text:
<?php
/**
 * @file
 *
 * QueryPath bootstrap.
 *
 * This file holds bootstrap code to load the QueryPath library.
 *
 * Usage:
 *
 * @code
 * <?php
 * require 'qp.php';
 *
 * qp($xml)->find('foo')->count();
 * ?>
 * @endcode
 *
 * If no autoloader is currently operating, this will use
 * QueryPath's default autoloader **unless**
 * QP_NO_AUTOLOADER is defined, in which case all of the
 * files will be statically required in.
 */

// This is sort of a last ditch attempt to load QueryPath if no
// autoloader is used.
if (!class_exists('\QueryPath\QueryPath')) {

  // If classloaders are explicitly disabled, load everything.
  if (defined('QP_NO_AUTOLOADER')) {
    // This is all (and only) the required classes for QueryPath.
    // Extensions are not loaded automatically.
    require __DIR__ . '/QueryPath/Exception.php';
    require __DIR__ . '/QueryPath/ParseException.php';
    require __DIR__ . '/QueryPath/IOException.php';
    require __DIR__ . '/QueryPath/CSS/ParseException.php';
    require __DIR__ . '/QueryPath/CSS/NotImplementedException.php';
    require __DIR__ . '/QueryPath/CSS/EventHandler.php';
    require __DIR__ . '/QueryPath/CSS/SimpleSelector.php';
    require __DIR__ . '/QueryPath/CSS/Selector.php';
    require __DIR__ . '/QueryPath/CSS/Traverser.php';
    require __DIR__ . '/QueryPath/CSS/DOMTraverser/PseudoClass.php';
    // require __DIR__ . '/QueryPath/CSS/DOMTraverser/PseudoElement.php';
    require __DIR__ . '/QueryPath/CSS/DOMTraverser/Util.php';
    require __DIR__ . '/QueryPath/CSS/DOMTraverser.php';
    require __DIR__ . '/QueryPath/CSS/Token.php';
    require __DIR__ . '/QueryPath/CSS/InputStream.php';
    require __DIR__ . '/QueryPath/CSS/Scanner.php';
    require __DIR__ . '/QueryPath/CSS/Parser.php';
    require __DIR__ . '/QueryPath/CSS/QueryPathEventHandler.php';
    require __DIR__ . '/QueryPath/Query.php';
    require __DIR__ . '/QueryPath/Entities.php';
    require __DIR__ . '/QueryPath/Extension.php';
    require __DIR__ . '/QueryPath/ExtensionRegistry.php';
    require __DIR__ . '/QueryPath/Options.php';
    require __DIR__ . '/QueryPath/QueryPathIterator.php';
    require __DIR__ . '/QueryPath/DOMQuery.php';
    require __DIR__ . '/QueryPath.php';
  }
  else {
    spl_autoload_register(function ($klass) {
      $parts = explode('\\', $klass);
      if ($parts[0] == 'QueryPath') {
        $path = __DIR__ . '/' . implode('/', $parts) . '.php';
        if (file_exists($path)) {
          require $path;
        }
      }
    });
  }
}

// Define qp() and qphtml() function.
if (!function_exists('qp')) {
    require __DIR__ . '/qp_functions.php';
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Hello World</title>
    <meta name="description" content="Hello World Backbone Application">

Loading...

redpajama_set_name: RedPajamaGithub


text:
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
%BOOK_ENTITIES;
]>

    <title>Administrator Alerts</title>
    <para>The system provides alerts and events to help with the management of the cloud. Alerts are notices to an administrator, generally delivered by e-mail, notifying the administrator that an error has occurred in the cloud. Alert behavior is configurable.</para>
    <para>Events track all of the user and administrator actions in the cloud. For example, every guest VM start creates an associated event. Events are stored in the Management Server's database.</para>
    <para>Emails will be sent to administrators under the following circumstances:</para>
    <itemizedlist>
        <listitem><para>The Management Server cluster runs low on CPU, memory, or storage resources</para></listitem>
        <listitem><para>The Management Server loses heartbeat from a Host for more than 3 minutes</para></listitem>
        <listitem><para>The Host cluster runs low on CPU, memory, or storage resources</para></listitem>
    </itemizedlist>

        <title>Sending Alerts to External SNMP and Syslog Managers</title>
        <para>In addition to showing administrator alerts on the Dashboard in the &PRODUCT; UI and
            sending them in email, &PRODUCT; can also send the same alerts to external SNMP or
            Syslog management software. This is useful if you prefer to use an SNMP or Syslog
            manager to monitor your cloud.</para>
        <para>The alerts which can be sent are listed in <xref linkend="alerts"/>. You can also
            display the most up to date list by calling the API command listAlerts.</para>

            <title>SNMP Alert Details</title>
            <para>The supported protocol is SNMP version 2.</para>
            <para>Each SNMP trap contains the following information: message, podId, dataCenterId, clusterId, and generationTime.</para>

            <title>Syslog Alert Details</title>
            <para>&PRODUCT; generates a syslog message for every alert. Each syslog message incudes
                the fields alertType, message, podId, dataCenterId, and clusterId, in the following
                format. If any field does not have a valid value, it will not be included.</para>
            <programlisting>Date severity_level Management_Server_IP_Address/Name  alertType:: value dataCenterId:: value  podId:: value  clusterId:: value  message:: value</programlisting>
            <para>For example:</para>
            <programlisting>Mar  4 10:13:47    WARN    localhost    alertType:: managementNode message:: Management server node 127.0.0.1 is up</programlisting>

            <title>Configuring SNMP and Syslog Managers</title>
            <para>To configure one or more SNMP managers or Syslog managers to receive alerts from
                &PRODUCT;:</para>
            <orderedlist>
                <listitem><para>For an SNMP manager, install the &PRODUCT; MIB file on your SNMP manager system.
                    This maps the SNMP OIDs to trap types that can be more easily read by users.
                    The file must be publicly available.
                    For more information on how to install this file, consult the documentation provided with the SNMP manager.</para></listitem>
                <listitem>
                    <para>Edit the file /etc/cloudstack/management/log4j-cloud.xml.</para>
                    <programlisting># vi /etc/cloudstack/management/log4j-cloud.xml</programlisting>
                </listitem>
                <listitem>
                    <para>Add an entry using the syntax shown below. Follow the appropriate example
                        depending on whether you are adding an SNMP manager or a Syslog manager. To specify
                        multiple external managers, separate the IP addresses and other configuration values
                        with commas (,).</para>
                    <note>
                        <para>The recommended maximum number of SNMP or Syslog managers is 20 for
                            each.</para>
                    </note>
                    <para/>
                    <para>The following example shows how to configure two SNMP managers at IP addresses
                        10.1.1.1 and 10.1.1.2. Substitute your own IP addresses, ports, and communities. Do
                        not change the other values (name, threshold, class, and layout values).</para>
                    <programlisting><appender name="SNMP" class="org.apache.cloudstack.alert.snmp.SnmpTrapAppender">
  <param name="Threshold" value="WARN"/>  <!-- Do not edit. The alert feature assumes WARN. -->
  <param name="SnmpManagerIpAddresses" value="10.1.1.1,10.1.1.2"/>
  <param name="SnmpManagerPorts" value="162,162"/>
  <param name="SnmpManagerCommunities" value="public,public"/>
  <layout class="org.apache.cloudstack.alert.snmp.SnmpEnhancedPatternLayout"> <!-- Do not edit -->
    <param name="PairDelimeter" value="//"/>
    <param name="KeyValueDelimeter" value="::"/>
  </layout>
