text:
<?xml version="1.0" encoding="UTF-8"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>dnsjava</groupId>
    <artifactId>dnsjava</artifactId>
    <version>2.1.7</version>
    <name>dnsjava</name>
    <description>dnsjava is an implementation of DNS in Java. It supports all defined record types (including the DNSSEC types), and unknown types. It can be used for queries, zone transfers, and dynamic updates. It includes a cache which can be used by clients, and a minimal implementation of a server. It supports TSIG authenticated messages, partial DNSSEC verification, and EDNS0. </description>
    <url>http://www.dnsjava.org</url>
    <licenses>
        <license>
            <name>BSD 2-Clause license</name>
            <url>http://opensource.org/licenses/BSD-2-Clause</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:https://github.com/dnsjava/dnsjava</connection>
        <developerConnection>scm:git:git@github.com:dnsjava/dnsjava</developerConnection>
        <url>https://github.com/dnsjava/dnsjava</url>
        <tag>v2.1.6</tag>
    </scm>
    <developers>
        <developer>
            <id>bwelling</id>
            <name>Brian Wellington</name>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <target.jdk>1.4</target.jdk>
    </properties>

    <build>
        <sourceDirectory>./</sourceDirectory>
        <testSourceDirectory>./tests</testSourceDirectory>
        <resources>
            <resource>
                <directory>org/xbill/DNS/spi/</directory>
                <targetPath>META-INF</targetPath>
                <includes>
                    <include>services/</include>
                </includes>
            </resource>
        </resources>

        <plugins>

        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>${target.jdk}</source>
                    <target>${target.jdk}</target>
                    <encoding>iso8859-1</encoding>
                    <testExcludes>
                        <!-- Exclude unit tests with external dependencies -->
                        <exclude>**/DNSSECWithLunaProviderTest.java</exclude>
                    </testExcludes>
                    <includes>
                        <include>*.java</include>
                        <include>org/**/*.java</include>
                    </includes>
                    <excludes>
                        <exclude>org/xbill/DNS/tests/**</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <includes>
                        <include>*.java</include>
                        <include>org/**/*.java</include>
                    </includes>
                    <excludes>
                        <exclude>org/xbill/DNS/tests/</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <manifestEntries>
                            <Bundle-RequiredExecutionEnvironment>J2SE-1.4</Bundle-RequiredExecutionEnvironment>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.4.0</version>
                <configuration>
                    <instructions>
                        <Export-Package>org.xbill.DNS;uses:="org.xbill.DNS.util",org.xbill.DNS.spi;uses:="org.xbill.DNS,sun.net.spi.nameservice",org.xbill.DNS.utils,org.xbill.DNS.windows</Export-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <excludePackageNames>*.tests.*</excludePackageNames>
                    <sourcepath>./org</sourcepath>
                    <debug>true</debug>
                    <windowtitle>dnsjava documentation</windowtitle>
                    <footer></footer>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>


text:
package btools.router;

public class RoutingIslandException extends RuntimeException
{
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace App\Services\Transaction\Periodicity\Parser\Matchers;

use App\Models\Transaction;
use App\Models\TransactionPeriodicityOneShot;
use App\Repositories\Contracts\TransactionPeriodicityRepositoryContract;
use Carbon\Carbon;
use Illuminate\Support\Collection;

class OneShotMatcher
	implements MatcherContract {

	/**
	 * @var TransactionPeriodicityRepositoryContract
	 */
	protected $transactionPeriodicityRepository;

	/**
	 * @var Carbon[]
	 */
	public $dates;

	/**
	 * @param TransactionPeriodicityRepositoryContract $transactionPeriodicityRepository
	 */
	public function __construct(
		TransactionPeriodicityRepositoryContract $transactionPeriodicityRepository
	) {
		$this->transactionPeriodicityRepository = $transactionPeriodicityRepository;
	}

	/**
	 * @inheritDoc
	 */
	public function loadTransaction(Transaction $transaction): MatcherContract {
		$rows = $this->transactionPeriodicityRepository->getOneShotsByTransactionId($transaction->id);

		$this->dates = $rows->map(function (TransactionPeriodicityOneShot $row) {
			return $row->date;
		});

		return $this;
	}

	/**
	 * @inheritDoc
	 */
	public function filterRange(Carbon $dateFrom, Carbon $dateTo): MatcherContract {
		$filteredDates = [];

		foreach ($this->dates as $date) {
			if ($date >= $dateFrom && $date <= $dateTo) {
				$filteredDates[] = $date;
			}
		}

		$this->dates = $filteredDates;

		return $this;
	}

	/**
	 * @inheritDoc
	 */
	public function getMatchingDates(): Collection {
		return new Collection($this->dates);
	}

}


text:
if (!String.prototype.endsWith) {
  String.prototype.endsWith = function(searchString, position) {
      var subjectString = this.toString();
      if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
        position = subjectString.length;
      }
      position -= searchString.length;
      var lastIndex = subjectString.indexOf(searchString, position);
      return lastIndex !== -1 && lastIndex === position;
  };
}
chrome.runtime.sendMessage({greeting: "getsettings"}, function(response) {
  if(response.farewell && window.location.host.endsWith(response.farewell)) {
    console.log("I'm in production!")
    document.body.style.backgroundcolor="red";
  }
})


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

<title>CBRegion</title>
<meta name="date" content="2016-11-18">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.eyro.cubeacon

Class CBRegion

java.lang.Object

com.eyro.cubeacon.CBRegion

public final class CBRegion
extends java.lang.Object

This class represents a criteria of fields used to match beacons.

 The identifier field is used to distinguish this Region in the system.  When you set up
 monitoring or ranging based on a Region and later want to stop monitoring or ranging,
 you must do so by passing a Region object that has the same identifier field value.  If it
 doesn't match, you can't cancel the operation.  There is no other purpose to this field.

 The region can be constructed from a multi-part identifier.  The first identifier is the most
 significant, the second the second most significant, etc.

 When constructing a range, any or all of these identifiers may be set to null,
 which indicates that they are a wildcard and will match any value.

Version:

2.0.0

Author:

Eyro Labs

Constructor Summary

Constructors

Constructor and Description

CBRegion(java.lang.String identifier)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

CBRegion(java.lang.String identifier,
        java.util.UUID proximityUUID)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

CBRegion(java.lang.String identifier,
        java.util.UUID proximityUUID,
        java.lang.Integer major)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

CBRegion(java.lang.String identifier,
        java.util.UUID proximityUUID,
        java.lang.Integer major,
        java.lang.Integer minor)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

boolean
equals(java.lang.Object other)

java.lang.String
getIdentifier()

Returns the identifier used to start or stop ranging/monitoring this region.

java.lang.Integer
getMajor()

Returns the second most significant identifier (major)

java.lang.Integer
getMinor()

Returns the third most significant identifier (minor)

java.util.UUID
getProximityUUID()

Returns the most significant identifier (proximity UUID)

int
hashCode()

boolean
matchesBeacon(CBBeacon beacon)

Checks to see if an CBBeacon object is included in the matching criteria of this CBRegion

java.lang.String
toString()

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

CBRegion

public CBRegion(@NonNull
                java.lang.String identifier)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

Parameters:

identifier - A unique identifier used to cancel Ranging and Monitoring later,
                   or change the region being Ranged/Monitored

See Also:

CBRegion(String, UUID),
CBRegion(String, UUID, Integer),
CBRegion(String, UUID, Integer, Integer)

CBRegion

public CBRegion(@NonNull
                java.lang.String identifier,
                @Nullable
                java.util.UUID proximityUUID)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

Parameters:

identifier - A unique identifier used to cancel Ranging and Monitoring later,
                      or change the region being Ranged/Monitored

proximityUUID - The most significant identifier (can be null)

See Also:

CBRegion(String),
CBRegion(String, UUID, Integer),
CBRegion(String, UUID, Integer, Integer)

CBRegion

public CBRegion(@NonNull
                java.lang.String identifier,
                @Nullable
                java.util.UUID proximityUUID,
                @Nullable
                java.lang.Integer major)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

Parameters:

identifier - A unique identifier used to cancel Ranging and Monitoring later,
                      or change the region being Ranged/Monitored

proximityUUID - The most significant identifier (can be null)

major - The second most significant identifier (can be null)

See Also:

CBRegion(String),
CBRegion(String, UUID),
CBRegion(String, UUID, Integer, Integer)

CBRegion

public CBRegion(@NonNull
                java.lang.String identifier,
                @Nullable
                java.util.UUID proximityUUID,
                @Nullable
                java.lang.Integer major,
                @Nullable
                java.lang.Integer minor)

Constructs a new CBRegion object to be used for Ranging or Monitoring.

Parameters:

identifier - A unique identifier used to cancel Ranging and Monitoring later,
                      or change the region being Ranged/Monitored

proximityUUID - The most significant identifier (can be null)

major - The second most significant identifier (can be null)

minor - The third most significant identifier (can be null)

See Also:

CBRegion(String),
CBRegion(String, UUID),
CBRegion(String, UUID, Integer)

Method Detail

getIdentifier

public java.lang.String getIdentifier()

Returns the identifier used to start or stop ranging/monitoring this region.

Returns:

The unique identifier of region

getProximityUUID

public java.util.UUID getProximityUUID()

Returns the most significant identifier (proximity UUID)

Returns:

The most significant identifier (proximity UUID)

getMajor

public java.lang.Integer getMajor()

Returns the second most significant identifier (major)

Returns:

The second most significant identifier (major)

getMinor

public java.lang.Integer getMinor()

Returns the third most significant identifier (minor)

Returns:

The third most significant identifier (minor)

matchesBeacon

public boolean matchesBeacon(CBBeacon beacon)

Checks to see if an CBBeacon object is included in the matching criteria of this CBRegion

Parameters:

beacon - the beacon to check to see if it is in the Region

Returns:

<tt>true</tt> if it matches

hashCode

public int hashCode()

Overrides:

hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)

Overrides:

equals in class java.lang.Object

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

