text:
using System;
using System.Collections.Generic;
using Azure.Core;

namespace Azure.ResourceManager.Sql.Models
{
    /// <summary> An extended server blob auditing policy. </summary>
    public partial class ExtendedServerBlobAuditingPolicy : Resource
    {
        /// <summary> Initializes a new instance of ExtendedServerBlobAuditingPolicy. </summary>
        public ExtendedServerBlobAuditingPolicy()
        {
            AuditActionsAndGroups = new ChangeTrackingList<string>();
        }

        /// <summary> Initializes a new instance of ExtendedServerBlobAuditingPolicy. </summary>
        /// <param name="id"> Resource ID. </param>
        /// <param name="name"> Resource name. </param>
        /// <param name="type"> Resource type. </param>
        /// <param name="predicateExpression"> Specifies condition of where clause when creating an audit. </param>
        /// <param name="state"> Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. </param>
        /// <param name="storageEndpoint"> Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. </param>
        /// <param name="storageAccountAccessKey">
        /// Specifies the identifier key of the auditing storage account.
        ///
        /// If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage.
        ///
        /// Prerequisites for using managed identity authentication:
        ///
        /// 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
        ///
        /// 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity.
        ///
        /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355).
        /// </param>
        /// <param name="retentionDays"> Specifies the number of days to keep in the audit logs in the storage account. </param>
        /// <param name="auditActionsAndGroups">
        /// Specifies the Actions-Groups and Actions to audit.
        ///
        ///
        ///
        /// The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins:
        ///
        ///
        ///
        /// BATCH_COMPLETED_GROUP,
        ///
        /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
        ///
        /// FAILED_DATABASE_AUTHENTICATION_GROUP.
        ///
        ///
        ///
        /// This above combination is also the set that is configured by default when enabling auditing from the Azure portal.
        ///
        ///
        ///
        /// The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records):
        ///
        ///
        ///
        /// APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
        ///
        /// BACKUP_RESTORE_GROUP
        ///
        /// DATABASE_LOGOUT_GROUP
        ///
        /// DATABASE_OBJECT_CHANGE_GROUP
        ///
        /// DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
        ///
        /// DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
        ///
        /// DATABASE_OPERATION_GROUP
        ///
        /// DATABASE_PERMISSION_CHANGE_GROUP
        ///
        /// DATABASE_PRINCIPAL_CHANGE_GROUP
        ///
        /// DATABASE_PRINCIPAL_IMPERSONATION_GROUP
        ///
        /// DATABASE_ROLE_MEMBER_CHANGE_GROUP
        ///
        /// FAILED_DATABASE_AUTHENTICATION_GROUP
        ///
        /// SCHEMA_OBJECT_ACCESS_GROUP
        ///
        /// SCHEMA_OBJECT_CHANGE_GROUP
        ///
        /// SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
        ///
        /// SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
        ///
        /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
        ///
        /// USER_CHANGE_PASSWORD_GROUP
        ///
        /// BATCH_STARTED_GROUP
        ///
        /// BATCH_COMPLETED_GROUP
        ///
        ///
        ///
        /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs.
        ///
        ///
        ///
        /// For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups).
        ///
        ///
        ///
        /// For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are:
        ///
        /// SELECT
        ///
        /// UPDATE
        ///
        /// INSERT
        ///
        /// DELETE
        ///
        /// EXECUTE
        ///
        /// RECEIVE
        ///
        /// REFERENCES
        ///
        ///
        ///
        /// The general form for defining an action to be audited is:
        ///
        /// {action} ON {object} BY {principal}
        ///
        ///
        ///
        /// Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.
        ///
        ///
        ///
        /// For example:
        ///
        /// SELECT on dbo.myTable by public
        ///
        /// SELECT on DATABASE::myDatabase by public
        ///
        /// SELECT on SCHEMA::mySchema by public
        ///
        ///
        ///
        /// For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions).
        /// </param>
        /// <param name="storageAccountSubscriptionId"> Specifies the blob storage subscription Id. </param>
        /// <param name="isStorageSecondaryKeyInUse"> Specifies whether storageAccountAccessKey value is the storage's secondary key. </param>
        /// <param name="isAzureMonitorTargetEnabled">
        /// Specifies whether audit events are sent to Azure Monitor.
        ///
        /// In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true.
        ///
        ///
        ///
        /// When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created.
        ///
        /// Note that for server level audit you should use the 'master' database as {databaseName}.
        ///
        ///
        ///
        /// Diagnostic Settings URI format:
        ///
        /// PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
        ///
        ///
        ///
        /// For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207)
        ///
        /// or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043)
        ///
        /// .
        /// </param>
        /// <param name="queueDelayMs">
        /// Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed.
        ///
        /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
        /// </param>
        internal ExtendedServerBlobAuditingPolicy(string id, string name, string type, string predicateExpression, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, IList<string> auditActionsAndGroups, Guid? storageAccountSubscriptionId, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs) : base(id, name, type)
        {
            PredicateExpression = predicateExpression;
            State = state;
            StorageEndpoint = storageEndpoint;
            StorageAccountAccessKey = storageAccountAccessKey;
            RetentionDays = retentionDays;
            AuditActionsAndGroups = auditActionsAndGroups;
            StorageAccountSubscriptionId = storageAccountSubscriptionId;
            IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse;
            IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled;
            QueueDelayMs = queueDelayMs;
        }

        /// <summary> Specifies condition of where clause when creating an audit. </summary>
        public string PredicateExpression { get; set; }
        /// <summary> Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. </summary>
        public BlobAuditingPolicyState? State { get; set; }
        /// <summary> Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. </summary>
        public string StorageEndpoint { get; set; }
        /// <summary>
        /// Specifies the identifier key of the auditing storage account.
        ///
        /// If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage.
        ///
        /// Prerequisites for using managed identity authentication:
        ///
        /// 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
        ///
        /// 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity.
        ///
        /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355).
        /// </summary>
        public string StorageAccountAccessKey { get; set; }
        /// <summary> Specifies the number of days to keep in the audit logs in the storage account. </summary>
        public int? RetentionDays { get; set; }
        /// <summary>
        /// Specifies the Actions-Groups and Actions to audit.
        ///
        ///
        ///
        /// The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins:
        ///
        ///
        ///
        /// BATCH_COMPLETED_GROUP,
        ///
        /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
        ///
        /// FAILED_DATABASE_AUTHENTICATION_GROUP.
        ///
        ///
        ///
        /// This above combination is also the set that is configured by default when enabling auditing from the Azure portal.
        ///
        ///
        ///
        /// The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records):
        ///
        ///
        ///
        /// APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
        ///
        /// BACKUP_RESTORE_GROUP
        ///
        /// DATABASE_LOGOUT_GROUP
        ///
        /// DATABASE_OBJECT_CHANGE_GROUP
        ///
        /// DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
        ///
        /// DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
        ///
        /// DATABASE_OPERATION_GROUP
        ///
        /// DATABASE_PERMISSION_CHANGE_GROUP
        ///
        /// DATABASE_PRINCIPAL_CHANGE_GROUP
        ///
        /// DATABASE_PRINCIPAL_IMPERSONATION_GROUP
        ///
        /// DATABASE_ROLE_MEMBER_CHANGE_GROUP
        ///
        /// FAILED_DATABASE_AUTHENTICATION_GROUP
        ///
        /// SCHEMA_OBJECT_ACCESS_GROUP
        ///
        /// SCHEMA_OBJECT_CHANGE_GROUP
        ///
        /// SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
        ///
        /// SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
        ///
        /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
        ///
        /// USER_CHANGE_PASSWORD_GROUP
        ///
        /// BATCH_STARTED_GROUP
        ///
        /// BATCH_COMPLETED_GROUP
        ///
        ///
        ///
        /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs.
        ///
        ///
        ///
        /// For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups).
        ///
        ///
        ///
        /// For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are:
        ///
        /// SELECT
        ///
        /// UPDATE
        ///
        /// INSERT
        ///
        /// DELETE
        ///
        /// EXECUTE
        ///
        /// RECEIVE
        ///
        /// REFERENCES
        ///
        ///
        ///
        /// The general form for defining an action to be audited is:
        ///
        /// {action} ON {object} BY {principal}
        ///
        ///
        ///
        /// Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.
        ///
        ///
        ///
        /// For example:
        ///
        /// SELECT on dbo.myTable by public
        ///
        /// SELECT on DATABASE::myDatabase by public
        ///
        /// SELECT on SCHEMA::mySchema by public
        ///
        ///
        ///
        /// For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions).
        /// </summary>
        public IList<string> AuditActionsAndGroups { get; }
        /// <summary> Specifies the blob storage subscription Id. </summary>
        public Guid? StorageAccountSubscriptionId { get; set; }
        /// <summary> Specifies whether storageAccountAccessKey value is the storage's secondary key. </summary>
        public bool? IsStorageSecondaryKeyInUse { get; set; }
        /// <summary>
        /// Specifies whether audit events are sent to Azure Monitor.
        ///
        /// In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true.
        ///
        ///
        ///
        /// When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created.
        ///
        /// Note that for server level audit you should use the 'master' database as {databaseName}.
        ///
        ///
        ///
        /// Diagnostic Settings URI format:
        ///
        /// PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview
        ///
        ///
        ///
        /// For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207)
        ///
        /// or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043)
        ///
        /// .
        /// </summary>
        public bool? IsAzureMonitorTargetEnabled { get; set; }
        /// <summary>
        /// Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed.
        ///
        /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
        /// </summary>
        public int? QueueDelayMs { get; set; }
    }
}


text:
using FluentNHibernate.MappingModel;
using FluentNHibernate.MappingModel.ClassBased;
using FluentNHibernate.MappingModel.Output;
using FluentNHibernate.Testing.Testing;
using NUnit.Framework;

namespace FluentNHibernate.Testing.MappingModel.Output
{
    [TestFixture]
    public class XmlHibernateMappingWriterTester
    {
        private IXmlWriter<HibernateMapping> writer;

        [SetUp]
        public void GetWriterFromContainer()
        {
            var container = new XmlWriterContainer();
            writer = container.Resolve<IXmlWriter<HibernateMapping>>();
        }

        [Test]
        public void ShouldOnlyOutputOneClass()
        {
            var mapping = new HibernateMapping();

            mapping.AddClass(new ClassMapping());

            writer.VerifyXml(mapping)
                .Element("class[2]").DoesntExist();
        }