</appender></programlisting>
                    <para>The following example shows how to configure two Syslog managers at IP
                        addresses 10.1.1.1 and 10.1.1.2. Substitute your own IP addresses. You can
                        set Facility to any syslog-defined value, such as LOCAL0 - LOCAL7. Do not
                        change the other values.</para>
                    <programlisting><appender name="ALERTSYSLOG">
  <param name="Threshold" value="WARN"/>
  <param name="SyslogHosts" value="10.1.1.1,10.1.1.2"/>
  <param name="Facility" value="LOCAL6"/>
  <layout>
    <param name="ConversionPattern" value=""/>
  </layout>
</appender></programlisting>
                </listitem>
                <listitem>
                    <para>If your cloud has multiple Management Server nodes, repeat these steps to edit
                        log4j-cloud.xml on every instance.</para>
                </listitem>
                <listitem>
                    <para>If you have made these changes while the Management Server is running, wait a
                        few minutes for the change to take effect.</para>
                </listitem>
            </orderedlist>
            <para><emphasis role="bold">Troubleshooting:</emphasis> If no alerts appear at the
                configured SNMP or Syslog manager after a reasonable amount of time, it is likely that
                there is an error in the syntax of the <appender> entry in log4j-cloud.xml. Check
                to be sure that the format and settings are correct.</para>

            <title>Deleting an SNMP or Syslog Manager</title>
            <para>To remove an external SNMP manager or Syslog manager so that it no longer receives
                alerts from &PRODUCT;, remove the corresponding entry from the file
                /etc/cloudstack/management/log4j-cloud.xml.</para>


text:
package de.conterra.babelfish.plugin.v10_02.object.domain;

/**
 * defines any kind of {@link DomainObject}
 *
 * @author ChrissW-R1
 * @version 0.1.0
 * @see ArcGIS REST API
 * @since 0.1.0
 */
public abstract class DomainObject {
	/**
	 * gives the domain type
	 *
	 * @return the domain type
	 *
	 * @since 0.1.0
	 */
	public abstract String getType();
}


text:
"""
Wrapper for z3950 library call & data-extraction.
Resources:
- z3950 library docs, http://www.panix.com/~asl2/software/PyZ3950/zoom.html
- list of record formats,  http://lists.indexdata.dk/pipermail/zoom/2003-November/000547.html
"""

import logging, os, pprint, sys
from PyZ3950 import zoom  # fork, git+https://github.com/Brown-University-Library/PyZ3950.git
from pymarc import Record  # pymarc==3.0.2