Skip navigation links

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package dynamodb

import (
	"context"
	"fmt"
	"strings"

	"github.com/Clever/wag/samples/v8/gen-go-db/models"
	"github.com/Clever/wag/samples/v8/gen-go-db/server/db"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/service/dynamodb"
	"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
	"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface"
	"github.com/go-openapi/strfmt"
)

var _ = strfmt.DateTime{}

// ThingWithCompositeAttributesTable represents the user-configurable properties of the ThingWithCompositeAttributes table.
type ThingWithCompositeAttributesTable struct {
	DynamoDBAPI        dynamodbiface.DynamoDBAPI
	Prefix             string
	TableName          string
	ReadCapacityUnits  int64
	WriteCapacityUnits int64
}

// ddbThingWithCompositeAttributesPrimaryKey represents the primary key of a ThingWithCompositeAttributes in DynamoDB.
type ddbThingWithCompositeAttributesPrimaryKey struct {
	NameBranch string          `dynamodbav:"name_branch"`
	Date       strfmt.DateTime `dynamodbav:"date"`
}

// ddbThingWithCompositeAttributesGSINameVersion represents the nameVersion GSI.
type ddbThingWithCompositeAttributesGSINameVersion struct {
	NameVersion string          `dynamodbav:"name_version"`
	Date        strfmt.DateTime `dynamodbav:"date"`
}

// ddbThingWithCompositeAttributes represents a ThingWithCompositeAttributes as stored in DynamoDB.
type ddbThingWithCompositeAttributes struct {
	models.ThingWithCompositeAttributes
}

func (t ThingWithCompositeAttributesTable) name() string {
	if t.TableName != "" {
		return t.TableName
	}
	return fmt.Sprintf("%s-thing-with-composite-attributess", t.Prefix)
}

func (t ThingWithCompositeAttributesTable) create(ctx context.Context) error {
	if _, err := t.DynamoDBAPI.CreateTableWithContext(ctx, &dynamodb.CreateTableInput{
		AttributeDefinitions: []*dynamodb.AttributeDefinition{
			{
				AttributeName: aws.String("date"),
				AttributeType: aws.String("S"),
			},
			{
				AttributeName: aws.String("name_branch"),
				AttributeType: aws.String("S"),
			},
			{
				AttributeName: aws.String("name_version"),
				AttributeType: aws.String("S"),
			},
		},
		KeySchema: []*dynamodb.KeySchemaElement{
			{
				AttributeName: aws.String("name_branch"),
				KeyType:       aws.String(dynamodb.KeyTypeHash),
			},
			{
				AttributeName: aws.String("date"),
				KeyType:       aws.String(dynamodb.KeyTypeRange),
			},
		},
		GlobalSecondaryIndexes: []*dynamodb.GlobalSecondaryIndex{
			{
				IndexName: aws.String("nameVersion"),
				Projection: &dynamodb.Projection{
					ProjectionType: aws.String("ALL"),
				},
				KeySchema: []*dynamodb.KeySchemaElement{
					{
						AttributeName: aws.String("name_version"),
						KeyType:       aws.String(dynamodb.KeyTypeHash),
					},
					{
						AttributeName: aws.String("date"),
						KeyType:       aws.String(dynamodb.KeyTypeRange),
					},
				},
				ProvisionedThroughput: &dynamodb.ProvisionedThroughput{
					ReadCapacityUnits:  aws.Int64(t.ReadCapacityUnits),
					WriteCapacityUnits: aws.Int64(t.WriteCapacityUnits),
				},
			},
		},
		ProvisionedThroughput: &dynamodb.ProvisionedThroughput{
			ReadCapacityUnits:  aws.Int64(t.ReadCapacityUnits),
			WriteCapacityUnits: aws.Int64(t.WriteCapacityUnits),
		},
		TableName: aws.String(t.name()),
	}); err != nil {
		return err
	}
	return nil
}

func (t ThingWithCompositeAttributesTable) saveThingWithCompositeAttributes(ctx context.Context, m models.ThingWithCompositeAttributes) error {
	data, err := encodeThingWithCompositeAttributes(m)
	if err != nil {
		return err
	}
	_, err = t.DynamoDBAPI.PutItemWithContext(ctx, &dynamodb.PutItemInput{
		TableName: aws.String(t.name()),
		Item:      data,
		ExpressionAttributeNames: map[string]*string{
			"#NAME_BRANCH": aws.String("name_branch"),
			"#DATE":        aws.String("date"),
		},
		ConditionExpression: aws.String("attribute_not_exists(#NAME_BRANCH) AND attribute_not_exists(#DATE)"),
	})
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case dynamodb.ErrCodeConditionalCheckFailedException:
				return db.ErrThingWithCompositeAttributesAlreadyExists{
					NameBranch: fmt.Sprintf("%s@%s", *m.Name, *m.Branch),
					Date:       *m.Date,
				}
			case dynamodb.ErrCodeResourceNotFoundException:
				return fmt.Errorf("table or index not found: %s", t.name())
			}
		}
		return err
	}
	return nil
}

func (t ThingWithCompositeAttributesTable) getThingWithCompositeAttributes(ctx context.Context, name string, branch string, date strfmt.DateTime) (*models.ThingWithCompositeAttributes, error) {
	key, err := dynamodbattribute.MarshalMap(ddbThingWithCompositeAttributesPrimaryKey{
		NameBranch: fmt.Sprintf("%s@%s", name, branch),
		Date:       date,
	})
	if err != nil {
		return nil, err
	}
	res, err := t.DynamoDBAPI.GetItemWithContext(ctx, &dynamodb.GetItemInput{
		Key:            key,
		TableName:      aws.String(t.name()),
		ConsistentRead: aws.Bool(true),
	})
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case dynamodb.ErrCodeResourceNotFoundException:
				return nil, fmt.Errorf("table or index not found: %s", t.name())
			}
		}
		return nil, err
	}

	if len(res.Item) == 0 {
		return nil, db.ErrThingWithCompositeAttributesNotFound{
			Name:   name,
			Branch: branch,
			Date:   date,
		}
	}

	var m models.ThingWithCompositeAttributes
	if err := decodeThingWithCompositeAttributes(res.Item, &m); err != nil {
		return nil, err
	}

	return &m, nil
}

func (t ThingWithCompositeAttributesTable) scanThingWithCompositeAttributess(ctx context.Context, input db.ScanThingWithCompositeAttributessInput, fn func(m *models.ThingWithCompositeAttributes, lastThingWithCompositeAttributes bool) bool) error {
	scanInput := &dynamodb.ScanInput{
		TableName:      aws.String(t.name()),
		ConsistentRead: aws.Bool(!input.DisableConsistentRead),
		Limit:          input.Limit,
	}
	if input.StartingAfter != nil {
		exclusiveStartKey, err := dynamodbattribute.MarshalMap(input.StartingAfter)
		if err != nil {
			return fmt.Errorf("error encoding exclusive start key for scan: %s", err.Error())
		}
		// must provide only the fields constituting the index
		scanInput.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{
			"name_branch": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s@%s", *input.StartingAfter.Name, *input.StartingAfter.Branch)),
			},
			"date": exclusiveStartKey["date"],
		}
	}
	totalRecordsProcessed := int64(0)
	var innerErr error
	err := t.DynamoDBAPI.ScanPagesWithContext(ctx, scanInput, func(out *dynamodb.ScanOutput, lastPage bool) bool {
		items, err := decodeThingWithCompositeAttributess(out.Items)
		if err != nil {
			innerErr = fmt.Errorf("error decoding %s", err.Error())
			return false
		}
		for i := range items {
			if input.Limiter != nil {
				if err := input.Limiter.Wait(ctx); err != nil {
					innerErr = err
					return false
				}
			}
			isLastModel := lastPage && i == len(items)-1
			if shouldContinue := fn(&items[i], isLastModel); !shouldContinue {
				return false
			}
			totalRecordsProcessed++
			// if the Limit of records have been passed to fn, don't pass anymore records.
			if input.Limit != nil && totalRecordsProcessed == *input.Limit {
				return false
			}
		}
		return true
	})
	if innerErr != nil {
		return innerErr
	}
	return err
}

func (t ThingWithCompositeAttributesTable) getThingWithCompositeAttributessByNameBranchAndDateParseFilters(queryInput *dynamodb.QueryInput, input db.GetThingWithCompositeAttributessByNameBranchAndDateInput) {
	for _, filterValue := range input.FilterValues {
		switch filterValue.AttributeName {
		case db.ThingWithCompositeAttributesVersion:
			queryInput.ExpressionAttributeNames["#VERSION"] = aws.String(string(db.ThingWithCompositeAttributesVersion))
			for i, attributeValue := range filterValue.AttributeValues {
				queryInput.ExpressionAttributeValues[fmt.Sprintf(":%s_value%d", string(db.ThingWithCompositeAttributesVersion), i)] = &dynamodb.AttributeValue{
					N: aws.String(fmt.Sprint(attributeValue.(int64))),
				}
			}
		}
	}
}

