text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<TITLE
>pgstattuple</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.6.2 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Additional Supplied Modules"
HREF="contrib.html"><LINK
REL="PREVIOUS"
TITLE="pg_stat_statements"
HREF="pgstatstatements.html"><LINK
REL="NEXT"
TITLE="pg_trgm"
HREF="pgtrgm.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2017-02-06T21:56:32">

PostgreSQL 9.6.2 Documentation

Prev	Up	Appendix F. Additional Supplied Modules	Next

F.30. pgstattuple

  The <TT
CLASS="FILENAME"
>pgstattuple</TT
> module provides various functions to
  obtain tuple-level statistics.

F.30.1. Functions

     pgstattuple(regclass) returns record

      pgstattuple returns a relation's physical length,
      percentage of "dead" tuples, and other info. This may help users
      to determine whether vacuum is necessary or not.  The argument is the
      target relation's name (optionally schema-qualified) or OID.
      For example:

test=> SELECT * FROM pgstattuple('pg_catalog.pg_proc');
-[ RECORD 1 ]------+-------
table_len          | 458752
tuple_count        | 1470
tuple_len          | 438896
tuple_percent      | 95.67
dead_tuple_count   | 11
dead_tuple_len     | 3157
dead_tuple_percent | 0.69
free_space         | 8932
free_percent       | 1.95

     The output columns are described in Table F-23.

Table F-23. pgstattuple Output Columns

<COL><COL><COL>

Column	Type	Description

<TT
CLASS="STRUCTFIELD"
>table_len</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Physical relation length in bytes

<TT
CLASS="STRUCTFIELD"
>tuple_count</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of live tuples

<TT
CLASS="STRUCTFIELD"
>tuple_len</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Total length of live tuples in bytes

<TT
CLASS="STRUCTFIELD"
>tuple_percent</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Percentage of live tuples

<TT
CLASS="STRUCTFIELD"
>dead_tuple_count</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of dead tuples

<TT
CLASS="STRUCTFIELD"
>dead_tuple_len</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Total length of dead tuples in bytes

<TT
CLASS="STRUCTFIELD"
>dead_tuple_percent</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Percentage of dead tuples

<TT
CLASS="STRUCTFIELD"
>free_space</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Total free space in bytes

<TT
CLASS="STRUCTFIELD"
>free_percent</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Percentage of free space

Note:         The <TT
CLASS="LITERAL"
>table_len</TT
> will always be greater than the sum
        of the <TT
CLASS="LITERAL"
>tuple_len</TT
>, <TT
CLASS="LITERAL"
>dead_tuple_len</TT
>
        and <TT
CLASS="LITERAL"
>free_space</TT
>. The difference is accounted for by
        fixed page overhead, the per-page table of pointers to tuples, and
        padding to ensure that tuples are correctly aligned.

     pgstattuple acquires only a read lock on the
     relation. So the results do not reflect an instantaneous snapshot;
     concurrent updates will affect them.

     pgstattuple judges a tuple is "dead" if
     HeapTupleSatisfiesDirty returns false.

pgstattuple(text) returns record

      This is the same as pgstattuple(regclass), except
      that the target relation is specified as TEXT. This function is kept
      because of backward-compatibility so far, and will be deprecated in
      some future release.

     pgstatindex(regclass) returns record

      pgstatindex returns a record showing information
      about a B-tree index.  For example:

test=> SELECT * FROM pgstatindex('pg_cast_oid_index');
-[ RECORD 1 ]------+------
version            | 2
tree_level         | 0
index_size         | 16384
root_block_no      | 1
internal_pages     | 0
leaf_pages         | 1
empty_pages        | 0
deleted_pages      | 0
avg_leaf_density   | 54.27
leaf_fragmentation | 0

     The output columns are:

<COL><COL><COL>

Column	Type	Description

<TT
CLASS="STRUCTFIELD"
>version</TT
>	<TT
CLASS="TYPE"
>integer</TT
>	B-tree version number

<TT
CLASS="STRUCTFIELD"
>tree_level</TT
>	<TT
CLASS="TYPE"
>integer</TT
>	Tree level of the root page

<TT
CLASS="STRUCTFIELD"
>index_size</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Total index size in bytes

<TT
CLASS="STRUCTFIELD"
>root_block_no</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Location of root page (zero if none)

<TT
CLASS="STRUCTFIELD"
>internal_pages</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of "internal" (upper-level) pages

<TT
CLASS="STRUCTFIELD"
>leaf_pages</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of leaf pages

<TT
CLASS="STRUCTFIELD"
>empty_pages</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of empty pages

<TT
CLASS="STRUCTFIELD"
>deleted_pages</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of deleted pages

<TT
CLASS="STRUCTFIELD"
>avg_leaf_density</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Average density of leaf pages

<TT
CLASS="STRUCTFIELD"
>leaf_fragmentation</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Leaf page fragmentation

     The reported <TT
CLASS="LITERAL"
>index_size</TT
> will normally correspond to one more
     page than is accounted for by <TT
CLASS="LITERAL"
>internal_pages + leaf_pages +
     empty_pages + deleted_pages</TT
>, because it also includes the
     index's metapage.

     As with pgstattuple, the results are accumulated
     page-by-page, and should not be expected to represent an
     instantaneous snapshot of the whole index.

pgstatindex(text) returns record

      This is the same as pgstatindex(regclass), except
      that the target index is specified as TEXT. This function is kept
      because of backward-compatibility so far, and will be deprecated in
      some future release.

     pgstatginindex(regclass) returns record

      pgstatginindex returns a record showing information
      about a GIN index.  For example:

test=> SELECT * FROM pgstatginindex('test_gin_index');
-[ RECORD 1 ]--+--
version        | 1
pending_pages  | 0
pending_tuples | 0

     The output columns are:

<COL><COL><COL>

Column	Type	Description

<TT
CLASS="STRUCTFIELD"
>version</TT
>	<TT
CLASS="TYPE"
>integer</TT
>	GIN version number

<TT
CLASS="STRUCTFIELD"
>pending_pages</TT
>	<TT
CLASS="TYPE"
>integer</TT
>	Number of pages in the pending list

<TT
CLASS="STRUCTFIELD"
>pending_tuples</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of tuples in the pending list

     pg_relpages(regclass) returns bigint

      pg_relpages returns the number of pages in the
      relation.

pg_relpages(text) returns bigint

      This is the same as pg_relpages(regclass), except
      that the target relation is specified as TEXT. This function is kept
      because of backward-compatibility so far, and will be deprecated in
      some future release.

     pgstattuple_approx(regclass) returns record

      pgstattuple_approx is a faster alternative to
      pgstattuple that returns approximate results.
      The argument is the target relation's name or OID.
      For example:

test=> SELECT * FROM pgstattuple_approx('pg_catalog.pg_proc'::regclass);
-[ RECORD 1 ]--------+-------
table_len            | 573440
scanned_percent      | 2
approx_tuple_count   | 2740
approx_tuple_len     | 561210
approx_tuple_percent | 97.87
dead_tuple_count     | 0
dead_tuple_len       | 0
dead_tuple_percent   | 0
approx_free_space    | 11996
approx_free_percent  | 2.09

      The output columns are described in Table F-24.

      Whereas pgstattuple always performs a
      full-table scan and returns an exact count of live and dead tuples
      (and their sizes) and free space, pgstattuple_approx
      tries to avoid the full-table scan and returns exact dead tuple
      statistics along with an approximation of the number and
      size of live tuples and free space.

      It does this by skipping pages that have only visible tuples
      according to the visibility map (if a page has the corresponding VM
      bit set, then it is assumed to contain no dead tuples). For such
      pages, it derives the free space value from the free space map, and
      assumes that the rest of the space on the page is taken up by live
      tuples.

      For pages that cannot be skipped, it scans each tuple, recording its
      presence and size in the appropriate counters, and adding up the
      free space on the page. At the end, it estimates the total number of
      live tuples based on the number of pages and tuples scanned (in the
      same way that VACUUM estimates pg_class.reltuples).

Table F-24. pgstattuple_approx Output Columns

<COL><COL><COL>

Column	Type	Description

<TT
CLASS="STRUCTFIELD"
>table_len</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Physical relation length in bytes (exact)

<TT
CLASS="STRUCTFIELD"
>scanned_percent</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Percentage of table scanned

<TT
CLASS="STRUCTFIELD"
>approx_tuple_count</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of live tuples (estimated)

<TT
CLASS="STRUCTFIELD"
>approx_tuple_len</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Total length of live tuples in bytes (estimated)

<TT
CLASS="STRUCTFIELD"
>approx_tuple_percent</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Percentage of live tuples

<TT
CLASS="STRUCTFIELD"
>dead_tuple_count</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Number of dead tuples (exact)

<TT
CLASS="STRUCTFIELD"
>dead_tuple_len</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Total length of dead tuples in bytes (exact)

<TT
CLASS="STRUCTFIELD"
>dead_tuple_percent</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Percentage of dead tuples

<TT
CLASS="STRUCTFIELD"
>approx_free_space</TT
>	<TT
CLASS="TYPE"
>bigint</TT
>	Total free space in bytes (estimated)

<TT
CLASS="STRUCTFIELD"
>approx_free_percent</TT
>	<TT
CLASS="TYPE"
>float8</TT
>	Percentage of free space

      In the above output, the free space figures may not match the
      pgstattuple output exactly, because the free
      space map gives us an exact figure, but is not guaranteed to be
      accurate to the byte.

F.30.2. Authors

   Tatsuo Ishii, Satoshi Nagayasu and Abhijit Menon-Sen

Prev	Home	Next

pg_stat_statements	Up	pg_trgm


text:
namespace CloudFoundry.VisualStudio
{
    internal enum CloudItemType
    {
        Target,
        Organization,
        Space,
        AppsCollection,
        ServicesCollection,
        RoutesCollection,
        App,
        Service,
        Route,
        LoadingPlaceholder,
        Error,
    }
}

redpajama_set_name: RedPajamaGithub


text:
package rx.internal.operators;

import java.util.Iterator;
import java.util.concurrent.atomic.AtomicInteger;

import rx.*;
import rx.Completable.*;
import rx.subscriptions.*;

public final class CompletableOnSubscribeConcatIterable implements CompletableOnSubscribe {
    final Iterable<? extends Completable> sources;

    public CompletableOnSubscribeConcatIterable(Iterable<? extends Completable> sources) {
        this.sources = sources;
    }

    @Override
    public void call(CompletableSubscriber s) {

        Iterator<? extends Completable> it;

        try {
            it = sources.iterator();
        } catch (Throwable e) {
            s.onSubscribe(Subscriptions.unsubscribed());
            s.onError(e);
            return;
        }

        if (it == null) {
            s.onSubscribe(Subscriptions.unsubscribed());
            s.onError(new NullPointerException("The iterator returned is null"));
            return;
        }

        ConcatInnerSubscriber inner = new ConcatInnerSubscriber(s, it);
        s.onSubscribe(inner.sd);
        inner.next();
    }

    static final class ConcatInnerSubscriber extends AtomicInteger implements CompletableSubscriber {
        /** */
        private static final long serialVersionUID = -7965400327305809232L;

