text:
import prefix from '../prefix'
import pascalize from '../utils/pascalize'

// Support old inline-logical syntax.
// See https://github.com/postcss/autoprefixer/issues/324.
export default {
  supportedProperty: (prop, style) => {
    if (!/^(border|margin|padding)-inline/.test(prop)) return false
    if (prefix.js === 'Moz') return prop
    const newProp = prop.replace('-inline', '')
    return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false
  }
}


text:
package org.watterssoft.appsupport.user.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import org.watterssoft.appsupport.user.domain.UserRoleMapping;

/**
 * @author johnwatters 11 May 2014 09:29:03
 */

public interface IUserRoleMappingDao extends Repository<UserRoleMapping, Long>
{

	@Query(name = "UserRoleMapping.findRolesForUser")
	public List<UserRoleMapping> findUserRoleMappingByUserName(@Param("username")String username);
}

redpajama_set_name: RedPajamaGithub


text:
import React, { Component } from 'react';

import {
  View,
  Text,
  Image,
  StyleSheet,
  TouchableOpacity,
  Dimensions
} from 'react-native';

import * as moviesService from '../../services/movies-service';
import * as colors from '../../common/colors';

const { width, height } = Dimensions.get('window');

export default class Welcome extends Component {

  constructor(props) {
    super(props);

    this.state = {
      showWelcome: false
    };
  }

  _goTo(route) {
    if (route === 'login') {
      moviesService.getNavigator().push({index: 0.1, title: 'login'});
    } else {
      moviesService.getNavigator().push({index: 0.2, title: 'register'});
    }
  }

  render() {

    return (
      <View style={styles.container} renderToHardwareTextureAndroid={true}>

        <View style={{height: height, width: width}}>
          <Image source={require('../../assets/img/bg-welcome-light.png')} style={styles.bg} />
        </View>

        <View style={{position: 'absolute', top: height/2-180, left: width/2-150, width: 300}}>
          <Image source={require('../../assets/img/logo.png')} style={styles.logo} />

          <Text style={styles.welcome1}>
            Bienvenido a Filmist
          </Text>

          <Text style={styles.welcome2}>
            Busca, sincroniza y comparte tus películas y series favoritas
          </Text>

          <TouchableOpacity
            onPress={this._goTo.bind(this, 'login')}
            style={styles.buttonDark}
            activeOpacity={0.9}>
            <Text style={styles.textLight}>
              INICIAR SESIÓN
            </Text>
          </TouchableOpacity>

          <TouchableOpacity
            onPress={this._goTo.bind(this, 'register')}
            style={styles.button}
            activeOpacity={0.9}>
            <Text style={styles.text}>
              REGÍSTRATE
            </Text>
          </TouchableOpacity>
        </View>

      </View>
    );

  }

}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: colors.getList().primary,
    height: height,
    width: width
    // padding: 30
  },
  logo: {
    width: 100,
    height: 100,
    marginLeft: -10
  },
  welcome1: {
    color: colors.getList().white,
    textAlign: 'left',
    fontWeight: 'bold',
    fontSize: 32,
    marginBottom: 15
  },
  welcome2: {
    color: colors.getList().white,
    textAlign: 'left',
    fontSize: 18,
    width: 300,
    marginBottom: 30
  },
  button: {
    paddingTop: 17,
    paddingLeft: 20,
    paddingRight: 20,
    paddingBottom: 17,
    borderRadius: 3,
    borderWidth: 2,
    borderColor: colors.getList().app,
    backgroundColor: colors.getList().transparent,
    marginBottom: 20,
    minWidth: 300
  },
  buttonDark: {
    paddingTop: 17,
    paddingLeft: 20,
    paddingRight: 20,
    paddingBottom: 17,
    borderRadius: 3,
    borderWidth: 2,
    borderColor: colors.getList().app,
    backgroundColor: colors.getList().app,
    marginBottom: 15,
    minWidth: 300
  },
  text: {
    color: colors.getList().app,
    textAlign: 'center',
    fontWeight: 'bold',
    fontSize: 14
  },
  textLight: {
    color: '#FFF',
    textAlign: 'center',
    fontWeight: 'bold',
    fontSize: 14
  }
});


text:
"""Object client"""

import logging

from openstackclient.common import utils

LOG = logging.getLogger(__name__)

API_NAME = 'object-store'
API_VERSIONS = {
    '1': 'openstackclient.object.client.ObjectClientv1',
}

def make_client(instance):
    """Returns an object service client."""
    object_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    if instance._url:
        endpoint = instance._url
    else:
        endpoint = instance.get_endpoint_for_service_type(API_NAME)
    LOG.debug('instantiating object client')
    client = object_client(
        endpoint=endpoint,
        token=instance._token,
    )
    return client

class ObjectClientv1(object):

    def __init__(
        self,
        endpoint_type='publicURL',
        endpoint=None,
        token=None,
    ):
        self.endpoint_type = endpoint_type
        self.endpoint = endpoint
        self.token = token


text:
var log = require('color-log');
var rex = require('../regexp_html');
var fs_util = require('../fs_utils')
var fs = require('fs');
var path = require('path');

if (process.argv.length < 2 || !fs.existsSync(process.argv[2])) {
  log.info("Usage: jx compile_path.js <target_folder_with_html_files>");
  process.exit(0);
}

// Collect all the HTML file names
var files = fs_util.searchPathForExtension(process.argv[2], 'html');

var isWindows = process.platform === "win32";

fs.mkdirSync(path.join(__dirname, ".." + path.sep + "out" + path.sep));

