text:
<?php
    defined('BASEPATH') OR exit('No direct script access allowed');

    /**
     * Dashboard - Controller to handle all interactions with the dashboard
     * page.
     */
    class Dashboard extends CI_Controller{

        // Constant Offset Used for Better Code Formatting in Page Source
        const START_TABS = "\t\t\t\t";

        public function __construct(){
            // CodeIgniter Parent Constructor
            parent::__construct();

            // All SimplePages use a database connection
            $this->load->database();

            // Loading Libraries
            $this->load->library('table');

            // Loading Calendar Library w/ Preferences
            $prefs = array(
                'day_type'          => 'short',
                'show_other_days'   => TRUE
            );

            $prefs['template'] = '
                {table_open}
{/table_open}
                {heading_row_start}
{/heading_row_start}
                {heading_row_end}
{/heading_row_end}

                {week_row_start}
{/week_row_start}
                {week_row_end}
{/week_row_end}

                {cal_cell_start_other}{/cal_cell_start_other}
                {cal_cell_start_today}{/cal_cell_start_today}

                {cal_cell_content}{day}{content}{/cal_cell_content}

            ';

            $this->load->library('calendar', $prefs);

            // Loading My Models
            $this->load->model('Timestamp_model', 'Timestamp');
            $this->load->model('Assignment_model', 'Assignments');

        } // End of __construct

        /**
         * view - Method to generate the entire dashboard page
         *      Asks Assignment, and Timestamp models for data
         * @return NULL
         */
        public function view(){

            // Check login
            if(!$this->session->userdata('logged_in')){
                redirect("users/index");
            }

            // Current year & month variables
            $this_year = date("Y", strtotime("this year"));
            $this_month = date("m", strtotime("this month"));

            // Constructing data
            $data = array();

            // Info Tables
            $data = $this->create_time_table($data);

            // Passing Assignments
            $fields = array("assignment_id", "name", "due_date", "started",
                "completed", "is_completed");
            $assignments = $this->Assignments->get_assignments($this_month, $this_year, $fields, 1);

            $complete = array();
            $incomplete = array();

            // Sorting $assignments
            foreach($assignments as $assign){
                if($assign['is_completed'] == 0){
                    $incomplete[] = $assign;
                }else{
                    $complete[] = $assign;
                }
            }

            // Assembling tables
            $this->create_unfinished_table($data, $incomplete);
            $this->create_finished_table($data, $complete);

            // Calendar
            $data['calendar'] = $this->calendar->generate($this_year, $this_month);

            // Variable for nav
            $data['active'] = "dashboard";

            $this->load->view('templates/header');
            $this->load->view('templates/nav', $data);

            // Loading Remaining View & Passing data to dashboard
            $this->load->view('dashboard', $data);
            $this->load->view('templates/footer');
        } // End of view

        /**
         * [create_table_template description]
         * @return [type] [description]
         */
        private function create_table_template(){
            $template = array(
                'table_open'            => '
',

                'thead_open'            => '
',
                'thead_close'           => '
',

                'heading_row_start'     => '
',
                'heading_row_end'       => '
',
                'heading_cell_start'    => '
',
                'heading_cell_end'      => '
',

                'tbody_open'            => '
',
                'tbody_close'           => '
',

                'row_start'             => '
',
                'row_end'               => '
',
                'cell_start'            => '
',
                'cell_end'              => '
',

                'row_alt_start'         => '
',
                'row_alt_end'           => '
',
                'cell_alt_start'        => '
',
                'cell_alt_end'          => '
',

                'table_close'           => '
'
            );

            return $template;
        } // End of create_table_template

        /**
         * generate_heading - Accepts an array of strings and formats the table-head
         *      header to be used.
         *
         * @param  headers - Array of Strings
         * @return String
         */
        private function generate_heading($headers){
            // Formatted table-head String
            $out = "";

            // Creating table-head
            $out .= self::START_TABS.'
'."\n";
            $out .= self::START_TABS."\t
\n";

            // Adding list items
            foreach($headers as $head){
                $out .= "
".$head."
";
            }

            // Closing tags
            $out .= self::START_TABS."\t
\n";
            $out .= self::START_TABS."
\n";

            return $out;
        } // End of generate_heading

        /**
         * create_time_table - Finds and formats the time table
         *
         * @param  data - Reference to an associative array
         * @return data
         */
        private function create_time_table(&$data){

            // Starting with an empty string
            $data['time_table'] = "";

            // Total Time Logged
            $data['total_time'] = DateTime::createFromFormat('H:i:s', "00:00:00");

            // Header Items
            $heading = array("Date", "Start Time", "End Time", "Assignment", "Section");

            // Creating table opening
            $data['time_table'] .= '
'."\n";
            $data['time_table'] .= $this->generate_heading($heading);

            // Starting table-body div
            $data['time_table'] .= self::START_TABS.'
'."\n";

            // Timestamp Data
            $times = $this->Timestamp->get_timestamps();

            // Defining an empty-cell
            $empty_cell = '

'."\n";

            // Creating table rows & formatting date and times
            foreach ($times as $time){
                $formattedDate = nice_date($time['date'], 'm.d.y');
                $formattedStart = date("g:i A", strtotime($time['start']));
                $formattedEnd = date("g:i A", strtotime($time['end']));

                // TODO: Calculate timespan between start to end & add to total_time var
                $startTime = DateTime::createFromFormat('H:i:s', $time['start']);
                $endTime = DateTime::createFromFormat('H:i:s', $time['end']);

                $interval = new DateInterval('PT'.$startTime->format('h').'H'.$startTime->format('i').'M');
                $endTime->sub($interval);

                // End time as an interval
                $interval = new DateInterval('PT'.$endTime->format('h').'H'.$endTime->format('i').'M');
                $data['total_time']->add($interval);

                // Adding New Row
                $data['time_table'] .= self::START_TABS."\t
\n";
                $data['time_table'] .= self::START_TABS."\t\t".'
'.$formattedDate."
\n";
                $data['time_table'] .= self::START_TABS."\t\t".$empty_cell."\n";
                $data['time_table'] .= self::START_TABS."\t\t".'
'.$formattedStart."
\n";
                $data['time_table'] .= self::START_TABS."\t\t".'
'.$formattedEnd."
\n";
                $data['time_table'] .= self::START_TABS."\t\t".$empty_cell."\n";
                $data['time_table'] .= self::START_TABS."\t\t".'
'.$time['name']."
\n";
                $data['time_table'] .= self::START_TABS."\t\t".'
'.$time['section_id']."
\n";
                $data['time_table'] .= self::START_TABS."\t
"."\n";
            }

            // Closing Tags
            $data['time_table'] .= self::START_TABS."
\n";
            $data['time_table'] .= "\t\t\t
\n";

            // Formatting Total Time
            if(count($times) > 0){
                $data['total_time'] = $data['total_time']->format('h'). "hrs ". $data['total_time']->format('i'). "min";
            }else{
                $data['total_time'] = 0;
            }

            return $data;
        } // End of create_time_table

        /**
         * [create_unfinished_table description]
         * @param  Array data - Reference to an associative array
         * @param Array assignments - Array of assignment objects from db
         * @return [type]       [description]
         */
        private function create_unfinished_table(&$data, $assignments){
            $data['unfinished_table'] = '
'."\n";

            $heading = array("Assignment", "Started", "");
            $data['unfinished_table'] .= $this->generate_heading($heading);

            // Opening table-body
            $data['unfinished_table'] .= self::START_TABS.'
'."\n";

            foreach($assignments as $assign){

                $formattedDate = nice_date($assign['started'], 'm.d.y');

                $data['unfinished_table'] .= self::START_TABS."\t
\n";
                $data['unfinished_table'] .= self::START_TABS."\t\t".'
'.$assign['name']."
\n";

                $data['unfinished_table'] .= self::START_TABS."\t\t".'
'.$formattedDate."
\n";
                $data['unfinished_table'] .= self::START_TABS."\t\t".'
'."
\n";
                // TODO: Add links to assignments
                $data['unfinished_table'] .= self::START_TABS."\t\t".'
'.
                    ''.''."
\n";
                $data['unfinished_table'] .= self::START_TABS."\t
"."\n";
            }

            // Closing Tags
            $data['unfinished_table'] .= self::START_TABS."
\n";
            $data['unfinished_table'] .= "\t\t\t
\n";

            return $data;
        } // End of create_unfinished_table

        /**
         * [create_finished_table description]
         * @param  &Array data - Reference to an associative array
         * @param Array assignments - Array of assignment objects from db
         * @return [type]       [description]
         */
        private function create_finished_table(&$data, $assignments){
            $data['finished_table'] = '
'."\n";

            $heading = array("Assignment", "Completed", "");
            $data['finished_table'] .= $this->generate_heading($heading);

            // Opening table-body
            $data['finished_table'] .= self::START_TABS.'
'."\n";

            foreach($assignments as $assign){

                $formattedDate = nice_date($assign['completed'], 'm.d.y');

                $data['finished_table'] .= self::START_TABS."\t
\n";
                $data['finished_table'] .= self::START_TABS."\t\t".'
'.$assign['name']."
\n";

                $data['finished_table'] .= self::START_TABS."\t\t".'
'.$formattedDate."
\n";
                $data['finished_table'] .= self::START_TABS."\t\t".'
'."
\n";
                // TODO: Add links to assignments
                $data['finished_table'] .= self::START_TABS."\t\t".'
'.
                    ''.''."
\n";
                $data['finished_table'] .= self::START_TABS."\t
"."\n";
            }

            // Closing Tags
            $data['finished_table'] .= self::START_TABS."
\n";
            $data['finished_table'] .= "\t\t\t
\n";
        } // End of create_finished_table

    } // End of Dashboard
?>


text:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record id="hr_payroll.hr_employee_payroll" model="hr.employee">
            <field name="address_home_id" ref="base.res_partner_main2"/>
        </record>

    </data>
</openerp>

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.databasemigrationservice.model;

