text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W28758_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans23.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DXY

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">OXY USA
DUNN COUNTY, ND RAPHAEL/KENNETH STROH PAD RAPHAEL STROH 4-13-24H-143-97

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">RAPHAEL STROH 4-13-24H-143-97

    <p class="styleSans12.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Plan: Design #4

    <p class="styleSans20.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Standard Planning Report
28 May, 2014

    <p class="styleSans27.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">V Weatherlortr


text:
        Convert to a list in {{service.name}}.

        {{ service.state }}

redpajama_set_name: RedPajamaGithub


text:
# ghrhinodoc.py - utility functions for manipulating the RhinoDoc database from within Grasshopper

import Rhino
import System.Guid

#================================================================
def fetch_or_create_layer_index(name):
    """Given a layer name, return the integer layer index value.  If the layer doesn't exist, create it."""
    layers = Rhino.RhinoDoc.ActiveDoc.Layers
    existing = layers.Find(name, True) # flag: ignore deleted layers

    if existing == -1:
        # create a new layer in the active document
        new_layer = Rhino.DocObjects.Layer()
        new_layer.Name = name
        return layers.Add(new_layer)
    else:
        return existing
#================================================================
def add_geometry(geometry, layer_index = None, name = None):
    """Add the general geometry object (type GeometryBase) to the document,
    optionally on the given layer, and optionally with the given object name.
    Returns the GUID of the new DocObject wrapping the geometry object.
    This GUID is only valid within the RhinoDoc database.
    """

    attributes = Rhino.DocObjects.ObjectAttributes()
    if layer_index is not None:
        attributes.LayerIndex = layer_index
    if name is not None:
        attributes.Name = name
    return Rhino.RhinoDoc.ActiveDoc.Objects.Add(geometry, attributes)

#================================================================
def all_doc_objects(layer):
    """Return a list of all DocObjects on the given layer, specified by layer name."""
    return Rhino.RhinoDoc.ActiveDoc.Objects.FindByLayer(layer)

#================================================================
def find_ghdoc_geometry(ghdoc, gobj):
    """Find the Rhino.Geometry object identified by the given script input.  If an
    input has a 'ghdoc' type hint supplied, it will be supplied as a GUID
    identifying an object in the ghdoc document, and this function looks up the
    object.  Otherwise, it may be supplied as a Rhino.Geometry object which is
    simply returned.
    """

    if type(gobj) is System.Guid:
        # print "Looking up object GUID in Grasshopper document."
        # Find() returns an AttributedGeometry object with properties Geometry and ObjectAttributes
        item = ghdoc.Objects.Find(gobj)
        # print "Item is", item, type(item)
        return item.Geometry

    else:
        # print "Geometry was directly supplied."
        return gobj

#================================================================


text:
<?xml version="1.0" encoding="UTF-8" ?>
<introContent>
   <extensionContent id="org.eclipse.wtp" name="WTP" style="css/overview.css" path="whatsnew/@">
     <group id="content-group" style-id="content-group">
    	<link style-id="content-link" label="Web development tools" url="http://www.eclipse.org/webtools/development/news/main.php" id="wtp">
      		<text>The Eclipse Web Tools Platform (WTP) project extends the Eclipse platform with tools for developing Web and Java EE applications. In these pages you will find the New and Noteworthy about our releases</text>
    	</link>
     </group>
  </extensionContent>
</introContent>


text:
"use strict";

exports.Server = require('./Server').Server;


