text:
using System;
using System.Reflection;
using RzAspects;
using RzWpf.Localization;

namespace RzWpf.Validation
{
    /// <summary>
    /// Base class for validation attributes.
    /// </summary>
    [AttributeUsage( AttributeTargets.Property, AllowMultiple = true )]
    public abstract class PropertyValidationAttribute : ResourceStringAttribute, IPropertyValidationAttribute
    {
        public string Condition { get; set; }

        public string ErrorMessage
        {
            get
            {
                return ResourceValue;
            }
        }

        ITypeChecker ValidationType { get; set; }

        public PropertyValidationAttribute() : this( new TypeChecker<object>() ) { }

        protected PropertyValidationAttribute( ITypeChecker validationType )
        {
            if( null == validationType )
            {
                throw new ArgumentNullException( "validationType" );
            }
            ValidationType = validationType;
        }

        /// <summary>
        /// Checks to see if a property condition is true on this instance.
        /// </summary>
        /// <param name="condition">
        /// The name of the condition property.  If the property does not exist or does not return
        /// a boolean type, the condition is assumed to be met.
        /// </param>
        /// <returns>True if the condition doesn't exist/does not return null/is met.  False if the condition is not met.</returns>
        public bool IsConditionMet( object instance )
        {
            if( string.IsNullOrEmpty( Condition ) )
            {
                //No condition specified, so it is met by default.
                return true;
            }

            PropertyInfo propInfo = instance.GetType().GetProperty( Condition, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic );
            if( null == propInfo )
            {
                //The condition could not be resolved
                return true;
            }
            else
            {
                object value = propInfo.GetValue( instance, null );
                if( value is bool )
                {
                    return (bool)value;
                }
                else
                {
                    return true;
                }
            }
        }

        public bool IsValid( object toValidate )
        {
            return IsValid( toValidate, null );
        }

        public bool IsValid( object toValidate, object context )
        {
            if( ( null != context ) && ( !IsConditionMet( context ) ) )
            {
                //This attribute's condition is not met; return true to indicate that it will not block validation
                return true;
            }

            if( ValidationType.IsOfMatchingType( toValidate ) )
            {
                return ValidateInternal( toValidate, context );
            }
            else
            {
                //the parameter to validate against did not match the type, no possible way it can satisfy the validation rule.
                return false;
            }
        }

        protected abstract bool ValidateInternal( object toValidate, object context );
    }
}

redpajama_set_name: RedPajamaGithub


text:
var context = require('../utils/context.js'),
    users = require('../utils/users.js'),
    appsUtils = require('../utils/apps.js');

module.exports = function (req, res, next) {
    users.getUserData(req.params.user, function(userData) {
        if (!userData) {
            res.render('userError', context.create({user: req.params.user}));
            return;
        }

        var data = {
            user : userData,
            device: {
                battery : (req.params.battery) ? req.params.battery : 0
            }
        };

        appsUtils.getData(data, function(appsData) {
	    console.info('render ', new Date(), data.user.username, data.device.battery);
            res.render('page', context.create(context.merge(data, appsData)));
        });
    });
};


text:
require 'spec_helper'

describe UserHelper do

  before :each do
    @dummy_class = Class.new do
      extend UcozHelper
      extend UserHelper
      @cond_operators = []
      @_erbout = '  test'

      def self.config
        AppConfig.config
      end
    end
  end

  describe 'rank_name' do
    it 'should return html-string' do
      result = @dummy_class.rank_name('$_RANK$', '$_MSN$', '$_RANK_NAME$', '$_GENDER_ID$')
      expected_result = <<-HTML.chomp!
<span class="rank<?if($_MSN$)?> rank-$_RANK$-$_MSN$<?if($_GENDER_ID$=2)?> rank-$_RANK$-$_MSN$-f<?endif?><?endif?>" data-rank-name="$_RANK_NAME$">
      HTML
      expect(result).to eq(expected_result)
    end

    it "don't modify out buffer" do
      self_buffer = @dummy_class.instance_variable_get(:@_erbout).dup
      @dummy_class.rank_name('RID', 'MSN', 'RN', 'GID')
      expect(@dummy_class.instance_variable_get(:@_erbout)).to eq self_buffer
    end
  end
end


text:
#ifndef TUDAT_SOFA_H
#define TUDAT_SOFA_H

#include "sofa/earthOrientation.h"
#include "sofa/fundamentalArguments.h"
#include "sofa/sofaTimeConversions.h"

#endif // TUDAT_SOFA_H


text:
<?php

