text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tab;

import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.device.DeviceClassManager;
import org.chromium.chrome.browser.util.AccessibilityUtil;
import org.chromium.components.security_state.ConnectionSecurityLevel;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content_public.browser.WebContents;

/**
 * A delegate to determine visibility of the top controls.
 */
public class TopControlsVisibilityDelegate {
    protected final Tab mTab;

    /**
     * Basic constructor.
     * @param tab The associated {@link Tab}.
     */
    public TopControlsVisibilityDelegate(Tab tab) {
        mTab = tab;
    }

    /**
     * @return Whether hiding top controls is enabled or not.
     */
    public boolean isHidingTopControlsEnabled() {
        WebContents webContents = mTab.getWebContents();
        if (webContents == null || webContents.isDestroyed()) return false;

        String url = mTab.getUrl();
        boolean enableHidingTopControls = url != null;
        enableHidingTopControls &= !url.startsWith(UrlConstants.CHROME_SCHEME);
        enableHidingTopControls &= !url.startsWith(UrlConstants.CHROME_NATIVE_SCHEME);

        int securityState = mTab.getSecurityLevel();
        enableHidingTopControls &= (securityState != ConnectionSecurityLevel.SECURITY_ERROR
                && securityState != ConnectionSecurityLevel.SECURITY_WARNING);

        enableHidingTopControls &=
                !AccessibilityUtil.isAccessibilityEnabled(mTab.getApplicationContext());

        ContentViewCore cvc = mTab.getContentViewCore();
        enableHidingTopControls &= cvc == null || !cvc.isFocusedNodeEditable();
        enableHidingTopControls &= !mTab.isShowingErrorPage();
        enableHidingTopControls &= !webContents.isShowingInterstitialPage();
        enableHidingTopControls &= (mTab.getFullscreenManager() != null);
        enableHidingTopControls &= DeviceClassManager.enableFullscreen();
        enableHidingTopControls &= !DeviceClassManager.isAutoHidingToolbarDisabled(
                mTab.getApplicationContext());
        enableHidingTopControls &= !mTab.isFullscreenWaitingForLoad();

        return enableHidingTopControls;
    }

    /**
     * @return Whether showing top controls is enabled or not.
     */
    public boolean isShowingTopControlsEnabled() {
        if (mTab.getFullscreenManager() == null) return true;
        return !mTab.getFullscreenManager().getPersistentFullscreenMode();
    }
}


text:
..
    Copyright 2016 Hewlett Packard Enterprise Development Company LP

    Author: Federico Ceratto <federico.ceratto@hpe.com>

    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.

gdnsd Agent backend
*******************

User documentation
==================

This page documents the Agent backend for `gdnsd <http://gdnsd.org/>`_.

The agent runs on the same host as the resolver. It receives DNS messages
from Mini DNS using private DNS OPCODEs and classes and
creates/updates/deletes zones on gdnsd using zone files under
the gdnsd configuration directory.

The backend supports gdnsd from version 2.0

`gdnsd documentation <https://github.com/gdnsd/gdnsd/wiki>`_

Setting up gdnsd on Ubuntu Vivid
--------------------------------

Run as root:

.. code-block:: bash

    apt-get update
    apt-get install gdnsd

Configuring gdnsd
-----------------

Assuming gdnsd has been freshly installed on the system, run as root:

.. code-block:: bash

    # Monitor syslog during the next steps
    tail -f /var/log/syslog

    # config check should be successful
    /usr/sbin/gdnsd checkconf

    # Start the daemon if needed
    service gdnsd status
    service gdnsd start

    # gdnsd should be listening on TCP and UDP ports
    netstat -lnptu | grep '/gdnsd'

    # Test the daemon: it should respond with "gdnsd"
    dig @127.0.0.1 CH TXT +short

Configure the "service.agent" and "backend.agent.gdnsd" sections
in /etc/designate/designate.conf

Look in designate.conf.example for more complete examples

.. code-block:: ini

    [service:agent]
    backend_driver = gdnsd
    # Place here the MiniDNS ipaddr and port (not the agent itself)
    masters = 192.168.27.100:5354

    [backend:agent:gdnsd]
    #gdnsd_cmd_name = gdnsd
    #confdir_path = /etc/gdnsd
    #query_destination = 127.0.0.1

Ensure that the "zones" directory under "confdir_path" (default /etc/gdnsd)
is readable and writable by the system user running the Designate Agent

Create an agent pool:

.. code-block:: bash

    # Fetch the existing pool(s) if needed
    designate-manage pool generate_file --file /tmp/pool.yaml
    # Edit the file (see below) and reload it as:
    designate-manage pool update --file /tmp/pool.yaml

The "targets" section in pool.yaml should look like:

.. code-block:: ini

  targets:
  - description: gdnsd agent
    masters:
    - host: <MiniDNS IP addr>
      port: 5354
    options: {}
    options:
    - host: <Agent IP addr>
      port: 5358
    type: agent

Start the Designate Agent. You should see log messages similar to:

.. code-block:: bash

    2016-05-03 15:13:38.193 INFO designate.backend.agent_backend.impl_gdnsd [-] gdnsd command: 'gdnsd'
    2016-05-03 15:13:38.193 INFO designate.backend.agent_backend.impl_gdnsd [-] gdnsd conf directory: '/etc/gdnsd'
    2016-05-03 15:13:38.194 INFO designate.backend.agent_backend.impl_gdnsd [-] Resolvers: ['127.0.0.1']

redpajama_set_name: RedPajamaGithub


text:
sk_skype_bot
============

Shopkick's Skype Bot

  To run Shopkick's Skype Bot on OSX

  1. Download python 2.X from python.org. Make sure to grab a version with python-32 (the 32 bit version of python)
  2. arch -i386 pip install Skype4Py
  3. python-32 SKSkypeBotpy

  To add additional reponses to the skype bot:
   1. decide on the command you want to implement: e.g !sayhi
   2. Create a new file and class in the responses folder: sayhi.py
   3. Implement a reponse method.
   4. Update the commands dictionary below. The key is your regexp to match. Value is the filename.
   5. Go to response/help.py and put in instructions on how to use your command


text:
{% extends "dashboard/dashboard.html" %}
{% load static %}
{% load widget_tweaks %}

{% block window_title %}Dashboard - {{ title }}{% endblock window_title %}
{% block view_title %}{{ title }}{% endblock view_title %}

{% block options %}

    

{% endblock options %}

{% block page %}

          <form class="card-form" action="" method="POST">
            {% csrf_token %}

                {% if messages %}
                  {% for message in messages %}
                  {{ message }}
                  {% endfor %}
                {% endif %}

              {% for field in form %}

                  {{ field.label }}

                  {% if field|widget_type == 'textarea' %}
                    {% render_field field  class+="materialize-textarea" %}
                  {% else %}
                    {% render_field field %}
                  {% endif %}

{{ field.errors }}

              {% endfor %}

                <button class="btn btn-large waves-effect waves-green right" type="submit" name="save">Save Bucket List</button>

          </form>

{% endblock page %}