func (t ThingWithCompositeAttributesTable) getThingWithCompositeAttributessByNameBranchAndDate(ctx context.Context, input db.GetThingWithCompositeAttributessByNameBranchAndDateInput, fn func(m *models.ThingWithCompositeAttributes, lastThingWithCompositeAttributes bool) bool) error {
	if input.DateStartingAt != nil && input.StartingAfter != nil {
		return fmt.Errorf("Can specify only one of input.DateStartingAt or input.StartingAfter")
	}
	if input.Name == "" {
		return fmt.Errorf("Hash key input.Name cannot be empty")
	}
	if input.Branch == "" {
		return fmt.Errorf("Hash key input.Branch cannot be empty")
	}
	queryInput := &dynamodb.QueryInput{
		TableName: aws.String(t.name()),
		ExpressionAttributeNames: map[string]*string{
			"#NAME_BRANCH": aws.String("name_branch"),
		},
		ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
			":nameBranch": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s@%s", input.Name, input.Branch)),
			},
		},
		ScanIndexForward: aws.Bool(!input.Descending),
		ConsistentRead:   aws.Bool(!input.DisableConsistentRead),
	}
	if input.Limit != nil {
		queryInput.Limit = input.Limit
	}
	if input.DateStartingAt == nil {
		queryInput.KeyConditionExpression = aws.String("#NAME_BRANCH = :nameBranch")
	} else {
		queryInput.ExpressionAttributeNames["#DATE"] = aws.String("date")
		queryInput.ExpressionAttributeValues[":date"] = &dynamodb.AttributeValue{
			S: aws.String(toDynamoTimeString(*input.DateStartingAt)),
		}
		if input.Descending {
			queryInput.KeyConditionExpression = aws.String("#NAME_BRANCH = :nameBranch AND #DATE <= :date")
		} else {
			queryInput.KeyConditionExpression = aws.String("#NAME_BRANCH = :nameBranch AND #DATE >= :date")
		}
	}
	if input.StartingAfter != nil {
		queryInput.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{
			"date": &dynamodb.AttributeValue{
				S: aws.String(toDynamoTimeStringPtr(input.StartingAfter.Date)),
			},
			"name_branch": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s@%s", *input.StartingAfter.Name, *input.StartingAfter.Branch)),
			},
		}
	}
	if len(input.FilterValues) > 0 && input.FilterExpression != "" {
		t.getThingWithCompositeAttributessByNameBranchAndDateParseFilters(queryInput, input)
		queryInput.FilterExpression = aws.String(input.FilterExpression)
	}

	totalRecordsProcessed := int64(0)
	var pageFnErr error
	pageFn := func(queryOutput *dynamodb.QueryOutput, lastPage bool) bool {
		// Only assume an empty page means no more results if there are no filters applied
		if (len(input.FilterValues) == 0 || input.FilterExpression == "") && len(queryOutput.Items) == 0 {
			return false
		}
		items, err := decodeThingWithCompositeAttributess(queryOutput.Items)
		if err != nil {
			pageFnErr = err
			return false
		}
		hasMore := true
		for i := range items {
			if lastPage == true {
				hasMore = i < len(items)-1
			}
			if !fn(&items[i], !hasMore) {
				return false
			}
			totalRecordsProcessed++
			// if the Limit of records have been passed to fn, don't pass anymore records.
			if input.Limit != nil && totalRecordsProcessed == *input.Limit {
				return false
			}
		}
		return true
	}

	err := t.DynamoDBAPI.QueryPagesWithContext(ctx, queryInput, pageFn)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case dynamodb.ErrCodeResourceNotFoundException:
				return fmt.Errorf("table or index not found: %s", t.name())
			}
		}
		return err
	}
	if pageFnErr != nil {
		return pageFnErr
	}

	return nil
}

func (t ThingWithCompositeAttributesTable) deleteThingWithCompositeAttributes(ctx context.Context, name string, branch string, date strfmt.DateTime) error {
	key, err := dynamodbattribute.MarshalMap(ddbThingWithCompositeAttributesPrimaryKey{
		NameBranch: fmt.Sprintf("%s@%s", name, branch),
		Date:       date,
	})
	if err != nil {
		return err
	}
	_, err = t.DynamoDBAPI.DeleteItemWithContext(ctx, &dynamodb.DeleteItemInput{
		Key:       key,
		TableName: aws.String(t.name()),
	})
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case dynamodb.ErrCodeResourceNotFoundException:
				return fmt.Errorf("table or index not found: %s", t.name())
			}
		}
		return err
	}

	return nil
}

func (t ThingWithCompositeAttributesTable) getThingWithCompositeAttributessByNameVersionAndDate(ctx context.Context, input db.GetThingWithCompositeAttributessByNameVersionAndDateInput, fn func(m *models.ThingWithCompositeAttributes, lastThingWithCompositeAttributes bool) bool) error {
	if input.DateStartingAt != nil && input.StartingAfter != nil {
		return fmt.Errorf("Can specify only one of input.DateStartingAt or input.StartingAfter")
	}
	if input.Name == "" {
		return fmt.Errorf("Hash key input.Name cannot be empty")
	}
	queryInput := &dynamodb.QueryInput{
		TableName: aws.String(t.name()),
		IndexName: aws.String("nameVersion"),
		ExpressionAttributeNames: map[string]*string{
			"#NAME_VERSION": aws.String("name_version"),
		},
		ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
			":nameVersion": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s:%d", input.Name, input.Version)),
			},
		},
		ScanIndexForward: aws.Bool(!input.Descending),
		ConsistentRead:   aws.Bool(false),
	}
	if input.Limit != nil {
		queryInput.Limit = input.Limit
	}
	if input.DateStartingAt == nil {
		queryInput.KeyConditionExpression = aws.String("#NAME_VERSION = :nameVersion")
	} else {
		queryInput.ExpressionAttributeNames["#DATE"] = aws.String("date")
		queryInput.ExpressionAttributeValues[":date"] = &dynamodb.AttributeValue{
			S: aws.String(toDynamoTimeString(*input.DateStartingAt)),
		}
		if input.Descending {
			queryInput.KeyConditionExpression = aws.String("#NAME_VERSION = :nameVersion AND #DATE <= :date")
		} else {
			queryInput.KeyConditionExpression = aws.String("#NAME_VERSION = :nameVersion AND #DATE >= :date")
		}
	}
	if input.StartingAfter != nil {
		queryInput.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{
			"date": &dynamodb.AttributeValue{
				S: aws.String(toDynamoTimeStringPtr(input.StartingAfter.Date)),
			},
			"name_version": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s:%d", *input.StartingAfter.Name, input.StartingAfter.Version)),
			},
			"name_branch": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s@%s", *input.StartingAfter.Name, *input.StartingAfter.Branch)),
			},
		}
	}

	totalRecordsProcessed := int64(0)
	var pageFnErr error
	pageFn := func(queryOutput *dynamodb.QueryOutput, lastPage bool) bool {
		if len(queryOutput.Items) == 0 {
			return false
		}
		items, err := decodeThingWithCompositeAttributess(queryOutput.Items)
		if err != nil {
			pageFnErr = err
			return false
		}
		hasMore := true
		for i := range items {
			if lastPage == true {
				hasMore = i < len(items)-1
			}
			if !fn(&items[i], !hasMore) {
				return false
			}
			totalRecordsProcessed++
			// if the Limit of records have been passed to fn, don't pass anymore records.
			if input.Limit != nil && totalRecordsProcessed == *input.Limit {
				return false
			}
		}
		return true
	}

	err := t.DynamoDBAPI.QueryPagesWithContext(ctx, queryInput, pageFn)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case dynamodb.ErrCodeResourceNotFoundException:
				return fmt.Errorf("table or index not found: %s", t.name())
			}
		}
		return err
	}
	if pageFnErr != nil {
		return pageFnErr
	}

	return nil
}
func (t ThingWithCompositeAttributesTable) scanThingWithCompositeAttributessByNameVersionAndDate(ctx context.Context, input db.ScanThingWithCompositeAttributessByNameVersionAndDateInput, fn func(m *models.ThingWithCompositeAttributes, lastThingWithCompositeAttributes bool) bool) error {
	scanInput := &dynamodb.ScanInput{
		TableName:      aws.String(t.name()),
		ConsistentRead: aws.Bool(!input.DisableConsistentRead),
		Limit:          input.Limit,
		IndexName:      aws.String("nameVersion"),
	}
	if input.StartingAfter != nil {
		exclusiveStartKey, err := dynamodbattribute.MarshalMap(input.StartingAfter)
		if err != nil {
			return fmt.Errorf("error encoding exclusive start key for scan: %s", err.Error())
		}
		// must provide the fields constituting the index and the primary key
		// https://stackoverflow.com/questions/40988397/dynamodb-pagination-with-withexclusivestartkey-on-a-global-secondary-index
		scanInput.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{
			"name_branch": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s@%s", *input.StartingAfter.Name, *input.StartingAfter.Branch)),
			},
			"date": exclusiveStartKey["date"],
			"name_version": &dynamodb.AttributeValue{
				S: aws.String(fmt.Sprintf("%s:%d", *input.StartingAfter.Name, input.StartingAfter.Version)),
			},
		}
	}
	totalRecordsProcessed := int64(0)
	var innerErr error
	err := t.DynamoDBAPI.ScanPagesWithContext(ctx, scanInput, func(out *dynamodb.ScanOutput, lastPage bool) bool {
		items, err := decodeThingWithCompositeAttributess(out.Items)
		if err != nil {
			innerErr = fmt.Errorf("error decoding %s", err.Error())
			return false
		}
		for i := range items {
			if input.Limiter != nil {
				if err := input.Limiter.Wait(ctx); err != nil {
					innerErr = err
					return false
				}
			}
			isLastModel := lastPage && i == len(items)-1
			if shouldContinue := fn(&items[i], isLastModel); !shouldContinue {
				return false
			}
			totalRecordsProcessed++
			// if the Limit of records have been passed to fn, don't pass anymore records.
			if input.Limit != nil && totalRecordsProcessed == *input.Limit {
				return false
			}
		}
		return true
	})
	if innerErr != nil {
		return innerErr
	}
	return err
}

// encodeThingWithCompositeAttributes encodes a ThingWithCompositeAttributes as a DynamoDB map of attribute values.
func encodeThingWithCompositeAttributes(m models.ThingWithCompositeAttributes) (map[string]*dynamodb.AttributeValue, error) {
	val, err := dynamodbattribute.MarshalMap(ddbThingWithCompositeAttributes{
		ThingWithCompositeAttributes: m,
	})
	if err != nil {
		return nil, err
	}
	// make sure composite attributes don't contain separator characters
	if strings.Contains(*m.Name, ":") {
		return nil, fmt.Errorf("name cannot contain ':': %s", *m.Name)
	}
	if strings.Contains(*m.Branch, "@") {
		return nil, fmt.Errorf("branch cannot contain '@': %s", *m.Branch)
	}
	if strings.Contains(*m.Name, "@") {
		return nil, fmt.Errorf("name cannot contain '@': %s", *m.Name)
	}
	// add in composite attributes
	primaryKey, err := dynamodbattribute.MarshalMap(ddbThingWithCompositeAttributesPrimaryKey{
		NameBranch: fmt.Sprintf("%s@%s", *m.Name, *m.Branch),
		Date:       *m.Date,
	})
	if err != nil {
		return nil, err
	}
	for k, v := range primaryKey {
		val[k] = v
	}
	nameVersion, err := dynamodbattribute.MarshalMap(ddbThingWithCompositeAttributesGSINameVersion{
		NameVersion: fmt.Sprintf("%s:%d", *m.Name, m.Version),
		Date:        *m.Date,
	})
	if err != nil {
		return nil, err
	}
	for k, v := range nameVersion {
		val[k] = v
	}
	return val, err
}