class Searcher( object ):

    def __init__( self, HOST, PORT, DB_NAME, logger, connect_flag=False ):
        self.HOST = HOST   if type(HOST) == unicode   else HOST.decode(u'utf-8')
        self.PORT = PORT   if type(PORT) == unicode   else PORT.decode(u'utf-8')
        self.DB_NAME = DB_NAME   if type(DB_NAME) == unicode   else DB_NAME.decode(u'utf-8')
        self.logger = logger
        self.connection = self.connect()   if connect_flag   else None  # allows Searcher to be instantiated w/o connecting

    def connect( self ):
        """ Connects to z3950 server. """
        conn = zoom.Connection(
            self.HOST,
            int(self.PORT),
            databaseName=self.DB_NAME,
            preferredRecordSyntax=u'OPAC',  # Getting records in "opac" format. (Others were not more helpful.)
            charset=u'utf-8' )
        self.logger.debug( u'in z3950_wrapper.Searcher.connect(); connection made.')
        return conn

    def close_connection( self ):
        self.logger.debug( u'in z3950_wrapper.Searcher.close_connection(); closing connection.')
        self.connection.close()

    def search( self, key, value, marc_flag=False ):
        """ Convenience function. """
        try:
            qstring = self.build_qstring( key, value )
            qobject = self.build_qobject( qstring )
            resultset = self.connection.search( qobject )
            # self.inspect_resultset( resultset )
            item_list = self.process_resultset( resultset, marc_flag )  # marc_flag typically False
            return item_list
        except Exception as e:
            self.close_connection()
            error_dict = self.make_error_dict()
            self.logger.error( u'in z3950_wrapper.Searcher.search(); error-info, `%s`' % pprint.pformat(error_dict) )

    def build_qstring( self, key, value ):
        if key == u'bib':
            key = u'id'
        dct = {
            u'isbn': u'@attr 1=7',
            u'issn': u'@attr 1=8',
            u'id': u'@attr 1=12',
            u'oclc': u'@attr 1=1007', }
        value = value   if key != u'oclc'   else self.update_oclc_value( value )
        qstring = u'%s %s' % ( dct[key], value )
        self.logger.debug( u'in z3950_wrapper.Searcher.build_qstring(); qstring, `%s`' % qstring )
        return qstring

    def update_oclc_value( self, value ):
        """ Updates oclc number to brown-formatted number if necessary.
            Reference: http://www.oclc.org/batchprocessing/controlnumber.htm """
        if not ( value.startswith(u'ocn') or value.startswith(u'ocm') ):
            try:
                int_value = int(value)
                new_value = unicode(int_value).zfill( 8 )
                if int_value <= 99999999:
                    value = u'ocm%s' % new_value
                else:
                    value = u'ocn%s' % new_value
            except Exception, e:
                value = u'invalid_oclc_number'
        return value

    def build_qobject( self, qstring ):
        qobject = zoom.Query(
            u'PQF'.encode(u'utf-8'),
            qstring.encode(u'utf-8')
            )
        self.logger.debug( u'in z3950_wrapper.Searcher.build_qobject(); type(qobject), `%s`' % type(qobject) )
        self.logger.debug( u'in z3950_wrapper.Searcher.build_qobject(); pprint.pformat(qobject), `%s`' % pprint.pformat(qobject) )
        return qobject

    def inspect_resultset( self, resultset ):
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(resultset), `%s`' % pprint.pformat(resultset) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(dir(resultset)), `%s`' % pprint.pformat(dir(resultset)) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(resultset.__dict__), `%s`' % pprint.pformat(resultset.__dict__) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(len(resultset)), `%s`' % pprint.pformat(len(resultset)) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(resultset[0]), `%s`' % pprint.pformat(resultset[0]) )
        rec = resultset[0]
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(dir(rec)), `%s`' % pprint.pformat(dir(rec)) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.__dict__), `%s`' % pprint.pformat(rec.__dict__) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.data), `%s`' % pprint.pformat(rec.data) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.data.bibliographicRecord), `%s`' % pprint.pformat(rec.data.bibliographicRecord) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.data.bibliographicRecord.encoding), `%s`' % pprint.pformat(rec.data.bibliographicRecord.encoding) )
        ## marc
        pm_rec = Record( data=rec.data.bibliographicRecord.encoding[1] )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(pm_rec), `%s`' % pprint.pformat(pm_rec) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(dir(pm_rec)), `%s`' % pprint.pformat(dir(pm_rec)) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(pm_rec.__dict__), `%s`' % pprint.pformat(pm_rec.__dict__) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(pm_rec.as_dict()), `%s`' % pprint.pformat(pm_rec.as_dict()) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(pm_rec.title()), `%s`' % pprint.pformat(pm_rec.title()) )
        ## holdings
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.data.holdingsData), `%s`' % pprint.pformat(rec.data.holdingsData) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.data.holdingsData[0]), `%s`' % pprint.pformat(rec.data.holdingsData[0]) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.data.holdingsData[0][0]), `%s`' % pprint.pformat(rec.data.holdingsData[0][0]) )
        self.logger.debug( u'in z3950_wrapper.Searcher.inspect_resultset, pprint.pformat(rec.data.holdingsData[0][1].callNumber, `%s`' % pprint.pformat(rec.data.holdingsData[0][1].callNumber) )
        return

    def process_resultset( self, resultset, marc_flag=False ):
        """ Iterates through resultset, extracting from marc-data and holdings-data. """
        item_list = []
        for result in resultset:
            ## start w/marc
            marc_record_object = Record( data=result.data.bibliographicRecord.encoding[1] )
            item_entry = self.process_marc_data( marc_record_object, marc_flag )
            ## add holdings
            holdings_record_data = result.data.holdingsData
            item_entry[u'holdings_data'] = self.process_holdings_data( holdings_record_data )
            item_list.append( item_entry )
        self.logger.debug( u'in z3950_wrapper.Searcher.process_resultset, pprint.pformat(item_list), `%s`' % pprint.pformat(item_list) )
        return item_list

    def process_holdings_data( self, holdings_data ):
        record_holdings_data = []
        for holdings_entry in holdings_data:
            entry = {}
            holdings_object = holdings_entry[1]
            entry[u'callNumber'] = holdings_object.callNumber
            entry[u'localLocation'] = holdings_object.localLocation
            entry[u'publicNote'] = holdings_object.publicNote
            record_holdings_data.append( entry )
        self.logger.debug( u'in z3950_wrapper.Searcher.process_holdings_data, pprint.pformat(record_holdings_data), `%s`' % pprint.pformat(record_holdings_data) )
        return record_holdings_data

    def process_marc_data( self, marc_record_object, marc_flag ):
        marc_dict = marc_record_object.as_dict()
        item_entry = {}
        if marc_flag:
            item_entry[u'raw_marc'] = marc_dict
        item_entry[u'title'] = marc_record_object.title()
        item_entry[u'callnumber'] = self.make_marc_callnumber( marc_dict )
        item_entry[u'items_data'] = self.make_items_data( marc_record_object )
        item_entry[u'isbn'] = marc_record_object.isbn()
        item_entry[u'lccn'] = self.make_lccn( marc_dict )
        item_entry[u'bibid'] = self.make_bibid( marc_dict )
        item_entry[u'issn'] = self.make_issn( marc_dict )
        item_entry[u'josiah_bib_url'] = u'%s/record=%s' % ( u'https://josiah.brown.edu', item_entry[u'bibid'][1:-1] )  # removes period & check-digit
        item_entry[u'oclc_brown'] = self.make_oclc_brown( marc_dict )
        self.logger.debug( u'in z3950_wrapper.Searcher.process_marc_data(); pprint.pformat(item_entry), `%s`' % pprint.pformat(item_entry) )
        return item_entry

    def make_marc_callnumber( self, marc_dict ):
        ( callnumber, subfield_callnumber ) = ( u'callnumber_not_available', u'' )
        for field in marc_dict[u'fields']:
            ( key, val ) = field.items()[0]
            if key == u'050' or key == u'090':
                for subfield in field[key][u'subfields']:
                    ( key2, val2 ) = subfield.items()[0]
                    subfield_callnumber = u'%s %s' % (subfield_callnumber, val2)
                callnumber = subfield_callnumber.strip()
                break
        self.logger.debug( u'in z3950_wrapper.Searcher.make_marc_callnumber(); callnumber, `%s`' % callnumber )
        return callnumber

    def make_items_data( self, marc_record_object ):
        """ Processes each item's 945 field for:
              barcode, callnumber, item_id, itype, location, & status """
        items = marc_record_object.get_fields(u'945') or []
        return_items_data = []
        for item in items:
            items_dict = dict(
                barcode=self.make_945_barcode( item  ),
                item_id=item[u'y'].lstrip(u'.'),
                location=item[u'l'].strip(),
                callnumber=item[u'c'],  #This seems to be the second half of the callnumber only
                status=item[u's'].strip(),
                itype=item[u't'].strip()
                )
            return_items_data.append( self.interpret_itemsdict(items_dict, marc_record_object) )
        self.logger.debug( u'in z3950_wrapper.Searcher.make_items_data(); return_items_data, `%s`' % return_items_data )
        return return_items_data

    def make_945_barcode( self, item ):
        barcode = item[u'i']
        if barcode is not None:
            barcode = barcode.replace(u' ', u'')
        return barcode

    def interpret_itemsdict( self, dct, marc_record_object ):
        dct[u'location_interpreted'] = u'coming'
        dct[u'status_interpreted'] = u'coming'
        dct[u'itype_interpreted'] = u'coming'
        dct[u'callnumber_interpreted'] = self.build_full_callnumber( dct[u'callnumber'], marc_record_object.get_fields(u'090') or [] )
        return dct

    def build_full_callnumber( self, callnumber_suffix, nine_oh_obj ):
        """ Adds interpreted full callnumber for possible need to match on holdings data. """
        self.logger.debug( u'in z3950_wrapper.Searcher.build_full_callnumber(); callnumber_suffix, `%s`' % callnumber_suffix )
        self.logger.debug( u'in z3950_wrapper.Searcher.build_full_callnumber(); nine_oh_obj, `%s`' % nine_oh_obj )
        full_callnumber = u''
        if nine_oh_obj:
            full_callnumber = u'%s %s %s' % ( nine_oh_obj[0][u'a'], nine_oh_obj[0][u'b'], callnumber_suffix )
        return full_callnumber

    def make_lccn( self, marc_dict ):
        lccn = u'lccn_not_available'
        for field in marc_dict[u'fields']:
            ( key, val ) = field.items()[0]
            if key == u'010':
                for subfield in field[key][u'subfields']:
                    ( key2, val2 ) = subfield.items()[0]
                    if key2 == u'a':
                        lccn = val2
                        break
        self.logger.debug( u'in z3950_wrapper.Searcher.make_lccn(); lccn, `%s`' % lccn )
        return lccn

    def make_bibid( self, marc_dict ):
        bibid = u'bibid_not_available'
        for field in marc_dict[u'fields']:
            ( key, val ) = field.items()[0]
            if key == u'907':
                for subfield in field[key][u'subfields']:
                    ( key2, val2 ) = subfield.items()[0]
                    if key2 == u'a':
                        bibid = val2
                        break
        self.logger.debug( u'in z3950_wrapper.Searcher.make_bibid(); bibid, `%s`' % bibid )
        return bibid

    def make_issn( self, marc_dict, issn=u'issn_not_available' ):
        for field in marc_dict[u'fields']:
            ( key, val ) = field.items()[0]
            if key == u'022':
                for subfield in field[key][u'subfields']:
                    ( key2, val2 ) = subfield.items()[0]
                    if key2 == u'a':
                        issn = val2
                    elif key2 == u'l' and issn == u'issn_not_available':
                        issn = val2
        self.logger.debug( u'in z3950_wrapper.Searcher.make_bibid(); bibid, `%s`' % issn )
        return issn

    def make_oclc_brown( self, marc_dict ):
        oclc = u'oclc_not_available'
        for field in marc_dict[u'fields']:
            ( key, val ) = field.items()[0]
            if key == u'001':
                oclc = val
                break
        self.logger.debug( u'in z3950_wrapper.Searcher.make_oclc_brown(); oclc, `%s`' % oclc )
        return oclc

    def make_error_dict( self ):
        error_dict = {
            u'error-type': sys.exc_info()[0],
            u'error-message': sys.exc_info()[1],
            u'line-number': sys.exc_info()[2].tb_lineno
            }
        return error_dict

    # end class Searcher()