        final CompletableSubscriber actual;
        final Iterator<? extends Completable> sources;

        int index;

        final SerialSubscription sd;

        public ConcatInnerSubscriber(CompletableSubscriber actual, Iterator<? extends Completable> sources) {
            this.actual = actual;
            this.sources = sources;
            this.sd = new SerialSubscription();
        }

        @Override
        public void onSubscribe(Subscription d) {
            sd.set(d);
        }

        @Override
        public void onError(Throwable e) {
            actual.onError(e);
        }

        @Override
        public void onCompleted() {
            next();
        }

        void next() {
            if (sd.isUnsubscribed()) {
                return;
            }

            if (getAndIncrement() != 0) {
                return;
            }

            Iterator<? extends Completable> a = sources;
            do {
                if (sd.isUnsubscribed()) {
                    return;
                }

                boolean b;
                try {
                    b = a.hasNext();
                } catch (Throwable ex) {
                    actual.onError(ex);
                    return;
                }

                if (!b) {
                    actual.onCompleted();
                    return;
                }

                Completable c;

                try {
                    c = a.next();
                } catch (Throwable ex) {
                    actual.onError(ex);
                    return;
                }

                if (c == null) {
                    actual.onError(new NullPointerException("The completable returned is null"));
                    return;
                }

                c.subscribe(this);
            } while (decrementAndGet() != 0);
        }
    }
}


text:
require File.expand_path(File.join(File.dirname(__FILE__), '../../helper'))

class Cloudfront
  module Helpers
    class OriginTest < MiniTest::Unit::TestCase

      def test_serialize_deserialize
        origin = Origin.new ({
          id: "test origin",
          domain_name: "example.com",
          http_port:  90,
          https_port: 90
        })

        xml = origin.to_xml
        xml_from_hash = Origin.from_hash(MultiXml.parse(xml)).to_xml
        assert_equal(xml_from_hash.strip, xml.strip)

        origin2 = Origin.new {
          self.id = "test origin 2"
          self.domain_name = "example2.com"
          self.origin_access_identity = "origin-access-identity/cloudfront/ID"
        }

        xml2 = origin2.to_xml
        xml_from_hash2 = Origin.from_hash(MultiXml.parse(xml2)).to_xml
        assert_equal(xml_from_hash2.strip, xml2.strip)
      end

    end
  end
end


text:
function setFrame(frame)
%SETFRAME function used for a scene, where the vertices are precalculated

global SCENE
numArmatures = SCENE.status.numArmatures;
numMarkers = SCENE.status.numMarkers;
for armature = 1:numArmatures
    % go to last frame of skel, if skel.nframes is < frame
    if(frame > SCENE.armatures(armature).mot.nframes)
        frameForSkel = SCENE.armatures(armature).mot.nframes;
    else
        frameForSkel = frame;
    end
    numBones = SCENE.armatures(armature).skel.njoints;
    for b = 1:numBones
        numVerts = size(SCENE.armatures(armature).bones(b).vertices,1);
        startIndex = ((frameForSkel-1)*numVerts+1);
        endIndex = startIndex - 1 + numVerts;
        currentVerts = SCENE.armatures(armature).bones(b).vertstream(startIndex:endIndex,:);
        if(SCENE.status.drawLabels)
            currentLabelPos = SCENE.armatures(armature).bones(b).labelStream(1:3,frameForSkel);
            set(SCENE.armatures(armature).bones(b).labelHandle,'Position',currentLabelPos);
        end
        set(SCENE.armatures(armature).bones(b).objectHandle,'Vertices',currentVerts);
    end
end
for i = 1:numMarkers
    if(frame > SCENE.markers(i).nframes)
        frameForMarker = SCENE.markers(i).nframes;
    else
        frameForMarker = frame;
    end
    numVerts = size(SCENE.markers(i).vertices,1);
    startIndex = ((frameForMarker-1)*numVerts+1);
    endIndex = startIndex - 1 + numVerts;
    currentVerts = SCENE.markers(i).vertstream(startIndex:endIndex,:);
    set(SCENE.markers(i).objectHandle,'vertices',currentVerts);
    set(SCENE.markers(i).objectHandle,'facealpha',...
        SCENE.markers(i).faceAlphaStream(frameForMarker));
    set(SCENE.markers(i).objectHandle,'facecolor',...
        SCENE.markers(i).colorStream(frameForMarker,:));
end

%setFrame for Objects
for i = 1:size(SCENE.animatedObjects,1)
    objID = SCENE.animatedObjects(i);
    obj = SCENE.objects(objID);
    if(frame > obj.nFrames)
        frameForObject = obj.nFrames;
    else
        frameForObject = frame;
    end
    numVerts = size(obj.vertices,1);
    startIndex = ((frameForObject-1)*numVerts+1);
    endIndex = startIndex - 1 + numVerts;
    currentVerts = obj.verticesStream(startIndex:endIndex,:);
    set(SCENE.objects(objID).objectHandle,'vertices',currentVerts);
    if(size(obj.faceAlphaStream,1)>1)
    set(SCENE.objects(objID).objectHandle,'facealpha',...
        SCENE.objects(objID).faceAlphaStream(frameForObject));
    end
    if(size(obj.faceColorStream,1)>1)
    set(SCENE.objects(objID).objectHandle,'facecolor',...
        SCENE.objects(objID).faceColorStream(frameForObject,:));
    end
end

% refresh status information
if ishandle(SCENE.status.sliderHandle)
    set(SCENE.status.sliderHandle,'Value',frame);
end
if ishandle(SCENE.status.curFrameLabel)
    set(SCENE.status.curFrameLabel,'String',...
        sprintf(' %d / %d',frame, SCENE.status.nframes));
end
curFPS = uint16(SCENE.status.curFps);
if (curFPS > SCENE.status.samplingRate)
    fps = sprintf('> %d fps', SCENE.status.samplingRate);
else
    fps = sprintf('%d fps', uint16(SCENE.status.curFps));
end
if ishandle(SCENE.status.curFpsLabel)
    set(SCENE.status.curFpsLabel, 'String',fps);
end
end


text:
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* Copyright 2010 litl, LLC.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#include <config.h>

#include <gwkjs/gwkjs-module.h>
#include <gwkjs/compat.h>
#include <cairo.h>
#include "cairo-private.h"

#if CAIRO_HAS_PS_SURFACE
#include <cairo-ps.h>

GWKJS_DEFINE_PROTO("CairoPSSurface", cairo_ps_surface, JSCLASS_BACKGROUND_FINALIZE)

GWKJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_ps_surface)
{
    GWKJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_ps_surface)
    char *filename;
    double width, height;
    cairo_surface_t *surface;

    GWKJS_NATIVE_CONSTRUCTOR_PRELUDE(cairo_ps_surface);

    if (!gwkjs_parse_call_args(context, "PSSurface", "sff", argv,
                        "filename", &filename,
                        "width", &width,
                        "height", &height))
        return JS_FALSE;

    surface = cairo_ps_surface_create(filename, width, height);

    if (!gwkjs_cairo_check_status(context, cairo_surface_status(surface),
                                "surface")) {
        g_free(filename);
        return JS_FALSE;
    }

    gwkjs_cairo_surface_construct(context, object, surface);
    cairo_surface_destroy(surface);
    g_free(filename);

    GWKJS_NATIVE_CONSTRUCTOR_FINISH(cairo_ps_surface);

    return JS_TRUE;
}

static void
gwkjs_cairo_ps_surface_finalize(JSFreeOp *fop,
                              JSObjectRef obj)
{
    gwkjs_cairo_surface_finalize_surface(fop, obj);
}

JSPropertySpec gwkjs_cairo_ps_surface_proto_props[] = {
    { NULL }
};

JSFunctionSpec gwkjs_cairo_ps_surface_proto_funcs[] = {
    // restrictToLevel
    // getLevels
    // levelToString
    // setEPS
    // getEPS
    // setSize
    // dscBeginSetup
    // dscBeginPageSetup
    // dscComment
    { NULL }
};

JSObjectRef
gwkjs_cairo_ps_surface_from_surface(JSContextRef       context,
                                  cairo_surface_t *surface)
{
    JSObjectRef object;

    g_return_val_if_fail(context != NULL, NULL);
    g_return_val_if_fail(surface != NULL, NULL);
    g_return_val_if_fail(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_PS, NULL);

    object = JS_NewObject(context, &gwkjs_cairo_ps_surface_class, NULL, NULL);
    if (!object) {
        gwkjs_throw(context, "failed to create ps surface");
        return NULL;
    }

    gwkjs_cairo_surface_construct(context, object, surface);

    return object;
}
#else
JSObjectRef
gwkjs_cairo_ps_surface_from_surface(JSContextRef       context,
                                  cairo_surface_t *surface)
{
    gwkjs_throw(context,
        "could not create PS surface, recompile cairo and gwkjs with "
        "PS support.");
    return NULL;
}
#endif /* CAIRO_HAS_PS_SURFACE */


text:
namespace base {
class SequencedTaskRunner;
class FilePath;
}

namespace testing {
class ScopedCrowdDenyPreloadDataOverride;
}

namespace {
struct PendingOrigin {
  PendingOrigin(
      url::Origin origin,
      base::OnceCallback<void(const chrome_browser_crowd_deny::SiteReputation*)>
          callback);
  ~PendingOrigin();

  url::Origin origin;
  base::OnceCallback<void(const chrome_browser_crowd_deny::SiteReputation*)>
      callback;
};
}  // namespace

// Stores information relevant for making permission decision on popular sites.
//
// The preloaded list contains reputation data for popular sites, and is
// distributed to Chrome clients ahead of time through the component updater.
// The purpose is to reduce the frequency of on-demand pings to Safe Browsing.
class CrowdDenyPreloadData {
 public:
  using SiteReputation = chrome_browser_crowd_deny::SiteReputation;
  using DomainToReputationMap = base::flat_map<std::string, SiteReputation>;
  using PreloadData = chrome_browser_crowd_deny::PreloadData;

  using SiteReputationCallback =
      base::OnceCallback<void(const SiteReputation*)>;

  CrowdDenyPreloadData();

  CrowdDenyPreloadData(const CrowdDenyPreloadData&) = delete;
  CrowdDenyPreloadData& operator=(const CrowdDenyPreloadData&) = delete;

  ~CrowdDenyPreloadData();

  static CrowdDenyPreloadData* GetInstance();

  // Delivers preloaded site reputation data for |origin| via |callback|.
  //
  // Because there is no way to establish the identity of insecure origins,
  // reputation data is only ever provided if |origin| has HTTPS scheme. The
  // port of |origin| is ignored.
  void GetReputationDataForSiteAsync(const url::Origin& origin,
                                     SiteReputationCallback callback);

  // Parses a single instance of chrome_browser_crowd_deny::PreloadData message
  // in binary wire format from the file at |preload_data_path|.
  void LoadFromDisk(const base::FilePath& preload_data_path,
                    const base::Version& version);

  inline const absl::optional<base::Version>& version_on_disk() {
    return version_on_disk_;
  }