        [Test]
        public void ShouldWriteSchemaAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.Schema, "dbo").MapsToAttribute("schema");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteDefaultCascadeAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.DefaultCascade, "cas").MapsToAttribute("default-cascade");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteDefaultAccessAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.DefaultAccess, "acc").MapsToAttribute("default-access");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteAutoImportAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.AutoImport, true).MapsToAttribute("auto-import");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteDefaultLazyAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.DefaultLazy, true).MapsToAttribute("default-lazy");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteCatalogAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.Catalog, "catalog").MapsToAttribute("catalog");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteNamespaceAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.Namespace, "namespace").MapsToAttribute("namespace");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteAssemblyAttribute()
        {
            var testHelper = new XmlWriterTestHelper<HibernateMapping>();

            testHelper.Check(x => x.Assembly, "assembly").MapsToAttribute("assembly");
            testHelper.VerifyAll(writer);
        }

        [Test]
        public void ShouldWriteImports()
        {
            var mapping = new HibernateMapping();

            mapping.AddImport(new ImportMapping());

            writer.VerifyXml(mapping)
                .Element("import").Exists();
        }

        [Test]
        public void ShouldWriteClasses()
        {
            var mapping = new HibernateMapping();

            mapping.AddClass(new ClassMapping());

            writer.VerifyXml(mapping)
                .Element("class").Exists();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Glossary of Terms
=================

.. _glossary_retry_storm:

**Retry Storm**
  A retry storm is an undesirable client/server failure mode where one or more
  peers become unhealthy, causing clients to retry a significant fraction of
  requests. This has the effect of multiplying the volume of traffic sent to the
  unhealthy peers, exacerbating the problem.

  For instance, consider two services, `A` -> `B` where `B` becomes overloaded
  and starts to fail a large fraction of requests. If `A` is configured to
  greedily optimize its client success rate by retrying requests, the total
  number of requests to `B` will be substantially amplified. `B` is the victim
  of a retry storm.

.. _glossary_back_pressure:

**Back pressure**
  Back pressure is a way of signaling that a service is overloaded to its clients.
  This allows for graceful degradation of a system if one or more components are
  not performing well.

.. _glossary_nack:

**Nack**
  A nack is a Negative ACKnowledgement. A service responds with a nack to signal
  that it is refusing to process the request. Generally, this indicates that the
  request is safe to retry, but Finagle also supports non-retryable nacks.
  Responding with a nack is one way a service may exert back pressure.


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.navercorp.pinpoint</groupId>
        <artifactId>pinpoint</artifactId>
        <relativePath>../../pom.xml</relativePath>
        <version>2.4.0-SNAPSHOT</version>
    </parent>

    <artifactId>pinpoint-profiler-optional-parent</artifactId>
    <name>pinpoint-profiler-optional-parent</name>
    <packaging>pom</packaging>
    <description>pinpoint profiler optional package parent</description>

    <dependencies>
        <dependency>
            <groupId>com.navercorp.pinpoint</groupId>
            <artifactId>pinpoint-profiler</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.navercorp.pinpoint</groupId>
                    <artifactId>pinpoint-bootstrap</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.navercorp.pinpoint</groupId>
                    <artifactId>pinpoint-rpc</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.navercorp.pinpoint</groupId>
                    <artifactId>pinpoint-thrift</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.2.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>com/navercorp/**/*</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
<?php

/**
 * Image
 *
 * The Video is displayed in the ImagePanel. This file
 * implements its displaying.
 * Video File : only ogv (free licence)
 *
 * @category  Website
 * @package   Photoshow
 * @license   http://www.gnu.org/licenses/
 */

class Video implements HTMLObject
{
	/// URLencoded version of the relative path to file
	static public $fileweb;

	/**
	 * Create Video
	 *
	 * @param string $file
	 * @author C�dric Levasseur
	 */
	public function __construct($file=NULL,$forcebig = false){

		if( !Judge::view($file)){
			return;
		}

		/// Check file type
		if(!isset($file) || !File::Type($file) || File::Type($file) != "Video") {
			return;
        }

		/// File object
		$this->file = $file;

		/// Set relative path (url encoded)
		$this->fileweb	=	urlencode(File::a2r($file));

	}

	/**
	 * Create Asynchrone Execution (compatibles Linux/Windows)
	 *
	 * @param string $file
     * @return pid of the executed command (only linux)
	 * @author C�dric Levasseur/Franck Royer
	 */
	public function ExecInBackground($cmd) {
		error_log('DEBUG/Video: Background Execution : '.$cmd,0);
        $pid = 0;
		if (substr(php_uname(), 0, 7) == "Windows"){
		   pclose(popen('start /b '.$cmd.' 2>&1', 'r'));
		} else {
		    exec($cmd . " > /dev/null 2>&1 & echo $!", $output);
            $pid = intval($output[0]);
		}
        return $pid;
	}

    /**
     * Compute the duration of a video using ffmpeg
     *
     * @return the duration in seconds
     * @author Franck Royer
     */
    public function GetDuration($file){
        if(!File::Type($file) || File::Type($file) != "Video"){
            return;
        }

        //TODO Windows
        exec(Settings::$ffmpeg_path.' -i '.escapeshellarg($file).' 2>&1|grep Duration', $output);
        $duration = $output[0];

        $duration_array = explode(':', $duration);
        $duration = intval($duration_array[1]) * 3600 + intval($duration_array[2]) * 60 + intval($duration_array[3]);

        //error_log('DEBUG/Video: duration of '.$file.' is '.$duration.' seconds');
        return $duration;
    }

    /**
     * Compute the dimension of a video using ffmpeg
     *
     * @return the dimension in a array of int
     * @author Franck Royer
     */
    public function GetScaledDimension($file, $x = 0, $y = 0){

        if(!File::Type($file) || File::Type($file) != "Video"){
            return;
        }

        //TODO Windows
        exec(Settings::$ffmpeg_path." -i ".escapeshellarg($file)." 2>&1|grep 'Stream #...([^)]*): Video:'", $output);
        $line = $output[0];
        preg_match('/, ([0-9]+)x([0-9]+), /', $line, $matches);
        $orig_x = intval($matches[1]);
        $orig_y = intval($matches[2]);

        //error_log('DEBUG/Video: dimension of '.$file.' is '.$orig_x.'x'.$orig_y);

        //If for some reason ffmpeg cannot get the dimension
        if ($orig_x == 0 || $orig_y == 0){
            error_log('ERROR/Video: dimension of '.$file.' is '.$orig_x.'x'.$orig_y);
            $orig_x = 320;
            $orig_y = 240;
        }

        $dimensions = array( 'x' => $orig_x, 'y' => $orig_y );

        if ($x != 0){// wants to know y for the given x
            $y = ($x*$orig_y) / $orig_x;
            $dimensions['x'] = $x;
            $dimensions['y'] = intval($y);
        }
        elseif ($x != 0){// wants to know x for the given y
            $x = ($y*$orig_x) / $orig_y;
            $dimensions['x'] = intval($x);
            $dimensions['y'] = $y;
        }// if both 0 we return original dimensions

        //error_log('DEBUG/Video: *scaled* dimension of '.$file.' is '.$dimensions['x'].'x'.$dimensions['y']);
        return $dimensions;
    }

	/**
	 * Asynchronous Convert all Video format to video/mp4
	 *
	 * Use ffmpeg for conversion
	 * @return void
	 * @author C�dric Levasseur
	 */
    public static function FastEncodeVideo($file) {

        /// Check item
        if(!File::Type($file) || File::Type($file) != "Video"){
            return;
        }

        $file_file	       = new File($file);
        $thumb_path_no_ext = Settings::$thumbs_dir.dirname(File::a2r($file))."/".$file_file->name;
        $thumb_path_mp4   = $thumb_path_no_ext.'.mp4';
        $thumb_path_jpg    = $thumb_path_no_ext.'.jpg';

        // Check if thumb folder exist
        if(!file_exists(dirname($thumb_path_mp4))){
            @mkdir(dirname($thumb_path_mp4),0755,true);
        }

        if (!file_exists($thumb_path_jpg) || filectime($file) > filectime($thumb_path_jpg)) {
            //Create Thumbnail jpg in Thumbs folder
            //TODO: scaled thumbnail would be better

            $offset = self::GetDuration($file)/2;
            $dimensions = self::GetScaledDimension($file, 320);

            $u=Settings::$ffmpeg_path.' -itsoffset -'.$offset.'  -i '.escapeshellarg($file).' -vcodec mjpeg -vframes 1 -an -f rawvideo -s '.$dimensions['x'].'x'.$dimensions['y'].' -y '.escapeshellarg($thumb_path_jpg);
            self::ExecInBackground($u);
        }

        if (self::NoJob($file))// We check that first to allow the clean of old job files
        {
            if (!file_exists($thumb_path_mp4) || filectime($file) > filectime($thumb_path_mp4)){
                if ($file_file->extension !="mp4") {
                    ///Convert video to mp4 format in Thumbs folder
                    //TODO: Max job limit
                    $u = Settings::$ffmpeg_path.' -i '.escapeshellarg($file).' '.Settings::$ffmpeg_option.' -y '.escapeshellarg($thumb_path_mp4);
                    $pid = self::ExecInBackground($u);
                    self::CreateJob($file, $pid);
                }
                else {
                    ///Copy original mp4 video to Thumbs folder
                    copy($file,$thumb_path_mp4);
                }
            }
        }
    }

	/**
     * Check if a job is running for the conversion
     * of a video described in the argument
     * Clean existing job files if necessary
	 *
	 * @return bool if No Job is running for this video
	 * @author Franck Royer
	 */
    public static function NoJob($file) {
        $file_file	       = new File($file);
        $job_filename = Settings::$thumbs_dir.dirname(File::a2r($file))."/".$file_file->name.'.job';

        if (!file_exists($job_filename))
        {
            return true;
        }

        $job_file = fopen($job_filename, "r");

        if (!$job_file)
        {
            error_log('ERROR/Video: Cannot read '.$job_filename.', deleting if possible.');
            unlink($job_filename);
            return true;
        }

        $pid = fgets($job_file);
        fclose($job_file);

        //TODO: windows
        exec('ps ax | grep '.$pid.' | grep -v grep -c', $output);
        if ($pid && $pid != '' && $pid != '0' && intval($output[0]) > 0) {
            // Process is still running
            //error_log('DEBUG/Video: job '.$pid.' is still running for '.$file);
            return false;
        } else { // Process is not running, delete job file
            //error_log('DEBUG/Video: job '.$pid.' is not running, deleting '.$job_filename);
            unlink($job_filename);
            return true;
        }
    }

	/**
     * Create a job file
	 *
	 * @return void
	 * @author Franck Royer
	 */
    public static function CreateJob($file, $pid) {
        if (!self::NoJob($file)){
            error_log('ERROR/Video: job for '.$file.' already exists, not creating second job file');
            return;
        }
        if ( !$pid || $pid == '' || $pid == '0'){
            error_log('ERROR/Video: pid for '.$file.' is invalid, not creating job file');
            return;
        }

        // Open file
        $file_file	       = new File($file);
        $job_filename = Settings::$thumbs_dir.dirname(File::a2r($file))."/".$file_file->name.'.job';
        $job_file = fopen($job_filename, "w");

        if (!$job_file) {
            error_log('ERROR/Video: Cannot write on '.$job_filename.'.');
            return;
        }

        //error_log('DEBUG/Video: store PID '.$pid.' in '.$job_filename);
        fwrite($job_file, $pid);
        fclose($job_file);
    }

    //TODO: center the video on y axis
    public function VideoDiv($width='100%',$height='100%',$control=false){
		$c = null;
		self::FastEncodeVideo($this->file);
		$wh = ' height="'.$height.'" width="'.$width.'"';
        if ($control) {
            $c = ' controls="controls"';
        }
        echo '<video'.$wh.$c.'><source src="?t=Vid&f='.$this->fileweb.'" type="video/mp4"/>';
        echo 'Your browser does not support the video tag.
';
        echo 'Please upgrade your browser or Download the codec Download';
        echo '</video>';
        //TODO: verify the message above works/do translations
	}

	/**
	 * Display the video on the website
	 *
	 * @return void
	 * @author C�dric Levasseur
	 */
	public function toHTML(){
        self::VideoDiv(400,400,true);
	}

}

?>


text:
* Stable release
* improved API

## 0.2

* Added highlight color for cells
* Updated API documentation

## 0.1.4

* Split TBFacetTableViewManger up into TBFacetTableViewCellConfigurator and TBFacetTableViewCellObserver.
* Added documentation.

## 0.1.0

Initial release.


text:
#ifndef SHELL_UART_H__
#define SHELL_UART_H__

#include <shell/shell.h>
#include <ring_buffer.h>
#include <atomic.h>

#ifdef __cplusplus
extern "C" {
#endif

extern const struct shell_transport_api shell_uart_transport_api;

/** @brief Shell UART transport instance control block (RW data). */
struct shell_uart_ctrl_blk {
	struct device *dev;
	shell_transport_handler_t handler;
	void *context;
	atomic_t tx_busy;
	bool blocking;
};

#ifdef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
#define UART_SHELL_TX_RINGBUF_DECLARE(_name, _size) \
	RING_BUF_DECLARE(_name##_tx_ringbuf, _size)

#define UART_SHELL_TX_BUF_DECLARE(_name) \
	u8_t _name##_txbuf[SHELL_UART_TX_BUF_SIZE]

#define UART_SHELL_RX_TIMER_DECLARE(_name) /* Empty */

#define UART_SHELL_TX_RINGBUF_PTR(_name) (&_name##_tx_ringbuf)

#define UART_SHELL_RX_TIMER_PTR(_name) NULL

#else /* CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN */
#define UART_SHELL_TX_RINGBUF_DECLARE(_name, _size) /* Empty */
#define UART_SHELL_TX_BUF_DECLARE(_name) /* Empty */
#define UART_SHELL_RX_TIMER_DECLARE(_name) static struct k_timer _name##_timer
#define UART_SHELL_TX_RINGBUF_PTR(_name) NULL
#define UART_SHELL_RX_TIMER_PTR(_name) (&_name##_timer)
#endif /* CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN */

/** @brief Shell UART transport instance structure. */
struct shell_uart {
	struct shell_uart_ctrl_blk *ctrl_blk;
	struct k_timer *timer;
	struct ring_buf *tx_ringbuf;
	struct ring_buf *rx_ringbuf;
};

/** @brief Macro for creating shell UART transport instance. */
#define SHELL_UART_DEFINE(_name, _tx_ringbuf_size, _rx_ringbuf_size)	\
	static struct shell_uart_ctrl_blk _name##_ctrl_blk;		\
	UART_SHELL_RX_TIMER_DECLARE(_name);				\
	UART_SHELL_TX_RINGBUF_DECLARE(_name, _tx_ringbuf_size);		\
	RING_BUF_DECLARE(_name##_rx_ringbuf, _rx_ringbuf_size);		\
	static const struct shell_uart _name##_shell_uart = {		\
		.ctrl_blk = &_name##_ctrl_blk,				\
		.timer = UART_SHELL_RX_TIMER_PTR(_name),		\
		.tx_ringbuf = UART_SHELL_TX_RINGBUF_PTR(_name),		\
		.rx_ringbuf = &_name##_rx_ringbuf,			\
	};								\
	struct shell_transport _name = {				\
		.api = &shell_uart_transport_api,			\
		.ctx = (struct shell_uart *)&_name##_shell_uart		\
	}

/**
 * @brief This function provides pointer to shell uart backend instance.
 *
 * Function returns pointer to the shell uart instance. This instance can be
 * next used with shell_execute_cmd function in order to test commands behavior.
 *
 * @returns Pointer to the shell instance.
 */
const struct shell *shell_backend_uart_get_ptr(void);

#ifdef __cplusplus
}
#endif

#endif /* SHELL_UART_H__ */


text:
package com.meleeratings.players;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlayerService {

    @Autowired
    PlayerRepository playerRepository;

    Player save( Player p ) {
        return playerRepository.save( p );
    }

    List<Player> get( Pageable pageable ) {
        return playerRepository.findAll( pageable ).getContent();
    }

    void delete( Long id ) {
        playerRepository.delete( id );
    }
}


text:
package io.apiman.gateway.engine.beans.exceptions;

/**
 * Exception thrown when attempting (but failing) to connect to a back end system.
 *
 * @author eric.wittmann@redhat.com
 */
public class ConnectorException extends AbstractEngineException {

    private static final long serialVersionUID = -3509254747425991797L;

    /**
     * Constructor.
     * @param message an error message
     */
    public ConnectorException(String message) {
        super(message);
    }

    /**
     * Constructor.
     * @param message an error message
     * @param cause the exception cause the root cause
     */
    public ConnectorException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * Constructor.
     * @param cause the exception cause the root cause
     */
    public ConnectorException(Throwable cause) {
        super(cause.getMessage(), cause);
    }

}


text:
import database from "../api/database";
import * as types from "../actions/ActionTypes"

const receiveAspects = aspects => ({
  type: types.GET_COMMON_ASPECTS,
  aspects
});

export const getCommonAspects = () => dispatch => {
  database.getCommonAspects(aspects => {
    dispatch(receiveAspects(aspects))
  })
};

export const loadAll = () => ({
  type: types.LOAD_ALL_ASPECTS
});


text:
include Opscode::Aws::Ec2

use_inline_resources

def whyrun_supported?
  true
end

action :associate do
  ip = new_resource.ip || node['aws']['elastic_ip'][new_resource.name]['ip']
  addr = address(ip)

  if addr.nil?
    raise "Elastic IP #{ip} does not exist"
  elsif addr[:instance_id] == instance_id
    Chef::Log.debug("Elastic IP #{ip} is already attached to the instance")
  else
    converge_by("attach Elastic IP #{ip} to the instance") do
      Chef::Log.info("Attaching Elastic IP #{ip} to the instance")
      attach(ip, new_resource.timeout)
      node.normal['aws']['elastic_ip'][new_resource.name]['ip'] = ip
      node.save unless Chef::Config[:solo]
    end
  end
end

action :disassociate do
  ip = new_resource.ip || node['aws']['elastic_ip'][new_resource.name]['ip']
  addr = address(ip)

  if addr.nil?
    Chef::Log.debug("Elastic IP #{ip} does not exist, so there is nothing to detach")
  elsif addr[:instance_id] != instance_id
    Chef::Log.debug("Elastic IP #{ip} is already detached from the instance")
  else
    converge_by("detach Elastic IP #{ip} from the instance") do
      Chef::Log.info("Detaching Elastic IP #{ip} from the instance")
      detach(ip, new_resource.timeout)
    end
  end
end

action :allocate do
  current_elastic_ip = node['aws']['elastic_ip'][new_resource.name]['ip']
  if current_elastic_ip
    Chef::Log.info("An Elastic IP was already allocated for #{new_resource.name} #{current_elastic_ip} from the instance")
  else
    converge_by("allocate new Elastic IP for #{new_resource.name}") do
      addr = ec2.allocate_address(domain: new_resource.domain)
      Chef::Log.info("Allocated Elastic IP #{addr[:public_ip]} from the instance")
      node.normal['aws']['elastic_ip'][new_resource.name]['ip'] = addr[:public_ip]
      node.save unless Chef::Config[:solo]
    end
  end
end

private

def address(ip)
  ec2.describe_addresses(public_ips: [ip]).addresses[0]
end

def attach(ip, timeout)
  addr = address(ip)
  if addr[:domain] == 'vpc'
    ec2.associate_address(instance_id: instance_id, allocation_id: addr[:allocation_id])
  else
    ec2.associate_address(instance_id: instance_id, public_ip: addr[:public_ip])
  end

  # block until attached
  begin
    Timeout.timeout(timeout) do
      loop do
        addr = address(ip)
        if addr.nil?
          raise 'Elastic IP has been deleted while waiting for attachment'
        elsif addr[:instance_id] == instance_id
          Chef::Log.debug('Elastic IP is attached to this instance')
          break
        else
          Chef::Log.debug("Elastic IP is currently attached to #{addr[:instance_id]}")
        end
        sleep 3
      end
    end
  rescue Timeout::Error
    raise "Timed out waiting for attachment after #{timeout} seconds"
  end
end

def detach(ip, timeout)
  addr = address(ip)
  if ip[:domain] == 'vpc'
    ec2.disassociate_address(allocation_ip: addr[:allocation_id])
  else
    ec2.disassociate_address(public_ip: ip)
  end

  # block until detached
  begin
    Timeout.timeout(timeout) do
      loop do
        addr = address(ip)
        if addr.nil?
          Chef::Log.debug('Elastic IP has been deleted while waiting for detachment')
        elsif addr[:instance_id] != instance_id
          Chef::Log.debug('Elastic IP is detached from this instance')
          break
        else
          Chef::Log.debug('Elastic IP is still attached')
        end
        sleep 3
      end
    end
  rescue Timeout::Error
    raise "Timed out waiting for detachment after #{timeout} seconds"
  end
end


text:
Electrical/Optical/Semiconductor
================================

*Worksteps from the electrical, electronics, and optics industry.*

The workstep should be assigned a `function`. See the sidebar to the left for a list of valid `function` values.

.. sidebar:: Variations

   There are additional attributes based on **function** :

     * ``other`` - :doc:`workstep.industry.elecopt.function.other`


text:
testrunner=./runtest.py
fix_pythonpath=export PYTHONPATH="`readlink -f '../src/'`:$$PYTHONPATH" &&

test:
	$(testrunner)

test_local:
	$(fix_pythonpath) $(testrunner)

coverage_run:
	$(fix_pythonpath) python -mcoverage run $(testrunner)

coverage_report:
	python -mcoverage report -m

coverage_erase:
	python -mcoverage erase

coverage: coverage_erase coverage_run coverage_report
	@echo "DONE"

.PHONY: test test_local coverage_report coverage_erase coverage


text:
namespace BLPipeGen {

// ============================================================================
// [BLPipeGen::CompOpPart]
// ============================================================================

//! Pipeline combine part.
class CompOpPart : public PipePart {
public:
  BL_NONCOPYABLE(CompOpPart)

  enum : uint32_t {
    kIndexDstPart = 0,
    kIndexSrcPart = 1
  };

  //! Composition operator.
  uint32_t _compOp;
  //! The current span mode.
  uint8_t _cMaskLoopType;
  //! Maximum pixels the compositor can handle at a time.
  uint8_t _maxPixels;
  //! Pixel granularity.
  uint8_t _pixelGranularity;
  //! Minimum alignment required to process `_maxPixels`.
  uint8_t _minAlignment;

  //! Whether the destination format has an alpha channel.
  uint8_t _hasDa : 1;
  //! Whether the source format has an alpha channel.
  uint8_t _hasSa : 1;

  //! A hook that is used by the current loop.
  asmjit::BaseNode* _cMaskLoopHook;
  //! Optimized solid pixel for operators that allow it.
  SolidPixelARGB _solidOpt;
  //! Pre-processed solid pixel for TypeA operators that always use `vMaskProc?()`.
  PixelARGB _solidPre;
  //! Partial fetch that happened at the end of the scanline (border case).
  PixelARGB _pixPartial;
  //! Const mask.
  BLWrap<PipeCMask> _mask;

  CompOpPart(PipeCompiler* pc, uint32_t compOp, FetchPart* dstPart, FetchPart* srcPart) noexcept;

  BL_INLINE FetchPart* dstPart() const noexcept { return reinterpret_cast<FetchPart*>(_children[kIndexDstPart]); }
  BL_INLINE FetchPart* srcPart() const noexcept { return reinterpret_cast<FetchPart*>(_children[kIndexSrcPart]); }

  //! Returns the composition operator id, see `BLCompOp`.
  BL_INLINE uint32_t compOp() const noexcept { return _compOp; }
  //! Returns the composition operator flags, see `BLCompOpFlags`.
  BL_INLINE uint32_t compOpFlags() const noexcept { return blCompOpInfo[_compOp].flags; }

  //! Tests whether the destination pixel format has an alpha channel.
  BL_INLINE bool hasDa() const noexcept { return _hasSa != 0; }
  //! Tests whether the source pixel format has an alpha channel.
  BL_INLINE bool hasSa() const noexcept { return _hasDa != 0; }

  //! Returns the current loop mode.
  BL_INLINE uint32_t cMaskLoopType() const noexcept { return _cMaskLoopType; }
  //! Tests whether the current loop is fully opaque (no mask).
  BL_INLINE bool isLoopOpaque() const noexcept { return _cMaskLoopType == kCMaskLoopTypeOpaque; }
  //! Tests whether the current loop is `CMask` (constant mask).
  BL_INLINE bool isLoopCMask() const noexcept { return _cMaskLoopType == kCMaskLoopTypeMask; }

  //! Returns the maximum pixels the composite part can handle at a time.
  //!
  //! \note This value is configured in a way that it's always one if the fetch
  //! part doesn't support more. This makes it easy to use in loop compilers.
  //! In other words, the value doesn't describe the real implementation of the
  //! composite part.
  BL_INLINE uint32_t maxPixels() const noexcept { return _maxPixels; }
  //! Returns the maximum pixels the children of this part can handle.
  BL_INLINE uint32_t maxPixelsOfChildren() const noexcept { return blMin(dstPart()->maxPixels(), srcPart()->maxPixels()); }

  //! Returns pixel granularity passed to `init()`, otherwise the result should be zero.
  BL_INLINE uint32_t pixelGranularity() const noexcept { return _pixelGranularity; }
  //! Returns the minimum destination alignment required to the maximum number of pixels `_maxPixels`.
  BL_INLINE uint32_t minAlignment() const noexcept { return _minAlignment; }

  BL_INLINE bool isUsingSolidPre() const noexcept { return !_solidPre.pc.empty() || !_solidPre.uc.empty(); }

  void init(x86::Gp& x, x86::Gp& y, uint32_t pixelGranularity) noexcept;
  void fini() noexcept;

  //! Tests whether the opaque fill should be optimized and placed into a separate
  //! loop.
  bool shouldOptimizeOpaqueFill() const noexcept;

  //! Tests whether the compositor should emit a specialized loop that contains
  //! an inlined version of `memcpy()` or `memset()`.
  bool shouldMemcpyOrMemsetOpaqueFill() const noexcept;

  void startAtX(x86::Gp& x) noexcept;
  void advanceX(x86::Gp& x, x86::Gp& diff) noexcept;
  void advanceY() noexcept;

  // These are just wrappers that call these on both source & destination parts.
  void prefetch1() noexcept;
  void enterN() noexcept;
  void leaveN() noexcept;
  void prefetchN() noexcept;
  void postfetchN() noexcept;

  void dstFetch32(PixelARGB& out, uint32_t flags, uint32_t n) noexcept;
  void srcFetch32(PixelARGB& out, uint32_t flags, uint32_t n) noexcept;

  BL_INLINE bool isInPartialMode() const noexcept {
    return !_pixPartial.pc.empty();
  }

  void enterPartialMode(uint32_t partialFlags = 0) noexcept;
  void exitPartialMode() noexcept;
  void nextPartialPixel() noexcept;

  void cMaskInit(x86::Gp& m) noexcept;
  void cMaskInit(const x86::Mem& pMsk) noexcept;
  void cMaskFini() noexcept;

  void cMaskGenericLoop(x86::Gp& i) noexcept;
  void cMaskGranularLoop(x86::Gp& i) noexcept;
  void cMaskMemcpyOrMemsetLoop(x86::Gp& i) noexcept;

  void _cMaskLoopInit(uint32_t loopType) noexcept;
  void _cMaskLoopFini() noexcept;

  void cMaskInitXmm(x86::Vec& m) noexcept;
  void cMaskFiniXmm() noexcept;

  void cMaskGenericLoopXmm(x86::Gp& i) noexcept;
  void cMaskGranularLoopXmm(x86::Gp& i) noexcept;

  void cMaskProc32Xmm1(PixelARGB& out, uint32_t flags) noexcept;
  void cMaskProc32Xmm4(PixelARGB& out, uint32_t flags) noexcept;
  void cMaskProc32Xmm8(PixelARGB& out, uint32_t flags) noexcept;
  void cMaskProc32XmmV(PixelARGB& out, uint32_t flags, uint32_t n) noexcept;

  void vMaskProc(PixelARGB& out, uint32_t flags, x86::Gp& m) noexcept;

  void vMaskProc32Xmm1(PixelARGB& out, uint32_t flags, VecArray& mv, bool mImmutable) noexcept;
  void vMaskProc32Xmm4(PixelARGB& out, uint32_t flags, VecArray& mv, bool mImmutable) noexcept;
  void vMaskProc32XmmV(PixelARGB& out, uint32_t flags, VecArray& mv, uint32_t n, bool mImmutable) noexcept;

  void vMaskProc32InvertMask(VecArray& mi, VecArray& mv) noexcept;
  void vMaskProc32InvertDone(VecArray& mi, bool mImmutable) noexcept;
};

} // {BLPipeGen}

//! \}
//! \endcond

#endif // BLEND2D_PIPEGEN_BLCOMPOPPART_P_H


text:
namespace blink {

class FontVariantEastAsianParser {
  STACK_ALLOCATED();

 public:
  FontVariantEastAsianParser()
      : east_asian_form_value_(nullptr),
        east_asian_width_value_(nullptr),
        ruby_value_(nullptr) {}

  enum class ParseResult { kConsumedValue, kDisallowedValue, kUnknownValue };

  ParseResult ConsumeEastAsian(CSSParserTokenRange& range) {
    CSSValueID value_id = range.Peek().Id();
    switch (value_id) {
      case CSSValueID::kJis78:
      case CSSValueID::kJis83:
      case CSSValueID::kJis90:
      case CSSValueID::kJis04:
      case CSSValueID::kSimplified:
      case CSSValueID::kTraditional:
        if (east_asian_form_value_)
          return ParseResult::kDisallowedValue;
        east_asian_form_value_ =
            css_property_parser_helpers::ConsumeIdent(range);
        return ParseResult::kConsumedValue;
      case CSSValueID::kFullWidth:
      case CSSValueID::kProportionalWidth:
        if (east_asian_width_value_)
          return ParseResult::kDisallowedValue;
        east_asian_width_value_ =
            css_property_parser_helpers::ConsumeIdent(range);
        return ParseResult::kConsumedValue;
      case CSSValueID::kRuby:
        if (ruby_value_)
          return ParseResult::kDisallowedValue;
        ruby_value_ = css_property_parser_helpers::ConsumeIdent(range);
        return ParseResult::kConsumedValue;
      default:
        return ParseResult::kUnknownValue;
    }
  }

  CSSValue* FinalizeValue() {
    CSSValueList* result = CSSValueList::CreateSpaceSeparated();
    if (east_asian_form_value_) {
      result->Append(*east_asian_form_value_);
      east_asian_form_value_ = nullptr;
    }
    if (east_asian_width_value_) {
      result->Append(*east_asian_width_value_);
      east_asian_width_value_ = nullptr;
    }
    if (ruby_value_) {
      result->Append(*ruby_value_);
      ruby_value_ = nullptr;
    }

    if (!result->length())
      return CSSIdentifierValue::Create(CSSValueID::kNormal);
    return result;
  }

 private:
  CSSIdentifierValue* east_asian_form_value_;
  CSSIdentifierValue* east_asian_width_value_;
  CSSIdentifierValue* ruby_value_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_FONT_VARIANT_EAST_ASIAN_PARSER_H_


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace EP.SignalRSelfHost.Server.WindowsService
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {

            // Não é necessário instalar o Windows Service para testes!
            // Bastar setar a solution em modo Debug
            // E configurar os dois projetos para inicializarem juntos

#if (!DEBUG)
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new Broadcast()
            };
            ServiceBase.Run(ServicesToRun);
#else
            var service = new Broadcast();
            // Chamada do seu método para Debug.
            service.InitializeSelfHosting();
            // Coloque sempre um breakpoint para o ponto de parada do seu código.
            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#endif

        }
    }
}


text:
from lib.common import helpers

class Module:

    def __init__(self, mainMenu, params=[]):

        self.info = {
            'Name': 'Get-RickAstley',

            'Author': ['@SadProcessor', '@harmj0y'],

            'Description': ("Runs @SadProcessor's beeping rickroll."),

            'Background' : True,

            'OutputExtension' : None,

            'NeedsAdmin' : False,

            'OpsecSafe' : False,

            'Language' : 'powershell',

            'MinLanguageVersion' : '2',

            'Comments': [
                "https://gist.github.com/SadProcessor/3e413f9542b01ee90979"
            ]
        }

        # any options needed by the module, settable during runtime
        self.options = {
            # format:
            #   value_name : {description, required, default_value}
            'Agent' : {
                'Description'   :   'Agent to run module on.',
                'Required'      :   True,
                'Value'         :   ''
            }
        }

        # save off a copy of the mainMenu object to access external functionality
        #   like listeners/agent handlers/etc.
        self.mainMenu = mainMenu

        for param in params:
            # parameter format is [Name, Value]
            option, value = param
            if option in self.options:
                self.options[option]['Value'] = value

    def generate(self):

        moduleName = self.info["Name"]

        # read in the common powerup.ps1 module source code
        moduleSource = self.mainMenu.installPath + "/data/module_source/trollsploit/Get-RickAstley.ps1"

        try:
            f = open(moduleSource, 'r')
        except:
            print helpers.color("[!] Could not read module source path at: " + str(moduleSource))
            return ""

        script = f.read()
        f.close()

        script += moduleName + " "

        script += ' | Out-String | %{$_ + \"`n\"};"`n'+str(moduleName)+' completed!"'

        return script


text:
<?php

namespace Doctrine\MongoDB\Tests\Query;

use Doctrine\MongoDB\Query\Expr;

class ExprTest extends \PHPUnit_Framework_TestCase
{
    public function testAddManyToSet()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->field('a')->addManyToSet(array(1, 2)));
        $this->assertEquals(array('$addToSet' => array('a' => array('$each' => array(1, 2)))), $expr->getNewObj());
    }

    public function testAddToSetWithValue()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->field('a')->addToSet(1));
        $this->assertEquals(array('$addToSet' => array('a' => 1)), $expr->getNewObj());
    }

    public function testAddToSetWithExpression()
    {
        $expr = new Expr();
        $eachExpr = new Expr();
        $eachExpr->each(array(1, 2));

        $this->assertSame($expr, $expr->field('a')->addToSet($eachExpr));
        $this->assertEquals(array('$addToSet' => array('a' => array('$each' => array(1, 2)))), $expr->getNewObj());
    }

    public function testOperatorWithCurrentField()
    {
        $expr = new Expr();
        $expr->field('field');

        $this->assertSame($expr, $expr->operator('$op', 'value'));
        $this->assertEquals(array('field' => array('$op' => 'value')), $expr->getQuery());
    }

    public function testOperatorWithoutCurrentField()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->operator('$op', 'value'));
        $this->assertEquals(array('$op' => 'value'), $expr->getQuery());
    }

    /**
     * @dataProvider provideGeoJsonPoint
     */
    public function testMaxDistanceWithNearAndGeoJsonPoint($point, array $expected)
    {
        $expr = new Expr();
        $expr->near($point);

        $this->assertSame($expr, $expr->maxDistance(1));
        $this->assertEquals(array('$near' => $expected + array('$maxDistance' => 1)), $expr->getQuery());
    }

    public function provideGeoJsonPoint()
    {
        $json = array('type' => 'Point', 'coordinates' => array(1, 2));
        $expected = array('$geometry' => $json);

        return array(
            'array' => array($json, $expected),
            'object' => array($this->getMockPoint($json), $expected),
        );
    }

    public function testMaxDistanceWithNearAndLegacyCoordinates()
    {
        $expr = new Expr();
        $expr->near(1, 2);

        $this->assertSame($expr, $expr->maxDistance(1));
        $this->assertEquals(array('$near' => array(1, 2), '$maxDistance' => 1), $expr->getQuery());
    }

    public function testMaxDistanceWithNearSphereAndGeoJsonPoint()
    {
        $json = array('type' => 'Point', 'coordinates' => array(1, 2));

        $expr = new Expr();
        $expr->nearSphere($this->getMockPoint($json));

        $this->assertSame($expr, $expr->maxDistance(1));
        $this->assertEquals(array('$nearSphere' => array('$geometry' => $json, '$maxDistance' => 1)), $expr->getQuery());
    }

    public function testMaxDistanceWithNearSphereAndLegacyCoordinates()
    {
        $expr = new Expr();
        $expr->nearSphere(1, 2);

        $this->assertSame($expr, $expr->maxDistance(1));
        $this->assertEquals(array('$nearSphere' => array(1, 2), '$maxDistance' => 1), $expr->getQuery());
    }

    /**
     * @expectedException BadMethodCallException
     */
    public function testMaxDistanceRequiresNearOrNearSphereOperator()
    {
        $expr = new Expr();
        $expr->maxDistance(1);
    }

    /**
     * @dataProvider provideGeoJsonPoint
     */
    public function testMinDistanceWithNearAndGeoJsonPoint($point, array $expected)
    {
        $expr = new Expr();
        $expr->near($point);

        $this->assertSame($expr, $expr->minDistance(1));
        $this->assertEquals(array('$near' => $expected + array('$minDistance' => 1)), $expr->getQuery());
    }

    public function testMinDistanceWithNearAndLegacyCoordinates()
    {
        $expr = new Expr();
        $expr->near(1, 2);

        $this->assertSame($expr, $expr->minDistance(1));
        $this->assertEquals(array('$near' => array(1, 2), '$minDistance' => 1), $expr->getQuery());
    }

    public function testMinDistanceWithNearSphereAndGeoJsonPoint()
    {
        $json = array('type' => 'Point', 'coordinates' => array(1, 2));

        $expr = new Expr();
        $expr->nearSphere($this->getMockPoint($json));

        $this->assertSame($expr, $expr->minDistance(1));
        $this->assertEquals(array('$nearSphere' => array('$geometry' => $json, '$minDistance' => 1)), $expr->getQuery());
    }

    public function testMinDistanceWithNearSphereAndLegacyCoordinates()
    {
        $expr = new Expr();
        $expr->nearSphere(1, 2);

        $this->assertSame($expr, $expr->minDistance(1));
        $this->assertEquals(array('$nearSphere' => array(1, 2), '$minDistance' => 1), $expr->getQuery());
    }

    /**
     * @expectedException BadMethodCallException
     */
    public function testMinDistanceRequiresNearOrNearSphereOperator()
    {
        $expr = new Expr();
        $expr->minDistance(1);
    }

    /**
     * @dataProvider provideGeoJsonPoint
     */
    public function testNearWithGeoJsonPoint($point, array $expected)
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->near($point));
        $this->assertEquals(array('$near' => $expected), $expr->getQuery());
    }

    public function testNearWithLegacyCoordinates()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->near(1, 2));
        $this->assertEquals(array('$near' => array(1, 2)), $expr->getQuery());
    }

    /**
     * @dataProvider provideGeoJsonPoint
     */
    public function testNearSphereWithGeoJsonPoint($point, array $expected)
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->nearSphere($point));
        $this->assertEquals(array('$nearSphere' => $expected), $expr->getQuery());
    }

    public function testNearSphereWithLegacyCoordinates()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->nearSphere(1, 2));
        $this->assertEquals(array('$nearSphere' => array(1, 2)), $expr->getQuery());
    }

    public function testPullWithValue()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->field('a')->pull(1));
        $this->assertEquals(array('$pull' => array('a' => 1)), $expr->getNewObj());
    }

    public function testPullWithExpression()
    {
        $expr = new Expr();
        $nestedExpr = new Expr();
        $nestedExpr->gt(3);

        $this->assertSame($expr, $expr->field('a')->pull($nestedExpr));
        $this->assertEquals(array('$pull' => array('a' => array('$gt' => 3))), $expr->getNewObj());
    }

    public function testPushWithValue()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->field('a')->push(1));
        $this->assertEquals(array('$push' => array('a' => 1)), $expr->getNewObj());
    }

    public function testPushWithExpression()
    {
        $expr = new Expr();
        $innerExpr = new Expr();
        $innerExpr
            ->each(array(array('x' => 1), array('x' => 2)))
            ->slice(-2)
            ->sort('x', 1);

        $expectedNewObj = array(
            '$push' => array('a' => array(
                '$each' => array(array('x' => 1), array('x' => 2)),
                '$slice' => -2,
                '$sort' => array('x' => 1),
            )),
        );

        $this->assertSame($expr, $expr->field('a')->push($innerExpr));
        $this->assertEquals($expectedNewObj, $expr->getNewObj());
    }

    public function testPushWithExpressionShouldEnsureEachOperatorAppearsFirst()
    {
        $expr = new Expr();
        $innerExpr = new Expr();
        $innerExpr
            ->sort('x', 1)
            ->slice(-2)
            ->each(array(array('x' => 1), array('x' => 2)));

        $expectedNewObj = array(
            '$push' => array('a' => array(
                '$each' => array(array('x' => 1), array('x' => 2)),
                '$sort' => array('x' => 1),
                '$slice' => -2,
            )),
        );

        $this->assertSame($expr, $expr->field('a')->push($innerExpr));
        $this->assertSame($expectedNewObj, $expr->getNewObj());
    }

    /**
     * @dataProvider provideGeoJsonPolygon
     */
    public function testGeoIntersects($geometry, array $expected)
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->geoIntersects($geometry));
        $this->assertEquals(array('$geoIntersects' => $expected), $expr->getQuery());
    }

    public function provideGeoJsonPolygon()
    {
        $json = array(
            'type' => 'Polygon',
            'coordinates' => array(array(array(0, 0), array(1, 1), array(1, 0), array(0, 0))),
        );

        $expected = array('$geometry' => $json);

        return array(
            'array' => array($json, $expected),
            'object' => array($this->getMockPolygon($json), $expected),
        );
    }

    /**
     * @dataProvider provideGeoJsonPolygon
     */
    public function testGeoWithin($geometry, array $expected)
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->geoWithin($geometry));
        $this->assertEquals(array('$geoWithin' => $expected), $expr->getQuery());
    }

    public function testGeoWithinBox()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->geoWithinBox(1, 2, 3, 4));
        $this->assertEquals(array('$geoWithin' => array('$box' => array(array(1, 2), array(3, 4)))), $expr->getQuery());
    }

    public function testGeoWithinCenter()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->geoWithinCenter(1, 2, 3));
        $this->assertEquals(array('$geoWithin' => array('$center' => array(array(1, 2), 3))), $expr->getQuery());
    }

    public function testGeoWithinCenterSphere()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->geoWithinCenterSphere(1, 2, 3));
        $this->assertEquals(array('$geoWithin' => array('$centerSphere' => array(array(1, 2), 3))), $expr->getQuery());
    }

    public function testGeoWithinPolygon()
    {
        $expr = new Expr();
        $expectedQuery = array('$geoWithin' => array('$polygon' => array(array(0, 0), array(1, 1), array(1, 0))));

        $this->assertSame($expr, $expr->geoWithinPolygon(array(0, 0), array(1, 1), array(1, 0)));
        $this->assertEquals($expectedQuery, $expr->getQuery());
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testGeoWithinPolygonRequiresAtLeastThreePoints()
    {
        $expr = new Expr();
        $expr->geoWithinPolygon(array(0, 0), array(1, 1));
    }

    public function testSetWithAtomic()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->field('a')->set(1, true));
        $this->assertEquals(array('$set' => array('a' => 1)), $expr->getNewObj());
    }

    public function testSetWithoutAtomicWithTopLevelField()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->field('a')->set(1, false));
        $this->assertEquals(array('a' => 1), $expr->getNewObj());
    }

    public function testSetWithoutAtomicWithNestedField()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->field('a.b.c')->set(1, false));
        $this->assertEquals(array('a' => array('b' => array('c' => 1))), $expr->getNewObj());
    }

    public function testWhere()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->where('javascript'));
        $this->assertEquals(array('$where' => 'javascript'), $expr->getQuery());
        $this->assertNull($expr->getCurrentField());
    }

    public function testWithinBox()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->withinBox(1, 2, 3, 4));
        $this->assertEquals(array('$within' => array('$box' => array(array(1, 2), array(3, 4)))), $expr->getQuery());
    }

    public function testWithinCenter()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->withinCenter(1, 2, 3));
        $this->assertEquals(array('$within' => array('$center' => array(array(1, 2), 3))), $expr->getQuery());
    }

    public function testWithinCenterSphere()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->withinCenterSphere(1, 2, 3));
        $this->assertEquals(array('$within' => array('$centerSphere' => array(array(1, 2), 3))), $expr->getQuery());
    }

    public function testWithinPolygon()
    {
        $expr = new Expr();
        $expectedQuery = array('$within' => array('$polygon' => array(array(0, 0), array(1, 1), array(1, 0))));

        $this->assertSame($expr, $expr->withinPolygon(array(0, 0), array(1, 1), array(1, 0)));
        $this->assertEquals($expectedQuery, $expr->getQuery());
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testWithinPolygonRequiresAtLeastThreePoints()
    {
        $expr = new Expr();
        $expr->withinPolygon(array(0, 0), array(1, 1));
    }

    private function getMockPoint($json)
    {
        $point = $this->getMockBuilder('GeoJson\Geometry\Point')
            ->disableOriginalConstructor()
            ->getMock();

        $point->expects($this->once())
            ->method('jsonSerialize')
            ->will($this->returnValue($json));

        return $point;
    }

    private function getMockPolygon($json)
    {
        $point = $this->getMockBuilder('GeoJson\Geometry\Polygon')
            ->disableOriginalConstructor()
            ->getMock();

        $point->expects($this->once())
            ->method('jsonSerialize')
            ->will($this->returnValue($json));

        return $point;
    }

    public function testIn()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->in(array('value1', 'value2')));
        $this->assertEquals(array('$in' => array('value1', 'value2')), $expr->getQuery());
    }

    public function testInWillStripKeysToYieldBsonArray()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->in(array(1 => 'value1', 'some' => 'value2')));
        $this->assertEquals(array('$in' => array('value1', 'value2')), $expr->getQuery());
    }

    public function testNotIn()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->notIn(array('value1', 'value2')));
        $this->assertEquals(array('$nin' => array('value1', 'value2')), $expr->getQuery());
    }

    public function testNotInWillStripKeysToYieldBsonArray()
    {
        $expr = new Expr();

        $this->assertSame($expr, $expr->notIn(array(1 => 'value1', 'some' => 'value2')));
        $this->assertEquals(array('$nin' => array('value1', 'value2')), $expr->getQuery());
    }
}