// decodeThingWithCompositeAttributes translates a ThingWithCompositeAttributes stored in DynamoDB to a ThingWithCompositeAttributes struct.
func decodeThingWithCompositeAttributes(m map[string]*dynamodb.AttributeValue, out *models.ThingWithCompositeAttributes) error {
	var ddbThingWithCompositeAttributes ddbThingWithCompositeAttributes
	if err := dynamodbattribute.UnmarshalMap(m, &ddbThingWithCompositeAttributes); err != nil {
		return err
	}
	*out = ddbThingWithCompositeAttributes.ThingWithCompositeAttributes
	return nil
}

// decodeThingWithCompositeAttributess translates a list of ThingWithCompositeAttributess stored in DynamoDB to a slice of ThingWithCompositeAttributes structs.
func decodeThingWithCompositeAttributess(ms []map[string]*dynamodb.AttributeValue) ([]models.ThingWithCompositeAttributes, error) {
	thingWithCompositeAttributess := make([]models.ThingWithCompositeAttributes, len(ms))
	for i, m := range ms {
		var thingWithCompositeAttributes models.ThingWithCompositeAttributes
		if err := decodeThingWithCompositeAttributes(m, &thingWithCompositeAttributes); err != nil {
			return nil, err
		}
		thingWithCompositeAttributess[i] = thingWithCompositeAttributes
	}
	return thingWithCompositeAttributess, nil
}


text:
.. _quickstart:

Quickstart
==========

Eager to get started? This guide will help you get started managing your Dyn
services using this module.

If you have not already, :ref:`Install <install>` the Dyn module before proceeding further.

It is also important to understand that this library handles interacting with
both Traffic Management (TM) and Message Management (MM) services. For both
TM and MM, you will need to create Session objects to handle API interactions,
processing API responses, and creating the various objects described
in the :ref:`TM <dyn-tm>` and :ref:`MM <dyn-mm>` API documentation sections.

Here are some simple examples to get you started.

Authentication
--------------
API sessions will need to be created each time you use either of these libraries.
These session objects internally manage interaction with the API.

To create a TM DynectSession, begin by importing the tm.session module::

    >>> from dyn.tm.session import DynectSession

Now create an instance of a DynectSession by using our Dyn
login credentials::

    >>> my_session = DynectSession(customer, username, password)

Now you have a :class:`DynectSession` object called ``my_session``. You will be
able to use this to access your available resources.

For MM, you can import and create an :class:`MMSession` from the mm.session
module::

    >>> from dyn.mm.session import MMSession

Now create an instance of this session by providing it an API Key::

    >>> mm_session = MMSession(my_api_key)

This object will now grant you access to the features provided by the Email API.

Managing Your TM Accounts
-------------------------
The new wrapper allows you easy access to managing all of the elements within
your account, such as new :class:`Users` objects::

    >>> from dyn.tm.accounts import User
    >>> jsmith = User('jsmith')
    >>> jsmith.status
    u'blocked'
    >>> jsmith.unblock()
    >>> jsmith.status
    u'active'
    >>> jsmith.get_permissions_report()
    ['ZoneAdd', 'ZoneDelete', 'Login']
    >>> jsmith.add_permission('ZoneGet')
    >>> jsmith.get_permissions_report()
    ['ZoneAdd', 'ZoneDelete', 'Login', 'ZoneGet']

You can also create new :class:`PermissionGroups` that can later be applied to
:class:`User` objects
::

    >>> from dyn.tm.accounts import PermissionsGroup
    >>> sample = PermissionsGroup('Sample', 'Sample permission Group')
    >>> sample.add_permissions('DSFAdd')
    >>> sample.add_permissions('DSFGet')
    >>> sample.add_permissions('DSFDelete')
    >>> sample.add_zone('mysite.com')

Using your Zones
----------------
Using your current session you can create a new zone::

    >>> from dyn.tm.zones import Zone
    >>> my_zone = Zone('mysite.com', 'myemail@email.com')

You can also access your previously created zones::

    >>> my_old_zone = Zone('example.com')

Using these :class:`Zone` objects you can begin to manipulate your zones,
such as, adding a record::

    >>> a_rec = my_zone.add_record('node', 'A', '127.0.0.1')
    >>> a_rec.ip
    u'127.0.0.1'
    >>> a_rec.fqdn
    u'node.mysite.com.'
    >>> a_rec.get_all_records()
    {'a_records': [127.0.0.1], 'aaaa_records': [], ...}

TM Services
-----------
Try adding a :class:`DynamicDNS` service to your zone::

    >>> ddns = my_zone.add_service(service_type='DDNS', record_type='A',
    ...                            address='127.0.0.1')
    >>> ddns.zone
    u'mysite.com'
    >>> ddns.active
    u'Y'

TM Errors and Exceptions
------------------------
In the event of an authentication problem, dyn.tm will raise a
:class:`~dyn.tm.errors.DynectAuthError` exception.

In the event an error in an API Creation is encountered, dyn.tm will
raise a :class:`~dyn.tm.errors.DynectCreateError` exception with
additional information about why the POST failed.

In the event an error in an API Update is encountered, dyn.tm will
raise a :class:`~dyn.tm.errors.DynectUpdateError` exception with
additional information about why the PUT failed.

In the event an error in an API Get is encountered, dyn.tm will
raise a :class:`~dyn.tm.errors.DynectGetError` exception with
additional information about why the GET failed.

In the event an error in an API Deletion is encountered, dyn.tm will
raise a :class:`~dyn.tm.errors.DynectDeleteError` exception with
additional information about why the DELETE failed.

In the event an error in an API request returns with an incomplete status (i.e.
the requested job has not yet completed) the wrapper will poll until either the
job has completed or the polling times out. In such an event,
dyn.tm will raise a :class:`~dyn.tm.errors.DynectQueryTimeout`
exception

All exceptions that dyn.tm explicitly raises inherit from
:class:`dyn.tm.errors.DynectError`.

MM Errors and Exceptions
------------------------
In the event that an invalid API Key is provided to your :class:`MMSession` an
:class:`~dyn.mm.errors.EmailKeyError` exception will be raised.

If you passed an invalid argument to one of the provided MM objects, a
:class:`~dyn.mm.errors.DynInvalidArgumentError` exception is raised.

The :class:`~dyn.mm.errors.DynInvalidArgumentError` should not be confused with
the :class:`~dyn.mm.errors.EmailInvalidArgumentError`. The latter is raised if a
required field is not provided. This is an unlikely exception to be raised
as the error would likely be raised as
:class:`~dyn.mm.errors.DynInvalidArgumentError`. However, it is still a possible
scenario.

The :class:`~dyn.mm.errors.EmailObjectError` will be raised if you
attempt to create an object that already exists on the Dyn MM system.

All MM exceptions inherit from :class:`~dyn.mm.errors.EmailError`

-----------------------

Ready for more? Check out the :ref:`TM <dyn-tm>` and :ref:`MM <dyn-mm>`
module documentation sections, the full
`TM API Documentation <https://help.dynect.net/rest-resources/>`_ or the
`MM API Documentation <https://help.dynect.net/api/>`_.


text:
<?php
/**
 * PHPTAL templating engine
 *
 * PHP Version 5
 *
 * @category HTML
 * @package  PHPTAL
 * @author   Kornel Lesiński <kornel@aardvarkmedia.co.uk>
 * @license  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 * @version  SVN: $Id: $
 * @link     http://phptal.org/
 */

/**
 * Collapses conscutive whitespace, trims attributes, merges adjacent text nodes
 */
class PHPTAL_PreFilter_Normalize extends PHPTAL_PreFilter
{
    function filter($src)
    {
        return str_replace("\r\n", "\n", $src);
    }

    function filterDOM(PHPTAL_Dom_Element $root)
    {
        // let xml:space=preserve preserve attributes as well
        if ($root->getAttributeNS("http://www.w3.org/XML/1998/namespace", 'space') == 'preserve') {
            $this->findElementToFilter($root);
            return;
        }

        $this->normalizeAttributes($root);

        // <pre> may have attributes normalized
        if ($this->isSpaceSensitiveInXHTML($root)) {
            $this->findElementToFilter($root);
            return;
        }

        $lastTextNode = null;
        foreach ($root->childNodes as $node) {

            // CDATA is not normalized by design
            if ($node instanceof PHPTAL_Dom_Text) {
                $norm = $this->normalizeSpace($node->getValueEscaped(), $node->getEncoding());
                $node->setValueEscaped($norm);

                if ('' === $norm) {
                    $root->removeChild($node);
                } else if ($lastTextNode) {
                    // "foo " . " bar" gives 2 spaces.
                    $norm = $lastTextNode->getValueEscaped().ltrim($norm,' ');

                    $lastTextNode->setValueEscaped($norm); // assumes all nodes use same encoding (they do)
                    $root->removeChild($node);
                } else {
                    $lastTextNode = $node;
                }
            } else {
                $lastTextNode = null;
                if ($node instanceof PHPTAL_Dom_Element) {
                    $this->filterDOM($node);
                }
            }
        }
    }

