text:
layout: post
title: "Install Mac OS X Mavericks 10.9 on VMware"
description: "My experience on installing Mac OS X on VMware Workstation"
category: notes
tags: [OS X, VMware, VMtools, fullscreen]
---

This weekend I was struggling on how to install the Mac OS X Mavericks 10.9 on VMware in Windows 7 for my girlfriend. The overall process is not so difficult, you can definitely find quite a lot of guidelines on the Internet. Here I will note down some important points.

- Check if your computer supports Hardware VT

   To install Mac OS X on VMware, you must first confirm that you computer's CPU supports Hardware Virtualization Technology and enable it from BIOS settings. I think most laptops currently in use should support it.

- Install VMtools on OS X

   VMtools should be installed as it can enable direct copy-paste action from host machine to the virtual machine, which is one of the advantage of VMware over VirtualBox. To install VMtools, you need to download a darwin.iso, load it to the CD/DVD drive. The VM should be able to detect and load it on destop automatically.

- Configure Fullscreen support for OS X

   This is the most tedious part through the whole installation. As the host machine's display resolution is 1366x768, which cannot be found in the Mac OS X dislay setting, resulting two dark areas beside the OS X screen. To solve the problem I googled a lot and some solutions are listed below.

   1. Install [VMsvga 2](http://sourceforge.net/projects/vmsvga2/files/) and more resolution settings will appear in the drop-down box. I tried and failed, there is no change on the display setting.

   2. Change `/Library/Preferences/SystemCOnfiguration/com.apple.boot.plist` file, which I did not try as I thought changing the configuration file is not safe and should the last option.

   3. Follow the answer [here](http://nickology.com/2013/11/21/displaylink-mavericks-osx-10-9-resolution-display-fix/), I simply press `alt` and click the Scaled option. Then magic happens! I see more resultion settings appear Problem solved! Honestly I do not understand why it works as I am really a Mac OS X noob. If anyone knows the mechanism behind please leave a comment below.

In the end, I would like to conclude that it might not be suitable to conduct ios development on virtual machine. If you really want to be an ios app developer, consider to go and buy a Mac:) I am not advertising for Apple!

redpajama_set_name: RedPajamaGithub


text:
<?php

use \Tsugi\Util\U;
use \Tsugi\Core\LTIX;
use \Tsugi\UI\CrudForm;

// In the top frame, we use cookies for session.
if (!defined('COOKIE_SESSION')) define('COOKIE_SESSION', true);
require_once("../../config.php");

header('Content-Type: text/html; charset=utf-8');
LTIX::session_start();

if ( ! U::get($_SESSION,'id') ) {
    die('Must be admin');
}

if ( ! isset($_REQUEST['membership_id']) ) {
    die('No membership_id');
}

$row = $PDOX->rowDie("SELECT M.context_id
    FROM {$CFG->dbprefix}lti_membership AS M
    JOIN {$CFG->dbprefix}lti_context AS C ON M.context_id = C.context_id
    WHERE membership_id = :MID AND
        C.key_id IN (select key_id from {$CFG->dbprefix}lti_key where user_id = :UID )
        OR C.user_id = :UID",
    array(
        ':MID' => $_REQUEST['membership_id'],
        ':UID' => $_SESSION['id'])
);

if ( $row === false || ! isset($row['context_id']) ) {
    die('Bad membership_id');
}

$tablename = "{$CFG->dbprefix}lti_membership";
$current = $CFG->getCurrentFileUrl(__FILE__);
$from_location = "membership?context_id=".$row['context_id'];
$allow_delete = true;
$allow_edit = true;
$where_clause = '';
$query_fields = array();
$fields = array("membership_id", "context_id", "user_id", "role_override", "created_at", "updated_at");

// Handle the post data
$row =  CrudForm::handleUpdate($tablename, $fields, $where_clause,
    $query_fields, $allow_edit, $allow_delete);

if ( $row === CrudForm::CRUD_FAIL || $row === CrudForm::CRUD_SUCCESS ) {
    header("Location: ".$from_location);
    return;
}

$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->topNav();
$OUTPUT->flashMessages();

$title = "Membership";
echo("
$title
\n
\n");
$retval = CrudForm::updateForm($row, $fields, $current, $from_location, $allow_edit, $allow_delete);
if ( is_string($retval) ) die($retval);
echo("
\n");

$OUTPUT->footer();


text:
/* eslint-env mocha */
'use strict'

var expect = require('chai').expect
var formats = require('..')

describe('formats', function () {
  describe('parseNumberPattern()', function () {
    it('handles currency', function () {
      expect(formats.parseNumberPattern('jpy')).to.eql({
        style: 'currency',
        currencyDisplay: 'symbol',
        currency: 'JPY'
      })

      expect(formats.parseNumberPattern('#,##0.00 ¤ EUR')).to.eql({
        style: 'currency',
        currencyDisplay: 'symbol',
        currency: 'EUR',
        useGrouping: true,
        minimumIntegerDigits: 1,
        minimumFractionDigits: 2,
        maximumFractionDigits: 2
      })

      expect(formats.parseNumberPattern('0 ¤¤ cad')).to.eql({
        style: 'currency',
        currencyDisplay: 'code',
        currency: 'CAD',
        useGrouping: false,
        minimumIntegerDigits: 1,
        minimumFractionDigits: 0,
        maximumFractionDigits: 0
      })
      expect(formats.parseNumberPattern('0 ¤¤¤')).to.eql({
        style: 'currency',
        currencyDisplay: 'name',
        currency: 'USD',
        useGrouping: false,
        minimumIntegerDigits: 1,
        minimumFractionDigits: 0,
        maximumFractionDigits: 0
      })
    })

    it('handles percentages', function () {
      expect(formats.parseNumberPattern('%')).to.eql({
        style: 'percent'
      })
      expect(formats.parseNumberPattern('#00.000%')).to.eql({
        style: 'percent',
        useGrouping: false,
        minimumIntegerDigits: 2,
        minimumFractionDigits: 3,
        maximumFractionDigits: 3
      })
    })

    it('handles fractions', function () {
      expect(formats.parseNumberPattern('#.#')).to.eql({
        useGrouping: false,
        minimumIntegerDigits: 1,
        minimumFractionDigits: 0,
        maximumFractionDigits: 1
      })
    })

    it('handles scientific notation as significant digits', function () {
      expect(formats.parseNumberPattern('0.##E+0')).to.eql({
        useGrouping: false,
        minimumSignificantDigits: 1,
        maximumSignificantDigits: 3
      })
    })

    it('handles significant digits', function () {
      expect(formats.parseNumberPattern('#,@@@')).to.eql({
        useGrouping: true,
        minimumSignificantDigits: 3,
        maximumSignificantDigits: 4
      })
    })

    it('ignores other characters', function () {
      expect(formats.parseNumberPattern('1~^/-_+|p')).to.equal(undefined)
    })
  })

  describe('parseDatePattern()', function () {
    it('handles era', function () {
      expect(formats.parseDatePattern('G')).to.eql({ era: 'short' })
      expect(formats.parseDatePattern('GGG')).to.eql({ era: 'short' })
      expect(formats.parseDatePattern('GGGG')).to.eql({ era: 'long' })
      expect(formats.parseDatePattern('GGGGG')).to.eql({ era: 'narrow' })
    })

    it('handles year', function () {
      expect(formats.parseDatePattern('Y')).to.eql({ year: 'numeric' })
      expect(formats.parseDatePattern('yy')).to.eql({ year: '2-digit' })
      expect(formats.parseDatePattern('yyyy')).to.eql({ year: 'numeric' })
    })

    it('handles month', function () {
      expect(formats.parseDatePattern('M')).to.eql({ month: 'numeric' })
      expect(formats.parseDatePattern('LL')).to.eql({ month: '2-digit' })
      expect(formats.parseDatePattern('MMM')).to.eql({ month: 'short' })
      expect(formats.parseDatePattern('LLLL')).to.eql({ month: 'long' })
      expect(formats.parseDatePattern('MMMMM')).to.eql({ month: 'narrow' })
    })

    it('handles weekday', function () {
      expect(formats.parseDatePattern('E')).to.eql({ weekday: 'short' })
      expect(formats.parseDatePattern('ccc')).to.eql({ weekday: 'short' })
      expect(formats.parseDatePattern('eeee')).to.eql({ weekday: 'long' })
      expect(formats.parseDatePattern('ccccc')).to.eql({ weekday: 'narrow' })
    })

    it('handles day', function () {
      expect(formats.parseDatePattern('D')).to.eql({ day: 'numeric' })
      expect(formats.parseDatePattern('dd')).to.eql({ day: '2-digit' })
      expect(formats.parseDatePattern('ddd')).to.eql({ day: 'numeric' })
    })

    it('handles hour', function () {
      expect(formats.parseDatePattern('h')).to.eql({ hour: 'numeric', hour12: true })
      expect(formats.parseDatePattern('H')).to.eql({ hour: 'numeric', hour12: false })
      expect(formats.parseDatePattern('KK')).to.eql({ hour: '2-digit', hour12: true })
      expect(formats.parseDatePattern('kk')).to.eql({ hour: '2-digit', hour12: false })
      expect(formats.parseDatePattern('KKK')).to.eql({ hour: 'numeric', hour12: true })
      expect(formats.parseDatePattern('HHH')).to.eql({ hour: 'numeric', hour12: false })
    })

    it('handles minute', function () {
      expect(formats.parseDatePattern('m')).to.eql({ minute: 'numeric' })
      expect(formats.parseDatePattern('mm')).to.eql({ minute: '2-digit' })
      expect(formats.parseDatePattern('mmm')).to.eql({ minute: 'numeric' })
    })

    it('handles second', function () {
      expect(formats.parseDatePattern('S')).to.eql({ second: 'numeric' })
      expect(formats.parseDatePattern('ss')).to.eql({ second: '2-digit' })
      expect(formats.parseDatePattern('sss')).to.eql({ second: 'numeric' })
    })

    it('handles timeZoneName', function () {
      expect(formats.parseDatePattern('z')).to.eql({ timeZoneName: 'short' })
      expect(formats.parseDatePattern('Z')).to.eql({ timeZoneName: 'short' })
      expect(formats.parseDatePattern('vv')).to.eql({ timeZoneName: 'long' })
      expect(formats.parseDatePattern('VVV')).to.eql({ timeZoneName: 'long' })
    })

    it('ignores other characters', function () {
      expect(formats.parseDatePattern('1~#/-_+|p')).to.equal(undefined)
    })
  })
})


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Demo04.Models;
using Gods.Foundation;

namespace Demo04.ViewModels
{
    public class FileInfoViewModel : NotificationObject
    {
        public FileInfoEntity FileInfoEntity { get; private set; }

        public FileInfoViewModel(FileInfoEntity fileInfoEntity)
        {
            FileInfoEntity = fileInfoEntity;
        }

        public string Name
        {
            get { return FileInfoEntity.Name; }
            set
            {
                FileInfoEntity.Name = value;
                RaisePropertyChanged("Name");
            }
        }

        public string Url
        {
            get { return FileInfoEntity.Url; }
            set
            {
                FileInfoEntity.Url = value;
                RaisePropertyChanged("Url");
            }
        }

        public string LocalPath
        {
            get { return FileInfoEntity.LocalPath; }
            set
            {
                FileInfoEntity.LocalPath = value;
                RaisePropertyChanged("LocalPath");
            }
        }

        private int _progressPercentage;

        public int ProgressPercentage
        {
            get { return _progressPercentage; }
            set
            {
                _progressPercentage = value;
                RaisePropertyChanged("ProgressPercentage");
            }
        }

        private DownloadState _downloadState;

        public DownloadState DownloadState
        {
            get { return _downloadState; }
            set
            {
                _downloadState = value;
                RaisePropertyChanged("DownloadState");
            }
        }

//        private long _fileTotalSize;
//
//        public long FileTotalSize
//        {
//            get { return _fileTotalSize; }
//            set
//            {
//                _fileTotalSize = value;
//                RaisePropertyChanged("FileTotalSize");
//            }
//        }
//
//        private long _fileCurrentSize;
//
//        public long FileCurrentSize
//        {
//            get { return _fileCurrentSize; }
//            set
//            {
//                _fileCurrentSize = value;
//                RaisePropertyChanged("FileCurrentSize");
//            }
//        }

        public static FileInfoViewModel FromNewFileInfo(string fileName, string fileUrl, string localPath)
        {
            return new FileInfoViewModel(new FileInfoEntity()
                {
                    Name = fileName,
                    Url = fileUrl,
                    LocalPath = localPath
                });
        }

        public static FileInfoViewModel FromFileInfo(FileInfoEntity fileInfoEntity)
        {
            return new FileInfoViewModel(fileInfoEntity);
        }
    }
}


text:
/**
 * @module creatine
 */

(function() {
  "use strict";

  /**
   * This manager is a helper to use the browser localStorage feature. It is
   * created by the game and accessed using `game.storage`.
   *
   * The localStorage is a HTML5 feature which allows persistent local
   * storage (JS can save information in the browser). But, it is limited to
   * string values only. This class helps you to store and retrieve any kind
   * of data inside a local storage (by converting these values from/to
   * JSON).
   *
   * Notice that this class uses the `game.config.project` as prefix for all
   * stored keys.
   *
   * ## Usage example
   *
   *     var game = new tine.Game();
   *
   *     game.storage.set('boolean-value', true);
   *     game.storage.set('string-value', 'lalala');
   *     game.storage.set('integer-value', 23);
   *     game.storage.set('object-value', {a:3});
   *
   *     console.log(game.storage.get('boolean-value')); // true
   *     console.log(game.storage.get('string-value'));  // 'lalala'
   *     console.log(game.storage.get('integer-value')); // 23
   *     console.log(game.storage.get('object-value'));  // {a:3}
   *
   * @class StorageManager
   * @constructor
   * @param {Object} game The game instance.
   */
  var StorageManager = function(game) {
    /**
     * The game instance.
     * @property {creatine.Game} game
     */
    this.game = game;

    /**
     * The reference to the local storage, if this isn't provided by the
     * browser then it is a simple object.
     *
     * @property {Object} _memory
     * @private
     */
    this._memory = localStorage;

    /**
     * The name (same as `game.config.project`).
     * @property {String} _namespace
     * @private
     */
    this._namespace = game.config.project;

    try {
      !!localStorage.getItem;
    } catch (e) {
      this._memory = {};
    }
  }
  var p = StorageManager.prototype;

  //---------------------------------------------------------------------------
  // CORE ACCESS (INTERNAL)
  //---------------------------------------------------------------------------
  /**
   * Same as `set` but used by internal modules.
   * @method iset
   * @param {String} module The name of the module using it.
   * @param {String} key The key identifier.
   * @param {Object} value The value to be stored.
   * @protected
   */
  p.iset = function(module, key, value) { this.set('['+module+']'+key, value); }

  /**
   * Same as `get` but used by internal modules.
   * @method iget
   * @param {String} module The name of the module using it.
   * @param {String} key The key identifier.
   * @returns {Object} The retrieved value.
   * @protected
   */
  p.iget = function(module, key) { return this.get('['+module+']'+key); }

  /**
   * Same as `remove` but used by internal modules.
   * @method iremove
   * @param {String} module The name of the module using it.
   * @param {String} key The key identifier.
   * @protected
   */
  p.iremove = function(module, key) { this.remove('['+module+']'+key); }

  //---------------------------------------------------------------------------
  // PUBLIC ACCESS
  //---------------------------------------------------------------------------
  /**
   * Set a value for a given key in storage.
   * @method set
   * @param {String} key The key identifier.
   * @param {String} value The value.
  **/
  p.set = function(key, value) {
    try {
      value = JSON.stringify(value);
    } catch (e) {}

    this._memory[this._namespace+key] = value;
  }

  /**
   * Get a value for a given key in storage.
   * @method get
   * @param {String} key The key.
   * @return {Object} the stored value.
   */
  p.get = function(key) {
    var value = this._memory[this._namespace+key];
    try {
      value = JSON.parse(value);
    } catch (e) {}

    return value;
  }

  /**
   * Remove a key from storage.
   * @method remove
   * @param {String} key The key.
   */
  p.remove = function(key) {
    delete this._memory[this._namespace+key];
  }

  creatine.StorageManager = StorageManager;

})();


text: Path utilities (like FileExists and DirectoryExists)


text:
class ExtendableModel < Cms::Models::Document
  include Extendable

  field :name, type: String
end

RSpec.shared_examples "Extendable" do

  it "should be valid" do
    expect(extendable_model).to be_valid
  end

  it "should have genric attributes" do
    generic_attributes = extendable_model.generic_attributes
    expect(generic_attributes.count).to eq(2)

    generic_attributes.each_with_index do |generic_attribute, index|
      expect(generic_attribute.caption).to eq(generic_attributes_array[index][:caption])
      expect(generic_attribute.generic_type).to eq(described_class.to_s)
    end
  end
end


text:
/**
 * 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. See accompanying LICENSE file.
 */
package org.apache.hadoop.security.authentication.server;

import org.apache.hadoop.security.authentication.client.AuthenticationException;
import org.apache.hadoop.security.authentication.util.AuthToken;

import java.security.Principal;

import javax.servlet.http.HttpServletRequest;

/**
 * The {@link AuthenticationToken} contains information about an authenticated
 * HTTP client and doubles as the {@link Principal} to be returned by
 * authenticated {@link HttpServletRequest}s
 *

 * The token can be serialized/deserialized to and from a string as it is sent
 * and received in HTTP client responses and requests as a HTTP cookie (this is
 * done by the {@link AuthenticationFilter}).
 */
public class AuthenticationToken extends AuthToken {

  /**
   * Constant that identifies an anonymous request.
   */
  public static final AuthenticationToken ANONYMOUS = new AuthenticationToken();

  private AuthenticationToken() {
    super();
  }

  private AuthenticationToken(AuthToken token) {
    super(token.getUserName(), token.getName(), token.getType());
    setMaxInactives(token.getMaxInactives());
    setExpires(token.getExpires());
  }

  /**
   * Creates an authentication token.
   *
   * @param userName user name.
   * @param principal principal (commonly matches the user name, with Kerberos is the full/long principal
   * name while the userName is the short name).
   * @param type the authentication mechanism name.
   * (System.currentTimeMillis() + validityPeriod).
   */
  public AuthenticationToken(String userName, String principal, String type) {
    super(userName, principal, type);
  }

  /**
   * Sets the max inactive time of the token.
   *
   * @param maxInactives inactive time of the token in milliseconds
   *                     since the epoch.
   */
  public void setMaxInactives(long maxInactives) {
    if (this != AuthenticationToken.ANONYMOUS) {
      super.setMaxInactives(maxInactives);
    }
  }

  /**
   * Sets the expiration of the token.
   *
   * @param expires expiration time of the token in milliseconds since the epoch.
   */
  public void setExpires(long expires) {
    if (this != AuthenticationToken.ANONYMOUS) {
      super.setExpires(expires);
    }
  }

  /**
   * Returns true if the token has expired.
   *
   * @return true if the token has expired.
   */
  public boolean isExpired() {
    return super.isExpired();
  }

  /**
   * Parses a string into an authentication token.
   *
   * @param tokenStr string representation of a token.
   *
   * @return the parsed authentication token.
   *
   * @throws AuthenticationException thrown if the string representation could not be parsed into
   * an authentication token.
   */
  public static AuthenticationToken parse(String tokenStr) throws AuthenticationException {
    return new AuthenticationToken(AuthToken.parse(tokenStr));
  }
}


text:
package request

import (
	"testing"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apiserver/pkg/authentication/user"
)

// TestNamespaceContext validates that a namespace can be get/set on a context object
func TestNamespaceContext(t *testing.T) {
	ctx := NewDefaultContext()
	result, ok := NamespaceFrom(ctx)
	if !ok {
		t.Fatalf("Error getting namespace")
	}
	if metav1.NamespaceDefault != result {
		t.Fatalf("Expected: %s, Actual: %s", metav1.NamespaceDefault, result)
	}

	ctx = NewContext()
	_, ok = NamespaceFrom(ctx)
	if ok {
		t.Fatalf("Should not be ok because there is no namespace on the context")
	}
}

// TestUserContext validates that a userinfo can be get/set on a context object
func TestUserContext(t *testing.T) {
	ctx := NewContext()
	_, ok := UserFrom(ctx)
	if ok {
		t.Fatalf("Should not be ok because there is no user.Info on the context")
	}
	ctx = WithUser(
		ctx,
		&user.DefaultInfo{
			Name:   "bob",
			UID:    "123",
			Groups: []string{"group1"},
			Extra:  map[string][]string{"foo": {"bar"}},
		},
	)

	result, ok := UserFrom(ctx)
	if !ok {
		t.Fatalf("Error getting user info")
	}

	expectedName := "bob"
	if result.GetName() != expectedName {
		t.Fatalf("Get user name error, Expected: %s, Actual: %s", expectedName, result.GetName())
	}

	expectedUID := "123"
	if result.GetUID() != expectedUID {
		t.Fatalf("Get UID error, Expected: %s, Actual: %s", expectedUID, result.GetName())
	}

	expectedGroup := "group1"
	actualGroup := result.GetGroups()
	if len(actualGroup) != 1 {
		t.Fatalf("Get user group number error, Expected: 1, Actual: %d", len(actualGroup))
	} else if actualGroup[0] != expectedGroup {
		t.Fatalf("Get user group error, Expected: %s, Actual: %s", expectedGroup, actualGroup[0])
	}

	expectedExtraKey := "foo"
	expectedExtraValue := "bar"
	actualExtra := result.GetExtra()
	if len(actualExtra[expectedExtraKey]) != 1 {
		t.Fatalf("Get user extra map number error, Expected: 1, Actual: %d", len(actualExtra[expectedExtraKey]))
	} else if actualExtra[expectedExtraKey][0] != expectedExtraValue {
		t.Fatalf("Get user extra map value error, Expected: %s, Actual: %s", expectedExtraValue, actualExtra[expectedExtraKey])
	}

}


text:
/* */
"format cjs";
/**
 * riot.util.brackets
 *
 * - `brackets    ` - Returns a string or regex based on its parameter
 * - `brackets.set` - Change the current riot brackets
 *
 * @module
 */
//#if 0 // only in the unprocessed source
/* eslint no-unused-vars: [2, {args: "after-used", varsIgnorePattern: "^brackets$"}] */
//#endif

//#if ES6
/* global riot */

export
//#endif
var brackets = (function (UNDEF) {
  //
  // Closure data
  // --------------------------------------------------------------------------
  //
  //#set $_RIX_TEST  = 4
  //#set $_RIX_ESC   = 5
  //#set $_RIX_OPEN  = 6
  //#set $_RIX_CLOSE = 7
  //#set $_RIX_PAIR  = 8
  //#set $_RIX_LOOP  = 9
  //#ifndef $_RIX_TEST
  var
    $_RIX_TEST  = 4,  // DONT'T FORGET SYNC THE #set BLOCK!!!
    $_RIX_ESC   = 5,
    $_RIX_OPEN  = 6,
    $_RIX_CLOSE = 7,
    $_RIX_PAIR  = 8,
    $_RIX_LOOP  = 9
  //#endif

  var
    REGLOB = 'g',

    /**
     * Used by internal functions and shared with the riot compiler, matches valid,
     * multiline JavaScript comments in almost all its forms. Can handle embedded
     * sequences `/\*`, `*\/` and `//` inside these. Skips non-valid comments like `/*\/`
     *
     * `R_MLCOMMS` does not make captures.
     * @const {RegExp}
     * @static
     */
    R_MLCOMMS = /\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,

    /**
     * Used by internal functions and shared with the riot compiler, matches single or
     * double quoted strings, handles embedded quotes and multi-line strings (not in
     * accordance with the JavaScript spec).
     * It is not for ES6 template strings.
     *
     * `R_STRINGS` does not make captures.
     * @const {RegExp}
     * @static
     */
    R_STRINGS = /"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,

    /**
     * For use with the RegExp constructor. Combines the
     * {@link module:brackets.R_STRINGS|R_STRINGS} source with sources of regexes matching
     * division operators and literal regexes.
     * The resulting regex captures in `$1` and `$2` a single slash, depending
     * if it matches a division operator ($1) or a literal regex ($2).
     * @const {string}
     * @static
     */
    S_QBLOCKS = R_STRINGS.source + '|' +
      /(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source + '|' +
      /\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,

    /**
     * Characters not supported by the expression parser.
     * @const {RegExp}
     * @static
     */
    UNSUPPORTED = RegExp('[\\' + 'x00-\\x1F<>a-zA-Z0-9\'",;\\\\]'),

    /**
     * These characters have to be escaped - Note that '{}' is not in this list.
     * @const {RegExp}
     * @static
     */
    NEED_ESCAPE = /(?=[[\]()*+?.^$|])/g,

    /**
     * Hash of regexes for matching JavaScript brackets out of quoted strings and literal
     * regexes. Used by {@link module:brackets.split|split}, these are heavy, but their
     * performance is acceptable.
     * @const {object}
     * @private
     */
    FINDBRACES = {
      '(': RegExp('([()])|'   + S_QBLOCKS, REGLOB),
      '[': RegExp('([[\\]])|' + S_QBLOCKS, REGLOB),
      '{': RegExp('([{}])|'   + S_QBLOCKS, REGLOB)
    },

    /**
     * The predefined riot brackets
     * @const {string}
     * @default
     */
    DEFAULT = '{ }'

  // pre-made string and regexes for the default brackets
  var _pairs = [
    '{', '}',                   // [0-1]: separated brackets
    '{', '}',                   // [2-3]: separated brackets (escaped)
    /{[^}]*}/,                  // $_RIX_TEST
    /\\([{}])/g,                // $_RIX_ESC
    /\\({)|{/g,                 // $_RIX_OPEN
    RegExp('\\\\(})|([[({])|(})|' + S_QBLOCKS, REGLOB),       // $_RIX_CLOSE
    DEFAULT,                    // $_RIX_PAIR
    /^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/, // $_RIX_LOOP
    /(^|[^\\]){=[\S\s]*?}/      // $_RIX_RAW
  ]

  // Variable information about the current brackets state, initialized on first use
  // and on bracket changes.
  var
    cachedBrackets = UNDEF,     // full brackets string in use, for change detection
    _regex,                     // function for regex convertion of default brackets
    _cache = [],                // pre-made string and regexes for the current brackets
    _settings                   // mirror `riot.settings`

  //
  // Private functions
  // --------------------------------------------------------------------------

  /**
   * Rewrite function for default brackets, returns the received regex as-is.
   * Used by the main brackets function when the current brackets are the default.
   * @param   {RegExp} re RegExp instance with the default riot brackets
   * @returns {RegExp}    The received regex.
   * @private
   */
  function _loopback (re) { return re }

  /**
   * Rewrite the regex with the default brackets replaced with the custom ones.
   * Used by the main brackets function when the current brackets are not the default.
   * @param   {RegExp} re  - RegExp instance with the default riot brackets
   * @param   {Array} [bp] - Escaped brackets in elements 2-3, defaults to those in _cache
   * @returns {RegExp} Copy of the received regex, with the default brackets replaced.
   * @private
   */
  function _rewrite (re, bp) {
    if (!bp) bp = _cache
    return new RegExp(
      re.source.replace(/{/g, bp[2]).replace(/}/g, bp[3]), re.global ? REGLOB : ''
    )
  }

  /**
   * Creates an array with pre-made strings and regexes based on the received brackets.
   * With the default brackets, returns a reference to an inner static array.
   *
   * Does not accept `<, >, a-z, A-Z, 0-9` nor control characters.
   * @param   {string} pair - String with the desired brackets pair (cannot be falsy)
   * @returns {Array}  Array with information for the given brackets.
   * @throws  Will throw an "Unsupported brackets ..." if _pair_ is not separated with
   *   exactly one space, or contains an invalid character.
   * @private
   */
  function _create (pair) {
    if (pair === DEFAULT) return _pairs

    var arr = pair.split(' ')

    if (arr.length !== 2 || UNSUPPORTED.test(pair)) {
      throw new Error('Unsupported brackets "' + pair + '"')
    }
    arr = arr.concat(pair.replace(NEED_ESCAPE, '\\').split(' '))

    arr[$_RIX_TEST] = _rewrite(arr[1].length > 1 ? /{[\S\s]*?}/ : _pairs[$_RIX_TEST], arr)
    arr[$_RIX_ESC] = _rewrite(pair.length > 3 ? /\\({|})/g : _pairs[$_RIX_ESC], arr)
    arr[$_RIX_OPEN] = _rewrite(_pairs[$_RIX_OPEN], arr) // for _split()
    arr[$_RIX_CLOSE] = RegExp('\\\\(' + arr[3] + ')|([[({])|(' + arr[3] + ')|' + S_QBLOCKS, REGLOB)
    arr[$_RIX_PAIR] = pair
    return arr
  }

  //
  // "Exported" functions
  // --------------------------------------------------------------------------

  /**
   * The main function.
   *
   * With a numeric parameter, returns the current left (0) or right (1) riot brackets.
   *
   * With a regex, returns the original regex if the current brackets are the defaults,
   * or a new one with the default brackets replaced by the current custom brackets.
   * @param   {RegExp|number} reOrIdx - As noted above
   * @returns {RegExp|string} Based on the received parameter.
   * @alias   brackets
   */
  function _brackets (reOrIdx) {
    return reOrIdx instanceof RegExp ? _regex(reOrIdx) : _cache[reOrIdx]
  }

  /**
   * Splits the received string in its template text and expression parts using
   * balanced brackets detection to avoid require escaped brackets from users.
   *
   * _For internal use by tmpl and the riot-compiler._
   * @param   {string} str    - Template source to split, can be one expression
   * @param   {number} [tmpl] - 1 if called from `tmpl()`
   * @param   {Array}  [_bp]  - Info of custom brackets to use
   * @returns {Array} - Array containing template text and expressions.
   *   If str was one unique expression, returns two elements: ["", expression].
   * @private
   */
  _brackets.split = function split (str, tmpl, _bp) {
    // istanbul ignore next: _bp is for the compiler
    if (!_bp) _bp = _cache

    // Template text is easy: closing brackets are ignored, all we have to do is find
    // the first unescaped bracket. The real work is with the expressions...
    //
    // Expressions are not so easy. We can already ignore opening brackets, but finding
    // the correct closing bracket is tricky.
    // Strings and regexes can contain almost any combination of characters and we
    // can't deal with these complexity with our regexes, so let's hide and ignore
    // these. From there, all we need is to detect the bracketed parts and skip
    // them, as they contains most of the common characters used by riot brackets.
    // With that, we have a 90% reliability in the detection, although (hope few) some
    // custom brackets still requires to be escaped.
    var
      parts = [],                 // holds the resulting parts
      match,                      // reused by both outer and nested searches
      isexpr,                     // we are in ttext (0) or expression (1)
      start,                      // start position of current template or expression
      pos,                        // current position (exec() result)
      re = _bp[$_RIX_OPEN]        // start with *updated* opening bracket

    isexpr = start = re.lastIndex = 0       // re is reused, we must reset lastIndex

    while ((match = re.exec(str))) {

      pos = match.index

      if (isexpr) {
        // $1: optional escape character,
        // $2: opening js bracket `{[(`,
        // $3: closing riot bracket,
        // $4 & $5: qblocks

        if (match[2]) {                     // if have a javascript opening bracket,
          re.lastIndex = skipBraces(str, match[2], re.lastIndex)
          continue                          // skip the bracketed block and loop
        }
        if (!match[3]) {                    // if don't have a closing bracket
          continue                          // search again
        }
      }

      // At this point, we expect an _unescaped_ openning bracket in $2 for text,
      // or a closing bracket in $3 for expression.

      if (!match[1]) {                      // ignore it if have an escape char
        unescapeStr(str.slice(start, pos))  // push part, even if empty
        start = re.lastIndex                // next position is the new start
        re = _bp[$_RIX_OPEN + (isexpr ^= 1)] // switch mode and swap regexp
        re.lastIndex = start                // update the regex pointer
      }
    }

    if (str && start < str.length) {        // push remaining part, if we have one
      unescapeStr(str.slice(start))
    }

    return parts

    // Inner Helpers for _split() -----

    // Store the string in the array `parts`.
    // Unescape escaped brackets from expressions and, if we are called from
    // tmpl, from the HTML part too.
    function unescapeStr (s) {
      if (tmpl || isexpr) {
        parts.push(s && s.replace(_bp[$_RIX_ESC], '$1'))
      } else {
        parts.push(s)
      }
    }

    // Find the js closing bracket for the current block.
    // Skips strings, regexes, and other inner blocks.
    function skipBraces (s, ch, ix) {
      var
        match,
        recch = FINDBRACES[ch]

      recch.lastIndex = ix
      ix = 1
      while ((match = recch.exec(s))) {
        if (match[1] &&
          !(match[1] === ch ? ++ix : --ix)) break
      }
      return ix ? s.length : recch.lastIndex
    }
  }

  // exposed by riot.util.tmpl.hasExpr
  _brackets.hasExpr = function hasExpr (str) {
    return _cache[$_RIX_TEST].test(str)
  }

  // exposed by riot.util.tmpl.loopKeys
  _brackets.loopKeys = function loopKeys (expr) {
    var m = expr.match(_cache[$_RIX_LOOP])

    return m
      ? { key: m[1], pos: m[2], val: _cache[0] + m[3].trim() + _cache[1] }
      : { val: expr.trim() }
  }

  /**
   * Returns an array with brackets information, defaults to the current brackets.
   * (the `brackets` module in the node version of the compiler allways defaults
   * to the predefined riot brackets `{ }`).
   *
   * _This function is for internal use._
   * @param   {string} [pair] - If used, returns info for this brackets
   * @returns {Array}  Brackets array in internal format.
   * @private
   */
  _brackets.array = function array (pair) {
    return pair ? _create(pair) : _cache
  }

  /**
   * Resets the _cache array with strings and regexes based on its parameter.
   * @param {string} [pair=DEFAULT] - String with the brackets pair to set
   * @alias brackets.set
   */
  function _reset (pair) {
    if ((pair || (pair = DEFAULT)) !== _cache[$_RIX_PAIR]) {
      _cache = _create(pair)
      _regex = pair === DEFAULT ? _loopback : _rewrite
      _cache[$_RIX_LOOP] = _regex(_pairs[$_RIX_LOOP])
    }
    cachedBrackets = pair  // always set these
  }

  /**
   * Allows change detection of `riot.settings.brackets`.
   * @param {object} o - Where store the `brackets` property, mostly `riot.settings`
   * @private
   */
  function _setSettings (o) {
    var b

    o = o || {}
    b = o.brackets
    Object.defineProperty(o, 'brackets', {
      set: _reset,
      get: function () { return cachedBrackets },
      enumerable: true
    })
    _settings = o   // save the new reference
    _reset(b)       // update the brackets
  }

  // Inmediate execution
  // --------------------------------------------------------------------------

  // Set the internal _settings property as reference to `riot.settings`
  Object.defineProperty(_brackets, 'settings', {
    set: _setSettings,
    get: function () { return _settings }
  })

  /* istanbul ignore next: in the browser riot is always in the scope */
  _brackets.settings = typeof riot !== 'undefined' && riot.settings || {}
  _brackets.set = _reset

  // Public properties, shared with `tmpl`
  _brackets.R_STRINGS = R_STRINGS
  _brackets.R_MLCOMMS = R_MLCOMMS
  _brackets.S_QBLOCKS = S_QBLOCKS

  return _brackets

})()


text:
"""Common imports for generated computeaccounts client library."""
# pylint:disable=wildcard-import

import pkgutil

from googlecloudapis.apitools.base.py import *
from googlecloudapis.computeaccounts.staging_alpha.computeaccounts_staging_alpha_client import *
from googlecloudapis.computeaccounts.staging_alpha.computeaccounts_staging_alpha_messages import *

__path__ = pkgutil.extend_path(__path__, __name__)


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
    <name>ConfigureOlaIO</name>
    <message>
        <location filename="configureolaio.ui" line="33"/>
        <source>Configure OLA I/O</source>
        <translation>OLA Eingabe/Ausgabe konfigurieren</translation>
    </message>
    <message>
        <location filename="configureolaio.ui" line="40"/>
        <source>Output</source>
        <translation>Ausgang</translation>
    </message>
    <message>
        <location filename="configureolaio.ui" line="45"/>
        <source>OLA Universe</source>
        <translation>OLA Universum</translation>
    </message>
    <message>
        <location filename="configureolaio.ui" line="53"/>
        <source>Run standalone OLA daemon</source>
        <translation>Eigenständigen OLA-Daemon starten</translation>
    </message>
</context>
<context>
    <name>OlaIO</name>
    <message>
        <location filename="olaio.cpp" line="163"/>
        <source>This plugin provides DMX output support for the Open Lighting Architecture (OLA).</source>
        <translation>Dieses Plugin bietet DMX-Output für die Open Lighting Architecture (OLA).</translation>
    </message>
    <message>
        <location filename="olaio.cpp" line="177"/>
        <source>This is the output for OLA universe %1</source>
        <translation>Dies ist der Ausgang für OLA Universum %1</translation>
    </message>
</context>
</TS>


text:
angular.module('os.administrative.containertype.list', ['os.administrative.models'])
  .controller('ContainerTypeListCtrl', function($scope, $state, CheckList, ContainerType, Util, DeleteUtil, ListPagerOpts) {

    var pagerOpts, ctx;

    function init() {
      pagerOpts = $scope.pagerOpts = new ListPagerOpts({listSizeGetter: getContainerTypesCount});
      ctx = $scope.ctx = {
        exportDetail: {objectType: 'storageContainerType'},
        filterOpts: {maxResults: pagerOpts.recordsPerPage + 1},
        emptyState: {
          loading: true,
          empty: true,
          loadingMessage: 'container_type.loading_list',
          emptyMessage: 'container_type.empty_list'
        }
      };

      loadContainerTypes(ctx.filterOpts);
      Util.filter($scope, 'ctx.filterOpts', loadContainerTypes);
    }

    function loadContainerTypes(filterOpts) {
      ctx.emptyState.loading = true;

      var q = ContainerType.query(filterOpts);
      if (Object.keys(ctx.filterOpts).length == 1) {
        ctx.defTypesQ = q;
      }

      q.then(
        function(containerTypes) {
          ctx.emptyState.loading = false;
          ctx.emptyState.empty = (containerTypes.length <= 0);
          pagerOpts.refreshOpts(containerTypes);

          $scope.containerTypes = containerTypes;
          $scope.ctx.checkList = new CheckList(containerTypes);
        }
      );
    };

    function getContainerTypesCount() {
      return ContainerType.getCount(ctx.filterOpts);
    }

    function getTypeIds(types) {
      return types.map(function(t) { return t.id; });
    }

    $scope.deleteTypes = function() {
      var types = $scope.ctx.checkList.getSelectedItems();
      var opts = {
        confirmDelete:  'container_type.delete_types',
        successMessage: 'container_type.types_deleted',
        onBulkDeletion: function() {
          loadContainerTypes(ctx.filterOpts);
        }
      }

      DeleteUtil.bulkDelete({bulkDelete: ContainerType.bulkDelete}, getTypeIds(types), opts);
    }

    $scope.loadTypes = function(search) {
      if (ctx.defTypes && (ctx.defTypes.length < 100 || !search)) {
        $scope.canHolds = ctx.defTypes;
        return;
      }

      var q;
      if (!search && ctx.defTypesQ) {
        q = ctx.defTypesQ;
      } else {
        q = ContainerType.query({name: search});
      }

      q.then(
        function(types) {
          if (!search) {
            ctx.defTypes = types;
          }

          $scope.canHolds = types;
        }
      );
    }

    $scope.showContainerTypeOverview = function(containerType) {
      $state.go('container-type-detail.overview', {containerTypeId: containerType.id});
    };

    $scope.pageSizeChanged = function() {
      ctx.filterOpts.maxResults = pagerOpts.recordsPerPage + 1;
    }

    init();
  });


text:
CREATE TABLE user_account (
  id BIGSERIAL NOT NULL,
  display_name VARCHAR(255) DEFAULT NULL,
  password_crypted VARCHAR(255) DEFAULT NULL,
  password_salt VARCHAR(40) DEFAULT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  forgotten_password_code VARCHAR(20) NULL,
  forgotten_password_code_generated_at TIMESTAMP WITHOUT TIME ZONE NULL,
  year_of_birth SMALLINT NULL,
  gender VARCHAR(1) NULL,
  avatar_key VARCHAR(100) DEFAULT NULL,
  system_admin BOOLEAN NOT NULL DEFAULT 'f',
  use_advanced_schedule BOOLEAN NOT NULL DEFAULT 'f',
  PRIMARY KEY(id)
);

CREATE TABLE user_email (
  id BIGSERIAL NOT NULL,
  user_account_id BIGINT NOT NULL,
  title VARCHAR(255) DEFAULT 'main' NOT NULL, /** NOW UNUSED **/
  email VARCHAR(255) NOT NULL,
  confirm_code VARCHAR(50) DEFAULT NULL,
  send_before_confirmation BOOLEAN NOT NULL DEFAULT 't',
  stop_send_before_confirmation_code VARCHAR(50) DEFAULT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  deleted_at TIMESTAMP WITHOUT TIME ZONE NULL,
  simple_schedule_on_days VARCHAR(255) DEFAULT 'mon,tue,wed,thu,fri,sat,sun' NOT NULL,
  simple_schedule_from_time TIME WITHOUT TIME ZONE DEFAULT '00:00',
  simple_schedule_to_time TIME WITHOUT TIME ZONE  DEFAULT '23:59',
  PRIMARY KEY(id)
);
CREATE UNIQUE INDEX user_email_email ON user_email (email, deleted_at);
ALTER TABLE user_email ADD CONSTRAINT user_email_user_account_id  FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE user_twitter (
  id BIGSERIAL NOT NULL,
  user_account_id BIGINT NOT NULL,
  title VARCHAR(255) DEFAULT 'main' NOT NULL, /** NOW UNUSED **/
  username VARCHAR(100) NOT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  deleted_at TIMESTAMP WITHOUT TIME ZONE NULL,
  simple_schedule_on_days VARCHAR(255) DEFAULT 'mon,tue,wed,thu,fri,sat,sun' NOT NULL,
  simple_schedule_from_time TIME WITHOUT TIME ZONE DEFAULT '00:00',
  simple_schedule_to_time TIME WITHOUT TIME ZONE  DEFAULT '23:59',
  PRIMARY KEY(id)
);
CREATE UNIQUE INDEX user_twitter_username ON user_twitter (username, deleted_at);
ALTER TABLE user_twitter ADD CONSTRAINT user_twitter_user_account_id  FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE country (
  id SERIAL NOT NULL,
  iso_code_2char VARCHAR(2) NOT NULL,
  title VARCHAR(255) NOT NULL,
  international_dailing_code VARCHAR(20) NOT NULL,
  international_dailing_prefix VARCHAR(20) NOT NULL,
  PRIMARY KEY(id)
);
INSERT INTO country (iso_code_2char,title,international_dailing_code,international_dailing_prefix) VALUES ('gb','United Kingdom','44','00');

CREATE TABLE user_telephone (
  id BIGSERIAL NOT NULL,
  user_account_id BIGINT NOT NULL,
  title VARCHAR(255) DEFAULT 'main' NOT NULL, /** NOW UNUSED **/
  country_id INT NOT NULL,
  call_number VARCHAR(50) NOT NULL,
  confirm_code VARCHAR(10) DEFAULT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  deleted_at TIMESTAMP WITHOUT TIME ZONE NULL,
  simple_schedule_on_days VARCHAR(255) DEFAULT 'mon,tue,wed,thu,fri,sat,sun' NOT NULL,
  simple_schedule_from_time TIME WITHOUT TIME ZONE DEFAULT '00:00',
  simple_schedule_to_time TIME WITHOUT TIME ZONE  DEFAULT '23:59',
  PRIMARY KEY(id)
);
CREATE UNIQUE INDEX user_telephone_number ON user_telephone (country_id,call_number, deleted_at);
ALTER TABLE user_telephone ADD CONSTRAINT user_telephone_user_account_id  FOREIGN KEY (user_account_id) REFERENCES user_account(id);
ALTER TABLE user_telephone ADD CONSTRAINT user_telephone_country_id  FOREIGN KEY (country_id) REFERENCES country(id);

CREATE TABLE user_on_holiday (
  id BIGSERIAL NOT NULL,
  user_account_id BIGINT NOT NULL,
  holiday_from TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  holiday_to TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  share_with_group BOOLEAN NOT NULL DEFAULT 'f',
  description TEXT NULL,
  PRIMARY KEY(id)
);
ALTER TABLE user_on_holiday ADD CONSTRAINT user_on_holiday_account_id  FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE user_session (
  user_account_id BIGINT NOT NULL,
  id VARCHAR(100) NOT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  last_used_at TIMESTAMP WITHOUT TIME ZONE NULL,
  PRIMARY KEY(user_account_id, id)
);
ALTER TABLE user_session ADD CONSTRAINT user_session_user_account_id  FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE white_label (
  id BIGSERIAL NOT NULL,
  title VARCHAR(255) NOT NULL,
  PRIMARY KEY(id)
);

CREATE TABLE user_admins_white_label (
  user_account_id BIGINT NOT NULL,
  white_label_id BIGINT NOT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (user_account_id,white_label_id)
);
ALTER TABLE user_admins_white_label ADD CONSTRAINT user_admins_white_label_user_account_id  FOREIGN KEY (user_account_id) REFERENCES user_account(id);
ALTER TABLE user_admins_white_label ADD CONSTRAINT user_admins_white_label_white_label_id  FOREIGN KEY (white_label_id) REFERENCES white_label(id);

CREATE TABLE support_group (
  id BIGSERIAL NOT NULL,
  white_label_id BIGINT NULL,
  title VARCHAR(255) NOT NULL,
  description TEXT NULL,
  sys_admin_label VARCHAR(255) NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  deleted_at TIMESTAMP WITHOUT TIME ZONE NULL,
  is_premium BOOLEAN NOT NULL DEFAULT false,
  avatar_key VARCHAR(100) DEFAULT NULL,
  PRIMARY KEY(id)
);
ALTER TABLE support_group ADD CONSTRAINT support_group_white_label_id  FOREIGN KEY (white_label_id) REFERENCES white_label(id);

CREATE TABLE user_in_group (
  user_account_id BIGINT NOT NULL,
  support_group_id BIGINT NOT NULL,
  invited_by_user_account_id BIGINT NULL,
  is_admin BOOLEAN NOT NULL DEFAULT false,
  can_make_requests BOOLEAN NOT NULL DEFAULT true,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (user_account_id,support_group_id)
);
ALTER TABLE user_in_group ADD CONSTRAINT user_in_group_user_account_id  FOREIGN KEY (user_account_id) REFERENCES user_account(id);
ALTER TABLE user_in_group ADD CONSTRAINT user_in_group_invited_by_user_account_id  FOREIGN KEY (invited_by_user_account_id) REFERENCES user_account(id);
ALTER TABLE user_in_group ADD CONSTRAINT user_in_group_support_group_id  FOREIGN KEY (support_group_id) REFERENCES support_group(id);

CREATE TABLE request_type (
  id BIGSERIAL NOT NULL,
  title VARCHAR(255) NOT NULL,
  support_group_id BIGINT NOT NULL,
  is_active BOOLEAN NOT NULL DEFAULT true,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY(id)
);
CREATE UNIQUE INDEX request_type_title ON request_type (support_group_id,title);
ALTER TABLE request_type ADD CONSTRAINT request_type_support_group_id FOREIGN KEY (support_group_id) REFERENCES support_group(id);

CREATE TABLE request (
  id BIGSERIAL NOT NULL,
  summary VARCHAR(140) NOT NULL,
  request TEXT NULL,
  support_group_id BIGINT NOT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  created_by_user_id BIGINT NOT NULL,
  closed_at TIMESTAMP WITHOUT TIME ZONE,
  closed_by_user_id BIGINT NULL,
  cancelled_at TIMESTAMP WITHOUT TIME ZONE,
  cancelled_by_user_id BIGINT NULL,
  start_at TIMESTAMP WITHOUT TIME ZONE NULL,
  end_at TIMESTAMP WITHOUT TIME ZONE NULL,
  to_all_members BOOLEAN NOT NULL DEFAULT false,
  PRIMARY KEY(id)
 );
ALTER TABLE request ADD CONSTRAINT request_support_group_id FOREIGN KEY (support_group_id) REFERENCES support_group(id);
ALTER TABLE request ADD CONSTRAINT request_created_by_user_id FOREIGN KEY (created_by_user_id) REFERENCES user_account(id);
ALTER TABLE request ADD CONSTRAINT request_closed_by_user_id FOREIGN KEY (closed_by_user_id) REFERENCES user_account(id);
ALTER TABLE request ADD CONSTRAINT request_cancelled_by_user_id FOREIGN KEY (cancelled_by_user_id) REFERENCES user_account(id);

CREATE TABLE request_has_type (
  request_id BIGINT NOT NULL,
  request_type_id BIGINT NOT NULL,
  PRIMARY KEY (request_id,request_type_id)
);
ALTER TABLE request_has_type ADD CONSTRAINT request_has_type_request_id FOREIGN KEY (request_id) REFERENCES request(id);
ALTER TABLE request_has_type ADD CONSTRAINT request_has_type_request_type_id FOREIGN KEY (request_type_id) REFERENCES request_type(id);

CREATE TABLE request_to_user (
  request_id BIGINT NOT NULL,
  user_account_id BIGINT NOT NULL,
  PRIMARY KEY (request_id,user_account_id)
);
ALTER TABLE request_to_user ADD CONSTRAINT request_to_user_request_id FOREIGN KEY (request_id) REFERENCES request(id);
ALTER TABLE request_to_user ADD CONSTRAINT request_to_user_user_account_id FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE request_sent_to_user_email (
  request_id BIGINT NOT NULL,
  user_email_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (request_id,user_email_id)
);
ALTER TABLE request_sent_to_user_email ADD CONSTRAINT request_sent_to_user_email_request_id FOREIGN KEY (request_id) REFERENCES request(id);
ALTER TABLE request_sent_to_user_email ADD CONSTRAINT request_sent_to_user_email_user_email_id FOREIGN KEY (user_email_id) REFERENCES user_email(id);

CREATE TABLE request_sent_to_user_twitter (
  request_id BIGINT NOT NULL,
  user_twitter_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (request_id,user_twitter_id)
);
ALTER TABLE request_sent_to_user_twitter ADD CONSTRAINT request_sent_to_user_twitter_request_id FOREIGN KEY (request_id) REFERENCES request(id);
ALTER TABLE request_sent_to_user_twitter ADD CONSTRAINT request_sent_to_user_twitter_user_twitter_id FOREIGN KEY (user_twitter_id) REFERENCES user_twitter(id);

CREATE TABLE request_sent_to_user_telephone (
  request_id BIGINT NOT NULL,
  user_telephone_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (request_id,user_telephone_id)
);
ALTER TABLE request_sent_to_user_telephone ADD CONSTRAINT request_sent_to_user_telephone_request_id FOREIGN KEY (request_id) REFERENCES request(id);
ALTER TABLE request_sent_to_user_telephone ADD CONSTRAINT request_sent_to_user_telephone_user_telephone_id FOREIGN KEY (user_telephone_id) REFERENCES user_telephone(id);

CREATE TABLE request_response (
  id BIGSERIAL NOT NULL,
  request_id BIGINT NOT NULL,
  user_account_id BIGINT NOT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  response TEXT,
  PRIMARY KEY (id)
);
ALTER TABLE request_response ADD CONSTRAINT request_response_request_id FOREIGN KEY (request_id) REFERENCES request(id);
ALTER TABLE request_response ADD CONSTRAINT request_response_user_account_id FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE request_response_sent_to_user_email (
  request_response_id BIGINT NOT NULL,
  user_email_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (request_response_id,user_email_id)
);
ALTER TABLE request_response_sent_to_user_email ADD CONSTRAINT request_response_sent_to_user_email_request_response_id FOREIGN KEY (request_response_id) REFERENCES request_response(id);
ALTER TABLE request_response_sent_to_user_email ADD CONSTRAINT request_response_sent_to_user_email_user_email_id FOREIGN KEY (user_email_id) REFERENCES user_email(id);

CREATE TABLE request_response_sent_to_user_twitter (
  request_response_id BIGINT NOT NULL,
  user_twitter_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (request_response_id,user_twitter_id)
);
ALTER TABLE request_response_sent_to_user_twitter ADD CONSTRAINT request_response_sent_to_user_twitter_request_id FOREIGN KEY (request_response_id) REFERENCES request_response(id);
ALTER TABLE request_response_sent_to_user_twitter ADD CONSTRAINT request_response_sent_to_user_twitter_user_twitter_id FOREIGN KEY (user_twitter_id) REFERENCES user_twitter(id);

CREATE TABLE request_response_sent_to_user_telephone (
  request_response_id BIGINT NOT NULL,
  user_telephone_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (request_response_id,user_telephone_id)
);
ALTER TABLE request_response_sent_to_user_telephone ADD CONSTRAINT request_response_sent_to_user_telephone_request_id FOREIGN KEY (request_response_id) REFERENCES request_response(id);
ALTER TABLE request_response_sent_to_user_telephone ADD CONSTRAINT request_response_sent_to_user_telephone_user_telephone_id FOREIGN KEY (user_telephone_id) REFERENCES user_telephone(id);

CREATE TABLE simple_schedule_request_type_rule (
  user_account_id BIGINT NOT NULL,
  request_type_id BIGINT NOT NULL,
  send BOOLEAN NOT NULL DEFAULT 't',
  PRIMARY KEY(user_account_id,request_type_id)
);
ALTER TABLE simple_schedule_request_type_rule ADD CONSTRAINT simple_schedule_request_type_rule_user_account_id FOREIGN KEY (user_account_id) REFERENCES user_account(id);
ALTER TABLE simple_schedule_request_type_rule ADD CONSTRAINT simple_schedule_request_type_rule_request_type_id FOREIGN KEY (request_type_id) REFERENCES request_type(id);

CREATE TABLE schedule_rule (
  id BIGSERIAL NOT NULL,
  user_account_id BIGINT NOT NULL,
  sort_order SMALLINT,
  from_time TIME WITHOUT TIME ZONE,
  to_time TIME WITHOUT TIME ZONE,
  days VARCHAR(100),
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY(id)
);
ALTER TABLE schedule_rule ADD CONSTRAINT schedule_rule_user_account_id FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE schedule_rule_for_user_email (
  schedule_rule_id BIGINT NOT NULL,
  user_email_id BIGINT NOT NULL,
  PRIMARY KEY (schedule_rule_id,user_email_id)
);
ALTER TABLE schedule_rule_for_user_email ADD CONSTRAINT schedule_rule_for_user_email_schedule_rule_id FOREIGN KEY (schedule_rule_id) REFERENCES schedule_rule(id);
ALTER TABLE schedule_rule_for_user_email ADD CONSTRAINT schedule_rule_for_user_email_user_email_id FOREIGN KEY (user_email_id) REFERENCES user_email(id);

CREATE TABLE schedule_rule_for_user_telephone (
  schedule_rule_id BIGINT NOT NULL,
  user_telephone_id BIGINT NOT NULL,
  PRIMARY KEY (schedule_rule_id,user_telephone_id)
);
ALTER TABLE schedule_rule_for_user_telephone ADD CONSTRAINT schedule_rule_for_user_telephone_schedule_rule_id FOREIGN KEY (schedule_rule_id) REFERENCES schedule_rule(id);
ALTER TABLE schedule_rule_for_user_telephone ADD CONSTRAINT schedule_rule_for_user_telephone_user_telephone_id FOREIGN KEY (user_telephone_id) REFERENCES user_telephone(id);

CREATE TABLE schedule_rule_for_user_twitter (
  schedule_rule_id BIGINT NOT NULL,
  user_twitter_id BIGINT NOT NULL,
  PRIMARY KEY (schedule_rule_id,user_twitter_id)
);
ALTER TABLE schedule_rule_for_user_twitter ADD CONSTRAINT schedule_rule_for_user_twitter_schedule_rule_id FOREIGN KEY (schedule_rule_id) REFERENCES schedule_rule(id);
ALTER TABLE schedule_rule_for_user_twitter ADD CONSTRAINT schedule_rule_for_user_twitter_user_telephone_id FOREIGN KEY (user_twitter_id) REFERENCES user_twitter(id);

CREATE TABLE schedule_rule_for_request_type (
  schedule_rule_id BIGINT NOT NULL,
  request_type_id BIGINT NOT NULL,
  PRIMARY KEY (schedule_rule_id,request_type_id)
);
ALTER TABLE schedule_rule_for_request_type ADD CONSTRAINT schedule_rule_for_request_type_schedule_rule_id FOREIGN KEY (schedule_rule_id) REFERENCES schedule_rule(id);
ALTER TABLE schedule_rule_for_request_type ADD CONSTRAINT schedule_rule_for_request_type_request_type_id FOREIGN KEY (request_type_id) REFERENCES request_type(id);

CREATE TABLE sms_in (
  id BIGSERIAL NOT NULL,
  twilio_msg_id VARCHAR(34) NULL,
  from_number VARCHAR(100) NOT NULL,
  body VARCHAR(200) NOT NULL,
  user_telephone_id BIGINT NULL,
  request_response_id BIGINT NULL,
  request_id BIGINT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (id)
);
ALTER TABLE sms_in ADD CONSTRAINT sms_in_user_telephone_id FOREIGN KEY (user_telephone_id) REFERENCES user_telephone(id);
ALTER TABLE sms_in ADD CONSTRAINT sms_in_request_response_id FOREIGN KEY (request_response_id) REFERENCES request_response(id);
ALTER TABLE sms_in ADD CONSTRAINT sms_in_request_id FOREIGN KEY (request_id) REFERENCES request(id);

CREATE TABLE pilot_users (
  id BIGSERIAL NOT NULL,
  about TEXT,
  name TEXT,
  email TEXT,
  phone TEXT,
  PRIMARY KEY (id)
);

CREATE TABLE support_group_news_article (
  id BIGSERIAL NOT NULL,
  summary VARCHAR(500) NOT NULL,
  body TEXT NULL,
  support_group_id BIGINT NOT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  created_by_user_id BIGINT NOT NULL,
  PRIMARY KEY(id)
 );
ALTER TABLE support_group_news_article ADD CONSTRAINT support_group_news_article_support_group_id FOREIGN KEY (support_group_id) REFERENCES support_group(id);
ALTER TABLE support_group_news_article ADD CONSTRAINT support_group_news_article_created_by_user_id FOREIGN KEY (created_by_user_id) REFERENCES user_account(id);

CREATE TABLE support_group_news_article_sent_to_user_email (
  support_group_news_article_id BIGINT NOT NULL,
  user_email_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (support_group_news_article_id,user_email_id)
);
ALTER TABLE support_group_news_article_sent_to_user_email ADD CONSTRAINT support_group_news_article_sent_to_user_email_group_news_id FOREIGN KEY (support_group_news_article_id) REFERENCES support_group_news_article(id);
ALTER TABLE support_group_news_article_sent_to_user_email ADD CONSTRAINT support_group_news_article_sent_to_user_email_user_email_id FOREIGN KEY (user_email_id) REFERENCES user_email(id);

CREATE TABLE support_group_news_article_response (
  id BIGSERIAL NOT NULL,
  support_group_news_article_id BIGINT NOT NULL,
  user_account_id BIGINT NOT NULL,
  created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  response TEXT,
  PRIMARY KEY (id)
);
ALTER TABLE support_group_news_article_response ADD CONSTRAINT support_group_news_article_response_group_news_id FOREIGN KEY (support_group_news_article_id) REFERENCES support_group_news_article(id);
ALTER TABLE support_group_news_article_response ADD CONSTRAINT support_group_news_article_response_user_account_id FOREIGN KEY (user_account_id) REFERENCES user_account(id);

CREATE TABLE support_group_news_article_response_sent_to_user_email (
  support_group_news_article_response_id BIGINT NOT NULL,
  user_email_id BIGINT NOT NULL,
  sent_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  PRIMARY KEY (support_group_news_article_response_id,user_email_id)
);
ALTER TABLE support_group_news_article_response_sent_to_user_email ADD CONSTRAINT support_group_news_article_response_sent_to_user_email_response_id FOREIGN KEY (support_group_news_article_response_id) REFERENCES support_group_news_article_response(id);
ALTER TABLE support_group_news_article_response_sent_to_user_email ADD CONSTRAINT support_group_news_article_response_sent_to_user_email_user_email_id FOREIGN KEY (user_email_id) REFERENCES user_email(id);


text:
#ifndef __A_OUT_GNU_H__
# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
#endif

#ifdef __x86_64__

/* Signal to users of this header that this architecture really doesn't
   support a.out binary format.  */
#define __NO_A_OUT_SUPPORT 1

#endif


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
 ! @(#)RNADNAExpts_Hetero3D_HCCH_COSY.xml 1.1 10/28/10
 !
 -->
<template type="basic" name="RNADNAExpts_Hetero3D_HCCH_COSY" author="chempack" investigator=""
         label="HCCH-COSY" menu1="RNADNAExpts"  menu2="Heteronuclear 3D"
        time_created="20101028T082531" tabname="BioPack" apptype="BioPack"
        application="liquids" scans="RNADNAExpts_Hetero3D_HCCH_COSY" seqfil="rna_hcch_cosy">
  <protocol title="RNADNAExpts_Hetero3D_HCCH_COSY" type="protocol">
    <action  type="LIB" status="Ready" lock="off" title="RNADNAExpts_Hetero3D_HCCH_COSY" exp="RNADNAExpts_Hetero3D_HCCH_COSY"
         dodialog="yes"
        time="0:25" macro="rna_hcch_cosy" data="" />
  </protocol>
</template>


text:
<?php

namespace common\tests\unit;

class TestCase extends \yii\codeception\TestCase
{
    public $appConfig = '@common/tests/unit/_config.php';
}


text:
<!doctype html>

	<title>predator vision</title>
	<meta charset="utf-8" />
 	<link rel="stylesheet" href="css/main.css" />
	<link href="/favicon.png" rel="icon" type="image/png" />
	<meta name="mobile-web-app-capable" content="yes">

Please allow this page to access your camera.

Your browser does not support the Camera API.

Your browser does not support WebGL.

	<canvas id="heatmap"></canvas>

	<button id="button">start</button>

	View on GitHub
	Made by idevelop


text:
// checkVersion('util', 1);

// Utilities
// http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

function showHtmlLink(link)
{
  window.location = link;
}

/*
function checkVersion(name, version)
{
  if (typeof ignoreVersions == 'undefined') {
    if (typeof jsversions[name] == 'undefined') {
      alert(name + '.js has no current version');
	} else if (jsversions[name] != version) {
	  var cookie = name + 'Reload';
	  var flag   = readCookie(cookie);
      if (flag == null) {
		createCookie(cookie, '0', 60);
	    alert(name + '.js version ' + version + ' has been upgraded to version ' + jsversions[name] + '.\n\nReloading page.');
		window.location.reload(true);
        top.window.location.reload(true);
	    return;
      }
	  deleteCookie(cookie);
	  alert(name + '.js version ' + version + ' has been upgraded to version ' + jsversions[name] + '.\n\nPlease clear your browser cache.');
      top.showHtmlLink('../error/upgradeVersion.php');
} } }
*/

function dumbGetElementById(idVal)
{
  if (document.all != null) {
    return document.all[idVal];
  }
  alert("Problem getting element '" + idVal + "' by id");
  return null;
}

if (document.getElementById == null) {
  document.getElementById = dumbGetElementById;
}

function windowInnerWidth(target)
{
  return target.innerWidth || target.document.documentElement.clientWidth || target.document.body.clientWidth;
}

function windowInnerHeight(target)
{
  return target.innerHeight || target.document.documentElement.clientHeight || target.document.body.clientHeight;
}

function windowPageXOffset(target)
{
  return target.pageXOffset || target.document.body.scrollLeft;
}

function windowPageYOffset(target)
{
  return target.pageYOffset || target.document.body.scrollTop;
}

function escapeHTML(unsafe)
{
  if (typeof unsafe == 'string') {
    return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
  }
  return unsafe;

}

function trim(s)
{
  if (s == null) {
    return s;
  }
  return s.replace(/^\s+|\s+$/g,"");
}

function addhidden1(form, name, value)
{
  if ((typeof form[name] === 'undefined') ||
      (typeof form[name].type == 'undefined') ||
	  (form[name].type != 'hidden')) {
    var input = document.createElement('input');
    input.type  = 'hidden';	// ie8 insist this be done before appendChild
    input.name  = name;
    input.value = value;
    form.appendChild(input);
  } else {
    form[name].value = value;
  }
}

function addhidden(form, name, value)
{
  if (value != null && typeof value == 'object') {
	for (item in value) {
	  addhidden1(form, name + '[' + item + ']', value[item]);
    }
  } else {
	addhidden1(form, name, value);
} }

function submitPost(options)
{
  var d,body, form, input, parameters, parameter;

  d    = document;
  body = d.getElementsByTagName("body")[0];
  form = body.appendChild(d.createElement('form'));

  if (options.parameters) {
    parameters = options.parameters;
    for (parameter in parameters) {
      addhidden(form, parameter, parameters[parameter]);
  } }
  form.action = options.action;
  form.method = 'post';
  if (options.target) {
    form.target = options.target;
  }
  form.submit();
}


text:
    defined(JS_ENGINE_CHAKRA)

#ifndef LD_ITERATOR_ASYNC_H
#define LD_ITERATOR_ASYNC_H

#include <node.h>
#include "async.h"
#include "iterator.h"

namespace leveldown {

class NextWorker : public AsyncWorker {
 public:
  NextWorker(Iterator* iterator, NanCallback* callback,
             void (*localCallback)(Iterator*));

  virtual ~NextWorker();
  virtual void Execute();
  virtual void HandleOKCallback();

 private:
  Iterator* iterator;
  void (*localCallback)(Iterator*);
  std::vector<std::pair<std::string, std::string> > result;
  bool ok;
};

class EndWorker : public AsyncWorker {
 public:
  EndWorker(Iterator* iterator, NanCallback* callback);

  virtual ~EndWorker();
  virtual void Execute();
  virtual void HandleOKCallback();

 private:
  Iterator* iterator;
};

}  // namespace leveldown

#endif
#endif


text:
  <button class="btn btn-primary" ng-click="variants.add()"> Add a variant</button>

You have {{ appDetail.app.variants.length }} Variants

{{ variants.typeEnum[variantType].name }} Variants

 {{ variantList.$messageCount }} Delivered

 {{ variantList.$deviceCount }} Devices

 Change name

 Delete

 {{ variant.name }}

            Warning

 No installation yet

 0"> {{ variant.$messageCount }} Delivered

 0"> {{ variant.$deviceCount }} Devices

Apple's Push Network (APNs) will be used.
          To learn more about APNs, visit our iOS
          or Apache Cordova guides for push.

Google's Cloud Messaging Network (GCM) will be used.
          To learn more about GCM, visit our Android, Chrome or Apache Cordova guides for push.

A Server implementing the SimplePush protocol will be used.
          More information can be found in SimplePush Protocol Draft.
          The AeroGears' SimplePush Quickstart also contains useful information.

Amazon's Device Messaging Network (ADM) will be used.
          To learn more about, visit our adm or Apache Cordova guides for push.

Project Number:

{{ variant.projectNumber }}

Google API Key:

            {{ variant.googleKey }}

            <button class="btn btn-sm btn-primary" ng-click="variants.edit( variant )"> Change network options</button>

Type:

Microsoft Push Notification Service

Type:

Windows Push Network

Package SID:

{{ variant.sid }}

Client Secret:

            {{ variant.clientSecret }}

            <button class="btn btn-sm btn-primary" ng-click="variants.edit( variant )"> Change network options</button>

Type:

            {{ variant.production ? 'Production' : 'Development' }}

            <button class="btn btn-sm btn-primary" ng-click="variants.edit( variant )"> Change network options</button>

Client Id:

{{ variant.clientId }}

Client Secret:

{{ variant.clientSecret }}

Refresh Token:

            {{ variant.refreshToken }}

            <button class="btn btn-sm btn-primary" ng-click="variants.edit( variant )"> Change network options</button>

Client Id:

{{ variant.clientId }}

Client Secret:

            {{ variant.clientSecret }}

            <button class="btn btn-sm btn-primary" ng-click="variants.edit( variant )"> Change network options</button>

        <ups-client-snippets variant="variant"></ups-client-snippets>


text:
/**
 *
 */
package com.thinkbiganalytics.security.core;

/*-
 * #%L
 * kylo-commons-security
 * %%
 * Copyright (C) 2017 ThinkBig Analytics
 * %%
 * 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.
 * #L%
 */

import com.thinkbiganalytics.security.core.encrypt.EncryptionService;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.config.server.config.EncryptionAutoConfiguration;
import org.springframework.cloud.config.server.encryption.SingleTextEncryptorLocator;
import org.springframework.cloud.config.server.encryption.TextEncryptorLocator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.crypto.encrypt.TextEncryptor;

/**
 *
 */
@Configuration
@Import({EncryptionAutoConfiguration.class})
public class SecurityCoreConfig {

    @Bean
    @ConditionalOnMissingBean
    public EncryptionService encryptionService() {
        return new EncryptionService();
    }

    @Bean
    @ConditionalOnMissingBean
    public TextEncryptorLocator textEncryptorLocator(TextEncryptor textEncryptor) {
        return new SingleTextEncryptorLocator(textEncryptor);
    }
}


text:
package io.requery.query.element;

public interface SetOperationElement {
    QueryElement<?> getInnerSetQuery();
    SetOperator getOperator();
}


text:
require 'spec_helper'
require 'whois/record/parser/whois.dns.pl.rb'

describe Whois::Record::Parser::WhoisDnsPl, "status_registered.expected" do

  before(:each) do
    file = fixture("responses", "whois.dns.pl/status_registered.txt")
    part = Whois::Record::Part.new(:body => File.read(file))
    @parser = klass.new(part)
  end

  describe "#status" do
    it do
      @parser.status.should == :registered
    end
  end
  describe "#available?" do
    it do
      @parser.available?.should == false
    end
  end
  describe "#registered?" do
    it do
      @parser.registered?.should == true
    end
  end
  describe "#created_on" do
    it do
      @parser.created_on.should be_a(Time)
      @parser.created_on.should == Time.parse("2002-09-19 13:00:00")
    end
  end
  describe "#updated_on" do
    it do
      @parser.updated_on.should be_a(Time)
      @parser.updated_on.should == Time.parse("2010-08-16 11:17:17")
    end
  end
  describe "#expires_on" do
    it do
      lambda { @parser.expires_on }.should raise_error(Whois::PropertyNotSupported)
    end
  end
  describe "#nameservers" do
    it do
      @parser.nameservers.should be_a(Array)
      @parser.nameservers.should have(2).items
      @parser.nameservers[0].should be_a(_nameserver)
      @parser.nameservers[0].name.should == "ns2.google.com"
      @parser.nameservers[1].should be_a(_nameserver)
      @parser.nameservers[1].name.should == "ns1.google.com"
    end
  end
end


text:
namespace content {

class RenderFrameHostImplTest : public RenderViewHostImplTestHarness {
 public:
  void SetUp() override {
    RenderViewHostImplTestHarness::SetUp();
    contents()->GetMainFrame()->InitializeRenderFrameIfNeeded();
  }
};

TEST_F(RenderFrameHostImplTest, ExpectedMainWorldOrigin) {
  GURL initial_url = GURL("https://initial.example.test/");
  GURL final_url = GURL("https://final.example.test/");

  auto get_expected_main_world_origin = [](RenderFrameHost* rfh) {
    NavigationRequest* in_flight_request =
        static_cast<RenderFrameHostImpl*>(rfh)
            ->FindLatestNavigationRequestThatIsStillCommitting();

    return in_flight_request ? in_flight_request->GetOriginToCommit()
                             : rfh->GetLastCommittedOrigin();
  };

  // Start the test with a simple navigation.
  {
    std::unique_ptr<NavigationSimulator> simulator =
        NavigationSimulator::CreateRendererInitiated(initial_url, main_rfh());
    simulator->Start();
    simulator->Commit();
  }
  RenderFrameHostImpl* initial_rfh = main_test_rfh();
  // This test is for a bug that only happens when there is no RFH swap on
  // same-site navigations, so we should disable same-site proactive
  // BrowsingInstance for |initial_rfh| before continiung.
  // Note: this will not disable RenderDocument.
  // TODO(crbug.com/936696): Skip this test when main-frame RenderDocument is
  // enabled.
  DisableProactiveBrowsingInstanceSwapFor(initial_rfh);
  // Verify expected main world origin in a steady state - after a commit it
  // should be the same as the last committed origin.
  EXPECT_EQ(url::Origin::Create(initial_url),
            get_expected_main_world_origin(main_rfh()));
  EXPECT_EQ(url::Origin::Create(initial_url),
            main_rfh()->GetLastCommittedOrigin());
  EXPECT_EQ(blink::StorageKey(url::Origin::Create(initial_url)),
            main_test_rfh()->storage_key());

  // Verify expected main world origin when a pending navigation was started but
  // hasn't yet reached the ready-to-commit state.
  std::unique_ptr<NavigationSimulator> simulator2 =
      NavigationSimulator::CreateRendererInitiated(final_url, main_rfh());
  simulator2->Start();
  EXPECT_EQ(url::Origin::Create(initial_url),
            get_expected_main_world_origin(main_rfh()));

  // Verify expected main world origin when a pending navigation has reached the
  // ready-to-commit state.  Note that the last committed origin shouldn't
  // change yet at this point.
  simulator2->ReadyToCommit();
  simulator2->Wait();
  EXPECT_EQ(url::Origin::Create(final_url),
            get_expected_main_world_origin(main_rfh()));
  EXPECT_EQ(url::Origin::Create(initial_url),
            main_rfh()->GetLastCommittedOrigin());
  EXPECT_EQ(blink::StorageKey(url::Origin::Create(initial_url)),
            main_test_rfh()->storage_key());

  // Verify expected main world origin once we are again in a steady state -
  // after a commit.
  simulator2->Commit();
  EXPECT_EQ(url::Origin::Create(final_url),
            get_expected_main_world_origin(main_rfh()));
  EXPECT_EQ(url::Origin::Create(final_url),
            main_rfh()->GetLastCommittedOrigin());
  EXPECT_EQ(blink::StorageKey(url::Origin::Create(final_url)),
            main_test_rfh()->storage_key());

  // As a test correctness check, verify that there was no RFH swap (the bug
  // this test protects against would only happen if there is no swap).  In
  // fact, FindLatestNavigationRequestThatIsStillCommitting might possibly be
  // removed entirely once we swap on all document changes.
  EXPECT_EQ(initial_rfh, main_rfh());
}

// Test the IsolationInfo and related fields of a request during the various
// phases of a commit, when a RenderFrameHost is reused. Once RenderDocument
// ships, this test may no longer be needed.
TEST_F(RenderFrameHostImplTest, IsolationInfoDuringCommit) {
  GURL initial_url = GURL("https://initial.example.test/");
  url::Origin expected_initial_origin = url::Origin::Create(initial_url);
  blink::StorageKey expected_initial_storage_key =
      blink::StorageKey(expected_initial_origin);
  net::IsolationInfo expected_initial_isolation_info =
      net::IsolationInfo::Create(
          net::IsolationInfo::RequestType::kOther, expected_initial_origin,
          expected_initial_origin,
          net::SiteForCookies::FromOrigin(expected_initial_origin),
          std::set<net::SchemefulSite>());

  GURL final_url = GURL("https://final.example.test/");
  url::Origin expected_final_origin = url::Origin::Create(final_url);
  blink::StorageKey expected_final_storage_key =
      blink::StorageKey(expected_final_origin);
  net::IsolationInfo expected_final_isolation_info = net::IsolationInfo::Create(
      net::IsolationInfo::RequestType::kOther, expected_final_origin,
      expected_final_origin,
      net::SiteForCookies::FromOrigin(expected_final_origin),
      std::set<net::SchemefulSite>());

  // Start the test with a simple navigation.
  {
    std::unique_ptr<NavigationSimulator> simulator =
        NavigationSimulator::CreateRendererInitiated(initial_url, main_rfh());
    simulator->Start();
    simulator->Commit();
  }

  // This test is targetted at the case an RFH is reused between navigations.
  RenderFrameHost* initial_rfh = main_rfh();
  DisableProactiveBrowsingInstanceSwapFor(main_rfh());

  // Check values for the initial commit.
  EXPECT_EQ(expected_initial_origin, main_rfh()->GetLastCommittedOrigin());
  EXPECT_EQ(expected_initial_storage_key, main_test_rfh()->storage_key());
  EXPECT_TRUE(expected_initial_isolation_info.IsEqualForTesting(
      main_rfh()->GetIsolationInfoForSubresources()));
  EXPECT_EQ(expected_initial_isolation_info.network_isolation_key(),
            main_rfh()->GetNetworkIsolationKey());
  EXPECT_TRUE(expected_initial_isolation_info.site_for_cookies().IsEquivalent(
      static_cast<RenderFrameHostImpl*>(main_rfh())->ComputeSiteForCookies()));
  EXPECT_TRUE(expected_initial_isolation_info.IsEqualForTesting(
      main_rfh()->GetPendingIsolationInfoForSubresources()));

  // Values should be the same when a pending navigation was started but
  // hasn't yet reached the ready-to-commit state.
  std::unique_ptr<NavigationSimulator> simulator2 =
      NavigationSimulator::CreateRendererInitiated(final_url, main_rfh());
  simulator2->Start();
  EXPECT_EQ(expected_initial_origin, main_rfh()->GetLastCommittedOrigin());
  EXPECT_EQ(expected_initial_storage_key, main_test_rfh()->storage_key());
  EXPECT_TRUE(expected_initial_isolation_info.IsEqualForTesting(
      main_rfh()->GetIsolationInfoForSubresources()));
  EXPECT_EQ(expected_initial_isolation_info.network_isolation_key(),
            main_rfh()->GetNetworkIsolationKey());
  EXPECT_TRUE(expected_initial_isolation_info.site_for_cookies().IsEquivalent(
      static_cast<RenderFrameHostImpl*>(main_rfh())->ComputeSiteForCookies()));
  EXPECT_TRUE(expected_initial_isolation_info.IsEqualForTesting(
      main_rfh()->GetPendingIsolationInfoForSubresources()));

  // Only the GetPendingIsolationInfoForSubresources() should change when a
  // pending navigation has reached the ready-to-commit state.
  simulator2->ReadyToCommit();
  simulator2->Wait();
  EXPECT_EQ(expected_initial_origin, main_rfh()->GetLastCommittedOrigin());
  EXPECT_EQ(expected_initial_storage_key, main_test_rfh()->storage_key());
  EXPECT_TRUE(expected_initial_isolation_info.IsEqualForTesting(
      main_rfh()->GetIsolationInfoForSubresources()));
  EXPECT_EQ(expected_initial_isolation_info.network_isolation_key(),
            main_rfh()->GetNetworkIsolationKey());
  EXPECT_TRUE(expected_initial_isolation_info.site_for_cookies().IsEquivalent(
      static_cast<RenderFrameHostImpl*>(main_rfh())->ComputeSiteForCookies()));
  EXPECT_TRUE(expected_final_isolation_info.IsEqualForTesting(
      main_rfh()->GetPendingIsolationInfoForSubresources()));

  // Verify expected main world origin once we are again in a steady state -
  // after a commit.
  simulator2->Commit();
  EXPECT_EQ(expected_final_origin, main_rfh()->GetLastCommittedOrigin());
  EXPECT_EQ(expected_final_storage_key, main_test_rfh()->storage_key());
  EXPECT_TRUE(expected_final_isolation_info.IsEqualForTesting(
      main_rfh()->GetIsolationInfoForSubresources()));
  EXPECT_EQ(expected_final_isolation_info.network_isolation_key(),
            main_rfh()->GetNetworkIsolationKey());
  EXPECT_TRUE(expected_final_isolation_info.site_for_cookies().IsEquivalent(
      static_cast<RenderFrameHostImpl*>(main_rfh())->ComputeSiteForCookies()));
  EXPECT_TRUE(expected_final_isolation_info.IsEqualForTesting(
      main_rfh()->GetPendingIsolationInfoForSubresources()));

  // As a test correctness check, verify that there was no RFH swap. When
  // there's always an RFH swap, this test will likely no longer be useful.
  EXPECT_EQ(initial_rfh, main_rfh());
}

TEST_F(RenderFrameHostImplTest, PolicyContainerLifecycle) {
  TestRenderFrameHost* main_rfh = contents()->GetMainFrame();
  ASSERT_NE(main_rfh->policy_container_host(), nullptr);
  EXPECT_EQ(main_rfh->policy_container_host()->referrer_policy(),
            network::mojom::ReferrerPolicy::kDefault);

  static_cast<blink::mojom::PolicyContainerHost*>(
      main_rfh->policy_container_host())
      ->SetReferrerPolicy(network::mojom::ReferrerPolicy::kAlways);
  EXPECT_EQ(main_rfh->policy_container_host()->referrer_policy(),
            network::mojom::ReferrerPolicy::kAlways);

  // Create a child frame and check that it inherits the PolicyContainerHost
  // from the parent frame.
  auto* child_frame = static_cast<TestRenderFrameHost*>(
      content::RenderFrameHostTester::For(main_test_rfh())
          ->AppendChild("child"));

  ASSERT_NE(child_frame->policy_container_host(), nullptr);
  EXPECT_EQ(child_frame->policy_container_host()->referrer_policy(),
            network::mojom::ReferrerPolicy::kAlways);

  // Create a new WebContents with opener and test that the new main frame
  // inherits the PolicyContainerHost from the opener.
  static_cast<blink::mojom::PolicyContainerHost*>(
      child_frame->policy_container_host())
      ->SetReferrerPolicy(network::mojom::ReferrerPolicy::kNever);
  WebContents::CreateParams params(browser_context());
  std::unique_ptr<WebContentsImpl> new_contents(
      WebContentsImpl::CreateWithOpener(params, child_frame));
  RenderFrameHostImpl* new_frame =
      new_contents->GetPrimaryFrameTree().root()->current_frame_host();

  ASSERT_NE(new_frame->policy_container_host(), nullptr);
  EXPECT_EQ(new_frame->policy_container_host()->referrer_policy(),
            network::mojom::ReferrerPolicy::kNever);
}

TEST_F(RenderFrameHostImplTest, FaviconURLsSet) {
  TestRenderFrameHost* main_rfh = contents()->GetMainFrame();
  const auto kFavicon =
      blink::mojom::FaviconURL(GURL("https://example.com/favicon.ico"),
                               blink::mojom::FaviconIconType::kFavicon, {});
  std::unique_ptr<NavigationSimulator> navigation =
      NavigationSimulator::CreateBrowserInitiated(GURL("https://example.com"),
                                                  contents());
  ui::PageTransition transition = ui::PAGE_TRANSITION_LINK;
  navigation->SetTransition(transition);
  navigation->Commit();
  EXPECT_EQ(0u, contents()->GetFaviconURLs().size());

  std::vector<blink::mojom::FaviconURLPtr> one_favicon_url;
  one_favicon_url.push_back(blink::mojom::FaviconURL::New(kFavicon));
  main_rfh->UpdateFaviconURL(std::move(one_favicon_url));
  EXPECT_EQ(1u, contents()->GetFaviconURLs().size());

  std::vector<blink::mojom::FaviconURLPtr> two_favicon_urls;
  two_favicon_urls.push_back(blink::mojom::FaviconURL::New(kFavicon));
  two_favicon_urls.push_back(blink::mojom::FaviconURL::New(kFavicon));
  main_rfh->UpdateFaviconURL(std::move(two_favicon_urls));
  EXPECT_EQ(2u, contents()->GetFaviconURLs().size());

  std::vector<blink::mojom::FaviconURLPtr> another_one_favicon_url;
  another_one_favicon_url.push_back(blink::mojom::FaviconURL::New(kFavicon));
  main_rfh->UpdateFaviconURL(std::move(another_one_favicon_url));
  EXPECT_EQ(1u, contents()->GetFaviconURLs().size());
}

TEST_F(RenderFrameHostImplTest, FaviconURLsResetWithNavigation) {
  TestRenderFrameHost* main_rfh = contents()->GetMainFrame();
  std::vector<blink::mojom::FaviconURLPtr> favicon_urls;
  favicon_urls.push_back(blink::mojom::FaviconURL::New(
      GURL("https://example.com/favicon.ico"),
      blink::mojom::FaviconIconType::kFavicon, std::vector<gfx::Size>()));

  std::unique_ptr<NavigationSimulator> navigation =
      NavigationSimulator::CreateBrowserInitiated(GURL("https://example.com"),
                                                  contents());
  ui::PageTransition transition = ui::PAGE_TRANSITION_LINK;
  navigation->SetTransition(transition);
  navigation->Commit();

  EXPECT_EQ(0u, contents()->GetFaviconURLs().size());
  main_rfh->UpdateFaviconURL(std::move(favicon_urls));
  EXPECT_EQ(1u, contents()->GetFaviconURLs().size());

  navigation = NavigationSimulator::CreateBrowserInitiated(
      GURL("https://example.com/navigation.html"), contents());
  navigation->SetTransition(transition);
  navigation->Commit();
  EXPECT_EQ(0u, contents()->GetFaviconURLs().size());
}

TEST_F(RenderFrameHostImplTest, ChildOfAnonymousIsAnonymous) {
  EXPECT_FALSE(main_test_rfh()->anonymous());

  auto* child_frame = static_cast<TestRenderFrameHost*>(
      content::RenderFrameHostTester::For(main_test_rfh())
          ->AppendChild("child"));
  EXPECT_FALSE(child_frame->anonymous());
  EXPECT_FALSE(child_frame->storage_key().nonce().has_value());

  child_frame->frame_tree_node()->set_anonymous(true);
  EXPECT_FALSE(child_frame->anonymous());
  EXPECT_FALSE(child_frame->storage_key().nonce().has_value());

  // A navigation in the anonymous iframe commits an anonymous RFH.
  std::unique_ptr<NavigationSimulator> navigation =
      NavigationSimulator::CreateRendererInitiated(
          GURL("https://example.com/navigation.html"), child_frame);
  navigation->Commit();
  child_frame =
      static_cast<TestRenderFrameHost*>(navigation->GetFinalRenderFrameHost());
  EXPECT_TRUE(child_frame->anonymous());
  EXPECT_TRUE(child_frame->storage_key().nonce().has_value());

  // An anonymous document sets a nonce on its network isolation key.
  EXPECT_TRUE(child_frame->GetNetworkIsolationKey().GetNonce().has_value());
  EXPECT_EQ(main_test_rfh()->GetPage().anonymous_iframes_nonce(),
            child_frame->GetNetworkIsolationKey().GetNonce().value());

  // A child of an anonymous RFH is anonymous.
  auto* grandchild_frame = static_cast<TestRenderFrameHost*>(
      content::RenderFrameHostTester::For(child_frame)
          ->AppendChild("grandchild"));
  EXPECT_TRUE(grandchild_frame->anonymous());
  EXPECT_TRUE(child_frame->storage_key().nonce().has_value());

  // The two anonymous RFH's storage keys should have the same nonce.
  EXPECT_EQ(child_frame->storage_key().nonce().value(),
            grandchild_frame->storage_key().nonce().value());

  // Also the anonymous initial empty document sets a nonce on its network
  // isolation key.
  EXPECT_TRUE(
      grandchild_frame->GetNetworkIsolationKey().GetNonce().has_value());
  EXPECT_EQ(main_test_rfh()->GetPage().anonymous_iframes_nonce(),
            grandchild_frame->GetNetworkIsolationKey().GetNonce().value());
}

// FakeLocalFrame implementation that records calls to BeforeUnload().
class FakeLocalFrameWithBeforeUnload : public content::FakeLocalFrame {
 public:
  explicit FakeLocalFrameWithBeforeUnload(TestRenderFrameHost* test_host) {
    Init(test_host->GetRemoteAssociatedInterfaces());
  }

  bool was_before_unload_called() const { return was_before_unload_called_; }

  void RunBeforeUnloadCallback() {
    ASSERT_TRUE(before_unload_callback_);
    std::move(before_unload_callback_)
        .Run(true, base::TimeTicks::Now(), base::TimeTicks::Now());
  }

  // FakeLocalFrame:
  void BeforeUnload(bool is_reload, BeforeUnloadCallback callback) override {
    was_before_unload_called_ = true;
    before_unload_callback_ = std::move(callback);
  }

 private:
  bool was_before_unload_called_ = false;
  BeforeUnloadCallback before_unload_callback_;
};

// Verifies BeforeUnload() is not sent to renderer if there is no before
// unload handler present.
TEST_F(RenderFrameHostImplTest, BeforeUnloadNotSentToRenderer) {
  base::test::ScopedFeatureList scoped_feature_list;
  scoped_feature_list.InitAndEnableFeature(
      features::kAvoidUnnecessaryBeforeUnloadCheck);
  FakeLocalFrameWithBeforeUnload local_frame(contents()->GetMainFrame());
  auto simulator = NavigationSimulatorImpl::CreateBrowserInitiated(
      GURL("https://example.com/simple.html"), contents());
  simulator->set_block_invoking_before_unload_completed_callback(true);
  simulator->Start();
  EXPECT_TRUE(
      contents()->GetMainFrame()->is_waiting_for_beforeunload_completion());
  EXPECT_FALSE(local_frame.was_before_unload_called());
  // This is necessary to trigger FakeLocalFrameWithBeforeUnload to be bound.
  contents()->GetMainFrame()->FlushLocalFrameMessages();
  // This runs a MessageLoop, which also results in the PostTask() scheduled
  // completing.
  local_frame.FlushMessages();
  EXPECT_FALSE(local_frame.was_before_unload_called());
  // Because of the nested message loops run by the previous calls, the task
  // that RenderFrameHostImpl will have also completed.
  EXPECT_FALSE(
      contents()->GetMainFrame()->is_waiting_for_beforeunload_completion());
}

// Verifies BeforeUnloadNotSentToRenderer() is sent to renderer.
TEST_F(RenderFrameHostImplTest, BeforeUnloadSentToRenderer) {
  base::test::ScopedFeatureList scoped_feature_list;
  scoped_feature_list.InitAndDisableFeature(
      features::kAvoidUnnecessaryBeforeUnloadCheck);
  FakeLocalFrameWithBeforeUnload local_frame(contents()->GetMainFrame());
  auto simulator = NavigationSimulatorImpl::CreateBrowserInitiated(
      GURL("https://example.com/simple.html"), contents());
  simulator->set_block_invoking_before_unload_completed_callback(true);
  simulator->Start();
  EXPECT_TRUE(
      contents()->GetMainFrame()->is_waiting_for_beforeunload_completion());
  // This is necessary to trigger FakeLocalFrameWithBeforeUnload to be bound.
  contents()->GetMainFrame()->FlushLocalFrameMessages();
  local_frame.FlushMessages();
  EXPECT_TRUE(local_frame.was_before_unload_called());
  EXPECT_TRUE(
      contents()->GetMainFrame()->is_waiting_for_beforeunload_completion());
  // Needed to avoid DCHECK in mojo if callback is not run.
  local_frame.RunBeforeUnloadCallback();
}

}  // namespace content


text:
package com.microsoft.azure.management.vmwarecloudsimple.v2019_04_01.implementation;

import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.vmwarecloudsimple.v2019_04_01.ResourcePools;
import rx.Observable;
import rx.functions.Func1;
import com.microsoft.azure.Page;
import com.microsoft.azure.management.vmwarecloudsimple.v2019_04_01.ResourcePool;

class ResourcePoolsImpl extends WrapperImpl<ResourcePoolsInner> implements ResourcePools {
    private final VMwareCloudSimpleManager manager;

    ResourcePoolsImpl(VMwareCloudSimpleManager manager) {
        super(manager.inner().resourcePools());
        this.manager = manager;
    }

    public VMwareCloudSimpleManager manager() {
        return this.manager;
    }

    private ResourcePoolImpl wrapModel(ResourcePoolInner inner) {
        return  new ResourcePoolImpl(inner, manager());
    }

    @Override
    public Observable<ResourcePool> listAsync(final String regionId, final String pcName) {
        ResourcePoolsInner client = this.inner();
        return client.listAsync(regionId, pcName)
        .flatMapIterable(new Func1<Page<ResourcePoolInner>, Iterable<ResourcePoolInner>>() {
            @Override
            public Iterable<ResourcePoolInner> call(Page<ResourcePoolInner> page) {
                return page.items();
            }
        })
        .map(new Func1<ResourcePoolInner, ResourcePool>() {
            @Override
            public ResourcePool call(ResourcePoolInner inner) {
                return wrapModel(inner);
            }
        });
    }

    @Override
    public Observable<ResourcePool> getAsync(String regionId, String pcName, String resourcePoolName) {
        ResourcePoolsInner client = this.inner();
        return client.getAsync(regionId, pcName, resourcePoolName)
        .flatMap(new Func1<ResourcePoolInner, Observable<ResourcePool>>() {
            @Override
            public Observable<ResourcePool> call(ResourcePoolInner inner) {
                if (inner == null) {
                    return Observable.empty();
                } else {
                    return Observable.just((ResourcePool)wrapModel(inner));
                }
            }
       });
    }

}


text:
"""
Test subset iterators.
"""
import numpy as np

from pylearn2.testing.skip import skip_if_no_sklearn

def test_validation_k_fold():
    """Test ValidationKFold."""
    skip_if_no_sklearn()
    from pylearn2.cross_validation.subset_iterators import ValidationKFold
    n = 30

    # test with indices
    cv = ValidationKFold(n)
    for train, valid, test in cv:
        assert np.unique(np.concatenate((train, valid, test))).size == n
        assert valid.size == n / cv.n_folds
        assert test.size == n / cv.n_folds

def test_stratified_validation_k_fold():
    """Test StratifiedValidationKFold."""
    skip_if_no_sklearn()
    from pylearn2.cross_validation.subset_iterators import (
        StratifiedValidationKFold)
    n = 30
    y = np.concatenate((np.zeros(n / 2, dtype=int), np.ones(n / 2, dtype=int)))

    # test with indices
    cv = StratifiedValidationKFold(y)
    for train, valid, test in cv:
        assert np.unique(np.concatenate((train, valid, test))).size == n
        assert valid.size == n / cv.n_folds
        assert test.size == n / cv.n_folds
        assert np.count_nonzero(y[valid]) == (n / 2) * (1. / cv.n_folds)
        assert np.count_nonzero(y[test]) == (n / 2) * (1. / cv.n_folds)

def test_validation_shuffle_split():
    """Test ValidationShuffleSplit."""
    skip_if_no_sklearn()
    from pylearn2.cross_validation.subset_iterators import (
        ValidationShuffleSplit)
    n = 30

    # test with indices
    cv = ValidationShuffleSplit(n)
    for train, valid, test in cv:
        assert np.unique(np.concatenate((train, valid, test))).size == n
        assert valid.size == n * cv.test_size
        assert test.size == n * cv.test_size

def test_stratified_validation_shuffle_split():
    """Test StratifiedValidationShuffleSplit."""
    skip_if_no_sklearn()
    from pylearn2.cross_validation.subset_iterators import (
        StratifiedValidationShuffleSplit)
    n = 60
    y = np.concatenate((np.zeros(n / 2, dtype=int), np.ones(n / 2, dtype=int)))

    # test with indices
    cv = StratifiedValidationShuffleSplit(y)
    for train, valid, test in cv:
        assert np.unique(np.concatenate((train, valid, test))).size == n
        assert valid.size == n * cv.test_size
        assert test.size == n * cv.test_size
        assert np.count_nonzero(y[valid]) == (n / 2) * cv.test_size
        assert np.count_nonzero(y[test]) == (n / 2) * cv.test_size


text:
using namespace swift::irgen;
using StringSet = llvm::StringSet<>;

namespace swift {

struct TBDGenOptions;

namespace tbdgen {

class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
public:
  tapi::internal::InterfaceFile &Symbols;
  tapi::internal::ArchitectureSet Archs;
  StringSet *StringSymbols;

  const UniversalLinkageInfo &UniversalLinkInfo;
  ModuleDecl *SwiftModule;
  AvailabilityContext AvailCtx;
  const TBDGenOptions &Opts;

private:
  void addSymbol(StringRef name, tapi::internal::SymbolKind kind =
                                     tapi::internal::SymbolKind::GlobalSymbol);

  void addSymbol(SILDeclRef declRef);

  void addSymbol(LinkEntity entity);

  void addConformances(DeclContext *DC);

  void addDispatchThunk(SILDeclRef declRef);

  void addMethodDescriptor(SILDeclRef declRef);

  void addProtocolRequirementsBaseDescriptor(ProtocolDecl *proto);
  void addAssociatedTypeDescriptor(AssociatedTypeDecl *assocType);
  void addAssociatedConformanceDescriptor(AssociatedConformance conformance);
  void addBaseConformanceDescriptor(BaseConformance conformance);

public:
  TBDGenVisitor(tapi::internal::InterfaceFile &symbols,
                tapi::internal::ArchitectureSet archs, StringSet *stringSymbols,
                const UniversalLinkageInfo &universalLinkInfo,
                ModuleDecl *swiftModule, AvailabilityContext availCtx,
                const TBDGenOptions &opts)
      : Symbols(symbols), Archs(archs), StringSymbols(stringSymbols),
        UniversalLinkInfo(universalLinkInfo), SwiftModule(swiftModule),
        AvailCtx(availCtx), Opts(opts) {}

  void addMainIfNecessary(FileUnit *file) {
    // HACK: 'main' is a special symbol that's always emitted in SILGen if
    //       the file has an entry point. Since it doesn't show up in the
    //       module until SILGen, we need to explicitly add it here.
    if (file->hasEntryPoint())
      addSymbol("main");
  }

  /// Adds the global symbols associated with the first file.
  void addFirstFileSymbols();

  void visitDefaultArguments(ValueDecl *VD, ParameterList *PL);

  void visitAbstractFunctionDecl(AbstractFunctionDecl *AFD);

  void visitAccessorDecl(AccessorDecl *AD);

  void visitNominalTypeDecl(NominalTypeDecl *NTD);

  void visitClassDecl(ClassDecl *CD);

  void visitConstructorDecl(ConstructorDecl *CD);

  void visitDestructorDecl(DestructorDecl *DD);

  void visitExtensionDecl(ExtensionDecl *ED);

  void visitFuncDecl(FuncDecl *FD);

  void visitProtocolDecl(ProtocolDecl *PD);

  void visitAbstractStorageDecl(AbstractStorageDecl *ASD);

  void visitVarDecl(VarDecl *VD);

  void visitEnumDecl(EnumDecl *ED);

  void visitEnumElementDecl(EnumElementDecl *EED);

  void visitDecl(Decl *D) {}
};
} // end namespace tbdgen
} // end namespace swift

#endif