import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 */
public class DeleteReplicationTaskRequest extends AmazonWebServiceRequest
        implements Serializable, Cloneable {

    /**
     *

     * The Amazon Resource Name (ARN) of the replication task to be deleted.
     *

     */
    private String replicationTaskArn;

    /**
     *

     * The Amazon Resource Name (ARN) of the replication task to be deleted.
     *

     *
     * @param replicationTaskArn
     *        The Amazon Resource Name (ARN) of the replication task to be
     *        deleted.
     */

    public void setReplicationTaskArn(String replicationTaskArn) {
        this.replicationTaskArn = replicationTaskArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the replication task to be deleted.
     *

     *
     * @return The Amazon Resource Name (ARN) of the replication task to be
     *         deleted.
     */

    public String getReplicationTaskArn() {
        return this.replicationTaskArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the replication task to be deleted.
     *

     *
     * @param replicationTaskArn
     *        The Amazon Resource Name (ARN) of the replication task to be
     *        deleted.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public DeleteReplicationTaskRequest withReplicationTaskArn(
            String replicationTaskArn) {
        setReplicationTaskArn(replicationTaskArn);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getReplicationTaskArn() != null)
            sb.append("ReplicationTaskArn: " + getReplicationTaskArn());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DeleteReplicationTaskRequest == false)
            return false;
        DeleteReplicationTaskRequest other = (DeleteReplicationTaskRequest) obj;
        if (other.getReplicationTaskArn() == null
                ^ this.getReplicationTaskArn() == null)
            return false;
        if (other.getReplicationTaskArn() != null
                && other.getReplicationTaskArn().equals(
                        this.getReplicationTaskArn()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime
                * hashCode
                + ((getReplicationTaskArn() == null) ? 0
                        : getReplicationTaskArn().hashCode());
        return hashCode;
    }

    @Override
    public DeleteReplicationTaskRequest clone() {
        return (DeleteReplicationTaskRequest) super.clone();
    }
}


text:
console.log('dd')
var mWidth = 0;
var mHeight = 0;
var maxFacesTracker = 0;
var maxFacesDetector = 0;
var numOfFaces = 0;
var faceIndex = 0;
var trackerStatus = 0;
var m_Tracker;
//
var TrackingQualityDELTA = [];
var TrackingQualityList = [];
var currentTrackingQuality = [];
//
var TfaceDataNoseOld = [];

let width = 800;
let height = 800;

console.log('123')
licenseName = "284-242-592-068-833-593-311-021-182-111-320.vlc"
licenseURL = "./284-242-592-068-833-593-311-021-182-111-320.vlc"
maxFacesTracker = 1
console.log('qq')

var locateFile = function(dataFileName) {var relativePath = "./lib/"+ dataFileName; console.log(relativePath); return relativePath};
var VisageModule = VisageModule({onRuntimeInitialized: onModuleInitialized, locateFile: locateFile});
var preloadFiles = function() {
        VisageModule.FS_createPreloadedFile('/', licenseName, licenseURL, true, false, function() { console.log("load success") },  function(){ console.log("Loading License Failed!") });
       	VisageModule.FS_createPreloadedFile('/', 'Facial Features Tracker - High.cfg', "./lib/Facial Features Tracker - High.cfg", true, false);
	  	VisageModule.FS_createPreloadedFile('/', 'Face Detector.cfg', "./lib/Face Detector.cfg", true, false);
		VisageModule.FS_createPreloadedFile('/', 'Head Tracker.cfg', "./lib/Head Tracker.cfg", true, false);
	  };
VisageModule.preRun.push(preloadFiles);
console.log('ww')

//importScripts('../../lib/visageAnalysisData.js');

function onModuleInitialized()
{

	//  300*300 = frame width*height
	ppixels = VisageModule._malloc(height*width*4);
	pixels = new Uint8ClampedArray(VisageModule.HEAPU8.buffer, ppixels, height*width*4);

	alert = function(msg)
	{
		console.log(msg);
	}

    VisageModule.initializeLicenseManager(licenseName);
    console.log('kk')

	m_Tracker = new VisageModule.VisageTracker("Facial Features Tracker - High.cfg");
	m_Detector = new VisageModule.VisageDetector();

	m_faceDataArray = new VisageModule.FaceDataVector();
	m_DfaceDataArray = new VisageModule.FaceDataVector();
	for (var i = 0; i < maxFacesTracker; ++i)
	{
		m_faceDataArray.push_back(new VisageModule.FaceData());
	}

	for(var i = 0; i < maxFacesDetector; ++i)
	{
		m_DfaceDataArray.push_back(new VisageModule.FaceData());
	}

	for(var i = 0; i < maxFacesTracker; ++i)
	{
		TrackingQualityDELTA[i] = 0;
		TrackingQualityList[i] = [];
		currentTrackingQuality[i] = 0;

		TfaceDataNoseOld[i] = [];
	}

	self.postMessage({aTopic:'initialization done'});
	console.log("done")
}


text:
<?php

namespace Acme\ServicesBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    public function indexAction()
    {

        return $this->render('AcmeServicesBundle:Default:index.html.twig', array(
        	'name' => "$name"
        ));
    }

    public function viewAction($name)
    {
        return $this->render('AcmeServicesBundle:Default:view.html.twig', array('name' => $name));
    }
}


text:
/* ==========================================================================
   App tests
   ========================================================================== */

var $template = '                                                                                \
                                                                                \
    <form name="booking_request_form" id="new_booking_request" data-toggle="validator" role="form"                                          \
          action="https://www.blacklane.com/en/booking_requests/transfers/new" accept-charset="UTF-8" method="get">                         \
        <input name="utf8" type="hidden" value="✓">                                                                                \

                                                                              \
            <input class="mustCheck form-control" type="text" id="pickup" name="booking_request[pickup]"                                    \
                   title="" data-map-container-id="dialogMap1" required data-hasaddressstreetnumber="true">                                 \

                                                                                \

                                                                                \

                                                                              \
            <input class="mustCheck form-control" type="text" id="dropoff" name="booking_request[dropoff]"                                  \
                   title="" data-map-container-id="dialogMap2" required data-hasaddressstreetnumber="true">                                 \

                                                                                \

                                                                                \

                                                                                \
            <input class="mustCheck datepicker form-control" title="" id="at_date" type="date" name="at_date" required>                     \

                                                                                \

                                                                                \

                                                                                \
            <input class="mustCheck timepicker form-control" type="time" id="at_time" name="at_time" required>                              \

                                                                                \

                                                                                \

                                                                              \
            <input class="mustCheck form-control" type="text" id="return_pickup" name="booking_request[return_pickup]"                      \
                   title="" data-map-container-id="dialogMap3" required data-hasaddressstreetnumber="true">                                 \

                                                                                \

                                                                                \

                                                                              \
            <input class="mustCheck form-control" type="text" id="return_dropoff" name="booking_request[return_dropoff]"                    \
                   title="" data-map-container-id="dialogMap4" required data-hasaddressstreetnumber="true">                                 \

                                                                                \

                                                                                \

                                                                                \
            <input class="mustCheck datepicker form-control" title="" type="date" id="return_at_date"                                       \
                   name="return_at_date" required data-datebigger="#at_date">                                                               \

                                                                                \

                                                                                \

                                                                                \
            <input class="mustCheck timepicker form-control" type="time" id="return_at_time" name="return_at_time" required>                \

                                                                                \

                                                                                \
    </form>                                                                                \
                                                                                \
                                                                                \
', $DOM =$('#qunit-fixture');

QUnit.module('AppTest setup', {
    beforeEach: function () {
        $DOM.append($template);
        App.initValidation();
        $.fn.validator.Constructor.INPUT_SELECTOR = 'input.mustCheck';

        App.initForm();
    },
    afterEach: function () {
        $DOM.empty();
    }
});

QUnit.test('Validation & Custom', function (assert) {

    var validators = $.fn.validator.Constructor.VALIDATORS

    assert.ok(!!validators.hasaddressstreetnumber, "'Has address street number' Appent to Validators Collection")
    assert.ok(!!validators.datebigger, "'datebigger' Appent to Validators Collection")

    var validator = $('#new_booking_request').data('bs.validator');
    assert.ok(!!validator, 'validator is Run');
    assert.ok(validator.$inputs.length === 8, 'validator Active For 8 Inputs ')
    var date1 = $('#return_at_date');
    assert.ok(validators.datebigger(date1) === false, 'at_date and Return_at_date are equal togeth3r')
    var date2 = $('#at_date');
    var date = new Date();
    date2.pickadate('picker').set("select", date.setTime(date.getTime() + 3 * 86400000));

    assert.ok(validators.datebigger(date1) != false, 'at_date is bigger than Return_at_date ');
    var $pickup = $('#pickup');
    $pickup.val("Lobeckstraße, 10969 Berlin, Germany");
    var done1 = assert.async();
    validators.hasaddressstreetnumber($pickup).then(function (error) {
        assert.ok(!!error, "'Lobeckstraße, 10969 Berlin, Germany' doesn't have street number");
        done1();
    });
    $pickup.val("Lobeckstraße 64, 10969 Berlin, Germany");
    var done2 = assert.async();
    validators.hasaddressstreetnumber($pickup).then(function (error) {
        assert.ok(!error, "'Lobeckstraße 64, 10969 Berlin, Germany' has street number");
        done2();
    });
});

QUnit.test('Form', function (assert) {

    $(".locationpicker input").each(function () {
        assert.ok(!!$(this).data('placepicker'), 'placepicker is active on ' + this.name);
    });

    assert.ok(!!$('#return_at_date').pickadate('picker'), 'pickadate is active on return_at_date');
    assert.ok(!!$('#at_date').pickadate('picker'), 'pickadate is active on at_date');
    assert.ok(!!$('#return_at_time').pickatime('picker'), 'pickatime is active on return_at_time');
    assert.ok(!!$('#at_time').pickatime('picker'), 'pickatime is active on at_time');
});


text:
package org.apache.river.test.impl.mercury;

import java.util.logging.Level;

import java.rmi.RemoteException;
import java.rmi.NoSuchObjectException;
import java.rmi.ServerException;
import java.util.Date;

import net.jini.core.lease.Lease;
import net.jini.core.lease.UnknownLeaseException;
import net.jini.core.event.EventRegistration;
import net.jini.core.event.RemoteEvent;
import net.jini.core.event.RemoteEventListener;
import net.jini.event.EventMailbox;
import net.jini.event.MailboxRegistration;
import net.jini.lookup.entry.Name;
import net.jini.space.JavaSpace;

import org.apache.river.qa.harness.QAConfig;
import org.apache.river.constants.TimeConstants;
import org.apache.river.qa.harness.Test;

public class InterOpTest extends EMSTestBase implements TimeConstants {

    //
    // This should be long enough to sensibly run the test.
    // If the service doesn't grant long enough leases, then
    // we might have to resort to using something like the
    // LeaseRenewalManager to keep our leases current.
    //

    private final int NUM_EVENTS = 1;
    private final long MAX_WAIT = NUM_EVENTS * SECONDS * 80;
    private final long DURATION = MAX_WAIT * 10;

    public void run() throws Exception {
	int i;

	logger.log(Level.INFO, "Starting up " + this.getClass().toString());

	specifyServices(new Class[]{EventMailbox.class, JavaSpace.class});
	logger.log(Level.INFO, "Getting EventMailbox reference");
	EventMailbox mb = (EventMailbox)services[0];
	logger.log(Level.INFO, "Getting JavaSpace reference");
	JavaSpace space = (JavaSpace)services[1];

	// Register and check lease
	logger.log(Level.INFO, "Creating MailboxRegistration");
	MailboxRegistration mr =  getRegistration(mb, DURATION);
	checkLease(getMailboxLease(mr), DURATION);
	addLease(getMailboxLease(mr), false);

	logger.log(Level.INFO, "Getting mailbox listener");
	RemoteEventListener mbRel = getMailboxListener(mr);

	logger.log(Level.INFO, "Getting our own listener");
	TestListener listener = TestUtils.createListener(getManager());

	//Setup space to generate events
	logger.log(Level.INFO, "Setting up space notifications");
	EventRegistration er = space.notify(null, null, mbRel, DURATION, null);
	checkLease(er.getLease(), DURATION);
	addLease(er.getLease(), false);

	logger.log(Level.INFO, "Generating some events");
	for (i = 0; i < NUM_EVENTS; i++) {
	    addLease(space.write(new Name("Duh"), null, DURATION), false);
	}

	//Note: JavaSpaces is allowed to compact event notifications.
	// That is, if more than one event is scheduled to be delivered
	// for the same notification target, then the one with the latest
	// sequence number can be sent (alone). Therefore, for
	// NUM_EVENTS > 1, you'll need to add some sort of delay factor
	// in order to prevent multiple notifications from beng queue'd
	// up together on the space side of the house.
	logger.log(Level.INFO, "Checking event count befor enabling");
	int eventCount = 0;
	assertCount(listener, eventCount);

	logger.log(Level.INFO, "Enabling delivery");
	mr.enableDelivery(listener);
	eventCount += NUM_EVENTS;
	logger.log(Level.INFO, "Waiting for event delivery");
	waitForEvents(listener, eventCount, MAX_WAIT);
	logger.log(Level.INFO, "Verifying event delivery");
	assertCount(listener, eventCount);

	logger.log(Level.INFO, "Generating some more events");
	for (i = 0; i < NUM_EVENTS; i++) {
	    addLease(space.write(new Name("Yah"), null, DURATION), false);
	}

	eventCount += NUM_EVENTS;
	logger.log(Level.INFO, "Waiting for event delivery");
	waitForEvents(listener, eventCount, MAX_WAIT);
	logger.log(Level.INFO, "Verifying event delivery");
	assertCount(listener, eventCount);

	shutdown(0); // Mailbox is at index 0;

	logger.log(Level.INFO, "Generating some more events");
	for (i = 0; i < NUM_EVENTS; i++) {
	    addLease(space.write(new Name("Yah"), null, DURATION), false);
	}

	eventCount += NUM_EVENTS;
	logger.log(Level.INFO, "Waiting for event delivery");
	waitForEvents(listener, eventCount, MAX_WAIT);
	logger.log(Level.INFO, "Verifying event delivery");
	assertCount(listener, eventCount);
    }

    /**
     * Invoke parent's construct and parser
     * @exception TestException will usually indicate an "unresolved"
     *  condition because at this point the test has not yet begun.
     */
    public Test construct(QAConfig sysConfig) throws Exception {
	super.construct(sysConfig);
	parse();
        return this;
    }
}


text:
<?php

namespace OCA\Files\BackgroundJob;

use OC\BackgroundJob\TimedJob;
use OC\Lock\DBLockingProvider;

/**
 * Clean up all file locks that are expired for the DB file locking provider
 */
class CleanupFileLocks extends TimedJob {

	/**
	 * Default interval in minutes
	 *
	 * @var int $defaultIntervalMin
	 **/
	protected $defaultIntervalMin = 5;

	/**
	 * sets the correct interval for this timed job
	 */
	public function __construct() {
		$this->interval = $this->defaultIntervalMin * 60;
	}

	/**
	 * Makes the background job do its work
	 *
	 * @param array $argument unused argument
	 */
	public function run($argument) {
		$lockingProvider = \OC::$server->getLockingProvider();
		if ($lockingProvider instanceof DBLockingProvider) {
			$lockingProvider->cleanExpiredLocks();
		}
	}
}


text:
namespace spicy {

class Grammar;

/// Base class for all grammar productions.
class Production : public Node {
    AST_RTTI
public:
    typedef std::list<shared_ptr<Production>> production_list;

    /// Constructor.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// type: An optional type associated with this production.
    ///
    /// l: Associated location.
    Production(const string& symbol, shared_ptr<Type> type, const Location& l = Location::None);

    /// Returns the symbol asssociated with the production.
    const string& symbol() const;

    /// Returns the type associated with this rule.
    shared_ptr<Type> type() const;

    /// Returns the location associated with the production, or Location::None
    /// if none.
    const Location& location() const;

    /// Returns true if it's possible to derive the production to an Epsilon
    /// production. Note that it doesn't \a always need to do so, just one
    /// possible derivation is sufficient.
    virtual bool nullable() const;

    /// Returns true if running out of data while parsing this production
    /// should not be considered an error.
    ///
    /// Can be overridden by derived classes. The default implmentation
    /// returns true iff the producion is nullable().
    virtual bool eodOk() const;

    /// Returns a readable representation of the production, suitable to
    /// include in error message and debugging output.
    string render() override;

    /// Returns true if this production does not recursively contain other
    /// instructions.
    virtual bool atomic() const = 0;

    /// Returns true if this production is flagged by the user as ok to be
    /// parsed in synchronization mode (i.e., after a parser error, or in DPD
    /// mode, it knows how to find a subsequent point in the input stream
    /// where it can continue normally). This is independent of whether the
    /// production actually supports that.
    bool maySynchronize();

    /// Returns true if this production in principle supports being parsed in
    /// synchronization mode (i.e., after a parser error, or in DPD mode, it
    /// knows how to find a subsequent point in the input stream where it can
    /// continue normally). This is independent of whether the user has
    /// requested to activate that support.
    ///
    /// The default implemementation returns false.
    virtual bool supportsSynchronize();

    /// If this production corresponds to a container's item field, sets the
    /// container.
    void setContainer(shared_ptr<type::unit::item::field::Container> c);

    /// If this production corresponds to a container's item field, returns
    /// the container.
    shared_ptr<type::unit::item::field::Container> container() const;

    /// A struct for the parser generator to associate information with a
    /// production.
    struct ParserGenMeta {
        /// A unit field associated with the production.
        shared_ptr<type::unit::item::Field> field = nullptr;

        /// If the production corresponds to a for-each hook, this stores the
        /// corresponding field.
        shared_ptr<type::unit::item::Field> for_each = nullptr;
    };

    /// Returns a pointer to the production's meta information maintained
    /// during parser generation. The parser generated can manipulate the
    /// fields in there directly as necessary.
    ParserGenMeta* pgMeta();

    ACCEPT_VISITOR_ROOT();

protected:
    friend class Grammar;

    /// Returns a readable representation of the production. Must be
    /// overridden by derived classes and will be called by render() (though
    /// that may chose to skip it and refer to the production just by its
    /// symbol).
    virtual string renderProduction() const = 0;

    /// May attempt to simplify the production's internal representation. The
    /// default does nothing.
    virtual void simplify();

    /// Rename the production.
    void setSymbol(const string& sym);

private:
    shared_ptr<Type> _type;
    shared_ptr<type::unit::item::field::Container> _container;

    string _symbol;
    ParserGenMeta _pgmeta;
    Location _location;
};

namespace production {

/// An empty production.
class Epsilon : public Production {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// l: Associated location.
    Epsilon(const Location& l = Location::None);

    ACCEPT_VISITOR(Production);

protected:
    string renderProduction() const override;
    bool nullable() const override;
    bool atomic() const override;
};

/// Base class for terminals.
class Terminal : public Production {
    AST_RTTI
public:
    typedef void (*filter_func)(); // TODO

    /// Constructor.
    ///
    /// type: An optional type associated with this production.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// expr: An optional expression that will be evaluated after the terminal
    /// has been parsed but before its value is assigned to its destination
    /// variable. If the expression is given, *its* value is actually assigned
    /// to the destination variable instead (and also determined the type of
    /// that). This can be used, e.g., into coerce the parsed value into a
    /// different type.
    ///
    /// filter: An optional function called when a value has been parsed for
    /// this terminatal. The function's return value is then used instead of the
    /// parsed value subsequently.
    ///
    /// l: Associated location.
    Terminal(const string& symbol, shared_ptr<Type> type, shared_ptr<Expression> expr,
             filter_func filter, const Location& l = Location::None);

    /// Returns the filter associated with the terminal.
    filter_func filter() const;

    /// Returns the expression associated with the terminal.
    shared_ptr<Expression> expression() const;

    /// Associates a sink with the terminal.
    ///
    /// sink: An expression refercing the sink that parsed data should be
    /// forwarded to.
    void setSink(shared_ptr<Expression> sink);

    /// Returns the sink associated with the terminal, or null if none.
    shared_ptr<Expression> sink() const;

    ACCEPT_VISITOR(Production);

    /// Returns a unique ID for this terminal. The ID is unique across all
    /// grammars and guaranteed to be positive.
    int tokenID() const;

    /// XXX
    virtual string renderTerminal() const = 0;

protected:
    bool atomic() const override;

private:
    filter_func _filter;
    shared_ptr<Expression> _sink = nullptr;
    shared_ptr<Expression> _expr = nullptr;

    mutable int _id;
    static std::map<string, int> _token_ids;
};

/// Base class for a literal. A literal is anythig which can be directly
/// scanned for as a sequence of bytes.
class Literal : public Terminal {
    AST_RTTI
public:
    typedef ctor::RegExp::pattern_list pattern_list;

    /// Constructor. A literal is a production that can be parsed via one or
    /// more regular expressions.
    ///
    /// type: The literal's type. Can be null of \a expr is given (if so,
    /// it's ignored and the expression's type is taken).
    ///
    /// expr: An optional expression that will be evaluated after the
    /// terminal has been parsed but before its value is assigned to its
    /// destination variable. If the expression is given, *its* value is
    /// actually assigned to the destination variable instead (and also
    /// determined the type of that). This can be used, e.g., into coerce the
    /// parsed value into a different type.
    ///
    /// filter: An optional function called when a value has been parsed for
    /// this terminatal. The function's return value is then used instead of
    /// the parsed value subsequently.
    ///
    /// l: Associated location.
    Literal(const string& symbol, shared_ptr<Type> type, shared_ptr<Expression> expr = nullptr,
            filter_func filter = nullptr, const Location& l = Location::None);

    /// Returns an expression representing the literal.
    virtual shared_ptr<Expression> literal() const = 0;

    /// Returns a set of regular expressions corresponding to the literal.
    virtual pattern_list patterns() const = 0;

    bool supportsSynchronize() override;
    string renderTerminal() const override;

    ACCEPT_VISITOR(Terminal);
};

/// A literal represented by a constant.
class Constant : public Literal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// constant: The constant.
    ///
    /// l: Associated location.
    Constant(const string& symbol, shared_ptr<spicy::Constant> constant,
             shared_ptr<Expression> expr = nullptr, filter_func filter = nullptr,
             const Location& l = Location::None);

    /// Returns the literal.
    shared_ptr<spicy::Constant> constant() const;

    shared_ptr<Expression> literal() const override;
    pattern_list patterns() const override;

    ACCEPT_VISITOR(Literal);

protected:
    string renderProduction() const override;

private:
    shared_ptr<spicy::Constant> _const;
};

/// A literal represented by a ctor.
class Ctor : public Literal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// ctor: The ctor.
    ///
    /// l: Associated location.
    Ctor(const string& symbol, shared_ptr<spicy::Ctor> ctor, shared_ptr<Expression> expr = nullptr,
         filter_func filter = nullptr, const Location& l = Location::None);

    /// Returns the literal.
    shared_ptr<spicy::Ctor> ctor() const;

    shared_ptr<Expression> literal() const override;
    pattern_list patterns() const override;

    ACCEPT_VISITOR(Literal);

protected:
    string renderProduction() const override;

private:
    shared_ptr<spicy::Ctor> _ctor;
};

/// A literal represented by a type. Note that normally types aren't
/// literals; they can only if the parsing can for tell that a instance of
/// the type is coming up, i.e., supports look-ahead (as, e.g., in the case
/// of embedded objects).
class TypeLiteral : public Literal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// type: The type.
    ///
    /// l: Associated location.
    TypeLiteral(const string& symbol, shared_ptr<spicy::Type> type,
                shared_ptr<Expression> expr = nullptr, filter_func filter = nullptr,
                const Location& l = Location::None);

    /// Returns the type.
    shared_ptr<spicy::Type> type() const;

    shared_ptr<Expression> literal() const override;
    pattern_list patterns() const override;

    ACCEPT_VISITOR(Literal);

protected:
    string renderProduction() const override;

private:
    shared_ptr<spicy::Type> _type;
};