    protected function isSpaceSensitiveInXHTML(PHPTAL_Dom_Element $element)
    {
        $ln = $element->getLocalName();
        return ($ln === 'script' || $ln === 'pre' || $ln === 'textarea')
            && ($element->getNamespaceURI() === 'http://www.w3.org/1999/xhtml' || $element->getNamespaceURI() === '');
    }

    protected function findElementToFilter(PHPTAL_Dom_Element $root)
    {
        foreach ($root->childNodes as $node) {
            if (!$node instanceof PHPTAL_Dom_Element) continue;

            if ($node->getAttributeNS("http://www.w3.org/XML/1998/namespace", 'space') == 'default') {
                $this->filterDOM($node);
            }
        }
    }

    /**
     * does not trim
     */
    protected function normalizeSpace($text, $encoding)
    {
        $utf_regex_mod = ($encoding=='UTF-8'?'u':'');

        return preg_replace('/\s+/'.$utf_regex_mod, ' ', $text);
    }

    protected function normalizeAttributes(PHPTAL_Dom_Element $element)
    {
        foreach ($element->getAttributeNodes() as $attrnode) {

            // skip replaced attributes (because getValueEscaped on them is meaningless)
            if ($attrnode->getReplacedState() !== PHPTAL_Dom_Attr::NOT_REPLACED) continue;

            $val = $this->normalizeSpace($attrnode->getValueEscaped(), $attrnode->getEncoding());
            $attrnode->setValueEscaped(trim($val, ' '));
        }
    }
}


text:
package com.sequenceiq.it.cloudbreak.util;

import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;

import org.opentest4j.MultipleFailuresError;
import org.opentest4j.TestAbortedException;

public class RetryOnGatewayTimeout {

    private static final String OUT_OF_ATTEMPTS_MESSAGE = "Ran out of retries but still getting timeout from the API.";

    private static final List<WebApplicationException> STORED_EXCEPTIONS = new LinkedList<>();

    private RetryOnGatewayTimeout() {
    }

    /**
     * Executes the provided function and returns it's return value – if has – but retries the execution by the provided amount if a
     * WebApplicationException occurs with a status code 504.
     * If this 504 happens all the time and the retry mechanism runs out of attempt quantity then it will throw a
     * {@code org.opentest4j.MultipleFailuresError} which contains all the previous exception's message.
     *
     * @param method          The method which has to be executed.
     * @param attemptQuantity The maximum amount of attempts what is going to happen if comes an 504.
     * @param <T>             The type of the return value of the provided function.
     * @return                The output value of the given function.
     */
    public static <T> T retry(Callable<T> method, int attemptQuantity) {
        try {
            return doRetryAndReturn(method, attemptQuantity);
        } catch (WebApplicationException e) {
            STORED_EXCEPTIONS.add(e);
            return processResult(e, method, attemptQuantity);
        } catch (Exception e) {
            throw new TestAbortedException("Unexpected exception has occured.", e);
        }
    }

    /**
     * Executes the provided function but retries the execution by the provided amount if a WebApplicationException occurs with a status code 504.
     * If this 504 happens all the time and the retry mechanism runs out of attempt quantity then it will throw a
     * {@code org.opentest4j.MultipleFailuresError} which contains all the previous exception's message.
     *
     * @param method          The method which has to be executed.
     * @param attemptQuantity The maximum amount of attempts what is going to happen if comes an 504.
     */
    public static void retry(Runnable method, int attemptQuantity) {
        try {
            doRetry(method, attemptQuantity);
        } catch (WebApplicationException e) {
            STORED_EXCEPTIONS.add(e);
            if (isResponseGatewayTimedOut(e)) {
                attemptQuantity--;
                retry(method, attemptQuantity);
            } else {
                throw e;
            }
        }
    }

    private static <T> T processResult(WebApplicationException e, Callable<T> method, int attemptQuantity) {
        if (!isResponseGatewayTimedOut(e)) {
            throw e;
        }
        attemptQuantity--;
        return retry(method, attemptQuantity);

    }

    private static <T> T doRetryAndReturn(Callable<T> method, int attemptQuantity) throws Exception {
        if (attemptQuantity > 0) {
            return method.call();
        } else {
            throw new MultipleFailuresError(OUT_OF_ATTEMPTS_MESSAGE, STORED_EXCEPTIONS);
        }
    }

    private static void doRetry(Runnable method, int attemptQuantity) {
        if (attemptQuantity > 0) {
            method.run();
        } else {
            throw new MultipleFailuresError(OUT_OF_ATTEMPTS_MESSAGE, STORED_EXCEPTIONS);
        }
    }

    private static boolean isResponseGatewayTimedOut(WebApplicationException e) {
        try (Response response = e.getResponse()) {
            return response.getStatus() == HttpServletResponse.SC_GATEWAY_TIMEOUT;
        }
    }

}


text:
package org.fastcatsearch.http.action.management.settings;

import java.io.Writer;

import org.fastcatsearch.db.DBService;
import org.fastcatsearch.db.InternalDBModule.MapperSession;
import org.fastcatsearch.db.mapper.UserAccountMapper;
import org.fastcatsearch.db.vo.UserAccountVO;
import org.fastcatsearch.http.ActionAuthority;
import org.fastcatsearch.http.ActionAuthorityLevel;
import org.fastcatsearch.http.ActionMapping;
import org.fastcatsearch.http.action.ActionRequest;
import org.fastcatsearch.http.action.ActionResponse;
import org.fastcatsearch.http.action.AuthAction;
import org.fastcatsearch.util.ResponseWriter;

@ActionMapping(value = "/settings/authority/update-user", authority = ActionAuthority.Settings, authorityLevel = ActionAuthorityLevel.WRITABLE)
public class PutUserAccountAction extends AuthAction {

	private static final int MODE_INSERT = 1;
	private static final int MODE_UPDATE = 2;

	@Override
	public void doAuthAction(ActionRequest request, ActionResponse response) throws Exception {

		Writer writer = response.getWriter();
		ResponseWriter resultWriter = getDefaultResponseWriter(writer);

		MapperSession<UserAccountMapper> userAccountSession = null;

		try {

			userAccountSession = DBService.getInstance().getMapperSession(UserAccountMapper.class);

			UserAccountMapper userAccountMapper = (UserAccountMapper) userAccountSession.getMapper();

			if (userAccountMapper != null) {
				String mode = request.getParameter("mode");

				if (("update").equals(mode)) {

					int id = request.getIntParameter("id", -1);
					String userName = request.getParameter("name");
					String userId = request.getParameter("userId");
					String password = request.getParameter("password");
					String confirmPassword = request.getParameter("confirmPassword");
					String email = request.getParameter("email");
					String sms = request.getParameter("sms");
					int groupId = request.getIntParameter("groupId", 0);

					UserAccountVO vo = null;

					int updateMode = 0;

					synchronized (userAccountMapper) {
						boolean doChangePassword = false;

						if (id != -1) {
							vo = userAccountMapper.getEntry(id);
							if (vo != null) {
								updateMode = MODE_UPDATE;
								if (password == null || "".equals(password) || !password.equals(confirmPassword)) {
									doChangePassword = true;
								}
							}
						} else {

							vo = new UserAccountVO();
							vo.id = id;

							updateMode = MODE_INSERT;
						}

						vo.name = userName;
						vo.userId = userId;
						if(!doChangePassword){
							vo.setEncryptedPassword(password);
						}
						vo.email = email;
						vo.sms = sms;
						vo.groupId = groupId;

						if (updateMode == MODE_UPDATE) {
							userAccountMapper.updateEntry(vo);
						} else if (updateMode == MODE_INSERT) {
							userAccountMapper.putEntry(vo);
						}
					}
				} else if ("delete".equals(mode)) {
					int id = request.getIntParameter("id", 0);
					userAccountMapper.deleteEntry(id);
				}

				resultWriter.object().key("success").value("true").key("status").value(1).endObject();

			}
		} catch (Exception e) {
			logger.error("", e);
			resultWriter.object().key("success").value("false").key("status").value(1).endObject();
		} finally {
			if (userAccountSession != null)
				try {
					userAccountSession.commit();
					userAccountSession.closeSession();
				} catch (Exception e) {
				}
		}
		resultWriter.done();
	}
}


text:
namespace org.apache.lucene.analysis.payloads
{

	using ArrayUtil = org.apache.lucene.util.ArrayUtil;
	using BytesRef = org.apache.lucene.util.BytesRef;

	/// <summary>
	///  Encode a character array Integer as a <seealso cref="BytesRef"/>.
	/// <p/>
	/// See <seealso cref="org.apache.lucene.analysis.payloads.PayloadHelper#encodeInt(int, byte[], int)"/>.
	///
	///
	/// </summary>
	public class IntegerEncoder : AbstractEncoder, PayloadEncoder
	{

	  public override BytesRef encode(char[] buffer, int offset, int length)
	  {
		int payload = ArrayUtil.parseInt(buffer, offset, length); //TODO: improve this so that we don't have to new Strings
		sbyte[] bytes = PayloadHelper.encodeInt(payload);
		BytesRef result = new BytesRef(bytes);
		return result;
	  }
	}
}


