text:
namespace Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition
{
    using Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResource.Update;
    using Microsoft.Azure.Management.Network.Fluent.Models;

    /// <summary>
    /// The stage of an application gateway redirect configuration allowing to specify whether the query string should be included in the redirected URL.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway update to return to after attaching this definition.</typeparam>
    public interface IWithQueryStringIncluded<ReturnT>
    {
        /// <summary>
        /// Specifies that the query string should be included in the redirected URL.
        /// </summary>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithAttach<ReturnT> WithQueryStringIncluded();
    }

    /// <summary>
    /// The final stage of an application gateway redirect configuration definition.
    /// At this stage, any remaining optional settings can be specified, or the definition
    /// can be attached to the parent application gateway definition.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway definition to return to after attaching this definition.</typeparam>
    public interface IWithAttach<ReturnT> :
        Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResource.Update.IInUpdate<ReturnT>,
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithQueryStringIncluded<ReturnT>
    {
    }

    /// <summary>
    /// The stage of an application gateway redirect configuration allowing to specify whether the query string should be included in the redirected URL or other optional settings.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway update to return to after attaching this definition.</typeparam>
    public interface IWithAttachAndPath<ReturnT> :
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithAttach<ReturnT>,
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithPathIncluded<ReturnT>
    {
    }

    /// <summary>
    /// The stage of an application gateway redirect configuration allowing to specify the target URL or listener for the redirection.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway update to return to after attaching this definition.</typeparam>
    public interface IWithTarget<ReturnT>
    {
        /// <summary>
        /// Specifies the URL to redirect to.
        /// </summary>
        /// <param name="url">A URL.</param>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithAttach<ReturnT> WithTargetUrl(string url);

        /// <summary>
        /// Specifies the listener on this application gateway to redirect to.
        /// </summary>
        /// <param name="name">The name of a listener on this application gateway.</param>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithAttachAndPath<ReturnT> WithTargetListener(string name);
    }

    /// <summary>
    /// The first stage of an application gateway redirect configuration configuration definition.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway definition to return to after attaching this definition.</typeparam>
    public interface IBlank<ReturnT> :
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithType<ReturnT>
    {
    }

    /// <summary>
    /// The entirety of an application gateway redirect configuration definition as part of an application gateway update.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway definition to return to after attaching this definition.</typeparam>
    public interface IUpdateDefinition<ReturnT> :
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IBlank<ReturnT>,
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithAttach<ReturnT>,
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithAttachAndPath<ReturnT>,
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithTarget<ReturnT>,
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithType<ReturnT>
    {
    }

    /// <summary>
    /// The stage of an application gateway redirect configuration allowing to specify whether the path should be included in the redirected URL.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway update to return to after attaching this definition.</typeparam>
    public interface IWithPathIncluded<ReturnT>
    {
        /// <summary>
        /// Specifies that the path should be included in the redirected URL.
        /// Note that this setting is valid only when the target of the redirection is a listener, not a URL.
        /// </summary>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithAttach<ReturnT> WithPathIncluded();
    }

    /// <summary>
    /// The stage of an application gateway redirect configuration allowing to specify the type of the redirection.
    /// </summary>
    /// <typeparam name="ReturnT">The stage of the parent application gateway update to return to after attaching this definition.</typeparam>
    public interface IWithType<ReturnT>
    {
        /// <summary>
        /// Specifies the redirection type.
        /// </summary>
        /// <param name="redirectType">A redirection type.</param>
        /// <return>The next stage of the definition.</return>
        Microsoft.Azure.Management.Network.Fluent.ApplicationGatewayRedirectConfiguration.UpdateDefinition.IWithTarget<ReturnT> WithType(ApplicationGatewayRedirectType redirectType);
    }
}


text:
This plugin implements BLE support for Android, iOS and Windows 8.1 (partial support). Enable your Cordova and PhoneGap mobile applications to communicate with all sorts of BLE devices.

Available functionality:

* Scan for BLE devices (background scanning supported on iOS and Android)
* Establish connections
* List services, characteristics and descriptors
* Read and write the values of characteristics and descriptors
* Request notification of changes to the values of characteristics
* Poll RSSI (signal strength) of a device (Android and iOS only)
* Experimental support for Peripheral mode on Android

## Installation

Install using the Apache Cordova command line:

    cordova plugin add cordova-plugin-ble

## Updated BLE Plugin API

We have extended the BLE plugin API to make it more high-level and easy to use.

Functions can now take objects as parameters.

The new plugin API is fully backwards compatible with the previous API, which used handles rather than objects.

We recommend using the new style with object parameters.

Below is tour of the new BLE plugin API.

## Quick Guide

### Scan for devices

Use function `evothings.ble.startScan` to scan for devices:

    evothings.ble.startScan(onDeviceFound, onScanError, options)

Starts scanning for devices. An array of service UUID strings may be given in the options object parameter. One or more service UUIDs must be specified for iOS background scanning to work. Found devices and errors are reported to the supplied callback functions. The startScan function will keep scanning until you call `evothings.ble.stopScan`.

Parameters:

    @param {scanCallback} onDeviceFound - Success callback, called repeatedly
    for each found device.
    @param {failCallback} onScanError - Error callback.
    @param {ScanOptions} options - Optional object with options.
    Set field serviceUUIDs to an array of service UUIDs to scan for.
    Set field parseAdvertisementData to false to disable automatic
    parsing of advertisement data.

Examples:

    // Scan for all services.
    evothings.ble.startScan(
        function(device)
        {
            console.log('startScan found device named: ' + device.name);
        },
        function(errorCode)
        {
            console.log('startScan error: ' + errorCode);
        }
    );

    // Scan for specific service (Eddystone Service UUID).
    evothings.ble.startScan(
        function(device)
        {
            console.log('startScan found device named: ' + device.name);
        },
        function(errorCode)
        {
            console.log('startScan error: ' + errorCode);
        },
        { serviceUUIDs: ['0000feaa-0000-1000-8000-00805f9b34fb'] }
    );

### Connect to a device

Use function `evothings.ble.connectToDevice` to connect to a device:

    evothings.ble.connectToDevice(device, onConnected, onDisconnected, onConnectError, options)

Connect to a BLE device and discover services. This is a more high-level
function than `evothings.ble.connect`. You can configure which services
to discover and also turn off automatic service discovery by supplying
an options parameter.

Parameters:

    @param {DeviceInfo} device - Device object from {scanCallback}.
    @param {connectedCallback} onConnected - Called when connected to the device.
    @param {disconnectedCallback} onDisconnected - Called when disconnected from the device.
    @param {failCallback} onConnectError - Called on error.
    @param {ConnectOptions} options - Optional connect options object.

Example:

    evothings.ble.connectToDevice(
         device,
         function(device)
         {
             console.log('Connected to device: ' + device.name);
         },
         function(device)
         {
             console.log('Disconnected from device: ' + device.name);
         },
         function(errorCode)
         {
             console.log('Connect error: ' + errorCode);
         });

It is recommended to use this functions in place of the low-level `evothings.ble.connect` function, which does not do automatic service discovery and has a different callback interface.

### Get services, characteristics and descriptors

#### evothings.ble.getService

Use `evothings.ble.getService` to get a service by UUID:

    evothings.ble.getService(device, uuid)

Parameters:

    @param {DeviceInfo} device - Device object.
    @param {string} uuid - UUID of service to get.

#### evothings.ble.getCharacteristic

Use `evothings.ble.getCharacteristic` to get a characteristic by UUID:

    evothings.ble.getCharacteristic(service, uuid)

Parameters:

    @param {Service} device - Service object.
    @param {string} uuid - UUID of characteristic to get.

Characteristics within a service that share the same UUID (rare case) must be retrieved by manually traversing the characteristics array of the service. The function getCharacteristic will return the first characteristic found, which may not be the one you want. Note that this is a rare case.

#### evothings.ble.getDescriptor

Use `evothings.ble.getDescriptor` to get a characteristic by UUID:

    evothings.ble.getDescriptor(characteristic, uuid)

Parameters:

    @param {Characteristic} characteristic - Characteristic object.
    @param {string} uuid - UUID of descriptor to get.

### Reading, writing and notifications

#### evothings.ble.readCharacteristic

Use `evothings.ble.readCharacteristic` to write a characteristic:

    evothings.ble.readCharacteristic(device, characteristic, success, fail)

Parameters:

    @param {DeviceInfo} device - Device object.
    @param {Characteristic} characteristic - Characteristic object.
    @param {dataCallback} success
    @param {failCallback} fail

Example:

    // When connected to the device, get the desired service and characteristic.
    var service = evothings.ble.getService(device, SERVICE_UUID)
    var characteristic = evothings.ble.getCharacteristic(service, CHARACTERISTIC_UUID)

    // Read the characteristic.
    evothings.ble.readCharacteristic(
        device,
        characteristic,
        function(data)
        {
            console.log('characteristic data: ' + evothings.ble.fromUtf8(data));
        },
        function(errorCode)
        {
            console.log('readCharacteristic error: ' + errorCode);
        });

#### evothings.ble.writeCharacteristic

Use `evothings.ble.writeCharacteristic` to write a characteristic:

    evothings.ble.writeCharacteristic(device, characteristic, data, success, fail)

Parameters:

    @param {DeviceInfo} device - Device object.
    @param {Characteristic} characteristic - Characteristic object.
    @param {ArrayBufferView} data - The value to be written.
    @param {emptyCallback} success - Called when the remote device has
    confirmed the write.
    @param {failCallback} fail - Called if the operation fails.

Example:

    // When connected to the device, get the desired service and characteristic.
    var service = evothings.ble.getService(device, SERVICE_UUID)
    var characteristic = evothings.ble.getCharacteristic(service, CHARACTERISTIC_UUID)

    // Read the characteristic.
    evothings.ble.writeCharacteristic(
        device,
        characteristic,
        data, // Buffer view with data to write
        function()
        {
            console.log('characteristic written');
        },
        function(errorCode)
        {
            console.log('writeCharacteristic error: ' + errorCode);
        });

#### evothings.ble.enableNotification

Use `evothings.ble.enableNotification` to start notifications on a characteristic:

    evothings.ble.enableNotification(device, characteristic, success, fail)

Parameters:

    @param {DeviceInfo} device - Device object .
    @param {Characteristic} characteristic - Characteristic object.
    @param {dataCallback} success - Called every time the value changes.
    @param {failCallback} fail - Error callback.
    @param {NotificationOptions} options - Android only: Optional object with options.