text:
<?php

namespace R4F\Bundle\RunnerBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * MessageRepository
 */
class MessageRepository extends EntityRepository
{
}


text:
using namespace std;

void permute( const string &str );
void permute( const string &str, int low, int high );

void permute( const string &str, int low, int high)
{
  string newstring = str;
  if ( low == high ) {
    for (int i = 0; i <= high; ++i)
      cout << newstring[i];
    cout << endl;
  }
  else {
    for (int i=low; i<high; ++i) {
      string tmp = newstring;
      swap( newstring[i], newstring[low] );
      permute( newstring, low + 1, high );
      swap( newstring[i], newstring[low] );
    }
  }
}

void permute( const string &str ) {
  int low = 0;
  int high = str.size();
  permute(str, low, high);
}

int main() {
  string str;
  cout << "Enter a string: ";
  cin >> str;
  permute(str);
  return 0;
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>dead.of.night.studios</groupId>
  <artifactId>hostnow</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <parent>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-parent</artifactId>
       <version>1.3.5.RELEASE</version>
  </parent>

  <name>hostnow</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
  	<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
	  <groupId>org.springframework.boot</groupId>
	  <artifactId>spring-boot-starter-security</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.security.oauth</groupId>
		<artifactId>spring-security-oauth2</artifactId>
	</dependency>
  </dependencies>

  <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>


text:
<?php echo validation_errors('
', '
'); ?>
<?php foreach ($errors as $error): ?>

<?php echo $error; ?>

<?php endforeach; ?>
<?php echo form_open('install/step4',array('class' => 'form-horizontal')); ?>

        <?=trans('FirstName',DEF_LANG)?>:*

         	<?php echo form_input(array('name' => 'first_name', 'id' => 'first_name', 'value' => set_value('first_name'))); ?>

        <?=trans('LastName',DEF_LANG)?>:*

         	<?php echo form_input(array('name' => 'last_name', 'id' => 'last_name', 'value' => set_value('last_name'))); ?>

        <?=trans('Username',DEF_LANG)?>:*

         	<?php echo form_input(array('name' => 'username', 'id' => 'username', 'value' => set_value('username','admin'))); ?>

        <?=trans('Email',DEF_LANG)?>:*

         	<?php echo form_input(array('name' => 'email', 'id' => 'email', 'value' => set_value('email'))); ?>

        <?=trans('Password',DEF_LANG)?>:*

         	<?php echo form_password(array('name' => 'admin_password', 'id' => 'admin_password')); ?>

        <?=trans('ConfirmPassword',DEF_LANG)?>:*

         	<?php echo form_password(array('name' => 'confirm_admin_password', 'id' => 'confirm_admin_password')); ?>

		<input type="submit" name="submit" class="btn save" value="<?=trans('NextStep',DEF_LANG)?>" />

<?php echo form_close(); ?>


text:
require 'addressable/uri'
require 'addressable/template'
require 'google/apis/options'
require 'google/apis/errors'
require 'retriable'
require 'hurley'
require 'hurley/addressable'
require 'google/apis/core/logging'
require 'pp'

module Google
  module Apis
    module Core
      # Command for HTTP request/response.
      class HttpCommand
        include Logging

        RETRIABLE_ERRORS = [Google::Apis::ServerError, Google::Apis::RateLimitError, Google::Apis::TransmissionError]

        # Request options
        # @return [Google::Apis::RequestOptions]
        attr_accessor :options

        # HTTP request URL
        # @return [String, Addressable::URI]
        attr_accessor :url

        # HTTP headers
        # @return [Hurley::Header]
        attr_accessor :header

        # Request body
        # @return [#read]
        attr_accessor :body

        # HTTP method
        # @return [symbol]
        attr_accessor :method

        # HTTP Client
        # @return [Hurley::Client]
        attr_accessor :connection

        # Query params
        # @return [Hash]
        attr_accessor :query

        # Path params for URL Template
        # @return [Hash]
        attr_accessor :params

        # @param [symbol] method
        #   HTTP method
        # @param [String,Addressable::URI, Addressable::Template] url
        #   HTTP URL or template
        # @param [String, #read] body
        #   Request body
        def initialize(method, url, body: nil)
          self.options = Google::Apis::RequestOptions.default.dup
          self.url = url
          self.url = Addressable::Template.new(url) if url.is_a?(String)
          self.method = method
          self.header = Hurley::Header.new
          self.body = body
          self.query = {}
          self.params = {}
        end

        # Execute the command, retrying as necessary
        #
        # @param [Hurley::Client] client
        #   HTTP client
        # @yield [result, err] Result or error if block supplied
        # @return [Object]
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def execute(client)
          prepare!
          proc = block_given? ? Proc.new : nil
          begin
            Retriable.retriable tries: options.retries + 1,
                                base_interval: 1,
                                multiplier: 2,
                                on: RETRIABLE_ERRORS do |try|
              # This 2nd level retriable only catches auth errors, and supports 1 retry, which allows
              # auth to be re-attempted without having to retry all sorts of other failures like
              # NotFound, etc
              auth_tries = (try == 1 && authorization_refreshable? ? 2 : 1)
              Retriable.retriable tries: auth_tries,
                                  on: [Google::Apis::AuthorizationError],
                                  on_retry: proc { |*| refresh_authorization } do
                return execute_once(client, &proc)
              end
            end
          rescue => e
            raise e if proc.nil?
          end
        ensure
          release!
        end

        # Refresh the authorization authorization after a 401 error
        #
        # @private
        # @return [void]
        def refresh_authorization
          # Handled implicitly by auth lib, here in case need to override
          logger.debug('Retrying after authentication failure')
        end

        # Check if attached credentials can be automatically refreshed
        # @return [Boolean]
        def authorization_refreshable?
          options.authorization.respond_to?(:apply!)
        end

        # Prepare the request (e.g. calculate headers, serialize data, etc) before sending
        #
        # @private
        # @return [void]
        def prepare!
          header.update(options.header) if options && options.header
          self.url = url.expand(params) if url.is_a?(Addressable::Template)
          url.query_values = query
        end

        # Release any resources used by this command
        # @private
        # @return [void]
        def release!
        end

        # Check the response and either decode body or raise error
        #
        # @param [Fixnum] status
        #   HTTP status code of response
        # @param [Hurley::Header] header
        #   Response headers
        # @param [String, #read] body
        #  Response body
        # @return [Object]
        #   Response object
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def process_response(status, header, body)
          check_status(status, header, body)
          decode_response_body(header[:content_type], body)
        end

        # Check the response and raise error if needed
        #
        # @param [Fixnum] status
        #   HTTP status code of response
        # @param
        # @param [Hurley::Header] header
        #   HTTP response headers
        # @param [String] body
        #   HTTP response body
        # @param [String] message
        #   Error message text
        # @return [void]
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def check_status(status, header = nil, body = nil, message = nil)
          # TODO: 304 Not Modified depends on context...
          case status
          when 200...300
            nil
          when 301, 302, 303, 307
            message ||= sprintf('Redirect to %s', header[:location])
            raise Google::Apis::RedirectError.new(message, status_code: status, header: header, body: body)
          when 401
            message ||= 'Unauthorized'
            raise Google::Apis::AuthorizationError.new(message, status_code: status, header: header, body: body)
          when 304, 400, 402...500
            message ||= 'Invalid request'
            raise Google::Apis::ClientError.new(message, status_code: status, header: header, body: body)
          when 500...600
            message ||= 'Server error'
            raise Google::Apis::ServerError.new(message, status_code: status, header: header, body: body)
          else
            logger.warn(sprintf('Encountered unexpected status code %s', status))
            message ||= 'Unknown error'
            raise Google::Apis::TransmissionError.new(message, status_code: status, header: header, body: body)
          end
        end

        # Process the actual response body. Intended to be overridden by subclasses
        #
        # @param [String] _content_type
        #  Content type of body
        # @param [String, #read] body
        #  Response body
        # @return [Object]
        def decode_response_body(_content_type, body)
          body
        end

        # Process a success response
        # @param [Object] result
        #  Result object
        # @return [Object] result if no block given
        # @yield [result, nil] if block given
        def success(result, &block)
          logger.debug { sprintf('Success - %s', PP.pp(result, '')) }
          block.call(result, nil) if block_given?
          result
        end

        # Process an error response
        # @param [StandardError] err
        #  Error object
        # @param [Boolean] rethrow
        #  True if error should be raised again after handling
        # @return [void]
        # @yield [nil, err] if block given
        # @raise [StandardError] if no block
        def error(err, rethrow: false, &block)
          logger.debug { sprintf('Error - %s', PP.pp(err, '')) }
          err = Google::Apis::TransmissionError.new(err) if err.is_a?(Hurley::ClientError)
          block.call(nil, err) if block_given?
          fail err if rethrow || block.nil?
        end

        # Execute the command once.
        #
        # @private
        # @param [Hurley::Client] client
        #   HTTP client
        # @yield [result, err] Result or error if block supplied
        # @return [Object]
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def execute_once(client, &block)
          body.rewind if body.respond_to?(:rewind)
          begin
            logger.debug { sprintf('Sending HTTP %s %s', method, url) }
            response = client.send(method, url, body) do |req|
              # Temporary workaround for Hurley bug where the connection preference
              # is ignored and it uses nested anyway
              req.url.query_class = Hurley::Query::Flat
              query.each { | k, v| req.url.query[k] = v }
              # End workaround
              apply_request_options(req)
            end
            logger.debug { response.status_code }
            logger.debug { response.inspect }
            response = process_response(response.status_code, response.header, response.body)
            success(response, &block)
          rescue => e
            logger.debug { sprintf('Caught error %s', e) }
            error(e, rethrow: true, &block)
          end
        end

        # Update the request with any specified options.
        # @param [Hurley::Request] req
        #  HTTP request
        # @return [void]
        def apply_request_options(req)
          if options.authorization.respond_to?(:apply!)
            options.authorization.apply!(req.header)
          elsif options.authorization.is_a?(String)
            req.header[:authorization] = sprintf('Bearer %s', options.authorization)
          end
          req.header.update(header)
          req.options.timeout = options.timeout_sec
        end
      end
    end
  end
end


text:
function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,' ');
	}
}