text:
''' Command to update the symbol server '''

import os
import shutil

import nimp.command
import nimp.model.symbol_server
import nimp.system

def _list_files(source):
    all_files = []

    for file_path in os.listdir(source):
        file_path = os.path.join(source, file_path)
        if os.path.isdir(file_path):
            all_files.extend(_list_files(file_path))
        else:
            all_files.append(file_path)

    return all_files

def _copy_file(source, destination, dry_run):
    if not dry_run:
        destination_directory = os.path.dirname(destination)
        if not os.path.exists(destination_directory):
            os.makedirs(destination_directory)
        shutil.copyfile(source, destination)

class UpdateSymbolServer(nimp.command.Command):
    ''' [DEPRECATED} (use nimp symbol-server) Update the symbol server '''

    def configure_arguments(self, env, parser):
        nimp.command.add_common_arguments(parser, 'dry_run', 'free_parameters')
        parser.add_argument('--symbol-type', required = True, metavar = '<type>', help = 'Set the type of symbols to upload')
        parser.add_argument('--platform', metavar = '<platform>', help = 'Set the platform to upload symbols for')
        return True

    def is_available(self, env):
        if not hasattr(env, 'symbol_servers'):
            return False, 'symbol_servers is not defined'
        return True, ''

    def run(self, env):
        symbol_server = nimp.model.symbol_server.configure_symbol_server(env, env.symbol_type)

        if hasattr(env, 'is_unreal') and env.is_unreal and symbol_server.server_type == 'shaders':
            symbol_source = '{uproject_dir}/Saved/ShaderDebugInfo/'
            if env.unreal_platform == 'PS4':
                platform_symbol_source = 'SF_PS4/sdb'
            # elif env.unreal_platform == 'PS5':
            #     platform_symbol_source = 'SF_PS5/agsd'
            else:
                platform_symbol_source = env.unreal_platform
            symbol_source += platform_symbol_source
            symbol_source = nimp.system.sanitize_path(env.format(symbol_source))
            symbol_server.update_symbols(symbol_source, env.dry_run)

        return True


text:
package org.apache.camel.component.cxf.jaxrs;

