text:
package com.thoughtworks.go.config.materials.perforce;

import com.thoughtworks.go.config.SecretParam;
import com.thoughtworks.go.config.exceptions.UnresolvedSecretParamException;
import com.thoughtworks.go.domain.MaterialRevision;
import com.thoughtworks.go.domain.materials.Modification;
import com.thoughtworks.go.domain.materials.perforce.P4Client;
import com.thoughtworks.go.helper.MaterialsMother;
import com.thoughtworks.go.helper.P4TestRepo;
import com.thoughtworks.go.security.GoCipher;
import com.thoughtworks.go.util.ReflectionUtil;
import com.thoughtworks.go.util.command.EnvironmentVariableContext;
import com.thoughtworks.go.util.command.InMemoryStreamConsumer;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class P4MaterialTest extends P4MaterialTestBase {

    @Override
    protected P4TestRepo createTestRepo() throws Exception {
        P4TestRepo repo = P4TestRepo.createP4TestRepo(temporaryFolder, clientFolder);
        repo.onSetup();
        return repo;
    }

    @Test
    void shouldAddServerSideEnvironmentVariablesClientNameEnvironmentVariable() throws IOException {
        File p4_working_dir = temporaryFolder.newFolder();

        P4Material p4 = new P4Material("host:10", "beautiful", "user");
        p4.setPassword("loser");
        EnvironmentVariableContext envVarCtx;

        envVarCtx = new EnvironmentVariableContext();
        p4.populateEnvironmentContext(envVarCtx, new MaterialRevision(p4, new Modification("loser", "loserish commit", "loser@boozer.com", new Date(), "123")), p4_working_dir);
        assertThat(envVarCtx.getProperty("GO_REVISION")).isEqualTo("123");
        assertThat(envVarCtx.getProperty("GO_TO_REVISION")).isEqualTo("123");
        assertThat(envVarCtx.getProperty("GO_FROM_REVISION")).isEqualTo("123");
    }

    @Test
    void shouldAddClientNameEnvironmentVariable() throws IOException {
        File p4_working_dir = temporaryFolder.newFolder();

        P4Material p4 = new P4Material("host:10", "beautiful", "user");
        p4.setPassword("loser");
        EnvironmentVariableContext envVarCtx;

        envVarCtx = new EnvironmentVariableContext();
        p4.populateAgentSideEnvironmentContext(envVarCtx, p4_working_dir);
        assertThat(envVarCtx.getProperty("GO_P4_CLIENT")).isEqualTo(p4.clientName(p4_working_dir));
    }

    @Test
    void shouldGenerateTheSameP4ClientValueForCommandAndEnvironment() throws Exception {

        P4Material p4Material = new P4Material("server:10", "out-of-the-window");
        ReflectionUtil.setField(p4Material, "folder", "crapy_dir");

        P4Client p4Client = p4Material._p4(tempDir, new InMemoryStreamConsumer(), false);

        assertThat(p4Client).isNotNull();
        String client = (String) ReflectionUtil.getField(p4Client, "p4ClientName");
        assertThat(client).isEqualTo(p4Material.clientName(tempDir));
    }

    @Test
    void shouldNotDisplayPasswordInStringRepresentation() {
        P4Material p4 = new P4Material("host:10", "beautiful");
        p4.setUsername("user");
        p4.setPassword("loser");
        assertThat(p4.toString()).doesNotContain("loser");
    }

    @Test
    void shouldReturnEqualsEvenIfPasswordsAreDifferent() throws Exception {
        P4Material material = MaterialsMother.p4Material();
        material.setPassword("password");

        P4Material other = MaterialsMother.p4Material();
        other.setPassword("password1");
        assertThat(material).isEqualTo(other);
    }

    @Test
    void shouldNotConsiderPasswordForEqualityCheck() {
        P4Material one = new P4Material("host:123", "through_window");
        one.setPassword("password");
        P4Material two = new P4Material("host:123", "through_window");
        two.setPassword("wordpass");

        assertThat(one).isEqualTo(two);
        assertThat(one.hashCode()).isEqualTo(two.hashCode());
    }

    @Test
    void shouldGetLongDescriptionForMaterial() {
        P4Material material = new P4Material("host:123", "through_window", "user", "folder");
        assertThat(material.getLongDescription()).isEqualTo("URL: host:123, View: through_window, Username: user");
    }

    @Test
    void shouldCopyOverPasswordWhenConvertingToConfig() throws Exception {
        P4Material material = new P4Material("blah.com", "view");
        material.setPassword("password");

        P4MaterialConfig config = (P4MaterialConfig) material.config();

        assertThat(config.getPassword()).isEqualTo("password");
        assertThat(config.getEncryptedPassword()).isNotNull();
    }

    @Test
    void shouldGetAttributesWithSecureFields() {
        P4Material material = new P4Material("host:1234", "view", "username");
        material.setPassword("password");
        material.setUseTickets(true);
        Map<String, Object> attributes = material.getAttributes(true);

        assertThat(attributes.get("type")).isEqualTo("perforce");
        Map<String, Object> configuration = (Map<String, Object>) attributes.get("perforce-configuration");
        assertThat(configuration.get("url")).isEqualTo("host:1234");
        assertThat(configuration.get("username")).isEqualTo("username");
        assertThat(configuration.get("password")).isEqualTo("password");
        assertThat(configuration.get("view")).isEqualTo("view");
        assertThat(configuration.get("use-tickets")).isEqualTo(true);
    }

    @Test
    void shouldGetAttributesWithoutSecureFields() {
        P4Material material = new P4Material("host:1234", "view", "username");
        material.setPassword("password");
        material.setUseTickets(true);
        Map<String, Object> attributes = material.getAttributes(false);

        assertThat(attributes.get("type")).isEqualTo("perforce");
        Map<String, Object> configuration = (Map<String, Object>) attributes.get("perforce-configuration");
        assertThat(configuration.get("url")).isEqualTo("host:1234");
        assertThat(configuration.get("username")).isEqualTo("username");
        assertThat(configuration.get("password")).isNull();
        assertThat(configuration.get("view")).isEqualTo("view");
        assertThat(configuration.get("use-tickets")).isEqualTo(true);
    }

    @Test
    void shouldSetGO_P4_CLIENT_toTheClientName() {
        P4Material material = new P4Material("host:1234", "view", "username", "destination");
        EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
        File agentWorkingDirectory = new File("pipelines/pipeline-name");
        material.populateAgentSideEnvironmentContext(environmentVariableContext, agentWorkingDirectory);
        assertThat(environmentVariableContext.getProperty("GO_P4_CLIENT_DESTINATION")).isEqualTo(material.clientName(material.workingdir(agentWorkingDirectory)));
    }

    @Nested
    class hasSecretParams {
        @Test
        void shouldBeTrueIfMaterialUrlHasSecretParams() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("{{SECRET:[secret_config_id][lookup_password]}}");

            assertThat(p4Material.hasSecretParams()).isTrue();
        }

        @Test
        void shouldBeFalseInMaterialUrlDoesNotHaveSecretParams() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("foo");

            assertThat(p4Material.hasSecretParams()).isFalse();
        }
    }

    @Nested
    class getSecretParams {
        @Test
        void shouldReturnAListOfSecretParams() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("{{SECRET:[secret_config_id][lookup_password]}}");

            assertThat(p4Material.getSecretParams())
                    .hasSize(1)
                    .contains(new SecretParam("secret_config_id", "lookup_password"));
        }

        @Test
        void shouldBeAnEmptyListInAbsenceOfSecretParamsinMaterialUrl() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("pass");

            assertThat(p4Material.getSecretParams())
                    .hasSize(0);
        }
    }

    @Nested
    class passwordForCommandLine {
        @Test
        void shouldReturnPasswordAsConfigured_IfNotDefinedAsSecretParam() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("badger");

            assertThat(p4Material.passwordForCommandLine()).isEqualTo("badger");
        }

        @Test
        void shouldReturnAResolvedPassword_IfPasswordDefinedAsSecretParam() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("{{SECRET:[secret_config_id][lookup_pass]}}");

            p4Material.getSecretParams().findFirst("lookup_pass").ifPresent(secretParam -> secretParam.setValue("resolved_password"));

            assertThat(p4Material.passwordForCommandLine()).isEqualTo("resolved_password");
        }

        @Test
        void shouldErrorOutWhenCalledOnAUnResolvedSecretParam_IfPasswordDefinedAsSecretParam() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("{{SECRET:[secret_config_id][lookup_pass]}}");

            assertThatCode(p4Material::passwordForCommandLine)
                    .isInstanceOf(UnresolvedSecretParamException.class)
                    .hasMessageContaining("SecretParam 'lookup_pass' is used before it is resolved.");
        }
    }

    @Nested
    class setPassword {
        @Test
        void shouldParsePasswordString_IfDefinedAsSecretParam() {
            P4Material p4Material = new P4Material("host:10", "beautiful");
            p4Material.setPassword("{{SECRET:[secret_config_id][lookup_pass]}}");

            assertThat(p4Material.getSecretParams())
                    .hasSize(1)
                    .contains(new SecretParam("secret_config_id", "lookup_pass"));
        }
    }
}


text:
<!DOCTYPE html>

		<meta charset="gb2312">
		<title>ÆóÒµ»áÔ±ÖÐÐÄ-Ê×Ò³</title>
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
		<meta name="author" content="ÆïÊ¿CMS" />
		<meta name="copyright" content="74cms.com" />
		<link rel="stylesheet" href="../css/user-common.css" />
		<link rel="stylesheet" href="../css/user-company.css" />