function $(id) { return document.getElementById(id); }
function _(name) { return chrome.i18n.getMessage(name); }

var prefs = null;
var needsUpdate = true;

var insertRow = function(dst, domainPair)
{
  var table = dst;
  var compartmentTable = null;
  var prefDictionary = null;
  var compartmentDictionary = null;
  var anchorTitle = "";

  switch (dst.id) {
    case 'domain_filter_table':
      prefDictionary = 'domainFilter';
      compartmentDictionary = 'domainExceptions';
      compartmentTable = document.getElementById('domain_exceptions_table');
      anchorTitle = 'Exclude domains. Moves highlighted domain pair to Exceptions list.';
      break;
    case 'domain_exceptions_table':
      prefDictionary = 'domainExceptions';
      compartmentDictionary = 'domainFilter';
      compartmentTable = document.getElementById('domain_filter_table');
      anchorTitle = 'Enable domains. Moves highlighted domain pair to The Filter list.'
      break;
  }

  var tbody = table.getElementsByTagName('tbody').length ? table.getElementsByTagName('tbody')[0] : undefined;
  if (tbody == undefined) {
    tbody = document.createElement('tbody');
    table.appendChild(tbody);
  }

  var newRow = tbody.insertRow(-1);
  newRow.onmouseover = function() { addClass(this, 'highlight'); };
  newRow.onmouseout = function() { removeClass(this, 'highlight'); };
  if (tbody.children.length % 2 == 0) { // even row
    addClass(newRow, 'uncensor-even-row');
  }

  var oCell = newRow.insertCell(-1);
  oCell.innerHTML = "<img src='images/web.png' width='16' height='16' alt='' />";
  oCell.vAlign = "middle";
  oCell.style.width = "20px";

  oCell = newRow.insertCell(-1);
  oCell.innerHTML = domainPair.originalDomain;
  oCell.style.width = "50%";

  oCell = newRow.insertCell(-1);
  oCell.innerHTML = domainPair.newLocation;
  oCell.style.width = "50%";

  anchor = document.createElement('a');
  anchor.href = "#";
  anchor.className = "delete-icon";
  anchor.title = anchorTitle;
  anchor.domainPair = domainPair;
  icon = document.createElement('img');
  icon.src = "images/delete.png";
  icon.vAlign = "middle";
  icon.width = "16";
  icon.height = "16";
  anchor.appendChild(icon);

  anchor.onclick = function() {
    var row;
    var rowIndex = 0;
    // Search current row index
    for ( ; rowIndex < tbody.getElementsByTagName('tr').length; rowIndex++) {
      row = tbody.getElementsByTagName('tr')[rowIndex];
      rowCells = row.getElementsByTagName('td');
      if (rowCells.length != 3)
        return;
      if (rowCells[1].innerHTML == this.domainPair.originalDomain)
        break;
    }

    insertRow(compartmentTable, this.domainPair);
    tbody.deleteRow(rowIndex);

    var prefs = JSON.parse(localStorage.prefs);

    prefs[compartmentDictionary][this.domainPair.originalDomain] = this.domainPair.newLocation;
    if (prefDictionary != 'domainFilter')
        delete prefs[prefDictionary][this.domainPair.originalDomain];

    localStorage.prefs = JSON.stringify(prefs);

    return false;
  };

  oCell.appendChild(anchor);
};