/// A variable. A variable is a terminal that will be parsed from the input
/// stream according to its type, yet is not recognizable as such in advance
/// by just looking at the available bytes. If we start parsing, we assume it
/// will match (and if not, generate a parse error).
class Variable : public Terminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// type: The type of the variable.
    ///
    /// expr: An optional expression that will be evaluated after the terminal
    /// has been parsed but before its value is assigned to its destination
    /// variable. If the expression is given, *its* value is actually assigned
    /// to the destination variable instead (and also determined the type of
    /// that). This can be used, e.g., into coerce the parsed value into a
    /// different type.
    ///
    /// filter: An optional function called when a value has been parsed for
    /// this terminatal. The function's return value is then used instead of the
    /// parsed value subsequently.
    ///
    /// l: Associated location.
    Variable(const string& symbol, shared_ptr<Type> type, shared_ptr<Expression> expr = nullptr,
             filter_func filter = nullptr, const Location& l = Location::None);

    ACCEPT_VISITOR(Terminal);

    string renderTerminal() const override;

protected:
    string renderProduction() const override;
};

/// Base class for non-terminals.
class NonTerminal : public Production {
    AST_RTTI
public:
    typedef std::list<production_list> alternative_list;

    /// Constructor.
    ///
    /// type: An optional type associated with this production.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    NonTerminal(const string& symbol, shared_ptr<Type> type, const Location& l = Location::None);