/*
 * This file is part of Sulu.
 *
 * (c) MASSIVE ART WebServices GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sulu\Bundle\ProductBundle\Tests\Functional\Controller;

use DateTime;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManager;
use Sulu\Bundle\ProductBundle\DataFixtures\ORM\Attributes\LoadAttributes;
use Sulu\Bundle\ProductBundle\Entity\Attribute;
use Sulu\Bundle\ProductBundle\Entity\AttributeTranslation;
use Sulu\Bundle\ProductBundle\Entity\AttributeType;
use Sulu\Bundle\TestBundle\Testing\SuluTestCase;
use Symfony\Component\HttpKernel\Client;

class AttributeControllerTest extends SuluTestCase
{
    /**
     * @var string
     */
    const REQUEST_LOCALE = 'en';

    /**
     * @var array
     */
    protected static $entities;

    /**
     * @var EntityManager
     */
    protected $em;

    /**
     * @var AttributeType
     */
    protected $attributeType2;

    /**
     * @var AttributeType
     */
    private $attributeType1;

    /**
     * @var Attribute
     */
    private $attribute1;

    /**
     * @var Client
     */
    private $client;

    /**
     * @var Attribute
     */
    private $attribute2;

    /**
     * {@inheritdoc}
     */
    public function setUp()
    {
        $this->em = $this->getEntityManager();
        $this->purgeDatabase();
        $this->setUpTestData();
        $this->client = $this->createAuthenticatedClient();
        $this->em->flush();
    }

    /**
     * Create initial data for tests.
     */
    private function setUpTestData()
    {
        $metadata = $this->em->getClassMetadata(AttributeType::class);
        $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);

        $this->attributeType1 = new AttributeType();
        $this->attributeType1->setId(1);
        $this->attributeType1->setName('some-translation-type-1-string');
        $this->attributeType2 = new AttributeType();
        $this->attributeType2->setName('some-translation-type-2-string');
        $this->attributeType2->setId(2);

        // shipping
        $metadata = $this->em->getClassMetadata(Attribute::class);
        $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);

        $this->attribute1 = new Attribute();
        $this->attribute1->setId(Attribute::ATTRIBUTE_TYPE_TEXT);
        $this->attribute1->setCreated(new DateTime());
        $this->attribute1->setChanged(new DateTime());
        $this->attribute1->setType($this->attributeType1);
        $this->attribute1->setKey('key.one');
        $attributeTextTranslation = new AttributeTranslation();
        $attributeTextTranslation->setName('Gas');
        $attributeTextTranslation->setLocale('en');
        $attributeTextTranslation->setAttribute($this->attribute1);
        $this->attribute1->addTranslation($attributeTextTranslation);

        $this->attribute2 = new Attribute();
        $this->attribute2->setCreated(new DateTime());
        $this->attribute2->setChanged(new DateTime());
        $this->attribute2->setType($this->attributeType2);
        $this->attribute2->setKey('key.two');
        $attributeTextTranslation2 = new AttributeTranslation();
        $attributeTextTranslation2->setName('Power');
        $attributeTextTranslation2->setLocale('en');
        $attributeTextTranslation2->setAttribute($this->attribute2);
        $this->attribute2->addTranslation($attributeTextTranslation2);

        $this->em->persist($this->attributeType1);
        $this->em->persist($this->attribute1);
        $this->em->persist($this->attributeType2);
        $this->em->persist($this->attribute2);

        $this->em->flush();
    }

    /**
     * Get a existing attribute by it's id.
     */
    public function testGetById()
    {
        $this->client->request('GET', '/api/attributes/1');
        $response = json_decode($this->client->getResponse()->getContent());

        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-1-string', $response->type->name);
        $this->assertEquals('Gas', $response->name);
    }

    /**
     * Get a not existing attribute by it's id.
     */
    public function testGetNotExistingById()
    {
        $this->client->request('GET', '/api/attributes/666');
        $response = json_decode($this->client->getResponse()->getContent());

        $this->assertEquals(404, $this->client->getResponse()->getStatusCode());
        $this->assertEquals(
            'Entity with the type "SuluProductBundle:Attribute" and the id "666" not found.',
            $response->message
        );
    }

    /**
     * Get all available attributes.
     */
    public function testGetAll()
    {
        $this->client->request('GET', '/api/attributes');
        $response = json_decode($this->client->getResponse()->getContent());
        $items = $response->_embedded->attributes;

        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals(2, count($items));

        $item1 = $items[0];
        $this->assertEquals('some-translation-type-1-string', $item1->type->name);
        $this->assertEquals('Gas', $item1->name);

        $item2 = $items[1];
        $this->assertEquals('some-translation-type-2-string', $item2->type->name);
        $this->assertEquals('Power', $item2->name);
    }

    /**
     * Get all available attributes flat.
     */
    public function testGetAllFlat()
    {
        $this->client->request('GET', '/api/attributes?flat=true');
        $response = json_decode($this->client->getResponse()->getContent());
        $items = $response->_embedded->attributes;

        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals(2, count($items));

        $item1 = $items[0];
        $this->assertEquals('some-translation-type-1-string', $item1->type);
        $this->assertEquals('Gas', $item1->name);

        $item2 = $items[1];
        $this->assertEquals('some-translation-type-2-string', $item2->type);
        $this->assertEquals('Power', $item2->name);
    }

    /**
     * Post (create) a new attribute.
     */
    public function testPost()
    {
        $data = [
            'name' => 'Material',
            'key' => 'key.one',
            'type' => [
                'id' => $this->attributeType1->getId(),
            ],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('POST', '/api/attributes', $data);
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals('Material', $response->name);
        $this->assertEquals($this->attributeType1->getId(), $response->type->id);

        $this->client->request('GET', '/api/attributes/' . $response->id);
        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('Material', $response->name);
        $this->assertEquals('key.one', $response->key);
        $this->assertEquals($this->attributeType1->getId(), $response->type->id);
    }

    /**
     * Post with an invalid attribute type does not create a new attribute.
     */
    public function testPostInvalidType()
    {
        $data = [
            'name' => 'InvalidType',
            'type' => [
                'id' => 666,
            ],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('POST', '/api/attributes', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(400, $this->client->getResponse()->getStatusCode());

        $this->assertEquals(
            'Entity with the type "SuluProductBundle:AttributeType" and the id "666" not found.',
            $response->message
        );
    }

    /**
     * Post with a missing attribute name does not create a new attribute.
     */
    public function testPostMissingNameData()
    {
        $data = [
            'type' => [
                'id' => 1,
            ],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('POST', '/api/attributes', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(400, $this->client->getResponse()->getStatusCode());

        $this->assertEquals(
            'The "SuluProductBundle:Attribute"-entity requires a "name"-argument',
            $response->message
        );
    }

    /**
     * Post with a missing type object does not create a new attribute.
     */
    public function testPostMissingTypeData()
    {
        $data = [
            'name' => 'Some name',
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('POST', '/api/attributes', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(400, $this->client->getResponse()->getStatusCode());

        $this->assertEquals(
            'The "SuluProductBundle:Attribute"-entity requires a "type"-argument',
            $response->message
        );
    }

    /**
     * Post with a missing type id does not create a new attribute.
     */
    public function testPostMissingTypeIdData()
    {
        $data = [
            'name' => 'InvalidTypeId',
            'type' => [],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('POST', '/api/attributes', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(400, $this->client->getResponse()->getStatusCode());

        $this->assertEquals(
            'The "SuluProductBundle:Attribute"-entity requires a "id"-argument',
            $response->message
        );
    }

    /**
     * Put new name and type to change the appropriate properties on an existing attribute.
     */
    public function testPut()
    {
        $data = [
            'name' => 'Petrol',
            'type' => [
                'id' => $this->attributeType2->getId(),
            ],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('PUT', '/api/attributes/1', $data);
        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-2-string', $response->type->name);
        $this->assertEquals('Petrol', $response->name);

        $this->client->request('GET', '/api/attributes/1');
        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-2-string', $response->type->name);
        $this->assertEquals('Petrol', $response->name);
    }

    /**
     * Put to a not existing attribute id does return an error.
     */
    public function testPutNotExisting()
    {
        $data = [
            'name' => 'MissingProduct',
        ];

        $this->client->request('PUT', '/api/attributes/666', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(404, $this->client->getResponse()->getStatusCode());

        $this->assertEquals(
            'Entity with the type "SuluProductBundle:Attribute" and the id "666" not found.',
            $response->message
        );
    }

    /**
     * Put with a not existing type id does return an error.
     */
    public function testPutInvalidType()
    {
        $data = [
            'name' => 'InvalidType',
            'type' => [
                'id' => 666,
            ],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('PUT', '/api/attributes/1', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(400, $this->client->getResponse()->getStatusCode());

        $this->assertEquals(
            'Entity with the type "SuluProductBundle:AttributeType" and the id "666" not found.',
            $response->message
        );
    }

    /**
     * Put a new attribute name does change the name of the attribute for the given id.
     */
    public function testPutNewName()
    {
        $data = [
            'name' => 'Some new name',
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('PUT', '/api/attributes/1', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-1-string', $response->type->name);
        $this->assertEquals('Some new name', $response->name);

        $this->client->request('GET', '/api/attributes/1');
        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-1-string', $response->type->name);
        $this->assertEquals('Some new name', $response->name);
    }

    /**
     * Put a new type does change the type of the attribute for the given id.
     */
    public function testPutNewType()
    {
        $data = [
            'type' => [
                'id' => $this->attributeType2->getId(),
            ],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('PUT', '/api/attributes/1', $data);
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());

        $this->client->request('GET', '/api/attributes/1');
        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-2-string', $response->type->name);
        $this->assertEquals('Gas', $response->name);
    }

    /**
     * Put with an empty type does not change anything.
     */
    public function testPutNewTypeWithoutId()
    {
        $data = [
            'type' => [],
            'locale' => self::REQUEST_LOCALE,
        ];

        $this->client->request('PUT', '/api/attributes/1', $data);

        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-1-string', $response->type->name);
        $this->assertEquals('Gas', $response->name);

        $this->client->request('GET', '/api/attributes/1');
        $response = json_decode($this->client->getResponse()->getContent());
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals('some-translation-type-1-string', $response->type->name);
        $this->assertEquals('Gas', $response->name);
    }

    /**
     * Delete an existing attribute.
     */
    public function testDeleteById()
    {
        $this->client->request('DELETE', '/api/attributes/1');
        $this->assertEquals('204', $this->client->getResponse()->getStatusCode());

        $this->client->request('GET', '/api/attributes/1');
        $this->assertEquals('404', $this->client->getResponse()->getStatusCode());
    }

    /**
     * Delete an not existing attribute.
     */
    public function testDeleteNotExistingById()
    {
        $this->client->request('DELETE', '/api/attributes/666');
        $this->assertEquals('404', $this->client->getResponse()->getStatusCode());
    }

    /**
     * Test if fixtures were correctly created.
     */
    public function testAttributeFixtures()
    {
        $fixtureLoader = new LoadAttributes();
        $fixtureLoader->setContainer($this->getContainer());

        $fixtureLoader->load($this->em);

        $this->client->request('GET', '/api/attributes');
        $response = json_decode($this->client->getResponse()->getContent());
        $items = $response->_embedded->attributes;

        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
        $this->assertEquals(3, count($items));

        $item1 = $items[0];
        $this->assertEquals('some-translation-type-1-string', $item1->type->name);
        $this->assertEquals('Gas', $item1->name);

        $item2 = $items[1];
        $this->assertEquals('some-translation-type-2-string', $item2->type->name);
        $this->assertEquals('Power', $item2->name);

        $item3 = $items[2];
        $this->assertEquals('some-translation-type-1-string', $item3->type->name);
        $this->assertEquals('English Attribute', $item3->name);
    }
}


text:
package eu.pulsation.spektromagnet

/**
 * Implemented from example http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/
 */

import android.content.Context
//import android.content.res.Resources
import android.app.Service
import android.os.{Bundle, IBinder}
import android.content.{ContentProviderClient, AbstractThreadedSyncAdapter, SyncResult, Intent}
import android.accounts.{Account, AccountManager}

import org.ektorp.{ReplicationCommand, ReplicationStatus, CouchDbConnector, CouchDbInstance}
import org.ektorp.http.HttpClient
import org.ektorp.impl.StdCouchDbInstance

import com.couchbase.cblite.router.CBLURLStreamHandlerFactory
import com.couchbase.cblite.ektorp.CBLiteHttpClient
import com.couchbase.cblite.{CBLServer}

class SpektroMagnetSyncAdapterService extends Service { self =>

  def onBind(intent: Intent) : IBinder = {

    // Install the cblite URL handler, c.f. https://github.com/couchbase/couchbase-lite-android/wiki/FAQ-Android#q-why-do-i-see-a-message-like-javanetmalformedurlexception-unknown-protocol-cblite
    CBLURLStreamHandlerFactory.registerSelfIgnoreError()

    lazy val syncAdapter = {
      new AbstractThreadedSyncAdapter(this, true) {
        def onPerformSync(account: Account, extras: Bundle, authority: String, provider: ContentProviderClient, syncResult: SyncResult) {
          self.performSync(self, account, extras, authority, provider, syncResult)
        }
      }
    }
    syncAdapter.getSyncAdapterBinder()
  }

  private def performSync(context: Context, account: Account, extras: Bundle, authority: String, provider: ContentProviderClient,
    syncResult: SyncResult) {

    lazy val accountManager : AccountManager = {
      this.getSystemService(Context.ACCOUNT_SERVICE) match {
        case am : AccountManager => am
        case _ => throw new ClassCastException
      }
    }

    lazy val login = accountManager.getUserData(account, "login")
    lazy val password = accountManager.getPassword(account)
    lazy val server = accountManager.getUserData(account, "server")
    lazy val database = accountManager.getUserData(account, "database")

    def doReplicate() : ReplicationStatus = {

      // Connection to database
      lazy val filesDir : String = context.getFilesDir().getAbsolutePath()
      lazy val tdserver : CBLServer = new CBLServer(filesDir)
      lazy val httpClient : HttpClient = new CBLiteHttpClient(tdserver)
      lazy val serverInstance : CouchDbInstance = new StdCouchDbInstance(httpClient)

      val pushCommand  : ReplicationCommand= new ReplicationCommand.Builder()
          .source(context.getString(R.string.local_db_name))
          .target(  context.getString(R.string.remote_db_protocol) + "://"
                    + login + ":" + password
                    + "@" + server + ":" + context.getString(R.string.remote_db_port)
                    + "/" + database)
          .continuous(false)
          .build();

      serverInstance.replicate(pushCommand);
      // TODO: Remove replicated data
    }

    doReplicate()
  }
}


text:
rem Split the version off of the directory name
for %%I in (.) do for /F "tokens=1 delims=v" %%a in ("%%~nxI") do set extensionName=%%a
rem Remove trailing spaces
for /f "tokens=* delims= " %%A in ('echo %extensionName% ') do set extensionName=%%A
set extensionName=%extensionName:~0,-1%

echo Removing %extensionName%

rmdir /s /q "%localappdata%\InRule\irAuthor\ExtensionExchange\%extensionName%\"
rmdir /s /q "C:\Program Files (x86)\InRule\irAuthor\Extensions\%extensionName%\"


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>OpenNI 2.0: openni::Device Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

OpenNI 2.0

Main Page

Related Pages

Namespaces

Classes

Files

Class List

Class Index

Class Members

openni

Device

Public Member Functions

openni::Device Class Reference

#include <OpenNI.h>

List of all members.

Public Member Functions

 	Device ()

 	~Device ()

void 	close ()

const DeviceInfo & 	getDeviceInfo () const

ImageRegistrationMode 	getImageRegistrationMode () const

PlaybackControl * 	getPlaybackControl ()

Status 	getProperty (int propertyId, void *data, int *dataSize) const

template<class T >

Status 	getProperty (int propertyId, T *value) const

const SensorInfo * 	getSensorInfo (SensorType sensorType)

bool 	hasSensor (SensorType sensorType)

Status 	invoke (int commandId, const void *data, int dataSize)

template<class T >

Status 	invoke (int propertyId, const T &value)

bool 	isCommandSupported (int commandId) const

bool 	isFile () const

bool 	isImageRegistrationModeSupported (ImageRegistrationMode mode) const

bool 	isPropertySupported (int propertyId) const

bool 	isValid () const

Status 	open (const char *uri)

Status 	setDepthColorSyncEnabled (bool isEnabled)

Status 	setImageRegistrationMode (ImageRegistrationMode mode)

Status 	setProperty (int propertyId, const void *data, int dataSize)

template<class T >

Status 	setProperty (int propertyId, const T &value)

Detailed Description

The Device object abstracts a specific device; either a single hardware device, or a file device holding a recording from a hardware device. It offers the ability to connect to the device, and obtain information about its configuration and the data streams it can offer.

It provides the means to query and change all configuration parameters that apply to the device as a whole. This includes enabling depth/color image registration and frame synchronization.

Devices are used when creating and initializing VideoStreams – you will need a valid pointer to a Device in order to use the VideoStream.create() function. This, along with configuration, is the primary use of this class for application developers.

Before devices can be created, OpenNI::initialize() must have been run to make the device drivers on the system available to the API.

Constructor & Destructor Documentation

          openni::Device::Device
          (
          	)

inline

Default constructor. Creates a new empty Device object. This object will be invalid until it is initialized by calling its open() function.

          openni::Device::~Device
          (
          	)

inline

The destructor calls the close() function, but it is considered a best practice for applications to call close() manually on any Device that they run open() on.

Member Function Documentation

          void openni::Device::close
          (
          	)

inline

Closes the device. This properly closes any files or shuts down hardware, as appropriate. This function is currently called by the destructor if not called manually by application code, but it is considered a best practice to manually close any device that was opened.

          const DeviceInfo& openni::Device::getDeviceInfo
          (
          	)
           const

inline

Provides information about this device in the form of a DeviceInfo object. This object can be used to access the URI of the device, as well as various USB descriptor strings that might be useful to an application.

Note that valid device info will not be available if this device has not yet been opened. If you are trying to obtain a URI to open a device, use OpenNI::enumerateDevices() instead.

Returns:

DeviceInfo object for this Device

          ImageRegistrationMode openni::Device::getImageRegistrationMode
          (
          	)
           const

inline

Gets the current image registration mode of this device. Image registration is used to properly superimpose two images from cameras located at different points in space. Please see the OpenNi 2.0 Programmer's Guide for more information about registration.

Returns:

Current image registration mode. See ImageRegistrationMode for possible return values.

          PlaybackControl* openni::Device::getPlaybackControl
          (
          	)

inline

Gets an object through which playback of a file device can be controlled.

Returns:

NULL if this device is not a file device.

          Status openni::Device::getProperty
          (
          int
          propertyId,

          void *
          data,

          int *
          dataSize

          )
          	 const

inline

Get the value of a general property of the device. There are convenience functions for all the commonly used properties, such as image registration and frame synchronization. It is expected for this reason that this function will rarely be directly used by applications.

Parameters:

[in]	propertyId	Numerical ID of the property you would like to check.

[out]	data	Place to store the value of the property.

[in,out]	dataSize	IN: Size of the buffer passed in the data argument. OUT: the actual written size.

Returns:

Status code indicating results of this operation.

template<class T >

          Status openni::Device::getProperty
          (
          int
          propertyId,

          T *
          value

          )
          	 const

inline

Checks a property that provides an arbitrary data type as its output. It is not expected that application code will need this function frequently, as all commonly used properties have higher level functions provided.

Template Parameters:

[in]	T Data type of the value to be read.

Parameters:

[in]	propertyId	The numerical ID of the property to be read.

[in,out]	value	Pointer to a place to store the value read from the property.

Returns:

Status code indicating success or failure of this operation.

          const SensorInfo* openni::Device::getSensorInfo
          (
          SensorType
          sensorType	)

inline

Get the SensorInfo for a specific sensor type on this device. The SensorInfo is useful primarily for determining which video modes are supported by the sensor.

Parameters:

[in]	sensorType	of sensor to get information about.

Returns:

SensorInfo object corresponding to the sensor type specified, or NULL if such a sensor is not available from this device.

          bool openni::Device::hasSensor
          (
          SensorType
          sensorType	)

inline

This function checks to see if one of the specific sensor types defined in SensorType is available on this device. This allows an application to, for example, query for the presence of a depth sensor, or color sensor.

Parameters:

[in]	sensorType	of sensor to query for

Returns:

true if the Device supports the sensor queried, false otherwise.

          Status openni::Device::invoke
          (
          int
          commandId,

          const void *
          data,

          int
          dataSize

          )

inline

Invokes a command that takes an arbitrary data type as its input. It is not expected that application code will need this function frequently, as all commonly used properties have higher level functions provided.

Parameters:

[in]	commandId	Numerical code of the property to be invoked.

[in]	data	Data to be passed to the property.

[in]	dataSize	size of the buffer passed in data.

Returns:

Status code indicating success or failure of this operation.

template<class T >

          Status openni::Device::invoke
          (
          int
          propertyId,

          const T &
          value

          )

inline

Invokes a command that takes an arbitrary data type as its input. It is not expected that application code will need this function frequently, as all commonly used properties have higher level functions provided.

Template Parameters:

[in]	T Type of data to be passed to the property.

Parameters:

[in]	propertyId	Numerical code of the property to be invoked.

[in]	value	Data to be passed to the property.

Returns:

Status code indicating success or failure of this operation.

          bool openni::Device::isCommandSupported
          (
          int
          commandId	)
           const

inline

Checks if a specific command is supported by the device.

Parameters:

[in]	commandId	Command to be checked.

Returns:

true if the command is supported, false otherwise.

          bool openni::Device::isFile
          (
          	)
           const

inline

Checks whether this device is a file device (i.e. a recording).

Returns:

true if this is a file device, false otherwise.

          bool openni::Device::isImageRegistrationModeSupported
          (
          ImageRegistrationMode
          mode	)
           const

inline

Checks to see if this device can support registration of color video and depth video. Image registration is used to properly superimpose two images from cameras located at different points in space. Please see the OpenNi 2.0 Programmer's Guide for more information about registration.

Returns:

true if image registration is supported by this device, false otherwise.

          bool openni::Device::isPropertySupported
          (
          int
          propertyId	)
           const

inline

Checks if a specific property is supported by the device.

Parameters:

[in]	propertyId	Property to be checked.

Returns:

true if the property is supported, false otherwise.

          bool openni::Device::isValid
          (
          	)
           const

inline

Checks whether this Device object is currently connected to an actual file or hardware device.

Returns:

true if the Device is connected, false otherwise.

          Status openni::Device::open
          (
          const char *
          uri	)

inline

Opens a device. This can either open a device chosen arbitrarily from all devices on the system, or open a specific device selected by passing this function the device URI.

To open any device, simply pass the constantANY_DEVICE to this function. If multiple devices are connected to the system, then one of them will be opened. This procedure is most useful when it is known that exactly one device is (or can be) connected to the system. In that case, requesting a list of all devices and iterating through it would be a waste of effort.

If multiple devices are (or may be) connected to a system, then a URI will be required to select a specific device to open. There are two ways to obtain a URI: from a DeviceConnected event, or by calling OpenNI::enumerateDevices().

In the case of a DeviceConnected event, the OpenNI::Listener will be provided with a DeviceInfo object as an argument to its onDeviceConnected() function. The DeviceInfo.getUri() function can then be used to obtain the URI.

If the application is not using event handlers, then it can also call the static function OpenNI::enumerateDevices(). This will return an array of DeviceInfo objects, one for each device currently available to the system. The application can then iterate through this list and select the desired device. The URI is again obtained via the DeviceInfo::getUri() function.

Standard codes of type Status are returned indicating whether opening was successful.

Parameters:

[in]	uri	String containing the URI of the device to be opened, or ANY_DEVICE.

Returns:

Status code with the outcome of the open operation.

Remarks:

For opening a recording file, pass the file path as a uri.

          Status openni::Device::setDepthColorSyncEnabled
          (
          bool
          isEnabled	)

inline

Used to turn the depth/color frame synchronization feature on and off. When frame synchronization is enabled, the device will deliver depth and image frames that are separated in time by some maximum value. When disabled, the phase difference between depth and image frame generation cannot be guaranteed.

Parameters:

[in]	isEnabled	Set to TRUE to enable synchronization, FALSE to disable it

Returns:

Status code indicating success or failure of this operation

          Status openni::Device::setImageRegistrationMode
          (
          ImageRegistrationMode
          mode	)

inline

Sets the image registration on this device. Image registration is used to properly superimpose two images from cameras located at different points in space. Please see the OpenNi 2.0 Programmer's Guide for more information about registration.

See ImageRegistrationMode for a list of valid settings to pass to this function.

It is a good practice to first check if the mode is supported by calling isImageRegistrationModeSupported().

Parameters:

[in]	mode	Desired new value for the image registration mode.

Returns:

Status code for the operation.

          Status openni::Device::setProperty
          (
          int
          propertyId,

          const void *
          data,

          int
          dataSize

          )

inline

Sets the value of a general property of the device. There are convenience functions for all the commonly used properties, such as image registration and frame synchronization. It is expected for this reason that this function will rarely be directly used by applications.

Parameters:

[in]	propertyId	The numerical ID of the property to be set.

[in]	data	Place to store the data to be written to the property.

[in]	dataSize	Size of the data to be written to the property.

Returns:

Status code indicating results of this operation.

template<class T >

          Status openni::Device::setProperty
          (
          int
          propertyId,

          const T &
          value

          )

inline

Sets a property that takes an arbitrary data type as its input. It is not expected that application code will need this function frequently, as all commonly used properties have higher level functions provided.

Template Parameters:

T	Type of data to be passed to the property.

Parameters:

[in]	propertyId	The numerical ID of the property to be set.

[in]	value	Place to store the data to be written to the property.

Returns:

Status code indicating success or failure of this operation.

The documentation for this class was generated from the following file:

OpenNI.h

<address class="footer">
Generated on Tue Jan 15 2013 19:20:02 for OpenNI 2.0 by

 1.8.1.1
</address>


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#if (defined(_M_AMD64) && !defined(_M_ARM64EC)) || defined(_M_IX86) || defined(__x86_64__) || defined(__i386__) || !defined(DISABLE_CONTRIB_OPS)

#include "core/optimizer/qdq_transformer/avx2_weight_s8_to_u8.h"
#include "core/optimizer/qdq_transformer/s8_to_u8.h"

#include <algorithm>

#include "core/graph/graph_utils.h"

namespace onnxruntime {

struct OperatorWeightInfo {
  std::vector<ONNX_NAMESPACE::OperatorSetVersion> versions;
  const char* domain;
  const size_t weights_idx;
  const size_t weight_zp_idx;
};

static const std::unordered_map<std::string, struct OperatorWeightInfo> s8_overflow_ops = {
    {"QAttention", {{1}, kMSDomain, 1, 7}},
    {"MatMulIntegerToFloat", {{1}, kMSDomain, 1, 5}},
    {"DynamicQuantizeMatMul", {{1}, kMSDomain, 1, 3}},
    {"QGemm", {{1}, kMSDomain, 3, 5}},
    {"MatMulInteger", {{10}, kOnnxDomain, 1, 3}},
    {"QLinearMatMul", {{10}, kOnnxDomain, 3, 5}},
    {"QLinearConv", {{10}, kOnnxDomain, 3, 5}},
    {"DequantizeLinear", {{10,13}, kMSDomain, 0, 2}}, // already covered in QDQS8ToU8Transformer but does not hurt
    /* {"ConvInteger", {10}, kOnnxDomain, 1, 3},  // ConvInteger does not support int8_t weight at all */
};

static inline bool MatchesOpSinceVersion(
    const Node& node, const std::vector<ONNX_NAMESPACE::OperatorSetVersion>& versions) {
  return std::find(versions.begin(), versions.end(), node.SinceVersion()) != versions.end();
}

static bool TryConvertDynamicQuantizeLSTM(Node& op_node, Graph& graph) {
  constexpr size_t w_idx = 1;
  constexpr size_t w_zp_idx = 9;
  constexpr size_t r_idx = 2;
  constexpr size_t r_zp_idx = 11;

  auto& input_defs = op_node.MutableInputDefs();
  if (input_defs.size() < 3) {
    return false;
  }

  const ONNX_NAMESPACE::TensorProto* weight_tensor_proto = nullptr;
  if (!graph_utils::NodeArgIsConstant(graph, *input_defs[w_idx]) ||
      !graph.GetInitializedTensor(input_defs[w_idx]->Name(), weight_tensor_proto) ||
      weight_tensor_proto->data_type() != ONNX_NAMESPACE::TensorProto_DataType_INT8) {
    return false;
  }
  ORT_ENFORCE(nullptr != weight_tensor_proto,
              "Internal Error: weight tensor must be const int8 for Avx2WeightS8ToU8Transformer.");

  const ONNX_NAMESPACE::TensorProto* r_tensor_proto = nullptr;
  if (!graph_utils::NodeArgIsConstant(graph, *input_defs[r_idx]) ||
      !graph.GetInitializedTensor(input_defs[r_idx]->Name(), r_tensor_proto) ||
      r_tensor_proto->data_type() != ONNX_NAMESPACE::TensorProto_DataType_INT8) {
    LOGS_DEFAULT(WARNING) << "Unable transforming DynamicQuantizeLSTM operator,"
                          << " cannot locate recurrence tensor of const int8 type,"
                          << " int8 overflow might impact precision !";
    return false;
  }
  ORT_ENFORCE(nullptr != r_tensor_proto,
              "Internal Error: recurrence tensor must be const int8 for Avx2WeightS8ToU8Transformer.");

  const ONNX_NAMESPACE::TensorProto* weight_zp_tensor_proto = nullptr;
  const auto* zp_def = input_defs.size() <= w_zp_idx ? nullptr : input_defs[w_zp_idx];
  if (nullptr != zp_def) {
    if (!graph_utils::NodeArgIsConstant(graph, *zp_def) ||
        !graph.GetInitializedTensor(zp_def->Name(), weight_zp_tensor_proto) ||
        weight_zp_tensor_proto->data_type() != ONNX_NAMESPACE::TensorProto_DataType_INT8) {
        return false;
    }
    ORT_ENFORCE(nullptr != weight_zp_tensor_proto,
                "Internal Error: weight zero point must be const int8 for Avx2WeightS8ToU8Transformer.");
  }

  const ONNX_NAMESPACE::TensorProto* r_zp_tensor_proto = nullptr;
  const auto* rzp_def = input_defs.size() <= r_zp_idx ? nullptr : input_defs[r_zp_idx];
  if (nullptr != rzp_def) {
    if (!graph_utils::NodeArgIsConstant(graph, *input_defs[r_zp_idx]) ||
        !graph.GetInitializedTensor(input_defs[r_zp_idx]->Name(), r_zp_tensor_proto) ||
        r_zp_tensor_proto->data_type() != ONNX_NAMESPACE::TensorProto_DataType_INT8) {
      LOGS_DEFAULT(WARNING) << "Unable transforming DynamicQuantizeLSTM operator,"
                            << " unable to locate recurrence tensor or its zero point value,"
                            << " int8 overflow might impact precision !";
      return false;
    }
    ORT_ENFORCE(nullptr != r_zp_tensor_proto,
                "Internal Error: recurrence zero point must be const int8 for Avx2WeightS8ToU8Transformer.");
  }

  bool should_convert = false;
  Initializer w_temp(*weight_tensor_proto, graph.ModelPath());
  {
    int8_t* p = w_temp.data<int8_t>();
    for (int i = 0; i < w_temp.size(); i++) {
      if (*p < -64 || *p > 64) {
        should_convert = true;
      }
      *p ^= 0x80;
      p++;
    }
  }

  Initializer r_temp(*r_tensor_proto, graph.ModelPath());
  {
    int8_t* p = r_temp.data<int8_t>();
    for (int i = 0; i < r_temp.size(); i++) {
      if (*p < -64 || *p > 64) {
        should_convert = true;
      }
      *p ^= 0x80;
      p++;
    }
  }

  if (!should_convert) {
    // The weights fit into S7, overflow is not a problem, no need to convert to U8
    return false;
  }

  ONNX_NAMESPACE::TensorProto weights_proto_u8;
  weights_proto_u8.set_data_type(ONNX_NAMESPACE::TensorProto_DataType_UINT8);
  weights_proto_u8.set_name(weight_tensor_proto->name() + "_s8_2_u8");
  weights_proto_u8.mutable_dims()->CopyFrom(weight_tensor_proto->dims());
  weights_proto_u8.set_raw_data(w_temp.data<int8_t>(), w_temp.size());
  input_defs[w_idx] = &graph_utils::AddInitializer(graph, weights_proto_u8);

  ONNX_NAMESPACE::TensorProto weight_zp_proto_u8;
  QDQ::Int8TensorProto2Uint8(weight_zp_tensor_proto, weight_zp_proto_u8, graph, true);
  input_defs[w_zp_idx] = &graph_utils::AddInitializer(graph, weight_zp_proto_u8);

  ONNX_NAMESPACE::TensorProto r_proto_u8;
  r_proto_u8.set_data_type(ONNX_NAMESPACE::TensorProto_DataType_UINT8);
  r_proto_u8.set_name(r_tensor_proto->name() + "_s8_2_u8");
  r_proto_u8.mutable_dims()->CopyFrom(r_tensor_proto->dims());
  r_proto_u8.set_raw_data(r_temp.data<int8_t>(), r_temp.size());
  input_defs[r_idx] = &graph_utils::AddInitializer(graph, r_proto_u8);

  ONNX_NAMESPACE::TensorProto r_zp_proto_u8;
  QDQ::Int8TensorProto2Uint8(r_zp_tensor_proto, r_zp_proto_u8, graph, true);
  input_defs[r_zp_idx] = &graph_utils::AddInitializer(graph, r_zp_proto_u8);

  return true;
}

// For QAttention operator, if the weight is const int8, convert it to const uint8
Status Avx2WeightS8ToU8Transformer::ApplyImpl(Graph& graph, bool& modified, int graph_level,
                                       const logging::Logger& logger) const {
  GraphViewer graph_viewer(graph);
  const auto& node_topology_list = graph_viewer.GetNodesInTopologicalOrder();

  for (auto node_index : node_topology_list) {
    auto* node_ptr = graph.GetNode(node_index);
    if (node_ptr == nullptr)
      continue;  // node removed as part of an earlier fusion

    Node& op_node = *node_ptr;
    ORT_RETURN_IF_ERROR(Recurse(op_node, modified, graph_level, logger));

    if (!graph_utils::IsSupportedProvider(op_node, GetCompatibleExecutionProviders())) {
      continue;  // only care about CPU operators
    }

    if (graph_utils::IsSupportedOptypeVersionAndDomain(
        op_node, "DynamicQuantizeLSTM", {1}, kMSDomain)) {
      // This one has two set of quantized arguments
      modified |= TryConvertDynamicQuantizeLSTM(op_node, graph);
      continue;  // go on to next operator node
    }

    const auto it = s8_overflow_ops.find(op_node.OpType());
    if (it == s8_overflow_ops.end()) {
      continue;  // unknown operator, next
    }

    if (
#if !defined(ORT_MINIMAL_BUILD)
        !op_node.Op()->Deprecated() &&
#endif
        MatchesOpSinceVersion(op_node, it->second.versions) &&
        graph_utils::MatchesOpSetDomain(op_node, it->second.domain)) {
      modified |= QDQ::ConvertS8WeightToU8(graph, op_node,
                                      it->second.weights_idx,
                                      it->second.weight_zp_idx);
      continue;  // finished with this op, next
    }

  }

  return Status::OK();
}

}  // namespace onnxruntime

#endif  // x86 or x64


text:
package com.spike.giantdataanalysis.task.execution.application.core;

public interface ApplicationWorkloadAssignor extends ApplicationWorkloadHandler {

}


text:
/************************************************************************/
/*  File Description:                                       			*/
/*                                                    					*/
/*  This file contains a basic library for the PmodBT2.           		*/
/*                                                      				*/
/************************************************************************/
/*  Revision History:                                       			*/
/*                                                      				*/
/*  07/12/2016(TommyK, MikelS): Created                           		*/
/*                                                      				*/
/************************************************************************/

#ifndef PMODBT2_H
#define PMODBT2_H

/****************** Include Files ********************/
#include "xil_types.h"
#include "xstatus.h"
#include "xuartns550_l.h"
#include "xuartns550.h"
#include "xparameters.h"

#ifdef XPAR_XINTC_NUM_INSTANCES
 #include "xintc.h"
 #define INTC   XIntc
 #define INTC_HANDLER XIntc_InterruptHandler
#elif XPAR_FABRIC_PMODBT2_0_BT2_UART_INTERRUPT_INTR
 #include "xscugic.h"
 #define INTC   XScuGic
 #define INTC_HANDLER XScuGic_InterruptHandler
#else
#define NO_IRPT 1
#endif

#ifdef XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ
#define PERIPHERAL_CLK 100000000 //FCLK0 frequency is not in Xparameters.h for some reason
#else
#define PERIPHERAL_CLK XPAR_CPU_M_AXI_DP_FREQ_HZ
#endif

#define bool u8
#define true 1
#define false 0

/**************************** Type Definitions *****************************/
/**
 * Write a value to a PMODBT2 register. A 32 bit write is performed.
 * If the component is implemented in a smaller width, only the least
 * significant data is written.
 *
 * @param   BaseAddress is the base address of the PMODBT2device.
 * @param   RegOffset is the register offset from the base to write to.
 * @param   Data is the data written to the register.
 *
 * @return  None.
 *
 * @note
 * C-style signature:
 *  void PMODBT2_mWriteReg(u32 BaseAddress, unsigned RegOffset, u32 Data)
 */
#define PMODBT2_mWriteReg(BaseAddress, RegOffset, Data) \
    Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))

/**
 * Read a value from a PMODBT2 register. A 32 bit read is performed.
 * If the component is implemented in a smaller width, only the least
 * significant data is read from the register. The most significant data
 * will be read as 0.
 *
 * @param   BaseAddress is the base address of the PMODBT2 device.
 * @param   RegOffset is the register offset from the base to write to.
 *
 * @return  Data is the data from the register.
 *
 * @note
 * C-style signature:
 *  u32 PMODBT2_mReadReg(u32 BaseAddress, unsigned RegOffset)
 */
#define PMODBT2_mReadReg(BaseAddress, RegOffset) \
    Xil_In32((BaseAddress) + (RegOffset))

/************************** Function Prototypes ****************************/
XStatus PMODBT2_Reg_SelfTest(void * baseaddr_p);

typedef struct PmodBT2{
  u32 GPIO_addr;
#ifndef NO_IRPT
  INTC intc;
  void (* recvHandler)(int bytesRecv);
  void (* sendHandler)(int bytesSent);
  void (* timeoutHandler)(int bytesSent);
#endif
  XUartNs550 BT2Uart;
  char recv[600];
}PmodBT2;

void BT2_begin(PmodBT2* InstancePtr, u32 GPIO_Address, u32 UART_Address);
int BT2_getData(PmodBT2* InstancePtr, int buffersize);
int BT2_sendData(PmodBT2* InstancePtr, char* sendData, int size);
int BT2_changeBaud(PmodBT2* InstancePtr, int baud);
int BT2_UARTInit(XUartNs550 *UartInstancePtr);
int BT2_ReadRTS(PmodBT2* InstancePtr);
int BT2_ReadCTS(PmodBT2* InstancePtr);
void BT2_WriteRTS(PmodBT2* InstancePtr, bool enable);
void BT2_WriteCTS(PmodBT2* InstancePtr, bool enable);
bool BT2_getLine(PmodBT2* InstancePtr, char* output);
int BT2_SetupInterruptSystem(PmodBT2* InstancePtr, u32 interruptDeviceID, u32 interruptID, void* recvHandler, void* sendHandler, void* timeoutHandler);
void BT2_intHandler(PmodBT2* InstancePtr, u32 Event, unsigned int EventData);

#endif // PMODBT2_H


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { DynamicPropsListComponent } from './dynamic-props-list.component';
import { CdCommonModule, CdPropertiesModule } from 'cd-common';
import { DynamicPropsListPickerDirective } from './picker.directive';
import {
  IsDynamicListItemSelectedPipe,
  ItemLabelLookupPipe,
  DynamicListItemCheckboxTooltipPipe,
} from './dynamic-props-list.pipe';

@NgModule({
  declarations: [
    DynamicPropsListComponent,
    DynamicPropsListPickerDirective,
    ItemLabelLookupPipe,
    IsDynamicListItemSelectedPipe,
    DynamicListItemCheckboxTooltipPipe,
  ],
  imports: [CommonModule, CdCommonModule, CdPropertiesModule, DragDropModule],
  exports: [DynamicPropsListComponent, DynamicPropsListPickerDirective],
})
export class DynamicPropsListModule {}


text:
import json
import falcon
import falcon.testing as testing

from notify.core import handlers

class TestAPI(testing.TestBase):
    def before(self):
        # TestBase provides an instance of falcon.API to use along
        # with simulate_request (see below).
        self.api.add_route('/health', handlers.GetHealth())
        self.api.add_route('/api/notify', handlers.NotifyEvent())

    def test_get_health(self):
        # TestBase provides a method to simulate a WSGI request without
        # having to stand up an actual server. The decode option tells
        # simulate_request to convert the raw WSGI response into a
        # Unicode string.
        body = self.simulate_request('/health', decode='utf-8')

        # TestBase provides an instance of StartResponseMock that captures
        # the data passed to WSGI's start_response callback. This includes
        # the status code and headers returned by the Falcon app.
        self.assertEqual(self.srmock.status, falcon.HTTP_200)
        json_body = json.loads(body)
        self.assertEqual(json_body, {'status': 'OK'})

    def test_post_slack_event(self):
        body = json.dumps({
            'org_name': 'qoneci',
            'message': 'foo bar',
            'services': ['slack'],
            'channel_name': 'test',
        })
        headers = {'content-type': 'application/json'}
        self.simulate_request(
            '/api/notify',
            method='POST',
            decode='utf-8',
            headers=headers,
            body=body
        )
        self.assertEqual(self.srmock.status, falcon.HTTP_201)

    def test_post_multi_event(self):
        body = json.dumps({
            'org_name': 'qoneci',
            'message': 'foo bar',
            'services': ['slack', 'datadog'],
            'channel_name': 'test',
            'alert_type': 'info',
            'tags': ['testing:test'],
        })
        headers = {'content-type': 'application/json'}
        self.simulate_request(
            '/api/notify',
            method='POST',
            decode='utf-8',
            headers=headers,
            body=body
        )
        self.assertEqual(self.srmock.status, falcon.HTTP_201)

    def test_post_event_invalid_json_body(self):
        body = str({'alert_type': 'info', 'tags': ['testing:test']})
        headers = {'content-type': 'application/json'}
        self.simulate_request(
            '/api/notify',
            method='POST',
            decode='utf-8',
            headers=headers,
            body=body
        )
        self.assertEqual(self.srmock.status, falcon.HTTP_753)


text:
<?php

namespace EVT\CoreDomain\Tests;

use EVT\CoreDomain\Email;
use EVT\CoreDomain\EmailCollection;

class EmailCollectionTest extends \PHPUnit_Framework_TestCase
{
    public function testCreation()
    {
        $emailCollection = new EmailCollection(new Email('valid@email.com'));
        $this->assertCount(1, $emailCollection);
    }
}


text:
"""
This is the core database connection.

All Django code assumes database SELECT statements cast the resulting values as such:
    * booleans are mapped to Python booleans
    * dates are mapped to Python datetime.date objects
    * times are mapped to Python datetime.time objects
    * timestamps are mapped to Python datetime.datetime objects
"""

from django.conf.settings import DATABASE_ENGINE

try:
    dbmod = __import__('django.core.db.backends.%s' % DATABASE_ENGINE, '', '', [''])
except ImportError, exc:
    # The database backend wasn't found. Display a helpful error message
    # listing all possible database backends.
    from django.core.exceptions import ImproperlyConfigured
    import os
    backend_dir = os.path.join(__path__[0], 'backends')
    available_backends = [f[:-3] for f in os.listdir(backend_dir) if f.endswith('.py') and not f.startswith('__init__')]
    available_backends.sort()
    raise ImproperlyConfigured, "Could not load database backend: %s. Is your DATABASE_ENGINE setting (currently, %r) spelled correctly? Available options are: %s" % \
        (exc, DATABASE_ENGINE, ", ".join(map(repr, available_backends)))

DatabaseError = dbmod.DatabaseError
db = dbmod.DatabaseWrapper()
dictfetchone = dbmod.dictfetchone
dictfetchmany = dbmod.dictfetchmany
dictfetchall = dbmod.dictfetchall
dictfetchall = dbmod.dictfetchall
get_last_insert_id = dbmod.get_last_insert_id
get_date_extract_sql = dbmod.get_date_extract_sql
get_date_trunc_sql = dbmod.get_date_trunc_sql
get_limit_offset_sql = dbmod.get_limit_offset_sql
get_random_function_sql = dbmod.get_random_function_sql
get_table_list = dbmod.get_table_list
get_relations = dbmod.get_relations
OPERATOR_MAPPING = dbmod.OPERATOR_MAPPING
DATA_TYPES = dbmod.DATA_TYPES
DATA_TYPES_REVERSE = dbmod.DATA_TYPES_REVERSE


text:
<?php

include_once("../../../../_setup.php");
include_once("../../../../classes/member.php");
include_once("../../../../classes/basicorder.php");

$consoleObj = new ConsoleOption($mysqli);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);

$cID = $consoleObj->findConsoleIDByName("Member Application");
$consoleObj->select($cID);

$appComponentObj = new BasicOrder($mysqli, "app_components", "appcomponent_id");

if($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj)) {

	$memberInfo = $member->get_info_filtered();

	if($appComponentObj->select($_POST['acID'])) {

		$member->logAction("Modified the member application component order.");

		$appComponentObj->move($_POST['acDir']);

		include("appcomponentlist.php");

	}

}

?>


text:
/** @file stk_mixed_connection_api.h
 * The Mixed Connection module provides the ability to combine
 * listener and client data flows as a single data flow.
 * Currently it only supports UDP listeners and clients, but
 * in the future will support mixing TCP and UDP listeners/clients.
 *
 * This module implements the data flow interface specified by the
 * Sequence Toolkit. Applications should use the create API
 * defined here, but use the standard destroy/send/receive
 * APIs in stk_data_flow_api.h
 * Applications may only send sequences on data flows.
 */
#ifndef STK_MIXED_CONNECTION_API_H
#define STK_MIXED_CONNECTION_API_H
#include "stk_data_flow.h"

/**
 * Create a  Mixed connection (sender) data flow
 * \see stk_options.txt for accepted options
 * \see stk_data_flow.h
 * \returns A handle to a Sequence Data Flow
 */
stk_data_flow_t *stk_mixed_connection_create_data_flow(stk_env_t *env,char *name,stk_uint64 id,stk_options_t *options);
/**
 * Receive data from a mixed connection data flow
 * \returns The sequence containing received data (if any)
 */
stk_sequence_t *stk_mixed_connection_data_flow_rcv(stk_data_flow_t *df,stk_sequence_t *data_sequence,stk_uint64 flags);
/**
 * Get the Listener File Descriptor for a data flow. Applications may use this to
 * register with an event processing loop which calls select()/poll() etc.
 * \returns The Listener File Descriptor.
 */
int stk_mixed_connection_listener_fd(stk_data_flow_t *df);
/**
 * Get the Client File Descriptor for a data flow. Applications may use this to
 * register with an event processing loop which calls select()/poll() etc.
 * \returns The Client File Descriptor.
 */
int stk_mixed_connection_client_fd(stk_data_flow_t *df);
/**
 * Get the IP acting as the ID for this data flow.
 * \returns Whether the IP address was filled out
 */
stk_ret stk_mixed_connection_data_flow_id_ip(stk_data_flow_t *df,struct sockaddr *data_flow_id,socklen_t addrlen);

#endif


text:
#include <aws/codestar/model/AssociateTeamMemberRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::CodeStar::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

AssociateTeamMemberRequest::AssociateTeamMemberRequest() :
    m_projectIdHasBeenSet(false),
    m_clientRequestTokenHasBeenSet(false),
    m_userArnHasBeenSet(false),
    m_projectRoleHasBeenSet(false),
    m_remoteAccessAllowed(false),
    m_remoteAccessAllowedHasBeenSet(false)
{
}

Aws::String AssociateTeamMemberRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_projectIdHasBeenSet)
  {
   payload.WithString("projectId", m_projectId);

  }

  if(m_clientRequestTokenHasBeenSet)
  {
   payload.WithString("clientRequestToken", m_clientRequestToken);

  }

  if(m_userArnHasBeenSet)
  {
   payload.WithString("userArn", m_userArn);

  }

  if(m_projectRoleHasBeenSet)
  {
   payload.WithString("projectRole", m_projectRole);

  }

  if(m_remoteAccessAllowedHasBeenSet)
  {
   payload.WithBool("remoteAccessAllowed", m_remoteAccessAllowed);

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection AssociateTeamMemberRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "CodeStar_20170419.AssociateTeamMember"));
  return headers;

}


text:
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    viewer.setMainQmlFile(QStringLiteral("qml/qtqml/main.qml"));
    viewer.showExpanded();

    return app.exec();
}


text:
// AGENTDLG.CPP - Dialog to run the AGENT code
//
// This is a part of the TAPI Applications Classes C++ library.
// Original Copyright © 1995-2004 JulMar Entertainment Technology, Inc. All rights reserved.
//
// "This program is free software; you can redistribute it and/or modify it under the terms of
// the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
// even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program; if not, write
// to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// Or, contact: JulMar Technology, Inc. at: info@julmar.com."

#include "stdafx.h"
#include "AgentDlg.h"
#include "AddAgent.h"
#include "SetAgentGroup.h"
#include "SetAgentState.h"
#include "AgentProperties.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define UM_AGENTCHANGE (WM_USER + 100)

class CMyLine : public CTapiLine
{
	DECLARE_DYNCREATE (CMyLine)

// Overrides
protected:
	virtual void OnAgentStateChange (DWORD dwAddressID, DWORD dwFields, DWORD dwState) {
		CTapiLine::OnAgentStateChange(dwAddressID, dwFields, dwState);
		if (AfxGetApp()->m_pMainWnd != NULL)
			AfxGetApp()->m_pMainWnd->PostMessage(UM_AGENTCHANGE, (WPARAM)GetDeviceID(), (LPARAM)dwAddressID);
	}
};

IMPLEMENT_DYNCREATE (CMyLine, CTapiLine)

/////////////////////////////////////////////////////////////////////////////
// Globals

CMainApp theApp;

/*------------------------------------------------------------------------------
    LISTVIEW COLUMN STRUCTURE
  This structure defines the column information which is setup for
  a listview control on our main view.
--------------------------------------------------------------------------------*/
struct
{
	const char * pszName;		// Name for the column
	int iWidth;					// Size of the column in characters

} g_AgentColumns[] = {
	{ "Line",			15 },
	{ "Address",		15 },
	{ "Agent State",	15 },
	{ "Next State",		15 }
};
#define TOTAL_CALL_COLUMNS (sizeof(g_AgentColumns) / sizeof(g_AgentColumns[0]))

/////////////////////////////////////////////////////////////////////////////
// CMainApp::InitInstance
//
// Initialize the main application
//
BOOL CMainApp::InitInstance()
{
    // Initialize a connection with TAPI and determine if there
    // are any TAPI complient devices installed.
    if (GetTAPIConnection()->Init ("AgentMonitor", RUNTIME_CLASS(CMyLine)) != 0 ||
        GetTAPIConnection()->GetLineDeviceCount() == 0)
    {
        AfxMessageBox ("There are no TAPI devices installed!");
		return FALSE;
    }

	// Create our dialog.
	CAgentDlg dlg;
	m_pMainWnd = &dlg;
	dlg.DoModal();
	m_pMainWnd = NULL;

	return FALSE;

}// CMainApp::InitInstance

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::CAgentDlg
//
// Constructor for the agent dialog
//
CAgentDlg::CAgentDlg(CWnd* pParent) : CDialog(CAgentDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAgentDlg)
	//}}AFX_DATA_INIT
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

}// CAgentDlg::CAgentDlg

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::DoDataExchange
//
// Dialog data exchange for the answer dialog
//
void CAgentDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAgentDlg)
	DDX_Control(pDX, IDC_SETAGENTSTATE, m_btnSetAgentState);
	DDX_Control(pDX, IDC_SETAGENTGROUP, m_btnSetAgentGroup);
	DDX_Control(pDX, IDC_SETAGENTACTIVITY, m_btnSetAgentActivity);
	DDX_Control(pDX, IDC_REMOVE, m_btnRemove);
	DDX_Control(pDX, IDC_ADD, m_btnAdd);
	DDX_Control(pDX, IDC_AGENTS, m_lcAgents);
	//}}AFX_DATA_MAP
}

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg message map

BEGIN_MESSAGE_MAP(CAgentDlg, CDialog)
	//{{AFX_MSG_MAP(CAgentDlg)
	ON_MESSAGE(UM_AGENTCHANGE, OnAgentStateChange)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_ADD, OnAddAgent)
	ON_BN_CLICKED(IDC_REMOVE, OnRemoveAgent)
	ON_BN_CLICKED(IDC_SETAGENTACTIVITY, OnSetAgentActivity)
	ON_BN_CLICKED(IDC_SETAGENTGROUP, OnSetAgentGroup)
	ON_BN_CLICKED(IDC_SETAGENTSTATE, OnSetAgentState)
	ON_NOTIFY(LVN_ITEMCHANGED, IDC_AGENTS, OnAgentChange)
	ON_NOTIFY(LVN_GETDISPINFO, IDC_AGENTS, OnGetDispInfo)
	ON_NOTIFY(NM_DBLCLK, IDC_AGENTS, OnDblclkAgents)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::OnInitDialog
//
// Manage the creation of our dialog box.
//
BOOL CAgentDlg::OnInitDialog()
{
    // Reset the font to all be ANSI var.
    CFont fntAnsi;
    fntAnsi.CreateStockObject (ANSI_VAR_FONT);
    CWnd* pwndChild = GetWindow (GW_CHILD);
    while (pwndChild != NULL && IsChild(pwndChild))
    {
        pwndChild->SetFont(&fntAnsi);
        pwndChild = pwndChild->GetWindow(GW_HWNDNEXT);
    }

	// Connect all the controls via DDX
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// Setup our list view.
	// Get the metrics which are being used for this control.
	CDC* pDC = m_lcAgents.GetDC();
	TEXTMETRIC tm;
	pDC->GetTextMetrics(&tm);
	m_lcAgents.ReleaseDC(pDC);

	// Setup the TAPI call list
	for (int i = 0; i < TOTAL_CALL_COLUMNS; i++)
		m_lcAgents.InsertColumn (i, g_AgentColumns[i].pszName, LVCFMT_LEFT,
							tm.tmAveCharWidth*(g_AgentColumns[i].iWidth+1));

	// Setup the initial button states
	UpdateButtons();

	if (AfxGetApp()->GetProfileInt("JTAgent", "Reload", 0))
	{
		int iCount = AfxGetApp()->GetProfileInt("JTAgent", "ReloadCount", 0);
		for (int i = 0; i < iCount; i++)
		{
			CString strEntry, strAgent;
			strEntry.Format("Reload%d", i);
			strAgent = AfxGetApp()->GetProfileString("JTAgent", strEntry);
			DWORD dwAgent = (DWORD) atol(strAgent);
			AddAgentToList(dwAgent);
		}
	}
	return TRUE;

}// CAgentDlg::OnInitDialog

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::OnPaint
//
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon.  For MFC applications using the document/view model,
// this is automatically done for you by the framework.
//
void CAgentDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
		CDialog::OnPaint();
}// CAgentDlg::OnPaint

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::OnQueryDragIcon
//
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
//
HCURSOR CAgentDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;

}// CAgentDlg::OnQueryDragIcon

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::UpdateButtons
//
// Enable/Disable the buttons based on our current states
//
void CAgentDlg::UpdateButtons()
{
	int iPos = GetSelectedAgent();
	m_btnRemove.EnableWindow(iPos  != -1);
	if (iPos >= 0)
	{
		DWORD_PTR dwIndex = m_lcAgents.GetItemData(iPos);
		CTapiLine* pLine = GetTAPIConnection()->GetLineFromDeviceID(LOWORD(dwIndex));
		if (pLine != NULL)
		{
			LPLINEAGENTSTATUS lpStatus = pLine->GetAddress(HIWORD(dwIndex))->GetAgentStatus();
			if (lpStatus != NULL)
			{
				m_btnSetAgentState.EnableWindow((lpStatus->dwAgentFeatures & LINEAGENTFEATURE_SETAGENTSTATE) != 0);
				m_btnSetAgentGroup.EnableWindow((lpStatus->dwAgentFeatures & LINEAGENTFEATURE_SETAGENTGROUP) != 0);
				m_btnSetAgentActivity.EnableWindow((lpStatus->dwAgentFeatures & LINEAGENTFEATURE_SETAGENTACTIVITY) != 0);
				return;
			}
		}

		m_btnSetAgentState.EnableWindow(FALSE);
		m_btnSetAgentGroup.EnableWindow(FALSE);
		m_btnSetAgentActivity.EnableWindow(FALSE);
	}

}// CAgentDlg::UpdateButtons

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::GetSelectedAgent
//
// Return the first selected agent
//
int CAgentDlg::GetSelectedAgent()
{
	for (int i = 0; i < m_lcAgents.GetItemCount(); i++)
	{
		if (m_lcAgents.GetItemState(i, LVIS_SELECTED))
			return i;
	}
	return -1;

}// CAgentDlg::GetSelectedAgent