  inline void set_is_ready_to_use_for_testing(bool is_ready) {
    is_ready_to_use_ = is_ready;
  }

  inline int get_pending_origins_queue_size_for_testing() {
    return origins_pending_verification_.size();
  }

  inline bool IsReadyToUse() { return is_ready_to_use_; }

 private:
  friend class testing::ScopedCrowdDenyPreloadDataOverride;
  friend class CrowdDenyPreloadDataTest;

  const SiteReputation* GetReputationDataForSite(
      const url::Origin& origin) const;
  void SetSiteReputations(DomainToReputationMap map);
  void CheckOriginsPendingVerification();
  DomainToReputationMap TakeSiteReputations();
  // The only moment when CrowdDenyPreloadData is not ready to use is during
  // loading from disk.
  bool is_ready_to_use_ = true;
  DomainToReputationMap domain_to_reputation_map_;
  scoped_refptr<base::SequencedTaskRunner> loading_task_runner_;
  absl::optional<base::Version> version_on_disk_;
  std::queue<PendingOrigin> origins_pending_verification_;
};

namespace testing {

// Overrides the production preload list, while the instance is in scope, with
// a testing list that is initially empty.
class ScopedCrowdDenyPreloadDataOverride {
 public:
  using SiteReputation = CrowdDenyPreloadData::SiteReputation;
  using DomainToReputationMap = CrowdDenyPreloadData::DomainToReputationMap;

  ScopedCrowdDenyPreloadDataOverride();
  ~ScopedCrowdDenyPreloadDataOverride();

  ScopedCrowdDenyPreloadDataOverride(
      const ScopedCrowdDenyPreloadDataOverride&) = delete;
  ScopedCrowdDenyPreloadDataOverride& operator=(
      const ScopedCrowdDenyPreloadDataOverride&) = delete;

  void SetOriginReputation(const url::Origin& origin,
                           SiteReputation site_reputation);
  void ClearAllReputations();

 private:
  DomainToReputationMap old_map_;
};

}  // namespace testing

#endif  // CHROME_BROWSER_PERMISSIONS_CROWD_DENY_PRELOAD_DATA_H_


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

namespace SPALM.SPSF.Library
{
    public class BCSMethod
    {
    }
}


text:
var effectComposer = require('./effectComposer');
var fxaa = require('./fxaa/fxaa');
var bloom = require('./bloom/bloom');
var vignette = require('./vignette/vignette');
var motionBlur = require('./motionBlur/motionBlur');
var dof = require('./dof/dof');
var particlesPass = require('./particlesPass/particlesPass');
var fboHelper = require('../fboHelper');

var undef;

exports.init = init;
exports.resize = resize;
exports.render = render;
exports.visualizeTarget = undef;

var _renderer;
var _scene;
var _camera;

function init(renderer, scene, camera) {

    _renderer = renderer;
    _scene = scene;
    _camera = _camera;

    effectComposer.init(renderer, scene, camera);

    // for less power machine, pass true
    // fxaa.init(true);

    particlesPass.init();
    effectComposer.queue.push(particlesPass);

    fxaa.init();
    effectComposer.queue.push(fxaa);

    dof.init();
    effectComposer.queue.push(dof);

    motionBlur.init();
    effectComposer.queue.push(motionBlur);

    bloom.init();
    effectComposer.queue.push(bloom);

    vignette.init();
    effectComposer.queue.push(vignette);

}

function resize(width, height) {
    effectComposer.resize(width, height);
}

function render(dt) {

    effectComposer.renderQueue(dt);

    if(exports.visualizeTarget) {
        fboHelper.copy(exports.visualizeTarget);
    }

}


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Android.Annotation;
using Android.Content;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Text;
using Android.Text.Method;
using Android.Util;
using Android.Views;
using Android.Views.InputMethods;
using Android.Widget;
using Java.Lang;
using Object = Java.Lang.Object;
using Math = System.Math;
using String = System.String;
using Codenutz.Controls.Extensions;
using Codenutz.Controls;
using Java.Interop;