    /// Returns a list of RHS alternatives for this production. Each RHS is
    /// itself a list of Production instances.
    virtual alternative_list rhss() const = 0;

    ACCEPT_VISITOR(Production);

protected:
    bool atomic() const override;
    bool nullable() const override;
};

/// A type described by another grammar from an independent type::Unit type.
class ChildGrammar : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// child: The production for the child unit type, corresponding to *child*.
    ///
    /// type: The unit type.
    ///
    /// l: Associated location.
    ChildGrammar(const string& symbol, shared_ptr<Production> child, shared_ptr<type::Unit> type,
                 const Location& l = Location::None);

    /// Returns the child production.
    shared_ptr<Production> child() const;

    /// Returns the child type.
    shared_ptr<type::Unit> childType() const;

#if 0
    typedef std::list<shared_ptr<Expression>> expression_list;

    /// Sets a list of parameters passed into the parser for the child grammar.
    ///
    /// params: The expressions to evaluate to get the parameters.
    void setParameters(const expression_list& params);

    /// Returns a list of parameters to pass into the parser for the child
    /// grammar.
    const expression_list& parameters() const;
#endif

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;
    bool supportsSynchronize() override;

private:
    node_ptr<Production> _child;
    // expression_list _params;
};

/// A wrapper that forwards directly to another grammar (within the same unit
/// type). This can be used to hook into starting/finishing parsing that
/// other grammar.
class Enclosure : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// child: The enclosed child production.
    ///
    /// type: The unit type.
    ///
    /// l: Associated location.
    Enclosure(const string& symbol, shared_ptr<Production> child,
              const Location& l = Location::None);

    /// Returns the enclosed child production.
    shared_ptr<Production> child() const;

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;
    bool supportsSynchronize() override;

private:
    node_ptr<Production> _child;
};

/// A sequence of other productions.
class Sequence : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// seq: list of ~~Production - The sequence of productions.
    ///
    /// type: An optional type associated with this production.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    ///
    /// .. todo: Does this class need the \a type parameter?
    Sequence(const string& symbol, const production_list& seq, shared_ptr<Type> type = nullptr,
             const Location& l = Location::None);

    /// Returns the production sequence.
    production_list sequence() const;

    /// Adds a production to the sequence.
    ///
    /// prod: The production to add to the end of the sequence.
    void add(shared_ptr<Production> prod);

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;
    bool supportsSynchronize() override;

private:
    std::list<node_ptr<Production>> _seq;
};

/// A pair of alternatives between which we can decide with one token of
/// look-ahead.
class LookAhead : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// alt1: The first alternative.
    ///
    /// alt2: The first alternative.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    LookAhead(const string& symbol, shared_ptr<Production> alt1, shared_ptr<Production> alt2,
              const Location& l = Location::None);

    typedef std::set<shared_ptr<Terminal>> look_aheads;

    /// Returns the look-aheads for the two alternatives. This function must
    /// only be called after the instance has been added to a ~Grammar, as
    /// that's when the look-aheads are computed.
    ///
    /// Returns: a pair of sets representing the look-aheads for the first and
    /// second alternative, respectively. Each set contains the ~~Literals for
    /// which the corresponding alternative should be selected.
    std::pair<look_aheads, look_aheads> lookAheads() const;

    /// Returns a boolean for each alternative indicating whether the
    /// corresponding look-ahead set is the default case. Any variable
    /// production is automatically considered a default, others may be
    /// marked as such via setDefaultAlternative().
    std::pair<bool, bool> defaultAlternatives();

    /// Returns the two alternatives.
    std::pair<shared_ptr<Production>, shared_ptr<Production>> alternatives() const;

    /// Sets the two alternatives.
    ///
    /// alt1: The first alternative.
    ///
    /// alt2: The first alternative.
    void setAlternatives(shared_ptr<Production> alt1, shared_ptr<Production> alt2);

    // Marks one of the two alterantives as default. Note that any variable
    // production is automatically considered a default, independent of this
    // setting.
    //
    // i: 1 sets alternative 1 to default, 2 alternative 2; anything set
    // neither to be a default.
    void setDefaultAlternative(int i);

    ACCEPT_VISITOR(NonTerminal);

protected:
    friend class ::spicy::Grammar;

    /// Sets the look-ahead sets for the two alternative. Called from the
    /// Grammar calss when it computes the parsing tables.
    void setLookAheads(const look_aheads& lah1, const look_aheads& lah2);

    string renderProduction() const override;
    alternative_list rhss() const override;
    bool supportsSynchronize() override;

private:
    int _default = 0;
    std::pair<look_aheads, look_aheads> _lahs;
    node_ptr<Production> _alt1;
    node_ptr<Production> _alt2;
};