{% block modals %}
	{# include modals here #}
{% endblock modals %}


text:
<?php

namespace Pred\DemandeBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * EvaluateurRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class EvaluateurRepository extends EntityRepository
{
}


text:
var assert = require('assert')
var basename = require('path').basename
var captureStderr = require('./support/capture-stderr')
var depd = require('..')
var libs = require('./fixtures/libs')
var mylib = libs.my
var path = require('path')
var script = path.join(__dirname, 'fixtures', 'script.js')
var spawn = require('child_process').spawn
var strictlib = libs.strict

describe('depd(namespace)', function () {
  it('creates deprecated function', function () {
    assert.strictEqual(typeof depd('test'), 'function')
  })

  it('requires namespace', function () {
    assert.throws(depd.bind(null), /namespace.*required/)
  })
})

describe('deprecate(message)', function () {
  it('should log namespace', function () {
    function callold () { mylib.old() }
    assert.ok(captureStderr(callold).indexOf('my-lib') !== -1)
  })

  it('should log deprecation', function () {
    function callold () { mylib.old() }
    assert.ok(captureStderr(callold).indexOf('deprecate') !== -1)
  })

  it('should log message', function () {
    function callold () { mylib.old() }
    assert.ok(captureStderr(callold).indexOf('old') !== -1)
  })

  it('should log call site', function () {
    function callold () { mylib.old() }
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(basename(__filename)) !== -1)
    assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
  })

  it('should log call site from strict lib', function () {
    function callold () { strictlib.old() }
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(basename(__filename)) !== -1)
    assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
  })

  it('should log call site regardless of Error.stackTraceLimit', function () {
    function callold () { mylib.old() }
    var limit = Error.stackTraceLimit
    try {
      Error.stackTraceLimit = 1
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
    } finally {
      Error.stackTraceLimit = limit
    }
  })

  it('should log call site within eval', function () {
    function callold () { eval('mylib.old()') } // eslint-disable-line no-eval
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(basename(__filename)) !== -1)
    assert.ok(stderr.indexOf('<anonymous>:1:') !== -1)
    assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
  })

  it('should log call site within strict', function () {
    function callold () { 'use strict'; mylib.old() }
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(basename(__filename)) !== -1)
    assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
  })

  it('should only warn once per call site', function () {
    function callold () {
      for (var i = 0; i < 5; i++) {
        mylib.old() // single call site
        process.stderr.write('invoke ' + i + '\n')
      }
    }

    var stderr = captureStderr(callold)
    assert.strictEqual(stderr.split('deprecated').length, 2)
    assert.strictEqual(stderr.split('invoke').length, 6)
  })

  it('should warn for different fns on same call site', function () {
    var prop

    function callold () {
      mylib[prop]() // call from same site
    }

    prop = 'old'
    assert.ok(captureStderr(callold).indexOf(basename(__filename)) !== -1)

    prop = 'old2'
    assert.ok(captureStderr(callold).indexOf(basename(__filename)) !== -1)
  })

  it('should warn for different calls on same line', function () {
    function callold () {
      mylib.old(); mylib.old()
    }

    var stderr = captureStderr(callold)
    var fileline = stderr.match(/\.js:[0-9]+:/)
    assert.ok(stderr.indexOf(basename(__filename)) !== -1)
    assert.strictEqual(stderr.split('deprecated').length, 3)
    assert.strictEqual(stderr.split(fileline[0]).length, 3)
  })

  describe('when message omitted', function () {
    it('should generate message for method call on named function', function () {
      function callold () { mylib.automsgnamed() }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(stderr.indexOf(' automsgnamed ') !== -1)
    })

    it('should generate message for function call on named function', function () {
      function callold () {
        var fn = mylib.automsgnamed
        fn()
      }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(stderr.indexOf(' automsgnamed ') !== -1)
    })

    it('should generate message for method call on unnamed function', function () {
      function callold () { mylib.automsg() }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(stderr.indexOf(' exports.automsg ') !== -1)
    })

    it('should generate message for function call on unnamed function', function () {
      function callold () {
        var fn = mylib.automsg
        fn()
      }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(stderr.indexOf(' exports.automsg ') !== -1)
    })

    it('should generate message for function call on anonymous function', function () {
      function callold () { mylib.automsganon() }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(/ exports\.automsganon | <anonymous@[^\\/]+[^:]+:[0-9]+:[0-9]+> /.test(stderr))
    })

    describe('in strict mode library', function () {
      it('should generate message for method call on named function', function () {
        function callold () { strictlib.automsgnamed() }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(stderr.indexOf(' automsgnamed ') !== -1)
      })

      it('should generate message for function call on named function', function () {
        function callold () {
          var fn = strictlib.automsgnamed
          fn()
        }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(stderr.indexOf(' automsgnamed ') !== -1)
      })

      it('should generate message for method call on unnamed function', function () {
        function callold () { strictlib.automsg() }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(stderr.indexOf(' exports.automsg ') !== -1)
      })

      it('should generate message for function call on unnamed function', function () {
        function callold () {
          var fn = strictlib.automsg
          fn()
        }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(stderr.indexOf(' exports.automsg ') !== -1)
      })

      it('should generate message for function call on anonymous function', function () {
        function callold () { strictlib.automsganon() }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(/ exports\.automsganon | <anonymous@[^\\/]+[^:]+:[0-9]+:[0-9]+> /.test(stderr))
      })
    })
  })

  describe('when output supports colors', function () {
    var stderr
    before(function () {
      function callold () { mylib.old() }
      stderr = captureStderr(callold, true)
    })

    it('should log in color', function () {
      assert.notStrictEqual(stderr, '')
      assert.ok(stderr.indexOf('\x1b[') !== -1)
    })

    it('should log namespace', function () {
      assert.ok(stderr.indexOf('my-lib') !== -1)
    })

    it('should log deprecation', function () {
      assert.ok(stderr.indexOf('deprecate') !== -1)
    })

    it('should log message', function () {
      assert.ok(stderr.indexOf('old') !== -1)
    })

    it('should log call site', function () {
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
    })
  })

  describe('when output does not support colors', function () {
    var stderr
    before(function () {
      function callold () { mylib.old() }
      stderr = captureStderr(callold, false)
    })

    it('should not log in color', function () {
      assert.notStrictEqual(stderr, '')
      assert.ok(stderr.indexOf('\x1b[') === -1)
    })

    it('should log namespace', function () {
      assert.ok(stderr.indexOf('my-lib') !== -1)
    })

    it('should log timestamp', function () {
      assert.ok(/\w+, \d+ \w+ \d{4} \d{2}:\d{2}:\d{2} \w{3}/.test(stderr))
    })

    it('should log deprecation', function () {
      assert.ok(stderr.indexOf('deprecate') !== -1)
    })

    it('should log message', function () {
      assert.ok(stderr.indexOf('old') !== -1)
    })

    it('should log call site', function () {
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))
    })
  })
})

describe('deprecate.function(fn, message)', function () {
  it('should throw when not given function', function () {
    var deprecate = depd('test')
    assert.throws(deprecate.function.bind(deprecate, 2), /fn.*function/)
  })

  it('should log on call to function', function () {
    function callold () { mylib.oldfn() }
    assert.ok(captureStderr(callold).indexOf(' oldfn ') !== -1)
  })

  it('should have same arity', function () {
    assert.strictEqual(mylib.oldfn.length, 2)
  })

  it('should pass arguments', function () {
    var ret
    function callold () { ret = mylib.oldfn(1, 2) }
    assert.ok(captureStderr(callold).indexOf(' oldfn ') !== -1)
    assert.strictEqual(ret, 2)
  })

  it('should show call site outside scope', function () {
    function callold () { mylib.layerfn() }
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(' oldfn ') !== -1)
    assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
  })

  it('should show call site outside scope from strict lib', function () {
    function callold () { strictlib.layerfn() }
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(' oldfn ') !== -1)
    assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
  })

  it('should only warn once per call site', function () {
    function callold () {
      for (var i = 0; i < 5; i++) {
        mylib.oldfn() // single call site
        process.stderr.write('invoke ' + i + '\n')
      }
    }

    var stderr = captureStderr(callold)
    assert.strictEqual(stderr.split('deprecated').length, 2)
    assert.strictEqual(stderr.split('invoke').length, 6)
  })

  it('should handle rapid calling of deprecated thing', function () {
    this.timeout(5000)

    function callold () {
      for (var i = 0; i < 10000; i++) {
        mylib.oldfn()
      }
    }

    var stderr = captureStderr(callold)
    assert.strictEqual(stderr.split('deprecated').length, 2)
  })

  it('should warn for different calls on same line', function () {
    function callold () {
      mylib.oldfn(); mylib.oldfn()
    }

    var stderr = captureStderr(callold)
    var fileline = stderr.match(/\.js:[0-9]+:/)
    assert.ok(stderr.indexOf(basename(__filename)) !== -1)
    assert.strictEqual(stderr.split('deprecated').length, 3)
    assert.strictEqual(stderr.split(fileline[0]).length, 3)
  })

  describe('when message omitted', function () {
    it('should generate message for method call on named function', function () {
      function callold () { mylib.oldfnauto() }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(stderr.indexOf(' fn ') !== -1)
      assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
    })

    it('should generate message for method call on anonymous function', function () {
      function callold () { mylib.oldfnautoanon() }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(/ <anonymous@[^\\/]+[^:]+my\.js:[0-9]+:[0-9]+> /.test(stderr))
      assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
    })

    describe('in strict mode library', function () {
      it('should generate message for method call on named function', function () {
        function callold () { strictlib.oldfnauto() }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(stderr.indexOf(' fn ') !== -1)
        assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
      })

      it('should generate message for method call on anonymous function', function () {
        function callold () { strictlib.oldfnautoanon() }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(/ <anonymous@[^\\/]+[^:]+strict\.js:[0-9]+:[0-9]+> /.test(stderr))
        assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
      })
    })
  })
})