namespace Codenutz.Controls
{
	public abstract class TokenCompleteTextView<T> : MultiAutoCompleteTextView, TextView.IOnEditorActionListener
		where T:class
	{
		public EventHandler<EventArgs> StateRestoring;
	    public EventHandler<EventArgs> StateRestored;

        #region Constants

		public const string TAG = "TokenAutoComplete";

		#endregion

		#region Private members

		private bool _isInitialized = false;
		private bool _isInInvalidate = false;
		private char[] _splitChars = { ',', ';' };
		private ITokenizer _tokenizer;
		private T _selectedItem;
		private bool _isHintVisible = false;
		private List<TokenImageSpan<T>> _hiddenSpans;
	    private bool _shouldFocusNext = false;
		private TokenTextWatcher<T> _textWatcher;
		private TokenSpanWatcher<T> _spanWatcher;
		private string _prefix = String.Empty;
		private Layout _lastLayout = null;
	    private ObservableCollection<T> _items;

        #endregion

        #region Properties

        public TokenDeleteStyle TokenDeletionStyle { get; protected set; } = TokenDeleteStyle._Parent;

        public virtual TokenClickStyle TokenClickStyle { get; protected set; }

		public bool IsTokenRemovable(T token) {
			return true;
		}

		public bool IsTokenClickStyleSelectable
		{
			get
			{
				switch (TokenClickStyle)
				{
					case TokenClickStyle.Select:
					case TokenClickStyle.SelectDeselect:
						return true;
					default:
						return false;
				}
			}
		}

		public virtual int TokenLimit { get; protected set; }

		public virtual string Prefix
		{
			get { return _prefix; }
		    set
			{
				_prefix = String.Empty;
			    EditableText?.Insert(0, value);
			    _prefix = value;
				UpdateHint();
			}
		}

	    public ObservableCollection<T> Items
	    {
	        get { return _items ?? (_items = new ObservableCollection<T>()); }
	    }

	    public bool IsInSavingState { get; set; }

		public bool IsFocusChanging { get; set; }

		public ITokenListener<T> Listener { get; set; }

		public virtual char[] SplitChars
		{
			get { return _splitChars; }
		    protected set
			{
				if (value[0] == ' ')
					value = new[] { value.Length > 1 ? value[1] : '§', value[0]};
				_splitChars = value;

				SetTokenizer(new CharacterTokenizer(value));
			}
		}

		public virtual bool AllowDuplicates { get; protected set; }

		public virtual bool PerformBestGuess { get; set; }

		public virtual bool AllowCollapse { get; set; }

		protected string CurrentCompletionText
		{
			get
			{
				if(_isHintVisible) return String.Empty;

				var end = SelectionEnd;
				var start = _tokenizer.FindTokenStart(EditableText, end);
				if (start < Prefix.Length)
				{
					start = Prefix.Length;
				}
			    return TextUtils.Substring(EditableText, start, end);
			}
		}

		protected float MaxTextWidth
		{
			get { return Width - PaddingLeft - PaddingRight; }
		}

		#endregion

		#region Constructors

		protected TokenCompleteTextView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
		{
			Initialize();
		}

		protected TokenCompleteTextView(Context context) : base(context)
		{
			Initialize();
		}

		protected TokenCompleteTextView(Context context, IAttributeSet attrs) : base(context, attrs)
		{
			Initialize();
		}

		protected TokenCompleteTextView(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr)
		{
			Initialize();
		}

		protected TokenCompleteTextView(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context, attrs, defStyleAttr, defStyleRes)
		{
			Initialize();
		}

        #endregion

        #region Abstract methods

        abstract protected View GetViewForObject(T target);

        abstract protected T DefaultObject(String completionText);

	    abstract protected TokenCompleteTextViewSavedState<T> CreateSavedState(IParcelable superState);

		#endregion

		#region Methods

		public override void Invalidate()
		{
			if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
			{
				Api16Invalidate();
			}

			base.Invalidate();
		}

		public override bool EnoughToFilter()
		{
			var text = EditableText;

			var end = SelectionEnd;
			if (end < 0 || _tokenizer == null)
				return false;

			var start = _tokenizer.FindTokenStart(text, end);
			if (start < Prefix.Length)
				start = Prefix.Length;

			return end - start >= Math.Max(Threshold, 1);
		}

		public override void PerformCompletion()
		{
			if (ListSelection == AdapterView.InvalidPosition && EnoughToFilter())
			{
				Object bestGuess;
				if (Adapter.Count > 0 && PerformBestGuess)
				{
					bestGuess = Adapter.GetItem(0);
				}
				else
				{
					var defaultObject = DefaultObject(CurrentCompletionText);
					bestGuess = new JavaObjectWrapper<T>(defaultObject);
				}

				var selection = ConvertSelectionToString(bestGuess);
				ReplaceText(selection);
			}
			else
			{
				base.PerformCompletion();
			}
		}

		protected override void PerformFiltering(ICharSequence text, int start, int end, int keyCode)
		{
			if (start < Prefix.Length)
			{
				start = Prefix.Length;
			}
			if (Filter != null)
			{
				Filter.InvokeFilter(text.SubSequenceFormatted(start, end), this);
			}
		}

		public override IInputConnection OnCreateInputConnection(EditorInfo outAttrs)
		{
			var superConn = base.OnCreateInputConnection(outAttrs);
			if (superConn != null) {
				var conn = new TokenInputConnection<T>(this, superConn, true);
				outAttrs.ImeOptions &= ImeFlags.NoEnterAction;
				outAttrs.ImeOptions |= ImeFlags.NoExtractUi;
				return conn;
			} else {
				return null;
			}
		}

		public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
		{
			var handled = base.OnKeyUp(keyCode, e);
			if (_shouldFocusNext)
			{
				_shouldFocusNext = false;
				HandleDone();
			}
			return handled;
		}

	    public void TrySomething()
	    {
            //PerformFiltering("test", (int)Keycode.A);
            base.PerformFiltering("test", (int)Keycode.A);
            //base.OnKeyDown(Keycode.A, new KeyEvent(KeyEventActions.Down, Keycode.A));
	    }

		public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
		{
			var handled = false;
			switch (keyCode)
			{
				case Keycode.Tab:
				case Keycode.Enter:
				case Keycode.DpadCenter:
					if (e.HasNoModifiers)
					{
						_shouldFocusNext = true;
						handled = true;
					}
					break;
				case Keycode.Del:
					handled =  !CanDeleteSelection(1) || DeleteSelectedObject(false);
					break;
			}

			return handled || base.OnKeyDown(keyCode, e);
		}

		public bool CanDeleteSelection(int beforeLength){
			if (Items.Count < 1)
				return true;

			var text = EditableText;

			int endSelection = SelectionEnd;
			int startSelection = beforeLength == 1 ? SelectionStart : endSelection - beforeLength;

			TokenImageSpan<T>[] spans = text.GetSpans<TokenImageSpan<T>>(0, Text.Length);

			foreach (var span in spans) {
				int startTokenSelection = text.GetSpanStart(span);
				int endTokenSelection = text.GetSpanEnd(span);

				// moving on, no need to check this token
				if (IsTokenRemovable(span.Token)) continue;

				if (startSelection == endSelection) {
					// Delete single
					if (endTokenSelection + 1 == endSelection) {
						return false;
					}
				} else {
					// Delete range
					// Don't delete if a non removable token is in range
					if (startSelection <= startTokenSelection
						&& endTokenSelection + 1 <= endSelection) {
						return false;
					}
				}
			}

			return true;
		}

		public override bool OnTouchEvent(MotionEvent e)
		{
			var action = e.ActionMasked;
			var text = EditableText;
			var handled = false;

			if (TokenClickStyle == TokenClickStyle.None)
			{
				handled = base.OnTouchEvent(e);
			}

			if (IsFocused && text != null && _lastLayout != null && action == MotionEventActions.Up)
			{
				var offset = GetOffsetForPosition(e.GetX(), e.GetY());

				if (offset != -1)
				{
					var links = text.GetSpans<TokenImageSpan<T>>(offset, offset);

					if (links.Length > 0)
					{
						links[0].OnClick();
						handled = true;
					}
					else
					{
						ClearSelections();
					}
				}
			}

			if (!handled && TokenClickStyle != TokenClickStyle.None)
			{
				handled = base.OnTouchEvent(e);
			}

			return handled;
		}

		public override bool ExtractText(ExtractedTextRequest request, ExtractedText outText)
		{
			try
			{
				return base.ExtractText(request, outText);
			}
			catch (IndexOutOfBoundsException ignored)
			{
				Log.Debug(TAG, "ExtractText hit IndexOutOfBoundsException. This may be normal.", ignored);
				return false;
			}
		}

		protected override void OnFocusChanged(bool gainFocus, FocusSearchDirection direction, Rect previouslyFocusedRect)
		{
			base.OnFocusChanged(gainFocus, direction, previouslyFocusedRect);

			if (!HasFocus) PerformCompletion();

			if(AllowCollapse) PerformCollapse(HasFocus);
		}

		protected override void OnSelectionChanged(int selStart, int selEnd)
		{
			if (_isHintVisible)
			{
				selStart = 0;
			}

			selEnd = selStart;

			if (IsTokenClickStyleSelectable)
			{
				if(EditableText != null)
					ClearSelections();
			}

		    if (EditableText == null || String.IsNullOrWhiteSpace(EditableText.ToString()))
		    {
                base.OnSelectionChanged(selStart, selEnd);
                return;
		    }

			if (Prefix != null && (selStart < Prefix.Length || selEnd < Prefix.Length))
			{

				SetSelection(Prefix.Length);
			}
			else
			{
				if (EditableText != null)
				{
					var spans = EditableText.GetSpans<TokenImageSpan<T>>(selStart, selEnd);
					foreach (var span in spans)
					{
						var spanEnd = EditableText.GetSpanEnd(span);
						if (selStart <= spanEnd && EditableText.GetSpanStart(span) < selStart)
						{
							if (spanEnd == EditableText.Length())
								SetSelection(spanEnd);
							else
								SetSelection(spanEnd + 1);
							return;
						}
					}
				}
				base.OnSelectionChanged(selStart, selEnd);
			}
		}

		protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
		{
			base.OnLayout(changed, left, top, right, bottom);
			_lastLayout = Layout;
		}

		protected override void ReplaceText(ICharSequence text)
		{
			ClearComposingText();

			if(_selectedItem == null  || _selectedItem.ToString().Equals(String.Empty)) return;

			var ssb = BuildSpannableForText(text.ToString());
			var tokenSpan = BuildSpanForItem(_selectedItem);

			var editable = EditableText;
			var end = SelectionEnd;
			var start = _tokenizer.FindTokenStart(editable, end);
			if (start < Prefix.Length)
			{
				start = Prefix.Length;
			}

			var original = TextUtils.Substring(editable, start, end);

			if (editable != null)
			{
				if (tokenSpan == null)
				{
					editable.Replace(start, end, String.Empty);
				}else if (!AllowDuplicates && Items.Contains(tokenSpan.Token))
				{
					editable.Replace(start, end, String.Empty);
				}
				else
				{
					QwertyKeyListener.MarkAsReplaced(editable, start, end, original);
					editable.Replace(start, end, ssb);
					editable.SetSpan(tokenSpan,start, start + ssb.Length() - 1, SpanTypes.ExclusiveExclusive);
				}
			}
		}

		public override void SetTokenizer(ITokenizer t)
		{
			base.SetTokenizer(t);
			_tokenizer = t;
		}

		public void PerformCollapse(bool hasFocus)
		{
			try
			{
				IsFocusChanging = true;
				var text = EditableText;

				if (!hasFocus)
				{
					if (text != null && _lastLayout != null)
					{
						var lastPosition = _lastLayout.GetLineVisibleEnd(0);
						var tokens = text.GetSpans<TokenImageSpan<T>>(0, lastPosition);
						var count = Items.Count - tokens.Length;

						var countSpans = text.GetSpans<CountSpan>(0, lastPosition);

						if (count > 0 && countSpans.Length == 0)
						{
							lastPosition++;

							var cs = new CountSpan(count, Context, new Color(CurrentTextColor), (int)TextSize, (int)MaxTextWidth);

							text.Insert(lastPosition, cs.Text);

							var newWidth = Layout.GetDesiredWidth(text, 0, lastPosition + cs.Text.Length, _lastLayout.Paint);

							if (newWidth > MaxTextWidth)
							{
								text.Delete(lastPosition, lastPosition + cs.Text.Length);

								if (tokens.Length > 0)
								{
									var token = tokens[tokens.Length - 1];
									lastPosition = text.GetSpanStart(token);
									cs.SetCount(count + 1);
								}
								else
								{
									lastPosition = Prefix.Length;
								}

								text.Insert(lastPosition, cs.Text);
							}

							text.SetSpan(cs, lastPosition, lastPosition + cs.Text.Length, SpanTypes.ExclusiveExclusive);

							_hiddenSpans =
								new List<TokenImageSpan<T>>(text.GetSpans<TokenImageSpan<T>>(lastPosition + cs.Text.Length, text.Length()));
							foreach (var span in _hiddenSpans)
							{
								RemoveSpan(span);
							}
						}
					}
				}
				else
				{
					if (text != null)
					{
						var counts = text.GetSpans<CountSpan>(0, text.Length());
						foreach (var count in counts)
						{
							text.Delete(text.GetSpanStart(count), text.GetSpanEnd(count));
							text.RemoveSpan(count);
						}

						foreach (var span in _hiddenSpans)
						{
							InsertSpan( span);
						}
						_hiddenSpans.Clear();

						if (_isHintVisible)
						{
							SetSelection(Prefix.Length);
						}
						else
						{
							PostDelayed(() =>
							{
								SetSelection(text.Length());
							}, 10);
						}

						var watchers = EditableText.GetSpans<TokenSpanWatcher<T>>(0, EditableText.Length());
						if (watchers.Length == 0)
							text.SetSpan(_spanWatcher, 0, text.Length(), SpanTypes.InclusiveInclusive);

					}
				}
			}
			finally
			{
				IsFocusChanging = false;
			}
		}

		public void ClearSelections()
		{
			if (EditableText == null) return;

			var length = EditableText.Length();
			var tokens = EditableText.GetSpans<TokenImageSpan<T>>(0, length);
			foreach (var token in tokens)
			{
				token.View.Selected = false;
			}

			Invalidate();
		}

		public void RemoveSpan(TokenImageSpan<T> span)
		{
			var text = EditableText;
			if(EditableText == null)return;

			var spans = text.GetSpans<TokenSpanWatcher<T>>(0, text.Length());
			if(spans.Length == 0)
				_spanWatcher.OnSpanRemoved(text, span, text.GetSpanStart(span),text.GetSpanEnd(span));

			text.Delete(text.GetSpanStart(span), text.GetSpanEnd(span) + 1);

			if(AllowCollapse && !IsFocused)
				UpdateCountSpan();
		}

		public void InsertSpan(T item, string sourceText)
		{
			var ssb = BuildSpannableForText(sourceText);
			var tokenSpan = BuildSpanForItem(item);

			var editable = EditableText;

		    if (editable == null)
		        return;

			if (!AllowCollapse || IsFocused || !_hiddenSpans.Any())
			{
				var offset = editable.Length();

				if (_isHintVisible)
				{
					offset = Prefix.Length;
					editable.Insert(offset, ssb);
				}
				else
				{
					var completionText = CurrentCompletionText;
					if (!string.IsNullOrEmpty(completionText))
					{
						offset = TextUtils.IndexOf(editable, completionText.ToAndroidString());
					}
					editable.Insert(offset, ssb);
				}
				editable.SetSpan(tokenSpan, offset, offset + ssb.Length() - 1, SpanTypes.ExclusiveExclusive);

				if (!IsFocused && AllowCollapse) PerformCollapse(false);

				if (!Items.Contains(item)) //not sure if this is right?!
				{
					_spanWatcher.OnSpanAdded(editable, tokenSpan, 0, 0);
				}
			}
			else
			{
				_hiddenSpans.Add(tokenSpan);
				_spanWatcher.OnSpanAdded(editable, tokenSpan, 0, 0);
				UpdateCountSpan();
			}
        }

		public void InsertSpan(T item)
		{
			InsertSpan(item, item.ToString());
		}

		public void InsertSpan(TokenImageSpan<T> span)
		{
			InsertSpan(span.Token);
		}

		public void AddItem(T item, string sourceText)
		{
			Post(() =>
			{
				if (item == null) return;
				if (!AllowDuplicates && Items.Contains(item)) return;
				if (TokenLimit != -1 && Items.Count == TokenLimit) return;
				InsertSpan(item, sourceText);
				if (EditableText != null && IsFocused) SetSelection(EditableText.Length());
			});
		}

		public void AddItem(T item)
		{
            AddItem(item, String.Empty);
		}

		public void RemoveItem(T item)
		{
			Post(() =>
			{
				var text = EditableText;
				if (text == null) return;

				var toRemove = new List<TokenImageSpan<T>>();
				foreach (var span in _hiddenSpans)
				{
					if(span.Token.Equals(item))
						toRemove.Add(span);
				}
				foreach (var span in toRemove)
				{
					_hiddenSpans.Remove(span);
					_spanWatcher.OnSpanRemoved(text, span, 0, 0);
				}

				UpdateCountSpan();

				var spans = text.GetSpans<TokenImageSpan<T>>(0, text.Length());
				foreach (var span in spans)
				{
					if(span.Token.Equals(item))
						RemoveSpan(span);
				}
			});
		}

		public void Clear(bool postToQueue = true)
		{
		    Action clearAction = () =>
		    {
		        var text = EditableText;
		        if (text == null) return;

		        var spans = text.GetSpans<TokenImageSpan<T>>(0, text.Length());
		        foreach (var span in spans)
		        {
		            RemoveSpan(span);
		            _spanWatcher.OnSpanRemoved(text, span, text.GetSpanStart(span), text.GetSpanEnd(span));
		        }
		    };
            if(postToQueue)
		        Post(clearAction);
            else
                clearAction.Invoke();
		}

	    public bool IsSplitChar(char c)
		{
			return SplitChars.Contains(c);
		}

		public void UpdateHint()
		{
			var text = EditableText;
			var hintText = Hint;
			if (text == null || hintText == null)
				return;

			if (Prefix.Length > 0)
			{
				var hints = text.GetSpans<HintSpan>(0, text.Length());
				HintSpan hint = null;

				var testLength = Prefix.Length;
				if (hints.Length > 0)
				{
					hint = hints[0];
					testLength += text.GetSpanEnd(hint) - text.GetSpanStart(hint);
				}

				if (text.Length() == testLength)
				{
					_isHintVisible = true;

					if (hint != null)
						return;

					var typeface = Typeface;
					var typefaceStyle = TypefaceStyle.Normal;
					if (typeface != null)
						typefaceStyle = typeface.Style;

					var colors = HintTextColors;

					var hintSpan = new HintSpan(null, typefaceStyle, (int) TextSize, colors, colors);
					text.Insert(Prefix.Length, hintText);
					text.SetSpan(hintSpan, Prefix.Length, Prefix.Length + Hint.Length, SpanTypes.ExclusiveExclusive);
					SetSelection(Prefix.Length);

				}
				else
				{
					if(hint == null)
						return;

					var spanStart = text.GetSpanStart(hint);
					var spanEnd = text.GetSpanEnd(hint);

					text.RemoveSpan(hint);
					text.Replace(spanStart, spanEnd, String.Empty);

					_isHintVisible = false;
				}

			}
		}

		public bool DeleteSelectedObject(bool handled)
		{
			if (IsTokenClickStyleSelectable)
			{
				if (EditableText == null) return handled;

				var spans = EditableText.GetSpans<TokenImageSpan<T>>(0, EditableText.Length());
				foreach (var span in spans)
				{
					if (span.View.Selected)
					{
						RemoveSpan(span);
						handled = true;
						break;
					}
				}
			}
			return handled;
		}

		protected override ICharSequence ConvertSelectionToStringFormatted(Object selectedItem)
		{
			_selectedItem = GetSelectedItem(selectedItem);

			ICharSequence result = null;
			switch (TokenDeletionStyle)
			{
				case TokenDeleteStyle.Clear:
					result = String.Empty.ToAndroidString();
					break;
				case TokenDeleteStyle.PartialCompletion:
					result = CurrentCompletionText.ToAndroidString();
					break;
				case TokenDeleteStyle.ToString:
					result = selectedItem != null ? selectedItem.ToString().ToAndroidString() : String.Empty.ToAndroidString();
					break;
				case TokenDeleteStyle._Parent:
				default:
					result = base.ConvertSelectionToStringFormatted(selectedItem);
					break;
			}
			return result;
		}

		private T GetSelectedItem(Object selectedItem)
		{
			if (selectedItem == null)
				return null;

			var wrappedSelection = selectedItem as JavaObjectWrapper<T>;

			if (wrappedSelection != null)
				return wrappedSelection.Obj;

			var propertyInfo = selectedItem.GetType().GetProperty("Instance");

			return propertyInfo == null ? null : propertyInfo.GetValue(selectedItem, null) as T;

		}

		private void Initialize()
		{
			if (_isInitialized) return;

            TokenLimit = -1;

			TokenClickStyle = TokenClickStyle.None;

			SetTokenizer(new CommaTokenizer());

			_spanWatcher = new TokenSpanWatcher<T>(this);
			_textWatcher = new TokenTextWatcher<T>(this);
			_hiddenSpans = new List<TokenImageSpan<T>>();

			AddListeners();

			SetTextIsSelectable(false);
			LongClickable = false;

			InputType = InputType | InputTypes.TextFlagNoSuggestions | InputTypes.TextFlagAutoComplete;
			SetHorizontallyScrolling(false);

			SetOnEditorActionListener(this);

			SetFilters(new IInputFilter[]
			{
				new TextFilter<T>(this)
			});

			//_deletionStyle = TokenDeleteStyle.Clear;
			_isInitialized = true;
		}

		[TargetApi(Value = (int)BuildVersionCodes.JellyBean)]
		private void Api16Invalidate()
		{
			if (_isInitialized && _isInInvalidate)
			{
				try
				{
					_isInInvalidate = true;
					SetShadowLayer(ShadowRadius, ShadowDx, ShadowDy, ShadowColor);
				}
				finally
				{
					_isInInvalidate = false;
				}
			}
		}

		protected void AddListeners()
		{
			if (EditableText != null)
			{
				EditableText.SetSpan(_spanWatcher,0, EditableText.Length(), SpanTypes.InclusiveInclusive);
				AddTextChangedListener(_textWatcher);
			}
		}

		protected void RemoveListeners()
		{
			if (EditableText != null)
			{
				var spanWatchers = EditableText.GetSpans<TokenSpanWatcher<T>>(0, EditableText.Length());
				foreach (var watcher in spanWatchers)
				{
					EditableText.RemoveSpan(watcher);
				}
				RemoveTextChangedListener(_textWatcher);
			}
		}

		private void HandleDone()
		{
			PerformCompletion();

			var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
			imm.HideSoftInputFromWindow(WindowToken, 0);
		}

		private SpannableStringBuilder BuildSpannableForText(string text)
		{
			char sentinel = SplitChars[0];
			return new SpannableStringBuilder(sentinel + _tokenizer.TerminateToken(text));
		}

		private TokenImageSpan<T> BuildSpanForItem(T item)
		{
			if (item == null)
				return null;

			var tokenView = GetViewForObject(item);
			return new TokenImageSpan<T>(tokenView, item, (int) MaxTextWidth, this);
		}

		private void UpdateCountSpan()
		{
			var text = EditableText;
			var counts = text.GetSpans<CountSpan>(0, text.Length());
			var newCount = _hiddenSpans.Count;
			foreach (var count in counts)
			{
				if (newCount == 0)
				{
					text.Delete(text.GetSpanStart(count), text.GetSpanEnd(count));
					text.RemoveSpan(count);
				}
				else
				{
					count.SetCount(_hiddenSpans.Count);
					text.SetSpan(count,text.GetSpanStart(count),text.GetSpanEnd(count),SpanTypes.ExclusiveExclusive);
				}
			}
		}

        #endregion

        #region Save state

        public override IParcelable OnSaveInstanceState()
        {
            RemoveListeners();

            IsInSavingState = true;
            var superState = base.OnSaveInstanceState();
            IsInSavingState = false;
            var state = CreateSavedState(superState);

            state.Prefix = Prefix;
            state.AllowCollapse = AllowCollapse;
            state.AllowDuplicates = AllowDuplicates;
            state.PerformBestGuess = PerformBestGuess;
            state.TokenClickStyle = TokenClickStyle;
            state.TokenDeleteStyle = TokenDeletionStyle;
            state.Items = new ObservableCollection<T>(Items);

            //Temporarily removed until I can work out whats causing the exception witrh SetTokenizer
            //state.SplitChars = SplitChars;

            AddListeners();

            return state;
        }

        public override void OnRestoreInstanceState(IParcelable state)
        {

			Post (() => {
				StateRestoring?.Invoke (this, EventArgs.Empty);
			});

            if (!(state is TokenCompleteTextViewSavedState<T>))
            {
                base.OnRestoreInstanceState(state);
                return;
            }

            var ss = (TokenCompleteTextViewSavedState<T>)state;
            base.OnRestoreInstanceState(ss.SuperState);

            Text = ss.Prefix;
            Prefix = ss.Prefix;
            UpdateHint();
            AllowCollapse = ss.AllowCollapse;
            AllowDuplicates = ss.AllowDuplicates;
            PerformBestGuess = ss.PerformBestGuess;
            TokenClickStyle = ss.TokenClickStyle;
            TokenDeletionStyle = ss.TokenDeleteStyle;

            //Temporarily removed until I can work out whats causing the exception witrh SetTokenizer
            //SplitChars = ss.SplitChars;

            AddListeners();
            foreach (var item in ss.Items)
            {
                AddItem(item);
            }

            // Collapse the view if necessary
            if (!IsFocused && AllowCollapse)
            {
                Post(() =>
                {
                    PerformCollapse(IsFocused);
                });
            }

            Post(() =>
            {
                StateRestored?.Invoke(this, EventArgs.Empty);
            });
        }

        #endregion

        #region IOnEditorActionListener members

        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
		{
			if (actionId == ImeAction.Done)
			{
				HandleDone();
				return true;
			}
			return false;
		}

		#endregion

	}

}