/// A pair of alternatives between which we decide based on a boolean
/// expression.
class Boolean : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// expr: An expression of type type::Bool.
    ///
    /// alt1: The first alternative to select if \a expr is \a true.
    ///
    /// alt2: The second alternative to select if \a expr is \a false.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    Boolean(const string& symbol, shared_ptr<Expression> expr, shared_ptr<Production> alt1,
            shared_ptr<Production> alt2, const Location& l = Location::None);

    /// Returns the expression associated with the boolean production.
    shared_ptr<Expression> expression() const;

    /// Returns the two alternatives as a tuple. The first element is for the
    /// \a true case, the second for \a false.
    std::pair<shared_ptr<Production>, shared_ptr<Production>> branches() const;

    bool eodOk() const override;

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;

private:
    shared_ptr<Expression> _expr;
    node_ptr<Production> _alt1;
    node_ptr<Production> _alt2;
};

/// A production executing a given number of times.
class Counter : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// expr: An expression of an integer type that limits the number of times
    /// the production is parsed.
    ///
    /// body: The production to be repeated.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    Counter(const string& symbol, shared_ptr<Expression> expr, shared_ptr<Production> body,
            const Location& l = Location::None);

    /// Destructor.
    virtual ~Counter();

    /// Returns the counter expression.
    shared_ptr<spicy::Expression> expression() const;

    /// Returns the counter body production.
    shared_ptr<Production> body() const;

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;

private:
    shared_ptr<Expression> _expr;
    node_ptr<Production> _body;
};

/// A production that parses a byte block of a given length with another production.
class ByteBlock : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// expr: An expression of an integer type that specifies the number of
    /// bytes to parse.
    ///
    /// body: The production to be parse the byte block with.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    ByteBlock(const string& symbol, shared_ptr<Expression> expr, shared_ptr<Production> body,
              const Location& l = Location::None);

    /// Returns the length expression.
    shared_ptr<spicy::Expression> expression() const;

    /// Returns the counter body production.
    shared_ptr<Production> body() const;

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;

private:
    shared_ptr<Expression> _expr;
    node_ptr<Production> _body;
};

/// A production executing as long as condition is true.
class While : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// expr: An expression of type ~~Bool controlling the loop.
    ///
    /// body: The production to be repeated.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    While(const string& symbol, shared_ptr<Expression> expr, shared_ptr<Production> body,
          const Location& l = Location::None);

    /// Returns the condition expression.
    shared_ptr<Expression> expression() const;

    /// Returns the loop body production.
    shared_ptr<Production> body() const;

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;
    bool supportsSynchronize() override;

private:
    shared_ptr<Expression> _expr;
    node_ptr<Production> _body;
};

/// A production executing until interrupted by a foreach hook.
class Loop : public NonTerminal {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// body: The production to be repeated.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// eod_ok: True if running out of data while being about to enter the
    /// next iteration is ok.
    ///
    /// l: Associated location.
    Loop(const string& symbol, shared_ptr<Production> body, bool eod_ok,
         const Location& l = Location::None);

    /// Returns the loop body production.
    shared_ptr<Production> body() const;

    bool eodOk() const override;

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;
    bool supportsSynchronize() override;

private:
    node_ptr<Production> _body;
    bool _eod_ok;
};

/// Alternatives between which we decide based on which value out of a set of
/// options is matched; plus a default if none.
class Switch : public NonTerminal {
    AST_RTTI
public:
    typedef std::list<std::pair<std::list<shared_ptr<Expression>>, shared_ptr<Production>>>
        case_list;

    /// Constructor.
    ///
    /// expr: An expression to switch on.
    ///
    /// cases: The alternatives. The value of \a *expr* is matched against the
    /// evaluated values of the expressions given in the list (which must be
    /// of the same type); if a match is found the corresponding production is
    /// selected.
    ///
    /// default_: Default production if none of \a cases matches. If None, a
    /// ~~ParseError will be generated if no other alternative matches.
    ///
    /// symbol: A symbol associated with the production. The symbol must be
    /// unique within the grammar the production is (or will be) part of.
    ///
    /// l: Associated location.
    Switch(const string& symbol, shared_ptr<Expression> expr, const case_list& cases,
           shared_ptr<Production> default_, const Location& l = Location::None);

    /// Returns the switch expression.
    shared_ptr<Expression> expression() const;

    /// Returns the alternatives.
    case_list alternatives() const;

    /// Returns the default production, or null if none.
    shared_ptr<Production> default_() const;

    bool eodOk() const override;

    ACCEPT_VISITOR(NonTerminal);

protected:
    string renderProduction() const override;
    alternative_list rhss() const override;

private:
    std::list<std::pair<std::list<shared_ptr<Expression>>, node_ptr<Production>>> _cases;
    shared_ptr<Expression> _expr;
    node_ptr<Production> _default;
};

/// An internal class representing a production to be resolved later. This is
/// for supporting recursive grammars.
class Unknown : public Production {
    AST_RTTI
public:
    /// Constructor.
    ///
    /// node: The node with which's production this unknown is to be replaced with later.
    Unknown(shared_ptr<Node> node);

    /// Returns the node that needs resolving.
    shared_ptr<Node> node() const;

    bool atomic() const override;

    ACCEPT_VISITOR(Production);

protected:
    string renderProduction() const override;

private:
    shared_ptr<Node> _node;
};
}
}

#endif


text:
import os
from django.test import TestCase
from data_importers.filehelpers import CsvHelper

class CsvHelperTest(TestCase):
    def test_parse_csv(self):
        helper = CsvHelper(
            os.path.join(os.path.dirname(__file__), "fixtures/csv_helper/test.csv")
        )
        data = helper.get_features()

        self.assertIsInstance(data[0], tuple)
        self.assertEqual("1", data[0].foo)
        self.assertEqual("2", data[0].b_a_r)
        self.assertEqual("3", data[0].baz)

        self.assertIsInstance(data[1], tuple)
        self.assertEqual("cheese", data[1].foo)
        self.assertEqual("peas", data[1].b_a_r)
        self.assertEqual("", data[1].baz)

        self.assertNotIn(2, data)


text:
/** \file stlsoft/meta/base_type_traits.hpp
 *
 * \brief [C++ only] Definition of the stlsoft::base_type_traits component
 *   (\ref group__library__meta "Template Meta-programming" Library).
 */

#ifndef STLSOFT_INCL_STLSOFT_META_HPP_BASE_TYPE_TRAITS
#define STLSOFT_INCL_STLSOFT_META_HPP_BASE_TYPE_TRAITS

#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_META_HPP_BASE_TYPE_TRAITS_MAJOR    4
# define STLSOFT_VER_STLSOFT_META_HPP_BASE_TYPE_TRAITS_MINOR    2
# define STLSOFT_VER_STLSOFT_META_HPP_BASE_TYPE_TRAITS_REVISION 1
# define STLSOFT_VER_STLSOFT_META_HPP_BASE_TYPE_TRAITS_EDIT     36
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/* /////////////////////////////////////////////////////////////////////////
 * Includes
 */

#ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
# include <stlsoft/stlsoft.h>
#endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */

/* /////////////////////////////////////////////////////////////////////////
 * Namespace
 */

#ifndef _STLSOFT_NO_NAMESPACE
namespace stlsoft
{
#endif /* _STLSOFT_NO_NAMESPACE */

/* /////////////////////////////////////////////////////////////////////////
 * Classes
 */

#ifdef STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT

# ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION

#  if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
template <ss_typename_param_k T>
struct base_type_traits_array_detector
{
    enum { value            =   0 };
};

template<   ss_typename_param_k T
        ,   ss_size_t           N
        >
struct base_type_traits_array_detector<T[N]>
{
    enum { value            =   1 };
};
#  endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

template <ss_typename_param_k T>
struct base_type_traits_pointer_detector
{
    enum { value            =   0 };
};

template <ss_typename_param_k T>
struct base_type_traits_pointer_detector<T*>
{
    enum { value            =   1 };
};
template <ss_typename_param_k T>
struct base_type_traits_pointer_detector<T const*>
{
    enum { value            =   1 };
};
template <ss_typename_param_k T>
struct base_type_traits_pointer_detector<T volatile*>
{
    enum { value            =   1 };
};
template <ss_typename_param_k T>
struct base_type_traits_pointer_detector<T const volatile*>
{
    enum { value            =   1 };
};

# endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/** \brief Deduces the base type
 *
 * \ingroup group__library__meta
 */
template <ss_typename_param_k T>
struct base_type_traits
{
    enum { is_pointer           =   base_type_traits_pointer_detector<T>::value };
    enum { is_reference         =   0 };
    enum { is_const             =   0 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T   base_type;
    typedef T   cv_type;
};

# ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION

// instance

# if !defined(STLSOFT_COMPILER_IS_BORLAND) || \
     __BORLANDC__ >= 0x0564

template <ss_typename_param_k T>
struct base_type_traits<const T>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   0 };
    enum { is_const             =   1 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T   base_type;
    typedef T   cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<volatile T>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   0 };
    enum { is_const             =   0 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T   base_type;
    typedef T   cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<const volatile T>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   0 };
    enum { is_const             =   1 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T   base_type;
    typedef T   cv_type;
};

# endif /* compiler */

// pointers

template <ss_typename_param_k T>
struct base_type_traits<T*>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   0 };
    enum { is_const             =   0 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T   base_type;
    typedef T   cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T const*>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   0 };
    enum { is_const             =   1 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   0   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T       base_type;
    typedef T const cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T volatile*>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   0 };
    enum { is_const             =   0 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   0   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T           base_type;
    typedef T volatile  cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T const volatile*>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   0 };
    enum { is_const             =   1 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   0   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T                   base_type;
    typedef T const volatile    cv_type;
};

// arrays

#  if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)

#if 0
template <ss_typename_param_k T, ss_size_t N>
struct base_type_traits<T[N]>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   0 };
    enum { is_const             =   0 };
    enum { is_volatile          =   0 };
    enum { is_array             =   1 };
    enum { is_array_or_pointer  =   1 };

    typedef T   base_type;
    typedef T   cv_type;
};