var save = function() {
  var prefs = JSON.parse(localStorage.prefs);
  prefs.shouldRedirect = document.getElementById('uncensor_always_redirect').checked;
  prefs.showMessage = document.getElementById('uncensor_show_message').checked;
  prefs.notifyUpdate = document.getElementById('uncensor_notify_update').checked;
  localStorage.prefs = JSON.stringify(prefs);
};

// Make sure the checkbox checked state gets properly initialized from the
// saved preference.
var initUncensorOptions = function(prefs) {
  if (prefs.shouldRedirect) {
    document.getElementById('uncensor_always_redirect').checked = true;
    document.getElementById('uncensor_never_redirect').checked = false;
  }
  else {
    document.getElementById('uncensor_always_redirect').checked = false;
    document.getElementById('uncensor_never_redirect').checked = true;
  }

  document.getElementById('uncensor_show_message').checked = prefs.showMessage;
  document.getElementById('uncensor_notify_update').checked = prefs.notifyUpdate;
  var filterTable = document.getElementById("domain_filter_table");
  for (var originalDomain in prefs.domainFilter) {
    if (!(originalDomain in prefs.domainExceptions)) {
      this.insertRow(filterTable, { originalDomain: originalDomain,
                            newLocation: prefs.domainFilter[originalDomain] });
    }
  }
  var exceptionsTable = document.getElementById("domain_exceptions_table");
  for (var originalDomain in prefs.domainExceptions) {
    this.insertRow(exceptionsTable, { originalDomain: originalDomain,
                          newLocation: prefs.domainExceptions[originalDomain] });
  }

  document.getElementById('uncensor_always_redirect').onclick = save;
  document.getElementById('uncensor_never_redirect').onclick = save;
  document.getElementById('uncensor_show_message').onchange = save;
  document.getElementById('uncensor_notify_update').onchange = save;
};