text:
/**
 * BillingDocumentInfo.java
 * <p>
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package com.microsoft.bingads.v11.customermanagement.entities;

public class BillingDocumentInfo implements java.io.Serializable {
    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
            new org.apache.axis.description.TypeDesc(BillingDocumentInfo.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "BillingDocumentInfo"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("accountId");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "AccountId"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("accountName");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "AccountName"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("accountNumber");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "AccountNumber"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("amount");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "Amount"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "double"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("currencyCode");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "CurrencyCode"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("documentDate");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "DocumentDate"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("documentId");
        elemField.setXmlName(new javax.xml.namespace.QName("https://bingads.microsoft.com/Customer/v11/Entities", "DocumentId"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        typeDesc.addFieldDesc(elemField);
    }

    private java.lang.Long accountId;
    private java.lang.String accountName;
    private java.lang.String accountNumber;
    private java.lang.Double amount;
    private java.lang.String currencyCode;
    private java.util.Calendar documentDate;
    private java.lang.Long documentId;
    private java.lang.Object __equalsCalc = null;
    private boolean __hashCodeCalc = false;

    public BillingDocumentInfo() {
    }

    public BillingDocumentInfo(
            java.lang.Long accountId,
            java.lang.String accountName,
            java.lang.String accountNumber,
            java.lang.Double amount,
            java.lang.String currencyCode,
            java.util.Calendar documentDate,
            java.lang.Long documentId) {
        this.accountId = accountId;
        this.accountName = accountName;
        this.accountNumber = accountNumber;
        this.amount = amount;
        this.currencyCode = currencyCode;
        this.documentDate = documentDate;
        this.documentId = documentId;
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
            java.lang.String mechType,
            java.lang.Class _javaType,
            javax.xml.namespace.QName _xmlType) {
        return
                new org.apache.axis.encoding.ser.BeanSerializer(
                        _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
            java.lang.String mechType,
            java.lang.Class _javaType,
            javax.xml.namespace.QName _xmlType) {
        return
                new org.apache.axis.encoding.ser.BeanDeserializer(
                        _javaType, _xmlType, typeDesc);
    }

    /**
     * Gets the accountId value for this BillingDocumentInfo.
     *
     * @return accountId
     */
    public java.lang.Long getAccountId() {
        return accountId;
    }

    /**
     * Sets the accountId value for this BillingDocumentInfo.
     *
     * @param accountId
     */
    public void setAccountId(java.lang.Long accountId) {
        this.accountId = accountId;
    }

    /**
     * Gets the accountName value for this BillingDocumentInfo.
     *
     * @return accountName
     */
    public java.lang.String getAccountName() {
        return accountName;
    }

    /**
     * Sets the accountName value for this BillingDocumentInfo.
     *
     * @param accountName
     */
    public void setAccountName(java.lang.String accountName) {
        this.accountName = accountName;
    }

    /**
     * Gets the accountNumber value for this BillingDocumentInfo.
     *
     * @return accountNumber
     */
    public java.lang.String getAccountNumber() {
        return accountNumber;
    }

    /**
     * Sets the accountNumber value for this BillingDocumentInfo.
     *
     * @param accountNumber
     */
    public void setAccountNumber(java.lang.String accountNumber) {
        this.accountNumber = accountNumber;
    }

    /**
     * Gets the amount value for this BillingDocumentInfo.
     *
     * @return amount
     */
    public java.lang.Double getAmount() {
        return amount;
    }

    /**
     * Sets the amount value for this BillingDocumentInfo.
     *
     * @param amount
     */
    public void setAmount(java.lang.Double amount) {
        this.amount = amount;
    }

    /**
     * Gets the currencyCode value for this BillingDocumentInfo.
     *
     * @return currencyCode
     */
    public java.lang.String getCurrencyCode() {
        return currencyCode;
    }

    /**
     * Sets the currencyCode value for this BillingDocumentInfo.
     *
     * @param currencyCode
     */
    public void setCurrencyCode(java.lang.String currencyCode) {
        this.currencyCode = currencyCode;
    }

    /**
     * Gets the documentDate value for this BillingDocumentInfo.
     *
     * @return documentDate
     */
    public java.util.Calendar getDocumentDate() {
        return documentDate;
    }

    /**
     * Sets the documentDate value for this BillingDocumentInfo.
     *
     * @param documentDate
     */
    public void setDocumentDate(java.util.Calendar documentDate) {
        this.documentDate = documentDate;
    }

    /**
     * Gets the documentId value for this BillingDocumentInfo.
     *
     * @return documentId
     */
    public java.lang.Long getDocumentId() {
        return documentId;
    }

    /**
     * Sets the documentId value for this BillingDocumentInfo.
     *
     * @param documentId
     */
    public void setDocumentId(java.lang.Long documentId) {
        this.documentId = documentId;
    }

    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof BillingDocumentInfo)) return false;
        BillingDocumentInfo other = (BillingDocumentInfo) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true &&
                ((this.accountId == null && other.getAccountId() == null) ||
                        (this.accountId != null &&
                                this.accountId.equals(other.getAccountId()))) &&
                ((this.accountName == null && other.getAccountName() == null) ||
                        (this.accountName != null &&
                                this.accountName.equals(other.getAccountName()))) &&
                ((this.accountNumber == null && other.getAccountNumber() == null) ||
                        (this.accountNumber != null &&
                                this.accountNumber.equals(other.getAccountNumber()))) &&
                ((this.amount == null && other.getAmount() == null) ||
                        (this.amount != null &&
                                this.amount.equals(other.getAmount()))) &&
                ((this.currencyCode == null && other.getCurrencyCode() == null) ||
                        (this.currencyCode != null &&
                                this.currencyCode.equals(other.getCurrencyCode()))) &&
                ((this.documentDate == null && other.getDocumentDate() == null) ||
                        (this.documentDate != null &&
                                this.documentDate.equals(other.getDocumentDate()))) &&
                ((this.documentId == null && other.getDocumentId() == null) ||
                        (this.documentId != null &&
                                this.documentId.equals(other.getDocumentId())));
        __equalsCalc = null;
        return _equals;
    }

    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getAccountId() != null) {
            _hashCode += getAccountId().hashCode();
        }
        if (getAccountName() != null) {
            _hashCode += getAccountName().hashCode();
        }
        if (getAccountNumber() != null) {
            _hashCode += getAccountNumber().hashCode();
        }
        if (getAmount() != null) {
            _hashCode += getAmount().hashCode();
        }
        if (getCurrencyCode() != null) {
            _hashCode += getCurrencyCode().hashCode();
        }
        if (getDocumentDate() != null) {
            _hashCode += getDocumentDate().hashCode();
        }
        if (getDocumentId() != null) {
            _hashCode += getDocumentId().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

}