template <ss_typename_param_k T, ss_size_t N>
struct base_type_traits<T const[N]>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   0 };
    enum { is_const             =   1 };
    enum { is_volatile          =   0 };
    enum { is_array             =   1 };
    enum { is_array_or_pointer  =   1 };

    typedef T       base_type;
    typedef T const cv_type;
};

template <ss_typename_param_k T, ss_size_t N>
struct base_type_traits<T volatile[N]>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   0 };
    enum { is_const             =   0 };
    enum { is_volatile          =   1 };
    enum { is_array             =   1 };
    enum { is_array_or_pointer  =   1 };

    typedef T           base_type;
    typedef T volatile  cv_type;
};

template <ss_typename_param_k T, ss_size_t N>
struct base_type_traits<T const volatile[N]>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   0 };
    enum { is_const             =   1 };
    enum { is_volatile          =   1 };
    enum { is_array             =   1 };
    enum { is_array_or_pointer  =   1 };

    typedef T                   base_type;
    typedef T const volatile    cv_type;
};
#endif /* 0 */

#  endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

// references

template <ss_typename_param_k T>
struct base_type_traits<T&>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   1 };
    enum { is_const             =   0 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T   base_type;
    typedef T   cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T const&>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   1 };
    enum { is_const             =   1 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T       base_type;
    typedef T const cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T volatile&>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   1 };
    enum { is_const             =   0 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T           base_type;
    typedef T volatile  cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T const volatile&>
{
    enum { is_pointer           =   0 };
    enum { is_reference         =   1 };
    enum { is_const             =   1 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   0 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   base_type_traits_array_detector<T>::value   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T                   base_type;
    typedef T const volatile    cv_type;
};

// references to pointers

template <ss_typename_param_k T>
struct base_type_traits<T*&>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   1 };
    enum { is_const             =   0 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   0   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T   base_type;
    typedef T   cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T const*&>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   1 };
    enum { is_const             =   1 };
    enum { is_volatile          =   0 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   0   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T       base_type;
    typedef T const cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T volatile*&>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   1 };
    enum { is_const             =   0 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   0   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T           base_type;
    typedef T volatile  cv_type;
};

template <ss_typename_param_k T>
struct base_type_traits<T const volatile*&>
{
    enum { is_pointer           =   1 };
    enum { is_reference         =   1 };
    enum { is_const             =   1 };
    enum { is_volatile          =   1 };
    enum { is_array_or_pointer  =   1 };
#if defined(STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT)
    enum { is_array             =   0   };
#endif /* STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */

    typedef T                   base_type;
    typedef T const volatile    cv_type;
};

# endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

#else /* ? STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */

#endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */

/* /////////////////////////////////////////////////////////////////////////
 * Unit-testing
 */

#ifdef STLSOFT_UNITTEST
# include "./unittest/base_type_traits_unittest_.h"
#endif /* STLSOFT_UNITTEST */

/* ////////////////////////////////////////////////////////////////////// */

#ifndef _STLSOFT_NO_NAMESPACE
} // namespace stlsoft
#endif /* _STLSOFT_NO_NAMESPACE */

/* ////////////////////////////////////////////////////////////////////// */

#endif /* !STLSOFT_INCL_STLSOFT_META_HPP_BASE_TYPE_TRAITS */

/* ///////////////////////////// end of file //////////////////////////// */


text:
@interface YQMarginLabel : YQMarginView

@property (nonatomic, readonly) UILabel *contentLabel;

// 设置为圆角
- (void)makeRound;
- (void)makeRoundWithBoardColor:(UIColor *)color width:(CGFloat)width;

@end


text:
goog.provide('p3rf.perfkit.explorer.components.explorer.ExplorerHeaderDirective');

goog.require('p3rf.perfkit.explorer.components.code_editor.CodeEditorMode');

goog.scope(function() {
const explorer = p3rf.perfkit.explorer;
const CodeEditorMode = explorer.components.code_editor.CodeEditorMode;

/**
 * See module docstring for more information about purpose and usage.
 *
 * @return {Object} Directive definition object.
 */
explorer.components.explorer.ExplorerHeaderDirective = function() {
  return {
    restrict: 'E',
    replace: true,
    transclude: true,
    templateUrl: '/static/components/explorer/explorer-header-directive.html',
    controllerAs: 'ctrl',
    controller: [
        '$scope', '$modal', 'explorerService', 'dashboardService', 'errorService', 'workQueueService',
        function(
            $scope, $modal, explorerService, dashboardService, errorService, workQueueService) {
      /** @export */
      this.explorerSvc = explorerService;

      /** @private */
      this.modal_ = $modal;

      /** @export */
      this.dashboardSvc = dashboardService;

      /** @export */
      this.dashboards = this.explorerSvc.model.dashboards;

      /** @export */
      this.errorSvc = errorService;

      /** @export */
      this.workQueueSvc = workQueueService;

      // TODO(#139): Move to dedicated container service.
      /**
       * Prompts the user for a title, then copies the selected dashboard.
       * @export
       */
      this.saveDashboardCopy = function() {
        let title = window.prompt(
            'Please provide the title for your dashboard',
            this.dashboardSvc.current.model.title);
        if (!title) { return; }

        this.dashboardSvc.current.model.title = title;
        this.dashboardSvc.current.model.owner = '';
        this.dashboardSvc.saveDashboardCopy();
      };

      // TODO: Replace modal dialog with ui-router view.
      /**
       * Opens a dialog to edit the page config.
       * @export
       */
      this.editConfig = function() {
        this.modal_.open({
          templateUrl: '/static/components/config/config-dialog.html',
          controller: 'ConfigDialogCtrl as dialog'
        });
      };

      /**
       * Returns true if the 'Show Log' button should display, otherwise false.
       * @export
       */
      this.canShowLog = function() {
        return (
            this.errorSvc.errors.length > 0 &&
            !(this.explorerSvc.model.code_editor.isOpen &&
            this.explorerSvc.model.code_editor.selectedMode ===
                CodeEditorMode.LOG));
      };
    }]
  };
};

});  // goog.scope


text:
/**
 * Created by lei on 2015/10/23.
 */

document.getElementById("btnShow").addEventListener("click",getAtrribute);
document.getElementById("btnColor").addEventListener("click",changColor);