/////////////////////////////////////////////////////////////////////////////
// CAgentDlg::OnAddAgent
//
// Adds an agent (or more than one) to our list view.
//
void CAgentDlg::OnAddAgent()
{
	m_btnAdd.EnableWindow(FALSE);

	CAddAgent dlg(this);
	dlg.DoModal();

	m_btnAdd.EnableWindow(TRUE);

}// CAgentDlg::OnAddAgent

void CAgentDlg::OnRemoveAgent()
{
	int iPos = GetSelectedAgent();
	m_lcAgents.DeleteItem(iPos);
	if (m_lcAgents.GetItemCount() > 0)
		m_lcAgents.SetItemState(iPos, LVIS_SELECTED | LVIS_FOCUSED, 0);
}

void CAgentDlg::OnSetAgentActivity()
{
	m_lcAgents.RedrawItems (0, m_lcAgents.GetItemCount());
}

void CAgentDlg::OnSetAgentGroup()
{
	m_btnSetAgentGroup.EnableWindow(FALSE);

	CSetAgentGroup dlg(this);
	dlg.DoModal();

	m_btnSetAgentGroup.EnableWindow(TRUE);
	m_lcAgents.RedrawItems (0, m_lcAgents.GetItemCount());
}

void CAgentDlg::OnSetAgentState()
{
	m_btnSetAgentState.EnableWindow(FALSE);
	CSetAgentState dlg(this);
	dlg.DoModal();
	m_btnSetAgentState.EnableWindow(TRUE);
	m_lcAgents.RedrawItems (0, m_lcAgents.GetItemCount());
}