text:
<?xml version="1.0"?>
<window id="10440">
	<defaultcontrol always="true">281</defaultcontrol>
	<controls>
		<include>Dialog_Popup_Background</include>
		<control type="group">
			<include>Dialog_Popup_Animation</include>
			<posx>250</posx>
			<posy>60</posy>
			<control type="image">
				<posx>0</posx>
				<posy>0</posy>
				<width>800</width>
				<height>600</height>
				<texture border="64">new_skin/dialog4_background.png</texture>
			</control>
			<control type="label">
				<posx>30</posx>
				<posy>140</posy>
				<height>48</height>
				<width>100</width>
				<align>left</align>
				<aligny>center</aligny>
				<textcolor>white</textcolor>
				font16b
				[UPPERCASE]step 5/10[/UPPERCASE]
			</control>
			<include>Init_Box_Boxee_Icon_Left</include>
			<control type="label">
				<description>heading label</description>
				<posx>40</posx>
				<posy>60</posy>
				<width>550</width>
				<height>28</height>
				font28b
				<align>left</align>
				<aligny>center</aligny>
				[UPPERCASE]$LOCALIZE[54660][/UPPERCASE]
				<textcolor>FF3B2D06</textcolor>
			</control>
			<control type="label">
				<posx>250</posx>
				<posy>150</posy>
				<width>550</width>
				<height>48</height>
				font20b
				<align>left</align>
				<aligny>center</aligny>
				$LOCALIZE[54661]
			</control>
			<control type="label">
				<posx>250</posx>
				<posy>250</posy>
				<width>550</width>
				<height>48</height>
				font20b
				<align>left</align>
				<aligny>center</aligny>
				$LOCALIZE[54662]
			</control>
			<control type="group" id="280">
				<posx>240</posx>
				<posy>350</posy>
				<control type="radiobutton" id="281">
					<posx>0</posx>
					<posy>0</posy>
					<width>350</width>
					<height>40</height>
					<onup>-</onup>
					<ondown>282</ondown>
					<onright>250</onright>
					<onleft>251</onleft>
					<onclick>SetFocus(250)</onclick>
					font20b
					<aligny>center</aligny>
					<textcolor>white</textcolor>
					<focusedcolor>white</focusedcolor>
					<disabledcolor>disabled</disabledcolor>
					<textoffsetx>40</textoffsetx>
					<texturenofocus>-</texturenofocus>
					<texturefocus border="15">button_option_menu_on.png</texturefocus>
					<textureradiofocus>icons/icon_checkbox_full.png</textureradiofocus>
					<textureradionofocus>icons/icon_checkbox_empty.png</textureradionofocus>
					<pulseonselect>false</pulseonselect>
					<radioposx>10</radioposx>
					<radioposy>10</radioposy>
					<radiowidth>20</radiowidth>
					<radioheight>20</radioheight>
					$LOCALIZE[54663]
				</control>
				<control type="radiobutton" id="282">
					<posx>0</posx>
					<posy>40</posy>
					<width>350</width>
					<height>40</height>
					<onup>281</onup>
					<ondown>283</ondown>
					<onright>250</onright>
					<onleft>251</onleft>
					<onclick>SetFocus(250)</onclick>
					font20b
					<aligny>center</aligny>
					<textcolor>white</textcolor>
					<focusedcolor>white</focusedcolor>
					<disabledcolor>disabled</disabledcolor>
					<textoffsetx>40</textoffsetx>
					<texturenofocus>-</texturenofocus>
					<texturefocus border="15">button_option_menu_on.png</texturefocus>
					<textureradiofocus>icons/icon_checkbox_full.png</textureradiofocus>
					<textureradionofocus>icons/icon_checkbox_empty.png</textureradionofocus>
					<pulseonselect>false</pulseonselect>
					<radioposx>10</radioposx>
					<radioposy>10</radioposy>
					<radiowidth>20</radiowidth>
					<radioheight>20</radioheight>
					$LOCALIZE[54664]
				</control>
				<control type="radiobutton" id="283">
					<posx>0</posx>
					<posy>80</posy>
					<width>350</width>
					<height>40</height>
					<onup>282</onup>
					<ondown>250</ondown>
					<onright>250</onright>
					<onleft>251</onleft>
					<onclick>SetFocus(250)</onclick>
					font20b
					<aligny>center</aligny>
					<textcolor>white</textcolor>
					<focusedcolor>white</focusedcolor>
					<disabledcolor>disabled</disabledcolor>
					<textoffsetx>40</textoffsetx>
					<texturenofocus>-</texturenofocus>
					<texturefocus border="15">button_option_menu_on.png</texturefocus>
					<textureradiofocus>icons/icon_checkbox_full.png</textureradiofocus>
					<textureradionofocus>icons/icon_checkbox_empty.png</textureradionofocus>
					<pulseonselect>false</pulseonselect>
					<radioposx>10</radioposx>
					<radioposy>10</radioposy>
					<radiowidth>20</radiowidth>
					<radioheight>20</radioheight>
					$LOCALIZE[54665]
				</control>
			</control>
		</control>
		<control type="button" id="250">
			<posx>866</posx>
			<posy>578</posy>
			<width>160</width>
			<height>54</height>
			<align>center</align>
			<aligny>center</aligny>
			<textcolor>grey</textcolor>
			<focusedcolor>white</focusedcolor>
			<texturenofocus border="30">-</texturenofocus>
			<texturefocus border="30">button_action_menu_source_on.png</texturefocus>
			<textureclick border="30">button_action_menu_source_click.png</textureclick>
			font22b
			[B]$LOCALIZE[209][/B]

			<onup>280</onup>
			<ondown>-</ondown>
			<onleft>251</onleft>
			<onright>-</onright>
			<onclick>-</onclick>
		</control>
		<control type="button" id="251">
			<posx>276</posx>
			<posy>578</posy>
			<width>160</width>
			<height>54</height>
			<align>center</align>
			<aligny>center</aligny>
			<textcolor>grey</textcolor>
			<focusedcolor>white</focusedcolor>
			<texturenofocus border="30">-</texturenofocus>
			<texturefocus border="30">button_action_menu_source_on.png</texturefocus>
			<textureclick border="30">button_action_menu_source_click.png</textureclick>
			font22b
			[B]$LOCALIZE[51904][/B]

			<onup>280</onup>
			<ondown>-</ondown>
			<onleft>-</onleft>
			<onright>250</onright>
			<onclick>-</onclick>
		</control>
	</controls>
</window>


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Future work</title>
<link rel="stylesheet" href="../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Chapter 1. Boost.Bimap">
<link rel="up" href="../index.html" title="Chapter 1. Boost.Bimap">
<link rel="prev" href="test_suite.html" title="Test suite">
<link rel="next" href="release_notes.html" title="Release notes">

Home
Libraries
People
FAQ
More

Future work

      Rearrange
      Function

      Boost.MultiIndex includes some others functions that can be included in the
      views.

Copyright © 2006-2012 Matias Capeletto

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


text:
require 'aws-sdk-sns'
require 'aws-sdk-sqs'

class Barbeque::SnsSubscriptionService
  def self.sqs_client
    @sqs_client ||= Aws::SQS::Client.new
  end

  def self.sns_client
    @sns_client ||= Aws::SNS::Client.new
  end

  # @param [Barbeque::SnsSubscription] sns_subscription
  # @return [Boolean] `true` if succeeded to subscribe
  def subscribe(sns_subscription)
    if sns_subscription.valid?
      begin
        subscribe_topic!(sns_subscription)
        sns_subscription.save!
        update_sqs_policy!(sns_subscription)
        true
      rescue Aws::SNS::Errors::AuthorizationError
        sns_subscription.errors.add(:topic_arn, 'is not authorized')
        false
      rescue Aws::SNS::Errors::NotFound
        sns_subscription.errors.add(:topic_arn, 'is not found')
        false
      end
    else
      false
    end
  end

  # @param [Barbeque::SnsSubscription] sns_subscription
  def unsubscribe(sns_subscription)
    sns_subscription.destroy
    update_sqs_policy!(sns_subscription)
    unsubscribe_topic!(sns_subscription)
    nil
  end

  private

  def sqs_client
    Barbeque::SnsSubscriptionService.sqs_client
  end

  def sns_client
    Barbeque::SnsSubscriptionService.sns_client
  end

  # @param [Barbeque::SnsSubscription] sns_subscription
  def update_sqs_policy!(sns_subscription)
    attrs = sqs_client.get_queue_attributes(
      queue_url: sns_subscription.job_queue.queue_url,
      attribute_names: ['QueueArn'],
    )
    queue_arn = attrs.attributes['QueueArn']
    topic_arns = sns_subscription.job_queue.sns_subscriptions.map(&:topic_arn)

    if topic_arns.present?
      policy = generate_policy(queue_arn: queue_arn, topic_arns: topic_arns)
    else
      policy = '' # Be blank when there're no subscriptions.
    end

    sqs_client.set_queue_attributes(
      queue_url: sns_subscription.job_queue.queue_url,
      attributes: { 'Policy' => policy },
    )
  end

  # @param [String] queue_arn
  # @param [Array<String>] topic_arns
  # @return [String] JSON formatted policy
  def generate_policy(queue_arn:, topic_arns:)
    {
      'Version' => '2012-10-17',
      'Statement' => [
        'Effect' => 'Allow',
        'Principal' => '*',
        'Action' => 'sqs:SendMessage',
        'Resource' => queue_arn,
        'Condition' => {
          'ArnEquals' => {
            'aws:SourceArn' => topic_arns,
          }
        }
      ]
    }.to_json
  end

  # @param [Barbeque::SnsSubscription] sns_subscription
  def subscribe_topic!(sns_subscription)
    sqs_attrs = sqs_client.get_queue_attributes(
      queue_url: sns_subscription.job_queue.queue_url,
      attribute_names: ['QueueArn'],
    )
    queue_arn = sqs_attrs.attributes['QueueArn']

    sns_client.subscribe(
      topic_arn: sns_subscription.topic_arn,
      protocol: 'sqs',
      endpoint: queue_arn
    )
  end

  # @param [Barbeque::SnsSubscription] sns_subscription
  def unsubscribe_topic!(sns_subscription)
    sqs_attrs = sqs_client.get_queue_attributes(
      queue_url: sns_subscription.job_queue.queue_url,
      attribute_names: ['QueueArn'],
    )
    queue_arn = sqs_attrs.attributes['QueueArn']

    subscriptions = sns_client.list_subscriptions_by_topic(
      topic_arn: sns_subscription.topic_arn,
    )
    subscription_arn = subscriptions.subscriptions.find {|subscription| subscription.endpoint == queue_arn }.try!(:subscription_arn)

    if subscription_arn
      sns_client.unsubscribe(
        subscription_arn: subscription_arn,
      )
    end
  end

end


text:
#pragma once
#include <aws/connectcases/ConnectCases_EXPORTS.h>
#include <aws/connectcases/ConnectCasesRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <utility>