describe('deprecate.property(obj, prop, message)', function () {
  it('should throw when given primitive', function () {
    var deprecate = depd('test')
    assert.throws(deprecate.property.bind(deprecate, 2), /obj.*object/)
  })

  it('should throw when given missing property', function () {
    var deprecate = depd('test')
    var obj = {}
    assert.throws(deprecate.property.bind(deprecate, obj, 'blargh'), /property.*owner/)
  })

  it('should throw when given non-configurable property', function () {
    var deprecate = depd('test')
    var obj = {}
    Object.defineProperty(obj, 'thing', { value: 'thingie' })
    assert.throws(deprecate.property.bind(deprecate, obj, 'thing'), /property.*configurable/)
  })

  it('should log on access to property', function () {
    function callprop () { return mylib.propa }
    var stderr = captureStderr(callprop)
    assert.ok(stderr.indexOf(' deprecated ') !== -1)
    assert.ok(stderr.indexOf(' propa gone ') !== -1)
  })

  it('should log on setting property', function () {
    var val
    function callprop () { val = mylib.propa }
    function setprop () { mylib.propa = 'newval' }
    var stderr = captureStderr(setprop)
    assert.ok(stderr.indexOf(' deprecated ') !== -1)
    assert.ok(stderr.indexOf(' propa gone ') !== -1)
    assert.ok(captureStderr(callprop).indexOf(' deprecated ') !== -1)
    assert.strictEqual(val, 'newval')
  })

  it('should only warn once per call site', function () {
    function callold () {
      for (var i = 0; i < 5; i++) {
        var v = mylib.propa || v // single call site
        process.stderr.write('access ' + i + '\n')
      }
    }

    var stderr = captureStderr(callold)
    assert.strictEqual(stderr.split('deprecated').length, 2)
    assert.strictEqual(stderr.split('access').length, 6)
  })

  it('should warn for different accesses on same line', function () {
    function callold () {
      mylib.old(); mylib.old()
    }

    var stderr = captureStderr(callold)
    var fileline = stderr.match(/\.js:[0-9]+:/)
    assert.ok(stderr.indexOf(basename(__filename)) !== -1)
    assert.strictEqual(stderr.split('deprecated').length, 3)
    assert.strictEqual(stderr.split(fileline[0]).length, 3)
  })

  it('should show call site outside scope', function () {
    function callold () { mylib.layerprop() }
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(' propa ') !== -1)
    assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
  })

  it('should show call site outside scope from strict lib', function () {
    function callold () { strictlib.layerprop() }
    var stderr = captureStderr(callold)
    assert.ok(stderr.indexOf(' propa ') !== -1)
    assert.ok(/test.js:[0-9]+:[0-9]+/.test(stderr))
  })

  describe('when obj is a function', function () {
    it('should log on access to property on function', function () {
      function callprop () { return mylib.fnprop.propa }
      var stderr = captureStderr(callprop)
      assert.ok(stderr.indexOf(' deprecated ') !== -1)
      assert.ok(stderr.indexOf(' fn propa gone ') !== -1)
    })

    it('should generate message on named function', function () {
      function callprop () { return mylib.fnprop.propautomsg }
      var stderr = captureStderr(callprop)
      assert.ok(stderr.indexOf(' deprecated ') !== -1)
      assert.ok(stderr.indexOf(' thefn.propautomsg ') !== -1)
    })

    describe('in strict mode library', function () {
      it('should log on access to property on function', function () {
        function callprop () { return strictlib.fnprop.propa }
        var stderr = captureStderr(callprop)
        assert.ok(stderr.indexOf(' deprecated ') !== -1)
        assert.ok(stderr.indexOf(' fn propa gone ') !== -1)
      })

      it('should generate message on named function', function () {
        function callprop () { return strictlib.fnprop.propautomsg }
        var stderr = captureStderr(callprop)
        assert.ok(stderr.indexOf(' deprecated ') !== -1)
        assert.ok(stderr.indexOf(' thefn.propautomsg ') !== -1)
      })
    })
  })

  describe('when value descriptor', function () {
    it('should log on access and set', function () {
      function callold () { return mylib.propa }
      function setold () { mylib.propa = 'val' }
      assert.ok(captureStderr(callold).indexOf(' deprecated ') !== -1)
      assert.ok(captureStderr(setold).indexOf(' deprecated ') !== -1)
    })

    it('should not log on set to non-writable', function () {
      function callold () { return mylib.propget }
      function setold () { mylib.propget = 'val' }
      assert.ok(captureStderr(callold).indexOf(' deprecated ') !== -1)
      assert.strictEqual(captureStderr(setold), '')
    })
  })

  describe('when accessor descriptor', function () {
    it('should log on access and set', function () {
      function callold () { return mylib.propdyn }
      function setold () { mylib.propdyn = 'val' }
      assert.ok(captureStderr(callold).indexOf(' deprecated ') !== -1)
      assert.ok(captureStderr(setold).indexOf(' deprecated ') !== -1)
    })

    it('should not log on access when no accessor', function () {
      function callold () { return mylib.propsetter }
      assert.strictEqual(captureStderr(callold), '')
    })

    it('should not log on set when no setter', function () {
      function callold () { mylib.propgetter = 'val' }
      assert.strictEqual(captureStderr(callold), '')
    })
  })

  describe('when message omitted', function () {
    it('should generate message for method call on named function', function () {
      function callold () { return mylib.propauto }
      var stderr = captureStderr(callold)
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(stderr.indexOf('deprecated') !== -1)
      assert.ok(stderr.indexOf(' propauto ') !== -1)
      assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
    })

    describe('in strict mode library', function () {
      it('should generate message for method call on named function', function () {
        function callold () { return strictlib.propauto }
        var stderr = captureStderr(callold)
        assert.ok(stderr.indexOf(basename(__filename)) !== -1)
        assert.ok(stderr.indexOf('deprecated') !== -1)
        assert.ok(stderr.indexOf(' propauto ') !== -1)
        assert.ok(/ at [^\\/]+[^:]+test\.js:/.test(stderr))
      })
    })
  })
})

describe('process.on(\'deprecation\', fn)', function () {
  var error
  var stderr
  before(function () {
    process.on('deprecation', ondeprecation)
    function callold () { mylib.old() }
    stderr = captureStderr(callold)
  })
  after(function () {
    process.removeListener('deprecation', ondeprecation)
  })

  function ondeprecation (err) { error = err }

  it('should not write when listener exists', function () {
    assert.strictEqual(stderr, '')
  })

  it('should emit error', function () {
    assert.ok(error)
  })

  it('should emit DeprecationError', function () {
    assert.strictEqual(error.name, 'DeprecationError')
  })

  it('should emit error with message', function () {
    assert.strictEqual(error.message, 'old')
  })

  it('should emit error with namespace', function () {
    assert.strictEqual(error.namespace, 'my-lib')
  })

  it('should emit error with proper [[Class]]', function () {
    assert.strictEqual(Object.prototype.toString.call(error), '[object Error]')
  })

  it('should be instanceof Error', function () {
    assert.ok(error instanceof Error)
  })

  it('should emit error with proper stack', function () {
    var stack = error.stack.split('\n')
    assert.strictEqual(stack[0], 'DeprecationError: my-lib deprecated old')
    assert.ok(/ {4}at callold \(.+test\.js:[0-9]+:[0-9]+\)/.test(stack[1]))
  })

  it('should have writable properties', function () {
    error.name = 'bname'
    assert.strictEqual(error.name, 'bname')
    error.message = 'bmessage'
    assert.strictEqual(error.message, 'bmessage')
    error.stack = 'bstack'
    assert.strictEqual(error.stack, 'bstack')
  })
})

describe('process.env.NO_DEPRECATION', function () {
  var error
  function ondeprecation (err) { error = err }

  beforeEach(function () {
    error = null
  })

  afterEach(function () {
    process.removeListener('deprecation', ondeprecation)
  })

  after(function () {
    process.env.NO_DEPRECATION = ''
  })

  it('should suppress given namespace', function () {
    process.env.NO_DEPRECATION = 'old-lib'
    var oldlib = libs.old
    assert.strictEqual(captureStderr(oldlib.old), '')
    assert.notStrictEqual(captureStderr(oldlib.old2), '')
  })

  it('should suppress multiple namespaces', function () {
    process.env.NO_DEPRECATION = 'cool-lib,neat-lib'
    var coollib = libs.cool
    assert.strictEqual(captureStderr(coollib.cool), '')
    assert.strictEqual(captureStderr(coollib.neat), '')
  })

  it('should be case-insensitive', function () {
    process.env.NO_DEPRECATION = 'NEW-LIB'
    var newlib = libs.new
    assert.strictEqual(captureStderr(newlib.old), '')
  })

  it('should emit "deprecation" events anyway', function () {
    process.env.NO_DEPRECATION = 'thing-lib'
    var thinglib = libs.thing
    process.on('deprecation', ondeprecation)
    assert.strictEqual(captureStderr(thinglib.old), '')
    assert.strictEqual(error.namespace, 'thing-lib')
  })

  describe('when *', function () {
    it('should suppress any namespace', function () {
      process.env.NO_DEPRECATION = '*'
      var multilib = libs.multi
      assert.strictEqual(captureStderr(multilib.old), '')
      assert.strictEqual(captureStderr(multilib.old2), '')
    })
  })
})