int CAgentDlg::FindAgentByID(DWORD dwID)
{
	for (int i = 0; i < m_lcAgents.GetItemCount(); i++)
	{
		if (m_lcAgents.GetItemData(i) == dwID)
			return i;
	}
	return -1;
}

void CAgentDlg::AddAgentToList(DWORD dwID)
{
	if (FindAgentByID(dwID) != -1)
		return;

    CTapiLine* pLine = GetTAPIConnection()->GetLineFromDeviceID(LOWORD(dwID));
	if (pLine == NULL || pLine->IsValid() == FALSE)
		return;

	LONG lResult = pLine->Open (LINECALLPRIVILEGE_NONE, LINEMEDIAMODE_UNKNOWN);
	if (lResult == 0)
	{
		CString strLineName = pLine->GetLineName();

		// Use the following LV_ITEM structure to add all
		// the item information.
		LV_ITEM lvItem;
		lvItem.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
		lvItem.state = 0;
		lvItem.stateMask = 0;
		lvItem.pszText = LPSTR_TEXTCALLBACK;
		lvItem.cchTextMax = 0;
		lvItem.iSubItem = 0;
		lvItem.lParam = (LONG) dwID;

		lvItem.iItem = m_lcAgents.GetItemCount();
		int i = m_lcAgents.InsertItem (&lvItem);

		// Now set the other rows.
		for (int x = 1; x < TOTAL_CALL_COLUMNS; x++)
			m_lcAgents.SetItemText (i, x, LPSTR_TEXTCALLBACK);
	}

	UpdateButtons();
}