for (var i = 0, ln = files.length; i < ln; i++) {
  var file = files[i];
  process.stdout.write(".");
  var data = fs.readFileSync(file) + "";
  data = rex.clearHTMLTag(data);
  data = rex.clearSpaceAndBreak(data);
  data = rex.clearNoneSense(data, 'eng');

  if (isWindows)
    file = file.replace(/\\/g, "_");
  else
    file = file.replace(/\//g, "_");

  fs.writeFileSync(path.join(__dirname, ".." + path.sep + "out" + path.sep, file), data);
  log.info(file);
}

log.info("Operation Completed");


text:
import Ember from 'ember';
import LiquidTether from 'liquid-tether/components/liquid-tether';

const {
    RSVP: {Promise},
    inject: {service},
    isBlank,
    on,
    run
} = Ember;
const emberA = Ember.A;

const FullScreenModalComponent = LiquidTether.extend({
    to: 'fullscreen-modal',
    target: 'document.body',
    targetModifier: 'visible',
    targetAttachment: 'top center',
    attachment: 'top center',
    tetherClass: 'fullscreen-modal',
    overlayClass: 'fullscreen-modal-background',
    modalPath: 'unknown',

    dropdown: service(),

    init() {
        this._super(...arguments);
        this.modalPath = `modals/${this.get('modal')}`;
    },

    setTetherClass: on('init', function () {
        let tetherClass = this.get('tetherClass');
        let modifiers = (this.get('modifier') || '').split(' ');
        let tetherClasses = emberA([tetherClass]);

        modifiers.forEach((modifier) => {
            if (!isBlank(modifier)) {
                let className = `${tetherClass}-${modifier}`;
                tetherClasses.push(className);
            }
        });

        this.set('tetherClass', tetherClasses.join(' '));
    }),

    closeDropdowns: on('didInsertElement', function () {
        run.schedule('afterRender', this, function () {
            this.get('dropdown').closeDropdowns();
        });
    }),

    actions: {
        close() {
            if (this.get('close')) {
                return this.get('close')();
            }

            return new Promise((resolve) => {
                resolve();
            });
        },

        confirm() {
            if (this.get('confirm')) {
                return this.get('confirm')();
            }

            return new Promise((resolve) => {
                resolve();
            });
        },

        clickOverlay() {
            this.send('close');
        }
    }
});

FullScreenModalComponent.reopenClass({
    positionalParams: ['modal']
});

export default FullScreenModalComponent;


text:
import pytest

from distutils.version import LooseVersion
from f5.bigip.resource import MissingRequiredCreationParameter
from f5.bigip.tm.security.scrubber import Profile
from f5.bigip.tm.security.scrubber import Scrubber_Categories
from f5.bigip.tm.security.scrubber import Scrubber_Netflow_Protected_Server
from f5.bigip.tm.security.scrubber import Scrubber_Rd_Network_Prefix
from f5.bigip.tm.security.scrubber import Scrubber_Rt_Domain
from f5.bigip.tm.security.scrubber import Scrubber_Virtual_Server
from requests.exceptions import HTTPError

DESC = 'TESTADDED'

@pytest.fixture(scope='function')
def scrubber_categories(mgmt_root):
    p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
    cat_lst = p1.scrubber_categories_s
    params_set = {'name': 'fake_categories_profile', 'blacklistCategory': '/Common/proxy', 'routeDomainName': '/Common/0', 'nextHop': '1.1.1.1'}
    c1 = cat_lst.scrubber_categories.create(**params_set)
    yield c1
    c1.delete()

@pytest.fixture(scope='function')
def traffic_matching_criteria(mgmt_root):
    tmc1 = mgmt_root.tm.security.protected_servers.traffic_matching_criteria_s.traffic_matching_criteria.create(
        name='fake_tmc', destinationAddressInline='1.1.1.1', sourceAddressInline='2.2.2.2', partition='Common')
    yield tmc1
    tmc1.delete()

@pytest.fixture(scope='function')
def netflow_protected_server(mgmt_root, traffic_matching_criteria):
    tmc = traffic_matching_criteria
    nps1 = mgmt_root.tm.security.protected_servers.netflow_protected_server_s.netflow_protected_server.create(
        name='fake_nps', trafficMatchingCriteria=tmc.fullPath, partition='Common')
    yield nps1
    nps1.delete()

@pytest.fixture(scope='function')
def scrubber_netflow_protected_server(mgmt_root, netflow_protected_server):
    nps = netflow_protected_server
    p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
    nps_lst = p1.scrubber_netflow_protected_server_s
    params_set = {'name': 'fake_netflow_protected_server_profile', 'npsName': nps.fullPath, 'nextHop': '1.1.1.1'}
    nps1 = nps_lst.scrubber_netflow_protected_server.create(**params_set)
    yield nps1
    nps1.delete()

@pytest.fixture(scope='function')
def virtual(mgmt_root):
    vs = mgmt_root.tm.ltm.virtuals.virtual.create(
        name='fake_virtual', partition='Common', protocol='tcp')
    yield vs
    vs.delete()

@pytest.fixture(scope='function')
def scrubber_virtual_server(mgmt_root, virtual):
    vs = virtual
    p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
    cat_lst = p1.scrubber_virtual_server_s
    params_set = {'name': 'fake_virtual_server_profile', 'vsName': vs.fullPath, 'nextHop': '1.1.1.1'}
    v1 = cat_lst.scrubber_virtual_server.create(**params_set)
    yield v1
    v1.delete()

@pytest.fixture(scope='function')
def scrubber_rt_domain(mgmt_root):
    p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
    rd_lst = p1.scrubber_rt_domain_s
    params_set = {'name': 'fake_rt_domain_profile', 'routeDomain': '/Common/0', 'nextHop': '1.1.1.1'}
    rd1 = rd_lst.scrubber_rt_domain.create(**params_set)
    yield rd1
    rd1.delete()

@pytest.fixture(scope='function')
def scrubber_rd_network_prefix(mgmt_root):
    p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
    rd_lst = p1.scrubber_rt_domain_s
    params_set = {'name': 'fake_rt_domain_profile', 'routeDomain': '/Common/0', 'nextHop': '1.1.1.1'}
    rd1 = rd_lst.scrubber_rt_domain.create(**params_set)
    rd_net_lst = rd1.scrubber_rd_network_prefix_s
    net_params_set = {'name': 'fake_rd_network_prefix_profile', 'dstIp': '1.1.1.0', 'mask': '24', 'nextHop': '2.2.2.2'}
    rd_net1 = rd_net_lst.scrubber_rd_network_prefix.create(**net_params_set)
    yield rd_net1
    rd_net1.delete()
    rd1.delete()

@pytest.mark.skipif(
    LooseVersion(pytest.config.getoption('--release')) < LooseVersion('13.0.0'),
    reason='This collection is fully implemented on 13.0.0 or greater.'
)
class TestProfile(object):
    def test_load_no_object(self, mgmt_root):
        p = mgmt_root.tm.security.scrubber.profile_s.profile
        with pytest.raises(HTTPError) as err:
            p.load(name='not_exists', partition='Common')
        assert err.value.response.status_code == 404

    def test_load_and_update(self, mgmt_root):
        p = mgmt_root.tm.security.scrubber.profile_s.profile
        p1 = p.load(name='scrubber-profile-default', partition='Common')
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default'
        assert p1.name == 'scrubber-profile-default'
        assert p1.partition == 'Common'
        assert p1.selfLink.startswith(URI)
        p1.advertisementTtl = 500
        p1.update()
        p2 = p.load(name='scrubber-profile-default', partition='Common')
        assert p1.name == p2.name
        assert p1.partition == p2.partition
        assert p1.selfLink == p2.selfLink
        assert p2.advertisementTtl == '500'

    def test_profile_collection(self, mgmt_root):
        pc = mgmt_root.tm.security.scrubber.profile_s.get_collection()
        assert isinstance(pc, list)
        assert len(pc)
        assert isinstance(pc[0], Profile)

@pytest.mark.skipif(
    LooseVersion(pytest.config.getoption('--release')) < LooseVersion('13.0.0'),
    reason='This collection is fully implemented on 13.0.0 or greater.'
)
class TestScrubberCategories(object):
    def test_mandatory_attribute_missing(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        cat_lst = p1.scrubber_categories_s
        ERR = "Missing required params"
        with pytest.raises(MissingRequiredCreationParameter) as err:
            cat_lst.scrubber_categories.create(name='botnets')
        assert str(err.value).startswith(ERR)

    def test_create_req_arg(self, scrubber_categories):
        c1 = scrubber_categories
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-categories/fake_categories_profile'
        assert c1.name == 'fake_categories_profile'
        assert c1.selfLink.startswith(URI)

    def test_create_optional_args(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        cat_lst = p1.scrubber_categories_s
        params_set = {'name': 'fake_categories_profile', 'blacklistCategory': '/Common/proxy', 'routeDomainName': '/Common/0',
                      'nextHop': '1.1.1.1', 'advertisementMethod': 'bgp-flowspec-method'}
        c1 = cat_lst.scrubber_categories.create(**params_set)
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-categories/fake_categories_profile'
        assert c1.name == 'fake_categories_profile'
        assert c1.selfLink.startswith(URI)
        assert c1.advertisementMethod == 'bgp-flowspec-method'
        c1.delete()

    def test_refresh(self, scrubber_categories, mgmt_root):
        c1 = scrubber_categories
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        cat_lst = p1.scrubber_categories_s
        c2 = cat_lst.scrubber_categories.load(name='fake_categories_profile')
        assert c1.name == c2.name
        assert c1.selfLink == c2.selfLink
        assert c1.kind == c2.kind
        c2.modify(advertisementMethod='bgp-flowspec-method')
        assert c2.advertisementMethod == 'bgp-flowspec-method'
        c1.refresh()
        assert c1.advertisementMethod == 'bgp-flowspec-method'

    def test_delete(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        cat_lst = p1.scrubber_categories_s
        params_set = {'name': 'fake_categories_profile', 'blacklistCategory': '/Common/proxy',
                      'routeDomainName': '/Common/0', 'nextHop': '1.1.1.1', 'advertisementMethod': 'bgp-flowspec-method'}
        c1 = cat_lst.scrubber_categories.create(**params_set)
        c1.delete()
        with pytest.raises(HTTPError) as err:
            cat_lst.scrubber_categories.load(name='fake_categories_profile')
        assert err.value.response.status_code == 404

    def test_load_no_object(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        cat_lst = p1.scrubber_categories_s
        with pytest.raises(HTTPError) as err:
            cat_lst.scrubber_categories.load(name='fake_categories_profile')
        assert err.value.response.status_code == 404

    def test_load_and_update(self, scrubber_categories, mgmt_root):
        c1 = scrubber_categories
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-categories/fake_categories_profile'
        assert c1.name == 'fake_categories_profile'
        assert c1.selfLink.startswith(URI)
        c1.advertisementMethod = 'bgp-flowspec-method'
        c1.update()
        assert c1.advertisementMethod == 'bgp-flowspec-method'
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        cat_lst = p1.scrubber_categories_s
        c2 = cat_lst.scrubber_categories.load(name='fake_categories_profile')
        assert c1.name == c2.name
        assert c1.selfLink == c2.selfLink
        assert c1.kind == c2.kind
        assert c2.advertisementMethod == 'bgp-flowspec-method'

    def test_scrubber_categories_subcollection(self, scrubber_categories, mgmt_root):
        c1 = scrubber_categories
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-categories/fake_categories_profile'
        assert c1.name == 'fake_categories_profile'
        assert c1.selfLink.startswith(URI)
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        cat_lst = p1.scrubber_categories_s
        cat_col = cat_lst.get_collection()
        assert isinstance(cat_col, list)
        assert len(cat_col)
        assert isinstance(cat_col[0], Scrubber_Categories)

@pytest.mark.skipif(
    LooseVersion(pytest.config.getoption('--release')) < LooseVersion('13.0.0'),
    reason='This collection is fully implemented on 13.0.0 or greater.'
)
class TestScrubberVS(object):
    def test_mandatory_attribute_missing(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        vs_lst = p1.scrubber_virtual_server_s
        ERR = "Missing required params"
        with pytest.raises(MissingRequiredCreationParameter) as err:
            vs_lst.scrubber_virtual_server.create(name='fake')
        assert str(err.value).startswith(ERR)

    def test_create_req_arg(self, scrubber_virtual_server):
        v1 = scrubber_virtual_server
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-virtual-server/fake_virtual_server_profile'
        assert v1.name == 'fake_virtual_server_profile'
        assert v1.selfLink.startswith(URI)

    def test_create_optional_args(self, mgmt_root, virtual):
        vs = virtual
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        vs_lst = p1.scrubber_virtual_server_s
        params_set = {'name': 'fake_virtual_server_profile', 'vsName': vs.fullPath, 'nextHop': '1.1.1.1',
                      'advertisementMethod': 'bgp-flowspec-method'}
        v1 = vs_lst.scrubber_virtual_server.create(**params_set)
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-virtual-server/fake_virtual_server_profile'
        assert v1.name == 'fake_virtual_server_profile'
        assert v1.selfLink.startswith(URI)
        assert v1.advertisementMethod == 'bgp-flowspec-method'
        v1.delete()

    def test_refresh(self, scrubber_virtual_server, mgmt_root):
        v1 = scrubber_virtual_server
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        vs_lst = p1.scrubber_virtual_server_s
        v2 = vs_lst.scrubber_virtual_server.load(name='fake_virtual_server_profile')
        assert v1.name == v2.name
        assert v1.selfLink == v2.selfLink
        assert v1.kind == v2.kind
        v2.modify(advertisementMethod='bgp-flowspec-method')
        assert v2.advertisementMethod == 'bgp-flowspec-method'
        v1.refresh()
        assert v1.advertisementMethod == 'bgp-flowspec-method'

    def test_delete(self, mgmt_root, virtual):
        vs = virtual
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        vs_lst = p1.scrubber_virtual_server_s
        params_set = {'name': 'fake_virtual_server_profile', 'vsName': vs.fullPath, 'nextHop': '1.1.1.1',
                      'advertisementMethod': 'bgp-flowspec-method'}
        v1 = vs_lst.scrubber_virtual_server.create(**params_set)
        v1.delete()
        with pytest.raises(HTTPError) as err:
            vs_lst.scrubber_virtual_server.load(name='fake_virtual_server_profile')
        assert err.value.response.status_code == 404

    def test_load_no_object(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        vs_lst = p1.scrubber_virtual_server_s
        with pytest.raises(HTTPError) as err:
            vs_lst.scrubber_virtual_server.load(name='fake_virtual_server_profile')
        assert err.value.response.status_code == 404

    def test_load_and_update(self, scrubber_virtual_server, mgmt_root):
        v1 = scrubber_virtual_server
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-virtual-server/fake_virtual_server_profile'
        assert v1.name == 'fake_virtual_server_profile'
        assert v1.selfLink.startswith(URI)
        v1.advertisementMethod = 'bgp-flowspec-method'
        v1.update()
        assert v1.advertisementMethod == 'bgp-flowspec-method'
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        vs_lst = p1.scrubber_virtual_server_s
        v2 = vs_lst.scrubber_virtual_server.load(name='fake_virtual_server_profile')
        assert v1.name == v2.name
        assert v1.selfLink == v2.selfLink
        assert v1.kind == v2.kind
        assert v2.advertisementMethod == 'bgp-flowspec-method'

    def test_scrubber_vs_subcollection(self, scrubber_virtual_server, mgmt_root):
        v1 = scrubber_virtual_server
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-virtual-server/fake_virtual_server_profile'
        assert v1.name == 'fake_virtual_server_profile'
        assert v1.selfLink.startswith(URI)
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        vs_lst = p1.scrubber_virtual_server_s
        vs_col = vs_lst.get_collection()
        assert isinstance(vs_col, list)
        assert len(vs_col)
        assert isinstance(vs_col[0], Scrubber_Virtual_Server)

@pytest.mark.skipif(
    LooseVersion(pytest.config.getoption('--release')) < LooseVersion('13.0.0'),
    reason='This collection is fully implemented on 13.0.0 or greater.'
)
class TestScrubberNPS(object):
    def test_mandatory_attribute_missing(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        nps_lst = p1.scrubber_netflow_protected_server_s
        ERR = "Missing required params"
        with pytest.raises(MissingRequiredCreationParameter) as err:
            nps_lst.scrubber_netflow_protected_server.create(name='botnets')
        assert str(err.value).startswith(ERR)

    def test_create_req_arg(self, scrubber_netflow_protected_server):
        nps1 = scrubber_netflow_protected_server
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-netflow-protected-server/fake_netflow_protected_server_profile'
        assert nps1.name == 'fake_netflow_protected_server_profile'
        assert nps1.selfLink.startswith(URI)

    def test_create_optional_args(self, mgmt_root, netflow_protected_server):
        nps = netflow_protected_server
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        nps_lst = p1.scrubber_netflow_protected_server_s
        params_set = {'name': 'fake_netflow_protected_server_profile', 'npsName': nps.fullPath, 'nextHop': '1.1.1.1',
                      'advertisementMethod': 'bgp-flowspec-method'}
        nps1 = nps_lst.scrubber_netflow_protected_server.create(**params_set)
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-netflow-protected-server/fake_netflow_protected_server_profile'
        assert nps1.name == 'fake_netflow_protected_server_profile'
        assert nps1.selfLink.startswith(URI)
        assert nps1.advertisementMethod == 'bgp-flowspec-method'
        nps1.delete()

    def test_refresh(self, scrubber_netflow_protected_server, mgmt_root):
        nps1 = scrubber_netflow_protected_server
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        nps_lst = p1.scrubber_netflow_protected_server_s
        c2 = nps_lst.scrubber_netflow_protected_server.load(name='fake_netflow_protected_server_profile')
        assert nps1.name == c2.name
        assert nps1.selfLink == c2.selfLink
        assert nps1.kind == c2.kind
        c2.modify(advertisementMethod='bgp-flowspec-method')
        assert c2.advertisementMethod == 'bgp-flowspec-method'
        nps1.refresh()
        assert nps1.advertisementMethod == 'bgp-flowspec-method'

    def test_delete(self, mgmt_root, netflow_protected_server):
        nps = netflow_protected_server
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        nps_lst = p1.scrubber_netflow_protected_server_s
        params_set = {'name': 'fake_netflow_protected_server_profile', 'npsName': nps.fullPath, 'nextHop': '1.1.1.1',
                      'advertisementMethod': 'bgp-flowspec-method'}
        nps1 = nps_lst.scrubber_netflow_protected_server.create(**params_set)
        nps1.delete()
        with pytest.raises(HTTPError) as err:
            nps_lst.scrubber_netflow_protected_server.load(name='fake_netflow_protected_server_profile')
        assert err.value.response.status_code == 404

    def test_load_no_object(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        nps_lst = p1.scrubber_netflow_protected_server_s
        with pytest.raises(HTTPError) as err:
            nps_lst.scrubber_netflow_protected_server.load(name='fake_netflow_protected_server_profile')
        assert err.value.response.status_code == 404

    def test_load_and_update(self, scrubber_netflow_protected_server, mgmt_root):
        nps1 = scrubber_netflow_protected_server
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-netflow-protected-server/fake_netflow_protected_server_profile'
        assert nps1.name == 'fake_netflow_protected_server_profile'
        assert nps1.selfLink.startswith(URI)
        nps1.advertisementMethod = 'bgp-flowspec-method'
        nps1.update()
        assert nps1.advertisementMethod == 'bgp-flowspec-method'
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        nps_lst = p1.scrubber_netflow_protected_server_s
        c2 = nps_lst.scrubber_netflow_protected_server.load(name='fake_netflow_protected_server_profile')
        assert nps1.name == c2.name
        assert nps1.selfLink == c2.selfLink
        assert nps1.kind == c2.kind
        assert c2.advertisementMethod == 'bgp-flowspec-method'

    def test_scrubber_netflow_protected_server_subcollection(self, scrubber_netflow_protected_server, mgmt_root):
        nps1 = scrubber_netflow_protected_server
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-netflow-protected-server/fake_netflow_protected_server_profile'
        assert nps1.name == 'fake_netflow_protected_server_profile'
        assert nps1.selfLink.startswith(URI)
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        nps_lst = p1.scrubber_netflow_protected_server_s
        nps_col = nps_lst.get_collection()
        assert isinstance(nps_col, list)
        assert len(nps_col)
        assert isinstance(nps_col[0], Scrubber_Netflow_Protected_Server)

@pytest.mark.skipif(
    LooseVersion(pytest.config.getoption('--release')) < LooseVersion('13.0.0'),
    reason='This collection is fully implemented on 13.0.0 or greater.'
)
class TestScrubberRtDomain(object):
    def test_mandatory_attribute_missing(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        ERR = "Missing required params"
        with pytest.raises(MissingRequiredCreationParameter) as err:
            rd_lst.scrubber_rt_domain.create(name='fake_rt_domain_profile')
        assert str(err.value).startswith(ERR)

    def test_create_req_arg(self, scrubber_rt_domain):
        rd1 = scrubber_rt_domain
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-rt-domain/fake_rt_domain_profile'
        assert rd1.name == 'fake_rt_domain_profile'
        assert rd1.selfLink.startswith(URI)

    def test_create_optional_args(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        params_set = {'name': 'fake_rt_domain_profile', 'routeDomain': '/Common/0', 'nextHop': '1.1.1.1', 'advertisementMethod': 'bgp-flowspec-method'}
        rd1 = rd_lst.scrubber_rt_domain.create(**params_set)
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-rt-domain/fake_rt_domain_profile'
        assert rd1.name == 'fake_rt_domain_profile'
        assert rd1.selfLink.startswith(URI)
        assert rd1.advertisementMethod == 'bgp-flowspec-method'
        rd1.delete()

    def test_refresh(self, scrubber_rt_domain, mgmt_root):
        rd1 = scrubber_rt_domain
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        rd2 = rd_lst.scrubber_rt_domain.load(name='fake_rt_domain_profile')
        assert rd1.name == rd2.name
        assert rd1.selfLink == rd2.selfLink
        assert rd1.kind == rd2.kind
        rd2.modify(advertisementMethod='bgp-flowspec-method')
        assert rd2.advertisementMethod == 'bgp-flowspec-method'
        rd1.refresh()
        assert rd1.advertisementMethod == 'bgp-flowspec-method'

    def test_delete(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        params_set = {'name': 'fake_rt_domain_profile', 'routeDomain': '/Common/0', 'nextHop': '1.1.1.1', 'advertisementMethod': 'bgp-flowspec-method'}
        rd1 = rd_lst.scrubber_rt_domain.create(**params_set)
        rd1.delete()
        with pytest.raises(HTTPError) as err:
            rd_lst.scrubber_rt_domain.load(name='fake_rt_domain_profile')
        assert err.value.response.status_code == 404

    def test_load_no_object(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        with pytest.raises(HTTPError) as err:
            rd_lst.scrubber_rt_domain.load(name='fake_rt_domain_profile')
        assert err.value.response.status_code == 404

    def test_load_and_update(self, scrubber_rt_domain, mgmt_root):
        rd1 = scrubber_rt_domain
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-rt-domain/fake_rt_domain_profile'
        assert rd1.name == 'fake_rt_domain_profile'
        assert rd1.selfLink.startswith(URI)
        rd1.advertisementMethod = 'bgp-flowspec-method'
        rd1.update()
        assert rd1.advertisementMethod == 'bgp-flowspec-method'
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        rd2 = rd_lst.scrubber_rt_domain.load(name='fake_rt_domain_profile')
        assert rd1.name == rd2.name
        assert rd1.selfLink == rd2.selfLink
        assert rd1.kind == rd2.kind
        assert rd2.advertisementMethod == 'bgp-flowspec-method'

    def test_scrubber_rt_domain_subcollection(self, scrubber_rt_domain, mgmt_root):
        rd1 = scrubber_rt_domain
        URI = 'https://localhost/mgmt/tm/security/' \
            'scrubber/profile/~Common~scrubber-profile-default/scrubber-rt-domain/fake_rt_domain_profile'
        assert rd1.name == 'fake_rt_domain_profile'
        assert rd1.selfLink.startswith(URI)
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        rd_col = rd_lst.get_collection()
        assert isinstance(rd_col, list)
        assert len(rd_col)
        assert isinstance(rd_col[0], Scrubber_Rt_Domain)

@pytest.mark.skipif(
    LooseVersion(pytest.config.getoption('--release')) < LooseVersion('13.0.0'),
    reason='This collection is fully implemented on 13.0.0 or greater.'
)
class TestScrubberRdNetworkPrefix(object):
    def test_mandatory_attribute_missing(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        params_set = {'name': 'fake_rt_domain_profile', 'routeDomain': '/Common/0', 'nextHop': '1.1.1.1'}
        rd1 = rd_lst.scrubber_rt_domain.create(**params_set)
        rd_net_lst = rd1.scrubber_rd_network_prefix_s
        ERR = "Missing required params"
        with pytest.raises(MissingRequiredCreationParameter) as err:
            rd_net_lst.scrubber_rd_network_prefix.create(name='fake_rd_network_prefix_profile')
        assert str(err.value).startswith(ERR)
        rd1.delete()

    def test_create_req_arg(self, scrubber_rd_network_prefix):
        rd_net1 = scrubber_rd_network_prefix
        URI = 'https://localhost/mgmt/tm/security/scrubber/profile/' \
              '~Common~scrubber-profile-default/scrubber-rt-domain/fake_rt_domain_profile/scrubber-rd-network-prefix/fake_rd_network_prefix_profile'
        assert rd_net1.name == 'fake_rd_network_prefix_profile'
        assert rd_net1.selfLink.startswith(URI)

    def test_refresh(self, scrubber_rd_network_prefix, mgmt_root):
        rd_net1 = scrubber_rd_network_prefix
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        rd1 = rd_lst.scrubber_rt_domain.load(name='fake_rt_domain_profile')
        rd_net_lst = rd1.scrubber_rd_network_prefix_s
        rd_net2 = rd_net_lst.scrubber_rd_network_prefix.load(name='fake_rd_network_prefix_profile')
        assert rd_net1.name == rd_net2.name
        assert rd_net1.selfLink == rd_net2.selfLink
        assert rd_net1.kind == rd_net2.kind
        rd_net2.modify(nextHop='3.3.3.3')
        assert rd_net2.nextHop == '3.3.3.3'
        rd_net1.refresh()
        assert rd_net1.nextHop == '3.3.3.3'

    def test_delete(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        params_set = {'name': 'fake_rt_domain_profile', 'routeDomain': '/Common/0', 'nextHop': '1.1.1.1'}
        rd1 = rd_lst.scrubber_rt_domain.create(**params_set)
        rd_net_lst = rd1.scrubber_rd_network_prefix_s
        net_params_set = {'name': 'fake_rd_network_prefix_profile', 'dstIp': '1.1.1.0', 'mask': '24', 'nextHop': '2.2.2.2'}
        rd_net1 = rd_net_lst.scrubber_rd_network_prefix.create(**net_params_set)
        rd_net1.delete()
        with pytest.raises(HTTPError) as err:
            rd_net_lst.scrubber_rd_network_prefix.load(name='fake_rd_network_prefix_profile')
        assert err.value.response.status_code == 404
        rd1.delete()

    def test_load_no_object(self, mgmt_root):
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        params_set = {'name': 'fake_rt_domain_profile', 'routeDomain': '/Common/0', 'nextHop': '1.1.1.1'}
        rd1 = rd_lst.scrubber_rt_domain.create(**params_set)
        rd_net_lst = rd1.scrubber_rd_network_prefix_s
        with pytest.raises(HTTPError) as err:
            rd_net_lst.scrubber_rd_network_prefix.load(name='fake_rd_network_prefix_profile')
        assert err.value.response.status_code == 404
        rd1.delete()

    def test_load_and_update(self, scrubber_rd_network_prefix, mgmt_root):
        rd_net1 = scrubber_rd_network_prefix
        URI = 'https://localhost/mgmt/tm/security/scrubber/profile/' \
            '~Common~scrubber-profile-default/scrubber-rt-domain/fake_rt_domain_profile/scrubber-rd-network-prefix/fake_rd_network_prefix_profile'
        assert rd_net1.name == 'fake_rd_network_prefix_profile'
        assert rd_net1.selfLink.startswith(URI)
        rd_net1.nextHop = '3.3.3.3'
        rd_net1.update()
        assert rd_net1.nextHop == '3.3.3.3'
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        rd1 = rd_lst.scrubber_rt_domain.load(name='fake_rt_domain_profile')
        rd_net_lst = rd1.scrubber_rd_network_prefix_s
        rd_net2 = rd_net_lst.scrubber_rd_network_prefix.load(name='fake_rd_network_prefix_profile')
        assert rd_net1.name == rd_net2.name
        assert rd_net1.selfLink == rd_net2.selfLink
        assert rd_net1.kind == rd_net2.kind
        assert rd_net2.nextHop == '3.3.3.3'

    def test_scrubber_rd_network_prefix_subcollection(self, scrubber_rd_network_prefix, mgmt_root):
        rd_net1 = scrubber_rd_network_prefix
        URI = 'https://localhost/mgmt/tm/security/scrubber/profile/' \
            '~Common~scrubber-profile-default/scrubber-rt-domain/fake_rt_domain_profile/scrubber-rd-network-prefix/fake_rd_network_prefix_profile'
        assert rd_net1.name == 'fake_rd_network_prefix_profile'
        assert rd_net1.selfLink.startswith(URI)
        p1 = mgmt_root.tm.security.scrubber.profile_s.profile.load(name='scrubber-profile-default', partition='Common')
        rd_lst = p1.scrubber_rt_domain_s
        rd1 = rd_lst.scrubber_rt_domain.load(name='fake_rt_domain_profile')
        rd_net_lst = rd1.scrubber_rd_network_prefix_s
        rd_net_col = rd_net_lst.get_collection()
        assert isinstance(rd_net_col, list)
        assert len(rd_net_col)
        assert isinstance(rd_net_col[0], Scrubber_Rd_Network_Prefix)


text:
<?php

require_once "phing/Task.php";

/**
 * Saves currently defined properties into a specified file
 *
 * @author Andrei Serdeliuc
 * @extends Task
 * @version   $Id$
 * @package   phing.tasks.ext
 */
class ExportPropertiesTask extends Task
{
    /**
     * Array of project properties
     *
     * (default value: null)
     *
     * @var array
     */
    private $_properties = null;

    /**
     * Target file for saved properties
     *
     * (default value: null)
     *
     * @var string
     */
    private $_targetFile = null;

    /**
     * Exclude properties starting with these prefixes
     *
     * @var array
     */
    private $_disallowedPropertyPrefixes = array(
        'host.',
        'phing.',
        'os.',
        'php.',
        'line.',
        'env.',
        'user.'
    );

    /**
     * setter for _targetFile
     *
     * @param  string $file
     * @throws BuildException
     * @return bool
     */
    public function setTargetFile($file)
    {
        if (!is_dir(dirname($file))) {
            throw new BuildException("Parent directory of target file doesn't exist");
        }

        if (!is_writable(dirname($file)) && (file_exists($file) && !is_writable($file))) {
            throw new BuildException("Target file isn't writable");
        }

        $this->_targetFile = $file;

        return true;
    }

    /**
     * setter for _disallowedPropertyPrefixes
     *
     * @param $prefixes
     * @internal param string $file
     * @return bool
     */
    public function setDisallowedPropertyPrefixes($prefixes)
    {
        $this->_disallowedPropertyPrefixes = explode(",", $prefixes);

        return true;
    }

    public function main()
    {
        // Sets the currently declared properties
        $this->_properties = $this->getProject()->getProperties();

        if (is_array($this->_properties) && !empty($this->_properties) && null !== $this->_targetFile) {
            $propertiesString = '';
            foreach ($this->_properties as $propertyName => $propertyValue) {
                if (!$this->isDisallowedPropery($propertyName)) {
                    $propertiesString .= $propertyName . "=" . $propertyValue . PHP_EOL;
                }
            }

            if (!file_put_contents($this->_targetFile, $propertiesString)) {
                throw new BuildException('Failed writing to ' . $this->_targetFile);
            }
        }
    }

    /**
     * Checks if a property name is disallowed
     *
     * @param  string $propertyName
     * @return bool
     */
    protected function isDisallowedPropery($propertyName)
    {
        foreach ($this->_disallowedPropertyPrefixes as $property) {
            if (substr($propertyName, 0, strlen($property)) == $property) {
                return true;
            }
        }

        return false;
    }
}


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

package org.chromium.chrome.browser.infobar;

import android.graphics.Bitmap;

import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.R;
import org.chromium.components.infobars.ConfirmInfoBar;
import org.chromium.components.infobars.InfoBarControlLayout;
import org.chromium.components.infobars.InfoBarLayout;

import java.util.ArrayList;
import java.util.List;

/**
 * An infobar for assisted credit card filling.
 */
public class AutofillCreditCardFillingInfoBar extends ConfirmInfoBar {
    private final List<CardDetail> mCardDetails = new ArrayList<>();

    /**
     * Creates a new instance of the infobar.
     *
     * @param nativeAutofillCreditCardFillingInfoBar The pointer to the native object for callbacks.
     * @param iconId ID corresponding to the icon that will be shown for the InfoBar.
     * @param iconBitmap Bitmap to use if there is no equivalent Java resource for iconId.
     * @param message Message to display to the user indicating what the InfoBar is for.
     * @param buttonOk String to display on the OK button.
     * @param buttonCancel String to display on the Cancel button.
     */
    private AutofillCreditCardFillingInfoBar(long nativeAutofillCreditCardFillingInfoBar,
            int iconId, Bitmap iconBitmap, String message, String buttonOk, String buttonCancel) {
        super(iconId, R.color.infobar_icon_drawable_color, iconBitmap, message, null, buttonOk,
                buttonCancel);
    }

    /**
     * Creates an infobar for assisted credit card filling.
     *
     * @param nativeAutofillCreditCardFillingInfoBar The pointer to the native object for callbacks.
     * @param iconId ID corresponding to the icon that will be shown for the InfoBar.
     * @param iconBitmap Bitmap to use if there is no equivalent Java resource for iconId.
     * @param message Message to display to the user indicating what the InfoBar is for.
     * @param buttonOk String to display on the OK button.
     * @param buttonCancel String to display on the Cancel button.
     * @return A new instance of the infobar.
     */
    @CalledByNative
    private static AutofillCreditCardFillingInfoBar create(
            long nativeAutofillCreditCardFillingInfoBar, int iconId, Bitmap iconBitmap,
            String message, String buttonOk, String buttonCancel) {
        return new AutofillCreditCardFillingInfoBar(nativeAutofillCreditCardFillingInfoBar, iconId,
                iconBitmap, message, buttonOk, buttonCancel);
    }

    /**
     * Adds information to the infobar about the credit card that will be proposed for the assist.
     *
     * @param iconId ID corresponding to the icon that will be shown for this credit card.
     * @param label The credit card label, for example "***1234".
     * @param subLabel The credit card sub-label, for example "Exp: 06/17".
     */
    @CalledByNative
    private void addDetail(int iconId, String label, String subLabel) {
        mCardDetails.add(new CardDetail(iconId, label, subLabel));
    }

    @Override
    public void createContent(InfoBarLayout layout) {
        super.createContent(layout);
        InfoBarControlLayout control = layout.addControlLayout();
        for (int i = 0; i < mCardDetails.size(); i++) {
            CardDetail detail = mCardDetails.get(i);
            control.addIcon(detail.issuerIconDrawableId, 0, detail.label, detail.subLabel);
        }
    }
}


text:
#include <fstream>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared_object.hpp>
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>

namespace logging = boost::log;
namespace src = boost::log::sources;
namespace expr = boost::log::expressions;
namespace sinks = boost::log::sinks;
namespace keywords = boost::log::keywords;

//[ example_tutorial_formatters_format
void init()
{
    typedef sinks::synchronous_sink< sinks::text_ostream_backend > text_sink;
    boost::shared_ptr< text_sink > sink = boost::make_shared< text_sink >();

    sink->locked_backend()->add_stream(
        boost::make_shared< std::ofstream >("sample.log"));

    // This makes the sink to write log records that look like this:
    // 1: <normal> A normal severity message
    // 2: <error> An error severity message
    sink->set_formatter
    (
        expr::format("%1%: <%2%> %3%")
            % expr::attr< unsigned int >("LineID")
            % logging::trivial::severity
            % expr::smessage
    );

    logging::core::get()->add_sink(sink);
}
//]

int main(int, char*[])
{
    init();
    logging::add_common_attributes();

    using namespace logging::trivial;
    src::severity_logger< severity_level > lg;

    BOOST_LOG_SEV(lg, trace) << "A trace severity message";
    BOOST_LOG_SEV(lg, debug) << "A debug severity message";
    BOOST_LOG_SEV(lg, info) << "An informational severity message";
    BOOST_LOG_SEV(lg, warning) << "A warning severity message";
    BOOST_LOG_SEV(lg, error) << "An error severity message";
    BOOST_LOG_SEV(lg, fatal) << "A fatal severity message";

    return 0;
}


text:
layout: page
title: Wise 50th Anniversary
date: 2016-05-24
author: Kimberly Sawyer
tags: weekly links, java
status: published
summary: Ut ornare commodo faucibus. Vivamus eu.
banner: images/banner/leisure-02.jpg
booking:
  startDate: 02/02/2018
  endDate: 02/03/2018
  ctyhocn: ASTORHX
  groupCode: W5A
published: true
---
Duis finibus commodo quam pharetra vulputate. Etiam lacinia accumsan vulputate. Nullam iaculis tempus arcu id maximus. Nunc eget arcu consectetur, dictum enim in, gravida ipsum. Morbi fermentum vulputate tellus eget vulputate. Phasellus lobortis euismod lectus eu hendrerit. In interdum neque non velit iaculis tristique. Quisque mattis orci eget magna eleifend, eu lobortis nisl tempus. Etiam finibus purus nibh, semper viverra est bibendum sed. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla massa lorem, pretium id mattis volutpat, consectetur sit amet lectus. Etiam scelerisque, ante in cursus pharetra, dolor lectus lobortis lacus, vitae semper nibh metus ut ex. Quisque at metus ac orci molestie varius. Ut vel lectus sed est rhoncus blandit et vel tellus. Suspendisse auctor auctor dapibus. Quisque et ligula enim.
In porta tincidunt vehicula. Mauris id lobortis nulla. Nullam eu rhoncus lacus. Pellentesque eleifend dapibus congue. Donec vitae nibh eu risus volutpat lobortis non nec enim. Sed turpis ex, volutpat at odio vitae, volutpat pharetra sem. Curabitur vitae hendrerit diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at blandit nunc.

* Integer ac mauris fringilla, tristique ex id, pellentesque nibh
* Pellentesque rhoncus ante vitae gravida molestie
* Curabitur quis lorem pellentesque, volutpat dui quis, condimentum ligula.

Nullam purus lacus, placerat vitae molestie eu, sagittis quis velit. Praesent vitae justo a quam pharetra pretium a vel quam. Vivamus in orci nec lectus vulputate venenatis. Morbi et est id magna porttitor porttitor vel at magna. Sed tempus odio id tellus suscipit facilisis. Fusce lacinia odio a convallis fermentum. Sed ipsum nunc, placerat nec gravida eu, pellentesque eget felis. Sed finibus rhoncus est, vel iaculis lacus mollis vel. Mauris in purus sed quam molestie sollicitudin non a elit.


text:
from manila.api import common

class ViewBuilder(common.ViewBuilder):
    """Model a server API response as a python dictionary."""

    _collection_name = 'share_instances'

    def detail_list(self, request, instances):
        """Detailed view of a list of share instances."""
        return self._list_view(self.detail, request, instances)

    def detail(self, request, share_instance):
        """Detailed view of a single share instance."""
        export_locations = [e['path'] for e in share_instance.export_locations]

        instance_dict = {
            'id': share_instance.get('id'),
            'share_id': share_instance.get('share_id'),
            'availability_zone': share_instance.get('availability_zone'),
            'created_at': share_instance.get('created_at'),
            'host': share_instance.get('host'),
            'status': share_instance.get('status'),
            'share_network_id': share_instance.get('share_network_id'),
            'share_server_id': share_instance.get('share_server_id'),
            'export_location': share_instance.get('export_location'),
            'export_locations': export_locations,
        }

        return {'share_instance': instance_dict}

    def _list_view(self, func, request, instances):
        """Provide a view for a list of share instances."""
        instances_list = [func(request, instance)['share_instance']
                          for instance in instances]
        instances_links = self._get_collection_links(request,
                                                     instances,
                                                     self._collection_name)
        instances_dict = {self._collection_name: instances_list}

        if instances_links:
            instances_dict[self._collection_name] = instances_links

        return instances_dict


text:
package org.apache.cassandra.utils;

import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;

/**
 * Concurrent rate computation over a sliding time window.
 *
 * Currently not used in the Cassandra 4.0 code base. If you decide to use it, please check CASSANDRA-16713.
 * There still might be a bug, flaky test to be fixed before using it again.
 */
public class SlidingTimeRate
{
    private final ConcurrentSkipListMap<Long, AtomicInteger> counters = new ConcurrentSkipListMap<>();
    private final AtomicLong lastCounterTimestamp = new AtomicLong(0);
    private final ReadWriteLock pruneLock = new ReentrantReadWriteLock();
    private final long sizeInMillis;
    private final long precisionInMillis;
    private final TimeSource timeSource;

    /**
     * Creates a sliding rate whose time window is of the given size, with the given precision and time unit.
     * <p>
     * The precision defines how accurate the rate computation is, as it will be computed over window size +/-
     * precision.
     * </p>
     */
    public SlidingTimeRate(TimeSource timeSource, long size, long precision, TimeUnit unit)
    {
        Preconditions.checkArgument(size > precision, "Size should be greater than precision.");
        Preconditions.checkArgument(TimeUnit.MILLISECONDS.convert(precision, unit) >= 1, "Precision must be greater than or equal to 1 millisecond.");
        this.sizeInMillis = TimeUnit.MILLISECONDS.convert(size, unit);
        this.precisionInMillis = TimeUnit.MILLISECONDS.convert(precision, unit);
        this.timeSource = timeSource;
    }

    /**
     * Updates the rate.
     */
    public void update(int delta)
    {
        pruneLock.readLock().lock();
        try
        {
            while (true)
            {
                long now = timeSource.currentTimeMillis();
                long lastTimestamp = lastCounterTimestamp.get();
                boolean isWithinPrecisionRange = (now - lastTimestamp) < precisionInMillis;
                AtomicInteger lastCounter = counters.get(lastTimestamp);
                // If there's a valid counter for the current last timestamp, and we're in the precision range,
                // update such counter:
                if (lastCounter != null && isWithinPrecisionRange)
                {
                    lastCounter.addAndGet(delta);

                    break;
                }
                // Else if there's no counter or we're past the precision range, try to create a new counter,
                // but only the thread updating the last timestamp will create a new counter:
                else if (lastCounterTimestamp.compareAndSet(lastTimestamp, now))
                {
                    AtomicInteger existing = counters.putIfAbsent(now, new AtomicInteger(delta));
                    if (existing != null)
                    {
                        existing.addAndGet(delta);
                    }

                    break;
                }
            }
        }
        finally
        {
            pruneLock.readLock().unlock();
        }
    }

    /**
     * Gets the current rate in the given time unit from the beginning of the time window to the
     * provided point in time ago.
     */
    public double get(long toAgo, TimeUnit unit)
    {
        pruneLock.readLock().lock();
        try
        {
            long toAgoInMillis = TimeUnit.MILLISECONDS.convert(toAgo, unit);
            Preconditions.checkArgument(toAgoInMillis < sizeInMillis, "Cannot get rate in the past!");

            long now = timeSource.currentTimeMillis();
            long sum = 0;
            ConcurrentNavigableMap<Long, AtomicInteger> tailCounters = counters
                    .tailMap(now - sizeInMillis, true)
                    .headMap(now - toAgoInMillis, true);
            for (AtomicInteger i : tailCounters.values())
            {
                sum += i.get();
            }

            double rateInMillis = sum == 0
                                  ? sum
                                  : sum / (double) Math.max(1000, (now - toAgoInMillis) - tailCounters.firstKey());
            double multiplier = TimeUnit.MILLISECONDS.convert(1, unit);
            return rateInMillis * multiplier;
        }
        finally
        {
            pruneLock.readLock().unlock();
        }
    }

    /**
     * Gets the current rate in the given time unit.
     */
    public double get(TimeUnit unit)
    {
        return get(0, unit);
    }

    /**
     * Prunes the time window of old unused updates.
     */
    public void prune()
    {
        pruneLock.writeLock().lock();
        try
        {
            long now = timeSource.currentTimeMillis();
            counters.headMap(now - sizeInMillis, false).clear();
        }
        finally
        {
            pruneLock.writeLock().unlock();
        }
    }

    @VisibleForTesting
    public int size()
    {
        return counters.values().stream().reduce(new AtomicInteger(), (v1, v2) -> {
            v1.addAndGet(v2.get());
            return v1;
        }).get();
    }
}


text:
"use strict";

const assert  = require("chai").assert;
const co      = require("co");
const fs      = require("fs-promise");
const path    = require("path");

const GitUtilFast         = require("../../lib/util/git_util_fast");
const TestUtil            = require("../../lib/util/test_util");

describe("GitUtilFast", function () {
    describe("getRootGitDirectory", function () {
        let cwd;
        before(function () {
            cwd = process.cwd();
        });
        after(function () {
            process.chdir(cwd);
        });

        // This method is recursive, so we will check just three cases:
        // - failure case
        // - simple case
        // - one deep

        it("failure", co.wrap(function *() {
            const tempdir = yield TestUtil.makeTempDir();
            process.chdir(tempdir);
            const result = GitUtilFast.getRootGitDirectory();
            assert.isNull(result);
        }));

        it("successes", co.wrap(function *() {
            const repo = yield TestUtil.createSimpleRepository();
            const workdir = repo.workdir();
            process.chdir(workdir);
            const repoRoot = GitUtilFast.getRootGitDirectory(workdir);
            assert(yield TestUtil.isSameRealPath(workdir, repoRoot),
                   "trivial");
            const subdir = path.join(workdir, "sub");
            yield fs.mkdir(subdir);
            process.chdir(subdir);
            const subRoot = GitUtilFast.getRootGitDirectory(workdir);
            assert(yield TestUtil.isSameRealPath(workdir, subRoot), "trivial");
        }));
        it("with a non-submodule link", co.wrap(function *() {
            const tempdir = yield TestUtil.makeTempDir();
            process.chdir(tempdir);
            const gitLink = path.join(tempdir, ".git");
            yield fs.writeFile(gitLink, "gitdir: /foo/bar");
            const result = GitUtilFast.getRootGitDirectory();
            assert.isNotNull(result);
            assert(yield TestUtil.isSameRealPath(tempdir, result), result);
        }));
    });
});


text:
package iurii.job.interview.cracking;

import java.util.Arrays;

/**
 * Arrays and Strings
 */
public class CrackingCodingInterview1 {

    /**
     * 1.1 Are all characters in String unique. O(n^2). space O(0).
     */
    public static boolean isUnique(String s) {
        for (int i = 0; i < s.length(); i++) {
            for (int j = i + 1; j < s.length(); j++) {
                if (s.charAt(i) == s.charAt(j)) {
                    return false;
                }
            }
        }
        return true;
    }

    /**
     * 1.1 Are all characters in String unique. O(n). space O(n)
     */
    public static boolean isUnique2(String s) {
        boolean[] isInString = new boolean[256];
        for (int i = 0; i < s.length(); i++) {
            if (isInString[s.charAt(i)]) {
                return false;
            } else {
                isInString[s.charAt(i)] = true;
            }
        }
        return true;
    }

    // 1.2 is C++ style question about reverse String. O(n). space O(n). We cannot save space in java.

    /**
     * 1.2 Reverse String.
     */
    public static String reverseString(String s) {
        StringBuilder result = new StringBuilder();
        for (int i = s.length() - 1; i >= 0; i--) {
            result.append(String.valueOf(s.charAt(i)));
        }
        return result.toString();
    }

    /**
     * 1.3 Remove duplicate characters from String. O(n) with additional memory of constant size.
     * Ask if array of constant size is Ok.
     */
    public static char[] removeDuplicates(char[] string) {
        if (string == null) {
            return null;
        }
        int index = 0;
        boolean[] hit = new boolean[256];
        for (int i = 0; i < string.length; i++) {
            if (!hit[string[i]]) {
                hit[string[i]] = true;
                string[index++] = string[i];
            }
        }
        for (int i = index; i < string.length; i++) {
            string[i] = ' ';
        }
        return string;
    }

    /**
     * 1.3 Remove duplicate characters from String. O(n^2) without additional memory.
     * Ask if array of constant size is Ok.
     */
    public static char[] removeDuplicates2(char[] string) {
        if (string == null) {
            return null;
        }
        int index = 0;
        for (int i = 0; i < string.length; i++) {
            boolean isUnique = true;
            for (int j = 0; j < i; j++) {
                if (string[j] == string[i]) {
                    isUnique = false;
                    break;
                }
            }
            if (isUnique) {
                string[index++] = string[i];
            }
        }
        for (int i = index; i < string.length; i++) {
            string[i] = ' ';
        }
        return string;
    }

    /**
     * 1.4 If two strings are anagrams. Use sorting. O(n*log(n)) time
     */
    public static boolean areAnagrams(String s1, String s2) {
        if (s1 == null || s2 == null || s1.length() != s2.length()) {
            return false;
        }
        char[] s1CharArray = s1.toCharArray();
        Arrays.sort(s1CharArray);
        String sortedS1 = new String(s1CharArray);

        char[] s2CharArray = s2.toCharArray();
        Arrays.sort(s2CharArray);
        String sortedS2 = new String(s2CharArray);

        return sortedS1.equals(sortedS2);
    }

    /**
     * 1.4.1 If string is palindrome. Recursion
     */
    public static boolean isPalindrome(String s1) {
        if (s1 == null || s1.length() < 2) {
            return true;
        }
        int firstIndex = 0;
        int lastIndex = s1.length() - 1;

        return s1.charAt(firstIndex) == s1.charAt(lastIndex)
                && isPalindrome(s1.substring(firstIndex + 1, lastIndex));
    }

    /**
     * 1.4 If two strings are anagrams. O(n) time. array of constant size.
     */
    public static boolean areAnagrams2(String s1, String s2) {
        if (s1 == null || s2 == null || s1.length() != s2.length()) {
            return false;
        }
        int[] characterCount = new int[256];
        for (int i = 0; i < s1.length(); i++) {
            characterCount[s1.charAt(i)]++;
        }
        for (int i = 0; i < s2.length(); i++) {
            characterCount[s2.charAt(i)]--;
            if (characterCount[s2.charAt(i)] < 0) {
                return false;
            }
        }
        return true;
    }

    /**
     * 1.5 Replace spaces with %20. O(n) time algorithm. First of all count spaces and new length.
     */
    public static char[] replaceSpaces(char[] string) {
        int spacesCount = 0;
        for (int i = 0; i < string.length; i++) {
            if (string[i] == ' ') {
                spacesCount++;
            }
        }
        int newSize = string.length + 2 * spacesCount;
        char[] newString = new char[newSize];
        int index = 0;
        for (char character : string) {
            if (character == ' ') {
                newString[index++] = '%';
                newString[index++] = '2';
                newString[index++] = '0';
            } else {
                newString[index++] = character;
            }
        }
        return newString;
    }

    /**
     * 1.6 Rotate NxN matrix on 90 degrees. For rotation making 4 exchanges
     */
    public static void rotateMatrix(int[][] matrix) {
        for (int i = 0; i < matrix.length / 2; i++) {
            int iterNumber = matrix.length - 2 * i - 1;
            for (int j = 0; j < iterNumber; j++) {
                int buffer = matrix[matrix.length - i - j - 1][i];
                matrix[matrix.length - i - j - 1][i] = matrix[i][i + j];
                matrix[i][i + j] = matrix[i + j][matrix.length - i - 1];
                matrix[i + j][matrix.length - i - 1] = matrix[matrix.length - i - 1][matrix.length - i - j - 1];
                matrix[matrix.length - i - 1][matrix.length - i - j - 1] = buffer;
            }
        }
    }

    /**
     * 1.7 Set row and column of matrix into 0 if it contains 0
     */
    public static void setZeros(int[][] matrix) {
        boolean[] isRowZero = new boolean[matrix.length];
        boolean[] isColumnZero = new boolean[matrix[0].length];
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[0].length; j++) {
                if (matrix[i][j] == 0) {
                    isRowZero[i] = true;
                    isColumnZero[j] = true;
                }
            }
        }
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[0].length; j++) {
                if (isRowZero[i] || isColumnZero[j]) {
                    matrix[i][j] = 0;
                }
            }
        }
    }

    /**
     * 1.8 Using only one call to SubString check if rotation is a rotation of s
     */
    public static boolean isRotation(String s, String rotation) {
        return s != null && rotation != null && s.length() == rotation.length() && (rotation + rotation).contains(s);
    }
}


text:
using System;
using System.Reflection;

namespace Xunit
{
    static class ExceptionExtensions
    {
        public static Exception Unwrap(this Exception ex)
        {
            while (true)
            {
                if (ex is AggregateException aex)
                    ex = aex.GetBaseException();

                if (ex is not TargetInvocationException tiex)
                    return ex;

                ex = tiex.InnerException;
            }
        }
    }
}


text:
package org.apache.rocketmq.redis.test.pojo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.openmessaging.connector.api.data.DataEntry;
import io.openmessaging.connector.api.data.EntryType;
import io.openmessaging.connector.api.data.FieldType;
import io.openmessaging.connector.api.data.SourceDataEntry;
import org.apache.rocketmq.connect.redis.common.Options;
import org.apache.rocketmq.connect.redis.converter.KVEntryConverter;
import org.apache.rocketmq.connect.redis.converter.RedisEntryConverter;
import org.apache.rocketmq.connect.redis.pojo.KVEntry;
import org.apache.rocketmq.connect.redis.pojo.RedisEntry;
import org.junit.Assert;
import org.junit.Test;

public class KVEntryTest {

    @Test
    public void testConstruct(){
        KVEntry entry = new RedisEntry(FieldType.STRING);
        entry.value("value");
        Assert.assertEquals(String.class, entry.getValue().getClass());

        entry = new RedisEntry("partition", FieldType.ARRAY);
        entry.value(new ArrayList<>());
        Assert.assertEquals(ArrayList.class, entry.getValue().getClass());
        Assert.assertEquals("partition", entry.getPartition());

        entry = RedisEntry.newEntry(FieldType.MAP);
        entry.value(new HashMap());
        Assert.assertEquals(HashMap.class, entry.getValue().getClass());
        entry = RedisEntry.newEntry("partition", FieldType.INT64);

        entry.value(123L);
        Assert.assertEquals(Long.class, entry.getValue().getClass());

        Assert.assertTrue(123L == (long)entry.getValue());
        Assert.assertEquals("partition", entry.getPartition());
        Assert.assertNotNull(entry.toString());

        List<SourceDataEntry> entries = getConverter().kVEntryToDataEntries(entry);
        Assert.assertNotNull(entries);
    }

    @Test
    public void test(){
        RedisEntry entry = RedisEntry.newEntry(FieldType.STRING);
        entry.partition("partition");
        entry.queueName("queue1");
        entry.entryType(EntryType.UPDATE);
        entry.sourceId("replId");
        entry.offset(65535L);
        entry.command("set");
        entry.key("key");
        entry.valueType(FieldType.STRING);
        entry.value("value");
        entry.param(Options.REDIS_INCREMENT, 15L);

        Assert.assertEquals("partition", entry.getPartition());
        Assert.assertEquals("queue1", entry.getQueueName());
        Assert.assertEquals(EntryType.UPDATE, entry.getEntryType());
        Assert.assertEquals("replId", entry.getSourceId());
        Assert.assertEquals(65535L, (long)entry.getOffset());
        Assert.assertEquals("set", entry.getCommand());
        Assert.assertEquals("key", entry.getKey());
        Assert.assertEquals(FieldType.STRING, entry.getValueType());
        Assert.assertEquals("value", entry.getValue());
        Assert.assertEquals(15L, (long)entry.getParam(Options.REDIS_INCREMENT));
        Assert.assertEquals(15L, (long)entry.getParams().get(Options.REDIS_INCREMENT.name()));
    }

    private KVEntryConverter getConverter(){
        return new RedisEntryConverter();
    }
}


text:
package org.conqat.engine.blocklib.trends;

import org.conqat.engine.commons.util.ConQATInputProcessorBase;
import org.conqat.engine.core.core.AConQATProcessor;

/**
 * {@ConQAT.Doc}
 *
 * @author $Author: kinnen $
 * @version $Rev: 41751 $
 * @ConQAT.Rating GREEN Hash: 83165014AC8BD8536E229BE972BA2017
 */
@AConQATProcessor(description = "Extracts the log scale flag from the trend info.")
public class TrendInfoLogScale extends ConQATInputProcessorBase<TrendInfo> {

	/** {@inheritDoc} */
	@Override
	public Boolean process() {
		return input.isLogScaled();
	}
}


text:
/* Created on: Apr 12, 2016
 *     Author: T.Delame (tdelame@gmail.com)
 */
# include "../median-path/regularization.h"
# include <graphics-origin/geometry/box.h>
# define CGAL_LINKED_WITH_TBB
# include <tbb/task_scheduler_init.h>
# include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
# include <CGAL/Triangulation_vertex_base_with_info_3.h>
# include <CGAL/Regular_triangulation_euclidean_traits_3.h>
# include <CGAL/Regular_triangulation_3.h>

BEGIN_MP_NAMESPACE

  typedef CGAL::Epick rt_kernel;
  typedef CGAL::Regular_triangulation_euclidean_traits_3< rt_kernel > rt_traits;
  typedef CGAL::Triangulation_vertex_base_with_info_3< median_skeleton::atom_index, rt_traits > rt_vertex_base;
  typedef CGAL::Triangulation_cell_base_3< rt_traits > rt_cell_base;
  typedef CGAL::Triangulation_data_structure_3< rt_vertex_base, rt_cell_base, CGAL::Parallel_tag > rt_datastructure;
  typedef CGAL::Regular_triangulation_3< rt_traits, rt_datastructure > rt;

  void scale_regularizer(
      median_skeleton& skeleton,
      real scale )
  {
    tbb::task_scheduler_init init;
    const auto natoms = skeleton.get_number_of_atoms();

    std::vector< rt::Weighted_point > wpoints( natoms );
    std::vector< median_skeleton::atom_index > vinfos( natoms );
    scale *= scale;
    # pragma omp parallel for schedule(static)
    for( median_skeleton::atom_index i = 0; i < natoms; ++ i )
      {
        const auto& atom = skeleton.get_atom_by_index( i );
        wpoints[ i ] = rt::Weighted_point( rt::Bare_point( atom.x, atom.y, atom.z ), scale * atom.w * atom.w );
        vinfos[ i ] = i;
      }

    graphics_origin::geometry::aabox bbox = skeleton.compute_centers_bounding_box();
    bbox.hsides += 1e-6;
    rt::Lock_data_structure locking_datastructure(
        CGAL::Bbox_3(
            bbox.center.x - bbox.hsides.x, bbox.center.y - bbox.hsides.y, bbox.center.z - bbox.hsides.z,
            bbox.center.x + bbox.hsides.x, bbox.center.y + bbox.hsides.y, bbox.center.z + bbox.hsides.z ),
        8);

    rt regular_tetrahedrization(
        boost::make_zip_iterator(boost::make_tuple( wpoints.begin(), vinfos.begin() )),
        boost::make_zip_iterator(boost::make_tuple( wpoints.end()  , vinfos.end()   )),
        &locking_datastructure);

    std::vector< bool > delete_flags( natoms, true );
    for( auto it = regular_tetrahedrization.finite_vertices_begin(),
        end = regular_tetrahedrization.finite_vertices_end(); it != end; ++ it )
      {
        delete_flags[ it->info() ] = false;
      }

    skeleton.remove_atoms( [&skeleton, &delete_flags]( median_skeleton::atom& e )
     {
        return delete_flags[ skeleton.get_index( e ) ];
     }, true );
  }

END_MP_NAMESPACE


text:
<?php
namespace oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2;

/**
 * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2
 * @xmlType MonetaryTotalType
 * @xmlName AnticipatedMonetaryTotal
 * @var oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2\AnticipatedMonetaryTotal
 */
class AnticipatedMonetaryTotal extends MonetaryTotalType
{
} // end class AnticipatedMonetaryTotal


text:
<?php

namespace Zend\Validator\Barcode;

/**
 * @uses       \Zend\Validator\Barcode\AbstractAdapter
 * @category   Zend
 * @package    Zend_Validate
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Codabar extends AbstractAdapter
{
    /**
     * Constructor for this barcode adapter
     *
     * @return void
     */
    public function __construct()
    {
        $this->setLength(-1);
        $this->setCharacters('0123456789-$:/.+ABCDTN*E');
        $this->useChecksum(false);
    }

    /**
     * Checks for allowed characters
     * @see Zend\Validator\Barcode.AbstractAdapter::checkChars()
     */
    public function hasValidCharacters($value)
    {
        $first = $value[0];
        if (strpbrk($value, 'ABCD')) {
            $first = $value[0];
            if (!strpbrk($first, 'ABCD')) {
                // Missing start char
                return false;
            }

            $last = substr($value, -1, 1);
            if (!strpbrk($last, 'ABCD')) {
                // Missing stop char
                return false;
            }

            $value = substr($value, 1, -1);
        } elseif (strpbrk($value, 'TN*E')) {
            $first = $value[0];
            if (!strpbrk($first, 'TN*E')) {
                // Missing start char
                return false;
            }

            $last = substr($value, -1, 1);
            if (!strpbrk($last, 'TN*E')) {
                // Missing stop char
                return false;
            }

            $value = substr($value, 1, -1);
        }

        $chars  = $this->getCharacters();
        $this->setCharacters('0123456789-$:/.+');
        $result = parent::hasValidCharacters($value);
        $this->setCharacters($chars);
        return $result;
    }
}


text:
            <form class="ui form"
                  [ngFormModel]="myForm"
                  (ngSubmit)="submitted=true">

                        请输入4位验证码
                        <input type="text"
                               [ngFormControl]='codeControl'>
                        {{showError(codeControl)}}

                        请输入10-100内的数字
                        <input type="text"
                               [ngFormControl]='numControl'>
                        {{showError(numControl)}}

                        请输入大于100的数字
                        <input type="text"
                               [ngFormControl]='minControl'>
                        {{showError(minControl)}}

                        请输入小于100的数字
                        <input type="text"
                               [ngFormControl]='maxControl'>
                        {{showError(maxControl)}}

                        请输入姓名
                        <input type="text"
                               [ngFormControl]='textControl' >
                        {{showError(textControl)}}

                        邮箱
                        <input type="text"
                               placeholder="请输入邮箱"
                               [ngFormControl]='emailControl'
                        >
                        {{showError(emailControl)}}

                        密码
                        <input type="password"
                               placeholder="请输入密码"
                               [ngFormControl]='passwordControl'
                        >
                        {{showError(passwordControl)}}

                        checkbox验证

                            <input type="checkbox" tabindex="0" class="hidden" id="check1"
                                   [ngFormControl]='mustCheckControl'>
                            是否同意该协议

{{showError(mustCheckControl)}}

                        性别
                        <select class="ui dropdown" name="gender"  [ngFormControl]='selectControl'>
                            <option value="">Gender</option>
                            <option value="male">Male</option>
                            <option value="female">Female</option>
                        </select>
                        {{showError(selectControl)}}

                <button type="submit" class="ui button" [disabled]="!myForm.valid">提交</button>
            </form>

{{ErrorMessage}}

{{getFormData}}


text:
#pragma once

#include "../system.h"

// template_support describtion:
//
// Because many std lib functions might have overhead
// I descided to create some of the most critical functions
// related to templates.
//

namespace Everest
{
	// std::enable_if like
	template<bool Test, class T = void>
	struct EnableIf
	{
		// False case
	};
	template <class T>
	struct EnableIf<true, T>
	{
		typedef T Type;
	};

	// Select type based on condition bool
	template <bool Test, class T1, class T2>
	struct SelectType
	{
		typedef T2 Type;
	};
	template <class T1, class T2>
	struct SelectType<true, T1, T2>
	{
		typedef T1 Type;
	};

	// RemoveReference struct
	template < class T >
	struct RemoveReference
	{
		typedef T type;
	};
	template < class T >
	struct RemoveReference<T&>
	{
		typedef T type;
	};
	template < class T >
	struct RemoveReference<T&&>
	{
		typedef T type;
	};

	// perfect Forward just like std::forward, but with no overhead
	template < class T >
	_INLINE T&&
		Forward(typename RemoveReference<T>::type& arg)
	{
		return (T&&)arg;
	}

	// perfect Forward just like std::forward, but with no overhead
	template < class T >
	_INLINE T&&
		Forward(typename RemoveReference<T>::type&& arg)
	{
		return (T&&)arg;
	}

	// Temp move template function, just like std::move, , but with no overhead
	template < class T >
	_INLINE typename RemoveReference<T>::type&&
		Move(T&& arg)
	{
		return (typename RemoveReference<T>::type&&)arg;
	}

	// Check an integral-type's bit status
	//
	// @param: val - The integral value to check
	// @param: position - bit position in val
	// @return: True if bit is set
	template <typename T>
	_INLINE bool CheckBit(const T& val, int8 position)
	{
		return (val & (1 << position)) != 0;
	}

	// Set a bit in an integral-type
	//
	// @param: val - The integral value
	// @param: position - bit position in val
	// @return: new modified val
	template <typename T>
	_INLINE T SetBit(T& val, int8 position)
	{
		return val | (1 << position);
	}

	// Clear a bit in an integral-type
	//
	// @param: val - The integral value
	// @param: position - bit position in val
	// @return: new modified val
	template <typename T>
	_INLINE T ClearBit(T& val, int8 position)
	{
		return val & ~(1 << position);
	}

	// Toggle a bit in an integral-type
	//
	// @param: val - The integral value
	// @param: position - bit position in val
	// @return: new modified val
	template <typename T>
	_INLINE T ToggleBit(T& val, int8 position)
	{
		return val ^ (1 << position);
	}
}


text:
layout: page
title: Projects
permalink: /projects/
---


text:
// Copyright (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 7.6.1-1-7
description: >
    Allow reserved words as property names at object initialization,
    verified with hasOwnProperty: while, debugger, function
---*/

        var tokenCodes  = {
            while: 0,
            debugger: 1,
            function: 2
        };
        var arr = [
            'while' ,
            'debugger',
            'function'
        ];
        for(var p in tokenCodes) {
            for(var p1 in arr) {
                if(arr[p1] === p) {
                    assert(tokenCodes.hasOwnProperty(arr[p1]), 'tokenCodes.hasOwnProperty(arr[p1]) !== true');
                }
            }
        }


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace BL4N.Data
{
    /// <summary> content for type 5, 6, 7 </summary>
    public interface IWikiActivityContent : IActivityContent
    {
        /// <summary> ID を取得します. </summary>
        long Id { get; }

        /// <summary> ページ名を取得します. </summary>
        string Name { get; }

        /// <summary> 内容を取得します. </summary>
        string Content { get; }

        /// <summary> 差分を取得します. </summary>
        string Diff { get; }

        /// <summary> ヴァージョン文字列を取得します. </summary>
        long Version { get; }

        /// <summary> 添付ファイルの一覧を取得します. </summary>
        IList<IAttachment> Attachments { get; }

        /// <summary> 共有ファイルへの参照の一覧を取得します. </summary>
        IList<ISharedFile> SharedFiles { get; }
    }

    [DataContract]
    internal sealed class WikiActivityContent : IWikiActivityContent
    {
        [DataMember(Name = "id")]
        public long Id { get; private set; }

        [DataMember(Name = "name")]
        public string Name { get; private set; }

        [DataMember(Name = "content")]
        public string Content { get; private set; }

        [DataMember(Name = "diff")]
        public string Diff { get; private set; }

        [DataMember(Name = "version")]
        private long? _version;

        public long Version
        {
            get { return _version ?? 0; }
        }

        [DataMember(Name = "attachments")]
        private List<Attachment> _attachments;

        [IgnoreDataMember]
        public IList<IAttachment> Attachments
        {
            get { return _attachments.ToList<IAttachment>(); }
        }

        [DataMember(Name = "shared_files")]
        private List<SharedFile> _sharedFiles;

        [IgnoreDataMember]
        public IList<ISharedFile> SharedFiles
        {
            get { return _sharedFiles.ToList<ISharedFile>(); }
        }
    }
}


text:
<!DOCTYPE html>

    <title>GWAS Curation Tool</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css"/>

    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.0/select2.min.css"/>

    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.0/select2-bootstrap.min.css"/>

    <link th:href="@{/css/jumbotron.css}" rel="stylesheet"/>
    <link th:href="@{/css/sticky-footer-navbar.css}" rel="stylesheet"/>

    <link rel="stylesheet" th:href="@{/css/goci-curation.css}"/>
    <link rel="stylesheet" th:href="@{/css/icons/flaticon.css}"/>
    <link rel="stylesheet" th:href="@{/css/goci-color-palette-1.css}"/>

Studies

Study Details

                ×
                Success!

            <form id="studyForm" class="form-horizontal" th:object="${study}" name="studyForm">

                    Accession ID

                        <input type="hidden" th:field="*{accessionId}" class="form-control" id="accessionId" />

                    Author

                    Title

                    Publication

                    Publication Date

            </form>

            <input id="id_study-duplications-TOTAL_FORMS" value="1" type="hidden"/>
            <input id="studyId"  th:value="${study.id} ? ${study.id} : ''" type="hidden" />

                                1

                                <input type="text" name="tagtext1" class="form-control studyItemFormInput" />

                                <button type="button" class="btn btn-danger btn-sm remove-study-duplications" ></button>

                        <input id="multi-add-study-duplications" type="text" onkeypress="checkNumbers()" value="1" class="form-control"/>

                        <button id="multi-add-study-duplications-button" type="button" class="btn btn-primary">Add Rows</button>

                        <button id="duplicateStudy" type="button" class="btn btn-primary pull-left"> Duplicate Study</button>


text:
package pb138.service.facades;

import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import pb138.dal.entities.Category;

import javax.transaction.Transactional;
import java.util.List;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Created by Jan on 07.05.2017.
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:META-INF/persistence-config.xml")
@Transactional
public class CategoryFacadeTest extends TestCase {

    @Autowired
    private CategoryFacade categoryFacade;

    @Test
    public void createCorrectly() throws Exception {
        Category c1 = categoryFacade.createOrUpdateCategory("Clothes", "For clothing");
        Category c2 = categoryFacade.createOrUpdateCategory("Cars", "For riding in da hood");
        List<Category> result = categoryFacade.getAllCategories();
        assertThat(result.size(), is(2));
        assertThat(result.contains(c1), is(true));
        assertThat(result.contains(c2), is(true));
        assertThat(result.contains(null), is(false));
    }

    @Test
    public void update() throws Exception {
        Category c1 = categoryFacade.createOrUpdateCategory("Clothes", "For clothing");
        Category c2 = categoryFacade.createOrUpdateCategory("Clothes", "Some other generic description");
        List<Category> result = categoryFacade.getAllCategories();
        assertThat(result.size(), is(1));
        assertEquals(c1,c2);
        assertThat(result.get(0).getDescription(), is("Some other generic description"));

    }

}


text:
:mod:`smtpd` --- SMTP Server
============================

.. module:: smtpd
   :synopsis: A SMTP server implementation in Python.

.. moduleauthor:: Barry Warsaw <barry@python.org>
.. sectionauthor:: Moshe Zadka <moshez@moshez.org>

**Source code:** :source:`Lib/smtpd.py`

--------------

This module offers several classes to implement SMTP (email) servers.

Several server implementations are present; one is a generic
do-nothing implementation, which can be overridden, while the other two offer
specific mail-sending strategies.

Additionally the SMTPChannel may be extended to implement very specific
interaction behaviour with SMTP clients.

The code supports :RFC:`5321`, plus the :rfc:`1870` SIZE and :rfc:`6531`
SMTPUTF8 extensions.

SMTPServer Objects
------------------

.. class:: SMTPServer(localaddr, remoteaddr, data_size_limit=33554432,\
                      map=None, enable_SMTPUTF8=False, decode_data=False)

   Create a new :class:`SMTPServer` object, which binds to local address
   *localaddr*.  It will treat *remoteaddr* as an upstream SMTP relayer.  Both
   *localaddr* and *remoteaddr* should be a :ref:`(host, port) <host_port>`
   tuple.  The object inherits from :class:`asyncore.dispatcher`, and so will
   insert itself into :mod:`asyncore`'s event loop on instantiation.

   *data_size_limit* specifies the maximum number of bytes that will be
   accepted in a ``DATA`` command.  A value of ``None`` or ``0`` means no
   limit.

   *map* is the socket map to use for connections (an initially empty
   dictionary is a suitable value).  If not specified the :mod:`asyncore`
   global socket map is used.

   *enable_SMTPUTF8* determines whether the ``SMTPUTF8`` extension (as defined
   in :RFC:`6531`) should be enabled.  The default is ``False``.
   When ``True``, ``SMTPUTF8`` is accepted as a parameter to the ``MAIL``
   command and when present is passed to :meth:`process_message` in the
   ``kwargs['mail_options']`` list.  *decode_data* and *enable_SMTPUTF8*
   cannot be set to ``True`` at the same time.

   *decode_data* specifies whether the data portion of the SMTP transaction
   should be decoded using UTF-8.  When *decode_data* is ``False`` (the
   default), the server advertises the ``8BITMIME``
   extension (:rfc:`6152`), accepts the ``BODY=8BITMIME`` parameter to
   the ``MAIL`` command, and when present passes it to :meth:`process_message`
   in the ``kwargs['mail_options']`` list. *decode_data* and *enable_SMTPUTF8*
   cannot be set to ``True`` at the same time.

   .. method:: process_message(peer, mailfrom, rcpttos, data, **kwargs)

      Raise a :exc:`NotImplementedError` exception. Override this in subclasses to
      do something useful with this message. Whatever was passed in the
      constructor as *remoteaddr* will be available as the :attr:`_remoteaddr`
      attribute. *peer* is the remote host's address, *mailfrom* is the envelope
      originator, *rcpttos* are the envelope recipients and *data* is a string
      containing the contents of the e-mail (which should be in :rfc:`5321`
      format).

      If the *decode_data* constructor keyword is set to ``True``, the *data*
      argument will be a unicode string.  If it is set to ``False``, it
      will be a bytes object.

      *kwargs* is a dictionary containing additional information. It is empty
      if ``decode_data=True`` was given as an init argument, otherwise
      it contains the following keys:

          *mail_options*:
             a list of all received parameters to the ``MAIL``
             command (the elements are uppercase strings; example:
             ``['BODY=8BITMIME', 'SMTPUTF8']``).

          *rcpt_options*:
             same as *mail_options* but for the ``RCPT`` command.
             Currently no ``RCPT TO`` options are supported, so for now
             this will always be an empty list.

      Implementations of ``process_message`` should use the ``**kwargs``
      signature to accept arbitrary keyword arguments, since future feature
      enhancements may add keys to the kwargs dictionary.

      Return ``None`` to request a normal ``250 Ok`` response; otherwise
      return the desired response string in :RFC:`5321` format.

   .. attribute:: channel_class

      Override this in subclasses to use a custom :class:`SMTPChannel` for
      managing SMTP clients.

   .. versionadded:: 3.4
      The *map* constructor argument.

   .. versionchanged:: 3.5
      *localaddr* and *remoteaddr* may now contain IPv6 addresses.

   .. versionadded:: 3.5
      The *decode_data* and *enable_SMTPUTF8* constructor parameters, and the
      *kwargs* parameter to :meth:`process_message` when *decode_data* is
      ``False``.

   .. versionchanged:: 3.6
      *decode_data* is now ``False`` by default.

DebuggingServer Objects
-----------------------

.. class:: DebuggingServer(localaddr, remoteaddr)

   Create a new debugging server.  Arguments are as per :class:`SMTPServer`.
   Messages will be discarded, and printed on stdout.

PureProxy Objects
-----------------

.. class:: PureProxy(localaddr, remoteaddr)

   Create a new pure proxy server. Arguments are as per :class:`SMTPServer`.
   Everything will be relayed to *remoteaddr*.  Note that running this has a good
   chance to make you into an open relay, so please be careful.

MailmanProxy Objects
--------------------

.. class:: MailmanProxy(localaddr, remoteaddr)

   Create a new pure proxy server. Arguments are as per :class:`SMTPServer`.
   Everything will be relayed to *remoteaddr*, unless local mailman configurations
   knows about an address, in which case it will be handled via mailman.  Note that
   running this has a good chance to make you into an open relay, so please be
   careful.

SMTPChannel Objects
-------------------

.. class:: SMTPChannel(server, conn, addr, data_size_limit=33554432,\
                       map=None, enable_SMTPUTF8=False, decode_data=False)

   Create a new :class:`SMTPChannel` object which manages the communication
   between the server and a single SMTP client.

   *conn* and *addr* are as per the instance variables described below.

   *data_size_limit* specifies the maximum number of bytes that will be
   accepted in a ``DATA`` command.  A value of ``None`` or ``0`` means no
   limit.

   *enable_SMTPUTF8* determines whether the ``SMTPUTF8`` extension (as defined
   in :RFC:`6531`) should be enabled.  The default is ``False``.
   *decode_data* and *enable_SMTPUTF8* cannot be set to ``True`` at the same
   time.

   A dictionary can be specified in *map* to avoid using a global socket map.

   *decode_data* specifies whether the data portion of the SMTP transaction
   should be decoded using UTF-8.  The default is ``False``.
   *decode_data* and *enable_SMTPUTF8* cannot be set to ``True`` at the same
   time.

   To use a custom SMTPChannel implementation you need to override the
   :attr:`SMTPServer.channel_class` of your :class:`SMTPServer`.

   .. versionchanged:: 3.5
      The *decode_data* and *enable_SMTPUTF8* parameters were added.

   .. versionchanged:: 3.6
      *decode_data* is now ``False`` by default.

   The :class:`SMTPChannel` has the following instance variables:

   .. attribute:: smtp_server

      Holds the :class:`SMTPServer` that spawned this channel.

   .. attribute:: conn

      Holds the socket object connecting to the client.

   .. attribute:: addr

      Holds the address of the client, the second value returned by
      :func:`socket.accept <socket.socket.accept>`

   .. attribute:: received_lines

      Holds a list of the line strings (decoded using UTF-8) received from
      the client. The lines have their ``"\r\n"`` line ending translated to
      ``"\n"``.

   .. attribute:: smtp_state

      Holds the current state of the channel. This will be either
      :attr:`COMMAND` initially and then :attr:`DATA` after the client sends
      a "DATA" line.

   .. attribute:: seen_greeting

      Holds a string containing the greeting sent by the client in its "HELO".

   .. attribute:: mailfrom

      Holds a string containing the address identified in the "MAIL FROM:" line
      from the client.

   .. attribute:: rcpttos

      Holds a list of strings containing the addresses identified in the
      "RCPT TO:" lines from the client.

   .. attribute:: received_data

      Holds a string containing all of the data sent by the client during the
      DATA state, up to but not including the terminating ``"\r\n.\r\n"``.

   .. attribute:: fqdn

      Holds the fully-qualified domain name of the server as returned by
      :func:`socket.getfqdn`.

   .. attribute:: peer

      Holds the name of the client peer as returned by ``conn.getpeername()``
      where ``conn`` is :attr:`conn`.

   The :class:`SMTPChannel` operates by invoking methods named ``smtp_<command>``
   upon reception of a command line from the client. Built into the base
   :class:`SMTPChannel` class are methods for handling the following commands
   (and responding to them appropriately):

   ======== ===================================================================
   Command  Action taken
   ======== ===================================================================
   HELO     Accepts the greeting from the client and stores it in
            :attr:`seen_greeting`.  Sets server to base command mode.
   EHLO     Accepts the greeting from the client and stores it in
            :attr:`seen_greeting`.  Sets server to extended command mode.
   NOOP     Takes no action.
   QUIT     Closes the connection cleanly.
   MAIL     Accepts the "MAIL FROM:" syntax and stores the supplied address as
            :attr:`mailfrom`.  In extended command mode, accepts the
            :rfc:`1870` SIZE attribute and responds appropriately based on the
            value of *data_size_limit*.
   RCPT     Accepts the "RCPT TO:" syntax and stores the supplied addresses in
            the :attr:`rcpttos` list.
   RSET     Resets the :attr:`mailfrom`, :attr:`rcpttos`, and
            :attr:`received_data`, but not the greeting.
   DATA     Sets the internal state to :attr:`DATA` and stores remaining lines
            from the client in :attr:`received_data` until the terminator
            ``"\r\n.\r\n"`` is received.
   HELP     Returns minimal information on command syntax
   VRFY     Returns code 252 (the server doesn't know if the address is valid)
   EXPN     Reports that the command is not implemented.
   ======== ===================================================================