»áÔ±ÖÐÐÄ

				{#include file="m/company/navi.html"#}

{#$company_info.companyname#}

					{#if $company_info.logo==""#}

					{#else#}

					{#/if#}

ÆóÒµÈÏÖ¤£º{#if $company_info.audit==0#}δÈÏÖ¤{#elseif $company_info.audit==1#}ÈÏ֤ͨ¹ý{#elseif $company_info.audit==2#}µÈ´ýÈÏÖ¤{#else#}ÈÏ֤δͨ¹ý{#/if#}

{#if $QISHI.operation_mode=="1"#}µ±Ç°»ý·Ö£º{#$user_points#}{#elseif $QISHI.operation_mode=="2"#} {#if $user_setmeal.setmeal_id>'1'#}{#/if#}µ±Ç°Ìײͣº{#$user_setmeal.setmeal_name#}{#else#} {#if $user_setmeal.setmeal_id>'1'#}{#/if#}{#$user_setmeal.setmeal_name#} {#$user_points#} {#$QISHI.points_byname#}{#/if#}

·¢²¼Ö°Î»

¹ÜÀíְλ

¼òÀúËÑË÷

¼òÀú¹ÜÀí

Ë¢ÐÂְλ

ÕË»§¹ÜÀí

ÌײͻáÔ±²úÆ·

¶àÖÖÌØȨËæÐÄÏí

Á˽âÏêÇé

ÆóÒµÈÏÖ¤

ÈÏÖ¤ÆóÒµ¸üÊÜÇàíù

{#if $company_info.audit!=1#}Á¢¼´ÈÏÖ¤{#else#}ÒѾÍ¨¹ýÈÏÖ¤{#/if#}

ÁªÏµ¿Í·þ

{#if $consultant#}רÊô¿Í·þ QQ : {#$consultant#}{#else#}ÇëÁªÏµ¹ÜÀíԱΪÄú·ÖÅä¹ËÎÊ{#/if#}

°²È«Í˳ö

redpajama_set_name: RedPajamaGithub


text:
from troposphere import (
    GetAtt, Ref, ec2, Output, Tags
)
from troposphere.rds import (
    DBSubnetGroup,
    DBClusterParameterGroup,
    DBCluster,
)
from troposphere.route53 import RecordSetType

from stacker.blueprints.base import Blueprint
from stacker.blueprints.variables.types import CFNString

from stacker_blueprints.rds.base import validate_backup_retention_period

# Resource name constants
SUBNET_GROUP = "SubnetGroup"
PARAMETER_GROUP = "ClusterParameterGroup"
SECURITY_GROUP = "SecurityGroup"
DBCLUSTER = "DBCluster"
DNS_RECORD = "DBClusterMasterDnsRecord"

class Cluster(Blueprint):
    VARIABLES = {
        "BackupRetentionPeriod": {
            "type": int,
            "description": "Number of days to retain database backups.",
            "validator": validate_backup_retention_period,
            "default": 7,
        },
        "DatabaseName": {
            "type": str,
            "description": "Initial db to create in database."
        },
        "DBFamily": {
            "type": str,
            "description": "DBFamily for ParameterGroup.",
        },
        "ClusterParameters": {
            "type": dict,
            "description": "A dictionary of parameters to apply to the "
                           "cluster.",
            "default": {},
        },
        "VpcId": {
            "type": str,
            "description": "Vpc Id"
        },
        "Subnets": {
            "type": str,
            "description": "A comma separated list of subnet ids."
        },

        "EngineVersion": {
            "type": str,
            "description": "Database engine version for the RDS Instance.",
        },
        "MasterUser": {
            "type": str,
            "description": "Name of the master user in the db.",
        },
        "MasterUserPassword": {
            "type": CFNString,
            "no_echo": True,
            "description": "Master user password."
        },
        "PreferredBackupWindow": {
            "type": str,
            "description": "A (minimum 30 minute) window in HH:MM-HH:MM "
                           "format in UTC for backups. Default: 4am-5am "
                           "PST",
            "default": "12:00-13:00"
        },
        "PreferredMaintenanceWindow": {
            "type": str,
            "description": "A (minimum 30 minute) window in "
                           "DDD:HH:MM-DDD:HH:MM format in UTC for "
                           "backups. Default: Sunday 3am-4am PST",
            "default": "Sun:11:00-Sun:12:00"
        },
        "SnapshotIdentifier": {
            "type": str,
            "description": "The snapshot you want the db restored from.",
            "default": "",
        },
        "StorageEncrypted": {
            "type": bool,
            "description": "Set to 'false' to disable encrypted storage.",
            "default": True,
        },
        "Tags": {
            "type": dict,
            "description": "An optional dictionary of tags to put on the "
                           "database instance.",
            "default": {}
        },
        "ExistingSecurityGroup": {
            "type": str,
            "description": "The ID of an existing security group to put "
                           "the RDS instance in. If not specified, one "
                           "will be created for you.",
            "default": "",
        },
        "InternalZoneId": {
            "type": str,
            "default": "",
            "description": "Internal zone Id, if you have one."
        },
        "InternalZoneName": {
            "type": str,
            "default": "",
            "description": "Internal zone name, if you have one."
        },
        "InternalHostname": {
            "type": str,
            "default": "",
            "description": "Internal domain name, if you have one."
        },
    }

    def engine(self):
        return None

    def defined_variables(self):
        variables = super(Cluster, self).defined_variables()

        if not self.engine():
            variables['Engine'] = {
                "type": str,
                "description": "Database engine for the Aurora Cluster.",
            }

        return variables

    def should_create_internal_hostname(self):
        variables = self.get_variables()
        return all(
            [
                variables["InternalZoneId"],
                variables["InternalZoneName"],
                variables["InternalHostname"]
            ]
        )

    def get_db_snapshot_identifier(self):
        variables = self.get_variables()
        return variables["DBSnapshotIdentifier"] or Ref("AWS::NoValue")

    def get_tags(self):
        variables = self.get_variables()
        tag_var = variables["Tags"]
        t = {"Name": self.name}
        t.update(tag_var)
        return Tags(**t)

    def create_subnet_group(self):
        t = self.template
        variables = self.get_variables()
        t.add_resource(
            DBSubnetGroup(
                SUBNET_GROUP,
                DBSubnetGroupDescription="%s VPC subnet group." % self.name,
                SubnetIds=variables["Subnets"].split(",")
            )
        )
        t.add_output(Output("SubnetGroup", Value=Ref(SUBNET_GROUP)))

    def create_security_group(self):
        t = self.template
        variables = self.get_variables()
        self.security_group = variables["ExistingSecurityGroup"]
        if not variables["ExistingSecurityGroup"]:
            sg = t.add_resource(
                ec2.SecurityGroup(
                    SECURITY_GROUP,
                    GroupDescription="%s RDS security group" % self.name,
                    VpcId=variables["VpcId"]
                )
            )
            self.security_group = Ref(sg)
        t.add_output(Output("SecurityGroup", Value=self.security_group))

    def get_master_endpoint(self):
        endpoint = GetAtt(DBCLUSTER, "Endpoint.Address")
        return endpoint

    def create_parameter_group(self):
        t = self.template
        variables = self.get_variables()
        params = variables["ClusterParameters"]
        if params:
            t.add_resource(
                DBClusterParameterGroup(
                    PARAMETER_GROUP,
                    Description=self.name,
                    Family=variables["DBFamily"],
                    Parameters=params,
                )
            )

    def create_cluster(self):
        t = self.template
        variables = self.get_variables()
        parameter_group = Ref("AWS::NoValue")
        if variables["ClusterParameters"]:
            parameter_group = Ref(PARAMETER_GROUP)

        t.add_resource(
            DBCluster(
                DBCLUSTER,
                BackupRetentionPeriod=variables["BackupRetentionPeriod"],
                DBClusterParameterGroupName=parameter_group,
                DBSubnetGroupName=Ref(SUBNET_GROUP),
                Engine=self.engine() or variables["Engine"],
                EngineVersion=variables["EngineVersion"],
                MasterUsername=variables["MasterUser"],
                MasterUserPassword=Ref("MasterUserPassword"),
                PreferredBackupWindow=variables["PreferredBackupWindow"],
                PreferredMaintenanceWindow=variables[
                    "PreferredMaintenanceWindow"],
                Tags=self.get_tags(),
                VpcSecurityGroupIds=[self.security_group, ]
            )
        )

    def create_dns_records(self):
        t = self.template
        variables = self.get_variables()

        # Setup CNAME to cluster
        if self.should_create_internal_hostname():
            hostname = "%s.%s" % (
                variables["InternalHostname"],
                variables["InternalZoneName"]
            )
            t.add_resource(
                RecordSetType(
                    DNS_RECORD,
                    # Appends a "." to the end of the domain
                    HostedZoneId=variables["InternalZoneId"],
                    Comment="RDS DB CNAME Record",
                    Name=hostname,
                    Type="CNAME",
                    TTL="120",
                    ResourceRecords=[self.get_master_endpoint()],
                )
            )

    def create_outputs(self):
        t = self.template
        t.add_output(
            Output("MasterEndpoint", Value=self.get_master_endpoint())
        )
        t.add_output(Output("Cluster", Value=Ref(DBCLUSTER)))
        if self.should_create_internal_hostname():
            t.add_output(
                Output("DBCname", Value=Ref(DNS_RECORD))
            )

    def create_template(self):
        self.create_subnet_group()
        self.create_security_group()
        self.create_parameter_group()
        self.create_cluster()
        self.create_dns_records()
        self.create_outputs()

class AuroraCluster(Cluster):
    def engine(self):
        return "aurora"


text:
/*---
description: Async test
negative: RangeError
---*/

process.nextTick(function() {
    $DONE(new RangeError());
});


text:
# Dessin #

## Couleurs ##

Les couleurs de la liblapin sont représentées grâce à des entiers de 32
bits, autrement dit des `int` sur la plupart des architectures.

Une couleur (et donc un pixel) est encodée au [format RGBA][],
c'est à dire que chaque couleur est constituée de quatre
composantes de 8 bits :
  - Une composante pour le rouge ;
  - Une composante pour le vert ;
  - Une composante pour le bleu ;
  - Une composante pour la transparence, le « canal alpha » ;

La macro `GET_COLOR(rgb)` permet de convertir une couleur `rgb` au format
RGB vers le format RGBA en mettant la nouvelle composante alpha à 255,
de façon à ce que la couleur résultante soit totalement opaque.

La macro `ALPHA(a, rgb)` permet de convertir une couleur `rgb` au format
RGB vers le format RGBA, dont la nouvelle composante alpha sera donnée
par `a`.

Les macros suivantes sont également disponibles :

    Nom	Description

    BLACK	Noir

    BLUE	Bleu

    GREEN	Vert

	PINK	Rose

	PURPLE	Violet

	RED	Rouge

	TEAL	Cyan

	WHITE	Blanc

	YELLOW	Jaune

Noter que la liblapin ne pourra pas être utilisée sur n'importe quelle
architecture, et qu'une bonne compréhension de l'*[endianness][]* est nécéssaire
pour se faire une bonne idée du fonctionnement de la gestion des couleurs.

## Généralités ##

Il n'est pas possible de dessiner directement dans le buffer
d'une fenêtre sans appeller une fonction interdite de la liblapin.
Nous allons donc dessiner dans un tableau de pixels représenté
par le type `t_bunny_pixelarray`, transférer ce tableau de pixels
sur le buffer de la fenêtre, puis mettre à jour la fenêtre.

Le type `t_bunny_pixelarray` est défini ainsi :

```c
typedef struct
{
  t_bunny_clipable	clipable;
  void	* const		*pixels;
}					t_bunny_pixelarray;
```

Le membre `pixels` contient le tableau de pixels interne,
et le membre `clipable` contient diverses informations dont
la taille du `t_bunny_pixelarray` :

```c
typedef struct			s_bunny_clipable
{
  t_bunny_buffer		buffer;
  int					clip_width;
  int					clip_height;
  /* ... */
}				t_bunny_clipable;
```

`clip_width` est la largeur `t_bunny_pixelarray`, `clip_height` est
sa hauteur. Par exemple, si `a` est un `t_bunny_pixelarray`,
`a.clipable.clip_width` est sa largeur.

## Créer un t_bunny_pixelarray ##

[manuel officiel][o new_pixelarray]

```c
t_bunny_pixelarray	*bunny_new_pixelarray(unsigned int	width,
										  unsigned int	height);
```

La fonction `bunny_new_pixelarray()` crée un nouveau `t_bunny_pixelarray`
de taille donnée.

## Détruire un t_bunny_pixelarray ##

[manuel officiel][o delete_clipable]

```c
void		bunny_delete_clipable(t_bunny_clipable	*clipable);
```

Cette fonction peut servir à détruire un `t_bunny_pixelarray` dont le clipable
lui est passé en paramètre.

Il est nécessaire de détruire un `t_bunny_pixelarray` après avoir fini de l'utiliser, pour les mêmes raisons que tout appel à `malloc()` doit correspondre à un appel à `free()`.

## Dessiner sur un t_bunny_pixelarray ##

Le membre `pixels` d'un `t_bunny_pixelarray` peut être converti en un
tableau d'entiers non signés de 32 bits, représentant la liste des pixels.

Cela signifie que chaque case du tableau représente un pixel,
respectivement dans l'ordre de gauche à droite.

Si un `t_bunny_pixelarray` fait 3 pixels de haut sur 4 pixels de large,
ses 12 pixels seront disposés ainsi :

```
◀  largeur  ▶

0   1   2   3    ▲

4   5   6   7  hauteur

8   9  10  11    ▼
```

Ainsi, la case 0 du tableau correspond au pixel en haut
à gauche de l'écran, la case 1 au pixel juste à sa droite,
et ainsi de suite.

## Transférer un t_bunny_pixelarray vers une fenêtre ##

[manuel officiel][o blit]

```c
void	bunny_blit(t_bunny_buffer			*buffer,
				   const t_bunny_clipable	*picture,
				   const t_bunny_position	*position);
```

Cette fonction peut servir à transférer un `t_bunny_pixelarray`
vers une fenêtre.
Il suffit de l'appeller avec le buffer de la fenêtre et le
clipable du `t_bunny_pixelarray` :

```c
void				blit_to_window(t_bunny_window *window,
								   const t_bunny_pixelarray *pixelarray)
{
  t_bunny_position	position;

  position.x = 0;
  position.y = 0;
  bunny_blit(&window->buffer, &pixelarray->clipable, &position);
}
```

[Voir le fichier][blit.c]

N'oubliez pas d'appeler ensuite la fonction `bunny_display()` pour afficher ce que
vous venez de transférer.

## Exemple : Remplir en bleu ##

Vous en avez marre du rose ? Voici une fonction permettant
de remplir le `t_bunny_pixelarray` qui lui est passé en
paramètre en bleu :

```c
void			fill_blue(t_bunny_pixelarray *pixelarray)
{
  int			i;
  int			total;
  unsigned		*pixels;

  pixels = (unsigned *)pixelarray->pixels;
  total = pixelarray->clipable.clip_width * pixelarray->clipable.clip_height;
  i = 0;
  while (i < total)
    {
      pixels[i] = BLUE;
      i++;
    }
}
```

[Voir le fichier][fill.c]

`pixels` est un pointeur vers la liste des pixels du
`t_bunny_pixelarray`, `total` est un entier contenant
le nombre de pixels du `t_bunny_pixelarray`.

[o blit]: https://cdn.local.epitech.eu/elearning/B-MUL-051/doc_lapin.htm#bunny_blit
[o new_pixelarray]: https://cdn.local.epitech.eu/elearning/B-MUL-051/doc_lapin.htm#bunny_new_pixelarray
[o delete_clipable]: https://cdn.local.epitech.eu/elearning/B-MUL-051/doc_lapin.htm#bunny_delete_clipable
[format RGBA]: https://en.wikipedia.org/wiki/RGBA_color_space
[endianness]: https://fr.wikipedia.org/wiki/Endianness
[blit.c]: https://github.com/motet-a/liblapin-tutorial/blob/master/examples/drawing/blit.c
[fill.c]: https://github.com/motet-a/liblapin-tutorial/blob/master/examples/drawing/fill.c


text:
namespace chromeos {

// Fake implementation for HermesProfileClient.
class COMPONENT_EXPORT(HERMES_CLIENT) FakeHermesProfileClient
    : public HermesProfileClient,
      public HermesProfileClient::TestInterface {
 public:
  class Properties : public HermesProfileClient::Properties {
   public:
    explicit Properties(const PropertyChangedCallback& callback);
    ~Properties() override;

    // dbus::PropertySet:
    void Get(dbus::PropertyBase* property,
             dbus::PropertySet::GetCallback callback) override;
    void GetAll() override;
    void Set(dbus::PropertyBase* property,
             dbus::PropertySet::SetCallback callback) override;
  };

  FakeHermesProfileClient();
  FakeHermesProfileClient(const FakeHermesProfileClient&) = delete;
  FakeHermesProfileClient& operator=(const FakeHermesProfileClient&) = delete;
  ~FakeHermesProfileClient() override;

  // HermesProfileClient::TestInterface:
  void ClearProfile(const dbus::ObjectPath& carrier_profile_path) override;
  void SetEnableProfileBehavior(
      EnableProfileBehavior enable_profile_behavior) override;

  // HermesProfileClient:
  void EnableCarrierProfile(const dbus::ObjectPath& object_path,
                            HermesResponseCallback callback) override;
  void DisableCarrierProfile(const dbus::ObjectPath& object_path,
                             HermesResponseCallback callback) override;
  void RenameProfile(const dbus::ObjectPath& object_path,
                     const std::string& new_name,
                     HermesResponseCallback callback) override;
  HermesProfileClient::Properties* GetProperties(
      const dbus::ObjectPath& object_path) override;
  HermesProfileClient::TestInterface* GetTestInterface() override;

 private:
  void UpdateCellularDevice(HermesProfileClient::Properties* properties);
  void UpdateCellularServices(const std::string& iccid, bool connectable);
  void CallNotifyPropertyChanged(const dbus::ObjectPath& object_path,
                                 const std::string& property_name);
  void NotifyPropertyChanged(const dbus::ObjectPath& object_path,
                             const std::string& property_name);

  EnableProfileBehavior enable_profile_behavior_ =
      EnableProfileBehavior::kConnectableButNotConnected;

  // Maps fake profile properties to their object paths.
  using PropertiesMap =
      std::map<const dbus::ObjectPath, std::unique_ptr<Properties>>;
  PropertiesMap properties_map_;
};

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_HERMES_FAKE_HERMES_PROFILE_CLIENT_H_


text:
begin
  require 'less'
rescue LoadError => e
  e.message << " (You may need to install the less gem)"
  raise e
end

require  'styled_objects/partials_collector'
require  'styled_objects/generator'
require  'styled_objects/actionview'
require  'styled_objects/class_name_builder'
require  'styled_objects/html/decorator'
require  'styled_objects/helpers/stylesheet_link_tag'
require  'styled_objects/helpers/include'
ActionView::Base.class_eval {include StyledObjects::ActionView::Base}
ActionView::Base.class_eval {include StyledObjects::HTML::Decorator}
ActionView::Base.class_eval {include StyledObjects::Helpers::StylesheetLinkTag}
ActionView::Base.class_eval {include StyledObjects::Helpers::Include}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<TITLE>
Xerces2 Implementation: Class  InvalidDatatypeFacetException
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

org.apache.xerces.impl.dv

Class  InvalidDatatypeFacetException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--org.apache.xerces.impl.dv.DatatypeException
                    |
                    +--org.apache.xerces.impl.dv.InvalidDatatypeFacetException

All Implemented Interfaces:
java.io.Serializable

public class InvalidDatatypeFacetException
extends DatatypeException

Datatype exception for invalid facet. This exception is only used by
 schema datatypes.

INTERNAL:

Usage of this class is not supported. It may be altered or removed at any time.

Version:
$Id: InvalidDatatypeFacetException.java 446751 2006-09-15 21:54:06Z mrglavas $

Author:
Sandy Gao, IBM

See Also:
Serialized Form

Fields inherited from class org.apache.xerces.impl.dv.DatatypeException

args, key

Constructor Summary

InvalidDatatypeFacetException(java.lang.String key,
                              java.lang.Object[] args)

          Create a new datatype exception by providing an error code and a list
 of error message substitution arguments.

Methods inherited from class org.apache.xerces.impl.dv.DatatypeException

getArgs, getKey, getMessage

Methods inherited from class java.lang.Throwable

fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace, toString

Methods inherited from class java.lang.Object

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

Constructor Detail

InvalidDatatypeFacetException

public InvalidDatatypeFacetException(java.lang.String key,
                                     java.lang.Object[] args)

Create a new datatype exception by providing an error code and a list
 of error message substitution arguments.

Parameters:
key - error code
args - error arguments

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

Copyright © 1999-2007 The Apache Software Foundation. All Rights Reserved.


text:
"""
Tests for platutils.py
"""

#-----------------------------------------------------------------------------
#  Copyright (C) 2008-2011  The IPython Development Team
#
#  Distributed under the terms of the BSD License.  The full license is in
#  the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------

import sys
import os
from unittest import TestCase

import nose.tools as nt

from IPython.utils.process import (find_cmd, FindCmdError, arg_split,
                                   system, getoutput, getoutputerror,
                                   get_output_error_code)
from IPython.testing import decorators as dec
from IPython.testing import tools as tt

python = os.path.basename(sys.executable)

#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------

@dec.skip_win32
def test_find_cmd_ls():
    """Make sure we can find the full path to ls."""
    path = find_cmd('ls')
    nt.assert_true(path.endswith('ls'))

def has_pywin32():
    try:
        import win32api
    except ImportError:
        return False
    return True

@dec.onlyif(has_pywin32, "This test requires win32api to run")
def test_find_cmd_pythonw():
    """Try to find pythonw on Windows."""
    path = find_cmd('pythonw')
    assert path.lower().endswith('pythonw.exe'), path

@dec.onlyif(lambda : sys.platform != 'win32' or has_pywin32(),
            "This test runs on posix or in win32 with win32api installed")
def test_find_cmd_fail():
    """Make sure that FindCmdError is raised if we can't find the cmd."""
    nt.assert_raises(FindCmdError,find_cmd,'asdfasdf')

@dec.skip_win32
def test_arg_split():
    """Ensure that argument lines are correctly split like in a shell."""
    tests = [['hi', ['hi']],
             [u'hi', [u'hi']],
             ['hello there', ['hello', 'there']],
             # \u01ce == \N{LATIN SMALL LETTER A WITH CARON}
             # Do not use \N because the tests crash with syntax error in
             # some cases, for example windows python2.6.
             [u'h\u01cello', [u'h\u01cello']],
             ['something "with quotes"', ['something', '"with quotes"']],
             ]
    for argstr, argv in tests:
        nt.assert_equal(arg_split(argstr), argv)

@dec.skip_if_not_win32
def test_arg_split_win32():
    """Ensure that argument lines are correctly split like in a shell."""
    tests = [['hi', ['hi']],
             [u'hi', [u'hi']],
             ['hello there', ['hello', 'there']],
             [u'h\u01cello', [u'h\u01cello']],
             ['something "with quotes"', ['something', 'with quotes']],
             ]
    for argstr, argv in tests:
        nt.assert_equal(arg_split(argstr), argv)

class SubProcessTestCase(TestCase, tt.TempFileMixin):
    def setUp(self):
        """Make a valid python temp file."""
        lines = [ "import sys",
                 "print('on stdout', end='', file=sys.stdout)",
                 "print('on stderr', end='', file=sys.stderr)",
                 "sys.stdout.flush()",
                 "sys.stderr.flush()"]
        self.mktmp('\n'.join(lines))

    def test_system(self):
        status = system('%s "%s"' % (python, self.fname))
        self.assertEqual(status, 0)

    def test_system_quotes(self):
        status = system('%s -c "import sys"' % python)
        self.assertEqual(status, 0)

    def test_getoutput(self):
        out = getoutput('%s "%s"' % (python, self.fname))
        # we can't rely on the order the line buffered streams are flushed
        try:
            self.assertEqual(out, 'on stderron stdout')
        except AssertionError:
            self.assertEqual(out, 'on stdouton stderr')

    def test_getoutput_quoted(self):
        out = getoutput('%s -c "print (1)"' % python)
        self.assertEqual(out.strip(), '1')

    #Invalid quoting on windows
    @dec.skip_win32
    def test_getoutput_quoted2(self):
        out = getoutput("%s -c 'print (1)'" % python)
        self.assertEqual(out.strip(), '1')
        out = getoutput("%s -c 'print (\"1\")'" % python)
        self.assertEqual(out.strip(), '1')

    def test_getoutput_error(self):
        out, err = getoutputerror('%s "%s"' % (python, self.fname))
        self.assertEqual(out, 'on stdout')
        self.assertEqual(err, 'on stderr')

    def test_get_output_error_code(self):
        quiet_exit = '%s -c "import sys; sys.exit(1)"' % python
        out, err, code = get_output_error_code(quiet_exit)
        self.assertEqual(out, '')
        self.assertEqual(err, '')
        self.assertEqual(code, 1)
        out, err, code = get_output_error_code('%s "%s"' % (python, self.fname))
        self.assertEqual(out, 'on stdout')
        self.assertEqual(err, 'on stderr')
        self.assertEqual(code, 0)


text:
require 'devise/strategies/database_authenticatable'

class Devise::Strategies::LoginSmsable < Devise::Strategies::DatabaseAuthenticatable
  def authenticate!
    super
  end
end


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>VO808X: testing::TestEventListener Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

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

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

VO808X

Main Page

Related Pages

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

Public Member Functions |
List of all members

testing::TestEventListener Class Referenceabstract

#include <gtest.h>

Inheritance diagram for testing::TestEventListener:

[legend]

Public Member Functions

virtual 	~TestEventListener ()

virtual void 	OnTestProgramStart (const UnitTest &unit_test)=0

virtual void 	OnTestIterationStart (const UnitTest &unit_test, int iteration)=0

virtual void 	OnEnvironmentsSetUpStart (const UnitTest &unit_test)=0

virtual void 	OnEnvironmentsSetUpEnd (const UnitTest &unit_test)=0

virtual void 	OnTestCaseStart (const TestCase &test_case)=0

virtual void 	OnTestStart (const TestInfo &test_info)=0

virtual void 	OnTestPartResult (const TestPartResult &test_part_result)=0

virtual void 	OnTestEnd (const TestInfo &test_info)=0

virtual void 	OnTestCaseEnd (const TestCase &test_case)=0

virtual void 	OnEnvironmentsTearDownStart (const UnitTest &unit_test)=0

virtual void 	OnEnvironmentsTearDownEnd (const UnitTest &unit_test)=0

virtual void 	OnTestIterationEnd (const UnitTest &unit_test, int iteration)=0

virtual void 	OnTestProgramEnd (const UnitTest &unit_test)=0

Detailed Description

Definition at line 991 of file gtest.h.

Constructor & Destructor Documentation

          virtual testing::TestEventListener::~TestEventListener
          (
          	)

inlinevirtual

Definition at line 993 of file gtest.h.

Member Function Documentation

          virtual void testing::TestEventListener::OnEnvironmentsSetUpEnd
          (
          const UnitTest &
          unit_test	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnEnvironmentsSetUpStart
          (
          const UnitTest &
          unit_test	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnEnvironmentsTearDownEnd
          (
          const UnitTest &
          unit_test	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnEnvironmentsTearDownStart
          (
          const UnitTest &
          unit_test	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestCaseEnd
          (
          const TestCase &
          test_case	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestCaseStart
          (
          const TestCase &
          test_case	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestEnd
          (
          const TestInfo &
          test_info	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestIterationEnd
          (
          const UnitTest &
          unit_test,

          int
          iteration

          )

pure virtual

Implemented in SequenceTestingListener, testing::internal::XmlUnitTestResultPrinter, testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestIterationStart
          (
          const UnitTest &
          unit_test,

          int
          iteration

          )

pure virtual

Implemented in SequenceTestingListener, testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestPartResult
          (
          const TestPartResult &
          test_part_result	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestProgramEnd
          (
          const UnitTest &
          unit_test	)

pure virtual

Implemented in SequenceTestingListener, testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestProgramStart
          (
          const UnitTest &
          unit_test	)

pure virtual

Implemented in SequenceTestingListener, TestListener, testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

          virtual void testing::TestEventListener::OnTestStart
          (
          const TestInfo &
          test_info	)

pure virtual

Implemented in testing::internal::TestEventRepeater, testing::internal::PrettyUnitTestResultPrinter, testing::EmptyTestEventListener, and testing::internal::EventRecordingListener.

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

/home/bhargavi/Documents/SDR/Copy_Exam_808X/vendor/googletest/googletest/include/gtest/gtest.h

testing

TestEventListener

Generated by

     1.8.11


text:
* This is a sample demo app creating admob banner at bottom of any activity by using a single piece of code.
* It doesn't affect your layout and you have not to implement admob code in each and every screen.
* It uses `android.R.id.content`
* Read More [Here](http://mohammadkhatri.github.io/blog/2015/08/03/AdMob-Banner-In-all-activities/).

```java
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setupAdAtBottom();
    }
```

```
Copyright [2015] [Mohammadhussain Khatri]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```


text:
require "uiauto/version"

module UIAuto
end


text:
function command_is_not_available() {
    if ! type "$1" > /dev/null;
    then
        return 0
    else
        return 1
    fi
}

# main config
PLUGINSLUG="your-plugin-slug"
CURRENTDIR=`pwd`
MAINFILE="your-plugin-slug.php" # this should be the name of your main php file in the wordpress plugin

# git config
GITPATH="$CURRENTDIR/" # this file should be in the base of your git repository

# svn config
SVNPATH="/tmp/$PLUGINSLUG" # path to a temp SVN repo. No trailing slash required and don't add trunk.
SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG/" # Remote SVN repo on wordpress.org, with no trailing slash
SVNUSER="your-svn-username" # your svn username

# Let's begin...
echo ".........................................."
echo
echo "Preparing to deploy wordpress plugin"
echo
echo ".........................................."
echo

# Check if subversion is installed before getting all worked up
if command_is_not_available "svn"
	then
	echo "You'll need to install subversion before proceeding. Exiting....";
	exit 1;
fi

# Check version in readme.txt is the same as plugin file after translating both to unix line breaks to work around grep's failure to identify mac line breaks
NEWVERSION1=`grep "^Stable tag:" "$GITPATH/readme.txt" | awk -F' ' '{print $NF}'`
echo "readme.txt version: $NEWVERSION1"
NEWVERSION2=`grep "^Version:" "$GITPATH/$MAINFILE" | awk -F' ' '{print $NF}'`
echo "$MAINFILE version: $NEWVERSION2"

if [ "$NEWVERSION1" != "$NEWVERSION2" ] && [ "$NEWVERSION1" != "trunk" ]; then echo "Version in readme.txt & $MAINFILE don't match. Exiting...."; exit 1; fi

if [ "$NEWVERSION1" == "trunk" ]
	then
		echo "Setting trunk version to $NEWVERSION2 ..."
		NEWVERSION1=$NEWVERSION2;
	else
		echo "Versions match in readme.txt and $MAINFILE ..."
fi

cd "$GITPATH"
echo -e "Enter a commit message for this new version: \c"
read COMMITMSG

read -p "Create Git commit & tag? " -n 1 -r
echo # Move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
	then

		if git show-ref --tags --quiet --verify -- "refs/tags/$NEWVERSION1"
			then
				echo "Version $NEWVERSION1 already exists as git tag. Exiting....";
				exit 1;
			else
				echo "Git version does not exist. Let's proceed..."
		fi

	    git commit -am "$COMMITMSG"

	    echo "Tagging new version in git"
	    git tag -a "$NEWVERSION1" -m "Tagging version $NEWVERSION1"

	    echo "Pushing latest commit to origin, with tags"
	    git push origin master
	    git push origin master --tags

fi

# Check if the svn tag already exists
echo "Checking if the svn tag already exists ..."
set +e && svn info "$SVNURL/tags/$NEWVERSION1" >& /dev/null && set -e
if [ $? == 0 ]
	then
		echo "Version $NEWVERSION1 already exists as svn tag. Exiting....";
		exit 1;
	else
		echo "Version $NEWVERSION1 does not exist as svn tag. Proceeding....";
fi

# Checkout SVN repo
echo
echo "Creating local copy of SVN repo ..."
svn co $SVNURL $SVNPATH

# Delete all files in SVN trunk
echo "Clearing svn repo so we can overwrite it"
svn rm $SVNPATH/trunk/*

# Add all files from Git HEAD to SVN trunk
echo "Exporting the HEAD of master from git to the trunk of SVN"
git checkout-index -a -f --prefix=$SVNPATH/trunk/

# Ignore specific files in SVN trunk
echo "Ignoring github specific files and deployment script"
svn propset svn:ignore "wp-plugin-deploy.sh
README.md
.git
.gitignore" "$SVNPATH/trunk/"

echo "Changing directory to SVN and committing to trunk"
cd $SVNPATH/trunk/
# Add all new files that are not set to be ignored
svn add --force * --auto-props --parents --depth infinity -q
svn commit --username=$SVNUSER -m "$COMMITMSG"

echo "Creating new SVN tag & committing it"
cd $SVNPATH
svn copy trunk/ tags/$NEWVERSION1/
cd $SVNPATH/tags/$NEWVERSION1
svn commit --username=$SVNUSER -m "Tagging version $NEWVERSION1"

echo "Removing temporary directory $SVNPATH"
rm -fr $SVNPATH/

echo "*** Plugin deployment complete ***"


text:
require_relative '../../puppet_x/puppetlabs/swagger/fuzzy_compare'

Puppet::Type.newtype(:kubernetes_api_version) do

  @doc = "An APIVersion represents a single concrete version of an object model."

  ensurable

  newparam(:name, namevar: true) do
    desc 'Name of the api_version.'
  end

      newproperty(:name) do

        desc "Name of this version (e.g. 'v1')."

        def insync?(is)
          PuppetX::Puppetlabs::Swagger::Utils::fuzzy_compare(is, should)
        end
      end

end


text:
package com.google.api.ads.adwords.jaxws.v201406.cm;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
 *             Returns a list of shopping bidding categories.
 *
 *             A country predicate must be included in the selector.
 *             An empty parentDimensionType predicate will filter for root categories.
 *
 *             @return A list of shopping bidding categories.
 *             @throws ApiException when there is at least one error with the request.
 *
 *
 *
Java class for getProductBiddingCategoryData element declaration.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <element name="getProductBiddingCategoryData">
 *   <complexType>
 *     <complexContent>
 *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *         <sequence>
 *           <element name="selector" type="{https://adwords.google.com/api/adwords/cm/v201406}Selector" minOccurs="0"/>
 *         </sequence>
 *       </restriction>
 *     </complexContent>
 *   </complexType>
 * </element>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "selector"
})
@XmlRootElement(name = "getProductBiddingCategoryData")
public class ConstantDataServiceInterfacegetProductBiddingCategoryData {

    protected Selector selector;

    /**
     * Gets the value of the selector property.
     *
     * @return
     *     possible object is
     *     {@link Selector }
     *
     */
    public Selector getSelector() {
        return selector;
    }

    /**
     * Sets the value of the selector property.
     *
     * @param value
     *     allowed object is
     *     {@link Selector }
     *
     */
    public void setSelector(Selector value) {
        this.selector = value;
    }

}


text:
package org.search.system.utils;

/** Mistype util
 * All tools to handle mistyping
 * @author Daniil Matkov
 */
public class MistypeUtil {

    /**
     * Caculates levenstein distance between two strings
     *
     * @param first  string to calc levenstein distance between
     * @param second string to calc levenstein distance between
     * @return levenstein distance between two strings
     */
    public static int levensteinDistance(String first, String second){
        if(first==null){
            throw new IllegalArgumentException("String can't be null");
        }
        if(second==null){
            throw new IllegalArgumentException("String can't be null");
        }
        int[] prev = new int[ second.length() + 1 ];
        for (int j = 0; j < second.length() + 1; j++) {
            prev[ j ] = j;
        }
        for (int i = 1; i < first.length() + 1; i++) {
            int[] curr = new int[ second.length() + 1 ];
            curr[0] = i;
            for (int j = 1; j < second.length() + 1; j++) {
                int d1 = prev[ j ] + 1;
                int d2 = curr[ j - 1 ] + 1;
                int d3 = prev[ j - 1 ];
                if ( first.charAt(i-1) != second.charAt( j - 1 ) ) {
                    d3 += 1;
                }
                curr[ j ] = Math.min( Math.min( d1, d2 ), d3 );
            }
            prev = curr;
        }
        return prev[ second.length() ];
    }
}


text:
using System.Collections.Generic;

namespace Jcq.IcqProtocol.DataTypes
{
    public class Snac0105 : Snac
    {
        public Snac0105() : base(0x1, 0x5)
        {
        }

        public TlvServiceFamilyId ServiceFamily { get; } = new TlvServiceFamilyId();

        public TlvServerAddress ServerAddress { get; } = new TlvServerAddress();

        public TlvAuthorizationCookie AuthorizationCookie { get; } = new TlvAuthorizationCookie();

        public override int CalculateDataSize()
        {
            return ServiceFamily.CalculateTotalSize() + ServerAddress.CalculateTotalSize() +
                   AuthorizationCookie.CalculateTotalSize();
        }

        public override void Deserialize(List<byte> data)
        {
            base.Deserialize(data);

            int index = SizeFixPart;

            index += 8;

            while (index < data.Count)
            {
                TlvDescriptor desc = TlvDescriptor.GetDescriptor(index, data);

                switch (desc.TypeId)
                {
                    case 0xd:
                        ServiceFamily.Deserialize(data.GetRange(index, desc.TotalSize));
                        break;
                    case 0x5:
                        ServerAddress.Deserialize(data.GetRange(index, desc.TotalSize));
                        break;
                    case 0x6:
                        AuthorizationCookie.Deserialize(data.GetRange(index, desc.TotalSize));
                        break;
                }

                index += desc.TotalSize;
            }

            TotalSize = index;
        }

        public override List<byte> Serialize()
        {
            var data = base.Serialize();

            data.AddRange(ServiceFamily.Serialize());
            data.AddRange(ServerAddress.Serialize());
            data.AddRange(AuthorizationCookie.Serialize());

            return data;
        }
    }
}


text:
author: chipoglesby
comments: true
date: 2009-04-22 02:18:00+00:00
layout: post
slug: from-the-desk-of
title: From the desk of...
wordpress_id: 275
categories:
- iPhone
---

[![](http://farm4.static.flickr.com/3572/3464624448_0605b8bf6c.jpg)](http://www.flickr.com/photos/chipoglesby/3464624448/)
[From the desk of...](http://www.flickr.com/photos/chipoglesby/3464624448/)
Originally uploaded by [chipoglesby](http://www.flickr.com/people/chipoglesby/)


text:
using LiteDB;
using MZBlog.Core.Documents;
using System.Collections.Generic;
using System.Linq;

namespace MZBlog.Core.ViewProjections.Home
{
    public class TagDetailViewProjection : IViewProjection<string, Tag>
    {
        private readonly Config _dbConfig;

        public TagDetailViewProjection(Config dbConfig)
        {
            _dbConfig = dbConfig;
        }

        public Tag Project(string input)
        {
            using (var _db = new LiteDatabase(_dbConfig.DbPath))
            {
                var tagCol = _db.GetCollection<Tag>(DBTableNames.Tags);
                var tag = tagCol.FindOne(x => x.Name == input);
                return tag;
            }
        }
    }

    public class TagsViewProjection : IViewProjection<IEnumerable<string>, IEnumerable<Tag>>
    {
        private readonly Config _dbConfig;

        public TagsViewProjection(Config dbConfig)
        {
            _dbConfig = dbConfig;
        }

        public IEnumerable<Tag> Project(IEnumerable<string> input)
        {
            using (var _db = new LiteDatabase(_dbConfig.DbPath))
            {
                var tagCol = _db.GetCollection<Tag>(DBTableNames.Tags);
                var tags = from slug in input
                           select tagCol.FindOne(x => x.Name == slug);
                return tags;
            }
        }
    }
}


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

namespace Velox.DB
{
    public interface ICodeQuerySpec
    {
        bool IsFilterMatch(object o);
        object ExpressionValue(object o);
        int Compare(object o1, object o2);
        IEnumerable<T> Range<T>(IEnumerable<T> objects);
    }
}


text:
using System;
using System.Reflection;
namespace OopExamAutomation.Engine
{
    public static class TypeExtensions
    {
        public static bool ConstructorThrowsException(this Type type, params object[] args)
        {
            try
            {
                var flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
                Activator.CreateInstance(type, flags, null, args, null);
            }
            catch
            {
                return true;
            }

            return false;
        }

        public static bool MethodThrowsArgumentException(this Type type, object obj, string methodName, params object[] args)
        {
            if (obj == null)
            {
                return false;
            }

            MethodInfo method = null;
            try
            {
                method = type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
            }
            catch (AmbiguousMatchException)
            {
                return false;
            }

            if (method == null)
            {
                return false;
            }

            try
            {
                method.Invoke(obj, args);
            }
            catch (TargetInvocationException ex)
            {
                return ex.InnerException is ArgumentException;
            }
            catch
            {
                return false;
            }

            return false;
        }

        public static object GetInstance(this Type type, params object[] args)
        {
            try
            {
                var flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
                return Activator.CreateInstance(type, flags, null, args, null);
            }
            catch
            {
                return null;
            }
        }

        public static T GetPropertyValue<T>(this object source, string property)
        {
            try
            {
                var value = source.GetType().GetProperty(property).GetValue(source, null);
                return (T)value;
            }
            catch
            {
                return default(T);
            }
        }

        public static void InvokeMethod(this Type type, object obj, string methodName, params object[] args)
        {
            MethodInfo method = null;
            try
            {
                method = type.GetMethod(methodName);
            }
            catch (AmbiguousMatchException)
            {
                return;
            }

            if (method == null)
            {
                return;
            }

            try
            {
                method.Invoke(obj, args);
            }
            catch (Exception)
            {
                return;
            }
        }

        public static object GetMethodValue(this Type type, object obj, string methodName, params object[] args)
        {
            MethodInfo method = null;
            try
            {
                method = type.GetMethod(methodName);
            }
            catch (AmbiguousMatchException)
            {
                return null;
            }

            if (method == null)
            {
                return null;
            }

            object val = null;
            try
            {
                val = method.Invoke(obj, args);
            }
            catch (Exception)
            {
                return null;
            }

            return val;
        }

        public static bool CheckMethodValue<T>(this Type type, object obj, string methodName, T expectedValue, params object[] args)
        {
            if (obj == null)
            {
                return false;
            }

            MethodInfo method = null;
            try
            {
                method = type.GetMethod(methodName);
            }
            catch (AmbiguousMatchException)
            {
                return false;
            }

            if (methodName == null)
            {
                return false;
            }

            object result;
            try
            {
                result = method.Invoke(obj, args);
            }
            catch(Exception ex)
            {
                return false;
            }

            if (result == null)
            {
                return false;
            }

            return result.Equals(expectedValue);
        }

        public static bool CheckPropertyValue<T>(this Type type, string propertyName, T expectedValue)
        {
            var obj = type.GetInstance();
            if (obj == null) return false;
            return obj.GetPropertyValue<T>(propertyName).Equals(expectedValue);
        }

        public static bool CheckPropertyValue<T>(this Type type, string propertyName, Func<T, bool> checkValue)
        {
            var obj = type.GetInstance();
            if (obj == null) return false;
            var propertyValue = obj.GetPropertyValue<T>(propertyName);
            if (propertyValue == null) return false;
            return checkValue(propertyValue);
        }
    }
}


text:
package org.apache.commons.bcel6.generic;

/**
 * Implement this interface if you're interested in changes to an InstructionList object
 * and register yourself with addObserver().
 *
 * @version $Id$
 */
public interface InstructionListObserver {

    void notify( InstructionList list );
}


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">

    <parent>
        <groupId>org.wso2.carbon</groupId>
        <artifactId>server-role-manager</artifactId>
        <version>4.3.0-SNAPSHOT</version>
	<relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.wso2.carbon</groupId>
    <artifactId>org.wso2.carbon.roles.mgt.ui</artifactId>
    <packaging>bundle</packaging>

    <name>WSO2 Carbon - Server-Roles Manager UI</name>
    <description>Server Roles Manager UI bunble for Carbon</description>
    <url>http://wso2.org</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-Vendor>WSO2 Inc</Bundle-Vendor>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Export-Package>
                            org.wso2.carbon.roles.mgt.ui.*
                        </Export-Package>
                        <Import-Package>
                            org.wso2.carbon.roles.mgt.stub.*;version="${carbon.platform.package.export.version}",
                            javax.servlet; version="${imp.pkg.version.javax.servlet}",
                            javax.servlet.http; version="${imp.pkg.version.javax.servlet}",
                            *;resolution:=optional
                        </Import-Package>
                        <Carbon-Component>UIBundle</Carbon-Component>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.axis2.wso2</groupId>
            <artifactId>axis2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.roles.mgt.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.ui</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

</project>


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

namespace Kinectanban.ViewModels
{
    public class MainWindowViewModel : ViewModelBase, IMainWindowViewModel
    {
        private ViewModelBase _selectedData;
        public ViewModelBase SelectedData
        {
            get
            {
                return _selectedData;
            }
            set
            {
                _selectedData = value;
                RaisePropertyChanged("SelectedData");
            }
        }
    }
}


text:
package com.signavio.warehouse.business.util.jpdl4;

import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.w3c.dom.NamedNodeMap;

public class Esb extends Node {

	private String category;
	private String service;
	private List<Part> part;

	public Esb(JSONObject esb) {

		this.name = JsonToJpdl.getAttribute(esb, "name");
		this.category = JsonToJpdl.getAttribute(esb, "category");
		this.service = JsonToJpdl.getAttribute(esb, "service");
		this.bounds = JsonToJpdl.getBounds(esb);

		this.part = new ArrayList<Part>();

		try {
			JSONArray parameters = esb.getJSONObject("properties")
					.getJSONObject("part").getJSONArray("items");
			for (int i = 0; i < parameters.length(); i++) {
				JSONObject item = parameters.getJSONObject(i);
				part.add(new Part(item));
			}
		} catch (JSONException e) {
		}

		this.outgoings = JsonToJpdl.getOutgoings(esb);
	}

	public Esb(org.w3c.dom.Node esb) {
		this.uuid = "oryx_" + UUID.randomUUID().toString();
		NamedNodeMap attributes = esb.getAttributes();
		this.name = JpdlToJson.getAttribute(attributes, "name");
		this.category = JpdlToJson.getAttribute(attributes, "category");
		this.service = JpdlToJson.getAttribute(attributes, "service");
		this.bounds = JpdlToJson.getBounds(attributes.getNamedItem("g"));
		// TODO add part
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public List<Part> getPart() {
		return part;
	}

	public void setPart(List<Part> part) {
		this.part = part;
	}

	public String getService() {
		return service;
	}

	public void setService(String service) {
		this.service = service;
	}

	@Override
	public String toJpdl() throws InvalidModelException {
		StringWriter jpdl = new StringWriter();
		jpdl.write("  <esb");

		jpdl.write(JsonToJpdl.transformAttribute("name", name));

		try {
			jpdl.write(JsonToJpdl.transformRequieredAttribute("category",
					category));
			jpdl.write(JsonToJpdl.transformRequieredAttribute("service",
					service));
		} catch (InvalidModelException e) {
			throw new InvalidModelException("Invalid Esb activity. "
					+ e.getMessage());
		}

		if (bounds != null) {
			jpdl.write(bounds.toJpdl());
		} else {
			throw new InvalidModelException(
					"Invalid ESB activity. Bounds is missing.");
		}

		jpdl.write(" >\n");

		for (Part p : part) {
			jpdl.write(p.toJpdl());
		}

		for (Transition t : outgoings) {
			jpdl.write(t.toJpdl());
		}

		jpdl.write("  </esb>\n\n");

		return jpdl.toString();
	}

	@Override
	public JSONObject toJson() throws JSONException {
		JSONObject stencil = new JSONObject();
		stencil.put("id", "esb");

		JSONArray outgoing = JpdlToJson.getTransitions(outgoings);

		JSONObject properties = new JSONObject();
		properties.put("bgcolor", "#ffffcc");
		if (name != null)
			properties.put("name", name);
		if (category != null)
			properties.put("category", category);
		if (service != null)
			properties.put("service", service);

		// TODO add parts

		JSONArray childShapes = new JSONArray();

		return JpdlToJson.createJsonObject(uuid, stencil, outgoing, properties,
				childShapes, bounds.toJson());
	}
}


text:
<?php
//ini_set( "display_errors" , 1 );
require_once('app_code/config.inc.php');
require_once('class/class.yui.php');
require_once( 'class/class.contacts.php');
require_once('app_code/zipcode.class.php');
require_once('app_code/class.Event_Contacts.php');
require_once('class/class.yui.php');
$page = new basic_page();

$page->auth->Checklogin();
$yui = new phpyui("/yui2/");
if( PHONE_SYSTEM == "asterisk"){
    require_once('class/class.asterisk.php');
    $asterisk = new Asterisk;
}
$uid = $page->auth->Get_user_id();
$yui->add_datatable( "asterisk" ,  "xml" , "temp.xml.php?user_id=$uid"  ,  array( 0 => array("key" => "call")) , array() , array( "RefreshEvery" => "1000")  );

  //  ini_set("display_errors" , 1 );
    if( PHONE_SYSTEM == 'asterisk'){
   $web = $asterisk->get_web_ext( $page->auth->Get_user_id() );
//      print_r( $web );
   }

?>

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

<link rel="stylesheet" type="text/css" href="/yui2/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="/yui2/tabview/assets/skins/sam/tabview.css" />
<link rel="stylesheet" type="text/css" href="/yui2/datatable/assets/skins/sam/datatable.css" >

<?php echo $yui->get_header(); ?>

    <?php
    $page -> setPageKeywords('');
$page -> setPageDescription('');
$page -> setPageTitle("IFRAME BACKUP");
$page -> setActiveButton('1');
$page -> setInnerNav('0');
//$page -> setImportCss1('main_style.css');
//$page -> setImportCss2('welcome.css');
//$page -> setImportCss3('form.css');

$page -> SetDynamicCSS_1('main_style.php');
$page -> SetDynamicCSS_2('form.php');
//$page -> SetDynamicCSS_1('main_style.php');
$page -> SetDynamicCSS_3('welcome_1.php');

$page -> setImportCss4('autocomplete/jssuggest.css');
$page -> setImportCss5('src/css/jscal2.css');
$page -> setImportCss6('src/css/border-radius.css');
$page -> setImportCss7('src/css/win2k/win2k.css');

$page -> setExtJavaScripts1(''); // might not need
$page -> setExtJavaScripts2(''); // might not need
$page -> setExtJavaScripts3(''); // might not need
$page -> setExtJavaScripts4('');
$page -> setExtJavaScripts5('');
$page ->setExtJavaScripts6('');
    	$page->printCharEncod();
	$page->printTitle();
	$page->printMetaAuthor();
	$page->printMetaKeywords();
    $page->printMetaDesc();
	$page->printFOUC();
	$page->printMainStyle();
	$page->printPageStyle();
	$page->printExtJavaScripts();
	$page->printCustomJavaScripts();
	$page->printHeadEnd();
    ?>

    <?php $onload .= "initiate_tabview();onload_helper();"; ?>
<?php
if( CHAT_SYSTEM == "ejabberd"){
    require_once( "class/class.ejabberd.php");
    $chat = new ejabberd;
    $chat->get_login($page->auth->Get_user_name());
    $onload .= "iJab.loginWithStatus( '" . $chat->username . "' , '" . $chat->password . "');";
    $arr = $chat->get_chats_by_contact("11079");
}
?>

<body style="overflow: auto;"  class="yui-skin-sam" id="main" onLoad="<?php echo $onload; ?>" >

    <?php echo $yui->get_body();?>

        <?php $page->printHeader(); ?>

   <button style="position: absolute; top: 10px; right: 400px;" onClick="toggle_sidebar()" >SideBar</button>
   <button style="position: absolute; top: 10px; right: 300px;" onClick="add_widget('SomeName' , 'My Title' , 'My Body <button>Test</button>')">AddWidget</button>

    <div style="color: white;align: center;v-align: center;position: relative;top: 0px;left: 0px;background: url(images/bluebar3.png) repeat-x;border:solid #a3a3a3;border-width:0 1px;height:32px;width:350px;background-position: top;text-align:centerWidgets

                    <?php
                    $widgetCT = 1;
                    while( $widgetCT < 30){

                    ?>
			<div id="Widget<?php echo $widgetCT; ?>" class="Rec" <?php if( $widgetCT > 3){ echo "style='display:none'";} ?> >

				<div id="WidgetHandle<?php echo $widgetCT; ?>" class="Handle">

				<div id="WidgetBody<?php echo $widgetCT; ?>"class="Info">

                    <?php
                    $widgetCT++;
                    } ?>

Email ID


text:
{{-- Pterodactyl - Panel --}}
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}

{{-- This software is licensed under the terms of the MIT license. --}}
{{-- https://opensource.org/licenses/MIT --}}
@extends('layouts.admin')

@section('title')
    Server — {{ $server->name }}: Details
@endsection

@section('content-header')

{{ $server->name }}Edit details for this server including owner and container.

Admin

Servers

id) }}">{{ $server->name }}

Details

@endsection

@section('content')
@include('admin.servers.partials.navigation')

Base Information

            <form action="{{ route('admin.servers.view.details', $server->id) }}" method="POST">

                        Server Name
                        <input type="text" name="name" value="{{ old('name', $server->name) }}" class="form-control" />

Character limits: a-zA-Z0-9_- and [Space].

                        External Identifier
                        <input type="text" name="external_id" value="{{ old('external_id', $server->external_id) }}" class="form-control" />

Leave empty to not assign an external identifier for this server. The external ID should be unique to this server and not be in use by any other servers.

                        Server Owner
                        <select name="owner_id" class="form-control" id="pUserId">
                            <option value="{{ $server->owner_id }}" selected>{{ $server->user->email }}</option>
                        </select>

You can change the owner of this server by changing this field to an email matching another use on this system. If you do this a new daemon security token will be generated automatically.

                        Server Description
                        <textarea name="description" rows="3" class="form-control">{{ old('description', $server->description) }}</textarea>

A brief description of this server.

                    {!! csrf_field() !!}
                    {!! method_field('PATCH') !!}
                    <input type="submit" class="btn btn-sm btn-primary" value="Update Details" />

            </form>

@endsection

@section('footer-scripts')
    @parent

@endsection


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.activiti.idm.engine.impl.interceptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Tijs Rademakers
 */
public class LogInterceptor extends AbstractCommandInterceptor {

  private static Logger log = LoggerFactory.getLogger(LogInterceptor.class);

  public <T> T execute(CommandConfig config, Command<T> command) {
    if (!log.isDebugEnabled()) {
      // do nothing here if we cannot log
      return next.execute(config, command);
    }
    log.debug("\n");
    log.debug("--- starting {} --------------------------------------------------------", command.getClass().getSimpleName());
    try {

      return next.execute(config, command);

    } finally {
      log.debug("--- {} finished --------------------------------------------------------", command.getClass().getSimpleName());
      log.debug("\n");
    }
  }
}


text:
```js
FlowRouter.path(path, params, qs);
```
 - `path` {*String*} - Path or Route's name
 - `params` {*Object*} - Serialized route parameters, `{ _id: 'str' }`
 - `qs` {*Object*} - Serialized query string, `{ key: 'val' }`
 - Returns {*String*} - URI

```js
const pathDef = '/blog/:cat/:id';
const params = { cat: 'met eor', id: 'abc' };
const queryParams = {show: 'y+e=s', color: 'black'};

const path = FlowRouter.path(pathDef, params, queryParams);
console.log(path); // --> "/blog/met%20eor/abc?show=y%2Be%3Ds&color=black"
```

If there are no `params` or `qs`, it will simply return the path as it is.

#### Further reading
 - [`.url()` method](https://github.com/VeliovGroup/flow-router/blob/master/docs/api/url.md)


text:
const {
  assertSame
} = Assert;

// Ensure tailcall removes intermediate caller from stack
{
  function returnCaller() {
    return returnCaller.caller;
  }

  function tail() {
    "use strict";
    return returnCaller();
  }

  function start() {
    let caller = tail();
    assertSame(start, caller);
  }

  start();
}

// Ensure tailcall removes intermediate caller from stack
{
  function returnCaller() {
    return returnCaller.caller;
  }

  function tail() {
    "use strict";
    return new returnCaller();
  }

  function start() {
    let caller = tail();
    assertSame(start, caller);
  }

  start();
}

// Ensure tailcall removes intermediate caller from stack (Function.prototype.call)
{
  function returnCaller() {
    return returnCaller.caller;
  }

  function tail() {
    "use strict";
    return returnCaller.call();
  }

  function start() {
    let caller = tail.call();
    assertSame(start, caller);
  }

  start();
}

// Ensure tailcall removes intermediate caller from stack (Function.prototype.apply)
{
  function returnCaller() {
    return returnCaller.caller;
  }

  function tail() {
    "use strict";
    return returnCaller.apply();
  }

  function start() {
    let caller = tail.apply();
    assertSame(start, caller);
  }

  start();
}

// Ensure tailcall removes intermediate caller from stack (mixed calls, user and native)
{
  function returnCaller() {
    return returnCaller.caller;
  }

  function tail() {
    "use strict";
    return returnCaller();
  }

  function start() {
    let caller = tail.call();
    assertSame(start, caller);
  }

  start();
}

// Ensure tailcall removes intermediate caller from stack (mixed calls, user and native)
{
  function returnCaller() {
    return returnCaller.caller;
  }

  function tail() {
    "use strict";
    return returnCaller.call();
  }

  function start() {
    let caller = tail();
    assertSame(start, caller);
  }

  start();
}

// Ensure tailcall removes intermediate caller from stack (mixed calls, only native)
{
  function returnCaller() {
    return returnCaller.caller;
  }

  function tail() {
    "use strict";
    return returnCaller.call();
  }

  function start() {
    let caller = tail.apply();
    assertSame(start, caller);
  }

  start();
}


text:
package edu.wsu.weather.agweathernet.helpers;

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

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import edu.wsu.weather.agweathernet.helpers.models.NewsEntry;

public class NewRSSHandler extends DefaultHandler {
	private NewsEntry currentEntry = new NewsEntry();
	private List<NewsEntry> newsList = new ArrayList<NewsEntry>();

	private StringBuffer chars = new StringBuffer();

	private int entriesMaxQuantity = 1000;
	private int entriesCount;

	@Override
	public void startElement(String uri, String localName, String qName,
			Attributes attributes) throws SAXException {
		chars = new StringBuffer();
	}

	@Override
	public void endElement(String uri, String localName, String qName)
			throws SAXException {
		if (localName.equalsIgnoreCase("title")) {
			currentEntry.setTitle(chars.toString());

		} else if (localName.equalsIgnoreCase("pubDate")) {
			currentEntry.setPubDate(chars.toString());

		} else if (localName.equalsIgnoreCase("link")) {
			currentEntry.setLink(chars.toString());

		} else if (localName.equalsIgnoreCase("description")) {
			currentEntry.setDescription(chars.toString());

		} else if (localName.equalsIgnoreCase("guid")) {
			currentEntry.setPermaLink(chars.toString());

		} else if (localName.equalsIgnoreCase("item")) {
			newsList.add(currentEntry);
			currentEntry = new NewsEntry();
			entriesCount++;
			if (entriesCount >= entriesMaxQuantity) {
				return;
			}
		}
	}

	public void characters(char ch[], int start, int length) {
		chars.append(new String(ch, start, length));
	}

	public int getEntriesMaxQuantity() {
		return entriesMaxQuantity;
	}

	public void setEntriesMaxQuantity(int entriesMaxQuantity) {
		this.entriesMaxQuantity = entriesMaxQuantity;
	}

	public List<NewsEntry> getList() {
		return newsList;
	}
}


text:
<?php

namespace Oro\Bundle\LocaleBundle\Tests\Unit\Datagrid\EventListener;

use Doctrine\ORM\QueryBuilder;
use Oro\Bundle\ConfigBundle\Config\ConfigManager;
use Oro\Bundle\DataGridBundle\Datagrid\DatagridInterface;
use Oro\Bundle\DataGridBundle\Datasource\DatasourceInterface;
use Oro\Bundle\DataGridBundle\Datasource\Orm\OrmDatasource;
use Oro\Bundle\DataGridBundle\Event\BuildAfter;
use Oro\Bundle\LocaleBundle\Datagrid\EventListener\EnabledLocalizationsGridListener;
use Oro\Bundle\LocaleBundle\DependencyInjection\Configuration;

class EnabledLocalizationsGridListenerTest extends \PHPUnit\Framework\TestCase
{
    /**
     * @var ConfigManager|\PHPUnit\Framework\MockObject\MockObject
     */
    private $configManager;

    /**
     * @var EnabledLocalizationsGridListener
     */
    private $listener;

    protected function setUp()
    {
        $this->configManager = $this->createMock(ConfigManager::class);
        $this->listener = new EnabledLocalizationsGridListener($this->configManager);
    }

    public function testOnBuildAfterWhenNoOrmDatasource()
    {
        $datasource = $this->createMock(DatasourceInterface::class);
        /** @var DatagridInterface|\PHPUnit\Framework\MockObject\MockObject $datagrid */
        $datagrid = $this->createMock(DatagridInterface::class);
        $datagrid->expects($this->once())
            ->method('getDatasource')
            ->willReturn($datasource);

        $this->configManager->expects($this->never())
            ->method('get');

        $event = new BuildAfter($datagrid);
        $this->listener->onBuildAfter($event);
    }

    public function testOnBuildAfter()
    {
        $enabledLocalizationIds = [1, 2];
        $queryBuilder = $this->createMock(QueryBuilder::class);
        $queryBuilder->expects($this->once())
            ->method('setParameter')
            ->with('ids', $enabledLocalizationIds);
        $datasource = $this->createMock(OrmDatasource::class);
        $datasource->expects($this->once())
            ->method('getQueryBuilder')
            ->willReturn($queryBuilder);
        /** @var DatagridInterface|\PHPUnit\Framework\MockObject\MockObject $datagrid */
        $datagrid = $this->createMock(DatagridInterface::class);
        $datagrid->expects($this->once())
            ->method('getDatasource')
            ->willReturn($datasource);

        $this->configManager->expects($this->once())
            ->method('get')
            ->with(
                Configuration::getConfigKeyByName(Configuration::ENABLED_LOCALIZATIONS),
                [],
                null,
                null
            )
            ->willReturn($enabledLocalizationIds);

        $event = new BuildAfter($datagrid);
        $this->listener->onBuildAfter($event);
    }
}


text:
package org.xmeta.thingManagers;

import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

import org.xmeta.Category;
import org.xmeta.ThingCoder;
import org.xmeta.ThingIndex;
import org.xmeta.ThingManager;
import org.xmeta.World;
import org.xmeta.XMetaException;

/**
 * Jar包分类。
 *
 * @author zhangyuxiang
 *
 */
public class JarCategory extends CachedCategory{
	public JarCategory(ThingManager thingManager, Category parentPackage, String name){
		super(thingManager, parentPackage, name);
	}

	@Override
	public String getFilePath() {
		return null;
	}

	@Override
	public void refresh() {
		JarThingManager jarThingManager = (JarThingManager) this.thingManager;
		if(jarThingManager.rootCategory == this){
			try{
				World world = World.getInstance();
				Enumeration<JarEntry> enumeration = jarThingManager.jarFile.entries();
		        while (enumeration.hasMoreElements()) {
		            JarEntry jarEntry = (JarEntry) enumeration.nextElement();
		            if(!jarEntry.isDirectory()){
		            	String jarEntryName = jarEntry.getName();
		            	int index = jarEntryName.lastIndexOf("/");
		            	String packageName = null;
		            	String fileName = null;
		            	if(index != -1){
		            		packageName = jarEntryName.substring(0, index);
		            		packageName = packageName.replace('/', '.');
		            		fileName = jarEntryName.substring(index + 1, jarEntryName.length());
		            	}else{
		            		fileName = jarEntryName;
		            	}

		            	index = fileName.indexOf(".");
		            	if(index != -1){
		            		String fileExt = fileName.substring(index + 1, fileName.length());
		            		ThingCoder thingCoder = world.getThingCoder(fileExt);
		            		if(thingCoder != null){
		            			String thingName = fileName.substring(0, index);
		            			if("".equals(thingName)) {
		            				continue;
		            			}
		            			initThingIndex(jarThingManager.jarFile, jarEntry, thingCoder, packageName, thingName, fileExt);
		            		}
		            	}
		            }
		        }
			}catch(IOException ioe){
				throw new XMetaException("refresh jarThingManager error, jarFile=" + jarThingManager.jarFile, ioe);
			}
		}
	}

	private void initThingIndex(JarFile jFile, JarEntry jarEntry, ThingCoder thingCoder, String packageName, String thingName, String fileExt) throws IOException{
		Category category = initCategory(packageName);
		CachedCategory cat = ((CachedCategory) category);
		for(ThingIndex index : cat.getThingIndexs()){
			//过滤目录下的重复事物,为什么会重复,目前还未知
			if(index.getThingName().equals(thingName)){
				return;
			}
		}

		ThingIndex thingIndex = new ThingIndex();
		InputStream in = jFile.getInputStream(jarEntry);
		try{
			//thingCoder.decodeIndex(thingIndex, in, jarEntry.getTime());
		}finally{
			in.close();
		}
		thingIndex.name = thingName;
		thingIndex.path = (packageName == null || "".equals(packageName)) ? thingName : (packageName + "." + thingName);
		thingIndex.thingManager = this.thingManager;
		thingIndex.lastModified = jarEntry.getTime();
		((CachedCategory) category).addThingIndex(thingIndex);
	}

	private Category initCategory(String packageName){
		JarThingManager jarThingManager = (JarThingManager) this.thingManager;
		Category category = null;
		if(packageName == null){
			category = jarThingManager.rootCategory;
		}else{
			Category parentPackage = jarThingManager.rootCategory;
			for(String pkName : packageName.split("[.]")){
				category = parentPackage.getCategory(pkName);
				if(category == null){
					String name = parentPackage.getName();
					if(name != null && !"".equals(name)){
						name = name + "." + pkName;
					}else{
						name = pkName;
					}
					category = new JarCategory(jarThingManager, parentPackage, name);
					((JarCategory) parentPackage).addCategory(category);
				}
				parentPackage = category;
			}
		}

		return category;
	}

	@Override
	public void refresh(boolean includeChild) {
		//这里不用调用refresh,JarThingManager只需要refresh一次
		refresh();
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:layout_marginTop="25dp"
    android:paddingStart="16dp"
    android:paddingEnd="16dp"
    android:paddingTop="8dp"
    android:paddingBottom="8dp">

    <ImageView
        android:id="@+id/img_avatar"
        android:layout_width="48dp"
        android:layout_height="48dp"
        tools:src="@drawable/default_avatar"/>

    <TextView
        android:id="@+id/text_username"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toEndOf="@id/img_avatar"
        android:layout_marginStart="16dp"
        android:maxLines="1"
        android:ellipsize="end"
        android:textColor="@color/primary_text"
        android:textSize="14sp"
        tools:text="系统公告"/>

    <TextView
        android:id="@+id/text_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:textColor="@color/secondary_text"
        android:textSize="12sp"
        tools:text="2017-12-28 17:56"/>

    <TextView
        android:id="@+id/text_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toEndOf="@id/img_avatar"
        android:layout_below="@id/text_username"
        android:layout_marginStart="16dp"
        android:layout_marginTop="4dp"
        android:maxLines="1"
        android:ellipsize="end"
        android:textColor="@color/secondary_text"
        android:textSize="14sp"
        tools:text="AC娘的新年扭蛋抽奖派送AC娘的新年扭蛋抽奖派送AC娘的新年扭蛋抽奖派送"/>

</RelativeLayout>


text:
<?php

namespace AppBundle\Factory\Common\Choices\Enum;

use AppBundle\Entity\Main\Article;
use AppBundle\Factory\Common\Choices\Base\TwigChoicesFactory;

class ArticleImageSizesFactory extends TwigChoicesFactory {

	public function __construct() {
		$this->items['label.article.imageSize.small'] = Article::SMALL_IMAGE;
		$this->items['label.article.imageSize.medium'] = Article::MEDIUM_IMAGE;
		$this->items['label.article.imageSize.large'] = Article::LARGE_IMAGE;
	}

	protected function getTwigFunctionName() {
		return 'articleImageSizeName';
	}
}


text:
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
package org.xbill.DNS;

import java.util.*;

/**
 * Recource Record Signature - An RRSIG provides the digital signature of an RRset, so that the data
 * can be authenticated by a DNSSEC-capable resolver. The signature is generated by a key contained
 * in a DNSKEY Record.
 * @see RRset
 * @see DNSSEC
 * @see KEYRecord
 * @author Brian Wellington
 */
public class RRSIGRecord extends SIGBase {
	private static final long serialVersionUID = -2609150673537226317L;

	RRSIGRecord() {
	}
	@Override
	Record getObject() {
		return new RRSIGRecord();
	}
	/**
	 * Creates an RRSIG Record from the given data
	 * @param covered The RRset type covered by this signature
	 * @param alg The cryptographic algorithm of the key that generated the signature
	 * @param origttl The original TTL of the RRset
	 * @param expire The time at which the signature expires
	 * @param timeSigned The time at which this signature was generated
	 * @param footprint The footprint/key id of the signing key.
	 * @param signer The owner of the signing key
	 * @param signature Binary data representing the signature
	 */
	public RRSIGRecord(Name name, int dclass, long ttl, int covered, int alg,
			long origttl, Date expire, Date timeSigned, int footprint,
			Name signer, byte[] signature) {
		super(name, Type.RRSIG, dclass, ttl, covered, alg, origttl, expire,
				timeSigned, footprint, signer, signature);
	}
}