void CAgentDlg::OnGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult)
{
	LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
	LV_ITEM* pItem = &pDispInfo->item;
	DWORD dwIndex = (DWORD) pItem->lParam;

    CTapiLine* pLine = GetTAPIConnection()->GetLineFromDeviceID(LOWORD(dwIndex));
	if (pLine == NULL)
	{
		m_lcAgents.DeleteItem(pItem->iItem);
		return;
	}

	LPLINEAGENTSTATUS lpStatus = pLine->GetAddress(HIWORD(dwIndex))->GetAgentStatus();
	if (lpStatus == NULL)
		return;

	static char szBuffer[255];

	// See if it wants text for one of the fields.
	if (pItem->mask & LVIF_TEXT)
	{
		switch (pItem->iSubItem)
		{
			case 0: // Line
				strcpy(szBuffer, pLine->GetLineName());
				pItem->pszText = szBuffer;
				break;

			case 1: // Address
				wsprintf (szBuffer, "0x%lx %s", HIWORD(dwIndex), pLine->GetAddress(HIWORD(dwIndex))->GetDialableAddress());
				pItem->pszText = szBuffer;
				break;

			case 2: // Agent State
			{
				wsprintf(szBuffer, "%s 0x%lx", GetAgentStateString(lpStatus->dwState), lpStatus->dwState);
				pItem->pszText = szBuffer;
				break;
			}

			case 3: // Agent Next State
			{
				wsprintf(szBuffer, "%s 0x%lx", GetAgentStateString(lpStatus->dwNextState), lpStatus->dwNextState);
				pItem->pszText = szBuffer;
				break;
			}
		}
	}

	*pResult = 0;

}// CAgentDlg::OnGetDispInfo