describe('process.env.TRACE_DEPRECATION', function () {
  before(function () {
    process.env.TRACE_DEPRECATION = 'trace-lib'
  })

  after(function () {
    process.env.TRACE_DEPRECATION = ''
  })

  it('should trace given namespace', function () {
    var tracelib = libs.trace
    function callold () { tracelib.old() }
    assert.ok(captureStderr(callold).indexOf(' trace-lib deprecated old\n    at callold (') !== -1)
  })

  it('should not trace non-given namespace', function () {
    var tracelib = libs.trace
    function callold () { tracelib.old2() }
    assert.ok(captureStderr(callold).indexOf(' trace-lib-other deprecated old2 at ') !== -1)
  })

  describe('when output supports colors', function () {
    var stderr
    before(function () {
      var tracelib = libs.trace
      function callold () { tracelib.old() }
      stderr = captureStderr(callold, true)
    })

    it('should log in color', function () {
      assert.notStrictEqual(stderr, '')
      assert.ok(stderr.indexOf('\x1b[') !== -1)
    })

    it('should log namespace', function () {
      assert.ok(stderr.indexOf('trace-lib') !== -1)
    })

    it('should log call site in color', function () {
      assert.ok(stderr.indexOf(basename(__filename)) !== -1)
      assert.ok(/\x1b\[\d+mat callold \(/.test(stderr)) // eslint-disable-line no-control-regex
    })
  })
})

describe('node script.js', function () {
  it('should display deprecation message', function (done) {
    captureChildStderr(script, [], function (err, stderr) {
      if (err) return done(err)
      var filename = path.relative(process.cwd(), script)
      assert.strictEqual(stderr, '__timestamp__ my-cool-module deprecated oldfunction at ' + filename + ':7:10\n')
      done()
    })
  })
})

;(function () {
  // --*-deprecation switches are 0.8+
  // no good way to feature detect this sync
  var describe = /^v0\.6\./.test(process.version)
    ? global.describe.skip
    : global.describe

  describe('node --no-deprecation script.js', function () {
    it('should suppress deprecation message', function (done) {
      captureChildStderr(script, ['--no-deprecation'], function (err, stderr) {
        if (err) return done(err)
        assert.strictEqual(stderr, '')
        done()
      })
    })
  })

  describe('node --trace-deprecation script.js', function () {
    it('should suppress deprecation message', function (done) {
      captureChildStderr(script, ['--trace-deprecation'], function (err, stderr) {
        if (err) return done(err)
        assert.ok(stderr.indexOf('__timestamp__ my-cool-module deprecated oldfunction\n    at run (' + script + ':7:10)\n    at') === 0)
        done()
      })
    })
  })
}())

function captureChildStderr (script, opts, callback) {
  var chunks = []
  var env = { PATH: process.env.PATH }
  var exec = process.execPath

  var args = opts.concat(script)
  var proc = spawn(exec, args, {
    env: env
  })

  proc.stdout.resume()
  proc.stderr.on('data', function ondata (chunk) {
    chunks.push(chunk)
  })

  proc.on('error', callback)
  proc.on('exit', function () {
    var stderr = Buffer.concat(chunks)
      .toString('utf8')
      .replace(/\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+/, '__timestamp__')
    callback(null, stderr)
  })
}


text:
<form class="form-horizontal" role="form">

     Text Field

        <input type="text" id="form-field-1" placeholder="Username" class="col-xs-10 col-sm-5" />

     Password Field

        <input type="password" id="form-field-2" placeholder="Password" class="col-xs-10 col-sm-5" />

												Inline help text

     Readonly field

        <input readonly="" type="text" class="col-xs-10 col-sm-5" id="form-input-readonly" value="This text field is readonly!" />

                                                    <input class="ace" type="checkbox" id="id-disable-check" />
                                                     Disable it!

    Relative Sizing

        <input class="input-sm" type="text" id="form-field-4" placeholder=".input-sm" />

    Grid Sizing

            <input class="col-xs-1" type="text" id="form-field-5" placeholder=".col-xs-1" />

    Input with Icon

												<input type="text" id="form-field-icon-1" />

												<input type="text" id="form-field-icon-2" />

    Tooltip and help button

        <input data-rel="tooltip" type="text" id="form-field-6" placeholder="Tooltip on hover" title="Hello Tooltip!" data-placement="bottom" />
        ?

    Tag input

        <input type="text" name="tags" id="form-field-tags" value="Tag Input Control" placeholder="Enter tags ..." />

        <button class="btn btn-info" type="button">

            Submit
        </button>

        <button class="btn" type="reset">

            Reset
        </button>

Text Area

                    Default

                    <textarea class="form-control" id="form-field-8" placeholder="Default Text"></textarea>

                    With Character Limit

                    <textarea class="form-control limited" id="form-field-9" maxlength="50"></textarea>

                    Autosize

                    <textarea id="form-field-11" class="autosize-transition form-control"></textarea>

Masked Input

                        Date
                        99/99/9999

                        <input class="form-control input-mask-date" type="text" id="form-field-mask-1" />

																	<button class="btn btn-sm btn-default" type="button">

                                                                        Go!
                                                                    </button>

                        Phone
                        (999) 999-9999

                        <input class="form-control input-mask-phone" type="text" id="form-field-mask-2" />

                        Product Key
                        a*-999-a999

                        <input class="form-control input-mask-product" type="text" id="form-field-mask-3" />

                        Eye Script
                        ~9.99 ~9.99 999

                        <input class="input-medium input-mask-eyescript" type="text" id="form-field-mask-4" />

Select Box

    Default

    <select class="form-control" id="form-field-select-1">
        <option value=""> </option>
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
        <option value="AZ">Arizona</option>
        <option value="AR">Arkansas</option>
        <option value="CA">California</option>
        <option value="CO">Colorado</option>
        <option value="CT">Connecticut</option>
        <option value="DE">Delaware</option>
        <option value="FL">Florida</option>
        <option value="GA">Georgia</option>
        <option value="HI">Hawaii</option>
        <option value="ID">Idaho</option>
        <option value="IL">Illinois</option>
        <option value="IN">Indiana</option>
        <option value="IA">Iowa</option>
        <option value="KS">Kansas</option>
        <option value="KY">Kentucky</option>
        <option value="LA">Louisiana</option>
        <option value="ME">Maine</option>
        <option value="MD">Maryland</option>
        <option value="MA">Massachusetts</option>
        <option value="MI">Michigan</option>
        <option value="MN">Minnesota</option>
        <option value="MS">Mississippi</option>
        <option value="MO">Missouri</option>
        <option value="MT">Montana</option>
        <option value="NE">Nebraska</option>
        <option value="NV">Nevada</option>
        <option value="NH">New Hampshire</option>
        <option value="NJ">New Jersey</option>
        <option value="NM">New Mexico</option>
        <option value="NY">New York</option>
        <option value="NC">North Carolina</option>
        <option value="ND">North Dakota</option>
        <option value="OH">Ohio</option>
        <option value="OK">Oklahoma</option>
        <option value="OR">Oregon</option>
        <option value="PA">Pennsylvania</option>
        <option value="RI">Rhode Island</option>
        <option value="SC">South Carolina</option>
        <option value="SD">South Dakota</option>
        <option value="TN">Tennessee</option>
        <option value="TX">Texas</option>
        <option value="UT">Utah</option>
        <option value="VT">Vermont</option>
        <option value="VA">Virginia</option>
        <option value="WA">Washington</option>
        <option value="WV">West Virginia</option>
        <option value="WI">Wisconsin</option>
        <option value="WY">Wyoming</option>
    </select>

    Multiple

    <select class="form-control" id="form-field-select-2" multiple="multiple">
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
        <option value="AZ">Arizona</option>
        <option value="AR">Arkansas</option>
        <option value="CA">California</option>
        <option value="CO">Colorado</option>
        <option value="CT">Connecticut</option>
        <option value="DE">Delaware</option>
        <option value="FL">Florida</option>
        <option value="GA">Georgia</option>
        <option value="HI">Hawaii</option>
        <option value="ID">Idaho</option>
        <option value="IL">Illinois</option>
        <option value="IN">Indiana</option>
        <option value="IA">Iowa</option>
        <option value="KS">Kansas</option>
        <option value="KY">Kentucky</option>
        <option value="LA">Louisiana</option>
        <option value="ME">Maine</option>
        <option value="MD">Maryland</option>
        <option value="MA">Massachusetts</option>
        <option value="MI">Michigan</option>
        <option value="MN">Minnesota</option>
        <option value="MS">Mississippi</option>
        <option value="MO">Missouri</option>
        <option value="MT">Montana</option>
        <option value="NE">Nebraska</option>
        <option value="NV">Nevada</option>
        <option value="NH">New Hampshire</option>
        <option value="NJ">New Jersey</option>
        <option value="NM">New Mexico</option>
        <option value="NY">New York</option>
        <option value="NC">North Carolina</option>
        <option value="ND">North Dakota</option>
        <option value="OH">Ohio</option>
        <option value="OK">Oklahoma</option>
        <option value="OR">Oregon</option>
        <option value="PA">Pennsylvania</option>
        <option value="RI">Rhode Island</option>
        <option value="SC">South Carolina</option>
        <option value="SD">South Dakota</option>
        <option value="TN">Tennessee</option>
        <option value="TX">Texas</option>
        <option value="UT">Utah</option>
        <option value="VT">Vermont</option>
        <option value="VA">Virginia</option>
        <option value="WA">Washington</option>
        <option value="WV">West Virginia</option>
        <option value="WI">Wisconsin</option>
        <option value="WY">Wyoming</option>
    </select>

    data-date-format

    <select class="width-80 chosen-select" id="form-field-select-3" data-placeholder="Choose a Country...">
        <option value=""> </option>
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
        <option value="AZ">Arizona</option>
        <option value="AR">Arkansas</option>
        <option value="CA">California</option>
        <option value="CO">Colorado</option>
        <option value="CT">Connecticut</option>
        <option value="DE">Delaware</option>
        <option value="FL">Florida</option>
        <option value="GA">Georgia</option>
        <option value="HI">Hawaii</option>
        <option value="ID">Idaho</option>
        <option value="IL">Illinois</option>
        <option value="IN">Indiana</option>
        <option value="IA">Iowa</option>
        <option value="KS">Kansas</option>
        <option value="KY">Kentucky</option>
        <option value="LA">Louisiana</option>
        <option value="ME">Maine</option>
        <option value="MD">Maryland</option>
        <option value="MA">Massachusetts</option>
        <option value="MI">Michigan</option>
        <option value="MN">Minnesota</option>
        <option value="MS">Mississippi</option>
        <option value="MO">Missouri</option>
        <option value="MT">Montana</option>
        <option value="NE">Nebraska</option>
        <option value="NV">Nevada</option>
        <option value="NH">New Hampshire</option>
        <option value="NJ">New Jersey</option>
        <option value="NM">New Mexico</option>
        <option value="NY">New York</option>
        <option value="NC">North Carolina</option>
        <option value="ND">North Dakota</option>
        <option value="OH">Ohio</option>
        <option value="OK">Oklahoma</option>
        <option value="OR">Oregon</option>
        <option value="PA">Pennsylvania</option>
        <option value="RI">Rhode Island</option>
        <option value="SC">South Carolina</option>
        <option value="SD">South Dakota</option>
        <option value="TN">Tennessee</option>
        <option value="TX">Texas</option>
        <option value="UT">Utah</option>
        <option value="VT">Vermont</option>
        <option value="VA">Virginia</option>
        <option value="WA">Washington</option>
        <option value="WV">West Virginia</option>
        <option value="WI">Wisconsin</option>
        <option value="WY">Wyoming</option>
    </select>

            Multiple

																		style:

                                                                                1
                                                                                <input type="radio" value="1" />

                                                                                2
                                                                                <input type="radio" value="2" />

    <select multiple="" class="width-80 chosen-select" id="form-field-select-4" data-placeholder="Choose a Country...">
        <option value=""> </option>
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
        <option value="AZ">Arizona</option>
        <option value="AR">Arkansas</option>
        <option value="CA">California</option>
        <option value="CO">Colorado</option>
        <option value="CT">Connecticut</option>
        <option value="DE">Delaware</option>
        <option value="FL">Florida</option>
        <option value="GA">Georgia</option>
        <option value="HI">Hawaii</option>
        <option value="ID">Idaho</option>
        <option value="IL">Illinois</option>
        <option value="IN">Indiana</option>
        <option value="IA">Iowa</option>
        <option value="KS">Kansas</option>
        <option value="KY">Kentucky</option>
        <option value="LA">Louisiana</option>
        <option value="ME">Maine</option>
        <option value="MD">Maryland</option>
        <option value="MA">Massachusetts</option>
        <option value="MI">Michigan</option>
        <option value="MN">Minnesota</option>
        <option value="MS">Mississippi</option>
        <option value="MO">Missouri</option>
        <option value="MT">Montana</option>
        <option value="NE">Nebraska</option>
        <option value="NV">Nevada</option>
        <option value="NH">New Hampshire</option>
        <option value="NJ">New Jersey</option>
        <option value="NM">New Mexico</option>
        <option value="NY">New York</option>
        <option value="NC">North Carolina</option>
        <option value="ND">North Dakota</option>
        <option value="OH">Ohio</option>
        <option value="OK">Oklahoma</option>
        <option value="OR">Oregon</option>
        <option value="PA">Pennsylvania</option>
        <option value="RI">Rhode Island</option>
        <option value="SC">South Carolina</option>
        <option value="SD">South Dakota</option>
        <option value="TN">Tennessee</option>
        <option value="TX">Texas</option>
        <option value="UT">Utah</option>
        <option value="VT">Vermont</option>
        <option value="VA">Virginia</option>
        <option value="WA">Washington</option>
        <option value="WV">West Virginia</option>
        <option value="WI">Wisconsin</option>
        <option value="WY">Wyoming</option>
    </select>

    Checkboxes & Radio
    All Checkboxes, Radios and Switch Buttons Are Pure CSS

            Checkbox

                    <input name="form-field-checkbox" type="checkbox" class="ace" />
                     choice 1

                    <input name="form-field-checkbox" type="checkbox" class="ace" />
                     choice 2

                    <input name="form-field-checkbox" class="ace ace-checkbox-2" type="checkbox" />
                     choice 3

                    <input name="form-field-checkbox" disabled="" type="checkbox" class="ace" />
                     disabled

            Radio

                    <input name="form-field-radio" type="radio" class="ace" />
                     radio option 1

                    <input name="form-field-radio" type="radio" class="ace" />
                     radio option 2

                    <input name="form-field-radio" type="radio" class="ace" />
                     radio option 3

                    <input disabled="" name="form-field-radio" type="radio" class="ace" />
                     disabled

    On/Off Switches

                    <input name="switch-field-1" class="ace ace-switch" type="checkbox" />

                    <input name="switch-field-1" class="ace ace-switch ace-switch-2" type="checkbox" />

                    <input name="switch-field-1" class="ace ace-switch ace-switch-3" type="checkbox" />

                    <input name="switch-field-1" class="ace ace-switch ace-switch-4" type="checkbox" />

                    <input name="switch-field-1" class="ace ace-switch ace-switch-5" type="checkbox" />

                    <input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox" />

                    <input name="switch-field-1" class="ace ace-switch ace-switch-7" type="checkbox" />

Custom File Input

                    <input type="file" id="id-input-file-2" />
                    <input multiple="" type="file" id="id-input-file-3" />

                        <input type="checkbox" name="file-format" id="id-file-format" class="ace" />
                         Allow only images

jQuery UI Sliders

                                77
                                55
                                33
                                40
                                88

Spinners

                    <input type="text" class="input-mini" id="spinner1" />

                    <input type="text" class="input-mini" id="spinner2" />

                    <input type="text" class="input-mini" id="spinner3" />

Date Picker

                    Date Picker

                                <input class="form-control date-picker" id="id-date-picker-1" type="text" data-date-format="dd-mm-yyyy" />

                    Date Range Picker

                                <input class="form-control" type="text" name="date-range-picker" id="id-date-range-picker-1" />

                    Time Picker

                        <input id="timepicker1" type="text" class="form-control" />

                    Color Picker

                        Color Picker

                            <input id="colorpicker1" type="text" class="input-small" />

                    Custom Color Picker

                    <select id="simple-colorpicker-1" class="hide">
                        <option value="#ac725e">#ac725e</option>
                        <option value="#d06b64">#d06b64</option>
                        <option value="#f83a22">#f83a22</option>
                        <option value="#fa573c">#fa573c</option>
                        <option value="#ff7537">#ff7537</option>
                        <option value="#ffad46" selected="">#ffad46</option>
                        <option value="#42d692">#42d692</option>
                        <option value="#16a765">#16a765</option>
                        <option value="#7bd148">#7bd148</option>
                        <option value="#b3dc6c">#b3dc6c</option>
                        <option value="#fbe983">#fbe983</option>
                        <option value="#fad165">#fad165</option>
                        <option value="#92e1c0">#92e1c0</option>
                        <option value="#9fe1e7">#9fe1e7</option>
                        <option value="#9fc6e7">#9fc6e7</option>
                        <option value="#4986e7">#4986e7</option>
                        <option value="#9a9cff">#9a9cff</option>
                        <option value="#b99aff">#b99aff</option>
                        <option value="#c2c2c2">#c2c2c2</option>
                        <option value="#cabdbf">#cabdbf</option>
                        <option value="#cca6ac">#cca6ac</option>
                        <option value="#f691b2">#f691b2</option>
                        <option value="#cd74e6">#cd74e6</option>
                        <option value="#a47ae2">#a47ae2</option>
                        <option value="#555">#555</option>
                    </select>

                    Knob Input

                                    <input type="text" class="input-small knob" value="15" data-min="0" data-max="100" data-step="10" data-width="80" data-height="80" data-thickness=".2" />

                                    <input type="text" class="input-small knob" value="41" data-min="0" data-max="100" data-width="80" data-height="80" data-thickness=".2" data-fgColor="#87B87F" data-displayPrevious="true" data-angleArc="250" data-angleOffset="-125" />

                                    <input type="text" class="input-small knob" data-min="0" data-max="10" data-width="150" data-height="150" data-thickness=".2" data-fgColor="#B8877F" data-angleOffset="90" data-cursor="true" />

</form>


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

  <modelVersion>4.0.0</modelVersion>
  <artifactId>cql2pgjson</artifactId>

  <parent>
    <groupId>org.folio</groupId>
    <artifactId>raml-module-builder</artifactId>
    <version>35.1.0-SNAPSHOT</version>
  </parent>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <argLine />
  </properties>

  <repositories>
    <repository>
      <id>folio-nexus</id>
      <name>FOLIO Maven repository</name>
      <url>https://repository.folio.org/repository/maven-folio</url>
    </repository>

    <repository>
      <id>indexdata</id>
      <name>Index Data</name>
      <url>https://maven.indexdata.com/</url>
    </repository>
  </repositories>

  <dependencies>

    <dependency>
      <groupId>org.folio</groupId>
      <artifactId>dbschema</artifactId>
      <version>${project.parent.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.z3950.zing</groupId>
      <artifactId>cql-java</artifactId>
      <version>1.13</version>
    </dependency>

    <!-- test dependencies -->

    <!-- Eclipse users can avoid "SecurityException: class "org.hamcrest.Matchers"'s signer information does not match"
         by configuring Build Path / Configure Build Path ... / Libraries / Add External Jars ...
         ~/m2/repository/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar,
         Order and Export / Up until hamcrest-2.2.jar is above JUnit 5
    -->
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>pl.pragmatists</groupId>
      <artifactId>JUnitParams</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>42.5.0</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.folio.okapi</groupId>
      <artifactId>okapi-testing</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>postgresql</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>3.1.1</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-general-functions-ftl</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/test-classes</outputDirectory>
              <resources>
                <resource>
                  <directory>../domain-models-runtime/src/main/resources</directory>
                  <includes>
                    <include>templates/db_scripts/general_functions.ftl</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!-- @{argLine} required for sonarqube jacoco -->
          <argLine>@{argLine} -Dfile.encoding=${project.build.sourceEncoding}</argLine>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet />
              <outputFile>${project.build.directory}/${project.artifactId}-fat.jar</outputFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>


text:
from gophish.models import Template
from gophish.api import APIEndpoint

class API(APIEndpoint):
    def __init__(self, api, endpoint='api/templates/'):
        super(API, self).__init__(api, endpoint=endpoint, cls=Template)

    def get(self, template_id=None):
        """ Gets one or more templates """

        return super(API, self).get(resource_id=template_id)

    def post(self, template):
        """ Creates a new template """

        return super(API, self).post(template)

    def put(self, template):
        """ Edits a template """

        return super(API, self).put(template)

    def delete(self, template_id):
        """ Deletes a template by ID """

        return super(API, self).delete(template_id)


text:
<?xml version="1.0" encoding="UTF-8"?>

USB tethering

You can tether your Android device to your computer with a USB cable, to share your device's Internet connection with your computer

USB tethering works with Windows Vista, Windows 7, and Linux

If your device has an SD card or USB storage, you can't mount it on your computer when USB tethered

For more information, including using USB tethering with other OSs, see http://www.android.com/tether#usb

Bluetooth tethering

You can tether your Android device to your computer via a Bluetooth connection, to share your device's Internet connection with your computer

Bluetooth tethering works with any computer or other device that can obtain an Internet connection via Bluetooth

For more information, see http://www.android.com/tether#bluetooth

Portable Wi-Fi hotspot

You can turn your Android device into a portable Wi-Fi hotspot, to share your Android device's Internet connection with one or more computers or other devices

When your device is serving as a Wi-Fi hotspot, you can't use your phone's applications to access the Internet via its Wi-Fi connection (but of course you remain connected to the Internet via your mobile data network)

You configure the hotspot with the Wi-Fi hotspot settings

For more information, visit http://www.android.com/tether#wifi


text:
from .base import BaseCommand

class OverviewCommand(BaseCommand):
    __cmd__ = 'overview'
    __help__ = 'an overview of the current status'

    def run(self, line):
        stats = self.beanstalkd.stats()
        stats['uptime'] = self._format_uptime(stats['uptime'])
        self.respond("""
Hostname: {hostname}
Pid: {pid}
Uptime: {uptime}
Tubes: {current-tubes}

Connections: {total-connections} (total)
  Producers: {current-producers} (current)
    Workers: {current-workers} (current)

Jobs:
    Urgent: {current-jobs-urgent}
     Ready: {current-jobs-ready}
   Delayed: {current-jobs-delayed}
  Reserved: {current-jobs-reserved}
    Buried: {current-jobs-buried}
""".format(**stats))


text:
// Copyright 2013 The Chromium Authors. All rights reserved.
// Inspired by Chromium video capture interface
// Simplified and stripped from internal base code

#ifndef S3D_VIDEO_CAPTURE_VIDEO_FILE_PARSER_H
#define S3D_VIDEO_CAPTURE_VIDEO_FILE_PARSER_H

#include "s3d/utilities/rule_of_five.h"

#include <chrono>
#include <cstdint>
#include <vector>

namespace s3d {

struct VideoCaptureFormat;

class VideoFileParser : rule_of_five_interface<VideoFileParser> {
 public:
  virtual bool Initialize(VideoCaptureFormat* format) = 0;
  virtual bool GetNextFrame(std::vector<uint8_t>* frame) = 0;
  virtual void SeekToFrame(std::chrono::microseconds /*timestamp*/) {}  // todo: pure virtual
  virtual std::chrono::microseconds CurrentFrameTimestamp() {
    return {};
  };                                                                 // todo: make it pure virtual?
  virtual std::chrono::microseconds VideoDuration() { return {}; };  // todo: make it pure virtual?
};

}  // namespace s3d

#endif  // S3D_VIDEO_CAPTURE_VIDEO_FILE_PARSER_H


text:
import dns from 'dns';
import { AbortSignal } from 'node-abort-controller';

import AbortError from './errors/abort-error';
import { sendMessage } from './sender';
import { withTimeout } from './utils/with-timeout';

const SQL_SERVER_BROWSER_PORT = 1434;
const TIMEOUT = 2 * 1000;
const RETRIES = 3;
// There are three bytes at the start of the response, whose purpose is unknown.
const MYSTERY_HEADER_LENGTH = 3;

type LookupFunction = (hostname: string, options: dns.LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void) => void;

// Most of the functionality has been determined from from jTDS's MSSqlServerInfo class.
export async function instanceLookup(options: { server: string, instanceName: string, timeout?: number, retries?: number, port?: number, lookup?: LookupFunction, signal: AbortSignal }) {
  const server = options.server;
  if (typeof server !== 'string') {
    throw new TypeError('Invalid arguments: "server" must be a string');
  }

  const instanceName = options.instanceName;
  if (typeof instanceName !== 'string') {
    throw new TypeError('Invalid arguments: "instanceName" must be a string');
  }

  const timeout = options.timeout === undefined ? TIMEOUT : options.timeout;
  if (typeof timeout !== 'number') {
    throw new TypeError('Invalid arguments: "timeout" must be a number');
  }

  const retries = options.retries === undefined ? RETRIES : options.retries;
  if (typeof retries !== 'number') {
    throw new TypeError('Invalid arguments: "retries" must be a number');
  }

  if (options.lookup !== undefined && typeof options.lookup !== 'function') {
    throw new TypeError('Invalid arguments: "lookup" must be a function');
  }
  const lookup = options.lookup ?? dns.lookup;

  if (options.port !== undefined && typeof options.port !== 'number') {
    throw new TypeError('Invalid arguments: "port" must be a number');
  }
  const port = options.port ?? SQL_SERVER_BROWSER_PORT;

  const signal = options.signal;

  if (signal.aborted) {
    throw new AbortError();
  }

  let response;

  for (let i = 0; i <= retries; i++) {
    try {
      response = await withTimeout(timeout, async (signal) => {
        const request = Buffer.from([0x02]);
        return await sendMessage(options.server, port, lookup, signal, request);
      }, signal);
    } catch (err) {
      // If the current attempt timed out, continue with the next
      if (!signal.aborted && err instanceof Error && err.name === 'TimeoutError') {
        continue;
      }

      throw err;
    }
  }

  if (!response) {
    throw new Error('Failed to get response from SQL Server Browser on ' + server);
  }

  const message = response.toString('ascii', MYSTERY_HEADER_LENGTH);
  const foundPort = parseBrowserResponse(message, instanceName);

  if (!foundPort) {
    throw new Error('Port for ' + instanceName + ' not found in ' + options.server);
  }

  return foundPort;
}

export function parseBrowserResponse(response: string, instanceName: string) {
  let getPort;

  const instances = response.split(';;');
  for (let i = 0, len = instances.length; i < len; i++) {
    const instance = instances[i];
    const parts = instance.split(';');

    for (let p = 0, partsLen = parts.length; p < partsLen; p += 2) {
      const name = parts[p];
      const value = parts[p + 1];

      if (name === 'tcp' && getPort) {
        const port = parseInt(value, 10);
        return port;
      }

      if (name === 'InstanceName') {
        if (value.toUpperCase() === instanceName.toUpperCase()) {
          getPort = true;
        } else {
          getPort = false;
        }
      }
    }
  }
}


text:
/*
 * File:   test_dycors.cpp
 * Author: David Eriksson
 *
 * Created on July 19, 2016
 */

#include <sot.h>
using namespace sot;

int test_dycors() {

    int dim = 10;
    int maxEvals = 500;

    for(int i=1; i <= 2; i++) {
        std::cout << "DYCORS with " << i << " threads" << std::endl;

        std::shared_ptr<Problem> data(std::make_shared<UnitBoxProblem<Ackley>>(dim));
        std::shared_ptr<ExpDesign> slhd(std::make_shared<SLHD>(2 * (dim + 1), dim));
        std::shared_ptr<Surrogate> rbf(std::make_shared<CubicRBF>(maxEvals, dim));
        std::shared_ptr<Sampling> dycors(
                std::make_shared<DYCORS<>>(data, rbf, 100 * dim, maxEvals - slhd->numPoints()));

        setSeedRandom();
        Optimizer opt(data, slhd, rbf, dycors, maxEvals, i);
        Result res = opt.run();

        // Best value found
        std::cout << res.fBest() << std::endl;

        // Scale back the best solution to the original domain
        std::shared_ptr<Problem> origData(std::make_shared<Ackley>(dim)); // Non-scaled version of the problem

        // Best solution in the original domain
        std::cout << fromUnitBox(res.xBest(), origData->lBounds(), origData->uBounds()).t() << std::endl;

        // Check that we made enough progress and that we are feasible
        if (res.fBest() > -20.0) { // LCOV_EXCL_LINE
            return (EXIT_FAILURE); // LCOV_EXCL_LINE
        }
        if (not arma::all(res.xBest() >= data->lBounds())) { // LCOV_EXCL_LINE
            return (EXIT_FAILURE); // LCOV_EXCL_LINE
        }
        if (not arma::all(res.xBest() <= data->uBounds())) { // LCOV_EXCL_LINE
            return (EXIT_FAILURE); // LCOV_EXCL_LINE
        }
    }

    return EXIT_SUCCESS;
}

int main(int argc, char** argv) {
    return test_dycors();
}


text:
layout: page-fullwidth
title: "Take part"
permalink: "/take-part/"
teaser: PyCon Namibia needs you - and we'll be delighted to have your involvement.
---
A PyCon can't happen without the participation of the community, at all levels.

## How to get involved

Attend

Just by taking part as an attendee, you'll be making a valuable contribution. Windhoek is a very special place and the welcome you will receive is
      second to none. By attending you will help support the budding open source community in
      Africa.

Join our email list

Follow developments, take part in discussions, find out who else is going and ask your
      questions on our email
      list.

Volunteer

If you would like to be part of the team and help during the event or
      perhaps before with the organisation please get in touch with us.

Sponsor

The conference will be attended by 180 motivated delegates from the
      Python and wider software community. Sponsoring will put you in the
      spotlight of a very appreciative audience. Please take a look at the information for sponsors
      page.

Speak

Whether you are a seasoned conference speaker or have never given a talk before we would
      love to hear your proposal for a talk at PyCon Namibia. The call for proposals will close on the 15th of December.

Run a workshop

Have a great way of introducing version control? Want to help others learn how to build a
      Django application? We would be delighted to hear your proposal for a
      workshop at PyCon Namibia. As for the talks, a call for proposals will be circulated
      soon.


text:
A RBArrayNode is an AST node for runtime arrays.

Instance Variables
	left:	 <Integer | nil> position of {
	periods: <SequenceableCollection of: Integer> the positions of all the periods that separate the statements
	right: <Integer | nil> position of }
	statements: <SequenceableCollection of: RBStatementNode> the statement nodes


text:
if [ -z "$ETCD_NODE" ]
then
  echo "Missing ETCD_NODE env var"
  exit -1
fi

if [ -z "$HAPROXY_ID" ]
then
  echo "Missing HAPROXY_ID env var"
  exit -1
fi

DNS_SERVERS=$(cat /etc/resolv.conf | grep nameserver | cut -d " " -f2)
echo "Using DNS servers: $DNS_SERVERS"

set -eo pipefail

# Create base dir structure in etcd as confd will complain about missing keys that are watched
echo "Creating base structure for etcd..."
curl -sL $ETCD_NODE/v2/keys/haproxy-$HAPROXY_ID/services -XPUT -d dir=true
curl -sL $ETCD_NODE/v2/keys/haproxy-$HAPROXY_ID/tcp-services -XPUT -d dir=true
curl -sL $ETCD_NODE/v2/keys/haproxy-$HAPROXY_ID/certs -XPUT -d dir=true
echo "..done"

echo "[haproxy-confd] booting HAProxy $HAPROXY_ID. Reading configuration from ETCD: $ETCD_NODE"
DNS_SERVERS=$DNS_SERVERS confd -backend="etcd" -prefix="/haproxy-$HAPROXY_ID" -node "$ETCD_NODE" -interval=$BACKEND_POLLING_INTERVAL "$@"


text:
from __future__ import absolute_import, division, print_function

import mxnet as mx
import mxnet.ndarray as nd
import numpy
import copy
from utils import *

class ReplayMemory(object):
    def __init__(self, history_length, memory_size=1000000, replay_start_size=100,
                 state_dim=(), action_dim=(), state_dtype='uint8', action_dtype='uint8',
                 ctx=mx.gpu()):
        self.rng = get_numpy_rng()
        self.ctx = ctx
        assert type(action_dim) is tuple and type(state_dim) is tuple, \
            "Must set the dimensions of state and action for replay memory"
        self.state_dim = state_dim
        if action_dim == (1,):
            self.action_dim = ()
        else:
            self.action_dim = action_dim
        self.states = numpy.zeros((memory_size,) + state_dim, dtype=state_dtype)
        self.actions = numpy.zeros((memory_size,) + action_dim, dtype=action_dtype)
        self.rewards = numpy.zeros(memory_size, dtype='float32')
        self.terminate_flags = numpy.zeros(memory_size, dtype='bool')
        self.memory_size = memory_size
        self.replay_start_size = replay_start_size
        self.history_length = history_length
        self.top = 0
        self.size = 0

    def latest_slice(self):
        if self.size >= self.history_length:
            return self.states.take(numpy.arange(self.top - self.history_length, self.top),
                                    axis=0, mode="wrap")
        else:
            assert False, "We can only slice from the replay memory if the " \
                          "replay size is larger than the length of frames we want to take" \
                          "as the input."

    @property
    def sample_enabled(self):
        return self.size > self.replay_start_size

    def clear(self):
        """
        Clear all contents in the relay memory
        """
        self.states[:] = 0
        self.actions[:] = 0
        self.rewards[:] = 0
        self.terminate_flags[:] = 0
        self.top = 0
        self.size = 0

    def reset(self):
        """
        Reset all the flags stored in the replay memory.
        It will not clear the inner-content and is a light/quick version of clear()
        """
        self.top = 0
        self.size = 0

    def copy(self):
        # TODO Test the copy function
        replay_memory = copy.copy(self)
        replay_memory.states = numpy.zeros(self.states.shape, dtype=self.states.dtype)
        replay_memory.actions = numpy.zeros(self.actions.shape, dtype=self.actions.dtype)
        replay_memory.rewards = numpy.zeros(self.rewards.shape, dtype='float32')
        replay_memory.terminate_flags = numpy.zeros(self.terminate_flags.shape, dtype='bool')
        replay_memory.states[numpy.arange(self.top-self.size, self.top), ::] = \
            self.states[numpy.arange(self.top-self.size, self.top)]
        replay_memory.actions[numpy.arange(self.top-self.size, self.top)] = \
            self.actions[numpy.arange(self.top-self.size, self.top)]
        replay_memory.rewards[numpy.arange(self.top-self.size, self.top)] = \
            self.rewards[numpy.arange(self.top-self.size, self.top)]
        replay_memory.terminate_flags[numpy.arange(self.top-self.size, self.top)] = \
            self.terminate_flags[numpy.arange(self.top-self.size, self.top)]
        return replay_memory

    def append(self, obs, action, reward, terminate_flag):
        self.states[self.top] = obs
        self.actions[self.top] = action
        self.rewards[self.top] = reward
        self.terminate_flags[self.top] = terminate_flag
        self.top = (self.top + 1) % self.memory_size
        if self.size < self.memory_size:
            self.size += 1

    def sample_last(self, batch_size, states, offset):
        assert self.size >= batch_size and self.replay_start_size >= self.history_length
        assert(0 <= self.size <= self.memory_size)
        assert(0 <= self.top <= self.memory_size)
        if self.size <= self.replay_start_size:
            raise ValueError("Size of the effective samples of the ReplayMemory must be "
                             "bigger than start_size! Currently, size=%d, start_size=%d"
                             %(self.size, self.replay_start_size))
        actions = numpy.empty((batch_size,) + self.action_dim, dtype=self.actions.dtype)
        rewards = numpy.empty(batch_size, dtype='float32')
        terminate_flags = numpy.empty(batch_size, dtype='bool')
        counter = 0
        first_index = self.top - self.history_length - 1
        while counter < batch_size:
            full_indices = numpy.arange(first_index, first_index + self.history_length+1)
            end_index = first_index + self.history_length
            if numpy.any(self.terminate_flags.take(full_indices[0:self.history_length], mode='wrap')):
                # Check if terminates in the middle of the sample!
                first_index -= 1
                continue
            states[counter + offset] = self.states.take(full_indices, axis=0, mode='wrap')
            actions[counter] = self.actions.take(end_index, axis=0, mode='wrap')
            rewards[counter] = self.rewards.take(end_index, mode='wrap')
            terminate_flags[counter] = self.terminate_flags.take(end_index, mode='wrap')
            counter += 1
            first_index -= 1
        return actions, rewards, terminate_flags

    def sample_mix(self, batch_size, states, offset, current_index):
        assert self.size >= batch_size and self.replay_start_size >= self.history_length
        assert(0 <= self.size <= self.memory_size)
        assert(0 <= self.top <= self.memory_size)
        if self.size <= self.replay_start_size:
            raise ValueError("Size of the effective samples of the ReplayMemory must be bigger than "
                             "start_size! Currently, size=%d, start_size=%d"
                             %(self.size, self.replay_start_size))
        actions = numpy.empty((batch_size,) + self.action_dim, dtype=self.actions.dtype)
        rewards = numpy.empty(batch_size, dtype='float32')
        terminate_flags = numpy.empty(batch_size, dtype='bool')
        counter = 0
        first_index = self.top - self.history_length + current_index
        thisid = first_index
        while counter < batch_size:
            full_indices = numpy.arange(thisid, thisid + self.history_length+1)
            end_index = thisid + self.history_length
            if numpy.any(self.terminate_flags.take(full_indices[0:self.history_length], mode='wrap')):
                # Check if terminates in the middle of the sample!
                thisid -= 1
                continue
            states[counter+offset] = self.states.take(full_indices, axis=0, mode='wrap')
            actions[counter] = self.actions.take(end_index, axis=0, mode='wrap')
            rewards[counter] = self.rewards.take(end_index, mode='wrap')
            terminate_flags[counter] = self.terminate_flags.take(end_index, mode='wrap')
            counter += 1
            thisid = self.rng.randint(low=self.top - self.size, high=self.top - self.history_length-1)
        return actions, rewards, terminate_flags

    def sample_inplace(self, batch_size, states, offset):
        assert self.size >= batch_size and self.replay_start_size >= self.history_length
        assert(0 <= self.size <= self.memory_size)
        assert(0 <= self.top <= self.memory_size)
        if self.size <= self.replay_start_size:
            raise ValueError("Size of the effective samples of the ReplayMemory must be "
                             "bigger than start_size! Currently, size=%d, start_size=%d"
                             %(self.size, self.replay_start_size))
        actions = numpy.zeros((batch_size,) + self.action_dim, dtype=self.actions.dtype)
        rewards = numpy.zeros(batch_size, dtype='float32')
        terminate_flags = numpy.zeros(batch_size, dtype='bool')

        counter = 0
        while counter < batch_size:
            index = self.rng.randint(low=self.top - self.size + 1, high=self.top - self.history_length )
            transition_indices = numpy.arange(index, index + self.history_length+1)
            initial_indices = transition_indices - 1
            end_index = index + self.history_length - 1
            if numpy.any(self.terminate_flags.take(initial_indices[0:self.history_length], mode='wrap')):
                # Check if terminates in the middle of the sample!
                continue
            states[counter + offset] = self.states.take(initial_indices, axis=0, mode='wrap')
            actions[counter] = self.actions.take(end_index, axis=0, mode='wrap')
            rewards[counter] = self.rewards.take(end_index, mode='wrap')
            terminate_flags[counter] = self.terminate_flags.take(end_index, mode='wrap')
            # next_states[counter] = self.states.take(transition_indices, axis=0, mode='wrap')
            counter += 1
        return actions, rewards, terminate_flags

    def sample(self, batch_size):
        assert self.size >= batch_size and self.replay_start_size >= self.history_length
        assert(0 <= self.size <= self.memory_size)
        assert(0 <= self.top <= self.memory_size)
        if self.size <= self.replay_start_size:
            raise ValueError("Size of the effective samples of the ReplayMemory must be bigger than "
                             "start_size! Currently, size=%d, start_size=%d"
                             %(self.size, self.replay_start_size))
        #TODO Possibly states + inds for less memory access
        states = numpy.zeros((batch_size, self.history_length) + self.state_dim,
                             dtype=self.states.dtype)
        actions = numpy.zeros((batch_size,) + self.action_dim, dtype=self.actions.dtype)
        rewards = numpy.zeros(batch_size, dtype='float32')
        terminate_flags = numpy.zeros(batch_size, dtype='bool')
        next_states = numpy.zeros((batch_size, self.history_length) + self.state_dim,
                                  dtype=self.states.dtype)
        counter = 0
        while counter < batch_size:
            index = self.rng.randint(low=self.top - self.size + 1, high=self.top - self.history_length)
            transition_indices = numpy.arange(index, index + self.history_length)
            initial_indices = transition_indices - 1
            end_index = index + self.history_length - 1
            while numpy.any(self.terminate_flags.take(initial_indices, mode='wrap')):
                # Check if terminates in the middle of the sample!
                index -= 1
                transition_indices = numpy.arange(index, index + self.history_length)
                initial_indices = transition_indices - 1
                end_index = index + self.history_length - 1
            states[counter] = self.states.take(initial_indices, axis=0, mode='wrap')
            actions[counter] = self.actions.take(end_index, axis=0, mode='wrap')
            rewards[counter] = self.rewards.take(end_index, mode='wrap')
            terminate_flags[counter] = self.terminate_flags.take(end_index, mode='wrap')
            next_states[counter] = self.states.take(transition_indices, axis=0, mode='wrap')
            counter += 1
        return states, actions, rewards, next_states, terminate_flags


text:
class UsersController < ApplicationController

  def new
  end

  def create
    user = User.new(user_params)
    if user.save
      session[:user_id] = user.id
      redirect_to '/app/'
    else
      redirect_to '/app/signup'
    end
  end

  def get_user_by_username username
    return User.find_by(name: username)
  end

  private

  def user_params
    params.require(:user).permit(:name, :email, :password, :password_confirmation)
  end

end


text:
// Copyright 2007 Google Inc.
//
// 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.

package com.google.enterprise.connector.spi;

import java.util.Iterator;
import java.util.List;

/**
 * Simple implementation of the {@link DocumentList} interface.
 * Implementors may use this directly or for reference.
 *
 * @since 1.0
 */
public class SimpleDocumentList implements DocumentList {
  private List<? extends Document> documents;
  private Iterator<? extends Document> iterator;
  private Document document;

  /**
   * Constructs a {@code SimpleDocumentList} encapsulating the
   * supplied {@code List} of {@link Document Documents}.
   *
   * @param documents a {@code List} of {@link Document Documents}
   */
  public SimpleDocumentList(List<? extends Document> documents) {
    this.documents = documents;
    this.iterator = null;
    this.document = null;
  }

  @Override
  public Document nextDocument() {
    if (iterator == null) {
      iterator = documents.iterator();
    }
    if (iterator.hasNext()) {
      document = iterator.next();
      return document;
    }
    return null;
  }

  @Override
  public String checkpoint() throws RepositoryException {
    if (document == null) {
      return null;
    }
    return Value.getSingleValueString(document,
        SpiConstants.PROPNAME_LASTMODIFIED);
  }
}


text:
package com.vaporwarecorp.mirror.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import com.robopupu.api.plugin.PluginBus;
import com.vaporwarecorp.mirror.component.AppManager;
import com.vaporwarecorp.mirror.component.configuration.Configuration;
import com.vaporwarecorp.mirror.component.configuration.WebServer;
import timber.log.Timber;

import static com.vaporwarecorp.mirror.app.Constants.ACTION.WEB_SERVER_SERVICE_REFRESH;
import static com.vaporwarecorp.mirror.app.Constants.ACTION.WEB_SERVER_SERVICE_START;
import static com.vaporwarecorp.mirror.app.Constants.ACTION.WEB_SERVER_SERVICE_STOP;

public class WebServerService extends Service {
// ------------------------------ FIELDS ------------------------------

    private WebServer server;

// -------------------------- OTHER METHODS --------------------------

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        if (intent == null) {
            return START_STICKY;
        }

        if (WEB_SERVER_SERVICE_START.equals(intent.getAction()) && server == null) {
            Timber.i("Starting web server service");
            final AppManager appManager = PluginBus.getPlug(AppManager.class);
            server = new WebServer(appManager);
            server.start(PluginBus.getPlugs(Configuration.class));
        } else if (WEB_SERVER_SERVICE_REFRESH.equals(intent.getAction()) && server != null) {
            Timber.i("Refreshing the web server service");
            server.refresh(PluginBus.getPlugs(Configuration.class));
        } else if (WEB_SERVER_SERVICE_STOP.equals(intent.getAction())) {
            Timber.i("Stopping web server service");
            if (server != null) {
                if (server.isAlive()) {
                    server.stop();
                }
                server = null;
            }
            stopSelf();
        }
        return START_STICKY;
    }
}