var updateTables = function() {
  var prefs = JSON.parse(localStorage.prefs);

  fillTable = function(data) {
    var table = (data == prefs.domainFilter) ? document.getElementById('domain_filter_table') :
                                            document.getElementById('domain_exceptions_table');
    var tbody = table.getElementsByTagName('tbody').length ? table.getElementsByTagName('tbody')[0] : undefined;
    if (tbody == undefined) {
      tbody = document.createElement('tbody');
      table.appendChild(tbody);
    }

    if (tbody.hasChildNodes()) {
      while (tbody.childNodes.length >= 1) {
        tbody.removeChild( tbody.firstChild );
      }
    }

    for (var originalDomain in data) {
      if (data == prefs.domainExceptions || !(originalDomain in prefs.domainExceptions)) {
        insertRow(table, { originalDomain: originalDomain,
                              newLocation: data[originalDomain] });
      }
    }
  };

  fillTable(prefs.domainFilter);
  fillTable(prefs.domainExceptions);
};

var updatePageControlStates_ = function(e) {
  if (e.key == "prefs" && e.newValue != "") {
    var prefs = JSON.parse(e.newValue);

    initUncensorOptions(prefs);
    updateTables();
  }
};

document.title = _("optionsTitle");
document.addEventListener('storage', updatePageControlStates_, false);
window.addEventListener('load', function() {
  $('uncensorPageHeader').innerText               = _('extName');
  $('uncensorPageDescription').innerText          = _('extDesc');
  $('uncensorFilterControl').innerText            = _('filterControl');
  $('uncensorAlwaysRedirectOn').innerText         = _('alwaysRedirect');
  $('uncensorNeverRedirectOff').innerText         = _('neverRedirect');
  $('uncensorNotices').innerText                  = _('notices');
  $('uncensorShowMessage').innerText              = _('showMessage');
  $('uncensorNotifyUpdates').innerText            = _('notifyUpdates');
  $('uncensorOriginalDomain').innerText           = _('originalDomain');
  $('uncensorOriginalDomainExceptions').innerText = _('originalDomain');
  $('uncensorNewLocation').innerText              = _('newLocation');
  $('uncensorNewLocationExceptions').innerText    = _('newLocation');
  $('uncensorExceptions').innerText               = _('exceptions');

  updatePageControlStates_({key: 'prefs', newValue: localStorage.prefs ? localStorage.prefs : ''});

  $('navToSettings').addEventListener('click', function(e) {
    chrome.tabs.update(null, { url: 'chrome://settings' });
    e.preventDefault();
  });
}, false);


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>TransactionBuilder (Neo4j Community 2.0.0-M03 API)</title>
<meta name="date" content="2013-05-28">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Neo4j Community

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.neo4j.kernel