int CAgentDlg::GetAgentCount()
{
	return m_lcAgents.GetItemCount();

}// CAgentDlg::GetAgentCount

DWORD CAgentDlg::GetAgent(int iPos)
{
	if (iPos >= 0 && iPos < GetAgentCount())
		return static_cast<DWORD>(m_lcAgents.GetItemData(iPos));
	return static_cast<DWORD>(-1);

}// CAgentDlg::GetAgent

LRESULT CAgentDlg::OnAgentStateChange(WPARAM wParam, LPARAM lParam)
{
	int iPos = FindAgentByID(MAKELONG((WORD)wParam, (WORD)lParam));
	m_lcAgents.RedrawItems (iPos, iPos);
	return 0L;

}// CAgentDlg::OnAgentStateChange

void CAgentDlg::OnDblclkAgents(NMHDR* pNMHDR, LRESULT* pResult)
{
	UNREFERENCED_PARAMETER(pNMHDR);

	int iPos = GetSelectedAgent();
	if (iPos >= 0)
	{
		DWORD dwIndex = static_cast<DWORD>(m_lcAgents.GetItemData(iPos));
		CAgentProperties dlg(this, dwIndex);
		dlg.DoModal();
	}
	*pResult = 0;
}

void CAgentDlg::OnAgentChange(NMHDR* pNMHDR, LRESULT* pResult)
{
	UNREFERENCED_PARAMETER(pNMHDR);
	UpdateButtons();
	*pResult = 0;

}// CAgentDlg::OnAgentChange