import org.apache.camel.test.junit4.CamelSpringTestSupport;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.junit.Test;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class CxfRsRouterTest extends CamelSpringTestSupport {
    private static final String PUT_REQUEST = "<Customer><name>Mary</name><id>123</id></Customer>";
    private static final String POST_REQUEST = "<Customer><name>Jack</name></Customer>";

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml");
    }

    @Test
    public void testEndpointUris() throws Exception {
        CxfRsEndpoint cxfRsEndpoint = context.getEndpoint("cxfrs://bean://rsServer", CxfRsEndpoint.class);
        assertEquals("Get a wrong endpoint uri", "cxfrs://bean://rsServer", cxfRsEndpoint.getEndpointUri());

        cxfRsEndpoint = context.getEndpoint("cxfrs://bean://rsClient", CxfRsEndpoint.class);
        assertEquals("Get a wrong endpoint uri", "cxfrs://bean://rsClient", cxfRsEndpoint.getEndpointUri());

    }

    @Test
    public void testGetCustomer() throws Exception {
        HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers/123");
        get.addHeader("Accept" , "application/json");
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(get);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}",
                         EntityUtils.toString(response.getEntity()));
        } finally {
            httpclient.getConnectionManager().shutdown();
        }
    }

    @Test
    public void testGetCustomerWithQuery() throws Exception {
        HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers?id=123");
        get.addHeader("Accept" , "application/json");
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(get);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}",
                         EntityUtils.toString(response.getEntity()));
        } finally {
            httpclient.getConnectionManager().shutdown();
        }
    }

    @Test
    public void testGetCustomers() throws Exception {
        HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers/");
        get.addHeader("Accept" , "application/xml");
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(get);
            assertEquals(200, response.getStatusLine().getStatusCode());
            // order returned can differ on OS so match for both orders
            String s = EntityUtils.toString(response.getEntity());
            boolean m1 = "<Customers><Customer><id>123</id><name>John</name></Customer><Customer><id>113</id><name>Dan</name></Customer></Customers>".equals(s);
            boolean m2 = "<Customers><Customer><id>113</id><name>Dan</name></Customer><Customer><id>123</id><name>John</name></Customer></Customers>".equals(s);

            if (!m1 && !m2) {
                fail("Not expected body returned: " + s);
            }
        } finally {
            httpclient.getConnectionManager().shutdown();
        }
    }

    @Test
    public void testGetSubResource() throws Exception {
        HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/orders/223/products/323");
        get.addHeader("Accept" , "application/json");
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(get);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("{\"Product\":{\"description\":\"product 323\",\"id\":323}}",
                         EntityUtils.toString(response.getEntity()));
        } finally {
            httpclient.getConnectionManager().shutdown();
        }
    }

    @Test
    public void testPutConsumer() throws Exception {
        HttpPut put = new HttpPut("http://localhost:9000/route/customerservice/customers");
        StringEntity entity = new StringEntity(PUT_REQUEST, "ISO-8859-1");
        entity.setContentType("text/xml; charset=ISO-8859-1");
        put.setEntity(entity);
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(put);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("", EntityUtils.toString(response.getEntity()));
        } finally {
            httpclient.getConnectionManager().shutdown();
        }
    }

    @Test
    public void testPostConsumer() throws Exception {
        HttpPost post = new HttpPost("http://localhost:9000/route/customerservice/customers");
        post.addHeader("Accept" , "text/xml");
        StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
        entity.setContentType("text/xml; charset=ISO-8859-1");
        post.setEntity(entity);
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(post);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                         EntityUtils.toString(response.getEntity()));
        } finally {
            httpclient.getConnectionManager().shutdown();
        }

    }

    @Test
    public void testPostConsumerUniqueResponseCode() throws Exception {
        HttpPost post = new HttpPost("http://localhost:9000/route/customerservice/customersUniqueResponseCode");
        post.addHeader("Accept" , "text/xml");
        StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
        entity.setContentType("text/xml; charset=ISO-8859-1");
        post.setEntity(entity);
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(post);
            assertEquals(201, response.getStatusLine().getStatusCode());
            assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                         EntityUtils.toString(response.getEntity()));
        } finally {
            httpclient.getConnectionManager().shutdown();
        }
    }
}


text:
@interface ViewController ()

@property (nonatomic, strong) SWInfiniteScrollContainer *scrollContainer;

@property (nonatomic, assign) NSInteger numberOfPages;

@end

@implementation ViewController

#pragma mark - Action

- (void)pagesGenerator {
//    self.numberOfPages = arc4random() % 7;
//    self.pageControl.numberOfPages = self.numberOfPages;
//    [self.scrollView reloadData];
}

- (void)generateButtonTapped:(UIButton *)sender {
    NSInteger pageIndex = arc4random() % self.numberOfPages;
    [self.scrollContainer scrollToPageIndex:pageIndex];
}

#pragma mark - Lifecycle

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
        self.title = NSStringFromClass([self class]);
    }
    return self;
}