Interface TransactionBuilder

public interface TransactionBuilder

A builder for controlling certain behaviors of a transaction.
 Methods that return TransactionBuilder returns a new instance
 with the updated configuration that the method call modified.
 When the behavior is as desired a call to begin() will
 begin the transaction and return a Transaction.

 // To begin a transaction with default behavior
 Transaction tx = graphDb.tx().begin();

 // To begin a transaction with relaxed force
 Transaction tx = graphDb.tx().unforced().begin();

 // To have relaxed force optionally set by a condition
 TransactionBuilder txBuilder = graphDb.tx();
 if ( condition )
 {
     txBuilder = txBuilder.unforced();
 }
 Transaction tx = txBuilder.begin();

Author:

Mattias Persson

Method Summary

Methods

Modifier and Type
Method and Description

Transaction
begin()

Starts a new transaction and associates it with the current thread.

TransactionBuilder
unforced()

Relaxes the forcing constraint of the logical logs for this transaction
 so that the data is written out, but not forced to disk.

Method Detail

begin

Transaction begin()

Starts a new transaction and associates it with the current thread.

Returns:

a new transaction instance

unforced

TransactionBuilder unforced()

Relaxes the forcing constraint of the logical logs for this transaction
 so that the data is written out, but not forced to disk.

 Pros