LPCSTR CAgentDlg::GetAgentStateString(DWORD dwAgentState)
{
	switch (dwAgentState)
	{
		case LINEAGENTSTATE_LOGGEDOFF:	return "Logged Off";
		case LINEAGENTSTATE_NOTREADY:	return "Not Ready";
		case LINEAGENTSTATE_READY:		return "Ready";
		case LINEAGENTSTATE_BUSYACD:	return "Busy ACD";
		case LINEAGENTSTATE_BUSYINCOMING: return "Busy Incoming";
		case LINEAGENTSTATE_BUSYOUTBOUND: return "Busy Outbound";
		case LINEAGENTSTATE_BUSYOTHER:	return "Busy Other";
		case LINEAGENTSTATE_WORKINGAFTERCALL: return "Call Work";
		case LINEAGENTSTATE_UNAVAIL: return "Unavailable";
	}
	return "Unknown";

}// CAgentDlg::GetAgentStateString


text:
<!DOCTYPE HTML>

<meta charset="utf-8">
<title>Hangman Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{{ url_for('static', filename='styles/hangman.css') }}" rel="stylesheet" type="text/css">

Hangman Admin

JavaScript must be enabled to play this game.

Get Players

        <input class="select_radio" type="radio" name="player_sortby" value="wins">Wins
        <input class="select_radio" type="radio" name="player_sortby" value="losses">Losses
        <input class="select_radio" type="radio" name="player_sortby" value="alphabetical" checked>Alphabetical

        <input class="select_radio" type="radio" name="player_order" value="asc" checked>Asc
        <input class="select_radio" type="radio" name="player_order" value="desc">Desc