- (void)loadView {
    [super loadView];
    self.view.backgroundColor = [UIColor whiteColor];

    _scrollContainer = [[SWInfiniteScrollContainer alloc] initWithFrame:CGRectMake(0, 64, 320, 180)];
    _scrollContainer.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
    [self.view addSubview:_scrollContainer];

    CGRect generateButtonFrame = CGRectMake(0, CGRectGetMaxY(_scrollContainer.frame) + 20, CGRectGetWidth(self.view.bounds), 50);
    UIButton *generateButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    generateButton.frame = generateButtonFrame;
    generateButton.titleLabel.font = [UIFont systemFontOfSize:18];
    generateButton.layer.cornerRadius = CGRectGetMidY(generateButton.bounds);
    generateButton.layer.masksToBounds = YES;
    generateButton.layer.borderColor = generateButton.titleLabel.textColor.CGColor;
    generateButton.layer.borderWidth = .5f;
    [generateButton setTitle:@"random pages" forState:UIControlStateNormal];
    [generateButton addTarget:self action:@selector(generateButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:generateButton];
}

- (NSArray *)scrollImages {
    static const int count = 10;
    self.numberOfPages = count;

    NSMutableArray *scrollImages = [NSMutableArray array];
    for (int i = 0; i < count; i++)
    {
        NSString *imageName = [NSString stringWithFormat:@"scrollImage%d.jpg", i];
        UIImage *image = [UIImage imageNamed:imageName];
        if (image)
        {
            [scrollImages addObject:image];
        }
    }
    return [scrollImages copy];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self pagesGenerator];
    self.scrollContainer.images = [self scrollImages];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text:
from direct.directnotify import DirectNotifyGlobal
from direct.gui import DirectGui
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from pandac.PandaModules import *
from toontown.hood import ZoneUtil
from toontown.launcher import DownloadForceAcknowledge
from toontown.safezone.SafeZoneLoader import SafeZoneLoader
from toontown.safezone.GZPlayground import GZPlayground
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
import random
if (__debug__):
    import pdb

class GZSafeZoneLoader(SafeZoneLoader):

    def __init__(self, hood, parentFSM, doneEvent):
        SafeZoneLoader.__init__(self, hood, parentFSM, doneEvent)
        self.musicFile = 'phase_6/audio/bgm/GZ_SZ.ogg'
        self.activityMusicFile = 'phase_6/audio/bgm/GS_KartShop.ogg'
        self.dnaFile = 'phase_6/dna/golf_zone_sz.pdna'
        self.safeZoneStorageDNAFile = 'phase_6/dna/storage_GZ_sz.pdna'
        del self.fsm
        self.fsm = ClassicFSM.ClassicFSM('SafeZoneLoader', [State.State('start', self.enterStart, self.exitStart, ['quietZone', 'playground', 'toonInterior']),
         State.State('playground', self.enterPlayground, self.exitPlayground, ['quietZone', 'golfcourse']),
         State.State('toonInterior', self.enterToonInterior, self.exitToonInterior, ['quietZone']),
         State.State('quietZone', self.enterQuietZone, self.exitQuietZone, ['playground', 'toonInterior', 'golfcourse']),
         State.State('golfcourse', self.enterGolfCourse, self.exitGolfCourse, ['quietZone', 'playground']),
         State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')

    def load(self):
        SafeZoneLoader.load(self)
        self.birdSound = map(base.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.ogg', 'phase_4/audio/sfx/SZ_TC_bird2.ogg', 'phase_4/audio/sfx/SZ_TC_bird3.ogg'])

    def unload(self):
        del self.birdSound
        SafeZoneLoader.unload(self)

    def enterPlayground(self, requestStatus):
        self.playgroundClass = GZPlayground
        SafeZoneLoader.enterPlayground(self, requestStatus)
        top = self.geom.find('**/linktunnel_bosshq_10000_DNARoot')
        sign = top.find('**/Sign_5')
        sign.node().setEffect(DecalEffect.make())
        locator = top.find('**/sign_origin')
        signText = DirectGui.OnscreenText(text=TextEncoder.upper(TTLocalizer.BossbotHQ[-1]), font=ToontownGlobals.getSuitFont(), scale=TTLocalizer.GZSZLsignText, fg=(0, 0, 0, 1), mayChange=False, parent=sign)
        signText.setPosHpr(locator, 0, 0, -0.3, 0, 0, 0)
        signText.setDepthWrite(0)

    def exitPlayground(self):
        taskMgr.remove('titleText')
        self.hood.hideTitleText()
        SafeZoneLoader.exitPlayground(self)
        self.playgroundClass = None
        return

    def handlePlaygroundDone(self):
        status = self.place.doneStatus
        if self.enteringAGolfCourse(status) and status.get('shardId') == None:
            zoneId = status['zoneId']
            self.fsm.request('quietZone', [status])
        elif ZoneUtil.getBranchZone(status['zoneId']) == self.hood.hoodId and status['shardId'] == None:
            self.fsm.request('quietZone', [status])
        else:
            self.doneStatus = status
            messenger.send(self.doneEvent)
        return

    def enteringARace(self, status):
        if not status['where'] == 'golfcourse':
            return 0
        if ZoneUtil.isDynamicZone(status['zoneId']):
            return status['hoodId'] == self.hood.hoodId
        else:
            return ZoneUtil.getHoodId(status['zoneId']) == self.hood.hoodId

    def enteringAGolfCourse(self, status):
        if not status['where'] == 'golfcourse':
            return 0
        if ZoneUtil.isDynamicZone(status['zoneId']):
            return status['hoodId'] == self.hood.hoodId
        else:
            return ZoneUtil.getHoodId(status['zoneId']) == self.hood.hoodId

    def enterGolfCourse(self, requestStatus):
        if 'curseId' in requestStatus:
            self.golfCourseId = requestStatus['courseId']
        else:
            self.golfCourseId = 0
        self.accept('raceOver', self.handleRaceOver)
        self.accept('leavingGolf', self.handleLeftGolf)
        base.transitions.irisOut(t=0.2)

    def exitGolfCourse(self):
        del self.golfCourseId

    def handleRaceOver(self):
        print 'you done!!'

    def handleLeftGolf(self):
        req = {'loader': 'safeZoneLoader',
         'where': 'playground',
         'how': 'teleportIn',
         'zoneId': 17000,
         'hoodId': 17000,
         'shardId': None}
        self.fsm.request('quietZone', [req])
        return


text:
<?php

namespace Transit\Validator;

/**
 * Provides file validation functionality.
 *
 * @package Transit\Validator
 */
class ImageValidator extends AbstractValidator {

	/**
	 * Validate the image height matches the size.
	 *
	 * @param int $size
	 * @return bool
	 */
	public function height($size) {
		return ($this->getFile()->height() == $size);
	}

	/**
	 * Validate the image width matches the size.
	 *
	 * @param int $size
	 * @return bool
	 */
	public function width($size) {
		return ($this->getFile()->width() == $size);
	}

	/**
	 * Validate image height is less than or equal to the max.
	 *
	 * @param int $max
	 * @return bool
	 */
	public function maxHeight($max) {
		return ($this->getFile()->height() <= $max);
	}

	/**
	 * Validate image width is less than or equal to the max.
	 *
	 * @param int $max
	 * @return bool
	 */
	public function maxWidth($max) {
		return ($this->getFile()->width() <= $max);
	}

	/**
	 * Validate image height is greater than or equal to the minimum.
	 *
	 * @param int $min
	 * @return bool
	 */
	public function minHeight($min) {
		return ($this->getFile()->height() >= $min);
	}

	/**
	 * Validate image width is greater than or equal to the minimum.
	 *
	 * @param int $min
	 * @return bool
	 */
	public function minWidth($min) {
		return ($this->getFile()->width() >= $min);
	}

}


text:
package org.lielas.dataloggerstudio.test;

import org.lielas.dataloggerstudio.test.gui.MainFrame;

import java.awt.*;

/**
 * Created by Andi on 29.05.2015.
 */
public class Main {

    public static void main(String[] args){
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try{
                    MainFrame frame = new MainFrame();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
}


text:
require 'spec_helper'

describe Cancannible do
  let(:grantee_class) { Member }
  let(:grantee) { grantee_class.create! }
  let(:cached_object) do
    abilities = Ability.new(grantee)
    abilities.can :read, :all
    abilities
  end

  describe "#abilities" do
    subject { grantee.abilities }

    context "when get_cached_abilities provided" do
      before do
        Cancannible.get_cached_abilities = proc { |grantee| cached_object }
      end

      it "returns the cached object" do
        expect(cached_object.instance_variable_defined?(:@rules_index)).to eql(true)
        expect(subject).to eql(cached_object)
      end
      context 'when incompatible cached_object' do
        let(:cached_object) { 'bogative' }
        it 'returns a new object' do
          expect(subject).to be_an(Ability)
          expect(subject).to_not eql(cached_object)
        end
      end
      context "unless reload requested" do
        subject { grantee.abilities(true) }
        it 'returns a new object' do
          expect(subject).to be_an(Ability)
          expect(subject).to_not eql(cached_object)
        end
      end
    end

    context "when store_cached_abilities provided" do
      before do
        @stored = nil
        Cancannible.store_cached_abilities = proc { |grantee, ability| @stored = { grantee_id: grantee.id, ability: cached_object } }
      end
      it "stores the cached object" do
        expect { subject }.to change { @stored }.from(nil)
        expect(@stored[:grantee_id]).to eql(grantee.id)
        expect(@stored[:ability]).to be_an(Ability)
      end
    end

    context "when get and store cached_abilities provided" do
      before do
        @stored = nil
        @store = 0
        Cancannible.get_cached_abilities = proc { |grantee| @stored && cached_object }
        Cancannible.store_cached_abilities = proc { |grantee, ability| @store += 1 ; @stored = { grantee_id: grantee.id, ability: ability } }
      end
      it "stores the cached object on the first call" do
        expect { subject }.to change { @stored }.from(nil)
        expect(@store).to eql(1)
        expect(grantee.abilities.instance_variable_get(:@rules).size).to eql(1)
        expect(grantee.abilities.instance_variable_get(:@rules_index).size).to eql(1)
      end
      it "returns the cached object on the second call" do
        expect { subject }.to change { @stored }.from(nil)
        expect(@store).to eql(1)
        expect { grantee.abilities }.to_not change { @store }
        expect(grantee.abilities).to be_an(Ability)
      end
      it "should re-cache object on the second call if refresh requested" do
        expect { subject }.to change { @stored }.from(nil)
        expect(@store).to eql(1)
        expect { grantee.abilities(true) }.to change { @store }.from(1).to(2)
        expect(grantee.abilities).to be_an(Ability)
      end
    end
  end
end


text:
package dao.mapper;

import java.util.List;
import model.comment.TComment;
import model.comment.TCommentExample;
import org.apache.ibatis.annotations.Param;

public interface TCommentMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    long countByExample(TCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int deleteByExample(TCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int insert(TComment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int insertSelective(TComment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    List<TComment> selectByExampleWithBLOBs(TCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    List<TComment> selectByExample(TCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    TComment selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int updateByExampleSelective(@Param("record") TComment record, @Param("example") TCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int updateByExampleWithBLOBs(@Param("record") TComment record, @Param("example") TCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int updateByExample(@Param("record") TComment record, @Param("example") TCommentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int updateByPrimaryKeySelective(TComment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int updateByPrimaryKeyWithBLOBs(TComment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_comment
     *
     * @mbg.generated Fri Aug 25 22:17:13 CST 2017
     */
    int updateByPrimaryKey(TComment record);
}


text:
import { HOME_URL, TIMEOUT, launch, startCoverage, stopCoverage } from './e2e-config';

describe('Navigation e2e', () => {
    let browser;
    let page;

    beforeAll(async () => {
        browser = await launch();
        page = await browser.newPage();
        await startCoverage(page);
        await page.goto(HOME_URL);
    }, TIMEOUT);

    afterAll(async () => {
        await stopCoverage(page, 'Navigation e2e');
        await page.close();
        await browser.close();
    }, TIMEOUT);

    test(
        'Usage by Year',
        async () => {
            const selector = '#usage-by-year';
            await page.waitForSelector(selector);
            await page.click(selector);
            const url = page.url();
            expect(url).toBe(HOME_URL + 'UsageByYear');
        },
        TIMEOUT
    );

    test(
        'Usage by Month',
        async () => {
            const selector = '#usage-by-month';
            await page.waitForSelector(selector);
            await page.click(selector);
            const url = page.url();
            expect(url).toBe(HOME_URL + 'UsageByMonth');
        },
        TIMEOUT
    );

    test(
        'Usage by User',
        async () => {
            const selector = '#usage-by-user';
            await page.waitForSelector(selector);
            await page.click(selector);
            const url = page.url();
            expect(url).toBe(HOME_URL + 'UsageByUser');
        },
        TIMEOUT
    );
});


text:
package com.google.gerrit.server.api.changes;

import com.google.gerrit.extensions.api.changes.Changes;
import com.google.gerrit.server.config.FactoryModule;

public class Module extends FactoryModule {
  @Override
  protected void configure() {
    bind(Changes.class).to(ChangesImpl.class);

    factory(ChangeApiImpl.Factory.class);
    factory(RevisionApiImpl.Factory.class);
  }
}


text:
<?php
  class paymentModuleInfo {
    var $payment_code, $keys;

// class constructor
    function paymentModuleInfo($pmInfo_array) {
      $this->payment_code = $pmInfo_array['payment_code'];

      for ($i = 0, $n = sizeof($pmInfo_array) - 1; $i < $n; $i++) {
        $key_value_query = tep_db_query("select configuration_title, configuration_value, configuration_description from " . TABLE_CONFIGURATION . " where configuration_key = '" . $pmInfo_array[$i] . "'");
        $key_value = tep_db_fetch_array($key_value_query);

        $this->keys[$pmInfo_array[$i]]['title'] = $key_value['configuration_title'];
        $this->keys[$pmInfo_array[$i]]['value'] = $key_value['configuration_value'];
        $this->keys[$pmInfo_array[$i]]['description'] = $key_value['configuration_description'];
      }
    }
  }
?>


text:
package com.box.castle.router.metrics

object TagNames {
  val Actor      = "actor"
  val BrokerHost = "broker_host"
}


text:
$( document ).ready(function() {
    console.log( "ready!" );
    StartUpCheck();

});

//Some GLOBALS
var inventory;
var badgeName = "referralBadge";

function StartUpCheck()
{
	// check for a stored TitleId to use
	if (localStorage.titleId)
	{
	    $("#inputTitleId").val(localStorage.titleId);
	}
	else
	{
		$("#inputTitleId").val("Enter your Title Id");
	}

	// check for a stored UserId to use
	if (localStorage.userId)
	{
	    $("#inputUserId").val(localStorage.userId);
	}
	else
	{
		$("#inputUserId").val(CreateGUID());
	}

	// hook up our buttons
	$("#login").click(function() {
		Authenticate();
	});

	$("#redeem").click(function() {
		RedeemReferralCode();
	});

	// hide the main ui until we are authenticated
	$(".exampleUI").hide();
}

function Authenticate()
{
	// save our local GUID and Title Id so we use the same one (or at least until our cookies are cleared)
	localStorage.titleId = $("#inputTitleId").val();
	localStorage.userId = $("#inputUserId").val();

	PlayFab.settings.titleId = $("#inputTitleId").val();
	var LoginWithCustomIDRequest = {
		"TitleId" : PlayFab.settings.titleId,
		"CustomId" : $("#inputUserId").val(),
		"CreateAccount" : true
	};

	console.log("Logging into PlayFab...");
	PlayFabClientSDK.LoginWithCustomID(LoginWithCustomIDRequest, AuthenticationCallback);
}

function AuthenticationCallback(response, error)
{
	if(error)
	{
		OutputError(error);
	}
	else
	{
		var result = response.data;
		console.log("Login Successful. Welcome Player: " + result.PlayFabId);
		console.log("Your session ticket is: " + result.SessionTicket);
		console.log("Your friend referral code is: " + result.PlayFabId);

		$("#referralValue").text("[" + result.PlayFabId + "]");

		$(".loginUI").hide();
		GetInventory();
	}
}

function GetInventory()
{
	console.log("Getting the player inventory...");
	PlayFabClientSDK.GetUserInventory({}, GetInventoryCallback);
}

function GetInventoryCallback(response, error)
{
	if(error)
	{
		OutputError(error);
	}
	else
	{
		var result = response.data;
		var gmBalance = result.VirtualCurrency.hasOwnProperty("GM") ? result.VirtualCurrency["GM"] : 0;
		console.log("You have " + gmBalance + " Gems.");

		inventory = result.Inventory;
		console.log("Inventory retrieved. You have " + result.Inventory.length + " items.");

		SearchForReferralBadge();
		$(".exampleUI").show();
	}
}

function RedeemReferralCode()
{
	console.log("REDEEMING...");
	var ExecuteCloudScriptRequest = {
		"FunctionName" : "RedeemReferral",
		"FunctionParameter" : {
			"referralCode" : $("#inputReferralCode").val()
		}
	};

	PlayFabClientSDK.ExecuteCloudScript(ExecuteCloudScriptRequest, RedeemReferralCodeCallback);
}

function RedeemReferralCodeCallback(response, error)
{
	if(error)
	{
		OutputError(error);
	}
	else if(response.data.Error)
	{
		// Output any errors that occurred in Cloud Script
		OutputError(response.data.Error);
	}
	else if(response.data.FunctionResult.errorDetails)
	{
		OutputError(response.data.FunctionResult.errorDetails);
	}
	else
	{
		console.log("SUCCESS!...\nYou Just Received:");
		var grantedItems = response.data.Results;

		if(grantedItems)
		{
			var output = "";
			for(var item in grantedItems )
			{
				output += "\t " + grantedItems[item].itemId + " \n";
			}
			inventory.push(grantedItems);

			console.log(output);

			for(var z in response.data.Logs)
			{
				console.log(response.data.Logs[z]);
			}

			SearchForReferralBadge();

			$("#redeemUI").hide();

		}
		else
		{
			console.log("An error occurred when attempting to deserialize the BattleResults.");
		}
	}
}

function SearchForReferralBadge()
{
	for(var index in inventory)
	{
		if(inventory[index].ItemId == this.badgeName)
		{
			console.log("Referral Badge Found!");
			wasReferralBageFound = true;
			$("#redeemUI").hide();
			$("#referredBy").text(inventory[index].Annotation);
			$("#referredUI").show();
		}
	}
}

function OutputError(error)
{
	console.error(error);
}

// creates a standard GUID string to use as our custom ID
function CreateGUID()
{
	//http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
	return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);});
}


text:
namespace Anycmd.Edi.ServiceModel.Operations
{
    using DataContracts;
    using ServiceStack;
    using System;
    using System.Runtime.Serialization;
    using Types;

    /// <summary>
    /// 数据传输模型:请求获取单个本体的请求模型
    /// </summary>
    [Route("/Ontology/Get/{OntologyCode}")]
    [Route("/Ontology/Get")]
    [Api("单个本体。")]
    [DataContract]
    public sealed class GetOntology : IReturn<GetOntologyResponse>, IDto
    {
        /// <summary>
        /// 本体码
        /// </summary>
        [DataMember]
        [ApiMember(Description = "本体码", IsRequired = true)]
        public string OntologyCode { get; set; }
    }

    /// <summary>
    /// 数据传输模型:请求获取单个本体的响应模型
    /// </summary>
    [DataContract]
    public sealed class GetOntologyResponse
    {
        private static readonly string HostName = System.Net.Dns.GetHostName();
        private string _serverId;
        private long _serverTicks = DateTime.UtcNow.Ticks;

        public GetOntologyResponse()
        {
            this.Description = "单个本体";
        }

        /// <summary>
        /// 命令状态码。
        /// </summary>
        [DataMember]
        public int Status { get; set; }

        /// <summary>
        /// 原因短语。
        /// </summary>
        [DataMember]
        public string ReasonPhrase { get; set; }

        /// <summary>
        /// 命令状态码描述。
        /// </summary>
        [DataMember]
        public string Description { get; set; }

        /// <summary>
        /// 服务器响应时间戳
        /// </summary>
        [DataMember]
        public long ServerTicks
        {
            get { return _serverTicks; }
            set { _serverTicks = value; }
        }

        /// <summary>
        /// 服务器标识
        /// </summary>
        [DataMember]
        public string ServerId
        {
            get
            {
                return _serverId ?? HostName;
            }
            set
            {
                _serverId = value;
            }
        }
        /// <summary>
        ///
        /// </summary>
        [DataMember]
        public OntologyData Ontology { get; set; }
    }
}


text:
@interface UIViewController (LHNavigationGesture) <UIGestureRecognizerDelegate>
/// 是否隐藏导航栏
@property (nonatomic,assign) BOOL lh_hideNavBar;
/// 给view添加侧滑返回效果
- (void)lh_addPopGestureToView:(UIView *)view;

@end


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Paepalanthus diffusus Silveira

### Remarks
null