The overhead of committing a transaction is lowered due to the removal
 of the force, i.e. I/O waiting for the disk to actually write the bytes down.
 The smaller the transaction the bigger percentage of it is spent forcing
 the logical logs to disk, so small transactions get most benefit from
 being unforced.

 Cons

Since there's no guarantee that the data is actually written down to disk
 the data provided in this transaction could be lost in the event of power failure
 or similar. It is however guaranteed that the data that has been written to disk
 is consistent so the worst case scenario for unforced transactions is that a couple
 of seconds (depending on write load) worth of data might be lost in an event of
 power failure, but the database will still get back to a consistent state after
 a recovery.

Returns:

a TransactionBuilder instance with relaxed force set.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Neo4j Community

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.


text:
package org.uma.jmetal.problem.multiobjective;

import org.uma.jmetal.problem.doubleproblem.impl.AbstractDoubleProblem;
import org.uma.jmetal.solution.doublesolution.DoubleSolution;

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

/**
 * Class representing problem Kursawe
 */
@SuppressWarnings("serial")
public class Kursawe extends AbstractDoubleProblem {

  /**
   * Constructor.
   * Creates a default instance (3 variables) of the Kursawe problem
   */
  public Kursawe() {
    this(3);
  }

  /**
   * Constructor.
   * Creates a new instance of the Kursawe problem.
   *
   * @param numberOfVariables Number of variables of the problem
   */
  public Kursawe(Integer numberOfVariables) {
    setNumberOfVariables(numberOfVariables);
    setNumberOfObjectives(2);
    setName("Kursawe");

    List<Double> lowerLimit = new ArrayList<>(getNumberOfVariables()) ;
    List<Double> upperLimit = new ArrayList<>(getNumberOfVariables()) ;

    for (int i = 0; i < getNumberOfVariables(); i++) {
      lowerLimit.add(-5.0);
      upperLimit.add(5.0);
    }

    setVariableBounds(lowerLimit, upperLimit);
  }

  /** Evaluate() method */
  public void evaluate(DoubleSolution solution){
    double aux, xi, xj;
    double[] fx = new double[getNumberOfObjectives()];
    double[] x = new double[getNumberOfVariables()];
    for (int i = 0; i < solution.getNumberOfVariables(); i++) {
      x[i] = solution.getVariable(i) ;
    }

    fx[0] = 0.0;
    for (int var = 0; var < solution.getNumberOfVariables() - 1; var++) {
      xi = x[var] * x[var];
      xj = x[var + 1] * x[var + 1];
      aux = (-0.2) * Math.sqrt(xi + xj);
      fx[0] += (-10.0) * Math.exp(aux);
    }

    fx[1] = 0.0;

    for (int var = 0; var < solution.getNumberOfVariables(); var++) {
      fx[1] += Math.pow(Math.abs(x[var]), 0.8) +
        5.0 * Math.sin(Math.pow(x[var], 3.0));
    }

    solution.setObjective(0, fx[0]);
    solution.setObjective(1, fx[1]);
  }
}


text:
package com.knackedup.endpoints;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

import com.google.appengine.api.users.User;
import com.knackedup.entity.Member;
import com.knackedup.error.GenericServiceException;

public class UserGetHelper
{
	public Member fetchUserProfile(String token) throws Exception
	{
		String url = null;
		StringBuffer stringBuffer = null;
		Member member = new Member();
		try
		{
			url = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=" + token;
			stringBuffer = new StringBuffer();
			final URL u = new URL(url);
			final URLConnection uc = u.openConnection();
			final int end = 1000;
			InputStreamReader isr = null;
			BufferedReader br = null;
			try
			{
				isr = new InputStreamReader(uc.getInputStream());
				br = new BufferedReader(isr);
				final int chk = 0;
				while ((url = br.readLine()) != null)
				{
					if ((chk >= 0) && ((chk < end)))
					{
						stringBuffer.append(url).append('\n');
					}
				}
			}
			catch (final java.net.ConnectException cex)
			{
				throw new GenericServiceException();
			}
			catch (final Exception ex)
			{
				throw new GenericServiceException();
			}
			finally
			{
				try
				{
					br.close();
				}
				catch (final Exception ex)
				{
					throw new GenericServiceException();
				}
			}
		}
		catch (final Exception ex)
		{
			throw ex;
		}
		try
		{
			final JsonFactory f = new JsonFactory();
			JsonParser jp;
			jp = f.createJsonParser(stringBuffer.toString());
			jp.nextToken();
			while (jp.nextToken() != JsonToken.END_OBJECT)
			{
				final String fieldname = jp.getCurrentName();
				jp.nextToken();
				if ("picture".equals(fieldname))
				{
					member.setPictureURL(jp.getText());
				}
				else if ("name".equals(fieldname))
				{
					member.setName(jp.getText());
				}
				else if ("email".equals(fieldname))
				{
					member.setEmail(jp.getText());
				}
				else if ("verified_email".equals(fieldname))
				{
					member.setVerifiedEmail(Boolean.valueOf(jp.getText()));
				}
				else if ("given_name".equals(fieldname))
				{
					member.setGivenName(jp.getText());
				}
				else if ("family_name".equals(fieldname))
				{
					member.setFamilyName(jp.getText());
				}
				else if ("locale".equals(fieldname))
				{
					member.setLocale(jp.getText());
				}
				else if ("id".equals(fieldname))
				{
					member.setGoogleId(jp.getText());
				}
				else if ("hd".equals(fieldname))
				{
					member.setHd(jp.getText());
				}
			}
		}
		catch (final JsonParseException ex)
		{
			throw (ex);
		}
		catch (final IOException ex)
		{
			throw (ex);
		}
		catch (final Exception ex)
		{
			throw (ex);
		}
		return member;
	}
}