Get Words

        <input class="select_radio" type="radio" name="words_sortby" value="solved">Solved
        <input class="select_radio" type="radio" name="words_sortby" value="length">Length
        <input class="select_radio" type="radio" name="words_sortby" value="alphabetical" checked>Alphabetical

        <input class="select_radio" type="radio" name="words_order" value="asc" checked>Asc
        <input class="select_radio" type="radio" name="words_order" value="desc">Desc


text:
<nx-drawer>
    <competition-nav drawer-aside-left></competition-nav>

    <nx-nav>

        <ion-icon nav-right nav="true" icon="ion-android-favorite"></ion-icon>
    </nx-nav>

    <nx-content (refreshStarted)="refresh($event)">
        <StackLayout class="inset">
            <nx-list>
                <nx-header item-top>

                </nx-header>
                <nx-item animate="true" pageTransition="slide" [nsRouterLink]="['startList']">
                    <nx-icon item-left icon="assignment"></nx-icon>

                    <nx-icon item-right icon="chevron_right"></nx-icon>
                </nx-item>
                <nx-item animate="true" pageTransition="slide" [nsRouterLink]="['gradeList']">
                    <nx-icon item-left icon="assignment"></nx-icon>

                    <nx-icon item-right icon="chevron_right"></nx-icon>
                </nx-item>
                <nx-item animate="true" pageTransition="slide" [nsRouterLink]="['clubList']">
                    <nx-icon item-left icon="assignment"></nx-icon>

                    <nx-icon item-right icon="chevron_right"></nx-icon>
                </nx-item>
                <nx-item animate="true" pageTransition="slide" [nsRouterLink]="['findCompetitor']">
                    <nx-icon item-left icon="search"></nx-icon>

                    <nx-icon item-right icon="chevron_right"></nx-icon>
                </nx-item>

            </nx-list>

            <nx-list>
                <nx-item>

                </nx-item>
            </nx-list>

        </StackLayout>
    </nx-content>

</nx-drawer>


text:
if [ $# -ne 3 ]; then
    echo "Error: Requires exactly three arguments: Your GitHub username, the target GitHub username, and a GitHub team ID."
    echo
    exit 1;
fi

# Module constants
API_BASE="https://api.github.com"
API_VER_ACCEPTS="application/vnd.github.v3+json"

# Collect cmd args
TARGET_GITHUB_USERNAME=$1
GITHUB_TEAM_ID=$2
AUTH_TOKEN=$3

# Make sure user's username exists
echo "Checking username '$TARGET_GITHUB_USERNAME'..."
USER_EXISTS="$(./is-valid-user $TARGET_GITHUB_USERNAME || exit 1)"
if [ $USER_EXISTS = "false" ]; then
    echo "Error: User '$TARGET_GITHUB_USERNAME' does not exist."
    echo
    exit 1
fi
echo "User '$TARGET_GITHUB_USERNAME' is valid."
echo

# Construct curl command
cmd="curl -s -i -X PUT -u $AUTH_TOKEN:x-oauth-basic -d '' -H 'Accepts:$API_VER_ACCEPTS' $API_BASE/teams/$GITHUB_TEAM_ID/members/$TARGET_GITHUB_USERNAME"

# Capture stdout
cmd_out="$($cmd || exit 1)"

# Sniff the HTTP response status
http_status="$(echo $cmd_out | cut -d ' ' -f 2)"

# If we did not get a 204, something went wrong. Exit with failure
if [ $http_status -ne 204 ]; then
    echo "Error adding member to team! Are you sure it exists?"
    echo "Response header + body from GitHub:"
    echo
    echo "$cmd_out"
    echo
    exit 1
fi


text:
"""URLs for search"""
from django.conf.urls import url

from search.views import SearchView, RelatedPostsView, SimilarResourcesView

urlpatterns = [
    url(r"api/v0/search/", SearchView.as_view(), name="search"),
    url(
        r"api/v0/related/(?P<post_id>[A-Za-z0-9_]+)/$",
        RelatedPostsView.as_view(),
        name="related-posts",
    ),
    url(r"api/v0/similar/$", SimilarResourcesView.as_view(), name="similar-resources"),
]


text:
dest=${TARGET-/usr/}/bin
echo "using $dest as installation directory";
mkdir -p $dest

# downlownload version
VERSION='2.0.4'
rm -rf hisat-${VERSION}*
wget "ftp://ftp.ccb.jhu.edu/pub/infphilo/hisat2/downloads/hisat2-${VERSION}-Linux_x86_64.zip"
unzip hisat2-${VERSION}-Linux_x86_64.zip
rm hisat2-${VERSION}-Linux_x86_64.zip
# compile and copy binaries
cd hisat2-${VERSION}
#make
#mkdir -p dest/bin
cp hisat2-inspect-s hisat2_test_HLA_genotyping.py hisat2_build_genotype_genome.py hisat2_simulate_reads.py hisat2_extract_snps_haplotypes_UCSC.py hisat2_extract_HLA_vars.py hisat2-build-l-debug hisat2-inspect-s-debug hisat2_extract_exons.py hisat2_test_BRCA_genotyping.py hisat2_extract_splice_sites.py hisat2-build-l hisat2-inspect-l-debug hisat2_genotype.py hisat2-inspect hisat2-align-l hisat2_extract_snps_haplotypes_VCF.py hisat2 extract_exons.py hisat2-align-s-debug hisat2-build-s hisat2-align-s extract_splice_sites.py hisat2-inspect-l hisat2-build-s-debug hisat2-build hisat2-align-l-debug $dest
cd ..
rm -rf hisat-${VERSION}
ver=`hisat2 --version`
echo "${ver} is successfully installed"


text:
<?xml version="1.0"?>
<Document>

	<Sentence>
		<value>Type 2 diabetes is a lifelong (chronic) disease in which there is a high level of sugar (glucose) in the blood.</value>
		<pattern_crowdsource> Type 2 diabetes is a lifelong (chronic) disease in which there is a high level of [[sugar|C0242209]] ([[glucose|C0017725]]) in the [[blood|C0005767]].		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Type 2 diabetes</surface-form>
				<RDF-ID>C0011860</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>chronic) disease</surface-form>
				<RDF-ID>C0008679</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>high</surface-form>
				<RDF-ID>C0205250</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>sugar</surface-form>
				<RDF-ID>C0242209</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>glucose</surface-form>
				<RDF-ID>C0017725</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>blood</surface-form>
				<RDF-ID>C0005767</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0017725 ISA C0242209</triple>
			<triple>C0005767 LOCATION_OF C0242209</triple>
			<triple>C0005767 LOCATION_OF C0017725</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>Type 2 diabetes is the most common form of diabetes.</value>
		<pattern_crowdsource> [[Type 2 diabetes|C0011860]] is the most common form of [[diabetes|C0011847]].		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Type 2 diabetes</surface-form>
				<RDF-ID>C0011860</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>most</surface-form>
				<RDF-ID>C0205393</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>common</surface-form>
				<RDF-ID>C0205214</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>form</surface-form>
				<RDF-ID>C1522492</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>diabetes</surface-form>
				<RDF-ID>C0011847</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0011860 ISA C0011847</triple>
		</triples>
	</Sentence>

</Document>


text:
<html>
<!--
This test makes sure that referrer is properly set.
-->
<head>
<title>Prerender Referrer Test</title>
<script>
// Check referrer.
function DidPrerenderPass() {
  return document.referrer.indexOf("prerender_loader") >= 0;
}

// Check referrer.
function DidDisplayPass() {
  return document.referrer.indexOf("prerender_loader") >= 0;
}
</script>
</head>
<body></body>
</html>


text:
## 1.0.1

- Set max SDK version to <3.0.0

## 1.0.0

- First Dart-2-only release.

## 0.5.2, 0.5.2+1

- Last Dart 1 compatible version.
- Recommend use of `webdev` rather than `build_runner` in
  generated project `README.md` files.
- Build using the `--build web:build` option and remove the workaround to
  [dart-lang/build/issues/890](https://github.com/dart-lang/build/issues/890).

## 0.5.1

- Multi-example repos (like the ACX lottery) now have boilerplate files
  copied into each individual subproject.
- Projects are build using the default release config.

## 0.5.0

- Get all boilerplate files from `site-webdev/examples/**/_boilerplate`.
- Use `dart2_constant` so that this tool runs under Dart 1 and Dart 2.

## 0.4.0

- Add support for `--url [dev|main]` option.
- Don't rebuild the app if only the generated README.md file changed.

## 0.3.0

- Use dart2js options to minify, etc. build apps.
- Ensure that links in the example repo README.md files point to
  the appropriate branch and development server.
- Add `--skip <regex>` option, to filter out projects
  permitted by `--match <regex>`.

## 0.2.0

This is the first changelog entry.

- Add support for new build system used as of Angular 5 alpha,
  in particular with a workaround for
  https://github.com/dart-lang/build/issues/890.
- Add support for `--web-compiler` option, with `dart2js` being the default.
- Commit `pubspec.lock` to `gh-pages` so that we know exactly
  which packages were used to build the app.
- Output of commands (like `git`) is now printed when
  `--verbose` is specified.