namespace Aws
{
namespace Http
{
    class URI;
} //namespace Http
namespace ConnectCases
{
namespace Model
{

  /**
   */
  class AWS_CONNECTCASES_API ListFieldOptionsRequest : public ConnectCasesRequest
  {
  public:
    ListFieldOptionsRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "ListFieldOptions"; }

    Aws::String SerializePayload() const override;

    void AddQueryStringParameters(Aws::Http::URI& uri) const override;

    /**
     *
The unique identifier of the Cases domain.

     */
    inline const Aws::String& GetDomainId() const{ return m_domainId; }

    /**
     *
The unique identifier of the Cases domain.

     */
    inline bool DomainIdHasBeenSet() const { return m_domainIdHasBeenSet; }

    /**
     *
The unique identifier of the Cases domain.

     */
    inline void SetDomainId(const Aws::String& value) { m_domainIdHasBeenSet = true; m_domainId = value; }

    /**
     *
The unique identifier of the Cases domain.

     */
    inline void SetDomainId(Aws::String&& value) { m_domainIdHasBeenSet = true; m_domainId = std::move(value); }

    /**
     *
The unique identifier of the Cases domain.

     */
    inline void SetDomainId(const char* value) { m_domainIdHasBeenSet = true; m_domainId.assign(value); }

    /**
     *
The unique identifier of the Cases domain.

     */
    inline ListFieldOptionsRequest& WithDomainId(const Aws::String& value) { SetDomainId(value); return *this;}

    /**
     *
The unique identifier of the Cases domain.

     */
    inline ListFieldOptionsRequest& WithDomainId(Aws::String&& value) { SetDomainId(std::move(value)); return *this;}

    /**
     *
The unique identifier of the Cases domain.

     */
    inline ListFieldOptionsRequest& WithDomainId(const char* value) { SetDomainId(value); return *this;}

    /**
     *
The unique identifier of a field.

     */
    inline const Aws::String& GetFieldId() const{ return m_fieldId; }

    /**
     *
The unique identifier of a field.

     */
    inline bool FieldIdHasBeenSet() const { return m_fieldIdHasBeenSet; }

    /**
     *
The unique identifier of a field.

     */
    inline void SetFieldId(const Aws::String& value) { m_fieldIdHasBeenSet = true; m_fieldId = value; }

    /**
     *
The unique identifier of a field.

     */
    inline void SetFieldId(Aws::String&& value) { m_fieldIdHasBeenSet = true; m_fieldId = std::move(value); }

    /**
     *
The unique identifier of a field.

     */
    inline void SetFieldId(const char* value) { m_fieldIdHasBeenSet = true; m_fieldId.assign(value); }

    /**
     *
The unique identifier of a field.

     */
    inline ListFieldOptionsRequest& WithFieldId(const Aws::String& value) { SetFieldId(value); return *this;}

    /**
     *
The unique identifier of a field.

     */
    inline ListFieldOptionsRequest& WithFieldId(Aws::String&& value) { SetFieldId(std::move(value)); return *this;}

    /**
     *
The unique identifier of a field.

     */
    inline ListFieldOptionsRequest& WithFieldId(const char* value) { SetFieldId(value); return *this;}

    /**
     *
The maximum number of results to return per page.

     */
    inline int GetMaxResults() const{ return m_maxResults; }

    /**
     *
The maximum number of results to return per page.

     */
    inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; }

    /**
     *
The maximum number of results to return per page.

     */
    inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }

    /**
     *
The maximum number of results to return per page.

     */
    inline ListFieldOptionsRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; }

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline ListFieldOptionsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline ListFieldOptionsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
The token for the next set of results. Use the value returned in the previous
     * response in the next request to retrieve the next set of results.

     */
    inline ListFieldOptionsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline const Aws::Vector<Aws::String>& GetValues() const{ return m_values; }

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline bool ValuesHasBeenSet() const { return m_valuesHasBeenSet; }

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline void SetValues(const Aws::Vector<Aws::String>& value) { m_valuesHasBeenSet = true; m_values = value; }

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline void SetValues(Aws::Vector<Aws::String>&& value) { m_valuesHasBeenSet = true; m_values = std::move(value); }

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline ListFieldOptionsRequest& WithValues(const Aws::Vector<Aws::String>& value) { SetValues(value); return *this;}

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline ListFieldOptionsRequest& WithValues(Aws::Vector<Aws::String>&& value) { SetValues(std::move(value)); return *this;}

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline ListFieldOptionsRequest& AddValues(const Aws::String& value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; }

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline ListFieldOptionsRequest& AddValues(Aws::String&& value) { m_valuesHasBeenSet = true; m_values.push_back(std::move(value)); return *this; }

    /**
     *
A list of FieldOption values to filter on for
     * ListFieldOptions.

     */
    inline ListFieldOptionsRequest& AddValues(const char* value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; }

  private:

    Aws::String m_domainId;
    bool m_domainIdHasBeenSet = false;

    Aws::String m_fieldId;
    bool m_fieldIdHasBeenSet = false;

    int m_maxResults;
    bool m_maxResultsHasBeenSet = false;

    Aws::String m_nextToken;
    bool m_nextTokenHasBeenSet = false;

    Aws::Vector<Aws::String> m_values;
    bool m_valuesHasBeenSet = false;
  };

} // namespace Model
} // namespace ConnectCases
} // namespace Aws


text:
export class FakeTypeA {

  props: number
}


text:
XMLVM_FORWARD_DECL(java_util_Iterator)
#endif

XMLVM_DEFINE_CLASS(java_util_List, 0, 0)

extern JAVA_OBJECT __CLASS_java_util_List;
extern JAVA_OBJECT __CLASS_java_util_List_1ARRAY;
extern JAVA_OBJECT __CLASS_java_util_List_2ARRAY;
extern JAVA_OBJECT __CLASS_java_util_List_3ARRAY;
#ifndef XMLVM_FORWARD_DECL_java_util_List
#define XMLVM_FORWARD_DECL_java_util_List
typedef struct java_util_List java_util_List;
#endif

void __INIT_java_util_List();
void __INIT_IMPL_java_util_List();

#endif


text:
package org.elasticsearch.cloud.gce;

import com.google.api.services.compute.model.Instance;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.gce.mock.GceComputeServiceAbstractMock;
import org.elasticsearch.plugins.AbstractPlugin;

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

public class GceComputeServiceZeroNodeMock extends GceComputeServiceAbstractMock {
    public static class Plugin extends AbstractPlugin {
        @Override
        public String name() {
            return "mock-compute-service";
        }
        @Override
        public String description() {
            return "a mock compute service for testing";
        }
        public void onModule(GceModule gceModule) {
            gceModule.computeServiceImpl = GceComputeServiceZeroNodeMock.class;
        }
    }

    @Override
    protected List<List<String>> getTags() {
        return new ArrayList();
    }

    @Override
    protected List<String> getZones() {
        return new ArrayList();
    }

    private final List<String> zoneList;

    @Override
    public Collection<Instance> instances() {
        logger.debug("get instances for zoneList [{}]", zoneList);

        List<List<Instance>> instanceListByZone = Lists.transform(zoneList, new Function<String, List<Instance>>() {
            @Override
            public List<Instance> apply(String zoneId) {
                // If we return null here we will get a trace as explained in issue 43
                return new ArrayList();
            }
        });

        //Collapse instances from all zones into one neat list
        List<Instance> instanceList = Lists.newArrayList(Iterables.concat(instanceListByZone));

        if (instanceList.size() == 0) {
            logger.warn("disabling GCE discovery. Can not get list of nodes");
        }

        return instanceList;
    }

    @Inject
    protected GceComputeServiceZeroNodeMock(Settings settings) {
        super(settings);
        String[] zoneList = settings.getAsArray(Fields.ZONE);
        this.zoneList = Lists.newArrayList(zoneList);
    }
}


text:
package ucar.nc2.write;

import java.io.File;
import java.io.IOException;
import java.util.Formatter;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import ucar.nc2.FileWriter2;
import ucar.nc2.NetcdfFile;
import ucar.nc2.NetcdfFileWriter;
import ucar.nc2.NetcdfFiles;
import ucar.nc2.util.CompareNetcdf2;
import ucar.unidata.util.test.TestDir;

/** Compare NetcdfCopier with old NetcdfFileWriter */
public class TestNetcdfCopierCompare {

  @Rule
  public final TemporaryFolder tempFolder = new TemporaryFolder();

  private String filename = "file:" + TestDir.cdmLocalFromTestDataDir + "point/stationData2Levels.ncml";

  @Test
  public void doOne() throws IOException {
    File fin = new File(filename);
    File foutOrg = tempFolder.newFile();
    File foutNew = tempFolder.newFile();

    try (NetcdfFile ncfileIn = ucar.nc2.dataset.NetcdfDatasets.openFile(fin.getPath(), null)) {
      FileWriter2 fileWriter = new FileWriter2(ncfileIn, foutOrg.getPath(), NetcdfFileWriter.Version.netcdf3, null);
      try (NetcdfFile ncfileOut = fileWriter.write()) {
      }

      NetcdfFormatWriter.Builder builder = NetcdfFormatWriter.createNewNetcdf3(foutNew.getPath());
      NetcdfCopier copier = NetcdfCopier.create(ncfileIn, builder);
      try (NetcdfFile ncfileOut = copier.write(null)) {
      }
    }

    try (NetcdfFile org = NetcdfFiles.open(foutOrg.getPath());
        NetcdfFile withBuilder = NetcdfFiles.open(foutNew.getPath())) {
      Formatter f = new Formatter();
      CompareNetcdf2 compare = new CompareNetcdf2(f, false, false, true);
      boolean ok = compare.compare(org, withBuilder);
      System.out.printf("Compare old and new copy of %s is %s%n", filename, ok);
      if (!ok) {
        System.out.printf("%s%n", f);
        assert false;
      }
    }
  }

}


text:
/**
 * Created by PolarisChen on 16/9/9.
 */