Example:

    // When connected to the device, get the desired service and characteristic.
    var service = evothings.ble.getService(device, SERVICE_UUID)
    var characteristic = evothings.ble.getCharacteristic(service, CHARACTERISTIC_UUID)

    // Start notifications for the characteristic.
    evothings.ble.enableNotification(
        device,
        characteristic,
        function()
        function(data)
        {
            console.log('characteristic data: ' + evothings.ble.fromUtf8(data));
        },
        function(errorCode)
        {
            console.log('readCharacteristic error: ' + errorCode);
        });

## Documentation

The [BLE API Guide](http://evothings.com/doc/tutorials/evothings-ble-api-guide.html) contains step-by-step instructions for how to scan and connect to BLE devices.

Reference documentation is available as jsdoc comments in the [ble.js](https://github.com/evothings/cordova-ble/blob/master/ble.js) source file.

To build the documentation using [jsdoc](https://github.com/jsdoc3/jsdoc), run this command:

    jsdoc -l -c jsdoc/conf.json ble.js

[Generated documentation](https://evothings.com/doc/lib-doc/module-cordova-plugin-ble.html) is available at the Evothings documentation web site (note that this documentation may not reflect the latest updates of the plugin, it may lag to sync with Evothings releases).

<!--The file [introduction.md](introduction.md) contains a general introduction to BLE programming.-->

<!-- Read the [BLE app development tutorial](http://evothings.com/ble-app-development-explained/) to get started with your BLE mobile application. -->

## Libraries

This section lists libraries that runs on top of the BLE plugin.

### Web Bluetooth

Early support for Web Bluetooth is available using the Bleat library.

* Master repository: https://github.com/thegecko/bleat
* Example app: https://github.com/evothings/cordova-ble/blob/master/examples/webbluetooth
* Tutorial: https://evothings.com/evothings-studio-with-support-for-web-bluetooth-and-ecmascript-6/

### EasyBLE

The EasyBLE library has been deprecated and is replaced with the extended BLE plugin API.

### Eddystone

Library for scanning for Eddystone devices/beacons (Physical Web).

* Master repository:  https://github.com/evothings/evothings-libraries/tree/master/libs/evothings/eddystone
* Documentation: https://evothings.com/doc/lib-doc/evothings.eddystone.html
* Tutorial: https://evothings.com/doc/starter-guides/eddystone-starter-guide.html
* JavaScript file to include in index.html: https://github.com/evothings/evothings-libraries/tree/master/libs/evothings/eddystone/eddystone.dist.js

To use the Eddystone library, include this in index.html:

    <script src="eddystone.dist.js"></script>

## Use Evothings Studio for fast and easy BLE mobile app development

[![BLE Mobile App Development Video](http://evomedia.evothings.com/2013/11/youtube_ble_example_start.png)](http://www.youtube.com/watch?v=A7uxNS_0QOI)

This plugin is used in Evothings Studio, and is compatible with Apache Cordova and PhoneGap.

[Evothings Studio](http://evothings.com) is a development and prototyping tool for making Cordova/PhoneGap apps. With Evothings Studio the edit/run turn-around cycle is just a second or two, which is much faster compared to the traditional method of rebuilding the Cordova project for each update.

[![Evothings Studio Workflow](http://evomedia.evothings.com/2013/11/illustration_ble_plugin.jpg)](http://evothings.com)

See [Evothings Examples](http://evothings.com/doc/examples/examples.html) for comprehensive examples of mobile apps that communicate over Bluetooth Low Energy, and which you can use for your own projects to get quickly up and running.

## Download Evothings Studio

[Download Evothings Studio](http://evothings.com/download/) - It is easy to get started!

redpajama_set_name: RedPajamaGithub


text:
using Pokemon_3D_Server_Launcher.View;
using System;
using System.Windows.Forms;

namespace Pokemon_3D_Server_Launcher
{
    public class Program
    {
        [STAThread]
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Main());
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.wso2.carbon.apimgt.rest.api.core.dto.EndPointDTO (API Manager Core Micro Service 7.0.37-SNAPSHOT API)</title>
<meta name="date" content="2017-08-01">
<link rel="stylesheet" type="text/css" href="../../../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.wso2.carbon.apimgt.rest.api.core.dto.EndPointDTO

Packages that use EndPointDTO

Package
Description

org.wso2.carbon.apimgt.rest.api.core.dto

org.wso2.carbon.apimgt.rest.api.core.utils

Uses of EndPointDTO in org.wso2.carbon.apimgt.rest.api.core.dto

Methods in org.wso2.carbon.apimgt.rest.api.core.dto that return EndPointDTO

Modifier and Type
Method and Description

EndPointDTO
EndPointDTO.endpointConfig(String endpointConfig)

EndPointDTO
EndPointDTO.id(String id)

EndPointDTO
EndPointDTO.maxTps(Long maxTps)

EndPointDTO
EndPointDTO.name(String name)

EndPointDTO
EndPointDTO.security(String security)

EndPointDTO
EndPointDTO.type(String type)

Methods in org.wso2.carbon.apimgt.rest.api.core.dto that return types with arguments of type EndPointDTO

Modifier and Type
Method and Description

List<EndPointDTO>
EndpointListDTO.getList()

Get list

Methods in org.wso2.carbon.apimgt.rest.api.core.dto with parameters of type EndPointDTO

Modifier and Type
Method and Description

EndpointListDTO
EndpointListDTO.addListItem(EndPointDTO listItem)

Method parameters in org.wso2.carbon.apimgt.rest.api.core.dto with type arguments of type EndPointDTO

Modifier and Type
Method and Description

EndpointListDTO
EndpointListDTO.list(List<EndPointDTO> list)

void
EndpointListDTO.setList(List<EndPointDTO> list)

Uses of EndPointDTO in org.wso2.carbon.apimgt.rest.api.core.utils

Methods in org.wso2.carbon.apimgt.rest.api.core.utils that return types with arguments of type EndPointDTO

Modifier and Type
Method and Description

static List<EndPointDTO>
MappingUtil.toEndpointListDto(List<org.wso2.carbon.apimgt.core.models.Endpoint> endpointList)

Converts Endpoint list to EndPointDTO list

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2017 WSO2. All rights reserved.


text:
#region License(Apache Version 2.0)

#endregion
#region ChangeLog
/******************************************
 * 2017-10-7 OutMan Create
 *
 * ***************************************/
#endregion
using System;
using System.ComponentModel;

namespace WitsWay.Utilities.Win
{
    /// <summary>
    /// 后台加载
    /// </summary>
    public class BackgroundLoader
    {
        private readonly Action _action;
        private readonly Action _completedWork;
        private readonly BackgroundWorker _worker = new BackgroundWorker();
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="doWork">加载动作内容</param>
        /// <param name="completedWork">完成后内容</param>
        public BackgroundLoader(Action doWork, Action completedWork)
        {
            _action = doWork;
            _completedWork = completedWork;
            _worker.DoWork += bw_DoWork;
            _worker.RunWorkerCompleted += bw_RunWorkerCompleted;
            _worker.RunWorkerAsync();
        }

        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _completedWork?.Invoke();
        }

        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            _action?.Invoke();
        }
    }
}


text:
<?php

namespace WebsiteBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\FormBuilderInterface;

class ImageType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array                $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('file', FileType::class, array(
                'label'      => $options['label'],
                'required'   => false,
                'file_path'  => 'webPath',
                'file_name'  => 'originalName',
                'clear_file' => true,
                'overview'   => true
            ))
        ;
    }

    /**
     * @return string
     */
    public function getBlockPrefix()
    {
        return 'image';
    }
}


text:
extern "C" {
#endif

#define SASS_STYLE_NESTED     0
#define SASS_STYLE_EXPANDED   1
#define SASS_STYLE_COMPACT    2
#define SASS_STYLE_COMPRESSED 3

#define SASS_SOURCE_COMMENTS_NONE 0
#define SASS_SOURCE_COMMENTS_DEFAULT 1
#define SASS_SOURCE_COMMENTS_MAP 2

struct sass_options {
  int output_style;
  int source_comments; // really want a bool, but C doesn't have them
  const char* include_paths;
  const char* image_path;
};

struct sass_context {
  const char* source_string;
  char* output_string;
  struct sass_options options;
  int error_status;
  char* error_message;
  struct Sass_C_Function_Data* c_functions;
  char** included_files;
  int num_included_files;
};

struct sass_file_context {
  const char* input_path;
  const char* output_path;
  char* output_string;
  char* source_map_string;
  const char* source_map_file;
  struct sass_options options;
  int error_status;
  char* error_message;
  struct Sass_C_Function_Data* c_functions;
  char** included_files;
  int num_included_files;
};

struct sass_folder_context {
  const char* search_path;
  const char* output_path;
  struct sass_options options;
  int error_status;
  char* error_message;
  struct Sass_C_Function_Data* c_functions;
  char** included_files;
  int num_included_files;
};

struct sass_context*        sass_new_context        (void);
struct sass_file_context*   sass_new_file_context   (void);
struct sass_folder_context* sass_new_folder_context (void);

void sass_free_context        (struct sass_context* ctx);
void sass_free_file_context   (struct sass_file_context* ctx);
void sass_free_folder_context (struct sass_folder_context* ctx);

int sass_compile            (struct sass_context* ctx);
int sass_compile_file       (struct sass_file_context* ctx);
int sass_compile_folder     (struct sass_folder_context* ctx);

#ifdef __cplusplus
}
#endif


text:
import logging
import os
import signal
from subprocess import call

log = logging.getLogger(__name__)

class SLURMConnector:
    def __init__(self, trainer):
        self.trainer = trainer

    def register_slurm_signal_handlers(self):
        # see if we're using slurm (not interactive)
        on_slurm = False
        try:
            job_name = os.environ["SLURM_JOB_NAME"]
            if job_name != "bash":
                on_slurm = True
        # todo: specify the possible exception
        except Exception:
            pass

        if on_slurm:
            log.info("Set SLURM handle signals.")
            signal.signal(signal.SIGUSR1, self.sig_handler)
            signal.signal(signal.SIGTERM, self.term_handler)

    def sig_handler(self, signum, frame):  # pragma: no-cover
        if self.trainer.is_global_zero:
            # save weights
            log.info("handling SIGUSR1")
            self.trainer.checkpoint_connector.hpc_save(self.trainer.weights_save_path, self.trainer.logger)

            # find job id
            job_id = os.environ["SLURM_JOB_ID"]
            cmd = ["scontrol", "requeue", job_id]

            # requeue job
            log.info(f"requeing job {job_id}...")
            try:
                result = call(cmd)
            except FileNotFoundError:
                # This can occur if a subprocess call to `scontrol` is run outside a shell context
                # Re-attempt call (now with shell context). If any error is raised, propagate to user.
                # When running a shell command, it should be passed as a single string.
                joint_cmd = [str(x) for x in cmd]
                result = call(" ".join(joint_cmd), shell=True)

            # print result text
            if result == 0:
                log.info(f"requeued exp {job_id}")
            else:
                log.warning("requeue failed...")

            # close experiment to avoid issues
            self.trainer.logger.close()

    def term_handler(self, signum, frame):  # pragma: no-cover
        log.info("bypassing sigterm")


text:
@interface MyTwitter : NSObject<MGTwitterEngineDelegate> {
	MGTwitterEngine* twitter_;
	OAToken* requestToken_;
	OAToken* accessToken_;
	OAConsumer *consumer_;
	id <MyTwitterDelegate> delegate_;
}

- (BOOL)isUserAuthorized;
- (MyTwitter*)init;
- (NSString *)sendUpdate:(NSString *)status;
- (void) askForAccessToken: (NSString*) pincode ;
- (void) askForRequestToken ;
- (NSURLRequest*) authorizeURL;

- (void) askForPinCode;

@property(nonatomic,retain)TwitAccount *currentAccount;

@property(nonatomic,retain)id<MyTwitterDelegate> twitDelegate;

@property(nonatomic,retain)OAConsumer *consumer;
@property(nonatomic,retain)OAToken *requestToken;
@property(nonatomic,retain)OAToken *accessToken;

@property(nonatomic,retain)MGTwitterEngine *twitter;

@end


text:
<?php

namespace Jose\Algorithm\Signature;

/**
 * Class RS384.
 */
final class RS384 extends RSA
{
    /**
     * @return string
     */
    protected function getAlgorithm()
    {
        return 'sha384';
    }

    /**
     * @return int
     */
    protected function getSignatureMethod()
    {
        return self::SIGNATURE_PKCS1;
    }

    /**
     * @return string
     */
    public function getAlgorithmName()
    {
        return 'RS384';
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ShadowUsbManager</title>
<meta name="date" content="2018-11-09">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.robolectric.shadows

Class ShadowUsbManager

java.lang.Object

org.robolectric.shadows.ShadowUsbManager

@Implements(value=android.hardware.usb.UsbManager.class,
            looseSignatures=true)
public class ShadowUsbManager
extends java.lang.Object

Robolectric implementation of UsbManager.

Constructor Summary

Constructors

Constructor and Description

ShadowUsbManager()

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

void
addOrUpdateUsbDevice(android.hardware.usb.UsbDevice usbDevice,
                    boolean hasPermission)

Adds a USB device into available USB devices map with permission value.

void
addPort(java.lang.String portId)

Adds a USB port to UsbManager.

void
clearPorts()

Remove all added ports from UsbManager.

protected android.hardware.usb.UsbAccessory[]
getAccessoryList()

protected java.util.HashMap<java.lang.String,android.hardware.usb.UsbDevice>
getDeviceList()

Returns a HashMap containing all USB devices currently attached.

protected java.lang.Object[]
getPorts()

protected java.lang.Object
getPortStatus(java.lang.Object port)

protected void
grantPermission(android.hardware.usb.UsbDevice device)

protected void
grantPermission(android.hardware.usb.UsbDevice device,
               java.lang.String packageName)

protected boolean
hasPermission(android.hardware.usb.UsbDevice device)

Returns true if the caller has permission to access the device.

boolean
hasPermissionForPackage(android.hardware.usb.UsbDevice device,
                       java.lang.String packageName)

Returns true if the given package has permission to access the device.

protected android.os.ParcelFileDescriptor
openAccessory(android.hardware.usb.UsbAccessory accessory)

Opens a file descriptor from a temporary file.

void
removeUsbDevice(android.hardware.usb.UsbDevice usbDevice)

Removes a USB device from available USB devices map.

void
revokePermission(android.hardware.usb.UsbDevice device,
                java.lang.String packageName)

Revokes permission to a USB device granted to a package.

void
setAttachedUsbAccessory(android.hardware.usb.UsbAccessory usbAccessory)

Sets the currently attached Usb accessory returned in #getAccessoryList.

protected void
setPortRoles(java.lang.Object port,
            java.lang.Object powerRole,
            java.lang.Object dataRole)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ShadowUsbManager

public ShadowUsbManager()

Method Detail

hasPermission

@Implementation
protected boolean hasPermission(android.hardware.usb.UsbDevice device)

Returns true if the caller has permission to access the device.

hasPermissionForPackage

public boolean hasPermissionForPackage(android.hardware.usb.UsbDevice device,
                                       java.lang.String packageName)

Returns true if the given package has permission to access the device.

grantPermission

@Implementation(minSdk=24)
 @HiddenApi
protected void grantPermission(android.hardware.usb.UsbDevice device)

grantPermission

@Implementation(minSdk=25)
 @HiddenApi
protected void grantPermission(android.hardware.usb.UsbDevice device,
                                                                      java.lang.String packageName)

revokePermission

public void revokePermission(android.hardware.usb.UsbDevice device,
                             java.lang.String packageName)

Revokes permission to a USB device granted to a package. This method does nothing if the package doesn’t have permission to access the device.

getDeviceList

@Implementation
protected java.util.HashMap<java.lang.String,android.hardware.usb.UsbDevice> getDeviceList()

Returns a HashMap containing all USB devices currently attached. USB device name is the key for the returned HashMap. The result will be empty if no devices are attached, or if USB host mode is inactive or unsupported.

getAccessoryList

@Implementation
protected android.hardware.usb.UsbAccessory[] getAccessoryList()

setAttachedUsbAccessory

public void setAttachedUsbAccessory(android.hardware.usb.UsbAccessory usbAccessory)

Sets the currently attached Usb accessory returned in #getAccessoryList.

addOrUpdateUsbDevice

public void addOrUpdateUsbDevice(android.hardware.usb.UsbDevice usbDevice,
                                 boolean hasPermission)

Adds a USB device into available USB devices map with permission value. If the USB device already exists, updates the USB device with new permission value.

removeUsbDevice

public void removeUsbDevice(android.hardware.usb.UsbDevice usbDevice)

Removes a USB device from available USB devices map.

getPorts

@Implementation(minSdk=23)
 @HiddenApi
protected java.lang.Object[] getPorts()

clearPorts

public void clearPorts()

Remove all added ports from UsbManager.

addPort

public void addPort(java.lang.String portId)

Adds a USB port to UsbManager.

getPortStatus

@Implementation(minSdk=23)
 @HiddenApi
protected java.lang.Object getPortStatus(java.lang.Object port)

setPortRoles

@Implementation(minSdk=23)
 @HiddenApi
protected void setPortRoles(java.lang.Object port,
                                                                   java.lang.Object powerRole,
                                                                   java.lang.Object dataRole)

openAccessory

@Implementation
protected android.os.ParcelFileDescriptor openAccessory(android.hardware.usb.UsbAccessory accessory)

Opens a file descriptor from a temporary file.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
> see https://aka.ms/autorest

This is the AutoRest configuration file for Automanage.

---

## Getting Started

To build the SDK for Automanage, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run:

> `autorest`

To see additional help and options, run:

> `autorest --help`

---

## Configuration

### Basic Information

These are the global settings for the Automanage API.

``` yaml
title: AutomanageClient
description: Automanage Client
openapi-type: arm
tag: package-2020-06-30-preview
```

### Tag: package-2021-04-30-preview

These settings apply only when `--tag=package-2021-04-30-preview` is specified on the command line.

``` yaml $(tag) == 'package-2021-04-30-preview'
input-file:
- Microsoft.Automanage/preview/2021-04-30-preview/automanage.json
directive:
  - suppress: R3010
    from: Microsoft.Automanage/preview/2021-04-30-preview/automanage.json
    reason: list by immediate parent operations are defined
```

### Tag: package-2020-06-30-preview

These settings apply only when `--tag=package-2020-06-30-preview` is specified on the command line.

``` yaml $(tag) == 'package-2020-06-30-preview'
input-file:
- Microsoft.Automanage/preview/2020-06-30-preview/automanage.json
```

## Suppression

``` yaml
directive:
  - suppress: UniqueResourcePaths
    from: automanage.json
    where: $.paths
    reason: 'Microsoft.Automanage is a proxy resource provider under Microsoft. Please refer PR https://github.com/Azure/azure-rest-api-specs-pr/pull/1283'
  - suppress: R3018  # EnumInsteadOfBoolean - Booleans are not descriptive and make them hard to use. Consider using string enums with allowed set of values defined. Property: isDataAction"
    where:
      - $.definitions.Operation.properties.isDataAction
    from: types.json
    reason: its per the RPC specification
```

---

# Code Generation

## Swagger to SDK

This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.

``` yaml $(swagger-to-sdk)
swagger-to-sdk:
  - repo: azure-sdk-for-net
  - repo: azure-sdk-for-python-track2
  - repo: azure-sdk-for-go
  - repo: azure-sdk-for-go
  - repo: azure-sdk-for-js
  - repo: azure-sdk-for-node
  - repo: azure-sdk-for-ruby
    after_scripts:
      - bundle install && rake arm:regen_all_profiles['azure_mgmt_automanage']
```

## Python

See configuration in [readme.python.md](./readme.python.md)

## C#

These settings apply only when `--csharp` is specified on the command line.
Please also specify `--csharp-sdks-folder=<path to "SDKs" directory of your azure-sdk-for-net clone>`.

``` yaml $(csharp)
csharp:
  azure-arm: true
  license-header: MICROSOFT_MIT_NO_VERSION
  namespace: Microsoft.Azure.Management.Automanage
  output-folder: $(csharp-sdks-folder)/automanage/Microsoft.Azure.Management.Automanage/src/Generated
  clear-output-folder: true
```


text:
==============================
Rule ``standardize_increment``
==============================

Increment and decrement operators should be used if possible.

Examples
--------

Example #1
~~~~~~~~~~

.. code-block:: diff

   --- Original
   +++ New
    <?php
   -$i += 1;
   +++$i;

Example #2
~~~~~~~~~~

.. code-block:: diff

   --- Original
   +++ New
    <?php
   -$i -= 1;
   +--$i;

Rule sets
---------

The rule is part of the following rule sets:

@PhpCsFixer
  Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``standardize_increment`` rule.

@Symfony
  Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``standardize_increment`` rule.


text:
package org.assertj.core.api.iterable;

import org.assertj.core.api.AbstractIterableAssert;
import org.assertj.core.api.ConcreteIterableAssert;
import org.assertj.core.api.IterableAssertBaseTest;

import static org.mockito.Mockito.verify;

/**
 * Tests for <code>{@link AbstractIterableAssert#containsExactly(Object...)}</code>.
 *
 * @author Nicolas François
 */
public class IterableAssert_containsExactly_Test extends IterableAssertBaseTest {

  @Override
  protected ConcreteIterableAssert<Object> invoke_api_method() {
    return assertions.containsExactly("Yoda", "Luke");
  }

  @Override
  protected void verify_internal_effects() {
    Object[] values = { "Yoda", "Luke" };
    verify(iterables).assertContainsExactly(getInfo(assertions), getActual(assertions), values);
  }
}


text:
package org.sakaiproject.test.section;

import junit.framework.Assert;

import org.sakaiproject.component.section.sakai.SectionManagerImpl;
import org.sakaiproject.section.api.SectionManager;
import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig;
import org.sakaiproject.section.api.coursemanagement.CourseSection;
import org.sakaiproject.section.api.facade.Role;
import org.sakaiproject.site.api.Site;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.test.SakaiTestBase;
import org.sakaiproject.tool.api.Session;
import org.sakaiproject.tool.api.SessionManager;

public class CourseManagementIntegrationTest extends SakaiTestBase {
	// Services
	private SiteService siteService;
	private SessionManager sessionManager;
	private SectionManager sectionManager;

	// Objects we'll need to clean up on tearDown
	private String siteId;

	/**
	 * Setup test fixture (runs once for each test method called)
	 */
	public void setUp() throws Exception {
		// Fetch the services we need to run the tests
		siteService = (SiteService)getService(SiteService.class.getName());
		sessionManager = (SessionManager)getService(SessionManager.class.getName());
		sectionManager = (SectionManager)getService(SectionManager.class.getName());

		Session session = sessionManager.getCurrentSession();
		session.setUserId("admin");
		session.setUserEid("admin");
	}

	/**
	 * Remove the newly created objects, so we can run more tests with a clean slate.
	 */
	public void tearDown() throws Exception {
		if(siteId != null) {
			Site site = siteService.getSite(siteId);
			siteService.removeSite(site);
		}
	}

	//// Manual Mandatory ////

	public void testManualMandatoryConfig() throws Exception {
		// Set the sectionManager to be manual mandatory
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.MANUAL_MANDATORY.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");
		String siteReference = site.getReference();

		// Ensure that the site is not externally managed by default
		Assert.assertFalse(sectionManager.isExternallyManaged(siteReference));

		// Ensure that the section manager won't allow the site to be set to "automatic" sections
		try {
			sectionManager.setExternallyManaged(siteReference,true);
			fail();
		} catch (Exception e) {}
	}

	public void testManualMandatorySections() throws Exception {
		// Set the sectionManager to be manual mandatory
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.MANUAL_MANDATORY.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");

		// Set the provider ID to an external section EID, and save the site
		site.setProviderGroupId("bio101_f2006_lab1");
		siteService.save(site);

		// Ensure that no internal sections were created from the single attached "roster" (aka provider ID)
		Assert.assertEquals(0, sectionManager.getSections(siteId).size());

		// Now create a complex provider ID (multiple rosters)
		site.setProviderGroupId("bio101_f2006_lab1+bio101_f2006_lab2");
		siteService.save(site);

		// Ensure that no internal sections were created for multiple rosters
		Assert.assertEquals(0, sectionManager.getSections(siteId).size());
	}

	//// Manual Default ////

	public void testManualDefaultConfig() throws Exception {
		// Set the sectionManager to be manual default
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.MANUAL_DEFAULT.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");
		String siteReference = site.getReference();

		// Ensure that the site is not externally managed by default
		Assert.assertFalse(sectionManager.isExternallyManaged(siteReference));

		// Ensure that the section manager will allow the site to be set to "automatic" sections
		try {
			sectionManager.setExternallyManaged(siteReference,true);
		} catch (Exception e) {
			fail("Unable to change a manual site to automatic, even though we should be able to do so: " + e.getMessage());
		}
	}

	public void testManualDefaultSections() throws Exception {
		// Set the sectionManager to be manual default
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.MANUAL_DEFAULT.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");

		// Set the provider ID to an external section EID, and save the site
		site.setProviderGroupId("bio101_f2006_lab1");
		siteService.save(site);

		// Ensure that no internal sections were created from the single attached "roster" (aka provider ID)
		Assert.assertEquals(0, sectionManager.getSections(siteId).size());

		// Now create a complex provider ID (multiple rosters)
		site.setProviderGroupId("bio101_f2006_lab1+bio101_f2006_lab2");
		siteService.save(site);

		// Ensure that no internal sections were created for multiple rosters
		Assert.assertEquals(0, sectionManager.getSections(siteId).size());

		// Add a section "manually"
		CourseSection section = sectionManager.addSection(site.getReference(),
				"a manual section", "lec", Integer.valueOf(10), null, null, null, false, false,
				false, false, false, false, false);

		// Now change this "manual by default" site to be externally controlled (automatic)
		sectionManager.setExternallyManaged(site.getReference(), true);

		// Ensure that the manually created section was removed
		Assert.assertFalse(sectionManager.getSections(siteId).contains(section));

		// Get a new site object from the service, since the one we have is now out-of-date
		site = siteService.getSite(siteId);

		// Ensure that the provided rosters are reflected as sections
		Assert.assertEquals(2, sectionManager.getSections(siteId).size());

		// Change the provider IDs again.
		site.setProviderGroupId("bio101_f2006_lec1+bio101_f2006_lab1+bio101_f2006_lab2");
		siteService.save(site);

		// The automatic sections should have been added to the site
		Assert.assertEquals(3, sectionManager.getSections(siteId).size());
	}

	//// Automatic Default ////

	public void testAutomaticDefaultConfig() throws Exception {
		// Set the sectionManager to be auto default
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.AUTOMATIC_DEFAULT.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");
		String siteReference = site.getReference();

		// Ensure that the site is externally managed by default
		Assert.assertTrue(sectionManager.isExternallyManaged(siteReference));

		// Ensure that the section manager will allow the site to be set to "manual" sections
		try {
			sectionManager.setExternallyManaged(siteReference,false);
		} catch (Exception e) {
			fail("We should be able to switch to internal section management, but couldn't: " + e.getMessage());
		}
	}

	public void testAutomaticDefaultSections() throws Exception {
		// Set the sectionManager to be auto default
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.AUTOMATIC_DEFAULT.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");

		// Set the provider ID to an external section EID, and save the site
		site.setProviderGroupId("bio101_f2006_lab1");
		siteService.save(site);

		// Ensure that a single internal section was created from the attached "roster" (aka provider ID)
		Assert.assertEquals(1, sectionManager.getSections(siteId).size());

		// Now create a complex provider ID (multiple rosters)
		site.setProviderGroupId("bio101_f2006_lab1+bio101_f2006_lab2");
		siteService.save(site);

		// Ensure that both internal sections were created for the rosters
		Assert.assertEquals(2, sectionManager.getSections(siteId).size());

		// Ensure that we can not edit the sections
		CourseSection section = (CourseSection)sectionManager.getSections(siteId).get(0);
		try {
			sectionManager.updateSection(section.getUuid(), "a new title", null, null);
			fail("We should not be able to edit sections in an externally controlled site.");
		} catch (Exception e) {}

		// Ensure that we can not delete the sections
		try {
			sectionManager.disbandSection(section.getUuid());
			fail("We should not be able to delete sections in an externally controlled site.");
		} catch (Exception e) {}

		// Now change this "automatic by default" site to be manually controlled
		sectionManager.setExternallyManaged(site.getReference(), false);

		// Get a new site object from the service, since the one we have is now out-of-date
		site = siteService.getSite(siteId);

		// Ensure that the provided rosters are still reflected as sections
		Assert.assertEquals(2, sectionManager.getSections(siteId).size());

		// Change the provider IDs again.
		site.setProviderGroupId("bio101_f2006_lec1+bio101_f2006_lab1+bio101_f2006_lab2");
		siteService.save(site);

		// The sections should not have changed, since we're a manual site
		Assert.assertEquals(2, sectionManager.getSections(siteId).size());

		// Ensure that we can edit a section
		try {
			sectionManager.updateSection(section.getUuid(), "a new title", null, null);
		} catch (Exception e) {
			fail("We should be able to edit sections, but couldn't: " + e);
			e.printStackTrace();
		}

		// Ensure that we can delete sections
		try {
			sectionManager.disbandSection(section.getUuid());
		} catch (Exception e) {
			fail("We should be able to delete sections in a manually controlled site: " + e.getMessage());
		}
	}

	//// Automatic Mandatory ////

	public void testAutomaticMandatoryConfig() throws Exception {
		// Set the sectionManager to be automatic mandatory
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.AUTOMATIC_MANDATORY.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");
		String siteReference = site.getReference();

		// Ensure that the site is externally managed by default
		Assert.assertTrue(sectionManager.isExternallyManaged(siteReference));

		// Ensure that the section manager won't allow the site to be set to "manual" sections
		try {
			sectionManager.setExternallyManaged(siteReference,false);
			fail();
		} catch (Exception e) {}
	}

	public void testAutomaticMandatorySections() throws Exception {
		// Set the sectionManager to be automatic mandatory
		((SectionManagerImpl)sectionManager).setConfig(ExternalIntegrationConfig.AUTOMATIC_MANDATORY.toString());

		// Create a site
		siteId = generateSiteId();
		Site site = siteService.addSite(siteId, "course");

		// Set the provider ID to an external section EID, and save the site
		site.setProviderGroupId("bio101_f2006_lab1");
		siteService.save(site);

		// Ensure that a single internal section was created from the attached "roster" (aka provider ID)
		Assert.assertEquals(1, sectionManager.getSections(siteId).size());

		// Now create a complex provider ID (multiple rosters)
		site.setProviderGroupId("bio101_f2006_lab1+bio101_f2006_lab2");
		siteService.save(site);

		// Ensure that both internal sections were created
		Assert.assertEquals(2, sectionManager.getSections(siteId).size());

		// Ensure that sections in this site can not be edited
		CourseSection section = (CourseSection)sectionManager.getSections(siteId).get(0);
		try {
			sectionManager.updateSection(section.getUuid(), "a new title", null, null);
			fail();
		} catch (Exception e) {}

		// Ensure that students can not be added
		try {
			sectionManager.addSectionMembership("admin", Role.STUDENT, section.getUuid());
			fail("We should not be allowed to add students to an externally managed section");
		} catch (Exception e) {}

		// Ensure that TAs can be added
		try {
			sectionManager.addSectionMembership("admin", Role.TA, section.getUuid());
		} catch (Exception e) {
			fail("Exception adding a TA to an externally managed section: " + e.getMessage());
		}

		// Remove the provider ID (roster) from the site.
		site.setProviderGroupId(null);
		siteService.save(site);

		// Ensure that the sections were removed
		Assert.assertEquals(0, sectionManager.getSections(siteId).size());
	}
}


text:
define(function (require, exports) {
    "use strict";

    var Immutable = require("immutable");

    /**
     * Extracts a "uniform" value from a list of values, where uniformity is
     * tested using the given equality predicate. If the equality predicate is
     * undefined, reference equality is used. If the list is determined to have
     * a uniform value, the first such value is returned. If not, null is
     * returned.
     *
     * @param {Immutable.Iterable.<*>} values
     * @param {function(*,*):boolean=} equals Optional equality predicate.
     * @param {*} notSetValue The value to return if there is no uniform value.
     *  Defaults to null.
     * @return {*} The first value if the the values are uniform, or null.
     */
    var uniformValue = function (values, equals, notSetValue) {
        if (typeof equals !== "function") {
            notSetValue = equals;
            equals = Immutable.is;
        }

        if (notSetValue === undefined) {
            notSetValue = null;
        }

        if (!values || values.isEmpty()) {
            return notSetValue;
        }

        var first = values.get(0);
        if (values.size === 1) {
            return first;
        }

        var nonuniform = values.rest()
            .some(function (b) {
                return !equals(first, b);
            });

        if (nonuniform) {
            return notSetValue;
        }

        return first;
    };

    /**
     * Pluck the given property from each element of the iterable.
     *
     * @param {Immutable.Iterable} iterable
     * @param {string} property
     * @param {*} notSetValue
     * @return {Immutable.Iterable}
     */
    var pluck = function (iterable, property, notSetValue) {
        return iterable.map(function (obj) {
            if (obj) {
                if (obj.hasOwnProperty(property) || obj[property]) {
                    return obj[property];
                } else if (obj instanceof Immutable.Iterable) {
                    return obj.get(property, notSetValue);
                }
            }

            return notSetValue;
        });
    };

    /**
     * Pluck the given properties from each element of the iterable.
     *
     * @param {Immutable.Iterable} iterable
     * @param {Immutable.Iterable.<string>|Array.<string>} properties
     * @return {Immutable.Iterable}
     */
    var pluckAll = function (iterable, properties) {
        return iterable.map(function (obj) {
            return Immutable.Map(properties.reduce(function (map, property) {
                if (obj) {
                    if (obj.hasOwnProperty(property) || obj[property]) {
                        return map.set(property, obj[property]);
                    } else if (obj instanceof Immutable.Iterable && obj.has(property)) {
                        return map.set(property, obj.get(property));
                    }
                }
                return map;
            }, new Map()));
        });
    };

    /**
     * Transpose the iterable of iterables.
     *
     * Since this returns a Seq, note that size may not be available after of further filtering
     * so you may may need to explicitly use `toList()` or similar
     *
     * @param {Immutable.Iterable.<Immutable.Iterable>} iterable
     * @param {*} notSetValue
     * @return {Immutable.IndexedSeq.<Immutable.Iterable>}
     */
    var zip = function (iterable, notSetValue) {
        if (iterable.isEmpty()) {
            return Immutable.List();
        }

        var max = pluck(iterable, "size", 0).max();

        return Immutable.Range(0, max).map(function (index) {
            return iterable.map(function (subiterable) {
                return subiterable.get(index, notSetValue);
            });
        });
    };

    /**
     * Calculate the intersection of the iterable and collection.
     *
     * @param {Immutable.Iterable} iterable
     * @param {Immutable.Collection} collection
     * @return {Immutable.Iterable}
     */
    var intersection = function (iterable, collection) {
        return iterable.filter(function (elem) {
            return collection.contains(elem);
        });
    };

    /**
     * Calculate the difference of the iterable and collection.
     *
     * @param {Immutable.Iterable} iterable
     * @param {Immutable.Collection} collection
     * @return {Immutable.Iterable}
     */
    var difference = function (iterable, collection) {
        return iterable.filter(function (elem) {
            return !collection.contains(elem);
        });
    };

    exports.uniformValue = uniformValue;
    exports.zip = zip;
    exports.pluck = pluck;
    exports.pluckAll = pluckAll;
    exports.intersection = intersection;
    exports.difference = difference;
});


text:
package opennlp.tools.util.featuregen;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import opennlp.tools.postag.POSTaggerMETest;
import opennlp.tools.util.model.ModelType;

public class POSTaggerNameFeatureGeneratorTest {

  @Test
  void testFeatureGeneration() throws IOException {
    POSTaggerNameFeatureGenerator fg = new POSTaggerNameFeatureGenerator(
        POSTaggerMETest.trainPOSModel(ModelType.MAXENT));

    String[] tokens = {"Hi", "Mike", ",", "it", "'s", "Stefanie", "Schmidt", "."};
    for (int i = 0; i < tokens.length; i++) {
      List<String> feats = new ArrayList<>();
      fg.createFeatures(feats, tokens, i, null);
      Assertions.assertTrue(feats.get(0).startsWith("pos="));
    }
  }
}


text:
FROM dexterbt1/kestrel
WORKDIR /usr/local/kestrel/current
CMD ["java","-jar","kestrel_2.9.2-2.4.2-SNAPSHOT.jar","-f","config/development.scala"]


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

/**
 * MODULE NOTES:
 * @update  gess 4/1/98
 *
 * This class is defines the basic notion of a token
 * within our system. All other tokens are derived from
 * this one. It offers a few basic interfaces, but the
 * most important is consume(). The consume() method gets
 * called during the tokenization process when an instance
 * of that particular token type gets detected in the
 * input stream.
 *
 * CToken objects that are allocated from the heap _must_ be allocated
 * using the nsTokenAllocator: the nsTokenAllocator object uses an
 * arena to manage the tokens.
 *
 * The nsTokenAllocator object's arena implementation requires
 * object size at destruction time to properly recycle the object;
 * therefore, CToken::operator delete() is not public. Instead,
 * heap-allocated tokens should be destroyed using the static
 * Destroy() method, which accepts a token and the arena from which
 * the token was allocated.
 *
 * Leaf classes (that are actually instantiated from the heap) must
 * implement the SizeOf() method, which Destroy() uses to determine
 * the size of the token in order to properly recycle it.
 */

#ifndef CTOKEN__
#define CTOKEN__

#include "prtypes.h"
#include "nsString.h"
#include "nsError.h"
#include "nsFixedSizeAllocator.h"

#define NS_HTMLTOKENS_NOT_AN_ENTITY \
  NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000)

class nsScanner;
class nsTokenAllocator;

enum eContainerInfo {
  eWellFormed,
  eMalformed,
  eFormUnknown
};

/**
 * Implement the SizeOf() method; leaf classes derived from CToken
 * must declare this.
 */
#define CTOKEN_IMPL_SIZEOF                                \
protected:                                                \
  virtual size_t SizeOf() const { return sizeof(*this); } \
public:

/**
 *  Token objects represent sequences of characters as they
 *  are consumed from the input stream (URL). While they're
 *  pretty general in nature, we use subclasses (found in
 *  nsHTMLTokens.h) to define <start>, </end>, <text>,
 *  <comment>, <&entity>, <newline>, and <whitespace> tokens.
 *
 *  @update  gess 3/25/98
 */
class CToken {
  public:

    enum  eTokenOrigin {eSource,eResidualStyle};

  protected:

    // nsTokenAllocator should be the only class that tries to
    // allocate tokens from the heap.
    friend class nsTokenAllocator;

    /**
     *
     * @update	harishd 08/01/00
     * @param   aSize    -
     * @param   aArena   - Allocate memory from this pool.
     */
    static void * operator new (size_t aSize,nsFixedSizeAllocator& anArena) CPP_THROW_NEW
    {
      return anArena.Alloc(aSize);
    }

    /**
     * Hide operator delete; clients should use Destroy() instead.
     */
    static void operator delete (void*,size_t) {}

  protected:
    /**
     * destructor
     * @update	gess5/11/98
     */
    virtual ~CToken();

  private:
    /**
     * Destroy a token.
     */
    static void Destroy(CToken* aToken,nsFixedSizeAllocator& aArenaPool)
    {
      size_t sz = aToken->SizeOf();
      aToken->~CToken();
      aArenaPool.Free(aToken, sz);
    }

  public:
    /**
     * Make a note on number of times you have been referenced
     * @update	harishd 08/02/00
     */
    void AddRef() {
      ++mUseCount;
      NS_LOG_ADDREF(this, mUseCount, "CToken", sizeof(*this));
    }

    /**
     * Free yourself if no one is holding you.
     * @update	harishd 08/02/00
     */
    void Release(nsFixedSizeAllocator& aArenaPool) {
      --mUseCount;
      NS_LOG_RELEASE(this, mUseCount, "CToken");
      if (mUseCount==0)
        Destroy(this, aArenaPool);
    }

    /**
     * Default constructor
     * @update	gess7/21/98
     */
    CToken(PRInt32 aTag=0);

    /**
     * Retrieve string value of the token
     * @update	gess5/11/98
     * @return  reference to string containing string value
     */
    virtual const nsSubstring& GetStringValue(void) = 0;

    /**
     * Get string of full contents, suitable for debug dump.
     * It should look exactly like the input source.
     * @update	gess5/11/98
     * @return  reference to string containing string value
     */
    virtual void GetSource(nsString& anOutputString);

    /** @update	harishd 03/23/00
     *  @return  reference to string containing string value
     */
    virtual void AppendSourceTo(nsAString& anOutputString);

    /**
     * Sets the ordinal value of this token (not currently used)
     * @update	gess5/11/98
     * @param   value is the new ord value for this token
     */
    void SetTypeID(PRInt32 aValue) {
      mTypeID = aValue;
    }

    /**
     * Getter which retrieves the current ordinal value for this token
     * @update	gess5/11/98
     * @return  current ordinal value
     */
    virtual PRInt32 GetTypeID(void);

    /**
     * Getter which retrieves the current attribute count for this token
     * @update	gess5/11/98
     * @return  current attribute count
     */
    virtual PRInt16 GetAttributeCount(void);

    /**
     * Causes token to consume data from given scanner.
     * Note that behavior varies wildly between CToken subclasses.
     * @update	gess5/11/98
     * @param   aChar -- most recent char consumed
     * @param   aScanner -- input source where token should get data
     * @return  error code (0 means ok)
     */
    virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);

    /**
     * Getter which retrieves type of token
     * @update	gess5/11/98
     * @return  int containing token type
     */
    virtual PRInt32 GetTokenType(void);

    /**
     * For tokens who care, this can tell us whether the token is
     * well formed or not.
     *
     * @update	gess 8/30/00
     * @return  false; subclasses MUST override if they care.
     */
    virtual bool IsWellFormed(void) const {return false;}

    virtual bool IsEmpty(void) { return false; }

    /**
     * If aValue is TRUE then the token represents a short-hand tag
     */
    virtual void SetEmpty(bool aValue) { return ; }

    PRInt32 GetNewlineCount()
    {
      return mNewlineCount;
    }

    void SetNewlineCount(PRInt32 aCount)
    {
      mNewlineCount = aCount;
    }

    PRInt32 GetLineNumber()
    {
      return mLineNumber;
    }

    void SetLineNumber(PRInt32 aLineNumber)
    {
      mLineNumber = mLineNumber == 0 ? aLineNumber : mLineNumber;
    }

    void SetInError(bool aInError)
    {
      mInError = aInError;
    }

    bool IsInError()
    {
      return mInError;
    }

    void SetAttributeCount(PRInt16 aValue) {  mAttrCount = aValue; }

    /**
     * perform self test.
     * @update	gess5/11/98
     */
    virtual void SelfTest(void);

    static int GetTokenCount();

protected:
    /**
     * Returns the size of the token object.
     */
    virtual size_t SizeOf() const = 0;

    PRInt32 mTypeID;
    PRInt32 mUseCount;
    PRInt32 mNewlineCount;
    PRUint32 mLineNumber : 31;
    PRUint32 mInError : 1;
    PRInt16 mAttrCount;
};

#endif


text:
* http://discuss.emberjs.com/t/how-to-deal-with-route-when-model-gets-a-404/5283
  * suggest to use `error` action
* https://github.com/emberjs/ember.js/blob/master/packages/ember-runtime/lib/ext/rsvp.js#L69 sets default error handler on promises
* see https://github.com/tildeio/rsvp.js#error-handling
* no documentation in http://emberjs.com/api/classes/RSVP.html


text:
    {{#isSeparator}}
    {{/isSeparator}}
    {{^isSeparator}}

{{label}}

{{value}}

    {{#changeLink}}

{{#t}}buttons.change{{/t}} {{changeLinkDescription}} from {{value}}

    {{/changeLink}}
    {{^changeLink}}

{{#t}}buttons.change{{/t}} {{changeLinkDescription}} from {{value}}

    {{/changeLink}}
    {{/isSeparator}}


text:
from django.core.management.base import BaseCommand, CommandError

import silk.models

class Command(BaseCommand):
    help = "Clears silk's log of requests."

    @staticmethod
    def delete_model(model):
        count = model.objects.count()
        print("deleting %s %s objects" % (model.__name__, count))
        model.objects.all().delete()

    def handle(self, *args, **options):
        # Django takes a long time to traverse foreign key relations,
        # so delete in the order that makes it easy.
        Command.delete_model(silk.models.Profile)
        Command.delete_model(silk.models.SQLQuery)
        Command.delete_model(silk.models.Response)
        Command.delete_model(silk.models.Request)


text:
#include "mbed.h"
#include "test_env.h"
#include "rtos.h"

#if defined(MBED_RTOS_SINGLE_THREAD)
  #error [NOT_SUPPORTED] test not supported
#endif

#define QUEUE_SIZE              5
#define THREAD_DELAY            250
#define QUEUE_PUT_ISR_VALUE     128
#define QUEUE_PUT_THREAD_VALUE  127

/*
 * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
 * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
 * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
 */
#if (defined(TARGET_EFM32HG_STK3400)) && !defined(TOOLCHAIN_ARM_MICRO)
    #define STACK_SIZE 512
#elif (defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32PG_STK3401)) && !defined(TOOLCHAIN_ARM_MICRO)
    #define STACK_SIZE 768
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
    #define STACK_SIZE 1536
#elif defined(TARGET_MCU_NRF51822)
    #define STACK_SIZE 768
#elif (defined(TARGET_STM32F070RB) || defined(TARGET_STM32F072RB))
    #define STACK_SIZE DEFAULT_STACK_SIZE/2
#else
    #define STACK_SIZE DEFAULT_STACK_SIZE
#endif

Queue<uint32_t, QUEUE_SIZE> queue;

DigitalOut myled(LED1);

void queue_isr() {

    queue.put((uint32_t*)QUEUE_PUT_ISR_VALUE);
    myled = !myled;
}

void queue_thread(void const *argument) {
    while (true) {
        queue.put((uint32_t*)QUEUE_PUT_THREAD_VALUE);
        Thread::wait(THREAD_DELAY);
    }
}

int main (void) {
    MBED_HOSTTEST_TIMEOUT(20);
    MBED_HOSTTEST_SELECT(default_auto);
    MBED_HOSTTEST_DESCRIPTION(ISR (Queue));
    MBED_HOSTTEST_START("RTOS_8");

    Thread thread(queue_thread, NULL, osPriorityNormal, STACK_SIZE);
    Ticker ticker;
    ticker.attach(queue_isr, 1.0);
    int isr_puts_counter = 0;
    bool result = true;

    while (true) {
        osEvent evt = queue.get();
        if (evt.status != osEventMessage) {
            printf("QUEUE_GET: Status(0x%02X) ... [FAIL]\r\n", evt.status);
            result = false;
            break;
        } else {
            printf("QUEUE_GET: Value(%u) ... [OK]\r\n", evt.value.v);
            if (evt.value.v == QUEUE_PUT_ISR_VALUE) {
                isr_puts_counter++;
            }
            if (isr_puts_counter >= QUEUE_SIZE) {
                break;
            }
        }
    }

    MBED_HOSTTEST_RESULT(result);
    return 0;
}


text:
function Get-DbaXEObject {
    <#
    .SYNOPSIS
        Gets a list of extended events objects exposed by event packages from specified SQL Server instance(s).

    .DESCRIPTION
        This function returns a list of extended events objects exposed by event packages from specified SQL Server instance(s).

    .PARAMETER SqlInstance
        The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.

    .PARAMETER SqlCredential
        Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)

    .PARAMETER Type
        Used to specify the type. Valid types include:

        Action
        Event
        Map
        Message
        PredicateComparator
        PredicateSource
        Target
        Type

    .PARAMETER EnableException
        By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

    .NOTES
        Tags: ExtendedEvent, XE, XEvent
        Author: Chrissy LeMaire (@cl), netnerds.net

        Website: https://dbatools.io
        Copyright: (c) 2018 by dbatools, licensed under MIT
        License: MIT https://opensource.org/licenses/MIT

    .EXAMPLE
        PS C:\> Get-DbaXEObject -SqlInstance sql2016

        Lists all the XE Objects on the sql2016 SQL Server.

    .EXAMPLE
        PS C:\> Get-DbaXEObject -SqlInstance sql2017 -Type Action, Event

        Lists all the XE Objects of type Action and Event on the sql2017 SQL Server.

    #>
    [CmdletBinding()]
    param (
        [parameter(Position = 0, Mandatory, ValueFromPipeline)]
        [Alias("ServerInstance", "SqlServer")]
        [DbaInstanceParameter[]]$SqlInstance,
        [PSCredential]$SqlCredential,
        [ValidateSet("Type", "Event", "Target", "Action", "Map", "Message", "PredicateComparator", "PredicateSource")]
        [string[]]$Type,
        [switch]$EnableException
    )
    begin {
        if ($Type) {
            $join = $Type -join "','"
            $where = "AND o.object_type in ('$join')"
            $where.Replace("PredicateComparator", "pred_compare")
            $where.Replace("PredicateSource", "pred_source")
        }
        $sql = "SELECT  SERVERPROPERTY('MachineName') AS ComputerName,
                ISNULL(SERVERPROPERTY('InstanceName'), 'MSSQLSERVER') AS InstanceName,
                SERVERPROPERTY('ServerName') AS SqlInstance,
                p.name AS PackageName,
                ObjectType =
                      CASE o.object_type
                         WHEN 'type' THEN 'Type'
                         WHEN 'event' THEN 'Event'
                         WHEN 'target' THEN 'Target'
                         WHEN 'pred_compare' THEN 'PredicateComparator'
                         WHEN 'pred_source' THEN 'PredicateSource'
                         WHEN 'action' THEN 'Action'
                         WHEN 'map' THEN 'Map'
                         WHEN 'message' THEN 'Message'
                         ELSE o.object_type
                      END,
                o.object_type as ObjectTypeRaw,
                o.name AS TargetName,
                o.description as Description
                FROM sys.dm_xe_packages AS p
                JOIN sys.dm_xe_objects AS o ON p.guid = o.package_guid
                WHERE (p.capabilities IS NULL OR p.capabilities & 1 = 0)
                $where
                AND (o.capabilities IS NULL OR o.capabilities & 1 = 0)
                ORDER BY o.object_type
                "
    }
    process {
        foreach ($instance in $SqlInstance) {

            try {
                $server = Connect-SqlInstance -SqlInstance $instance -SqlCredential $SqlCredential -MinimumVersion 9
            } catch {
                Stop-Function -Message "Error occurred while establishing connection to $instance" -Category ConnectionError -ErrorRecord $_ -Target $instance -Continue
                return
            }

            try {
                $server.Query($sql) | Select-DefaultView -ExcludeProperty ComputerName, InstanceName, ObjectTypeRaw
            } catch {
                Stop-Function -Message "Issue collecting trace data on $server." -Target $server -ErrorRecord $_
            }
        }
    }
}


text:
<?php

/**#@+ @ignore */
require_once("ASF/Object.php");
/**#@-*/

/**
 * The <i>Advanced Content Encryption Object</i> lets authors protect content by
 * using Next Generation Windows Media Digital Rights Management for Network
 * Devices.
 *
 * @package    php-reader
 * @subpackage ASF
 * @author     Sven Vollbehr <svollbehr@gmail.com>
 * @copyright  Copyright (c) 2008 The PHP Reader Project Workgroup
 * @license    http://code.google.com/p/php-reader/wiki/License New BSD License
 * @version    $Rev: 108 $
 */
final class ASF_Object_AdvancedContentEncryption extends ASF_Object
{
  const WINDOWS_MEDIA_DRM_NETWORK_DEVICES =
    "7a079bb6-daa4-4e12-a5ca-91d3 8dc11a8d";

  /** @var Array */
  private $_contentEncryptionRecords = array();

  /**
   * Constructs the class with given parameters and reads object related data
   * from the ASF file.
   *
   * @param Reader $reader  The reader object.
   * @param Array  $options The options array.
   */
  public function __construct($reader, &$options = array())
  {
    parent::__construct($reader, $options);
    $contentEncryptionRecordsCount = $this->_reader->readUInt16LE();
    for ($i = 0; $i < $contentEncryptionRecordsCount; $i++) {
      $entry = array("systemId" => $this->_reader->readGUID(),
        "systemVersion" => $this->_reader->readUInt32LE(),
        "streamNumbers" => array());
      $encryptedObjectRecordCount = $this->_reader->readUInt16LE();
      for ($j = 0; $j < $encryptedObjectRecordCount; $j++) {
        $this->_reader->skip(4);
        $entry["streamNumbers"][] = $this->_reader->readUInt16LE();
      }
      $dataCount = $this->_reader->readUInt32LE();
      $entry["data"] = $this->_reader->read($dataCount);
      $this->_contentEncryptionRecords[] = $entry;
    }
  }

  /**
   * Returns an array of content encryption records. Each record consists of the
   * following keys.
   *
   *   o systemId -- Specifies the unique identifier for the content encryption
   *     system.
   *
   *   o systemVersion -- Specifies the version of the content encryption
   *     system.
   *
   *   o streamNumbers -- An array of stream numbers a particular Content
   *     Encryption Record is associated with.
   *
   *   o data -- The content protection data for this Content Encryption Record.
   *
   * @return Array
   */
  public function getContentEncryptionRecords()
  {
    return $this->_contentEncryptionRecords;
  }
}


text:
@interface BTUIKAppearance : NSObject

typedef NS_ENUM(NSInteger, BTUIKColorScheme) {
    BTUIKColorSchemeLight,
    BTUIKColorSchemeDark,
    BTUIKColorSchemeDynamic API_AVAILABLE(ios(13.0))
};

/// Shared instance used by Form elements
+ (instancetype)sharedInstance;

/// Fallback color for the overlay if blur is disabled
@property (nonatomic, strong) UIColor *overlayColor;
/// Tint color
@property (nonatomic, strong) UIColor *tintColor;
/// Bar color
@property (nonatomic, strong) UIColor *barBackgroundColor;
/// Font family
@property (nonatomic, strong) NSString *fontFamily;
/// Bold font family
@property (nonatomic, strong) NSString *boldFontFamily;
/// Sheet background color
@property (nonatomic, strong) UIColor *formBackgroundColor;
/// Form field background color
@property (nonatomic, strong) UIColor *formFieldBackgroundColor;
/// Primary text color
@property (nonatomic, strong) UIColor *primaryTextColor;
/// Navigation title text color
/// Defaults to nil. When not set, navigation titles will use primaryTextColor
@property (nonatomic, strong) UIColor *navigationBarTitleTextColor;
/// Secondary text color
@property (nonatomic, strong) UIColor *secondaryTextColor;
/// Color of disabled buttons
@property (nonatomic, strong) UIColor *disabledColor;
/// Placeholder text color for form fields
@property (nonatomic, strong) UIColor *placeholderTextColor;
/// Line and border color
@property (nonatomic, strong) UIColor *lineColor;
/// Error foreground color
@property (nonatomic, strong) UIColor *errorForegroundColor;
/// Blur style
@property (nonatomic) UIBlurEffectStyle blurStyle;
/// Activity indicator style
@property (nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
/// Toggle blur effects
@property (nonatomic) BOOL useBlurs;
/// The keyboard the postal code field should use
@property (nonatomic) UIKeyboardType postalCodeFormFieldKeyboardType;
/// The highlighted version of the `tintColor`
@property (nonatomic, readonly, getter = highlightedTintColor) UIColor *highlightedTintColor;
/// Tint color for UISwitch when in the on position
@property (nonatomic, strong) UIColor *switchOnTintColor;
/// Tint color for UISwitch thumb
@property (nonatomic, strong) UIColor *switchThumbTintColor;
/// Color scheme of the Drop-In UI.
///
/// When set to BTUIKColorSchemeLight, the Drop-In UI uses a light color palette.
/// When set to BTUIKColorSchemeDark, the Drop-In UI uses a dark color palette.
/// When set to BTUIKColorSchemeDynamic, the Drop-In UI uses a dark or light color palette depending on the user's light or dark mode system preference. Only available in iOS 13+
@property (nonatomic) enum BTUIKColorScheme colorScheme;
/// Appearance style of keyboards associated with text fields
@property (nonatomic) UIKeyboardAppearance keyboardAppearance;

@property (nonatomic) BOOL disableDynamicType;

@property (nonatomic, strong) UIFont *bodyFont;
@property (nonatomic, strong) UIFont *staticBodyFont;
@property (nonatomic, strong) UIFont *headlineFont;
@property (nonatomic, strong) UIFont *staticHeadlineFont;
@property (nonatomic, strong) UIFont *captionFont;
@property (nonatomic, strong) UIFont *staticCaptionFont;
@property (nonatomic, strong) UIFont *staticTitleFont;

- (void)configureWithUICustomization:(BTDropInUICustomization *)uiCustomization;

/// Sets the color (primary or secondary) and font with family and size (large or small)
/// These properties are on the [BTUIKAppearance sharedInstance]
+ (void)styleLabelPrimary:(UILabel *)label;
+ (void)styleLabelBoldPrimary:(UILabel *)label;
+ (void)styleSmallLabelPrimary:(UILabel *)label;
+ (void)styleLabelSecondary:(UILabel *)label;
+ (void)styleLargeLabelSecondary:(UILabel *)label;
+ (void)styleSystemLabelSecondary:(UILabel *)label;
+ (UILabel *)styledNavigationTitleLabel;

+ (float)horizontalFormContentPadding;
+ (float)minimumHitArea;
+ (float)verticalFormSpace;
+ (float)verticalFormSpaceTight;
+ (float)verticalSectionSpace;
+ (float)smallIconWidth;
+ (float)smallIconHeight;
+ (float)largeIconWidth;
+ (float)largeIconHeight;
+ (NSDictionary*)metrics;

@end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JackLondonRPG
{
	public interface IDamageable : IIdentifiable
	{
		int CurrHealth
		{
			get;
			set;
		}

		IEnumerable<GameEvent> GetDamaged(int damage);
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="start"
    android:paddingLeft="@dimen/md_dialog_frame_margin"
    android:paddingRight="@dimen/md_dialog_frame_margin">

    <TextView
        android:id="@android:id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:paddingLeft="4dp"
        android:paddingRight="4dp"
        tools:text="Dialog message"
        android:paddingBottom="12dp" />

</LinearLayout>


text:
package greycat.chunk;

public interface TimeTreeChunk extends Chunk {

    int insert(long key);

    long getKey(int offset);

    long previousOrEqual(long key);

    int previousOrEqualOffset(long key);

    void range(long startKey, long endKey, long maxElements, TreeWalker walker);

    long magic();

    long previous(long key);

    long next(long key);

    int size();

    long capacity();

    void setCapacity(long v);

    long max();

}


text:
namespace chromecast {

class OsdSurface;
struct Rect;
struct Size;

// Abstract graphics plane for OSD, to be implemented in platform-specific way.
// Platform must composite this plane on top of main (GL-based) graphics plane.
class OsdPlane {
 public:
  virtual ~OsdPlane() {}

  // Creates a surface for offscreen drawing.
  virtual OsdSurface* CreateSurface(const Size& size) = 0;

  // Sets a clip rectangle, client should call before drawing to back buffer
  // to specify the area they intend to draw on.  Platforms may reduce memory
  // usage by only allocating back buffer to cover this area.  Areas outside
  // clip rectangle must display as fully transparent.  In particular, setting
  // an empty clip rectangle and calling Flip should clear the plane.
  // |osd_res| gives the resolution of the full OSD plane, i.e. |rect| is
  // a subrectangle of this area.  |output_scale| specifies the current scaling
  // from |osd_res| to output screen resolution.
  virtual void SetClipRectangle(const Rect& rect,
                                const Size& osd_res,
                                float output_scale) = 0;

  // Gets the current back buffer surface.  Valid until next call to Flip or
  // SetClipRectangle.
  virtual OsdSurface* GetBackBuffer() = 0;

  // Presents current back buffer to screen.
  virtual void Flip() = 0;
};

}  // namespace chromecast

#endif  // CHROMECAST_PUBLIC_OSD_PLANE_H_


text:
/***************************************************************************

Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

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

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.IO;
using System.Security;
using System.Globalization;
using Microsoft.VisualStudio.TemplateWizard;

namespace Microsoft.Samples.VisualStudio.IronPythonWebSiteCustomWizard
{
    /// <summary>
    /// We need to override the default Wizard used by the WebSite Project
    /// in order to enable the itemtemplate to add the App_Code folder. That means that we will override the
    /// ShouldAddProjectItem to return true when the item to be added is the App_Code folder.
    ///  In all other methods we will just delegate to the default wizard
    /// </summary>
    public class CustomWizardBase : IWizard
    {
        #region fields
        IWizard aggregatedWizard;
        #endregion

        #region Properties
        internal protected string AggregatedWizardAssemblyName
        {
            get
            {
                return "Microsoft.VisualStudio.Web, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
            }
        }

        internal protected virtual string AggregatedFullClassName
        {
            get
            {
                return "";
            }
        }

        internal protected IWizard AggregatedWizard
        {
            get
            {
                if (aggregatedWizard == null)
                {
                    LoadAggregatedWizard();
                }
                return aggregatedWizard;
            }
        }
        #endregion

        #region IWizard Members

        public virtual void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
        {
            AggregatedWizard.BeforeOpeningFile(projectItem);
        }

        public virtual void ProjectFinishedGenerating(EnvDTE.Project project)
        {
            AggregatedWizard.ProjectFinishedGenerating(project);
        }

        public virtual void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
        {
            AggregatedWizard.ProjectItemFinishedGenerating(projectItem);
        }

        public virtual void RunFinished()
        {
            AggregatedWizard.RunFinished();
        }

        public virtual void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            AggregatedWizard.RunStarted(automationObject, replacementsDictionary, runKind, customParams);
        }

        /// <summary>
        /// Override original logic that determines if project items should be added.
        /// We want to return true if the add App_Code directory is added to project root
        /// </summary>
        /// <param name="filePath">path to file</param>
        /// <returns>true if file should be added</returns>
        public virtual bool ShouldAddProjectItem(string filePath)
        {
            //Always return true if the project item to be added is the App_Code folder
            DirectoryInfo info = new DirectoryInfo(filePath);
            if (String.Compare(info.Name, "App_Code", true, CultureInfo.InvariantCulture) == 0)
            {
                return true;
            }
            else
            {
                return AggregatedWizard.ShouldAddProjectItem(filePath);
            }
        }

        #endregion

        #region Helper methods
        protected void LoadAggregatedWizard()
        {
            Assembly asm = Assembly.Load(AggregatedWizardAssemblyName);
            aggregatedWizard = (IWizard)asm.CreateInstance(AggregatedFullClassName);
        }
        #endregion
    }

    /// <summary>
    /// WebForm specific custom wizard.
    /// </summary>
    public class WebFormCustomWizard : CustomWizardBase
    {
        #region Properties
        protected internal override string AggregatedFullClassName
        {
            get
            {
                return "Microsoft.VisualStudio.Web.Wizard.VsWebFormItemTemplateWizard";
            }
        }
        #endregion
    }

    /// <summary>
    /// MasterPage specific custom wizard.
    /// </summary>
    public class MasterPageCustomWizard : CustomWizardBase
    {
        #region Properties
        protected internal override string AggregatedFullClassName
        {
	        get
	        {
                return "Microsoft.VisualStudio.Web.Wizard.VsMasterPageItemTemplateWizard";
	        }
        }
        #endregion
    }
}


text:
#ifndef __C_SKY_BOX_SCENE_NODE_H_INCLUDED__
#define __C_SKY_BOX_SCENE_NODE_H_INCLUDED__

#include "ISceneNode.h"

namespace irr
{
namespace scene
{

	// Skybox, rendered with zbuffer turned off, before all other nodes.
	class CSkyBoxSceneNode : public ISceneNode
	{
        protected:
            virtual ~CSkyBoxSceneNode()
            {
                for (size_t i=0; i<6; i++)
                    sides[i]->drop();
            }

        public:
            //! constructor
            CSkyBoxSceneNode(	core::smart_refctd_ptr<video::ITexture>&& top, core::smart_refctd_ptr<video::ITexture>&& bottom,
								core::smart_refctd_ptr<video::ITexture>&& left, core::smart_refctd_ptr<video::ITexture>&& right,
								core::smart_refctd_ptr<video::ITexture>&& front, core::smart_refctd_ptr<video::ITexture>&& back,
								core::smart_refctd_ptr<video::IGPUBuffer>&& vertPositions, size_t positionsOffsetInBuf,
								IDummyTransformationSceneNode* parent, ISceneManager* mgr, int32_t id);
            //! clone Ctor
            CSkyBoxSceneNode(CSkyBoxSceneNode* other,
                IDummyTransformationSceneNode* parent, ISceneManager* mgr, int32_t id);

            //!
            virtual bool supportsDriverFence() const {return true;}

            virtual void OnRegisterSceneNode();

            //! renders the node.
            virtual void render();

            //! returns the axis aligned bounding box of this node
            virtual const core::aabbox3d<float>& getBoundingBox();

            //! Returns type of the scene node
            virtual ESCENE_NODE_TYPE getType() const { return ESNT_SKY_BOX; }

            //! Creates a clone of this scene node and its children.
            virtual ISceneNode* clone(IDummyTransformationSceneNode* newParent=0, ISceneManager* newManager=0) { assert(false); return nullptr; }

        private:

            core::aabbox3d<float> Box;
            video::IGPUMeshBuffer* sides[6];
            video::SGPUMaterial Material[6];
	};

} // end namespace scene
} // end namespace irr

#endif


text:
<!doctype html>

    <title>Stoke's Theorem</title>

    <link rel="stylesheet" href="https://rawgit.com/Imperial-visualizations/Physics-Visualizations/master/css/skeleton.css">
    <link rel="stylesheet" href="https://rawgit.com/Imperial-visualizations/Physics-Visualizations/master/css/style.css">
    <link rel="stylesheet" href="../util/navigation.css">
    <link rel="stylesheet" href="../styles/guidance.css">

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

        Instructions for use

        <button class="backBtn">◀ Back</button> <button class="nextBtn">Next ▶</button>

                This is the guidance for the Stoke's Theorem visualisation.

                The graph shows an open surface bounded by a loop.

                Click on the "Play" button to start the animation. The open surface then can be squashed down to the area bounded by the loop.

                The size of the surface can be changed by this slider. After changing the slider, play the animation again to see the value of the integral
                will NOT be affected by the shape of the open surface.

                The shape of the loop can be changed by this slider. After changing the slider, play the animation again to see the value of the integral
                will be affected by the shape of the loop.

                More details are shown here.

                You can zoom in the graph by turning your mouse wheel, and you can also view the graph from different viewpoints by click on the graph and rotate it with your mouse.

                Have fun!

Stoke's Theorem

                        Stoke's theorem relates the integral of the curl of a vector field, V, over an open surface S to the path integral of the vector field around a loop C defining the surface boundary.

                        Mathematically, this can be written as
                        $$ \iint_{S} \nabla \times \vec{V} \cdot \vec{dS} = \oint_C \vec{V} \cdot \vec{dr}$$
                        Where dS is the surface normal vector and dr is the path tangent vector.

                        As the right hand side of the equation is independent of the surface, the integral of the curl of a vector field over a surface is independent of the surface itself, but is only determined by the curve bounding it.

                        Therefore, changing the surface by moving the first slider doesn't change the value of the integral, however, modifying the loop by moving the second slider does.

                    Size of the Surface:
                        2

                        <input id="xController" class="inputs" type="range" value="5" min="0" max="2" step="0.1"/>

                    Shape of the Loop:
                        2

                        <input id="yController" class="inputs" type="range" value="5" min="2" max="8" step="2"/>

                    <input id="animate" class="button-primary" type="submit" value="Play">


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using AppKit.Core.Application.Enums;
using AppKit.Core.Audit.Models;
using AppKit.Core.Audit.ObjectAudits.Business;
using AppKit.Core.Ioc;
using AppKit.Core.Tests;
using AppKit.Core.Tests.Constants;
using FunctionalTests.Audit.TestUtils;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace FunctionalTests.Audit
{
    [TestClass]
    public class ObjectAuditListByUserNameFunctionalTest
    {

        [TestMethod]
        public void ObjectAuditListByUserName_RunNormal()
        {
            IObjectAuditWriteService writeService = IocProvider.Create<IObjectAuditWriteService>();
            IObjectAuditReadService readService = IocProvider.Create<IObjectAuditReadService>();

            PersonAuditEntity person1 = PersonAuditEntity.FillPerson("aaaaa", 19);
            PersonAuditEntity person2 = PersonAuditEntity.FillPerson("bbbbb", 40);
            PersonAuditEntity person3 = PersonAuditEntity.FillPerson("ccccc", 75);
            PersonAuditEntity person4 = PersonAuditEntity.FillPerson("ddddd", 6);
            PersonAuditEntity person5 = PersonAuditEntity.FillPerson("eeeee", 13);
            PersonAuditEntity person6 = PersonAuditEntity.FillPerson("fffff", 29);

            const string name1 = "Vasya";
            const string name2 = "Petya";

            Thread.Sleep(200);
            DateTime now = DateTime.Now;
            Thread.Sleep(200);

            TestProvider.Set(TestConstants.SecurityUserName, name1);
            writeService.WriteObjectAudit(person1, ActionResult.Success);

            TestProvider.Set(TestConstants.SecurityUserName, name2);
            writeService.WriteObjectAudit(person2, ActionResult.Error);

            TestProvider.Set(TestConstants.SecurityUserName, name1);
            writeService.WriteObjectAudit(person3, ActionResult.Success);

            TestProvider.Set(TestConstants.SecurityUserName, name2);
            writeService.WriteObjectAudit(person4, ActionResult.Error);

            TestProvider.Set(TestConstants.SecurityUserName, name1);
            writeService.WriteObjectAudit(person5, ActionResult.Success);

            TestProvider.Set(TestConstants.SecurityUserName, name2);
            writeService.WriteObjectAudit(person6, ActionResult.Error);

            List<ObjectAudit> list = readService.GetObjectAuditListByUserName(name2, now, now.AddHours(1));

            ObjectAudit audit1 = list.FirstOrDefault(x => x.ObjectId == person1.Id);
            ObjectAudit audit2 = list.FirstOrDefault(x => x.ObjectId == person2.Id);
            ObjectAudit audit3 = list.FirstOrDefault(x => x.ObjectId == person3.Id);
            ObjectAudit audit4 = list.FirstOrDefault(x => x.ObjectId == person4.Id);
            ObjectAudit audit5 = list.FirstOrDefault(x => x.ObjectId == person5.Id);
            ObjectAudit audit6 = list.FirstOrDefault(x => x.ObjectId == person6.Id);

            Assert.IsNull(audit1);
            Assert.IsNotNull(audit2);
            Assert.IsNull(audit3);
            Assert.IsNotNull(audit4);
            Assert.IsNull(audit5);
            Assert.IsNotNull(audit6);
        }
    }
}


text:
<?php

namespace QF\Form\Element;

use \QF\Form\Validator\InArray;

class CheckboxGroup extends Element
{

    protected $type = 'checkboxGroup';

    public function __construct($name = false, $options = array(), $validators = array())
    {
        parent::__construct($name, $options, $validators);
        if (!isset($this->options['elements'])) {
            $this->options['elements'] = array();
        }
    }

    public function setValue($value)
    {
        parent::setValue($value);
        if (!is_array($this->value)) {
            $this->value = (array) $this->value;
        }
    }

    public function validate()
    {
        if ($this->value && !$this->getOption('skipDefaultValidator')) {
            $values = array();
            foreach ($this->options['elements'] as $key => $value) {
                if (is_array($value)) {
                    foreach ($value as $k => $v) {
                        $values[] = $k;
                    }
                } else {
                    $values[] = $key;
                }
            }
            $this->validators[] = new InArray(array('errorMessage' => $this->errorMessage, 'array' => $values, 'multiple' => true));
        }

        return parent::validate();
    }

    public function toArray($public = true)
    {
        $element = parent::toArray($public);
        $element['fullName'] = $element['fullName'] . '[]';
        if ($public) {
            $element['elements'] = $this->options['elements'];
        }
        return $element;
    }

}