function getAtrribute()
{

    var tvalue=document.getElementById("txt1").value;
    var tid=document.getElementById("txt1").id;
    var tname=document.getElementById("txt1").name;
    document.write("value is "+ tvalue+"
"+"id is "+ tid+"
" +"name is "+tname);

}

function changColor()
{
    document.getElementById("txt1").style.background = "red";
}


text:
package test.server;

import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;

public class MqttPublishSample2 {

    public static void main(String[] args) throws Exception {

        String topic        = "鄰家的派豆龍";
        String broker       = "tcp://localhost:1991";
        String clientId     = "JavaSample_" + java.util.UUID.randomUUID();

        try {
            MqttClient sampleClient = new MqttClient(broker, clientId);
            System.out.println("Connecting to broker: "+broker);
            sampleClient.connect();
            System.out.println("Connected");

            sampleClient.setCallback(new MqttCallback(){

				@Override
				public void connectionLost(Throwable arg0) {
					// TODO Auto-generated method stub

				}

				@Override
				public void deliveryComplete(IMqttDeliveryToken token) {
					// TODO Auto-generated method stub

				}

				@Override
				public void messageArrived(String topic, MqttMessage message) throws Exception {
					System.out.println( message );
				}

            });

            sampleClient.subscribe( topic );

            Thread.sleep( 1000*120 );

            sampleClient.unsubscribe( topic );

            sampleClient.disconnect();
        } catch(MqttException me) {
            me.printStackTrace();
        }

    }

}


text:
require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * controller_class_nesting_depth %>/../spec_helper')

describe <%= controller_class_name %>Helper do

  #Delete this example and add some real ones or delete this file
  it "is included in the helper object" do
    included_modules = (class << helper; self; end).send :included_modules
    included_modules.should include(<%= controller_class_name %>Helper)
  end

end


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>file_posix::seek</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Beast">
<link rel="up" href="../boost__beast__file_posix.html" title="file_posix">
<link rel="prev" href="read.html" title="file_posix::read">
<link rel="next" href="size.html" title="file_posix::size">

Home
Libraries
People
FAQ
More

file_posix::seek

Adjust the current position in the open file.

          Synopsis

void
seek(
    std::uint64_t offset,
    error_code& ec);

          Description

          Parameters

<colgroup>
<col>
<col>
</colgroup>

                    Name

                    Description

                    offset

                    The offset in bytes from the beginning of the file

                    ec

                    Set to the error, if any occurred

Copyright © 2016, 2017 Vinnie Falco

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
class Question < ActiveRecord::Base
  has_many :votes, as: :votable
  belongs_to :user
  has_many :comments, as: :commentable
  has_many :answers
end


text:
struct iree_hal_driver_registry_t {
  iree_allocator_t host_allocator;
  iree_slim_mutex_t mutex;

  // Factories in registration order. As factories are unregistered the list is
  // shifted to be kept dense.
  iree_host_size_t factory_count;
  const iree_hal_driver_factory_t* factories[IREE_HAL_MAX_DRIVER_FACTORY_COUNT];
};

static iree_hal_driver_registry_t iree_hal_driver_registry_default_;
static iree_once_flag iree_hal_driver_registry_default_flag_ =
    IREE_ONCE_FLAG_INIT;
static void iree_hal_driver_registry_default_initialize(void) {
  memset(&iree_hal_driver_registry_default_, 0,
         sizeof(iree_hal_driver_registry_default_));
  iree_slim_mutex_initialize(&iree_hal_driver_registry_default_.mutex);
}

IREE_API_EXPORT iree_hal_driver_registry_t* iree_hal_driver_registry_default(
    void) {
  iree_call_once(&iree_hal_driver_registry_default_flag_,
                 iree_hal_driver_registry_default_initialize);
  return &iree_hal_driver_registry_default_;
}

IREE_API_EXPORT iree_status_t
iree_hal_driver_registry_allocate(iree_allocator_t host_allocator,
                                  iree_hal_driver_registry_t** out_registry) {
  IREE_ASSERT_ARGUMENT(out_registry);
  *out_registry = NULL;
  IREE_TRACE_ZONE_BEGIN(z0);

  iree_hal_driver_registry_t* registry = NULL;
  IREE_RETURN_AND_END_ZONE_IF_ERROR(
      z0, iree_allocator_malloc(host_allocator, sizeof(*registry),
                                (void**)&registry));
  registry->host_allocator = host_allocator;
  iree_slim_mutex_initialize(&registry->mutex);

  *out_registry = registry;
  IREE_TRACE_ZONE_END(z0);
  return iree_ok_status();
}

IREE_API_EXPORT void iree_hal_driver_registry_free(
    iree_hal_driver_registry_t* registry) {
  if (!registry) return;
  IREE_TRACE_ZONE_BEGIN(z0);
  iree_allocator_t host_allocator = registry->host_allocator;

  iree_slim_mutex_deinitialize(&registry->mutex);
  iree_allocator_free(host_allocator, registry);

  IREE_TRACE_ZONE_END(z0);
}

IREE_API_EXPORT iree_status_t iree_hal_driver_registry_register_factory(
    iree_hal_driver_registry_t* registry,
    const iree_hal_driver_factory_t* factory) {
  IREE_TRACE_ZONE_BEGIN(z0);
  iree_slim_mutex_lock(&registry->mutex);

  // Fail if already present; not because having it in there would harm anything
  // but because we can't then balance with unregisters if we were to skip it
  // when present and want to keep the list small and not have callers fill it
  // with tons of duplicate entries.
  iree_status_t status = iree_ok_status();
  for (iree_host_size_t i = 0; i < registry->factory_count; ++i) {
    if (registry->factories[i] == factory) {
      status = iree_make_status(IREE_STATUS_ALREADY_EXISTS,
                                "factory has already been registered");
      break;
    }
  }

  // Note that we check the capacity limit *after* checking for dupes so that
  // callers will find issues with duplicate registrations easier. Otherwise,
  // they'd just get a RESOURCE_EXHAUSTED and think there were too many unique
  // factories registered already.
  if (iree_status_is_ok(status) &&
      registry->factory_count + 1 >= IREE_ARRAYSIZE(registry->factories)) {
    status = iree_make_status(
        IREE_STATUS_RESOURCE_EXHAUSTED,
        "the maximum number of factories (%zu) have been registered",
        IREE_ARRAYSIZE(registry->factories));
  }

  if (iree_status_is_ok(status)) {
    registry->factories[registry->factory_count++] = factory;
  }

  iree_slim_mutex_unlock(&registry->mutex);
  IREE_TRACE_ZONE_END(z0);
  return status;
}

IREE_API_EXPORT iree_status_t iree_hal_driver_registry_unregister_factory(
    iree_hal_driver_registry_t* registry,
    const iree_hal_driver_factory_t* factory) {
  IREE_TRACE_ZONE_BEGIN(z0);
  iree_slim_mutex_lock(&registry->mutex);

  iree_status_t status = iree_ok_status();
  iree_host_size_t index = -1;
  for (iree_host_size_t i = 0; i < registry->factory_count; ++i) {
    if (registry->factories[i] != factory) continue;
    index = i;
    break;
  }
  if (index == -1) {
    status =
        iree_make_status(IREE_STATUS_NOT_FOUND,
                         "factory to remove is not registered at this time");
  }

  if (iree_status_is_ok(status)) {
    // Compact list. Note that registration order is preserved.
    // C4090 bug in MSVC: https://tinyurl.com/y46hlogx
    memmove((void*)&registry->factories[index], &registry->factories[index + 1],
            registry->factory_count - index - 1);
    registry->factories[--registry->factory_count] = NULL;
  }

  iree_slim_mutex_unlock(&registry->mutex);
  IREE_TRACE_ZONE_END(z0);
  return status;
}

// Computes the total byte size required to store driver info strings.
static iree_host_size_t iree_hal_driver_info_compute_storage_size(
    const iree_hal_driver_info_t* driver_info) {
  iree_host_size_t storage_size = 0;
  storage_size += driver_info->driver_name.size;
  storage_size += driver_info->full_name.size;
  return storage_size;
}

// Copies |source_driver_info| into |target_driver_info| using |string_storage|
// for the nested strings. Returns the total number of bytes added to
// string_storage.
static iree_host_size_t iree_hal_driver_info_copy(
    const iree_hal_driver_info_t* source_driver_info,
    iree_hal_driver_info_t* target_driver_info, char* string_storage) {
  // Copy everything by default (primitive fields, etc).
  memcpy(target_driver_info, source_driver_info, sizeof(*target_driver_info));

  // Copy in each string field to the string storage and set the ptr.
  iree_host_size_t storage_size = 0;
  storage_size += iree_string_view_append_to_buffer(
      source_driver_info->driver_name, &target_driver_info->driver_name,
      string_storage + storage_size);
  storage_size += iree_string_view_append_to_buffer(
      source_driver_info->full_name, &target_driver_info->full_name,
      string_storage + storage_size);
  return storage_size;
}

IREE_API_EXPORT iree_status_t iree_hal_driver_registry_enumerate(
    iree_hal_driver_registry_t* registry, iree_allocator_t host_allocator,
    iree_host_size_t* out_driver_info_count,
    iree_hal_driver_info_t** out_driver_infos) {
  IREE_ASSERT_ARGUMENT(registry);
  IREE_ASSERT_ARGUMENT(out_driver_info_count);
  IREE_ASSERT_ARGUMENT(out_driver_infos);
  IREE_TRACE_ZONE_BEGIN(z0);

  *out_driver_info_count = 0;
  *out_driver_infos = NULL;

  iree_status_t status = iree_ok_status();
  iree_slim_mutex_lock(&registry->mutex);

  // Enumerate each factory and figure out how much memory we need to fully
  // store all data we need to clone.
  iree_host_size_t total_driver_info_count = 0;
  iree_host_size_t total_storage_size = 0;
  for (iree_host_size_t i = 0; i < registry->factory_count; ++i) {
    const iree_hal_driver_factory_t* factory = registry->factories[i];
    const iree_hal_driver_info_t* driver_infos = NULL;
    iree_host_size_t driver_info_count = 0;
    status =
        factory->enumerate(factory->self, &driver_info_count, &driver_infos);
    if (!iree_status_is_ok(status)) break;
    total_driver_info_count += driver_info_count;
    for (iree_host_size_t j = 0; j < driver_info_count; j++) {
      total_storage_size +=
          iree_hal_driver_info_compute_storage_size(&driver_infos[j]);
    }
  }

  // Allocate the required memory for both the driver infos and the string
  // storage in a single block.
  iree_host_size_t total_driver_infos_size =
      total_driver_info_count * sizeof(iree_hal_driver_info_t);
  if (iree_status_is_ok(status)) {
    status = iree_allocator_malloc(host_allocator,
                                   total_driver_infos_size + total_storage_size,
                                   (void**)out_driver_infos);
  }

  // Write driver info and associated nested resources to the output. We have
  // to enumerate again but enumeration is expected to be immutable for a given
  // registration and we hold the lock so we're safe.
  if (iree_status_is_ok(status)) {
    iree_hal_driver_info_t* driver_info_storage_ptr = *out_driver_infos;
    char* string_storage_ptr =
        (char*)(*out_driver_infos) + total_driver_infos_size;
    for (iree_host_size_t i = 0; i < registry->factory_count; ++i) {
      const iree_hal_driver_factory_t* factory = registry->factories[i];
      const iree_hal_driver_info_t* driver_infos = NULL;
      iree_host_size_t driver_info_count = 0;
      status =
          factory->enumerate(factory->self, &driver_info_count, &driver_infos);
      if (!iree_status_is_ok(status)) break;
      for (iree_host_size_t j = 0; j < driver_info_count; j++) {
        string_storage_ptr += iree_hal_driver_info_copy(
            &driver_infos[j], driver_info_storage_ptr, string_storage_ptr);
        ++driver_info_storage_ptr;
      }
    }
    *out_driver_info_count = total_driver_info_count;
  }

  iree_slim_mutex_unlock(&registry->mutex);

  // Cleanup memory if we failed.
  if (!iree_status_is_ok(status) && *out_driver_infos) {
    iree_allocator_free(host_allocator, *out_driver_infos);
  }
  IREE_TRACE_ZONE_END(z0);
  return status;
}

IREE_API_EXPORT iree_status_t iree_hal_driver_registry_try_create(
    iree_hal_driver_registry_t* registry, iree_string_view_t driver_name,
    iree_allocator_t host_allocator, iree_hal_driver_t** out_driver) {
  IREE_ASSERT_ARGUMENT(registry);
  IREE_TRACE_ZONE_BEGIN(z0);
  IREE_TRACE_ZONE_APPEND_TEXT(z0, driver_name.data, driver_name.size);

  *out_driver = NULL;

  // NOTE: we hold the lock the entire time here so that we can avoid
  // allocations and avoid spurious failures by outside mutation of the
  // registry.
  iree_status_t status = iree_ok_status();
  iree_slim_mutex_lock(&registry->mutex);

  // Enumerate each factory and scan for the requested driver.
  // NOTE: we scan in reverse so that we prefer the first hit in the most
  // recently registered factory.
  const iree_hal_driver_factory_t* hit_factory = NULL;
  for (iree_host_size_t i = 0; i < registry->factory_count; ++i) {
    // Reach inside and grab the internal factory data structures.
    const iree_hal_driver_factory_t* factory =
        registry->factories[registry->factory_count - i - 1];
    const iree_hal_driver_info_t* driver_infos = NULL;
    iree_host_size_t driver_info_count = 0;
    status =
        factory->enumerate(factory->self, &driver_info_count, &driver_infos);
    if (!iree_status_is_ok(status)) break;

    // Scan for the specific driver by name.
    // NOTE: we scan in reverse here too so multiple drivers with the same name
    // from the same factory prefer the later drivers in the list.
    for (iree_host_size_t j = 0; j < driver_info_count; j++) {
      const iree_hal_driver_info_t* driver_info =
          &driver_infos[driver_info_count - j - 1];
      if (iree_string_view_equal(driver_name, driver_info->driver_name)) {
        hit_factory = factory;
        break;
      }
    }
    // Since we are scanning in reverse we stop searching when we find the first
    // hit (aka the most recently added driver).
    if (hit_factory != NULL) break;
  }

  // If we found a driver during the scan try to create it now.
  // This may block the caller (with the lock held!), and may fail if for
  // example a delay-loaded driver cannot be created even if it was enumerated.
  if (hit_factory != NULL) {
    status = hit_factory->try_create(hit_factory->self, driver_name,
                                     host_allocator, out_driver);
  } else {
    status =
        iree_make_status(IREE_STATUS_NOT_FOUND, "no driver '%.*s' registered",
                         (int)driver_name.size, driver_name.data);
  }

  iree_slim_mutex_unlock(&registry->mutex);

  IREE_TRACE_ZONE_END(z0);
  return status;
}

IREE_API_EXPORT iree_status_t iree_hal_create_device(
    iree_hal_driver_registry_t* registry, iree_string_view_t device_uri,
    iree_allocator_t host_allocator, iree_hal_device_t** out_device) {
  IREE_ASSERT_ARGUMENT(registry);
  IREE_ASSERT_ARGUMENT(out_device);
  *out_device = NULL;
  IREE_TRACE_ZONE_BEGIN(z0);
  IREE_TRACE_ZONE_APPEND_TEXT(z0, device_uri.data, device_uri.size);

  // Try to create the driver; the backing driver factory may cache this but
  // it's not safe to assume the returned driver is going to remain live for
  // any longer than this function holds a reference.
  iree_string_view_t driver_name = iree_uri_schema(device_uri);
  iree_hal_driver_t* driver = NULL;
  IREE_RETURN_AND_END_ZONE_IF_ERROR(
      z0,
      iree_hal_driver_registry_try_create(registry, driver_name, host_allocator,
                                          &driver),
      "creating driver for device '%.*s'", (int)device_uri.size,
      device_uri.data);

  // Have the driver create the device.
  iree_status_t status = iree_hal_driver_create_device_by_uri(
      driver, device_uri, host_allocator, out_device);

  iree_hal_driver_release(driver);

  IREE_TRACE_ZONE_END(z0);
  return status;
}


text:
import mymap from '../services/map-service';
import formatDate from '../utils/milliSecondsToDate';

function makeInfowindow(nis,order,incident_id,sed, point, time, address, etr){
  var map = mymap.getMap();

  var contentVars = {
    nis: nis,
    order: order,
    incident_id: incident_id,
    sed: sed,
    pointGeometry: point,
    time: time,
    address: address,
    etr: etr
  };

  map.infoWindow.setTitle("NIS : " + contentVars.nis);

  var content = `
Orden: ${contentVars.order}

ID Incidencia: ${contentVars.incident_id}

Tiempo Transcurrido: ${contentVars.time}

SED: ${contentVars.sed}

Dirección: ${contentVars.address}

ETR: ${contentVars.etr}

`;

  map.infoWindow.resize(450, 250);
  map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(point), content));
  map.infoWindow.show(point, map.getInfoWindowAnchor(point));
}