text:
@interface TD_DatabaseManagerTests : CloudantTests

@end

@implementation TD_DatabaseManagerTests

- (void)testManager
{
    // RequireTestCase(TD_Database); how can I do this in XCode?
    TD_DatabaseManager* dbm =
        [TD_DatabaseManager createEmptyAtTemporaryPath:@"TD_DatabaseManagerTest"];

    CDTEncryptionKeyNilProvider* provider = [CDTEncryptionKeyNilProvider provider];
    TD_Database* db = [dbm databaseNamed:TD_DATABASEMANAGERTESTS_DATABASENAME];

    XCTAssertNotNil(db, @"TD_Database is nil in %s", __PRETTY_FUNCTION__);
    XCTAssertEqualObjects(db.name, TD_DATABASEMANAGERTESTS_DATABASENAME,
                          @"TD_Database.name is not \"%@\" in %s",
                          TD_DATABASEMANAGERTESTS_DATABASENAME, __PRETTY_FUNCTION__);
    XCTAssertEqualObjects(
        db.path.stringByDeletingLastPathComponent, dbm.directory,
        @"TD_Database path is not equal to path supplied by TD_DatabaseManager in %s",
        __PRETTY_FUNCTION__);

    XCTAssertTrue(!db.exists, @"TD_Database already exists in %s", __PRETTY_FUNCTION__);

    XCTAssertEqual([dbm databaseNamed:TD_DATABASEMANAGERTESTS_DATABASENAME], db,
                   @"TD_DatabaseManager is not aware of a database named \"foo\" in %s",
                   __PRETTY_FUNCTION__);

    XCTAssertEqualObjects(dbm.allDatabaseNames, @[],
                          @"TD_DatabaseManager reports some database already exists in %s",
                          __PRETTY_FUNCTION__);  // because foo doesn't exist yet

    XCTAssertTrue([db openWithEncryptionKeyProvider:provider],
                  @"TD_Database.open returned NO in %s", __PRETTY_FUNCTION__);
    XCTAssertTrue(db.exists, @"TD_Database does not exist in %s", __PRETTY_FUNCTION__);

    XCTAssertEqualObjects(
        dbm.allDatabaseNames, @[ TD_DATABASEMANAGERTESTS_DATABASENAME ],
        @"TD_DatabaseManager reports some database other than \"foo\" in %s",
        __PRETTY_FUNCTION__);  // because foo should now exist and be the only database here
}

- (void)testDeleteDatabaseReleaseMemoryIfDBWasRequestedBefore
{
    TD_DatabaseManager* dbm =
        [TD_DatabaseManager createEmptyAtTemporaryPath:@"TD_DatabaseManagerTest_releaseMemory"];

    [dbm databaseNamed:TD_DATABASEMANAGERTESTS_DATABASENAME];

    NSUInteger beforeDeletingCounter = [dbm.allOpenDatabases count];

    [dbm deleteDatabaseNamed:TD_DATABASEMANAGERTESTS_DATABASENAME error:nil];

    XCTAssertEqual([dbm.allOpenDatabases count], beforeDeletingCounter - 1,
                   @"Delete the db from memory, not only from disk");
}

- (void)testDeleteDatabaseDoNotReleaseMemoryIfDBWasNotRequestedBefore
{
    TD_DatabaseManager* dbm =
        [TD_DatabaseManager createEmptyAtTemporaryPath:@"TD_DatabaseManagerTest_notReleaseMemory"];

    NSUInteger beforeDeletingCounter = [dbm.allOpenDatabases count];

    [dbm deleteDatabaseNamed:TD_DATABASEMANAGERTESTS_DATABASENAME error:nil];

    XCTAssertEqual([dbm.allOpenDatabases count], beforeDeletingCounter,
                   @"DB was never loaded in memory");
}

- (void)testDeleteDatastoreReturnsErrorIfNameIsNotValid
{
    TD_DatabaseManager* dbm =
        [TD_DatabaseManager createEmptyAtTemporaryPath:@"TD_DatabaseManagerTest_returnError"];

    NSError *error = nil;
    BOOL deletionSucceeded = [dbm deleteDatabaseNamed:@"-.-" error:&error];

    BOOL isExpectedError = (error &&
                            ([error.domain isEqualToString:kTD_DatabaseManagerErrorDomain]) &&
                            (error.code == kTD_DatabaseManagerErrorCodeInvalidName));

    XCTAssertTrue(!deletionSucceeded && isExpectedError,
                  @"There is only one possible error if the name is not valid (%@, %lu)",
                  kTD_DatabaseManagerErrorDomain,
                  (unsigned long)kTD_DatabaseManagerErrorCodeInvalidName);
}

@end


text:
require 'spec_helper'
require 'rspec-api/requests'
require 'rack/test'

app = -> env {[200, {"Content-Type" => "application/json; charset=utf-8"}, ["[]"]] }

describe 'Examples from a Rack app', rspec_api: true do

  concerts_params = {
    adapter: [:rack, app],
    action: 'get',
    route: '/',
    collection: true
  }

  describe 'Concerts', rspec_api_params: concerts_params do
    respond_with :ok
  end
end


text:
<?php

namespace Symfony\Component\HttpFoundation\File\Exception;

/**
 * Thrown when an UPLOAD_ERR_FORM_SIZE error occurred with UploadedFile.
 *
 * @author Florent Mata <florentmata@gmail.com>
 */
class FormSizeFileException extends FileException
{
}