text:
"""Add collection some fields.

Revision ID: 8dff301e1b1f
Revises: 23c4b0bf13bf
Create Date: 2020-06-15 19:41:23.953882

"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = "8dff301e1b1f"
down_revision = "23c4b0bf13bf"

def upgrade():
    op.add_column(
        "collection", sa.Column("frequency", sa.Unicode(), nullable=True)
    )  # noqa
    op.add_column(
        "collection", sa.Column("restricted", sa.Boolean(), nullable=True)
    )  # noqa
    op.add_column("collection", sa.Column("xref", sa.Boolean(), nullable=True))  # noqa

def downgrade():
    pass


text:
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef CTR_H
#define CTR_H 1

#include "blapii.h"

/* This structure is defined in this header because both ctr.c and gcm.c
 * need it. */
struct CTRContextStr {
   freeblCipherFunc cipher;
   void *context;
   unsigned char counter[MAX_BLOCK_SIZE];
   unsigned char buffer[MAX_BLOCK_SIZE];
   unsigned long counterBits;
   unsigned int bufPtr;
};

typedef struct CTRContextStr CTRContext;

SECStatus CTR_InitContext(CTRContext *ctr, void *context,
			freeblCipherFunc cipher, const unsigned char *param,
			unsigned int blocksize);

/*
 * The context argument is the inner cipher context to use with cipher. The
 * CTRContext does not own context. context needs to remain valid for as long
 * as the CTRContext is valid.
 *
 * The cipher argument is a block cipher in the ECB encrypt mode.
 */
CTRContext * CTR_CreateContext(void *context, freeblCipherFunc cipher,
			const unsigned char *param, unsigned int blocksize);

void CTR_DestroyContext(CTRContext *ctr, PRBool freeit);

SECStatus CTR_Update(CTRContext *ctr, unsigned char *outbuf,
			unsigned int *outlen, unsigned int maxout,
			const unsigned char *inbuf, unsigned int inlen,
			unsigned int blocksize);

#ifdef USE_HW_AES
SECStatus CTR_Update_HW_AES(CTRContext *ctr, unsigned char *outbuf,
			unsigned int *outlen, unsigned int maxout,
			const unsigned char *inbuf, unsigned int inlen,
			unsigned int blocksize);
#endif

#endif


text:
require 'spec_helper'

feature 'Pipeline Schedules', :js do
  include PipelineSchedulesHelper

  let!(:project) { create(:project, :repository) }
  let!(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) }
  let!(:pipeline) { create(:ci_pipeline, pipeline_schedule: pipeline_schedule) }
  let(:scope) { nil }
  let!(:user) { create(:user) }

  context 'logged in as master' do
    before do
      project.add_master(user)
      gitlab_sign_in(user)
    end

    describe 'GET /projects/pipeline_schedules' do
      before do
        visit_pipelines_schedules
      end

      describe 'The view' do
        it 'displays the required information description' do
          page.within('.pipeline-schedule-table-row') do
            expect(page).to have_content('pipeline schedule')
            expect(find(".next-run-cell time")['data-original-title'])
              .to include(pipeline_schedule.real_next_run.strftime('%b %-d, %Y'))
            expect(page).to have_link('master')
            expect(page).to have_link("##{pipeline.id}")
          end
        end

        it 'creates a new scheduled pipeline' do
          click_link 'New schedule'

          expect(page).to have_content('Schedule a new pipeline')
        end

        it 'changes ownership of the pipeline' do
          click_link 'Take ownership'
          page.within('.pipeline-schedule-table-row') do
            expect(page).not_to have_content('No owner')
            expect(page).to have_link('John Doe')
          end
        end

        it 'edits the pipeline' do
          page.within('.pipeline-schedule-table-row') do
            click_link 'Edit'
          end

          expect(page).to have_content('Edit Pipeline Schedule')
        end

        it 'deletes the pipeline' do
          click_link 'Delete'

          expect(page).not_to have_css(".pipeline-schedule-table-row")
        end
      end

      context 'when ref is nil' do
        before do
          pipeline_schedule.update_attribute(:ref, nil)
          visit_pipelines_schedules
        end

        it 'shows a list of the pipeline schedules with empty ref column' do
          expect(first('.branch-name-cell').text).to eq('')
        end
      end

      context 'when ref is empty' do
        before do
          pipeline_schedule.update_attribute(:ref, '')
          visit_pipelines_schedules
        end

        it 'shows a list of the pipeline schedules with empty ref column' do
          expect(first('.branch-name-cell').text).to eq('')
        end
      end
    end

    describe 'POST /projects/pipeline_schedules/new' do
      before do
        visit_new_pipeline_schedule
      end

      it 'sets defaults for timezone and target branch' do
        expect(page).to have_button('master')
        expect(page).to have_button('UTC')
      end

      it 'it creates a new scheduled pipeline' do
        fill_in_schedule_form
        save_pipeline_schedule

        expect(page).to have_content('my fancy description')
      end

      it 'it prevents an invalid form from being submitted' do
        save_pipeline_schedule

        expect(page).to have_content('This field is required')
      end
    end

    describe 'PATCH /projects/pipelines_schedules/:id/edit' do
      before do
        edit_pipeline_schedule
      end

      it 'it displays existing properties' do
        description = find_field('schedule_description').value
        expect(description).to eq('pipeline schedule')
        expect(page).to have_button('master')
        expect(page).to have_button('UTC')
      end

      it 'edits the scheduled pipeline' do
        fill_in 'schedule_description', with: 'my brand new description'

        save_pipeline_schedule

        expect(page).to have_content('my brand new description')
      end

      context 'when ref is nil' do
        before do
          pipeline_schedule.update_attribute(:ref, nil)
          edit_pipeline_schedule
        end

        it 'shows the pipeline schedule with default ref' do
          page.within('.js-target-branch-dropdown') do
            expect(first('.dropdown-toggle-text').text).to eq('master')
          end
        end
      end

      context 'when ref is empty' do
        before do
          pipeline_schedule.update_attribute(:ref, '')
          edit_pipeline_schedule
        end

        it 'shows the pipeline schedule with default ref' do
          page.within('.js-target-branch-dropdown') do
            expect(first('.dropdown-toggle-text').text).to eq('master')
          end
        end
      end
    end

    context 'when user creates a new pipeline schedule with variables' do
      background do
        visit_pipelines_schedules
        click_link 'New schedule'
        fill_in_schedule_form
        all('[name="schedule[variables_attributes][][key]"]')[0].set('AAA')
        all('[name="schedule[variables_attributes][][value]"]')[0].set('AAA123')
        all('[name="schedule[variables_attributes][][key]"]')[1].set('BBB')
        all('[name="schedule[variables_attributes][][value]"]')[1].set('BBB123')
        save_pipeline_schedule
      end

      scenario 'user sees the new variable in edit window' do
        find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
        page.within('.pipeline-variable-list') do
          expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input").value).to eq('AAA')
          expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input").value).to eq('AAA123')
          expect(find(".pipeline-variable-row:nth-child(2) .pipeline-variable-key-input").value).to eq('BBB')
          expect(find(".pipeline-variable-row:nth-child(2) .pipeline-variable-value-input").value).to eq('BBB123')
        end
      end
    end

    context 'when user edits a variable of a pipeline schedule' do
      background do
        create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
          create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule)
        end

        visit_pipelines_schedules
        find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
        all('[name="schedule[variables_attributes][][key]"]')[0].set('foo')
        all('[name="schedule[variables_attributes][][value]"]')[0].set('bar')
        click_button 'Save pipeline schedule'
      end

      scenario 'user sees the updated variable in edit window' do
        find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
        page.within('.pipeline-variable-list') do
          expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input").value).to eq('foo')
          expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input").value).to eq('bar')
        end
      end
    end

    context 'when user removes a variable of a pipeline schedule' do
      background do
        create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
          create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule)
        end

        visit_pipelines_schedules
        find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
        find('.pipeline-variable-list .pipeline-variable-row-remove-button').click
        click_button 'Save pipeline schedule'
      end

      scenario 'user does not see the removed variable in edit window' do
        find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
        page.within('.pipeline-variable-list') do
          expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input").value).to eq('')
          expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input").value).to eq('')
        end
      end
    end

    context 'when active is true and next_run_at is NULL' do
      background do
        create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
          pipeline_schedule.update_attribute(:cron, nil) # Consequently next_run_at will be nil
        end
      end

      scenario 'user edit and recover the problematic pipeline schedule' do
        visit_pipelines_schedules
        find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
        fill_in 'schedule_cron', with: '* 1 2 3 4'
        click_button 'Save pipeline schedule'

        page.within('.pipeline-schedule-table-row:nth-child(1)') do
          expect(page).to have_css(".next-run-cell time")
        end
      end
    end
  end

  context 'logged in as non-member' do
    before do
      gitlab_sign_in(user)
    end

    describe 'GET /projects/pipeline_schedules' do
      before do
        visit_pipelines_schedules
      end

      describe 'The view' do
        it 'does not show create schedule button' do
          expect(page).not_to have_link('New schedule')
        end
      end
    end
  end

  context 'not logged in' do
    describe 'GET /projects/pipeline_schedules' do
      before do
        visit_pipelines_schedules
      end

      describe 'The view' do
        it 'does not show create schedule button' do
          expect(page).not_to have_link('New schedule')
        end
      end
    end
  end

  def visit_new_pipeline_schedule
    visit new_project_pipeline_schedule_path(project, pipeline_schedule)
  end

  def edit_pipeline_schedule
    visit edit_project_pipeline_schedule_path(project, pipeline_schedule)
  end

  def visit_pipelines_schedules
    visit project_pipeline_schedules_path(project, scope: scope)
  end

  def select_timezone
    find('.js-timezone-dropdown').click
    click_link 'American Samoa'
  end

  def select_target_branch
    find('.js-target-branch-dropdown').click
    click_link 'master'
  end

  def save_pipeline_schedule
    click_button 'Save pipeline schedule'
  end

  def fill_in_schedule_form
    fill_in 'schedule_description', with: 'my fancy description'
    fill_in 'schedule_cron', with: '* 1 2 3 4'

    select_timezone
    select_target_branch
  end
end


text:
.. vim: set fileencoding=utf-8 :
.. Andre Anjos <andre.anjos@idiap.ch>

.. _bob.db.base_devguide:

===================
 Development Guide
===================

The best way to create a new database for |project| is by first looking at
examples of working databases that are similar to the dataset you want to
create an API for.  The name of database interface packages for |project|
usually start with ``bob.db.``. Take a look at our `available packages`_ list
to find available |project| db packages.

In this development guide, we provide a list of guidelines on how to structure
your database and solve common development issues. We'll use the example on the
:ref:`bob.db.base_userguide` of the Samples database (see:
:ref:`bob.db.base_sampledb`) inside this guide.

.. warning::

   This development guide is **not** a replacement for our official
   :ref:`bob.extension` guide, which explains how to structure packages. It
   only contains *additional* guidelines you should consider when developing db
   packages.

Naming Convention
-----------------

All database packages should be named ``bob.db.<dataset-slug>`` where
``<dataset-slug>`` corresponds to a short name for the dataset you're trying to
bind. As a general recommendation, use small and catchy names. Avoid long names
which are confusing and difficult to type and remember.

Examples of good, catchy names:

  * ``atnt``: for the AT&T faces database
  * ``iris``: for Fisher's Iris flower dataset
  * ``mobio``: for the Mobio biometric database

Examples of more inappropriate names (avoid these):

  * ``database_cut1_whatnot`` (avoid very long package names)
  * ``test-mine`` (avoid dashes - they don't play well with python)
  * ``set_v2`` (avoid version names)

Module Organization
-------------------

Most people find it beneficial to share a common module organization so that it is
easy for everyone to maintain different databases. This is our typical
directory organization, which you should try to adhere to:

.. code-block:: text

   bob.db.<dataset-slug>
   +-- bob
       +-- __init__.py #namespace init for "bob"
       +-- db
           +-- __init__.py #namespace init for "bob.db"
           +-- <dataset-slug>
               +-- __init__.py
               +-- models.py
               +-- query.py
               +-- driver.py
               +-- test.py

The file ``models.py`` include all classes and functions that represent the
task described by the database. If, for example, the database is composed of
image samples and associated tags, possible classes in ``models.py`` may
include ``Sample`` and ``Tag``. See an example at
:py:mod:`bob.db.base.tests.sample.Sample`.

The file ``query.py`` normally only contains the definition of the ``Database``
class. Finally, the file ``driver.py`` contains the connector allowing the
command-line program ``bob_dbmanage.py`` to interface with your python API for
specific tasks.

It is conventional that all elements inside ``models.py`` and ``query.py`` are
imported into the package's ``__init__.py`` to avoid obliging the user to understand
implementation specificities.

The ``driver.py`` should declare a database with a name matching
``<dataset-slug>`` and implement at least the following methods from
:py:class:`bob.db.base.driver.Interface`:

* :py:meth:`bob.db.base.driver.Interface.name`: Here, insert the
  ``<dataset-slug>``. See an example in the source code for
  :py:meth:`bob.db.base.tests.sample.driver.Interface.name`
* :py:meth:`bob.db.base.driver.Interface.version`: Here, insert the
  db package version. This is typically done by using ``pkg_resources``. See an
  example in the source code for
  :py:meth:`bob.db.base.tests.sample.driver.Interface.version`
* :py:meth:`bob.db.base.driver.Interface.files`: Here, insert the metafiles this
  package contains (see :ref:`bob.db.base_metafiles`)
* :py:meth:`bob.db.base.driver.Interface.type`: Returns the type of the backend
  implementation. The return value of this function on your driver
  implementation will allow ``bob_dbmanage.py`` to provide specialized actions
  for SQL-backend db package implementations. The value returned should be
  either ``builtin`` or ``sqlite``

The file ``test.py`` should contain basic test units for all functionality
shipped with the database. This should contain, at least:

* Tests for reading out samples,
* Tests for sub-selection of samples using parameters of the ``objects()``
  method.

Documentation should accompany the package and indicate how to use the db
package Python API and its command-line interface, with examples and
appropriate doctests.

File-based Databases
--------------------

If the raw dataset in question is composed of files, it may be beneficial to
re-use (through inheritance) some classes available in this package. Read the
documentation of:

* :py:class:`bob.db.base.File`
* :py:class:`bob.db.base.Database`

In this case, make sure your ``Sample`` objects inherit from ``File``, as is,
for example, the case for :py:class:`bob.db.base.tests.sample.Sample`.
Equivalently, you may also benefit from some database constructions if your
``Database`` inherits from :py:class:`bob.db.base.Database`.

SQL-Backend for File Databases
------------------------------

So far, we have exemplified the implementation and organization of a simple db
package, for which the dataset contained only a few raw image samples and a
single evaluation protocol. For very complex problems, in which datasets
contain many hundreds of raw samples and multiple evaluation protocols, a more
complex modelling of the *internals* of the |project| db package may be
required. In such cases, we recommend prospective developers to consider using
alternative techniques (as opposed to simple file lists) for *implementing* the
*internals* of their db packages. In this guide, we introduce how to handle
database backends using SQLite_ through SQLAlchemy_, for which support is
built into this package.

It is important to note that using a simple or complex *backend* implementation
for storing and retrieving iterables from the database **must** be completely
transparent to the db package user. Users of your |project| db package are
primarily interested in iterating over (sub-selected) samples and executing
their pipelines. The choice of the *backend* to use for a given db package
**must be**, therefore, totally opaque to them.

.. warning::

   Understanding SQL, database structuring, normalization and how to deploy an
   ORM (such as SQLAlchemy_) is beyond the scope of this guide. Search for
   guides and tutorials on the net to familiarize yourself with these subjects
   **before** trying to make a backend based with SQLAlchemy_.

Module Organization for SQLite
==============================

The module organization of typical SQL-backend db packages is very similar to
simple file-based ones:

.. code-block:: text

   bob.db.<dataset-slug>
   +-- bob
       +-- __init__.py #namespace init for "bob"
       +-- db
           +-- __init__.py #namespace init for "bob.db"
           +-- <dataset-slug>
               +-- __init__.py
               +-- models.py
               +-- query.py
               +-- create.py
               +-- driver.py
               +-- db.sql3
               +-- test.py

The file ``models.py`` will contain the definition of the SQL tables for every
component in the database. One possible table in the SQL database will be that
of ``Sample``'s. If you're designing a db package for a dataset with a
one-file-per-sample storage model, ensure your ``Sample`` class also inherits
from :py:class:`bob.db.base.File` to provide a uniform experience to users
already used to bob.db interfaces. Other tables and relationships are optional
and should map your problem alongside its contraints to a proper database
schema.

The file ``query.py`` will contain the definition of the ``Database`` class. We
recommend you consider, in this case, inheriting from
:py:class:`bob.db.base.SQLiteDatabase`, which provides a number of utilities to
handle file-based datasets with an SQLite backend. You'll find examples among
different |project| db packages for this. Typically, elements returned by the
``Database`` class ``objects()`` in this case are ORM objects from SQLAlchemy_,
representing a row in a table of your internal database. However, these objects
behave *exactly* the same as non-SQL ``Sample`` objects and allow the user to
transparently load file contents and meta data using simple API calls.

The file ``driver.py`` will be very similar to other databases, with a few
exceptions:

1. The :py:meth:`bob.db.base.driver.Interface.files` implementation will return
   at least the path to the ``db.sql3`` file, which will contain the db package
   backend information. This will allow ``bob_dbmanage.py`` to download this
   file in installations it misses or upload updated versions of it to our
   central server.
2. SQL-backend db packages normally install a ``create`` command at the driver
   :py:class:`bob.db.base.driver.Interface` allowing developers to create the
   ``db.sql3`` file from scratch. It is important to have a create command so
   that the database can be re-created in case of changes.

The file ``create.py`` typically contains routines for the creation of
``db.sql3`` from scratch and is not required *per se*. Functions and modules
implemented in ``create.py`` are imported into ``driver.py`` for the
instantiation of the ``create`` command. See examples in db packages for
mobio_ or verafinger_.

Finally, the file ``test.py`` should contain the usual set of tests, as for
simpler databases.

The package documentation should contain all information regarding the Python
API, command-line interface and, if possible, the SQL-backend database design
(showing tables, column types and constraints where adequate).

.. _bob.db.base_metafiles:

Metafiles Not Shipped with the Database
---------------------------------------

Very often, |project| db packages require the use of support files which should
exist **inside** the package structure, but are not kept under version control.
Reasons for this may be that these *meta*-files are too large or can be recreated
programmatically. Such files may be of different natures and each developer
should be able to recognize those easily when the situation occurs. Here is a
non-exhaustive list of possible use cases for such metafiles:

* Annotations
* File lists (for example, defining evaluation protocols or such)
* Auxiliary database files (for example, Sqlite database files)
* Samples (in case you want to ship them with your database)

In order to mitigate issues related to management, this package provides a set
of utilies to handle such *meta*-files more easily. To prepare your package for
handling metafiles, you must first make sure that the ``driver.py``
``Interface`` class returns a non-empty list as a result of the ``files()``
method.

Each entry in the list returned by ``files()`` should represent the **full**
path of the file, considering the current installation location. The method
``type()`` of :py:class:`bob.db.base.driver.Interface` should return `sqlite`.

A typical implementation for SQL-backend db packages is like this:

.. code-block:: python

   def files(self):

       from pkg_resources import resource_filename
       raw_files = ('db.sql3',)
       return [resource_filename(__name__, k) for k in raw_files]

   def type(self):

       return 'sqlite'

Metafiles Shipped with the Python Package
=========================================

If you'd like the file ``db.sql3`` to be shipped to PyPI when you publish
your package, make sure to include ``db.sql3`` in the package's ``MANIFEST.in``
file. Otherwise, you are not required to add this file to the package manifest.

Download Missing Files for Large Databases
==========================================

If you declared extra metafiles with your driver's ``files()`` implementation,
it is possible to both store and retrieve metafiles from a central file server
running at Idiap (see http://www.idiap.ch/software/bob/databases/latest). All
metafiles of a package are wrapped into a single tar-ball and copied to the
server upon uploading. The reverse process takes place when downloading.

This mechanism allows third-parties to download sources from the version
control repository and retrieve the metafiles.

To download and install metafiles for a package, do:

.. code-block:: sh

	 $ bob_dbmanage.py <database-name> download

For example, you can use the special database name ``all``, together with the
flag ``--missing`` to download the missing metafiles of all installed databases
like this:

.. code-block:: sh

	 $ bob_dbmanage.py all download --missing

Low and High-Level Interfaces
-----------------------------

Bob database interfaces come in two flavours:

1. **Low-level interfaces** allow developers to create programmatic APIs to
   access samples and metadata available with databases as they are distributed
   by their controllers. Examples of this are the Samples database in this
   package or APIs provided in any other db packages. The main objective of a
   low-level database interface is to provide access to **all** information
   provided with the database, without direct regards to the specific task it
   was originally conceived for. The reasoning behind this design
   choice lies in the fact that databases very often find second lives in different
   tasks than originally intended. By providing access to **all** information
   available from the raw dataset, a developer potentialises such (re-)use
   cases.
2. **High-level interfaces** allow developers to create programmatic APIs to
   *bind* low-level interfaces to frameworks that perform a *specific*
   function. Because each *low-level* databases should be created to export all
   available information, in some cases it is possible to re-use an existing
   db package as input to a different task than it was originally conceived
   for. Here are some examples:

   * Re-use a database for emotion recognition to perform remote
     photo-plethysmographic (see ``bob.db.hci_tagging``)
   * Re-use a face recognition database to train a face detector
   * Re-use a speaker recognition database to do speech recognition

   High-level database interfaces are, therefore, very task specific and
   normally sit together with frameworks doing high-level experimental
   research. Examples of such frameworks are :ref:`bob.bio.base <bob.bio.base>`
   (biometric recognition) and :ref:`bob.pad.base <bob.pad.base>` (presentation
   attack vulnerability and detection). Checkout their user guides for more
   information on specific high-level implementations required by those tasks.

.. Place your references here:
.. _sqlite: https://www.sqlite.org/
.. _sqlalchemy: https://www.sqlalchemy.org/
.. _available packages: http://www.idiap.ch/software/bob/packages/
.. _mobio: https://gitlab.idiap.ch/bob/bob.db.mobio/tree/master/bob/db/mobio
.. _verafinger: https://gitlab.idiap.ch/bob/bob.db.verafinger/tree/master/bob/db/verafinger


text:
import codecs
import csv
from datetime import date
from django.core.management.base import BaseCommand
from buslines.models import Route, CalendarDate, Stop, Trip, StopTime

class Command(BaseCommand):
    help = 'Import STM data from CSV files'

    def get_version(self):
        return '1.0'

    def importRoutes(self):
        with codecs.open('data/routes.txt', encoding='utf-8-sig') as csvfile:
            Route.objects.all().delete()
            reader = UnicodeDictReader(csvfile)
            print 'Importing routes'
            for row in reader:
                Route.objects.create(
                    route_id=row['route_id'],
                    route_short_name=row['route_short_name'],
                    route_long_name=row['route_long_name']
                )
            print 'Done importing routes'

    def importCalendarDates(self):
        with codecs.open('data/calendar_dates.txt', encoding='utf-8-sig') as csvfile:
            CalendarDate.objects.all().delete()
            reader = UnicodeDictReader(csvfile)
            print 'Importing calendar dates'
            for row in reader:
                adate = row['date']
                CalendarDate.objects.create(
                    service_id=row['service_id'],
                    date=date(int(adate[:4]), int(adate[4:6]), int(adate[6:])),
                )
            print 'Done importing calendar dates'

    def importStops(self):
        with codecs.open('data/stops.txt', encoding='utf-8-sig') as csvfile:
            Stop.objects.all().delete()
            reader = UnicodeDictReader(csvfile)
            print 'Importing stops'
            for row in reader:
                Stop.objects.create(
                    stop_id=row['stop_id'],
                    code=row['stop_code'],
                    name=row['stop_name'],
                    latitude=row['stop_lat'],
                    longitude=row['stop_lon'],
                )
            print 'Done importing stops'

    def importTrips(self):
        with codecs.open('data/trips.txt', encoding='utf-8-sig') as csvfile:
            Trip.objects.all().delete()
            reader = UnicodeDictReader(csvfile)
            print 'Importing trips'
            # print reader.next()
            for row in reader:
                route = Route.objects.get(pk=row['route_id'])
                Trip.objects.create(
                    route=route,
                    service_date=row['service_id'],
                    trip_id=row['trip_id']
                )
            print 'Done importing trips'

    def importStopTimes(self):
        with codecs.open('data/stop_times.txt', encoding='utf-8-sig') as csvfile:
            print 'flushing'
            StopTime.objects.all().delete()
            reader = csv.DictReader(csvfile, delimiter=',')
            print 'Importing stop times'
            for row in reader:
                StopTime.objects.create(
                    trip_id=row['trip_id'],
                    arrival_time=row['arrival_time'],
                    departure_time=row['departure_time'],
                    stop_id=row['stop_id']
                )
            print 'Done importing stop times'

    def handle(self, *args, **options):
        if len(args) == 0:
            self.importRoutes()
            self.importCalendarDates()
            self.importStops()
            # self.importTrips() # too slow - see fabfile
            # self.importStopTimes() # too slow - see fabfile
        elif args[0] == 'routes':
            self.importRoutes()
        elif args[0] == 'dates':
            self.importCalendarDates()
        elif args[0] == 'stops':
            self.importStops()
        elif args[0] == 'trips':
            self.importTrips()
        elif args[0] == 'stoptimes':
            self.importStopTimes()

def UnicodeDictReader(utf8_data, **kwargs):
    csv_reader = csv.DictReader(utf_8_encoder(utf8_data), **kwargs)
    for row in csv_reader:
        yield dict([(key, unicode(value, 'utf-8')) for key, value in row.iteritems()])

def utf_8_encoder(unicode_csv_data):
    for line in unicode_csv_data:
        yield line.encode('utf-8')


text:
using System;
using System.Net;
using System.Collections.Generic;
using Amazon.S3.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;

namespace Amazon.S3.Model.Internal.MarshallTransformations
{
    /// <summary>
    ///    Response Unmarshaller for GetBucketLocation operation
    /// </summary>
    internal class GetBucketLocationResponseUnmarshaller : S3ReponseUnmarshaller
    {
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            GetBucketLocationResponse response = new GetBucketLocationResponse();

            UnmarshallResult(context,response);

            return response;
        }

        private static void UnmarshallResult(XmlUnmarshallerContext context,GetBucketLocationResponse response)
        {

            int originalDepth = context.CurrentDepth;
            int targetDepth = 1;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("LocationConstraint", targetDepth))
                    {
                        response.Location = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }

            return;
        }

        public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
        {
            S3ErrorResponse errorResponse = S3ErrorResponseUnmarshaller.Instance.Unmarshall(context);

            return new AmazonS3Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode, errorResponse.Id2);
        }

        private static GetBucketLocationResponseUnmarshaller _instance;

        public static GetBucketLocationResponseUnmarshaller Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new GetBucketLocationResponseUnmarshaller();
                }
                return _instance;
            }
        }
    }
}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/privacy/dlp/v2/dlp.proto

namespace Google\Cloud\Dlp\V2\ByteContentItem;

use UnexpectedValueException;

/**
 * The type of data being sent for inspection. To learn more, see
 * [Supported file
 * types](https://cloud.google.com/dlp/docs/supported-file-types).
 *
 * Protobuf type google.privacy.dlp.v2.ByteContentItem.BytesType
 */
class BytesType
{
    /**
     * Unused
     *
     * Generated from protobuf enum BYTES_TYPE_UNSPECIFIED = 0;
     */
    const BYTES_TYPE_UNSPECIFIED = 0;
    /**
     * Any image type.
     *
     * Generated from protobuf enum IMAGE = 6;
     */
    const IMAGE = 6;
    /**
     * jpeg
     *
     * Generated from protobuf enum IMAGE_JPEG = 1;
     */
    const IMAGE_JPEG = 1;
    /**
     * bmp
     *
     * Generated from protobuf enum IMAGE_BMP = 2;
     */
    const IMAGE_BMP = 2;
    /**
     * png
     *
     * Generated from protobuf enum IMAGE_PNG = 3;
     */
    const IMAGE_PNG = 3;
    /**
     * svg
     *
     * Generated from protobuf enum IMAGE_SVG = 4;
     */
    const IMAGE_SVG = 4;
    /**
     * plain text
     *
     * Generated from protobuf enum TEXT_UTF8 = 5;
     */
    const TEXT_UTF8 = 5;
    /**
     * docx, docm, dotx, dotm
     *
     * Generated from protobuf enum WORD_DOCUMENT = 7;
     */
    const WORD_DOCUMENT = 7;
    /**
     * pdf
     *
     * Generated from protobuf enum PDF = 8;
     */
    const PDF = 8;
    /**
     * pptx, pptm, potx, potm, pot
     *
     * Generated from protobuf enum POWERPOINT_DOCUMENT = 9;
     */
    const POWERPOINT_DOCUMENT = 9;
    /**
     * xlsx, xlsm, xltx, xltm
     *
     * Generated from protobuf enum EXCEL_DOCUMENT = 10;
     */
    const EXCEL_DOCUMENT = 10;
    /**
     * avro
     *
     * Generated from protobuf enum AVRO = 11;
     */
    const AVRO = 11;
    /**
     * csv
     *
     * Generated from protobuf enum CSV = 12;
     */
    const CSV = 12;
    /**
     * tsv
     *
     * Generated from protobuf enum TSV = 13;
     */
    const TSV = 13;

    private static $valueToName = [
        self::BYTES_TYPE_UNSPECIFIED => 'BYTES_TYPE_UNSPECIFIED',
        self::IMAGE => 'IMAGE',
        self::IMAGE_JPEG => 'IMAGE_JPEG',
        self::IMAGE_BMP => 'IMAGE_BMP',
        self::IMAGE_PNG => 'IMAGE_PNG',
        self::IMAGE_SVG => 'IMAGE_SVG',
        self::TEXT_UTF8 => 'TEXT_UTF8',
        self::WORD_DOCUMENT => 'WORD_DOCUMENT',
        self::PDF => 'PDF',
        self::POWERPOINT_DOCUMENT => 'POWERPOINT_DOCUMENT',
        self::EXCEL_DOCUMENT => 'EXCEL_DOCUMENT',
        self::AVRO => 'AVRO',
        self::CSV => 'CSV',
        self::TSV => 'TSV',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }

    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BytesType::class, \Google\Cloud\Dlp\V2\ByteContentItem_BytesType::class);


text:
NSString *WDDefaultFreehandTool = @"WDDefaultFreehandTool";

@implementation WDFreehandTool

@synthesize closeShape = closeShape_;

- (NSString *) iconName
{
    return closeShape_ ? @"freehand_shape.png" : @"brush.png";
}

- (BOOL) createsObject
{
    return YES;
}

- (BOOL) isDefaultForKind
{
    NSNumber *defaultFreehand = [[NSUserDefaults standardUserDefaults] valueForKey:WDDefaultFreehandTool];
    return (closeShape_ == [defaultFreehand intValue]) ? YES : NO;
}

- (void) activated
{
    [[NSUserDefaults standardUserDefaults] setValue:@(closeShape_) forKey:WDDefaultFreehandTool];
}

- (void) beginWithEvent:(WDEvent *)theEvent inCanvas:(WDCanvas *)canvas
{
    [canvas.drawingController selectNone:nil];

    pathStarted_ = YES;

    tempPath_ = [[WDPath alloc] init];
    canvas.shapeUnderConstruction = tempPath_;

    [self moveWithEvent:theEvent inCanvas:canvas];
}

- (void) moveWithEvent:(WDEvent *)theEvent inCanvas:(WDCanvas *)canvas
{
    [tempPath_.nodes addObject:[WDBezierNode bezierNodeWithAnchorPoint:theEvent.location]];
    [canvas invalidateSelectionView];
}

- (void) endWithEvent:(WDEvent *)theEvent inCanvas:(WDCanvas *)canvas
{
    if (pathStarted_ && [tempPath_.nodes count] > 1) {
        float maxError = (kMaxError / canvas.viewScale);

        canvas.shapeUnderConstruction = nil;

        NSMutableArray *points = [NSMutableArray array];
        for (WDBezierNode *node in tempPath_.nodes) {
            [points addObject:[NSValue valueWithCGPoint:node.anchorPoint]];
        }

        if (closeShape_ && tempPath_.nodes.count > 2) {
            // we're drawing free form closed shapes... let's relax the error
            maxError *= 5;

            // add the first point at the end to make sure we close
            CGPoint first = [points[0] CGPointValue];
            CGPoint last = [[points lastObject] CGPointValue];

            if (WDDistance(first, last) >= (maxError*2)) {
                [points addObject:points[0]];
            }
        }

        WDPath *smoothPath = [WDCurveFit smoothPathForPoints:points error:maxError attemptToClose:YES];

        if (smoothPath) {
            smoothPath.fill = [canvas.drawingController.propertyManager activeFillStyle];
            smoothPath.strokeStyle = [canvas.drawingController.propertyManager activeStrokeStyle];
            smoothPath.opacity = [[canvas.drawingController.propertyManager defaultValueForProperty:WDOpacityProperty] floatValue];
            smoothPath.shadow = [canvas.drawingController.propertyManager activeShadow];

            [canvas.drawing addObject:smoothPath];
            [canvas.drawingController selectObject:smoothPath];
        }
    }

    pathStarted_ = NO;
    tempPath_ = nil;
}

@end


text:
use std::{
    ops::{Generator, GeneratorState},
    pin::Pin,
};

fn firstn() -> impl Generator<Yield = u64, Return = ()> {
    static move || {
        let mut num = 0;
        let num = &mut num;

        yield *num;
        *num += 1; //~ ERROR: dereferenced after this allocation got freed
    }
}

struct GeneratorIteratorAdapter<G>(G);

impl<G> Iterator for GeneratorIteratorAdapter<G>
where
    G: Generator<Return = ()>,
{
    type Item = G::Yield;

    fn next(&mut self) -> Option<Self::Item> {
        let me = unsafe { Pin::new_unchecked(&mut self.0) };
        match me.resume(()) {
            GeneratorState::Yielded(x) => Some(x),
            GeneratorState::Complete(_) => None,
        }
    }
}

fn main() {
    let mut generator_iterator_2 = {
        let mut generator_iterator = Box::new(GeneratorIteratorAdapter(firstn()));
        generator_iterator.next(); // pin it

        Box::new(*generator_iterator) // move it
    }; // *deallocate* generator_iterator

    generator_iterator_2.next(); // and use moved value
}


text:
/* -*- C++ -*- */
// $Id:  $

#include "TProactor/POSIX_AIO_SUN_Provider.h"

#if defined(ACE_HAS_AIO_CALLS) && defined(sun)

#include "ace/OS_NS_sys_socket.h"
#include "ace/Log_Msg.h"
#include "ace/ACE.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 *****************************************************************
 *  POSIX AIO  SUN Provider
 *****************************************************************
 */
TRB_POSIX_AIO_SUN_Provider::~TRB_POSIX_AIO_SUN_Provider ()
{
    this->fini ();
}

TRB_POSIX_AIO_SUN_Provider::TRB_POSIX_AIO_SUN_Provider
    (const TRB_POSIX_AIO_Config & config)
: TRB_POSIX_AIO_Provider (config)
, mon_provider_    ()
, started_queue_   ()
, deferred_queue_  ()
, interrupter_     (false)  // blocking read side
, interrupt_result_(interrupter_)
{
    //this->init ();
}

int
TRB_POSIX_AIO_SUN_Provider::get_supported_operations_mask () const
{
  return (TRB_Asynch_Result::OP_READ_STREAM
         |TRB_Asynch_Result::OP_WRITE_STREAM
         |TRB_Asynch_Result::OP_READ_FILE
         |TRB_Asynch_Result::OP_WRITE_FILE);

}

// *************************************************************
//
// *************************************************************
int
TRB_POSIX_AIO_SUN_Provider::register_handle (ACE_HANDLE handle,
                                         const void *completion_key,
                                         int operations)
{
    ACE_UNUSED_ARG (completion_key);

    if (!ACE_BIT_CMP_MASK(this->get_supported_operations_mask(),
                          operations, operations))
      {
        return -1;
      }

    if (handle == ACE_INVALID_HANDLE)
     {
        return -1;
     }

    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::unregister_handle (ACE_HANDLE handle)
{
    ACE_UNUSED_ARG(handle);
    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::init ()
{
    Guard_Monitor guard (this->mon_provider_);
    int rc = this->start_aio_impl (&this->interrupt_result_);
    if (rc <= 0)
    {
        int error = ACE_OS::last_error();
        ACE_ERROR((LM_ERROR,
            ACE_TEXT("TRB_POSIX_AIO_SUN_Provider::init:")
            ACE_TEXT(" unable to start aio error=%d\n"),
            error));
        return -1;

    }
    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::fini ()
{
    this->interrupt();
    TRB_POSIX_Asynch_Result_Queue completed_queue;
    this->cancel_all (completed_queue);
    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::interrupt ()
{
    this->interrupter_.notify();
    return 0;
}

// *************************************************************
//
// *************************************************************
int
TRB_POSIX_AIO_SUN_Provider::finish_aio_completions
     (TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    ACE_UNUSED_ARG (completed_queue);
    return 0;
}

bool
TRB_POSIX_AIO_SUN_Provider::begin_aio_wait
    (ACE_Time_Value * wait_time,
     Guard_Monitor &  leader_guard,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    this->get_completed_aio (wait_time, leader_guard, completed_queue);
    return false;
}

// *************************************************************
//   Cancel AIO
//    return
//     1  nothing to cancel ot all is done
//     0  cancelled
//    -1  errors
// *************************************************************
int
TRB_POSIX_AIO_SUN_Provider::cancel_result
    (TRB_POSIX_Asynch_Result * result,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    /// Cancel pending AIO request

    struct aiocb * aiocb_ptr = result->get_aiocb ();

    int rc = ::aiocancel (&aiocb_ptr->aio_resultp);

    // Check the return value and translate into enumeration values

    // ****** from Sun man pages *********************
    // Upon successful completion,
    // aiocancel() returns 0 and the requested operation is cancelled.
    // The application will not receive the SIGIO completion signal
    // for an asynchronous operation that is successfully cancelled.

    if (rc == 0)       // OK, canceled and dequeued
    {
        result->set_completion (0, ECANCELED);
        completed_queue.push_back(result);
        return 0;
    }

    int err = errno;

    switch ( errno )   // ****** from Sun man pages *********************
    {
    case EINVAL :                 // Thee are not any outstanding
                                  // requests to cancel
    case EACCES :                 // The parameter resultp does not
                                  // correspond to any outstanding
                                  // asynchronous operation,
                                  // although there is at least
                                  // one currently outstanding.
        result->set_completion (0, ECANCELED);
        completed_queue.push_back(result);
        return 0;

    case EFAULT:                    // resultp points to an address
                                    // outside the address space
                                    // of the requesting  process.
    default:
        break;
    }
    ACE_ERROR((LM_ERROR, "(%t) Result not cancelled errno=%d\n", err));
    return -1;
}

int
TRB_POSIX_AIO_SUN_Provider::cancel_all
    (TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    Guard_Monitor guard (this->mon_provider_);
    this->cancel_deferred_queue (0, 0, true, completed_queue);
    this->cancel_active_queue (0, 0, true, completed_queue);
    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::cancel_aio
    (TRB_Handler * handler,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    Guard_Monitor guard (this->mon_provider_);
    this->cancel_deferred_queue (handler, 0, false, completed_queue);
    this->cancel_active_queue (handler, 0, false, completed_queue);
    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::cancel_aio
    (TRB_POSIX_Asynch_Result * result,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    ACE_HANDLE handle = result->get_aiocb ()->aio_fildes;
    return this->cancel_aio (handle, completed_queue);
}

int
TRB_POSIX_AIO_SUN_Provider::cancel_aio
    (ACE_HANDLE handle,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    Guard_Monitor guard (this->mon_provider_);
    this->cancel_deferred_queue (0,handle, false, completed_queue);
    this->cancel_active_queue (0, handle, false, completed_queue);
    return 0;
}

bool
TRB_POSIX_AIO_SUN_Provider::cancel_active_queue
    (TRB_Handler * handler,
     ACE_HANDLE    handle,
     bool          flg_all,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    TRB_POSIX_Asynch_Result_Queue tmp_queue;
    TRB_POSIX_Asynch_Result * result;

    while((result = started_queue_.pop_front()) !=0)
    {
        if (flg_all ||
            handler == result->get_original_result ().get_handler() ||
            handle == result->get_aiocb ()->aio_fildes)
        {
            if (cancel_result (result, completed_queue) == 0)
            {
                continue;
            }
        }
        tmp_queue.push_front (result);
    }
    this->started_queue_.splice (tmp_queue);
    return  !completed_queue.empty();
}

bool
TRB_POSIX_AIO_SUN_Provider::cancel_deferred_queue
    (TRB_Handler * handler,
     ACE_HANDLE    handle,
     bool          flg_all,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    TRB_POSIX_Asynch_Result_Queue tmp_queue;
    TRB_POSIX_Asynch_Result * result;

    while((result = deferred_queue_.pop_front()) !=0)
    {
        if (flg_all ||
            handler == result->get_original_result ().get_handler() ||
            handle == result->get_aiocb ()->aio_fildes)
        {
            result->set_completion (0, ECANCELED);
            completed_queue.push_back (result);
        }
        else
        {
            tmp_queue.push_back (result);
        }
    }
    this->deferred_queue_.splice (tmp_queue);
    return  !completed_queue.empty();
}

// *****************************************************************
//  Start AIO
//  On return result state contains:
//  Return code :
//    1 - operation finished and added to completion list
//    0 - started
//   -1 - was not started
// *****************************************************************
int
TRB_POSIX_AIO_SUN_Provider::start_aio
    (TRB_POSIX_Asynch_Result *result,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    ACE_UNUSED_ARG (completed_queue);

    Guard_Monitor guard (this->mon_provider_);
    int rc = this->start_aio_impl (result);

    if (rc < 0)   // < 0   not started
        return -1;

    if (rc == 0)  // == 0  deferred
    {
        this->deferred_queue_.push_back (result);
        return 0;
    }

    //  > 0  started
    this->started_queue_.push_back (result);

    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::start_aio_impl
    (TRB_POSIX_Asynch_Result *result)
{
    result->build_aiocb ();

    struct aiocb * aiocb_ptr = result->get_aiocb ();
    // ****** from Sun man pages *********************
    // Upon completion of the operation both aio_return and aio_errno
    // are set to reflect the result of the operation.
    // AIO_INPROGRESS is not a value used by the system
    // so the client may detect a change in state
    // by initializing aio_return to this value.
    int rc = 0;

    //
    // temporary while register_handle will be changed
    //
    ACE::clr_flags (aiocb_ptr->aio_fildes, ACE_NONBLOCK);

    int op_code = result->get_original_result ().op_code ();

    switch (op_code)
    {
    case TRB_Asynch_Result::OP_READ_STREAM:
    case TRB_Asynch_Result::OP_READ_FILE:
        aiocb_ptr->aio_resultp.aio_return = AIO_INPROGRESS;
        aiocb_ptr->aio_resultp.aio_errno  = EINPROGRESS;
        rc =::aioread (aiocb_ptr->aio_fildes,
                     (char *) aiocb_ptr->aio_buf,
                     aiocb_ptr->aio_nbytes,
                     aiocb_ptr->aio_offset,
                     SEEK_SET,
                     &aiocb_ptr->aio_resultp);
        break;

    case TRB_Asynch_Result::OP_WRITE_STREAM:
    case TRB_Asynch_Result::OP_WRITE_FILE:
        aiocb_ptr->aio_resultp.aio_return = AIO_INPROGRESS;
        aiocb_ptr->aio_resultp.aio_errno  = EINPROGRESS;
        rc = ::aiowrite (aiocb_ptr->aio_fildes,
                       (char *) aiocb_ptr->aio_buf,
                       aiocb_ptr->aio_nbytes,
                       aiocb_ptr->aio_offset,
                       SEEK_SET,
                       &aiocb_ptr->aio_resultp);
        break;

    case TRB_Asynch_Result::OP_READ_DGRAM:
    case TRB_Asynch_Result::OP_WRITE_DGRAM:
    case TRB_Asynch_Result::OP_ACCEPT:
    case TRB_Asynch_Result::OP_CONNECT:
        result->set_completion (0, ENOTSUP);
        return -1;
    default:
        ACE_ASSERT (0);
        result->set_completion (0, ENOTSUP);
        return -1;
    }

    // lock access to the interest list

    if (rc == 0)  //  success on start
    {
        return 1;
    }

    int error = ACE_OS::last_error();
    ACE_ERROR((LM_ERROR, "(%t) start failed errno=%d\n", error));
    switch (error)
    {
    case EAGAIN:
    case ENOMEM:  //Ok, it will be deferred AIO
        return 0;
    }

    result->set_completion (0, error);
    return -1;
}

// *****************************************************************
//
// *****************************************************************
int
TRB_POSIX_AIO_SUN_Provider::get_completed_aio
    (ACE_Time_Value * wait_time,
     Guard_Monitor &  leader_guard,
     TRB_POSIX_Asynch_Result_Queue & completed_queue)
{

    TRB_POSIX_Asynch_Result * posix_result = 0;
    aio_result_t *            aio_result = 0;
    {
        // only one thread can take leadership
        Save_Guard lock_leader (leader_guard, Save_Guard::ACQUIRE);

        timeval timeout ;
        timeval * ptime = 0;

        if (wait_time != 0)
        {
            timeout = wait_time->operator timeval();
            ptime = &timeout;
        }

        aio_result = ::aiowait (ptime);
    }

    if (aio_result == 0 ||
        reinterpret_cast<long> (aio_result) == -1 )
    {
        return -1;
    }

    {
        Guard_Monitor guard (this->mon_provider_);
        if (this->check_interrupter_result (aio_result))
        {
            return 0;
        }

        posix_result = this->find_completed_result (aio_result);
        if (posix_result != 0)
        {
            completed_queue.push_back(posix_result);
        }
        this->start_deferred_queue (completed_queue);
    }
    return 0;
}

int
TRB_POSIX_AIO_SUN_Provider::start_deferred_queue
    (TRB_POSIX_Asynch_Result_Queue & completed_queue)
{
    int num_started = 0;
    TRB_POSIX_Asynch_Result * result;

    while((result = deferred_queue_.pop_front()) !=0)
    {
        int rc = this->start_aio_impl (result);
        if (rc < 0)  // unable to start
        {
            completed_queue.push_back(result);
            return -1;  // we have completions
        }

        if (rc == 0) // still have to try later
        {
            this->deferred_queue_.push_front(result);
            break;
        }
        ++num_started;
        this->started_queue_.push_front(result);
    }
    return num_started;
}

TRB_POSIX_Asynch_Result *
TRB_POSIX_AIO_SUN_Provider::find_completed_result (aio_result_t *aio_result)
{
    TRB_POSIX_Asynch_Result_Queue tmp_queue;
    TRB_POSIX_Asynch_Result * result;

    while ((result = started_queue_.pop_front()) !=0)
    {
        struct aiocb * aiocb_ptr = result->get_aiocb ();
        if (&aiocb_ptr->aio_resultp == aio_result)
        {
            int  val_aio_error = aiocb_ptr->aio_resultp.aio_errno;
            ssize_t val_aio_return = aiocb_ptr->aio_resultp.aio_return;

            ACE_ASSERT (val_aio_return != AIO_INPROGRESS);

            result->set_completion (val_aio_return, val_aio_error);
            break;
        }
        tmp_queue.push_back(result);
    }
    this->started_queue_.splice (tmp_queue);
    if (result == 0)
    {
         ACE_ERROR((LM_ERROR,"(%t) result not found!!!\n"));
    }
    return result;
}

bool
TRB_POSIX_AIO_SUN_Provider::check_interrupter_result
    (aio_result_t *result)
{
    struct aiocb * aiocb_ptr =
      this->interrupt_result_.get_aiocb ();

    if (result == &aiocb_ptr->aio_resultp)
    {
        int rc = this->start_aio_impl (&this->interrupt_result_);
        if (rc <= 0)
        {
            int error = ACE_OS::last_error();
            ACE_ERROR((LM_ERROR,
                ACE_TEXT("TRB_POSIX_AIO_SUN_Provider::check_interrupter_result:")
                ACE_TEXT(" unable to start aio error=%d"),
                error));

        }
        return true;
    }

    return false;
}

ACE_END_VERSIONED_NAMESPACE_DECL

#endif /* ACE_HAS_AIO_CALLS */


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

namespace GM.WebUI.WebApp
{
    // THIS CODE IS UNUSED.
    // It was for an experiment in using SpaServices to run the angular app
    // See: https://www.codeproject.com/Articles/1274513/Angular-7-with-NET-Core-2-2-Global-Weather-Part-1
    internal class CurrentDirectoryHelpers
    {
        internal const string AspNetCoreModuleDll = "aspnetcorev2_inprocess.dll";

        [System.Runtime.InteropServices.DllImport("kernel32.dll")]
        private static extern IntPtr GetModuleHandle(string lpModuleName);

        [System.Runtime.InteropServices.DllImport(AspNetCoreModuleDll)]
        private static extern int http_get_application_properties
                      (ref IISConfigurationData iiConfigData);

        [System.Runtime.InteropServices.StructLayout
                   (System.Runtime.InteropServices.LayoutKind.Sequential)]
        private struct IISConfigurationData
        {
            public IntPtr pNativeApplication;
            [System.Runtime.InteropServices.MarshalAs
                    (System.Runtime.InteropServices.UnmanagedType.BStr)]
            public string pwzFullApplicationPath;
            [System.Runtime.InteropServices.MarshalAs
                    (System.Runtime.InteropServices.UnmanagedType.BStr)]
            public string pwzVirtualApplicationPath;
            public bool fWindowsAuthEnabled;
            public bool fBasicAuthEnabled;
            public bool fAnonymousAuthEnable;
        }

        public static void SetCurrentDirectory()
        {
            try
            {
                // Check if physical path was provided by ANCM
                var sitePhysicalPath = Environment.GetEnvironmentVariable
                                       ("ASPNETCORE_IIS_PHYSICAL_PATH");
                if (string.IsNullOrEmpty(sitePhysicalPath))
                {
                    // Skip if not running ANCM InProcess
                    if (GetModuleHandle(AspNetCoreModuleDll) == IntPtr.Zero)
                    {
                        return;
                    }

                    IISConfigurationData configurationData = default(IISConfigurationData);
                    if (http_get_application_properties(ref configurationData) != 0)
                    {
                        return;
                    }

                    sitePhysicalPath = configurationData.pwzFullApplicationPath;
                }

                Environment.CurrentDirectory = sitePhysicalPath;
            }
            catch
            {
                // ignore
            }
        }
    }
}


text:
package org.apereo.cas.web.support.mgmr;

import org.apereo.cas.web.cookie.CookieValueManager;

import javax.servlet.http.HttpServletRequest;

/**
 * Default cookie value builder that returns the given cookie value
 * and does not perform any additional checks.
 *
 * @author Misagh Moayyed
 * @since 4.1
 */
public class NoOpCookieValueManager implements CookieValueManager {

    /**
     * Static instance.
     */
    public static final CookieValueManager INSTANCE = new NoOpCookieValueManager();

    private static final long serialVersionUID = -8464839674747772197L;

    @Override
    public String buildCookieValue(final String givenCookieValue, final HttpServletRequest request) {
        return givenCookieValue;
    }

    @Override
    public String obtainCookieValue(final String cookie, final HttpServletRequest request) {
        return cookie;
    }
}


text:
The library was suspended on April 1, 2017

# android-dialog-builder
This is an android in the Dialog library, not based on a systematic way to achieve Dialog using Activity root view of the Add Dialog, it has strong scalability and customizability!

For more information please see the website

## Screenshots

## android-dialog-builder with Java code
```java
public void onClick(View v){
        if(v.getId() == R.id.left){
            DialogBuilder builder = new DialogBuilder(this)
                    .setAnimation(R.anim.da_slide_in_left, R.anim.da_slide_out_left)
                    //.setIgnoreStatusBar(false)
                    .setLayoutParams(700, ViewGroup.LayoutParams.MATCH_PARENT)
                    .setGravity(Gravity.LEFT)
                    .setOnItemClickListener(this)
                    .setBackgroundResource(R.color.toolbar_background);
            ListMasterDialog dialog = new ListMasterDialog(builder);
            dialog.setAdapter(new TextDialogAdapter(this,getSimpleStringData(8)));
            dialog.show();
        }else if(v.getId() == R.id.top){
            DialogBuilder builder = new DialogBuilder(this)
                    .setAnimation(R.anim.da_slide_in_top, R.anim.da_slide_out_top)
                    //.setIgnoreStatusBar(false)
                    .setGravity(Gravity.TOP)
                    .setOnItemClickListener(this)
                    .setBackgroundResource(R.color.toolbar_background);
            ListMasterDialog dialog = new ListMasterDialog(builder);
            dialog.setCancelButton(false);
            dialog.setAdapter(new TextDialogAdapter(this,getSimpleStringData(3)));
            dialog.show();
        }else if(v.getId() == R.id.right){
            DialogBuilder builder = new DialogBuilder(this)
                    .setAnimation(R.anim.da_slide_in_right, R.anim.da_slide_out_right)
                    //.setIgnoreStatusBar(false)
                    .setLayoutParams(700, ViewGroup.LayoutParams.MATCH_PARENT)
                    .setGravity(Gravity.RIGHT)
                    .setOnItemClickListener(this)
                    .setBackgroundResource(R.color.toolbar_background);
            ListMasterDialog dialog = new ListMasterDialog(builder);
            dialog.setAdapter(new TextDialogAdapter(this,getSimpleStringData(8)));
            dialog.show();
        }else if(v.getId() == R.id.bottom){
            DialogBuilder builder = new DialogBuilder(this)
                    .setAnimation(R.anim.da_slide_in_bottom, R.anim.da_slide_out_bottom)
                    .setOnItemClickListener(this)
                    //.setIgnoreStatusBar(false)
                    .setGravity(Gravity.BOTTOM);
            ListMasterDialog dialog = new ListMasterDialog(builder);
            dialog.setAdapter(new TextDialogAdapter(this,getSimpleStringData(4)));
            dialog.show();
        }else if(v.getId() == R.id.center){
            DialogBuilder builder = new DialogBuilder(this)
                    .setOnItemClickListener(this)
                    .setAnimation(R.anim.da_fade_in_center, R.anim.da_fade_out_center)
                    //.setIgnoreStatusBar(false)
                    .setGravity(Gravity.CENTER);
            AlertMasterDialog dialog = new AlertMasterDialog(builder);
            dialog.setTitle("提示");
            dialog.setContent("校导网是一家专注于校园精英人才孵化的移动互联网公司,\n" +
                    "以帮助大学生成才为使命,打造了一个基于精品活动的校园交友及职业素养提升平台,\n" +
                    "通过各种比赛、拓展、培训、实习、演讲、沙龙等活动来帮助大学生走出迷茫,\n" +
                    "锻炼实践能力,拓展交际圈子,提升职业素养,实现成功就业与创业。");
            dialog.show();
        }else if(v.getId() == R.id.center1){
            DialogBuilder builder = new DialogBuilder(this)
                    .setAnimation(R.anim.da_fade_in_center, R.anim.da_fade_out_center)
                    .setOnItemClickListener(this)
                    //.setIgnoreStatusBar(false)
                    .setGravity(Gravity.CENTER);
            AlertMasterDialog dialog = new AlertMasterDialog(builder);
            dialog.setTitle("提示");
            dialog.setButton2("取消");
            dialog.setContent("校导网是一家专注于校园精英人才孵化的移动互联网公司,\n" +
                    "以帮助大学生成才为使命,打造了一个基于精品活动的校园交友及职业素养提升平台,\n" +
                    "通过各种比赛、拓展、培训、实习、演讲、沙龙等活动来帮助大学生走出迷茫,\n" +
                    "锻炼实践能力,拓展交际圈子,提升职业素养,实现成功就业与创业。");
            dialog.show();
        }else if(v.getId() == R.id.grid){
            DialogBuilder builder = new DialogBuilder(this)
                    .setAnimation(R.anim.da_slide_in_bottom, R.anim.da_slide_out_bottom)
                    .setOnItemClickListener(this)
                    //.setIgnoreStatusBar(false)
                    .setGravity(Gravity.BOTTOM);
            GridMasterDialog dialog = new GridMasterDialog(builder);
            dialog.setAdapter(new GridDialogAdapter(this, getSimpleGridModelData()));
            dialog.setNumColumns(4);
            dialog.show();
        }
    }

    private GridModel[] getSimpleGridModelData(){
        return new GridModel[]{
                new GridModel(R.mipmap.share_layout_qq_icon,"QQ"),
                new GridModel(R.mipmap.share_layout_wx_icon,"微信"),
                new GridModel(R.mipmap.share_layout_friends_icon,"朋友圈"),
                new GridModel(R.mipmap.share_layout_qq_icon,"QQ"),
                new GridModel(R.mipmap.share_layout_wx_icon,"微信"),
                new GridModel(R.mipmap.share_layout_friends_icon,"朋友圈")
        };
    }

    private String[] getSimpleStringData(int size){
        String[] array = new String[size];
        for (int i= 0;i< size ;i++){
            array[i] = "SIMPLE-DATA" + i;
        }
        return array;
    }

    @Override
    public void onItemClick(MasterDialog dialog, View view, int position) {
        Toast.makeText(this,"Item click:" + position,Toast.LENGTH_SHORT).show();
    }
```

## Maven
	<dependency>
  	    <groupId>net.soulwolf.widget</groupId>
		<url>https://dl.bintray.com/soulwolf/maven</url>
  	    <artifactId>dialogBuilder</artifactId>
  	    <version>1.0.0</version>
	</dependency>
## Gradle
	allprojects {
       repositories {
          jcenter()
       }
	}

	compile 'net.soulwolf.widget:dialogBuilder:1.0.0'

## Developed by
 Ching Soulwolf - Ching.Soulwolf@gmail.com

## License
	Copyright 2015 Soulwolf Ching
	Copyright 2015 The Android Open Source Project for android-dialog-builder

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	    http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.


text:
package io.fabric8.forge.camel.commands.project;

import io.fabric8.forge.addon.utils.completer.PackageNameCompleter;
import io.fabric8.forge.camel.commands.project.helper.CamelCommandsHelper;
import io.fabric8.forge.addon.utils.validator.ClassNameValidator;
import io.fabric8.forge.addon.utils.validator.PackageNameValidator;
import org.jboss.forge.addon.dependencies.DependencyResolver;
import org.jboss.forge.addon.facets.constraints.FacetConstraint;
import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.projects.Project;
import org.jboss.forge.addon.projects.dependencies.DependencyInstaller;
import org.jboss.forge.addon.projects.facets.ClassLoaderFacet;
import org.jboss.forge.addon.projects.facets.ResourcesFacet;
import org.jboss.forge.addon.ui.context.UIBuilder;
import org.jboss.forge.addon.ui.context.UIContext;
import org.jboss.forge.addon.ui.context.UIExecutionContext;
import org.jboss.forge.addon.ui.context.UINavigationContext;
import org.jboss.forge.addon.ui.input.UIInput;
import org.jboss.forge.addon.ui.input.UISelectOne;
import org.jboss.forge.addon.ui.metadata.UICommandMetadata;
import org.jboss.forge.addon.ui.metadata.WithAttributes;
import org.jboss.forge.addon.ui.result.NavigationResult;
import org.jboss.forge.addon.ui.result.Result;
import org.jboss.forge.addon.ui.result.Results;
import org.jboss.forge.addon.ui.util.Categories;
import org.jboss.forge.addon.ui.util.Metadata;
import org.jboss.forge.addon.ui.wizard.UIWizard;
import org.jboss.forge.roaster.model.util.Strings;

import javax.inject.Inject;
import java.util.Map;
import java.util.concurrent.Callable;

@FacetConstraint({JavaSourceFacet.class, ResourcesFacet.class, ClassLoaderFacet.class})
public class CamelNewComponentInstanceSpringCommand extends AbstractCamelProjectCommand implements UIWizard {

    @Inject
    @WithAttributes(label = "componentNameFilter", required = false, description = "To filter components")
    private UISelectOne<String> componentNameFilter;

    @Inject
    @WithAttributes(label = "componentName", required = true, description = "Name of component type to add")
    private UISelectOne<String> componentName;

    @Inject
    @WithAttributes(label = "instanceName", required = true, description = "Name of component instance to add")
    private UISelectOne<String> instanceName;

    @Inject
    @WithAttributes(label = "targetPackage", required = false, description = "The package name where this type will be created")
    private UIInput<String> targetPackage;

    @Inject
    @WithAttributes(label = "className", required = true, description = "Name of the Spring Component class to generate")
    private UIInput<String> className;

    @Inject
    private DependencyInstaller dependencyInstaller;

    @Inject
    private DependencyResolver dependencyResolver;

    @Override
    public UICommandMetadata getMetadata(UIContext context) {
        return Metadata.forCommand(CamelNewComponentInstanceSpringCommand.class).name(
                "Camel: New Component Spring").category(Categories.create(CATEGORY))
                .description("Creates a new Camel component instance configuration using Spring");
    }

    @Override
    public boolean isEnabled(UIContext context) {
        boolean enabled = super.isEnabled(context);
        if (enabled) {
            return CamelCommandsHelper.isSpringProject(getSelectedProject(context));
        }
        return false;
    }

    @Override
    public void initializeUI(UIBuilder builder) throws Exception {
        Project project = getSelectedProject(builder.getUIContext());
        JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);

        componentNameFilter.setValueChoices(CamelCommandsHelper.createComponentNameValues(project));
        componentNameFilter.setDefaultValue("<all>");
        componentName.setValueChoices(CamelCommandsHelper.createComponentNameValues(project, componentNameFilter, false));

        instanceName.setDefaultValue(new Callable<String>() {
            @Override
            public String call() throws Exception {
                String value = componentName.getValue();
                if (value != null) {
                    // the component may have a dash, so remove it
                    value = value.replaceAll("-", "");
                }
                // TODO if we already have a endpoint instance of the same name then lets return null
                return value;
            }
        });

        targetPackage.setCompleter(new PackageNameCompleter(facet));
        targetPackage.addValidator(new PackageNameValidator());
        targetPackage.setDefaultValue("org.apache.camel.spring.components");

        className.addValidator(new ClassNameValidator(false));
        className.setDefaultValue(new Callable<String>() {
            @Override
            public String call() throws Exception {
                return getDefaultProducerClassName();
            }
        });

        builder.add(componentNameFilter).add(componentName).add(instanceName).add(targetPackage).add(className);
    }

    @Override
    public NavigationResult next(UINavigationContext context) throws Exception {
        Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
        attributeMap.put("componentName", componentName.getValue());
        attributeMap.put("instanceName", instanceName.getValue());
        attributeMap.put("targetPackage", targetPackage.getValue());
        attributeMap.put("className", className.getValue());
        attributeMap.put("kind", "spring");
        return Results.navigateTo(ConfigureComponentPropertiesStep.class);
    }

    @Override
    public Result execute(UIExecutionContext context) throws Exception {
        return Results.success();
    }

    protected String getDefaultProducerClassName() {
        String name = instanceName.getValue();
        if (!Strings.isBlank(name)) {
            return Strings.capitalize(name) + "ComponentFactory";
        }
        return null;
    }

}


text:
package com.netflix.spectator.api;

import java.util.function.ToDoubleFunction;

/**
 * Function to extract a double value from an object.
 */
public abstract class DoubleFunction<T extends Number> implements ToDoubleFunction<T> {

  @Override public double applyAsDouble(T n) {
    return apply(n.doubleValue());
  }

  /**
   * Apply a transform to the value `v`.
   *
   * @param v
   *     Double value to transform.
   * @return
   *     Result of applying this function to `v`.
   */
  public abstract double apply(double v);
}


text:
[![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat
)](https://developer.apple.com/iphone/index.action)
[![Language](http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat
)](https://developer.apple.com/swift)
[![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat
)](http://mit-license.org)
[![CocoaPods](https://img.shields.io/cocoapods/v/SwiftyWalkthrough.svg)]()
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

SwiftyWalkthrough is a library for creating great walkthrough experiences in your apps, written in Swift.
You can use the library to allow users to navigate and explore your app, step by step, in a predefined way controlled by you.

## Features

- [x] Add walkthroughs to your app with little effort: you don't need to change anything in your view hierarchy.
- [x] SwiftyWalkthrough is great for onboarding, walkthroughs, tutorials, etc.
- [x] Control with precision which views are accessible to the user in a given time.
- [x] Take users through a series of steps, even across multiple screens.
- [x] Is simple!

## Preview

SwiftyWalkthrough provides you with a framework to build your walkthrough experience, giving you full control over what you want to achieve. The following examples were built using SwiftyWalkthrough:

![SwiftyWalkthrough demo](https://raw.githubusercontent.com/ruipfcosta/SwiftyWalkthrough/master/extras/demo.gif)

![MyChoicePad demo](https://raw.githubusercontent.com/ruipfcosta/SwiftyWalkthrough/master/extras/demo-mcp.gif)

## Usage

SwiftyWalkthrough works by adding an overlay on top of your screen, blocking the access to your views. You can then control which views should be made accessible and when.

### Initialize a walkthrough or attach to an existing one

```swift
import SwiftyWalkthrough

if let _ = walkthroughView {
	// Attached to existing walkthrough
} else {
   let myCustomWalkthrough = CustomWalkthroughView()
   startWalkthrough(myCustomWalkthrough)
   // Walkthrough initialized
}
```

### Check if there is an ongoing walkthrough

Sometimes it is useful to know if there is an ongoing walkthrough (i.e. to adjust the logic on the view controllers). In that situation you can make use of the property ```ongoingWalkthrough```.

```swift
@IBAction func switchValueChanged(sender: UISwitch) {
    customWalkthroughView?.removeAllHoles()
    customWalkthroughView?.helpLabel.hidden = true

    NSUserDefaults.standardUserDefaults().setBool(true, forKey: "settingsWalkthroughComplete")

    if ongoingWalkthrough {
        navigationController?.popToRootViewControllerAnimated(true)
    }
}
```

### Cut holes on the overlay for the views you want to expose

```swift
@IBOutlet weak var nameField: UITextField!
@IBOutlet weak var surnameField: UITextField!
@IBOutlet weak var addressField: UITextField!

override func viewDidAppear(animated: Bool) {
	super.viewDidAppear(animated)
	walkthroughView?.cutHolesForViews([nameField]) // start by only allowing the interaction with nameField
}
```

`cutHolesForViews` will only look into your views' frames to cut the holes in the overlay. If you want to add some extra padding or define a corner radius, use `cutHolesForViewDescriptors` like this:

```swift
let descriptors = [
	ViewDescriptor(view: showProfileButton, extraPaddingX: 20, extraPaddingY: 10, cornerRadius: 10)
]

walkthroughView?.cutHolesForViewDescriptors(descriptors)
```

### Remove the holes

```swift
walkthroughView?.removeAllHoles()
```

### Close the walkthrough when it is finished

```swift
finishWalkthrough()
```

### Customization

By default, SwiftyWalkthrough only provides the mechanism to block the access to your views and cut holes to access them, it's up to you to customize it to suit your needs. You can do it by subclassing ```WalkthroughView``` and start the walkthrough with your custom walkthrough view. You can find more about this on the example provided with the library.

```swift
import UIKit
import SwiftyWalkthrough

class CustomWalkthroughView: WalkthroughView {
    // customize it
}

let myCustomWalkthrough = CustomWalkthroughView()
startWalkthrough(myCustomWalkthrough)
```

To specify the overlay's dim color at any time you just need to set the property `dimColor`:

```swift
walkthroughView?.dimColor = UIColor.redColor().colorWithAlphaComponent(0.7).CGColor
```

### WalkthroughViewDelegate

If for some reason you need to be notified right before the interaction with an exposed view, you can provide an implementation for the `willInteractWithView` method:

```swift
// MARK: - WalkthroughViewDelegate

func willInteractWithView(view: UIView) {
    print("Will interact with view \(view)")
}
```

**Note:** Keep in mind that `willInteractWithView` may be invoked multiple times, depending on the view hierarchy, as it relies on UIView's `hitTest` method. From the [UIView Class Reference](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/index.html#//apple_ref/occ/instm/UIView/hitTest:withEvent:):

> This method traverses the view hierarchy by calling the pointInside:withEvent: method of each subview to determine which subview should receive a touch event. If pointInside:withEvent: returns true, then the subview's hierarchy is similarly traversed until the frontmost view containing the specified point is found. If a view does not contain the point, its branch of the view hierarchy is ignored. You rarely need to call this method yourself, but you might override it to hide touch events from subviews.

> This method ignores view objects that are hidden, that have disabled user interactions, or have an alpha level less than 0.01. This method does not take the view's content into account when determining a hit. Thus, a view can still be returned even if the specified point is in a transparent portion of that view's content.

> Points that lie outside the receiver's bounds are never reported as hits, even if they actually lie within one of the receiver's subviews. This can occur if the current view's clipsToBounds property is set to false and the affected subview extends beyond the view's bounds.

## Requirements

* iOS 9.0+
* Xcode 10.2.1 / Swift 5

## Instalation

### CocoaPods

```ruby
platform :ios, '9.0'
use_frameworks!

pod 'SwiftyWalkthrough'
```

### Carthage

```ogdl
github "ruipfcosta/SwiftyWalkthrough"
```

## Credits

Owned and maintained by Rui Costa ([@ruipfcosta](https://twitter.com/ruipfcosta)).

Thanks to Andrew Jackman ([@andrew_jackman](https://twitter.com/andrew_jackman)).

## Contributing

Bug reports and pull requests are welcome.

## License

SwiftyWalkthrough is released under the MIT license. See LICENSE for details.


text:
"""Tests for rsyslog state checks."""

from grr.lib import flags
from grr.lib import test_lib
from grr.lib.checks import checks_test_lib
from grr.parsers import config_file

class RsyslogCheckTests(checks_test_lib.HostCheckTest):
  """Test the rsyslog checks."""

  @classmethod
  def setUpClass(cls):
    cls.LoadCheck("rsyslog.yaml")
    cls.parser = config_file.RsyslogParser()

  def testLoggingAuthRemoteOK(self):
    chk_id = "CIS-LOGGING-AUTH-REMOTE"

    test_data = {
        "/etc/rsyslog.conf":
            "*.* @@tcp.example.com.:514;RSYSLOG_ForwardFormat"
    }
    host_data = self.GenFileData("LinuxRsyslogConfigs", test_data, self.parser)
    results = self.RunChecks(host_data)
    self.assertCheckUndetected(chk_id, results)

  def testLoggingAuthRemoteFail(self):
    chk_id = "CIS-LOGGING-AUTH-REMOTE"

    test_data = {"/etc/rsyslog.conf": "*.* /var/log/messages"}
    host_data = self.GenFileData("LinuxRsyslogConfigs", test_data, self.parser)
    sym = "Missing attribute: No remote destination for auth logs."
    found = ["Expected state was not found"]
    results = self.RunChecks(host_data)
    self.assertCheckDetectedAnom(chk_id, results, sym, found)

  def testLoggingFilePermissions(self):
    chk_id = "CIS-LOGGING-FILE-PERMISSIONS"

    ro = self.CreateStat("/test/ro", 0, 0, 0o0100640)
    rw = self.CreateStat("/test/rw", 0, 0, 0o0100666)

    sym = "Found: Log configurations can be modified by non-privileged users."
    found = ["/test/rw user: 0, group: 0, mode: -rw-rw-rw-"]
    results = self.GenResults(["LinuxRsyslogConfigs"], [[ro, rw]])
    self.assertCheckDetectedAnom(chk_id, results, sym, found)

def main(argv):
  test_lib.GrrTestProgram(argv=argv)

if __name__ == "__main__":
  flags.StartMain(main)


text:
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module    : QModelIndex.hs
    Copyright : (c) David Harley 2010
    Project   : qtHaskell
    Version   : 1.1.4
    Modified  : 2010-09-02 17:02:31

    Warning   : this file is machine generated - do not modify.
--}
-----------------------------------------------------------------------------

module Qtc.Core.QModelIndex (
  QqModelIndex(..)
  ,QqModelIndex_nf(..)
  ,internalId
  ,internalPointer
  ,qModelIndex_delete
  )
  where

import Qth.ClassTypes.Core
import Qtc.Enums.Base
import Qtc.Enums.Core.Qt

import Qtc.Classes.Base
import Qtc.Classes.Qccs
import Qtc.Classes.Core
import Qtc.ClassTypes.Core
import Qth.ClassTypes.Core

class QqModelIndex x1 where
  qModelIndex :: x1 -> IO (QModelIndex ())

instance QqModelIndex (()) where
 qModelIndex ()
  = withQModelIndexResult $
    qtc_QModelIndex

foreign import ccall "qtc_QModelIndex" qtc_QModelIndex :: IO (Ptr (TQModelIndex ()))

instance QqModelIndex ((QModelIndex t1)) where
 qModelIndex (x1)
  = withQModelIndexResult $
    withObjectPtr x1 $ \cobj_x1 ->
    qtc_QModelIndex1 cobj_x1

foreign import ccall "qtc_QModelIndex1" qtc_QModelIndex1 :: Ptr (TQModelIndex t1) -> IO (Ptr (TQModelIndex ()))

class QqModelIndex_nf x1 where
  qModelIndex_nf :: x1 -> IO (QModelIndex ())

instance QqModelIndex_nf (()) where
 qModelIndex_nf ()
  = withObjectRefResult $
    qtc_QModelIndex

instance QqModelIndex_nf ((QModelIndex t1)) where
 qModelIndex_nf (x1)
  = withObjectRefResult $
    withObjectPtr x1 $ \cobj_x1 ->
    qtc_QModelIndex1 cobj_x1

instance Qchild (QModelIndex a) ((Int, Int)) (IO (QModelIndex ())) where
 child x0 (x1, x2)
  = withQModelIndexResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_child cobj_x0 (toCInt x1) (toCInt x2)

foreign import ccall "qtc_QModelIndex_child" qtc_QModelIndex_child :: Ptr (TQModelIndex a) -> CInt -> CInt -> IO (Ptr (TQModelIndex ()))

instance Qcolumn (QModelIndex a) (()) where
 column x0 ()
  = withIntResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_column cobj_x0

foreign import ccall "qtc_QModelIndex_column" qtc_QModelIndex_column :: Ptr (TQModelIndex a) -> IO CInt

instance Qqdata (QModelIndex ()) (()) (IO (QVariant ())) where
 qdata x0 ()
  = withQVariantResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data cobj_x0

foreign import ccall "qtc_QModelIndex_data" qtc_QModelIndex_data :: Ptr (TQModelIndex a) -> IO (Ptr (TQVariant ()))

instance Qqdata (QModelIndexSc a) (()) (IO (QVariant ())) where
 qdata x0 ()
  = withQVariantResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data cobj_x0

instance Qqdata_nf (QModelIndex ()) (()) (IO (QVariant ())) where
 qdata_nf x0 ()
  = withObjectRefResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data cobj_x0

instance Qqdata_nf (QModelIndexSc a) (()) (IO (QVariant ())) where
 qdata_nf x0 ()
  = withObjectRefResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data cobj_x0

instance Qqdata (QModelIndex ()) ((Int)) (IO (QVariant ())) where
 qdata x0 (x1)
  = withQVariantResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data1 cobj_x0 (toCInt x1)

foreign import ccall "qtc_QModelIndex_data1" qtc_QModelIndex_data1 :: Ptr (TQModelIndex a) -> CInt -> IO (Ptr (TQVariant ()))

instance Qqdata (QModelIndexSc a) ((Int)) (IO (QVariant ())) where
 qdata x0 (x1)
  = withQVariantResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data1 cobj_x0 (toCInt x1)

instance Qqdata_nf (QModelIndex ()) ((Int)) (IO (QVariant ())) where
 qdata_nf x0 (x1)
  = withObjectRefResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data1 cobj_x0 (toCInt x1)

instance Qqdata_nf (QModelIndexSc a) ((Int)) (IO (QVariant ())) where
 qdata_nf x0 (x1)
  = withObjectRefResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_data1 cobj_x0 (toCInt x1)

instance Qflags (QModelIndex a) (()) (IO (ItemFlags)) where
 flags x0 ()
  = withQFlagsResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_flags cobj_x0

foreign import ccall "qtc_QModelIndex_flags" qtc_QModelIndex_flags :: Ptr (TQModelIndex a) -> IO CLong

internalId :: QModelIndex a -> (()) -> IO (Int)
internalId x0 ()
  = withLongLongResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_internalId cobj_x0

foreign import ccall "qtc_QModelIndex_internalId" qtc_QModelIndex_internalId :: Ptr (TQModelIndex a) -> IO CLLong

internalPointer :: QModelIndex a -> (()) -> IO (QVoid ())
internalPointer x0 ()
  = withObjectRefResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_internalPointer cobj_x0

foreign import ccall "qtc_QModelIndex_internalPointer" qtc_QModelIndex_internalPointer :: Ptr (TQModelIndex a) -> IO (Ptr (TQVoid ()))

instance QqisValid (QModelIndex ()) (()) where
 qisValid x0 ()
  = withBoolResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_isValid cobj_x0

foreign import ccall "qtc_QModelIndex_isValid" qtc_QModelIndex_isValid :: Ptr (TQModelIndex a) -> IO CBool

instance QqisValid (QModelIndexSc a) (()) where
 qisValid x0 ()
  = withBoolResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_isValid cobj_x0

instance Qmodel (QModelIndex a) (()) (IO (QAbstractItemModel ())) where
 model x0 ()
  = withQAbstractItemModelResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_model cobj_x0

foreign import ccall "qtc_QModelIndex_model" qtc_QModelIndex_model :: Ptr (TQModelIndex a) -> IO (Ptr (TQAbstractItemModel ()))

instance Qparent (QModelIndex a) (()) (IO (QModelIndex ())) where
 parent x0 ()
  = withQModelIndexResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_parent cobj_x0

foreign import ccall "qtc_QModelIndex_parent" qtc_QModelIndex_parent :: Ptr (TQModelIndex a) -> IO (Ptr (TQModelIndex ()))

instance Qrow (QModelIndex a) (()) where
 row x0 ()
  = withIntResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_row cobj_x0

foreign import ccall "qtc_QModelIndex_row" qtc_QModelIndex_row :: Ptr (TQModelIndex a) -> IO CInt

instance Qsibling (QModelIndex a) ((Int, Int)) where
 sibling x0 (x1, x2)
  = withQModelIndexResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_sibling cobj_x0 (toCInt x1) (toCInt x2)

foreign import ccall "qtc_QModelIndex_sibling" qtc_QModelIndex_sibling :: Ptr (TQModelIndex a) -> CInt -> CInt -> IO (Ptr (TQModelIndex ()))

qModelIndex_delete :: QModelIndex a -> IO ()
qModelIndex_delete x0
  = withObjectPtr x0 $ \cobj_x0 ->
    qtc_QModelIndex_delete cobj_x0

foreign import ccall "qtc_QModelIndex_delete" qtc_QModelIndex_delete :: Ptr (TQModelIndex a) -> IO ()


text:
[StormForge Optimize Live][1] applies machine learning to your observability metrics to make real-time recommendations to resource requests for any deployment running in Kubernetes.

**With StormForge Optimize Live, you can:**
- Improve resource efficiency
- Leverage existing observability data
- Reduce risk of performance issues
- Achieve fast time to value
- Deploy recommendations automatically or with approval

## Setup

To set up this integration, you must have a StormForge account along with Datadog API and application keys.

### Configuration

1. Create a [Datadog API key][2].
2. Create a [Datadog application key][3].
3. Add Datadog API and application keys to the [StormForge Datadog Integration][4].
4. Deploy Optimize Live
5. Set up your Applications within [StormForge][5].

More detailed instructions can be found in the StormForge [getting started guide][6].

## Data Collected

### Metrics

See [metadata.csv][7] for a list of metrics provided by this integration.

### Events

The StormForge integration creates events for:
- Application updates
- Recommendations that have been applied

### Service Checks

The StormForge integration does not include any service checks.

## Support

For questions or other support, you can contact StormForge via [email][8].

[1]: https://www.stormforge.io/how-stormforge-optimize-live-works/
[2]: https://docs.datadoghq.com/account_management/api-app-keys/#api-keys
[3]: https://docs.datadoghq.com/account_management/api-app-keys/#application-keys
[4]: https://docs.stormforge.io/optimize-live/getting-started/install/#datadog-metric-provider
[5]: https://app.stormforge.io
[6]: https://docs.stormforge.io/optimize-live/
[7]: https://github.com/DataDog/integrations-extras/blob/master/stormforge/metadata.csv
[8]: mailto:support@stormforge.io


text:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Ionic todo</name>
    <description>TODO application to test Ionic Framework 2 and Cordova.</description>
    <author email="jujens@jujens.eu" href="https://github.com/Jenselme/tests-ionic2-and-aurelia-framework7/tree/master">Julien Enselme</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
</widget>


text:
@interface WKTravleDetailCell : UITableViewCell

//@property (strong, nonatomic)UIImageView *headerImageView;
//@property (strong, nonatomic)UIImageView *starImageView;
//@property (strong, nonatomic)UIImageView *star1ImageView;
//@property (strong, nonatomic)UIImageView *star2ImageView;
//@property (strong, nonatomic)UIImageView *star3ImageView;
//@property (strong, nonatomic)UIImageView *star4ImageView;
//@property (strong, nonatomic)UILabel *textsLabel;
//@property (strong, nonatomic)UIImageView *textImageView;
//@property (strong, nonatomic)UIImageView *siteImageView;
//@property (strong, nonatomic)UIButton *siteNameButton;

@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *textsLabel;
@property (strong, nonatomic) IBOutlet UIImageView *textImageView;

@end


text:
package com.willlee.concurrency.lock;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

public class LockSupportBlockerExam {
    public static void main(String[] args) {
        Thread t3 = new Thread() {
            @Override
            public void run() {
                Thread.currentThread().setName("t3");
                System.out.println(Thread.currentThread().getName() + " park 5 seconds");
                // park 5 seconds, set blocker
                Object blocker = new String("Alex Wang");
                LockSupport.parkUntil(blocker,
                        System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(5, TimeUnit.SECONDS));
                System.out.println(Thread.currentThread().getName() + " after park");
            }
        };
        t3.start();

        try {
            Object t3_blocker = null;
            while (t3_blocker == null) {
                t3_blocker = LockSupport.getBlocker(t3);
                TimeUnit.MILLISECONDS.sleep(10);
            }
            System.out.println("t3 blocker is :" + t3_blocker);
            t3.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}


text:
"""
Minimum Domino version supported by this python-domino library
"""
MINIMUM_SUPPORTED_DOMINO_VERSION = "4.1.0"

"""
Minimum Domino version allowed by this python-domino library
This version is set to be deprecated in the future
"""
MINIMUM_GA_DOMINO_VERSION = "3.6.0"

"""
Minimum Domino version supporting on demand spark cluster
"""
MINIMUM_ON_DEMAND_SPARK_CLUSTER_SUPPORT_DOMINO_VERSION = "4.2.0"

"""
Minimum Domino version supporting distributed compute cluster launching
"""
MINIMUM_DISTRIBUTED_CLUSTER_SUPPORT_DOMINO_VERSION = "4.5.0"

"""
Distributed compute cluster types and their minimum supported Domino version
"""
CLUSTER_TYPE_MIN_SUPPORT = [
    ("Spark", "4.5.0"),
    ("Ray", "4.5.0"),
    ("Dask", "4.6.0"),
    ("MPI", "5.1.1"),
]

"""
Minimum Domino version that supports compute cluster autoscaling
"""
COMPUTE_CLUSTER_AUTOSCALING_MIN_SUPPORT_DOMINO_VERSION = "5.0.0"

"""
Minimum Domino version supporting external volume mounts
"""
MINIMUM_EXTERNAL_VOLUME_MOUNTS_SUPPORT_DOMINO_VERSION = "4.3.3"

"""
Environment variable names used by this python-domino library. The values
here match the environment variable names a user would find on a deployment.
"""
DOMINO_TOKEN_FILE_KEY_NAME = "DOMINO_TOKEN_FILE"
DOMINO_USER_API_KEY_KEY_NAME = "DOMINO_USER_API_KEY"
DOMINO_HOST_KEY_NAME = "DOMINO_API_HOST"
DOMINO_LOG_LEVEL_KEY_NAME = "DOMINO_LOG_LEVEL"
DOMINO_USER_NAME_KEY_NAME = "DOMINO_USER_NAME"
DOMINO_VERIFY_CERTIFICATE = "DOMINO_VERIFY_CERTIFICATE"
DOMINO_API_PROXY = "DOMINO_API_PROXY"