function makeInfowindowPerSED(sed, point, name, region, alimentador, property){
  var map = mymap.getMap();

  var contentVars = {
    sed: sed,
    pointGeometry: point,
    name: name,
    region: region,
    alimentador: alimentador,
    property: property
  };

  map.infoWindow.setTitle("SED : " + contentVars.sed);

  var content = `
Nombre: ${contentVars.name}

Comuna: ${contentVars.region}

Alimentador: ${contentVars.alimentador}

Propiedad: ${contentVars.property}

`;

  map.infoWindow.resize(450, 250);
  map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(point), content));
  map.infoWindow.show(point, map.getInfoWindowAnchor(point));
}

function makeInfowindowPerSEDInterrupted(sed, point, order_id, incident_id, alimentador, cause,commentary){
  var map = mymap.getMap();

  var contentVars = {
    sed: sed,
    pointGeometry: point,
    order_id: order_id,
    incident_id: incident_id,
    alimentador: alimentador,
    cause: cause,
    commentary: commentary
  };

  map.infoWindow.setTitle("SED : " + contentVars.sed);

  var content = `
ID Orden: ${contentVars.order_id}

ID Incidencia: ${contentVars.incident_id}

Alimentador: ${contentVars.alimentador}

Causa: ${contentVars.cause}

Comentario: ${contentVars.commentary}

`;

  map.infoWindow.resize(450, 250);
  map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(point), content));
  map.infoWindow.show(point, map.getInfoWindowAnchor(point));
}

function makeInfowindowPerNisInfo(nis,sed, point,address){
  var map = mymap.getMap();

  var contentVars = {
    nis: nis,
    sed: sed,
    pointGeometry: point,
    address: address
  };

  map.infoWindow.setTitle("NIS : " + contentVars.nis);

  var content = `
SED: ${contentVars.sed}

Dirección: ${contentVars.address}

`;

  map.infoWindow.resize(450, 250);
  map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(point), content));
  map.infoWindow.show(point, map.getInfoWindowAnchor(point));

}

function makeInfowindowPerGridInfo(type,
                                  order_id,
                                  incident_id,
                                  cause,
                                  commentary,
                                  state,
                                  creaDate,
                                  assiDate,
                                  deliDate,
                                  routDate,
                                  arriDate,
                                  time,
                                  ETR,
                                  geometry){
  var map = mymap.getMap();

  var contentVars = {
    type: type,
    order_id: order_id,
    incident_id: incident_id,
    cause: cause,
    commentary:commentary,
    state: state,
    creaDate: creaDate,
    assiDate: assiDate,
    deliDate: deliDate,
    routDate: routDate,
    arriDate: arriDate,
    time: time,
    ETR: ETR,
    geometry: geometry
  };

  map.infoWindow.setTitle("Tipo : " + contentVars.type);

  var content = `
ID Orden: ${contentVars.order_id}

ID Incidencia: ${contentVars.incident_id}

Causa: ${contentVars.cause}

Comentario: ${contentVars.commentary}

Estado: ${contentVars.state}

Fecha Creación: ${contentVars.creaDate}

Fecha Asignación: ${contentVars.assiDate}

Fecha Despacho: ${contentVars.deliDate}

Fecha Ruta: ${contentVars.routDate}

Fecha Llegada: ${contentVars.arriDate}

Tiempo: ${contentVars.time}

ETR: ${contentVars.ETR}

`;

  map.infoWindow.resize(450, 250);
  map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(geometry), content));
  map.infoWindow.show(geometry, map.getInfoWindowAnchor(geometry));
}

function ap_infoWindow(lightID, poleNumber, connectionType, type, property,meansured, geometry){
  var map = mymap.getMap();
  map.infoWindow.setTitle("ID Luminaria : " + lightID);
  var content = `
ROTULO: ${poleNumber}

Tipo Conexión: ${connectionType}

Tipo: ${type}

Propiedad: ${property}

Medido: ${meansured}

`;
  map.infoWindow.resize(250, 350);
  map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(geometry), content));
  map.infoWindow.show(geometry, map.getInfoWindowAnchor(geometry));

}

function ap_infoWindow_rotulo(poleNumber){
/*  var map = mymap.getMap();
  map.infoWindow.setTitle("ROTULO : " + poleNumber);
  var content = `
ROTULO: ${poleNumber}

Tipo Conexión: ${connectionType}

Tipo: ${type}

Propiedad: ${property}

Medido: ${meansured}

`;
  map.infoWindow.resize(250, 350);
  map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(geometry), content));
  map.infoWindow.show(geometry, map.getInfoWindowAnchor(geometry));
*/
}

function factigis_tramosInfo(tipoRed, idtramo, alimentador, comuna, tipo, propiedad,catalogo, descripcion, tension, fecha, sed, geometry){
  var fechaa = formatDate(fecha);
  var map = mymap.getMap();

  if(tipoRed=='MT'){
    map.infoWindow.setTitle("ID Tramo : " + idtramo);
    var content = `
Alimentador: ${alimentador}

Comuna: ${comuna}

Tipo: ${tipo}

Propiedad: ${propiedad}

Catálogo: ${catalogo}

Descripción: ${descripcion}

Tensión: ${tension}

Fecha: ${fechaa}

`;
    map.infoWindow.resize(250, 350);

    map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(geometry), content));
    map.infoWindow.show(geometry, map.getInfoWindowAnchor(geometry));
  }else{
    map.infoWindow.setTitle("ID Tramo : " + idtramo);
    var content = `
Alimentador: ${alimentador}

Comuna: ${comuna}

Tipo: ${tipo}

Propiedad: ${propiedad}

Catálogo: ${catalogo}

Descripción: ${descripcion}

SED: ${sed}

Fecha: ${fechaa}

`;
    map.infoWindow.resize(250, 350);

    map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(geometry), content));
    map.infoWindow.show(geometry, map.getInfoWindowAnchor(geometry));
  }

}

export {makeInfowindow,
        makeInfowindowPerSED,
        makeInfowindowPerSEDInterrupted,
        makeInfowindowPerNisInfo,
        makeInfowindowPerGridInfo,
        ap_infoWindow,
        ap_infoWindow_rotulo,
        factigis_tramosInfo};


text:
layout: post
title: Brinkley's Nike City Page Version 2
description: Check out my second version of my City Page for myself for Nike Dallas.
image:
categories: [pdf]
tags: [nike, city page, dallas, pdf]
---

Brinkley\'s
      Nike City Page Version 2 (PDF)


text:
namespace VeritasEngine
{
	class Engine;

	class EXPORT IWorldSetup
	{
	public:
		virtual ~IWorldSetup() = default;
		virtual void Init(Engine& engine) = 0;
		virtual void LoadFile(const char* filename) = 0;
	};
}