text:
/*
** GLOBAL
*/

	*, *::before, *::after{box-sizing:border-box; -moz-box-sizing: border-box;}

	/* overlay bleu */
	*{outline:none;}

	body{
		font-family: 'Raleway', 'Arial', 'Verdana', sans-serif;
		font-size:1em;
		line-height:1.2em;
	}

	h2{
		font-size:1.8em;
		text-transform: uppercase;
		font-weight:700;
		line-height:1.2em;
	}
	h3{font-size:1.5em; margin-bottom:15px;}

	p{margin-bottom:1em;}

	a{color:inherit; text-decoration:none;}
	a:hover{text-decoration:underline;}

	a.test{
		color:blue;
	}

	label, input[type=text], input[type=email], select, textarea{width:100%;}
	input[type=text],input[type=email], textarea{border:solid 1px black;}
	label{display:block; margin-bottom:5px;}
	input[type=text], input[type=email]{height:40px; padding-left:10px;}
	textarea{height:300px; resize:none; padding:10px;}

	select{border:solid 1px black;}
		@media screen and (-webkit-min-device-pixel-ratio:0) {  /*safari and chrome*/
			select{height:30px; line-height:30px; background:white;}
		}
		select::-moz-focus-inner{border:0; padding:0;} /*Remove button padding in FF*/
		@-moz-document url-prefix() { select{padding: 15px 0!important;} } /* targets Firefox only */
		@media screen\0 { select{height:30px; line-height:30px;} } /* IE Hacks: targets IE 8, 9 and 10 */

	input[type=submit], button[type=submit]{
		display:inline-block;
		border:none;
		padding:10px 30px;
		text-transform:uppercase;
		font-size:1.3em;
		cursor:pointer;
	}
	input[type=submit]:hover, button[type=submit]:hover{background-color:#f3e7d2;}

	form ul li{
		color:#cc3333;
	}

/*
** CLASSES
*/

	.ghost{clear:both;}

	.large-content, .content{position:relative; width:100%; margin:0 auto;}
	.large-content{max-width:1280px;}
	.content{max-width:960px;}

	.table-middle{display:table; height:100%; width:100%;}
	.cell-middle{display:table-cell; vertical-align:middle;}

	.left{float:left;}
	.right{float:right;}
	.full-width{width:100%;}
	.two-column{width:49%;}
	.one-third{width:32%;}
	.two-third{width:65%;}
	.column-left{margin-right:1%;}
	.column-right{margin-left:1%;}
	.column-middle{margin-left:1%; margin-right:1%;}

	.transition, .transition *{-webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;}

	.border{border:solid 1px #666;}
	.active{cursor:default;}

	.bg-cover{
		background-repeat:no-repeat;
		background-position:center center;
		-webkit-background-size:cover;
		-moz-background-size:cover;
		-o-background-size:cover;
		background-size:cover;
	}
		.bg-cover > img{width:100%;}

	.date{
		display:inline-block;
		margin-left:10px;
		font-size:0.8em;
		font-style:italic;
	}

	.pagination{text-align:center;}
		.pagination ul, .pagination ul li, .pagination ul li a{display:inline-block;}
		.pagination ul{margin:0 10px;}
			.pagination ul li a{margin:0 2px;}

	.btn{
		padding:10px;
		margin:5px 0;
		display:inline-block;
		font-weight:600;
	}
	.read-more{
		color:#17A29D;
		border:3px solid #17A29D;
	}
	.read-more:hover{
		background-color: #17A29D;
		color:#fff;
		text-decoration: none;
	}
	.aside-btn{
		color:#666;
		border:3px solid #666;
	}
	.aside-btn:hover{
		text-decoration: none;
		background-color: #666;
		color:#fff;
	}

	.notice{
		background-color: #17A29D;
		color:#fff;
	}

/*
** COULEURS
*/

	.black{color:black;}
	.blue-light{color:#17A29D;}
	.beige{color:#f3e7d2;}
	.grey{color:#858688;}
	.white{color:white;}
	.orange-logo{color:#FC8F55;}

	.bg-logo-grey{background-color:#666666;}
	.bg-black{background-color:black;}
	.bg-blue-light{background-color:#17A29D;}
	.bg-beige{background-color:#f3e7d2;}
	.bg-grey{background-color:#858688;}
	.bg-white{background-: ;color:white;}

/*
** TITLES
*/

	.title-experience{
		background-color:#17A29D;
		color:#FC8F55;
		padding:10px;
		margin-bottom: 10px;
		width:100%;
		display: block;
	}
	a.title-experience:hover{
		text-decoration: none;
		background-color: #FC8F55;
		color:#17A29D;
	}

/*
** HEADER
*/

	#header{padding:10px 30px; margin:0 0 40px 0;}
		#header nav ul{padding-top:15px;}
		#header nav ul li{display:inline-block; margin:0 10px; text-transform: uppercase; font-weight: bold}
		#header nav ul li:hover a{ text-decoration: none; color:#FC8F55;}

/*
** ASIDE
*/

	aside .content{padding:3% 5%;}
	aside > div.border{position:relative; margin-bottom:20px;}
	aside h2{
		width:100%;
		padding:10px;
		margin-bottom:20px;
	}

	#fastlinks ul li{position:relative; margin:10px 0 10px 10px; padding-left:10px;}
	#fastlinks ul li:before{
		content:'';
		position:absolute;
		width:6px; height:12px;
		left:-10px; top:3px;
		background:url(../images/global/arrow-list.png) left top no-repeat;
	}

/*
** INDEX
*/
	#last-exp{margin-bottom:20px;}
	.map{height:500px;}

/*
** EXPERIENCE
*/
	.detail-exp{margin-bottom:40px;}
		.detail-exp .map{height:250px;}

/*
** EXPERIENCES
*/
	#experiences article{margin-bottom:40px; padding-bottom:20px; border-bottom:solid 1px #17A29D;}

/*
** JE PARTICIPE
*/
	#participe label[for=form_participation_coacteur_jeu]{width:auto; display:inline-block;}
	/*#form_participation_parcours_coorDepart, #form_participation_parcours_coorArrivee{
		display: none;
	}*/

/*
** ACTUALITES
*/

	#actualites article:not(:last-child){margin-bottom:40px; padding-bottom:20px; border-bottom:solid 1px #17A29D;}
	#actualites article h3{display:inline-block;}

/*
** FOOTER
*/

	#footer{padding:5px 0;
		font-size:0.8em;
	margin-top:20px;}
		#footer nav ul, #footer nav ul li, #footer nav p{display:inline-block;}
		#footer nav:nth-child(1) ul li{margin:0 5px;}
			#footer nav:nth-child(1) ul li a{padding-right:5px;}


text:
import Ember from 'ember';

export default Ember.Service.extend({
  store: Ember.inject.service(),

  findByDomain(domain) {
    return this.get('store')
      .queryRecord('team', { filter: { domain } })
      .then(team => {
        if (!team) {
          const err = new Error('Not found');
          err.status = 404;
          throw err;
        }
        return team;
      });
  }
});


text:
================================================================================
GlobalMessageChangedEvent
================================================================================

.. describe:: Extends

    :py:class:`~pyvisdk.mo.session_event.SessionEvent`

.. class:: pyvisdk.do.global_message_changed_event.GlobalMessageChangedEvent

    .. py:attribute:: message

        The new message that was set.


text:
"""
Utility for caching master images.
"""

import os
import tempfile
import time
import uuid

from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import fileutils
import six

from ironic.common import exception
from ironic.common.glance_service import service_utils
from ironic.common.i18n import _
from ironic.common.i18n import _LI
from ironic.common.i18n import _LW
from ironic.common import image_service
from ironic.common import images
from ironic.common import utils

LOG = logging.getLogger(__name__)

img_cache_opts = [
    cfg.BoolOpt('parallel_image_downloads',
                default=False,
                help=_('Run image downloads and raw format conversions in '
                       'parallel.')),
]

CONF = cfg.CONF
CONF.register_opts(img_cache_opts)

# This would contain a sorted list of instances of ImageCache to be
# considered for cleanup. This list will be kept sorted in non-increasing
# order of priority.
_cache_cleanup_list = []

class ImageCache(object):
    """Class handling access to cache for master images."""

    def __init__(self, master_dir, cache_size, cache_ttl):
        """Constructor.

        :param master_dir: cache directory to work on
                           Value of None disables image caching.
        :param cache_size: desired maximum cache size in bytes
        :param cache_ttl: cache entity TTL in seconds
        """
        self.master_dir = master_dir
        self._cache_size = cache_size
        self._cache_ttl = cache_ttl
        if master_dir is not None:
            fileutils.ensure_tree(master_dir)

    def fetch_image(self, href, dest_path, ctx=None, force_raw=True):
        """Fetch image by given href to the destination path.

        Does nothing if destination path exists and is up to date with cache
        and href contents.
        Only creates a hard link (dest_path) to cached image if requested
        image is already in cache and up to date with href contents.
        Otherwise downloads an image, stores it in cache and creates a hard
        link (dest_path) to it.

        :param href: image UUID or href to fetch
        :param dest_path: destination file path
        :param ctx: context
        :param force_raw: boolean value, whether to convert the image to raw
                          format
        """
        img_download_lock_name = 'download-image'
        if self.master_dir is None:
            # NOTE(ghe): We don't share images between instances/hosts
            if not CONF.parallel_image_downloads:
                with lockutils.lock(img_download_lock_name, 'ironic-'):
                    _fetch(ctx, href, dest_path, force_raw)
            else:
                _fetch(ctx, href, dest_path, force_raw)
            return

        # TODO(ghe): have hard links and counts the same behaviour in all fs

        # NOTE(vdrok): File name is converted to UUID if it's not UUID already,
        # so that two images with same file names do not collide
        if service_utils.is_glance_image(href):
            master_file_name = service_utils.parse_image_ref(href)[0]
        else:
            # NOTE(vdrok): Doing conversion of href in case it's unicode
            # string, UUID cannot be generated for unicode strings on python 2.
            href_encoded = href.encode('utf-8') if six.PY2 else href
            master_file_name = str(uuid.uuid5(uuid.NAMESPACE_URL,
                                              href_encoded))
        master_path = os.path.join(self.master_dir, master_file_name)

        if CONF.parallel_image_downloads:
            img_download_lock_name = 'download-image:%s' % master_file_name

        # TODO(dtantsur): lock expiration time
        with lockutils.lock(img_download_lock_name, 'ironic-'):
            # NOTE(vdrok): After rebuild requested image can change, so we
            # should ensure that dest_path and master_path (if exists) are
            # pointing to the same file and their content is up to date
            cache_up_to_date = _delete_master_path_if_stale(master_path, href,
                                                            ctx)
            dest_up_to_date = _delete_dest_path_if_stale(master_path,
                                                         dest_path)

            if cache_up_to_date and dest_up_to_date:
                LOG.debug("Destination %(dest)s already exists "
                          "for image %(href)s",
                          {'href': href, 'dest': dest_path})
                return

            if cache_up_to_date:
                # NOTE(dtantsur): ensure we're not in the middle of clean up
                with lockutils.lock('master_image', 'ironic-'):
                    os.link(master_path, dest_path)
                LOG.debug("Master cache hit for image %(href)s",
                          {'href': href})
                return

            LOG.info(_LI("Master cache miss for image %(href)s, "
                         "starting download"),
                     {'href': href})
            self._download_image(
                href, master_path, dest_path, ctx=ctx, force_raw=force_raw)

        # NOTE(dtantsur): we increased cache size - time to clean up
        self.clean_up()

    def _download_image(self, href, master_path, dest_path, ctx=None,
                        force_raw=True):
        """Download image by href and store at a given path.

        This method should be called with uuid-specific lock taken.

        :param href: image UUID or href to fetch
        :param master_path: destination master path
        :param dest_path: destination file path
        :param ctx: context
        :param force_raw: boolean value, whether to convert the image to raw
                          format
        """
        # TODO(ghe): timeout and retry for downloads
        # TODO(ghe): logging when image cannot be created
        tmp_dir = tempfile.mkdtemp(dir=self.master_dir)
        tmp_path = os.path.join(tmp_dir, href.split('/')[-1])

        try:
            _fetch(ctx, href, tmp_path, force_raw)
            # NOTE(dtantsur): no need for global lock here - master_path
            # will have link count >1 at any moment, so won't be cleaned up
            os.link(tmp_path, master_path)
            os.link(master_path, dest_path)
        finally:
            utils.rmtree_without_raise(tmp_dir)

    @lockutils.synchronized('master_image', 'ironic-')
    def clean_up(self, amount=None):
        """Clean up directory with images, keeping cache of the latest images.

        Files with link count >1 are never deleted.
        Protected by global lock, so that no one messes with master images
        after we get listing and before we actually delete files.

        :param amount: if present, amount of space to reclaim in bytes,
                       cleaning will stop, if this goal was reached,
                       even if it is possible to clean up more files
        """
        if self.master_dir is None:
            return

        LOG.debug("Starting clean up for master image cache %(dir)s" %
                  {'dir': self.master_dir})

        amount_copy = amount
        listing = _find_candidates_for_deletion(self.master_dir)
        survived, amount = self._clean_up_too_old(listing, amount)
        if amount is not None and amount <= 0:
            return
        amount = self._clean_up_ensure_cache_size(survived, amount)
        if amount is not None and amount > 0:
            LOG.warning(
                _LW("Cache clean up was unable to reclaim %(required)d "
                    "MiB of disk space, still %(left)d MiB required"),
                {'required': amount_copy / 1024 / 1024,
                 'left': amount / 1024 / 1024})

    def _clean_up_too_old(self, listing, amount):
        """Clean up stage 1: drop images that are older than TTL.

        This method removes files all files older than TTL seconds
        unless 'amount' is non-None. If 'amount' is non-None,
        it starts removing files older than TTL seconds,
        oldest first, until the required 'amount' of space is reclaimed.

        :param listing: list of tuples (file name, last used time)
        :param amount: if not None, amount of space to reclaim in bytes,
                       cleaning will stop, if this goal was reached,
                       even if it is possible to clean up more files
        :returns: tuple (list of files left after clean up,
                         amount still to reclaim)
        """
        threshold = time.time() - self._cache_ttl
        survived = []
        for file_name, last_used, stat in listing:
            if last_used < threshold:
                try:
                    os.unlink(file_name)
                except EnvironmentError as exc:
                    LOG.warning(_LW("Unable to delete file %(name)s from "
                                    "master image cache: %(exc)s"),
                                {'name': file_name, 'exc': exc})
                else:
                    if amount is not None:
                        amount -= stat.st_size
                        if amount <= 0:
                            amount = 0
                            break
            else:
                survived.append((file_name, last_used, stat))
        return survived, amount

    def _clean_up_ensure_cache_size(self, listing, amount):
        """Clean up stage 2: try to ensure cache size < threshold.

        Try to delete the oldest files until conditions is satisfied
        or no more files are eligible for deletion.

        :param listing: list of tuples (file name, last used time)
        :param amount: amount of space to reclaim, if possible.
                       if amount is not None, it has higher priority than
                       cache size in settings
        :returns: amount of space still required after clean up
        """
        # NOTE(dtantsur): Sort listing to delete the oldest files first
        listing = sorted(listing,
                         key=lambda entry: entry[1],
                         reverse=True)
        total_listing = (os.path.join(self.master_dir, f)
                         for f in os.listdir(self.master_dir))
        total_size = sum(os.path.getsize(f)
                         for f in total_listing)
        while listing and (total_size > self._cache_size or
                           (amount is not None and amount > 0)):
            file_name, last_used, stat = listing.pop()
            try:
                os.unlink(file_name)
            except EnvironmentError as exc:
                LOG.warning(_LW("Unable to delete file %(name)s from "
                                "master image cache: %(exc)s"),
                            {'name': file_name, 'exc': exc})
            else:
                total_size -= stat.st_size
                if amount is not None:
                    amount -= stat.st_size

        if total_size > self._cache_size:
            LOG.info(_LI("After cleaning up cache dir %(dir)s "
                         "cache size %(actual)d is still larger than "
                         "threshold %(expected)d"),
                     {'dir': self.master_dir, 'actual': total_size,
                      'expected': self._cache_size})
        return max(amount, 0) if amount is not None else 0

def _find_candidates_for_deletion(master_dir):
    """Find files eligible for deletion i.e. with link count ==1.

    :param master_dir: directory to operate on
    :returns: iterator yielding tuples (file name, last used time, stat)
    """
    for filename in os.listdir(master_dir):
        filename = os.path.join(master_dir, filename)
        stat = os.stat(filename)
        if not os.path.isfile(filename) or stat.st_nlink > 1:
            continue
        # NOTE(dtantsur): Detect most recently accessed files,
        # seeing atime can be disabled by the mount option
        # Also include ctime as it changes when image is linked to
        last_used_time = max(stat.st_mtime, stat.st_atime, stat.st_ctime)
        yield filename, last_used_time, stat

def _free_disk_space_for(path):
    """Get free disk space on a drive where path is located."""
    stat = os.statvfs(path)
    return stat.f_frsize * stat.f_bavail

def _fetch(context, image_href, path, force_raw=False):
    """Fetch image and convert to raw format if needed."""
    path_tmp = "%s.part" % path
    images.fetch(context, image_href, path_tmp, force_raw=False)
    # Notes(yjiang5): If glance can provide the virtual size information,
    # then we can firstly clean cache and then invoke images.fetch().
    if force_raw:
        required_space = images.converted_size(path_tmp)
        directory = os.path.dirname(path_tmp)
        _clean_up_caches(directory, required_space)
        images.image_to_raw(image_href, path, path_tmp)
    else:
        os.rename(path_tmp, path)

def _clean_up_caches(directory, amount):
    """Explicitly cleanup caches based on their priority (if required).

    :param directory: the directory (of the cache) to be freed up.
    :param amount: amount of space to reclaim.
    :raises: InsufficientDiskSpace exception, if we cannot free up enough space
    after trying all the caches.
    """
    free = _free_disk_space_for(directory)

    if amount < free:
        return

    # NOTE(dtantsur): filter caches, whose directory is on the same device
    st_dev = os.stat(directory).st_dev

    caches_to_clean = [x[1]() for x in _cache_cleanup_list]
    caches = (c for c in caches_to_clean
              if os.stat(c.master_dir).st_dev == st_dev)
    for cache_to_clean in caches:
        cache_to_clean.clean_up(amount=(amount - free))
        free = _free_disk_space_for(directory)
        if amount < free:
            break
    else:
        raise exception.InsufficientDiskSpace(path=directory,
                                              required=amount / 1024 / 1024,
                                              actual=free / 1024 / 1024,
                                              )

def clean_up_caches(ctx, directory, images_info):
    """Explicitly cleanup caches based on their priority (if required).

    This cleans up the caches to free up the amount of space required for the
    images in images_info. The caches are cleaned up one after the other in
    the order of their priority.  If we still cannot free up enough space
    after trying all the caches, this method throws exception.

    :param ctx: context
    :param directory: the directory (of the cache) to be freed up.
    :param images_info: a list of tuples of the form (image_uuid,path)
        for which space is to be created in cache.
    :raises: InsufficientDiskSpace exception, if we cannot free up enough space
    after trying all the caches.
    """
    total_size = sum(images.download_size(ctx, uuid)
                     for (uuid, path) in images_info)
    _clean_up_caches(directory, total_size)

def cleanup(priority):
    """Decorator method for adding cleanup priority to a class."""
    def _add_property_to_class_func(cls):
        _cache_cleanup_list.append((priority, cls))
        _cache_cleanup_list.sort(reverse=True, key=lambda tuple_: tuple_[0])
        return cls

    return _add_property_to_class_func

def _delete_master_path_if_stale(master_path, href, ctx):
    """Delete image from cache if it is not up to date with href contents.

    :param master_path: path to an image in master cache
    :param href: image href
    :param ctx: context to use
    :returns: True if master_path is up to date with href contents,
        False if master_path was stale and was deleted or it didn't exist
    """
    if service_utils.is_glance_image(href):
        # Glance image contents cannot be updated without changing image's UUID
        return os.path.exists(master_path)
    if os.path.exists(master_path):
        img_service = image_service.get_image_service(href, context=ctx)
        img_mtime = img_service.show(href).get('updated_at')
        if not img_mtime:
            # This means that href is not a glance image and doesn't have an
            # updated_at attribute
            LOG.warning(_LW("Image service couldn't determine last "
                            "modification time of %(href)s, considering "
                            "cached image up to date."), {'href': href})
            return True
        master_mtime = utils.unix_file_modification_datetime(master_path)
        if img_mtime <= master_mtime:
            return True
        # Delete image from cache as it is outdated
        LOG.info(_LI('Image %(href)s was last modified at %(remote_time)s. '
                     'Deleting the cached copy "%(cached_file)s since it was '
                     'last modified at %(local_time)s and may be outdated.'),
                 {'href': href, 'remote_time': img_mtime,
                  'local_time': master_mtime, 'cached_file': master_path})

        os.unlink(master_path)
    return False

def _delete_dest_path_if_stale(master_path, dest_path):
    """Delete dest_path if it does not point to cached image.

    :param master_path: path to an image in master cache
    :param dest_path: hard link to an image
    :returns: True if dest_path points to master_path, False if dest_path was
        stale and was deleted or it didn't exist
    """
    dest_path_exists = os.path.exists(dest_path)
    if not dest_path_exists:
        # Image not cached, re-download
        return False
    master_path_exists = os.path.exists(master_path)
    if (not master_path_exists or
            os.stat(master_path).st_ino != os.stat(dest_path).st_ino):
        # Image exists in cache, but dest_path out of date
        os.unlink(dest_path)
        return False
    return True


text:
package org.unitime.timetable.model.base;

import java.io.Serializable;

import org.unitime.timetable.model.ContactCategory;
import org.unitime.timetable.model.RefTableEntry;

/**
 * Do not change this class. It has been automatically generated using ant create-model.
 * @see org.unitime.commons.ant.CreateBaseModelFromXml
 */
public abstract class BaseContactCategory extends RefTableEntry implements Serializable {
	private static final long serialVersionUID = 1L;

	private String iMessage;
	private Boolean iHasRole;
	private String iEmail;

	public static String PROP_MESSAGE = "message";
	public static String PROP_HAS_ROLE = "hasRole";
	public static String PROP_EMAIL = "email";

	public BaseContactCategory() {
		initialize();
	}

	public BaseContactCategory(Long uniqueId) {
		setUniqueId(uniqueId);
		initialize();
	}

	protected void initialize() {}

	public String getMessage() { return iMessage; }
	public void setMessage(String message) { iMessage = message; }

	public Boolean isHasRole() { return iHasRole; }
	public Boolean getHasRole() { return iHasRole; }
	public void setHasRole(Boolean hasRole) { iHasRole = hasRole; }

	public String getEmail() { return iEmail; }
	public void setEmail(String email) { iEmail = email; }

	public boolean equals(Object o) {
		if (o == null || !(o instanceof ContactCategory)) return false;
		if (getUniqueId() == null || ((ContactCategory)o).getUniqueId() == null) return false;
		return getUniqueId().equals(((ContactCategory)o).getUniqueId());
	}

	public int hashCode() {
		if (getUniqueId() == null) return super.hashCode();
		return getUniqueId().hashCode();
	}

	public String toString() {
		return "ContactCategory["+getUniqueId()+" "+getLabel()+"]";
	}

	public String toDebugString() {
		return "ContactCategory[" +
			"\n	Email: " + getEmail() +
			"\n	HasRole: " + getHasRole() +
			"\n	Label: " + getLabel() +
			"\n	Message: " + getMessage() +
			"\n	Reference: " + getReference() +
			"\n	UniqueId: " + getUniqueId() +
			"]";
	}
}