import React, { Component, PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './UserList.scss';

import UserFlowItem from '../UserFlowItem';
import LoadingFlowItem from '../LoadingFlowItem';
import TextFlowItem from '../TextFlowItem';

let userData = [
  {
    avatarUrl: '',
    login: 'PolarisChen',
    name: 'Polaris Chen',
    bio: 'A developer',
    url: 'http://bus1996.me',
    langs: [
      'JavaScript',
      'CSS'
    ],
    join: 'July 11, 2016',
    location: 'Nanjing, China',
    followers: 12,
    isFollowing: true,
    isLanguist: true
  },
  {
    avatarUrl: '',
    login: 'KennethReitz',
    name: 'Kenneth Reitz',
    bio: 'A developer',
    url: 'http://bus1996.me',
    langs: [
      'JavaScript',
      'CSS'
    ],
    join: 'July 11, 2016',
    location: 'Nanjing, China',
    followers: 12,
    isFollowing: false,
    isLanguist: false
  },
  {
    avatarUrl: '',
    login: 'tj',
    name: 'TJ Holowaychuk',
    bio: 'A developer',
    url: 'http://bus1996.me',
    langs: [
      'JavaScript',
      'CSS'
    ],
    join: 'July 11, 2016',
    location: 'Nanjing, China',
    followers: 12,
    isFollowing: true,
    isLanguist: false
  }
];

class UserList extends Component {
  constructor(props) {
    super(props);
  }
  renderUserItems() {
    // console.log(JSON.parse(JSON.stringify(this.props.data)));
    if(this.props.data) {
      userData = this.props.data;
      if (userData.length > 0) {
        let items = userData.map(flowItem => {
          return (
            <UserFlowItem
              key={flowItem.login}
              user={flowItem}
              handleFollow={this.props.handleFollow}
              handleUnfollow={this.props.handleUnfollow}
            />
          );
        });
        return items;
      } else {
        return <TextFlowItem text={this.props.emptyText} />;
      }
    } else {
      return (<LoadingFlowItem title={this.props.loadingText || 'Loading users...'}/>);
    }
  };

  render() {
    return (
      <div className={s.container}>
        {this.renderUserItems()}
      </div>
    );
  }
}

export default withStyles(UserList, s);


text:
#pragma once
#include <aws/states/SFN_EXPORTS.h>
#include <aws/states/SFNRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace SFN
{
namespace Model
{

  /**
   */
  class AWS_SFN_API ListStateMachinesRequest : public SFNRequest
  {
  public:
    ListStateMachinesRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "ListStateMachines"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The maximum number of results that are returned per call. You can use
     * nextToken to obtain further pages of results. The default is 100
     * and the maximum allowed page size is 1000. A value of 0 uses the default.

     *
This is only an upper limit. The actual number of results returned per call
     * might be fewer than the specified maximum.

     */
    inline int GetMaxResults() const{ return m_maxResults; }

    /**
     *
The maximum number of results that are returned per call. You can use
     * nextToken to obtain further pages of results. The default is 100
     * and the maximum allowed page size is 1000. A value of 0 uses the default.

     *
This is only an upper limit. The actual number of results returned per call
     * might be fewer than the specified maximum.

     */
    inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; }

    /**
     *
The maximum number of results that are returned per call. You can use
     * nextToken to obtain further pages of results. The default is 100
     * and the maximum allowed page size is 1000. A value of 0 uses the default.

     *
This is only an upper limit. The actual number of results returned per call
     * might be fewer than the specified maximum.

     */
    inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }

    /**
     *
The maximum number of results that are returned per call. You can use
     * nextToken to obtain further pages of results. The default is 100
     * and the maximum allowed page size is 1000. A value of 0 uses the default.

     *
This is only an upper limit. The actual number of results returned per call
     * might be fewer than the specified maximum.

     */
    inline ListStateMachinesRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; }

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline ListStateMachinesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline ListStateMachinesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
If nextToken is returned, there are more results available. The
     * value of nextToken is a unique pagination token for each page. Make
     * the call again using the returned token to retrieve the next page. Keep all
     * other arguments unchanged. Each pagination token expires after 24 hours. Using
     * an expired pagination token will return an HTTP 400 InvalidToken
     * error.

     */
    inline ListStateMachinesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}

  private:

    int m_maxResults;
    bool m_maxResultsHasBeenSet;

    Aws::String m_nextToken;
    bool m_nextTokenHasBeenSet;
  };

} // namespace Model
} // namespace SFN
} // namespace Aws


text:
<?php Page()->set_title('Features'); ?>

Some of the features Lazarus has to offer:

Freedom

LGPL licensed [1][2] libraries allow you to create your own applications under any license you desire. Even commercial closed source.

GPL licensed IDE

Cross Platform IDE. Work on your favourite system.

Platform independent projects out of the box. Simply copy your project to another platform and compile it.

Build native binaries. Distribute your binaries without dependencies on any runtime environment. [3]

Ease of use

Installer, with all required files available

Easy Drag & Drop Form designer to create powerful layouts

Automatic synchronization between GUI-Forms and code

Powerful code editor with syntax highlighting and code completion

Navigate pascal source code

Refactoring tools

Integrated build system and debugger. Run, test and debug your projects from the IDE

Extensibility

Open Source. You can add or modify existing code and components to meet your requirements

Lazarus package system allows to install 3rd party add ons for more components or to extend the IDE

Several database frameworks to meet your requirements

Reporting and Charting

A choice of Networking libraries available.

Utf8 and i18n support. Translate your projects.

Many more components. Build in and for download

	[1] LGPL with additional permission to link libraries into your binaries.

	[2] Some additional packages come with various licenses such as GPL, MPL, ...

	[3] Linux/BSD applications may depend on GTK2 or alternatively QT.

Cross Platform

Lazarus runs on Windows, MacOS, Linux and many other platforms. Even on Raspberry Pi! The programs you create also runs on these platforms. Enjoy the same experience on your favorite OS. See Installing Lazarus for OS-specific instructions for installation.

Powerful, Fast

Lazarus is a capable IDE for handling large projects. Its compiler FPC is being constantly developed to improve performance. As an example for the project size the IDE can handle, and the performance of the resulting application: The Lazarus IDE itself is developed using Lazarus.

Drag and Drop Form Designer

Lazarus has a graphical form designer with guidelines for aligning with adjacent components. There are numerous components for almost every software imaginable, already ready to be used. Further components can be added to the IDE by Lazarus Package Files (LPKs).

Cross-platform

Lazarus form designer uses LCL (Lazarus Component Library) which is especially designed for cross platform usage. Building your project for different platforms will give you native look and feel on each platform. There are no changes to the project needed.

Modern, Object oriented language

Lazarus uses Free Pascal as its language which is an Object Pascal dialect. It is constantly developed to integrate new features that can be expected in modern programming  languages.

Easily Extendable

Hundreds of developers are developing and maintaining their Lazarus Libraries and Lazarus Packages (LPKs). You can find almost any kind of library that you may need.

Open source

Lazarus is open source and the core libraries [4] are distributed under LGPL with the extra permission  of static linking. So you can create non-commercial and commercial applications with it.

[4] This applies to LCL, FCL, RTL. It covers all the standard components and many other. Some of the packages with extra components may be GPL, MPL or other

Frameworks

Various Frameworks are available which saves your time on certain codebase.

And more…

Here is a version-based feature history which has animations to show you many features in action: Wiki: New IDE features since


text:
module phosphor.core {

/**
 * The base message object which can be sent to a message handler.
 */
export
interface IMessage {
  /**
   * The type of the message.
   */
  type: string;
}

} // module phosphor.core


text:
package encryption

import (
	"bytes"
	"encoding/base64"
	"golang.org/x/crypto/openpgp"
	"golang.org/x/crypto/openpgp/armor"
	"golang.org/x/crypto/openpgp/packet"
	"io"
	"io/ioutil"
	"strings"
)

type Decrypter interface {
	Decrypt(encString string) (string, error)
}

type PgpDecrypter struct {
	PrivateKey string
	Passphrase string
}

func NewPgpDecrypter(privateKey, passphrase string) Decrypter {
	return &PgpDecrypter{
		PrivateKey: privateKey,
		Passphrase: passphrase,
	}
}
func (d PgpDecrypter) sanitizeString(value string) string {
	value = strings.TrimSpace(value)
	value = strings.Trim(value, "\n")
	value = strings.Trim(value, "\r")
	return value
}

func (d PgpDecrypter) Decrypt(encString string) (string, error) {

	// init some vars
	var entity *openpgp.Entity
	// Open the private key file
	buf := bytes.NewBuffer([]byte(d.PrivateKey))
	blockPrivateKey, err := armor.Decode(buf)
	if err != nil {
		return encString, nil
	}
	packetDecoder := packet.NewReader(blockPrivateKey.Body)
	entity, err = openpgp.ReadEntity(packetDecoder)

	// Get the passphrase and read the private key.
	// Have not touched the encrypted string yet
	passphraseByte := []byte(d.Passphrase)
	err = entity.PrivateKey.Decrypt(passphraseByte)
	if err != nil {
		return "", err
	}
	for _, subkey := range entity.Subkeys {
		err = subkey.PrivateKey.Decrypt(passphraseByte)
		if err != nil {
			return "", err
		}
	}
	// Decode the base64 string
	var dec io.Reader

	blockPublicKey, err := armor.Decode(bytes.NewBuffer([]byte(encString)))
	if err != nil {
		decBase64, err := base64.StdEncoding.DecodeString(encString)
		if err != nil {
			return encString, nil
		}
		dec = bytes.NewBuffer(decBase64)
	} else {
		dec = blockPublicKey.Body
	}

	// Decrypt it with the contents of the private key

	md, err := openpgp.ReadMessage(dec, openpgp.EntityList([]*openpgp.Entity{entity}), nil, nil)
	if err != nil {
		return encString, nil
	}
	b, err := ioutil.ReadAll(md.UnverifiedBody)
	if err != nil {
		return "", err
	}
	decStr := d.sanitizeString(string(b))

	return decStr, nil
}