text:
package v1beta1

import (
	slim_corev1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/api/core/v1"
	slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1"
)

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.16
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
// +k8s:prerelease-lifecycle-gen:removed=1.25
// +k8s:prerelease-lifecycle-gen:replacement=discovery.k8s.io,v1,EndpointSlice

// EndpointSlice represents a subset of the endpoints that implement a service.
// For a given service there may be multiple EndpointSlice objects, selected by
// labels, which must be joined to produce the full set of endpoints.
type EndpointSlice struct {
	slim_metav1.TypeMeta `json:",inline"`
	// Standard object's metadata.
	// +optional
	slim_metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
	// addressType specifies the type of address carried by this EndpointSlice.
	// All addresses in this slice must be the same type. This field is
	// immutable after creation. The following address types are currently
	// supported:
	// * IPv4: Represents an IPv4 Address.
	// * IPv6: Represents an IPv6 Address.
	// * FQDN: Represents a Fully Qualified Domain Name.
	AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"`
	// endpoints is a list of unique endpoints in this slice. Each slice may
	// include a maximum of 1000 endpoints.
	// +listType=atomic
	Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"`
	// ports specifies the list of network ports exposed by each endpoint in
	// this slice. Each port must have a unique name. When ports is empty, it
	// indicates that there are no defined ports. When a port is defined with a
	// nil port value, it indicates "all ports". Each slice may include a
	// maximum of 100 ports.
	// +optional
	// +listType=atomic
	Ports []EndpointPort `json:"ports" protobuf:"bytes,3,rep,name=ports"`
}

// AddressType represents the type of address referred to by an endpoint.
type AddressType string

const (
	// AddressTypeIPv4 represents an IPv4 Address.
	AddressTypeIPv4 = AddressType(slim_corev1.IPv4Protocol)
	// AddressTypeIPv6 represents an IPv6 Address.
	AddressTypeIPv6 = AddressType(slim_corev1.IPv6Protocol)
	// AddressTypeFQDN represents a FQDN.
	AddressTypeFQDN = AddressType("FQDN")
)

// Endpoint represents a single logical "backend" implementing a service.
type Endpoint struct {
	// addresses of this endpoint. The contents of this field are interpreted
	// according to the corresponding EndpointSlice addressType field. Consumers
	// must handle different types of addresses in the context of their own
	// capabilities. This must contain at least one address but no more than
	// 100. These are all assumed to be fungible and clients may choose to only
	// use the first element. Refer to: https://issue.k8s.io/106267
	// +listType=set
	Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"`
	// conditions contains information about the current status of the endpoint.
	Conditions EndpointConditions `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"`
	// topology contains arbitrary topology information associated with the
	// endpoint. These key/value pairs must conform with the label format.
	// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
	// Topology may include a maximum of 16 key/value pairs. This includes, but
	// is not limited to the following well known keys:
	// * kubernetes.io/hostname: the value indicates the hostname of the node
	//   where the endpoint is located. This should match the corresponding
	//   node label.
	// * topology.kubernetes.io/zone: the value indicates the zone where the
	//   endpoint is located. This should match the corresponding node label.
	// * topology.kubernetes.io/region: the value indicates the region where the
	//   endpoint is located. This should match the corresponding node label.
	// This field is deprecated and will be removed in future api versions.
	// +optional
	Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"`
	// nodeName represents the name of the Node hosting this endpoint. This can
	// be used to determine endpoints local to a Node. This field can be enabled
	// with the EndpointSliceNodeName feature gate.
	// +optional
	NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,6,opt,name=nodeName"`
}

// EndpointConditions represents the current condition of an endpoint.
type EndpointConditions struct {
	// ready indicates that this endpoint is prepared to receive traffic,
	// according to whatever system is managing the endpoint. A nil value
	// indicates an unknown state. In most cases consumers should interpret this
	// unknown state as ready. For compatibility reasons, ready should never be
	// "true" for terminating endpoints.
	// +optional
	Ready *bool `json:"ready,omitempty" protobuf:"bytes,1,name=ready"`

	// serving is identical to ready except that it is set regardless of the
	// terminating state of endpoints. This condition should be set to true for
	// a ready endpoint that is terminating. If nil, consumers should defer to
	// the ready condition. This field can be enabled with the
	// EndpointSliceTerminatingCondition feature gate.
	// +optional
	Serving *bool `json:"serving,omitempty" protobuf:"bytes,2,name=serving"`

	// terminating indicates that this endpoint is terminating. A nil value
	// indicates an unknown state. Consumers should interpret this unknown state
	// to mean that the endpoint is not terminating. This field can be enabled
	// with the EndpointSliceTerminatingCondition feature gate.
	// +optional
	Terminating *bool `json:"terminating,omitempty" protobuf:"bytes,3,name=terminating"`
}

// EndpointHints provides hints describing how an endpoint should be consumed.
type EndpointHints struct {
	// forZones indicates the zone(s) this endpoint should be consumed by to
	// enable topology aware routing. May contain a maximum of 8 entries.
	// +listType=atomic
	ForZones []ForZone `json:"forZones,omitempty" protobuf:"bytes,1,name=forZones"`
}

// ForZone provides information about which zones should consume this endpoint.
type ForZone struct {
	// name represents the name of the zone.
	Name string `json:"name" protobuf:"bytes,1,name=name"`
}

// EndpointPort represents a Port used by an EndpointSlice
type EndpointPort struct {
	// The name of this port. All ports in an EndpointSlice must have a unique
	// name. If the EndpointSlice is dervied from a Kubernetes service, this
	// corresponds to the Service.ports[].name.
	// Name must either be an empty string or pass DNS_LABEL validation:
	// * must be no more than 63 characters long.
	// * must consist of lower case alphanumeric characters or '-'.
	// * must start and end with an alphanumeric character.
	// Default is empty string.
	Name *string `json:"name,omitempty" protobuf:"bytes,1,name=name"`
	// The IP protocol for this port.
	// Must be UDP, TCP, or SCTP.
	// Default is TCP.
	Protocol *slim_corev1.Protocol `json:"protocol,omitempty" protobuf:"bytes,2,name=protocol"`
	// The port number of the endpoint.
	// If this is not specified, ports are not restricted and must be
	// interpreted in the context of the specific consumer.
	Port *int32 `json:"port,omitempty" protobuf:"bytes,3,opt,name=port"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.16
// +k8s:prerelease-lifecycle-gen:deprecated=1.21
// +k8s:prerelease-lifecycle-gen:removed=1.25
// +k8s:prerelease-lifecycle-gen:replacement=discovery.k8s.io,v1,EndpointSlice

// EndpointSliceList represents a list of endpoint slices
type EndpointSliceList struct {
	slim_metav1.TypeMeta `json:",inline"`
	// Standard list metadata.
	// +optional
	slim_metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
	// List of endpoint slices
	Items []EndpointSlice `json:"items" protobuf:"bytes,2,rep,name=items"`
}


text:
<!DOCTYPE html>
<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <!-- Meta, title, CSS, favicons, etc. -->
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title><?php echo $title; ?></title>

  <!-- Bootstrap core CSS -->

  <link href="<?php echo base_url();?>assets/backend/css/bootstrap.min.css" rel="stylesheet">

  <link href="<?php echo base_url();?>assets/fonts/css/font-awesome.min.css" rel="stylesheet">
  <link href="<?php echo base_url();?>assets/backend/css/animate.min.css" rel="stylesheet">

  <!-- Custom styling plus plugins -->
  <link href="<?php echo base_url();?>assets/backend/css/custom.css" rel="stylesheet">
  <link href="<?php echo base_url();?>assets/backend/css/icheck/flat/green.css" rel="stylesheet">

  <script src="<?php echo base_url();?>assets/backend/js/jquery.min.js"></script>

  <!--[if lt IE 9]>
        <script src="../assets/js/ie8-responsive-file-warning.js"></script>
        <![endif]-->

  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

</head>

redpajama_set_name: RedPajamaGithub


text:
package mocks

import (
	"github.com/cloudfoundry-incubator/notifications/v1/models"
	"github.com/cloudfoundry-incubator/notifications/v1/services"
)

type Registrar struct {
	RegisterCall struct {
		Receives struct {
			Connection services.ConnectionInterface
			Client     models.Client
			Kinds      []models.Kind
		}
		Returns struct {
			Error error
		}
	}

	PruneCall struct {
		Called   bool
		Receives struct {
			Connection services.ConnectionInterface
			Client     models.Client
			Kinds      []models.Kind
		}
		Returns struct {
			Error error
		}
	}
}

func NewRegistrar() *Registrar {
	return &Registrar{}
}

func (r *Registrar) Register(conn services.ConnectionInterface, client models.Client, kinds []models.Kind) error {
	r.RegisterCall.Receives.Connection = conn
	r.RegisterCall.Receives.Client = client
	r.RegisterCall.Receives.Kinds = kinds

	return r.RegisterCall.Returns.Error
}

func (r *Registrar) Prune(conn services.ConnectionInterface, client models.Client, kinds []models.Kind) error {
	r.PruneCall.Called = true
	r.PruneCall.Receives.Connection = conn
	r.PruneCall.Receives.Client = client
	r.PruneCall.Receives.Kinds = kinds

	return r.PruneCall.Returns.Error
}


text:
class BoxcryptorClassic < Cask
  url 'https://www.boxcryptor.com/download/Boxcryptor_Installer.dmg'
  homepage 'https://www.boxcryptor.com/en/boxcryptor-classic'
  version 'latest'
  no_checksum
  install 'Install Boxcryptor Classic.pkg'
  uninstall :script => 'Uninstall.command', :args => %w[--unattended]
end


text:
from __future__ import absolute_import

from django.db.models import F

from sentry import analytics
from sentry.models import Project
from sentry.signals import event_processed

@event_processed.connect(weak=False)
def record_first_transaction(project, event, **kwargs):
    if event.get_event_type() == "transaction" and not project.flags.has_transactions:
        project.update(flags=F("flags").bitor(Project.flags.has_transactions))

        try:
            default_user_id = project.organization.get_default_owner().id
        except IndexError:
            default_user_id = None

        analytics.record(
            "first_transaction.sent",
            default_user_id=default_user_id,
            project_id=project.id,
            organization_id=project.organization_id,
            platform=project.platform,
        )


text:
#ifndef _GUAC_INSTRUCTION_TYPES_H
#define _GUAC_INSTRUCTION_TYPES_H

/**
 * Type definitions related to Guacamole instructions.
 *
 * @file instruction-types.h
 */

/**
 * All possible states of the instruction parser.
 */
typedef enum guac_instruction_parse_state {

    /**
     * The parser is currently waiting for data to complete the length prefix
     * of the current element of the instruction.
     */
    GUAC_INSTRUCTION_PARSE_LENGTH,

    /**
     * The parser has finished reading the length prefix and is currently
     * waiting for data to complete the content of the instruction.
     */
    GUAC_INSTRUCTION_PARSE_CONTENT,

    /**
     * The instruction has been fully parsed.
     */
    GUAC_INSTRUCTION_PARSE_COMPLETE,

    /**
     * The instruction cannot be parsed because of a protocol error.
     */
    GUAC_INSTRUCTION_PARSE_ERROR

} guac_instruction_parse_state;

/**
 * Represents a single instruction within the Guacamole protocol.
 */
typedef struct guac_instruction guac_instruction;

#endif


text:
.class Lcom/google/common/collect/Synchronized$SynchronizedAsMap;
.super Lcom/google/common/collect/Synchronized$SynchronizedMap;
.source "Synchronized.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/google/common/collect/Synchronized;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "SynchronizedAsMap"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "<K:",
        "Ljava/lang/Object;",
        "V:",
        "Ljava/lang/Object;",
        ">",
        "Lcom/google/common/collect/Synchronized$SynchronizedMap",
        "<TK;",
        "Ljava/util/Collection",
        "<TV;>;>;"
    }
.end annotation

# static fields
.field private static final serialVersionUID:J

# instance fields
.field transient asMapEntrySet:Ljava/util/Set;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Set",
            "<",
            "Ljava/util/Map$Entry",
            "<TK;",
            "Ljava/util/Collection",
            "<TV;>;>;>;"
        }
    .end annotation
.end field

.field transient asMapValues:Ljava/util/Collection;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Collection",
            "<",
            "Ljava/util/Collection",
            "<TV;>;>;"
        }
    .end annotation
.end field

# direct methods
.method constructor <init>(Ljava/util/Map;Ljava/lang/Object;)V
    .locals 0
    .param p2, "mutex"    # Ljava/lang/Object;
        .annotation runtime Ljavax/annotation/Nullable;
        .end annotation
    .end param
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<TK;",
            "Ljava/util/Collection",
            "<TV;>;>;",
            "Ljava/lang/Object;",
            ")V"
        }
    .end annotation

    .prologue
    .line 1157
    .local p0, "this":Lcom/google/common/collect/Synchronized$SynchronizedAsMap;, "Lcom/google/common/collect/Synchronized$SynchronizedAsMap<TK;TV;>;"
    .local p1, "delegate":Ljava/util/Map;, "Ljava/util/Map<TK;Ljava/util/Collection<TV;>;>;"
    invoke-direct {p0, p1, p2}, Lcom/google/common/collect/Synchronized$SynchronizedMap;-><init>(Ljava/util/Map;Ljava/lang/Object;)V

    .line 1158
    return-void
.end method

# virtual methods
.method public containsValue(Ljava/lang/Object;)Z
    .locals 1
    .param p1, "o"    # Ljava/lang/Object;

    .prologue
    .line 1190
    .local p0, "this":Lcom/google/common/collect/Synchronized$SynchronizedAsMap;, "Lcom/google/common/collect/Synchronized$SynchronizedAsMap<TK;TV;>;"
    invoke-virtual {p0}, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->values()Ljava/util/Collection;

    move-result-object v0

    invoke-interface {v0, p1}, Ljava/util/Collection;->contains(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public entrySet()Ljava/util/Set;
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/Set",
            "<",
            "Ljava/util/Map$Entry",
            "<TK;",
            "Ljava/util/Collection",
            "<TV;>;>;>;"
        }
    .end annotation

    .prologue
    .line 1169
    .local p0, "this":Lcom/google/common/collect/Synchronized$SynchronizedAsMap;, "Lcom/google/common/collect/Synchronized$SynchronizedAsMap<TK;TV;>;"
    iget-object v1, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->mutex:Ljava/lang/Object;

    monitor-enter v1

    .line 1170
    :try_start_0
    iget-object v0, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->asMapEntrySet:Ljava/util/Set;

    if-nez v0, :cond_0

    .line 1171
    new-instance v0, Lcom/google/common/collect/Synchronized$SynchronizedAsMapEntries;

    invoke-virtual {p0}, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->delegate()Ljava/util/Map;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v2

    iget-object v3, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->mutex:Ljava/lang/Object;

    invoke-direct {v0, v2, v3}, Lcom/google/common/collect/Synchronized$SynchronizedAsMapEntries;-><init>(Ljava/util/Set;Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->asMapEntrySet:Ljava/util/Set;

    .line 1174
    :cond_0
    iget-object v0, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->asMapEntrySet:Ljava/util/Set;

    monitor-exit v1

    return-object v0

    .line 1175
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public bridge synthetic get(Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .param p1, "x0"    # Ljava/lang/Object;

    .prologue
    .line 1151
    .local p0, "this":Lcom/google/common/collect/Synchronized$SynchronizedAsMap;, "Lcom/google/common/collect/Synchronized$SynchronizedAsMap<TK;TV;>;"
    invoke-virtual {p0, p1}, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->get(Ljava/lang/Object;)Ljava/util/Collection;

    move-result-object v0

    return-object v0
.end method

.method public get(Ljava/lang/Object;)Ljava/util/Collection;
    .locals 3
    .param p1, "key"    # Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/Object;",
            ")",
            "Ljava/util/Collection",
            "<TV;>;"
        }
    .end annotation

    .prologue
    .line 1161
    .local p0, "this":Lcom/google/common/collect/Synchronized$SynchronizedAsMap;, "Lcom/google/common/collect/Synchronized$SynchronizedAsMap<TK;TV;>;"
    iget-object v2, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->mutex:Ljava/lang/Object;

    monitor-enter v2

    .line 1162
    :try_start_0
    invoke-super {p0, p1}, Lcom/google/common/collect/Synchronized$SynchronizedMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Collection;

    .line 1163
    .local v0, "collection":Ljava/util/Collection;, "Ljava/util/Collection<TV;>;"
    if-nez v0, :cond_0

    const/4 v1, 0x0

    :goto_0
    monitor-exit v2

    return-object v1

    :cond_0
    iget-object v1, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->mutex:Ljava/lang/Object;

    # invokes: Lcom/google/common/collect/Synchronized;->typePreservingCollection(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/Collection;
    invoke-static {v0, v1}, Lcom/google/common/collect/Synchronized;->access$400(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/Collection;

    move-result-object v1

    goto :goto_0

    .line 1165
    .end local v0    # "collection":Ljava/util/Collection;, "Ljava/util/Collection<TV;>;"
    :catchall_0
    move-exception v1

    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method public values()Ljava/util/Collection;
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/Collection",
            "<",
            "Ljava/util/Collection",
            "<TV;>;>;"
        }
    .end annotation

    .prologue
    .line 1179
    .local p0, "this":Lcom/google/common/collect/Synchronized$SynchronizedAsMap;, "Lcom/google/common/collect/Synchronized$SynchronizedAsMap<TK;TV;>;"
    iget-object v1, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->mutex:Ljava/lang/Object;

    monitor-enter v1

    .line 1180
    :try_start_0
    iget-object v0, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->asMapValues:Ljava/util/Collection;

    if-nez v0, :cond_0

    .line 1181
    new-instance v0, Lcom/google/common/collect/Synchronized$SynchronizedAsMapValues;

    invoke-virtual {p0}, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->delegate()Ljava/util/Map;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/Map;->values()Ljava/util/Collection;

    move-result-object v2

    iget-object v3, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->mutex:Ljava/lang/Object;

    invoke-direct {v0, v2, v3}, Lcom/google/common/collect/Synchronized$SynchronizedAsMapValues;-><init>(Ljava/util/Collection;Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->asMapValues:Ljava/util/Collection;

    .line 1184
    :cond_0
    iget-object v0, p0, Lcom/google/common/collect/Synchronized$SynchronizedAsMap;->asMapValues:Ljava/util/Collection;

    monitor-exit v1

    return-object v0

    .line 1185
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method


text:
package org.jivesoftware.openfire.security;

/**
 * Thrown if an event looked up (typically by id) was not found.
 *
 * @author Daniel Henninger
 */
public class EventNotFoundException extends Exception {

    public EventNotFoundException() {
        super();
    }

    public EventNotFoundException(String message) {
        super(message);
    }

    public EventNotFoundException(Throwable cause) {
        super(cause);
    }

    public EventNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }

}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v11/resources/asset_set.proto

namespace Google\Ads\GoogleAds\V11\Resources\AssetSet;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Merchant ID and Feed Label from Google Merchant Center.
 *
 * Generated from protobuf message google.ads.googleads.v11.resources.AssetSet.MerchantCenterFeed
 */
class MerchantCenterFeed extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Merchant ID from Google Merchant Center
     *
     * Generated from protobuf field int64 merchant_id = 1 [(.google.api.field_behavior) = REQUIRED];
     */
    protected $merchant_id = 0;
    /**
     * Optional. Feed Label from Google Merchant Center.
     *
     * Generated from protobuf field optional string feed_label = 2 [(.google.api.field_behavior) = OPTIONAL];
     */
    protected $feed_label = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $merchant_id
     *           Required. Merchant ID from Google Merchant Center
     *     @type string $feed_label
     *           Optional. Feed Label from Google Merchant Center.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Ads\GoogleAds\V11\Resources\AssetSet::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Merchant ID from Google Merchant Center
     *
     * Generated from protobuf field int64 merchant_id = 1 [(.google.api.field_behavior) = REQUIRED];
     * @return int|string
     */
    public function getMerchantId()
    {
        return $this->merchant_id;
    }

    /**
     * Required. Merchant ID from Google Merchant Center
     *
     * Generated from protobuf field int64 merchant_id = 1 [(.google.api.field_behavior) = REQUIRED];
     * @param int|string $var
     * @return $this
     */
    public function setMerchantId($var)
    {
        GPBUtil::checkInt64($var);
        $this->merchant_id = $var;

        return $this;
    }

    /**
     * Optional. Feed Label from Google Merchant Center.
     *
     * Generated from protobuf field optional string feed_label = 2 [(.google.api.field_behavior) = OPTIONAL];
     * @return string
     */
    public function getFeedLabel()
    {
        return isset($this->feed_label) ? $this->feed_label : '';
    }

    public function hasFeedLabel()
    {
        return isset($this->feed_label);
    }

    public function clearFeedLabel()
    {
        unset($this->feed_label);
    }

    /**
     * Optional. Feed Label from Google Merchant Center.
     *
     * Generated from protobuf field optional string feed_label = 2 [(.google.api.field_behavior) = OPTIONAL];
     * @param string $var
     * @return $this
     */
    public function setFeedLabel($var)
    {
        GPBUtil::checkString($var, True);
        $this->feed_label = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(MerchantCenterFeed::class, \Google\Ads\GoogleAds\V11\Resources\AssetSet_MerchantCenterFeed::class);


text:
import { requireAuth, isPublicTeam } from 'utils'
import { injectReducer, injectEpic } from 'modules'
import { WorkspaceLayout } from './layout'
import { workspaceReducer, workspaceEpic } from './modules'
import { Personal } from './personal'
import { Team } from './team'
import { Entries, Members, MemberJoin, TeamSettings } from './views'

export const WORKSPACE_BASE_PATH = '/workspace'
export const PERSONAL_PATH = 'personal'
export const TEAM_PATH = 'team'
export const ENTRIES_PATH = 'entries'
export const ENTRIES_FILTER_DEFAULT_PATH = 'unfiltered'
export const ENTRY_PATH = 'entry'
export const MEMBERS_PATH = 'members'
export const JOIN_PATH = 'join'
export const SETTINGS_PATH = 'settings'

export const getWorkspaceBashPath = (team) => {
  if (isPublicTeam(team)) {
    return `${WORKSPACE_BASE_PATH}/${TEAM_PATH}/${team.id}`
  } else {
    return `${WORKSPACE_BASE_PATH}/${PERSONAL_PATH}`
  }
}

export const getEntryPathById = (basePath, entryId) => {
  return `${basePath}/${ENTRY_PATH}/${entryId}`
}

export const getInvitePathByCode = (code) => {
  return `${WORKSPACE_BASE_PATH}/${JOIN_PATH}/${code}`
}

export const initWorkspaceLayout = (store) => {
  // Add reducer & epic async
  injectReducer(store, { key: 'workspace', reducer: workspaceReducer })
  injectEpic(workspaceEpic)
  return requireAuth(WorkspaceLayout)
}

export const redirectToPersonal = (_, replace) => {
  return replace(`${WORKSPACE_BASE_PATH}/${PERSONAL_PATH}`)
}

export const redirectToPersonalEntries = (_, replace) => {
  return replace(`${WORKSPACE_BASE_PATH}/${PERSONAL_PATH}/${ENTRIES_PATH}`)
}

export const redirectToTeamEntries = (nextState, replace) => {
  const pathname = nextState.location.pathname
  return replace(`${pathname}/${ENTRIES_PATH}`)
}

export const redirectToEntriesDefaultFilter = (nextState, replace) => {
  const pathname = nextState.location.pathname
  const filterName = nextState.params.filterName
  const entryId = nextState.params.entryId

  if (filterName || entryId) {
    return null
  }

  return replace(`${pathname}/${ENTRIES_FILTER_DEFAULT_PATH}`)
}

export const entryRoutes = (store) => ({
  path : `${ENTRIES_PATH}(/:filterName)`,
  indexRoute : { onEnter: redirectToEntriesDefaultFilter },
  component : Entries,
  childRoutes : [
    {
      path: `${ENTRY_PATH}/:entryId`
    }
  ]
})

export default (store) => ({
  path : WORKSPACE_BASE_PATH,
  indexRoute : { onEnter: redirectToPersonal },
  component : initWorkspaceLayout(store),
  childRoutes : [
    // External
    {
      path : `${JOIN_PATH}/:inviteCode`,
      component : MemberJoin
    },

    // Personal
    {
      path : PERSONAL_PATH,
      indexRoute : { onEnter: redirectToPersonalEntries },
      component : Personal,
      childRoutes : [
        entryRoutes(store)
      ]
    },

    // Team
    {
      path : `${TEAM_PATH}/:teamId`,
      component : Team,
      indexRoute : { onEnter: redirectToTeamEntries },
      childRoutes : [
        entryRoutes(store),

        {
          path : MEMBERS_PATH,
          component : Members
        },

        {
          path : SETTINGS_PATH,
          component : TeamSettings
        }
      ]
    }
  ]
})


text:
var {allParameters} = require('./util').default;
var {flatmap, get, getIn, groupBy, identity, isArray, isBoolean, isObject, isString, Let, mapObject, pick} = require('./underscore_ext').default;

import {parse} from './models/searchParser';

// This is pretty much cut & paste from columnsParam, so might be
// more complex than necessary.

var heatmapOptPaths = {
	showWelcome: ['showWelcome'],
	search: ['sampleSearch'],
	searchSampleList: ['sampleSearch'],
	filter: ['sampleFilter'],
	mode: ['mode']
};

function searchIsValid(s) {
	try {
		parse(s);
	} catch(e) {
		return false;
	}
	return true;
}

var isStringArray = a =>
	isArray(a) && a.every(s => isString(s));

var arrayToSearch = a =>
	a.map(s => `A:="${s}"`).join(' OR ');

var invalid = {}; // use reference equality to tag invalid values.
var heatmapOptCleaner = {
	mode: s =>
		s === 'heatmap' ? s :
		s === 'chart' ? s :
		invalid,
	search: s => searchIsValid(s) ? s : invalid,
	searchSampleList: s => isStringArray(s) ? arrayToSearch(s) : invalid,
	filter: s => searchIsValid(s) ? s : invalid,
	showWelcome: v => isBoolean(v) ? v : invalid,
};
var heatmapOptClean = (opt, v) => (heatmapOptCleaner[opt] || identity)(v);
var heatmapOpts = Object.keys(heatmapOptPaths);

var heatmapOptSetter = {
	mode: s => s ? s : invalid,
	search: s => searchIsValid(s) ? s : invalid,
	searchSampleList: () => invalid, // don't try to save a sample highlight
	filter: () => invalid, // don't try to save a sample filter
	showWelcome: v => v == null ? invalid : v
};
var heatmapOptSet = (opt, v) => (heatmapOptSetter[opt] || identity)(v);

var cleanOpts = c =>
	flatmap(pick(c, heatmapOpts), (v, k) =>
		Let((cleaned = heatmapOptClean(k, v)) =>
			cleaned === invalid ? [] :
			[[heatmapOptPaths[k], cleaned]]));

var heatmapSchema = obj => isObject(obj);

export function heatmapParam() {
	var {heatmap} = allParameters();
	if (heatmap) {
		try {
			var opts = cleanOpts(JSON.parse(heatmap[0]));
			if (heatmapSchema(opts)) {
				var {true: [[, filter]] = [[]], false: other} = groupBy(opts, ([[k]]) => k === 'sampleFilter');
				return {heatmap: other, filter};
			}
			console.log(`Invalid heatmap parameter ${opts}`);
		} catch(e) {
			console.log(`Failed to parse heatmap ${heatmap}`);
		}
	}
	return {};
}

var heatmapOptions = heatmap =>
	pick(
		mapObject(heatmapOptPaths, (path, key) =>
			heatmapOptSet(key, getIn(heatmap, path))),
		v => v !== invalid);

var encode = x => encodeURIComponent(JSON.stringify(x));

export var getHeatmap = state => encode(heatmapOptions(get(state, 'spreadsheet')));


text:
<?php
/**
 * Handle the SiteOrigin theme settings panel.
 *
 * @package SiteOrigin Extras
 */

/**
 * Intialize the theme settings page
 *
 * @param $theme_name
 * @action after_setup_theme
 */
function siteorigin_settings_init( $theme_name = null ) {
	// Ensure this is only run once
	static $run;
	if(!empty($run)) return;
	$run = true;

	if ( empty( $theme_name ) ) {
		$theme_name = basename( get_template_directory() );
	}

	$GLOBALS['siteorigin_settings_theme_name'] = $theme_name;
	$GLOBALS['siteorigin_settings_name'] = $theme_name . '_theme_settings';
	$GLOBALS['siteorigin_settings_defaults'] = apply_filters( 'siteorigin_theme_default_settings', array() );

	$settings = get_option( $theme_name . '_theme_settings', array() );
	// Remove any settings with a -1 value
	foreach($settings as $name => $value) {
		if (intval($value) === -1) {
			unset($settings[$name]);
		}
	}
	$GLOBALS['siteorigin_settings'] = wp_parse_args( $settings, $GLOBALS['siteorigin_settings_defaults'] );

	// Register all the actions for the settings page
	add_action( 'admin_menu', 'siteorigin_settings_admin_menu' );
	add_action( 'admin_init', 'siteorigin_settings_admin_init', 8 );
	add_action( 'siteorigin_adminbar', 'siteorigin_settings_adminbar' );

	add_action( 'admin_enqueue_scripts', 'siteorigin_settings_enqueue_scripts' );
	add_action( 'wp_enqueue_scripts', 'siteorigin_settings_enqueue_front_scripts' );
}
add_action('after_setup_theme', 'siteorigin_settings_init', 5);

/**
 * Initialize admin settings in the admin
 *
 * @action admin_init
 */
function siteorigin_settings_admin_init() {
	register_setting( 'theme_settings', $GLOBALS['siteorigin_settings_name'], 'siteorigin_settings_validate' );
	if(get_theme_mod('version_activated', false) === false)
		set_theme_mod('version_activated', SITEORIGIN_THEME_VERSION);
}

/**
 * Set up the theme settings page.
 *
 * @action admin_menu
 */
function siteorigin_settings_admin_menu() {
	$theme = wp_get_theme();
	$page = add_theme_page(
		sprintf(__( '%s Theme Settings', 'vantage' ), $theme->get('Name') ),
		sprintf(__( 'Theme Settings', 'vantage' ), $theme->get('Name') ),
		'edit_theme_options',
		'theme_settings_page',
		'siteorigin_settings_render'
	);

	add_action( 'load-' . $page, 'siteorigin_settings_theme_help' );
}

/**
 * Render the theme settings page
 */
function siteorigin_settings_render() {
	if( version_compare( get_bloginfo('version'), '3.4', '<' ) ) {
		?>

<?php _e('Please update to the latest version of WordPress to use theme settings.', 'vantage') ?>

<?php
		return;
	}

	locate_template( 'extras/settings/page.php', true, false );
}

/**
 * Enqueue all the settings scripts.
 *
 * @param $prefix
 */
function siteorigin_settings_enqueue_scripts( $prefix ) {
	if ( $prefix != 'appearance_page_theme_settings_page' ) return;

	wp_enqueue_script( 'siteorigin-settings', get_template_directory_uri() . '/extras/settings/js/settings.min.js', array( 'jquery' ), SITEORIGIN_THEME_VERSION );
	wp_enqueue_style( 'siteorigin-settings', get_template_directory_uri() . '/extras/settings/css/settings.css', array(), SITEORIGIN_THEME_VERSION );

	if( wp_script_is( 'wp-color-picker', 'registered' ) ){
		wp_enqueue_style( 'wp-color-picker' );
		wp_enqueue_script( 'wp-color-picker' );
	}
	else{
		wp_enqueue_style( 'farbtastic' );
		wp_enqueue_script( 'farbtastic' );
	}

	// We need the media editors
	wp_enqueue_media();

	// This is for the media uploader
	if ( function_exists( 'wp_enqueue_media' ) ) wp_enqueue_media();
}

/**
 * Enqueue the frontend settings scripts and CSS.
 */
function siteorigin_settings_enqueue_front_scripts(){
	if( current_user_can('manage_options') && siteorigin_setting('general_hover_edit', true) ) {
		wp_enqueue_style('siteorigin-settings-front', get_template_directory_uri().'/extras/settings/css/settings.front.css', array(), SITEORIGIN_THEME_VERSION);
		wp_enqueue_script('siteorigin-settings-front', get_template_directory_uri() . '/extras/settings/js/settings.front.min.js', array('jquery'), SITEORIGIN_THEME_VERSION);
		wp_localize_script('siteorigin-settings-front', 'siteoriginSettings', array(
			'edit' => admin_url('themes.php?page=theme_settings_page'),
		));
	}
}

/**
 * Add the admin bar to the settings page
 *
 * @param $bar
 * @return object|null
 */
function siteorigin_settings_adminbar( $bar ) {
	$screen = get_current_screen();
	if ( $screen->id == 'appearance_page_theme_settings_page' ) {
		$bar = (object) array( 'id' => $GLOBALS['siteorigin_settings_name'], 'message' => array( 'extras/settings/message' ) );
	}

	return $bar;
}

/**
 * Add a settings section.
 *
 * @param $id
 * @param $name
 */
function siteorigin_settings_add_section( $id, $name ) {
	add_settings_section( $id, $name, '__return_false', 'theme_settings' );
}

/**
 * Add a setting
 *
 * @param string $section
 * @param string $id
 * @param string $type
 * @param string $title
 * @param array $args
 */
function siteorigin_settings_add_field( $section, $id, $type, $title = null, $args = array() ) {
	global $wp_settings_fields;
	if ( isset( $wp_settings_fields[ 'theme_settings' ][ $section ][ $id ] ) ) {
		if ( isset( $wp_settings_fields[ 'theme_settings' ][ $section ][ $id ][ 'args' ][ 'type' ] ) && $wp_settings_fields[ 'theme_settings' ][ $section ][ $id ][ 'args' ][ 'type' ] == 'teaser' ) {
			if ( empty( $args[ 'description' ] ) && !empty( $wp_settings_fields[ 'theme_settings' ][ $section ][ $id ][ 'args' ][ 'description' ] ) ) {
				// Copy across the description field from the teaser
				$args[ 'description' ] = $wp_settings_fields[ 'theme_settings' ][ $section ][ $id ][ 'args' ][ 'description' ];
			}
			if ( empty( $name ) && !empty( $wp_settings_fields[ 'theme_settings' ][ $section ][ $id ][ 'title' ] ) ) {
				// Copy across the title field
				$title = $wp_settings_fields[ 'theme_settings' ][ $section ][ $id ][ 'title' ];
			}

			// Replace the teaser field with the actual setting
			$wp_settings_fields[ 'theme_settings' ][ $section ][ $id ] = array(
				'id' => $id,
				'title' => $title,
				'callback' => 'siteorigin_settings_field',
				'args' => $args
			);
		}
		else return;
	}

	$args = wp_parse_args( $args, array(
		'section' => $section,
		'field' => $id,
		'type' => $type,
	) );

	add_settings_field( $id, $title, 'siteorigin_settings_field', 'theme_settings', $section, $args );
}

/**
 * Adds a field that might only be available in another version of the theme.
 *
 * @param $section
 * @param $id
 * @param $name
 * @param array $args
 */
function siteorigin_settings_add_teaser( $section, $id, $name, $args = array() ) {
	global $wp_settings_fields;
	if ( isset( $wp_settings_fields['theme_settings'][ $section ][ $id ] ) ) return;

	$args = wp_parse_args( $args, array(
		'section' => $section,
		'field' => $id,
		'type' => 'teaser',
	) );

	add_settings_field( $id, $name, 'siteorigin_settings_field', 'theme_settings', $section, $args );
}

/**
 * Get the value of a setting, or the default value.
 *
 * @param string $name The setting name
 * @param mixed $default The default setting
 * @return mixed
 */
function siteorigin_setting( $name , $default = null) {
	$value = null;

	if ( !is_null( $default ) && ( !is_bool( $GLOBALS[ 'siteorigin_settings' ][ $name ] ) && empty( $GLOBALS[ 'siteorigin_settings' ][ $name ] ) ) ) {
		return apply_filters('siteorigin_setting_'.$name, $default);
	}

	if ( !isset( $GLOBALS[ 'siteorigin_settings' ][ $name ] ) ) $value = null;
	else $value = $GLOBALS['siteorigin_settings'][ $name ];

	return apply_filters('siteorigin_setting_'.$name, $value);
}

/**
 * Adds the necessary classes to make a field editable
 */
function siteorigin_setting_editable($field){
	if( current_user_can('manage_options') && siteorigin_setting('general_hover_edit', true) ) {
		echo 'data-so-edit="'.$field.'"';
	}
}

function siteorigin_setting_editable_option_default($defaults){
	$defaults['general_hover_edit'] = true;
	return $defaults;
}
add_filter('siteorigin_theme_default_settings', 'siteorigin_setting_editable_option_default');

/**
 * Render a settings field.
 *
 * @param $args
 */
function siteorigin_settings_field( $args ) {
	$field_name = $GLOBALS['siteorigin_settings_name'] . '[' . $args['section'] . '_' . $args['field'] . ']';
	$field_id = $args['section'] . '_' . $args['field'];
	$current = isset( $GLOBALS['siteorigin_settings'][ $field_id ] ) ? $GLOBALS['siteorigin_settings'][ $field_id ] : null;

	switch ( $args['type'] ) {
		case 'checkbox' :
			?>
			<input id="<?php echo esc_attr( $field_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" type="checkbox" <?php checked( $current ) ?> />
			<label for="<?php echo esc_attr( $field_id ) ?>"><?php echo esc_attr( !empty( $args['label'] ) ? $args['label'] : __( 'Enabled', 'vantage' ) ) ?>
			<?php
			break;
		case 'text' :
		case 'number' :
			?>
			<input
				id="<?php echo esc_attr( $field_id ) ?>"
				name="<?php echo esc_attr( $field_name ) ?>"
				class="<?php echo esc_attr( $args['type'] == 'number' ? 'small-text' : 'regular-text' ) ?>"
				size="25"
				type="<?php echo esc_attr( $args['type'] ) ?>"
				value="<?php echo esc_attr( $current ) ?>" />
			<?php if(!empty($args['options'])) : ?>
				<select class="input-field-select">
					<option></option>
					<?php foreach($args['options'] as $value => $label) : ?>
						<option value="<?php echo esc_attr($value) ?>"><?php echo esc_html($label) ?></option>
					<?php endforeach; ?>
				</select>
			<?php endif;
			break;

		case 'select' :
			?>
			<select id="<?php echo esc_attr( $field_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>">
				<?php foreach ( $args['options'] as $option_id => $label ) : ?>
					<option value="<?php echo esc_attr( $option_id ) ?>" <?php selected( $option_id, $current ) ?>><?php echo esc_attr( $label ) ?></option>
				<?php endforeach ?>
			</select>
			<?php
			break;

		case 'textarea' :
			?><textarea id="<?php echo esc_attr( $field_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" class="large-text" rows="3"><?php echo esc_textarea( $current ) ?></textarea><?php
			break;

		case 'color' :
			if( wp_script_is('wp-color-picker', 'registered') ){
				?><input type="text" value="<?php echo esc_attr( $current ) ?>" class="color-field" name="<?php echo esc_attr( $field_name ) ?>" /><?php
			}
			else{
				?>

					<div class="color-indicator" style="background-color: <?php echo esc_attr( $current ) ?>">

					<input type="text" id="<?php echo esc_attr( $field_id ) ?>" value="<?php echo esc_attr( $current ) ?>" name="<?php echo esc_attr( $field_name ) ?>" />

				<?php
			}
			break;

		case 'media':
			if(version_compare(get_bloginfo('version'), '3.5', '<')){
				printf(__('You need to upgrade to WordPress 3.5 to use media fields', 'vantage'), admin_url('update-core.php'));
				break;
			}

			if(!empty($current)) {
				if(is_array($current)) {
					$src = $current;
				}
				else {
					$post = get_post($current);
					$src = wp_get_attachment_image_src($current, 'thumbnail');
					if(empty($src)) $src = wp_get_attachment_image_src($current, 'thumbnail', true);
				}
			}
			else{
				$src = array('', 0, 0);
			}

			$choose_title = empty($args['choose']) ? __('Choose Media', 'vantage') : $args['choose'];
			$update_button = empty($args['update']) ? __('Set Media', 'vantage') : $args['update'];

			?>

							<img src="<?php echo esc_url($src[0]) ?>" class="thumbnail" <?php if(empty($src[0])) echo "style='display:none'" ?> />

<?php if(!empty($post)) echo esc_attr($post->post_title) ?>

					<a href="#" class="media-upload-button" data-choose="<?php echo esc_attr($choose_title) ?>" data-update="<?php echo esc_attr($update_button) ?>">
						<?php echo esc_html($choose_title) ?>

					<?php _e('Remove', 'vantage') ?>

				<input type="hidden" id="<?php echo esc_attr( $field_id ) ?>" value="<?php echo esc_attr( is_array( $current ) ? '-1' : $current ) ?>" name="<?php echo esc_attr( $field_name ) ?>" />

			<?php
			break;

		case 'teaser' :
			$theme = get_option( 'template' );
			?>
			<a class="premium-teaser siteorigin-premium-teaser" href="<?php echo admin_url( 'themes.php?page=premium_upgrade' ) ?>" target="_blank">

				<?php printf( __( 'Only available in %s - Upgrade Now', 'vantage' ), apply_filters('siteorigin_premium_theme_name', ucfirst($theme) . ' ' . __( 'Premium', 'vantage' ) ) ) ?>
				<?php if(!empty($args['teaser-image'])) : ?>

<img src="<?php echo esc_url($args['teaser-image']) ?>" width="220" height="120" />

				<?php endif; ?>

			<?php
			break;

		case 'gallery' :
			?>
			<input
				id="<?php echo esc_attr( $field_id ) ?>"
				name="<?php echo esc_attr( $field_name ) ?>"
				class="regular-text gallery-ids"
				size="25"
				type="text"
				value="<?php echo esc_attr( $current ) ?>" />
			<?php _e('Select Images', 'vantage') ?>
			<?php
			break;

		case 'pages' :
			$pages = get_posts( array(
				'post_type' => 'page',
				'numberposts' => 200,
				'post_status' => empty($args['unpublished']) ? 'publish' : 'any',
			) );
			?>
			<select id="<?php echo esc_attr( $field_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>">
				<option value="0"><?php _e('None', 'vantage') ?></option>
				<?php foreach ( $pages as $page ) : ?>
					<option value="<?php echo $page->ID ?>" <?php selected($page->ID, $current) ?>><?php echo esc_attr($page->post_title) ?></option>
				<?php endforeach ?>
			</select>
			<?php
			break;

		case 'widget' :
			if(empty($args['widget_class'])) break;

			if( !class_exists($args['widget_class']) ) {
				?>
<?php
				printf( __('This field requires the %s plugin. ', 'influence'), $args['plugin_name']);
				if( function_exists('siteorigin_plugin_activation_install_url') ) {
					$install_url = siteorigin_plugin_activation_install_url($args['plugin'], $args['plugin_name']);
					printf( __('Install %s now. ', 'influence'), $install_url, $args['plugin_name']);
				}
				?>
<?php
			}
			else {
				global $siteorigin_settings_widget_forms;
				if(is_null($siteorigin_settings_widget_forms)) {
					$siteorigin_settings_widget_forms = array();
				}

				// Render the widget form
				$the_widget = new $args['widget_class']();
				$the_widget->id = $field_id;
				$the_widget->number = $field_id;

				ob_start();
				$the_widget->form( $current );
				$form = ob_get_clean();

				// Convert the widget field naming into ones that Settings will use
				$exp = preg_quote( $the_widget->get_field_name('____') );
				$exp = str_replace('____', '(.*?)', $exp);
				$form = preg_replace( '/'.$exp.'/', 'siteorigin_settings_widget['.preg_quote($field_id).'][$1]', $form );

				echo '
' . __('Edit', 'vantage') . '
';
				?><input type="hidden" id="<?php echo esc_attr( $field_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( serialize( $current ) ) ?>" /><?php
			}
			break;

		default :
			_e( 'Unknown Field Type', 'vantage' );
			break;
	}

	if ( !empty( $args['description'] ) ) echo '
' . $args['description'] . '
';
}

/**
 * Validate the settings values
 *
 * @param $values
 * @return array
 */
function siteorigin_settings_validate( $values ) {
	global $wp_settings_fields;

	$theme_name = basename( get_template_directory() );
	$current = get_option( $theme_name . '_theme_settings', array() );

	set_theme_mod( '_theme_settings_current_tab', isset( $_REQUEST['theme_settings_current_tab'] ) ? $_REQUEST['theme_settings_current_tab'] : 0 );

	$changed = false;
	foreach ( $wp_settings_fields['theme_settings'] as $section_id => $fields ) {
		foreach ( $fields as $field_id => $field ) {
			$name = $section_id . '_' . $field_id;

			switch($field['args']['type']){
				case 'checkbox' :
					// Only allow true or false values
					$values[ $name ] = !empty( $values[ $name ] );
					break;

				case 'number' :
					// Only allow integers
					$values[ $name ] = isset( $values[ $name ] ) ? intval( $values[ $name ] ) : $GLOBALS['siteorigin_settings_defaults'][ $name ];
					break;

				case 'media' :
					// Only allow valid attachment post ids
					if( $values[ $name ] != -1 ) {
						$attachment = get_post( $values[ $name ] );
						if(empty($attachment) || $attachment->post_type != 'attachment') $values[ $name ] = '';
					}
					break;

				case 'widget' :
					if(!class_exists($field['args']['widget_class'])) break;
					else if( !empty( $_POST['siteorigin_settings_widget'] ) && !empty($_POST['siteorigin_settings_widget'][$name]) ) {
						$widget_values = stripslashes_deep($_POST['siteorigin_settings_widget'][$name]);
						$the_widget = new $field['args']['widget_class']();
						$values[ $name ] = $the_widget->update( $widget_values, !empty($current[$name]) ? $current[$name] : array() );
					}
					else {
						$values[ $name ] = unserialize( $values[ $name ] );
					}

					break;
			}

			if ( !isset( $current[ $name ] ) || ( isset( $values[ $name ] ) && isset( $current[ $name ] ) && $values[ $name ] != $current[ $name ] ) ) $changed = true;

			// See if this needs any special validation
			if ( !empty( $field['args']['validator'] ) && method_exists( 'SiteOrigin_Settings_Validator', $field['args']['validator'] ) ) {
				$values[ $name ] = call_user_func( array( 'SiteOrigin_Settings_Validator', $field['args']['validator'] ), $values[ $name ] );
			}

		}
	}

	if ( $changed ) {
		do_action( 'siteorigin_settings_changed' );
		set_theme_mod( 'siteorigin_settings_changed', true );
	}

	return $values;
}

/**
 * Display a message when the settings have been changed
 */
function siteorigin_settings_change_message() {
	if ( get_theme_mod( 'siteorigin_settings_changed' ) ) {
		remove_theme_mod( 'siteorigin_settings_changed' );

		?>

				<?php _e( 'Settings saved.', 'vantage' ) ?>

		<?php

		/**
		 * This is an action that the theme can use to display a settings changed message.
		 */
		do_action( 'siteorigin_settings_changed_message' );
	}
}

function siteorigin_settings_theme_help(){
	$screen = get_current_screen();
	$theme_name = basename( get_template_directory() );

	$text = sprintf(
		__( "Read %s's theme documentation for help with these settings.", 'vantage' ),
		ucfirst($theme_name),
		'http://siteorigin.com/theme/'.$theme_name.'/?action=docs'
	);

	$screen->add_help_tab( array(
		'id' => 'siteorigin_settings_help_tab',
		'title' => __( 'Settings Help', 'vantage' ),
		'content' => '
' . $text . '
',
	) );
}

/**
 * Gets all template layouts
 */
function siteorigin_settings_template_part_names($parts, $part_name){
	$return = array();

	$parent_parts = glob( get_template_directory().'/'.$parts.'*.php' );
	$child_parts = glob( get_stylesheet_directory().'/'.$parts.'*.php' );

	$files = array_unique( array_merge(
		!empty($parent_parts) ? $parent_parts : array(),
		!empty($child_parts) ? $child_parts : array()
	) );

	if( !empty($files) ) {
		foreach( $files as $file ) {
			$p = pathinfo($file);
			$filename = explode('-', $p['filename'], 2);
			$name = isset($filename[1]) ? $filename[1] : '';

			$info = get_file_data($file, array(
				'name' => $part_name,
			) );

			$return[$name] = $info['name'];
		}
	}

	ksort($return);
	return $return;
}

function siteorigin_settings_media_view_strings($strings, $post){
	if( !empty($post) ) return $strings;
	if( !is_admin() || !function_exists('get_current_screen') ) return $strings; // Skip this on front end usage

	$screen = get_current_screen();
	if(empty($screen->id) || $screen->id != 'appearance_page_theme_settings_page') return $strings;

	// Remove these strings, to remove the tabs
	// Luckily the JS gracefully handles these being unset
	unset($strings['createNewGallery']);
	unset($strings['createGalleryTitle']);
	unset($strings['insertFromUrlTitle']);

	$strings['insertIntoPost'] = __('Set Media File', 'vantage');

	return $strings;
}
add_filter('media_view_strings', 'siteorigin_settings_media_view_strings', 10, 2);

/**
 * Settings validators.
 */
class SiteOrigin_Settings_Validator {
	/**
	 * Extracts the twitter username from the string.
	 *
	 * @static
	 * @param $twitter
	 * @return bool|mixed|string
	 */
	static function twitter( $twitter ) {
		$twitter = trim( $twitter );
		if ( empty( $twitter ) ) return false;
		if ( $twitter[ 0 ] == '@' ) return preg_replace( '/^@+/', '', $twitter );

		$url = parse_url( $twitter );

		// Check if this is a twitter URL
		if ( isset( $url['host'] ) && !in_array( $url['host'], array( 'twitter.com', 'www.twitter.com' ) ) ) return false;

		// Check if this is a fragment URL
		if ( isset( $url['fragment'] ) && $url['fragment'][ 0 ] == '!' )
			return substr( $url['fragment'], 2 );

		// And our very last attempt... take it that the username is on the end of the path
		if ( isset( $url['path'] ) ) {
			$parts = explode( '/', $url['path'] );
			$username = array_pop( $parts );
			return $username;
		}

		return false;
	}
}


text:
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using ProgrammersSpot.Business.Identity;
using System;
using System.Linq;
using System.Web;
using System.Web.UI;

namespace ProgrammersSpot.WebClient.Account
{
    public partial class ResetPassword : Page
    {
        protected string StatusMessage
        {
            get;
            private set;
        }

        protected void Reset_Click(object sender, EventArgs e)
        {
            string code = IdentityHelper.GetCodeFromRequest(Request);
            if (code != null)
            {
                var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();

                var user = manager.FindByName(Email.Text);
                if (user == null)
                {
                    ErrorMessage.Text = "No user found";
                    return;
                }
                var result = manager.ResetPassword(user.Id, code, Password.Text);
                if (result.Succeeded)
                {
                    Response.Redirect("~/Account/ResetPasswordConfirmation");
                    return;
                }
                ErrorMessage.Text = result.Errors.FirstOrDefault();
                return;
            }

            ErrorMessage.Text = "An error has occurred";
        }
    }
}


text:
(function (specs, app) {

    module('vehicle add/edit specs');

    var stubFormSubmitter = {
        attach: function () {
        }
    };

    var default_mocks = {
        confirm: function () { return true; },
        formSubmitter: stubFormSubmitter
    };

    test('vehicle module constructs itself', function () {
        var module = app.vehicleAdd(mocks.create(default_mocks));

        ok(module != undefined, true);
        equal(typeof module, 'object');
    });

    test('vehicle module gets Makes when Year changes', function () {

        expect(5);

        var m = mocks.create(default_mocks);

        $.post = function (url, data, callback) {
            equal(url.indexOf('makesUrl'), 0, "Expect to see Makes URL");
            equal(data.year, 1990);
            callback(["MakeName1", "MakeName2"]);
        };

        var view = $('

<select id="Year"><option value="1990"/></select><select id="MakeName"></select>

');

        var module = app.vehicleAdd(m);
        module.postrender({}, view, {});

        view.find('#Year').change();

        equal(view.find('#MakeName').children().size(), 2);
        equal(view.find('#MakeName').children('option[value=MakeName1]').size(), 1);
        equal(view.find('#MakeName').children('option[value=MakeName2]').size(), 1);
    });

    test('vehicle module gets Models when Makes changes', function () {

        expect(5);

        var m = mocks.create(default_mocks);

        $.post = function (url, data, callback) {
            equal(url.indexOf('modelsUrl'), 0, "Expect to see Models URL");
            equal(data.year, 1990);
            callback(["Model1", "Model2"]);
        };

        var view = $('

<select id="Year"><option value="1990"/></select><select id="MakeName"><option value="testMakeName"/></select><select id="ModelName"></select>

');

        var module = app.vehicleAdd(m);
        module.postrender({}, view, {});

        view.find('#MakeName').change();

        equal(view.find('#ModelName').children().size(), 2);
        equal(view.find('#ModelName').children('option[value=Model1]').size(), 1);
        equal(view.find('#ModelName').children('option[value=Model2]').size(), 1);
    });

    test('vehicle module should attach to click event for DeleteVehicleButton and cancel event if not confirmed', function () {

        expect(2);

        var clickEvent = { preventDefault: function () { ok(true, "Trying to cancel click event."); } };
        var m = mocks.create({
            confirm: function () { return false; },
            formSubmitter: stubFormSubmitter
        });
        var mockView = m.$();

        mockView.find = function (selector) {
            switch (selector) {
                case 'form':
                    return {
                        first: function () { return mockView; }
                    };
                case '#vehicleEditForm':
                    return mockView;
                case '#DeleteVehicleButton':
                    return { click: function (subscription) {
                        ok(true, "Trying to attach to DeleteButton click");
                        subscription(clickEvent);
                    }
                    };
                case '#Year':
                    return { change: function () { }
                    };
                case '#MakeName':
                    return { change: function () { } };
                default:
                    return m.$(selector);
            }
        };

        var module = app.vehicleAdd(m);
        module.postrender({}, mockView, {});

    });

    test('vehicle module should invoke formSubmitter with the correct arguments', function () {

        expect(4);

        var m = mocks.create({
            confirm: function () { return true; },
            formSubmitter: {
                attach: function (el, callback, selector) {
                    equal(typeof el, 'object');
                    equal(typeof callback, 'function');
                }
            }
        });

        var view = $('

');

        var module = app.vehicleAdd(m);
        module.postrender({}, view, {});

    });

    test('vehicle module should redirect to / after deleting a vehicle', function () {

        expect(1);

        var m = mocks.create({
            window: { location: { hash:'something-else' } },
            confirm: function () { return true; },
            formSubmitter: {
                attach: function (el, callback, selector) {
                    if (selector !== '#DeleteVehicleForm') return;
                    callback();
                    equal(m.window.location.hash, '/');
                }
            }
        });

        var view = $('

');

        var module = app.vehicleAdd(m);
        module.postrender({}, view, {});

    });

} (window.specs = window.specs || {}, window.mstats));


text:
package org.onosproject.net.meter;

import com.google.common.testing.EqualsTester;
import org.junit.Before;
import org.junit.Test;

import java.util.Collections;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.onosproject.net.NetTestTools.APP_ID;
import static org.onosproject.net.NetTestTools.did;

/**
 * DefaultMeter Tests.
 */
public class DefaultMeterTest {

    private Meter m1;
    private Meter sameAsm1;
    private Meter m2;
    private Meter m3;

    @Before
    public void setup() {

        Band band = DefaultBand.builder()
                .ofType(Band.Type.DROP)
                .withRate(500)
                .build();

        Band band1 = DefaultBand.builder()
                .ofType(Band.Type.REMARK)
                .withRate(500)
                .dropPrecedence((short) 1)
                .build();

        m1 = DefaultMeter.builder()
                .forDevice(did("1"))
                .fromApp(APP_ID)
                .withId(MeterId.meterId(1))
                .withUnit(Meter.Unit.KB_PER_SEC)
                .withBands(Collections.singletonList(band))
                .build();

        sameAsm1 = DefaultMeter.builder()
                .forDevice(did("1"))
                .fromApp(APP_ID)
                .withId(MeterId.meterId(1))
                .withUnit(Meter.Unit.KB_PER_SEC)
                .withBands(Collections.singletonList(band))
                .build();

        m2 = DefaultMeter.builder()
                .forDevice(did("2"))
                .fromApp(APP_ID)
                .withId(MeterId.meterId(2))
                .withUnit(Meter.Unit.KB_PER_SEC)
                .withBands(Collections.singletonList(band))
                .build();

        m3 = DefaultMeter.builder()
                .forDevice(did("3"))
                .fromApp(APP_ID)
                .withId(MeterId.meterId(3))
                .withUnit(Meter.Unit.KB_PER_SEC)
                .withBands(Collections.singletonList(band1))
                .build();

    }

    @Test
    public void testEquality() {
        new EqualsTester()
                .addEqualityGroup(m1, sameAsm1)
                .addEqualityGroup(m2)
                .addEqualityGroup(m3).testEquals();
    }

    @Test
    public void testConstruction() {
        DefaultMeter m = (DefaultMeter) m1;

        assertThat(m.deviceId(), is(did("1")));
        assertThat(m.appId(), is(APP_ID));
        assertThat(m.id(), is(MeterId.meterId(1)));
        assertThat(m.isBurst(), is(false));

        assertThat(m.life(), is(0L));
        assertThat(m.bytesSeen(), is(0L));
        assertThat(m.packetsSeen(), is(0L));
        assertThat(m.referenceCount(), is(0L));

    }

}


text:
prompt
prompt Capture output

spool install
set showmode off
set serveroutput on size unlimited format truncated

-- Shared Setup Script
@../common_setup.sql

WHENEVER SQLERROR exit SQL.SQLCODE

prompt
prompt Connect as SCHEMA_OWNER

connect &schema_owner./&schema_owner.&connect_string.
set serveroutput on size unlimited format truncated

begin
   if USER != upper('&schema_owner')
   then
      raise_application_error (-20000,
        'Not logged in as &schema_owner');
   end if;
end;
/

WHENEVER SQLERROR continue

@proftab.sql
@proftab_comments.sql

create index plsql_profiler_runs_idx1
   on plsql_profiler_runs (run_date);

prompt
prompt Install Package Specifications

@wt_dbout.pks
/
show errors

@wt_job.pks
/
show errors

@wt_profile.pks
/
show errors

@wt_result.pks
/
show errors

@wt_test_run.pks
/
show errors

@wt_test_runner.pks
/
show errors

@wt_testcase.pks
/
show errors

@wt_persist_report.pks
/
show errors

prompt
prompt Install Tables - Must be ordered for foreign keys

@wt_test_runners.tab
@wt_testcases.tab
@wt_dbouts.tab
@wt_dbout_runs.tab
@wt_test_runs.tab
@wt_results.tab
@wt_profiles.tab
@wt_testcase_runs.tab

prompt
prompt Install Views

@wt_dbout_runs_vw.vw
@wt_profiles_vw.vw
@wt_results_vw.vw
@wt_scheduler_jobs.vw
@wt_test_runs_vw.vw
@wt_testcase_runs_vw.vw

prompt
prompt Install Package Bodies

@wt_dbout.pkb
/
show errors

@wt_job.pkb
/
show errors

@wt_profile.pkb
/
show errors

@wt_result.pkb
/
show errors

@wt_test_run.pkb
/
show errors

@wt_test_runner.pkb
/
show errors

@wt_testcase.pkb
/
show errors

@wt_persist_report.pkb
/
show errors

prompt
prompt Configuration Data

-- Remove the core report hooks
begin
   wt_core_report.delete_hooks;
end;
/

-- Add the Persist Add-on hooks
begin
   wt_test_run.insert_hooks;
end;
/

insert into wt_versions (component, version, action)
   values ('Persist', 1.002, 'INSTALL');

commit;

set showmode on
spool off


text:
CFUUIDRef CFUUIDCreateVersion3(CFUUIDRef namespaceUUID, CFStringRef name);
CFUUIDRef CFUUIDCreateVersion5(CFUUIDRef namespaceUUID, CFStringRef name);

#endif // MVSUUID_H


text:
of [glenrobertson/leaflet-tilelayer-geojson](https://github.com/glenrobertson/leaflet-tilelayer-geojson)

-work in progress-

### additions to leaflet-tilelayer-geojson:

* based on Leaflet Path vector classes instead of GeoJSON
* async queue for adding tiles to let UI render each tile immediately
* remove tiles/vectors outside viewport
* deduplication for unclipped tiles, remove common features only when no more references
* overzooming (reuse tiles for multiple zoom levels)
* loading/progress tiles
* Web Worker support

### Todo

* early adoption of Leaflet master (0.8-dev) refactorings
* cleanup, refactoring

configurable modules for tile loading (streams?): e.g. request > worker > queue > add
* debug layer
* performance
* clipped tiles support
* ...
* discuss if and what to merge back

### Leaflet versions

* current development on dev Branch is already for Leaflet master (0.8-dev)

install Leaflet with [bower](https://github.com/bower/bower#installing-bower):

```
bower install
```
* for Leaflet stable (v0.7) and v0.6 see [Tags](https://github.com/nrenner/leaflet-tilelayer-vector/tags)/[Releases](https://github.com/nrenner/leaflet-tilelayer-vector/releases)

### Usages

* [Mapsplit map](https://github.com/nrenner/mapsplit-map) using OSM PBF vector tiles.


text:
from sqlalchemy.orm import relationship, backref

from flask_app.flask_app import db

class Job(db.Model):
    __tablename__ = 'job'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(100))

    minimal_rank_id = db.Column(db.Integer, db.ForeignKey("rank.id"))
    minimal_rank = relationship("Rank", backref=backref("min_rank", uselist=False))

    def __init__(self, name=None, minimal_rank_id=None, minimal_rank=None):
        self.name = name
        self.minimal_rank_id = minimal_rank_id
        self.minimal_rank = minimal_rank

    def __repr__(self):
        pass


text:
module Api
  class ProgramsController < Api::ApplicationController
    respond_to :json

    def index
      @@tracker.pageview(path: "/api/programs/#{params[:limit]}", hostname: Settings.default_url_helper_host, title: 'API Programs Show - Search criteria: ' + params[:search].to_s)
      @programs = params[:search] ? SurveillanceProgram.search(params[:search]) : SurveillanceProgram.all
      @programs = params[:limit] ? @programs.limit(params[:limit].to_i) : @programs.limit(100)
      render json: @programs, each_serializer: ProgramSerializer
    end

    def show
      @program = SurveillanceProgram.find_by(id: params[:id])
      if @program.nil?
        @@tracker.pageview(path: "/api/programs/#{params[:id]}", hostname: Settings.default_url_helper_host, title: 'API Program Not Found')
        not_found
        return
      else
        @@tracker.pageview(path: "/api/programs/#{params[:id]}", hostname: Settings.default_url_helper_host, title: 'API Program Show')
        render json: @program, serializer: ProgramSerializer
      end
    end

    def usage
      @program = SurveillanceProgram.find_by(id: params[:id])
      if @program.nil?
        @@tracker.pageview(path: "/api/programsUsage/#{params[:id]}", hostname: Settings.default_url_helper_host, title: 'API Program Usage Not Found')
        not_found
        return
      else
        @@tracker.pageview(path: "/api/programsUsage/#{params[:id]}", hostname: Settings.default_url_helper_host, title: 'API Program Usage Show')
        render json: @program, serializer: ProgramSerializer
      end
    end
  end
end


text:
local function parse( tokens )
	local statements = {}
	local meta = {}
	local ignore = false
	local token = 1
	local EOF = {
		type = "EOF";
		value = "EOF";
		line = ( tokens[#tokens] or { line = 1 } ) .line;
		character = ( tokens[#tokens] or { character = 1 } ) .character;
		source = source;
	}
	local patterns = {}

	local function peek( n )
		return tokens[token + ( n or 0 )] or EOF
	end

	local function throw( err )
		error( peek().source .. " [" .. peek().line .. ", " .. peek().character .. "]: " .. tostring( err ), 0 )
	end

	local function next()
		local t = peek()
		token = token + 1
		return t
	end

	local function test( t, v, n )
		local token = peek( n )
		return token.type == t and ( v == nil or token.value == v ) and token
	end

	local function skip( t, v )
		if test( t, v ) then
			return next()
		end
	end

	local function push( type, applications, value )
		for i = 1, #applications do
			statements[#statements + 1] = {
				type = type;
				application = applications[i];
				value = value;
				ignore = ignore;
			}
		end
	end

	local function gettypename()
		if test "identifier" then
			return next().value
		else
			throw( "expected (identifier) typename, got " .. peek().type )
		end
	end

	local function getstr()
		if test "string" or test "identifier" then
			return next().value
		else
			throw( "expected string or identifier, got " .. peek().type )
		end
	end

	local function getstrlist()
		local list = { getstr() }
		while skip "comma" do
			list[#list + 1] = getstr()
		end
		return list
	end

	local function getcodelist()
		skip( "equals", ":" )
		local code = {}
		while test "tabbed_line" do
			code[#code + 1] = next().value
		end
		return code
	end

	local function parseLiteral()
		local applications = getstrlist()
		if ignore then
			if skip "equals" then
				return push( "literal", applications, gettypename() )
			end
			push( "literal", applications, "literal" )
		else
			if not skip "equals" then
				throw( "expected equals ('->', ':', '='), got " .. peek().type )
			end
			push( "literal", applications, gettypename() )
		end
	end

	local function parsePattern()
		local applications = getstrlist()
		if ignore then
			if skip "equals" then
				return push( "pattern", applications, gettypename() )
			end
			push( "pattern", applications, "pattern" )
		else
			if not skip "equals" then
				throw( "expected equals ('->', ':', '='), got " .. peek().type )
			end
			push( "pattern", applications, gettypename() )
		end
	end

	local function parseComplex()
		local applications = getstrlist()
		push( "complex", applications, getcodelist() )
	end

	local function parseMeta()
		local once = skip( "keyword", "once" )
		meta[#meta + 1] = {
			once = once;
			code = getcodelist();
		}
	end

	while not test "EOF" do
		ignore = false
		if skip( "keyword", "ignore" ) then
			ignore = true
		end

		if skip( "keyword", "lit" ) or skip( "keyword", "literal" ) then
			parseLiteral()
		elseif skip( "keyword", "pat" ) or skip( "keyword", "pattern" ) then
			parsePattern()
		elseif skip( "keyword", "complex" ) then
			parseComplex()
		elseif skip( "keyword", "meta" ) then
			parseMeta()
		else
			throw( "unexpected " .. peek().type .. " (" .. peek().value .. ")" )
		end
	end

	return statements, meta
end

return parse


text:
/*
 *  How to use this module in IOTDB / HomeStar
 *  This is the best way to do this
 *  Note: to work, this package must have been installed by 'homestar install'
 */

"use strict";

var iotdb = require('iotdb');
var iot = iotdb.iot();

var things = iot.connect('TestSomething');
things.on("state", function(thing) {
    console.log("+", "state", thing.thing_id(), "\n ", thing.state("istate"));
});
things.on("meta", function(thing) {
    console.log("+", "meta", thing.thing_id(), "\n ", thing.state("meta"));
});
things.on("thing", function(thing) {
    console.log("+", "discovered", thing.thing_id(), "\n ", thing.state("meta"));
});


text:
#include <af/version.h>
#include <platform.hpp>
#include <driver.h>
#include <vector>
#include <string>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <stdexcept>
#include <cstdio>
#include <cstring>
#include <err_cuda.hpp>

//Macro for checking cuda errors following a cuda launch or api call
#define CUDA(call)                                                  \
do {                                                                \
    cudaError_t err = call;                                         \
    if (cudaSuccess != err) {                                       \
        fprintf (stderr, "CUDA Error in %s:%d : %s.",               \
                 __FILE__, __LINE__, cudaGetErrorString(err));      \
        exit(EXIT_FAILURE);                                         \
    }                                                               \
} while (0);                                                        \

using namespace std;

namespace cuda
{
    ///////////////////////////////////////////////////////////////////////////
    // HELPERS
    ///////////////////////////////////////////////////////////////////////////
    // pulled from CUTIL from CUDA SDK
    static inline int compute2cores(int major, int minor)
    {
        struct {
            int compute; // 0xMm (hex), M = major version, m = minor version
            int cores;
        } gpus[] = {
            { 0x10,  8 },
            { 0x11,  8 },
            { 0x12,  8 },
            { 0x13,  8 },
            { 0x20, 32 },
            { 0x21, 48 },
            { 0x30, 192 },
            { 0x35, 192 },
            { 0x50, 128 },
            {   -1, -1  },
        };

        for (int i = 0; gpus[i].compute != -1; ++i) {
            if (gpus[i].compute == (major << 4) + minor)
                return gpus[i].cores;
        }
        return 0;
    }

    // compare two cards based on (in order):
    //   1. flops (theoretical)
    //   2. total memory

    #define COMPARE(a,b,f) do {                     \
            return ((a)->f >= (b)->f);              \
        } while (0);

    static inline bool card_compare_compute(const cudaDevice_t &l, const cudaDevice_t &r)
    {
        const cudaDevice_t *lc = &l;
        const cudaDevice_t *rc = &r;

        COMPARE(lc, rc, prop.major);
        COMPARE(lc, rc, prop.minor);
        COMPARE(lc, rc, flops);
        COMPARE(lc, rc, prop.totalGlobalMem);
        COMPARE(lc, rc, nativeId);
        return 0;
    }

    static inline bool card_compare_flops(const cudaDevice_t &l, const cudaDevice_t &r)
    {
        const cudaDevice_t *lc = &l;
        const cudaDevice_t *rc = &r;

        COMPARE(lc, rc, flops);
        COMPARE(lc, rc, prop.totalGlobalMem);
        COMPARE(lc, rc, prop.major);
        COMPARE(lc, rc, prop.minor);
        COMPARE(lc, rc, nativeId);
        return 0;
    }

    static inline bool card_compare_mem(const cudaDevice_t &l, const cudaDevice_t &r)
    {
        const cudaDevice_t *lc = &l;
        const cudaDevice_t *rc = &r;

        COMPARE(lc, rc, prop.totalGlobalMem);
        COMPARE(lc, rc, flops);
        COMPARE(lc, rc, prop.major);
        COMPARE(lc, rc, prop.minor);
        COMPARE(lc, rc, nativeId);
        return 0;
    }

    static inline bool card_compare_num(const cudaDevice_t &l, const cudaDevice_t &r)
    {
        const cudaDevice_t *lc = &l;
        const cudaDevice_t *rc = &r;

        COMPARE(lc, rc, nativeId);
        return 0;
    }

    static const char *get_system(void)
    {
        return
    #if defined(ARCH_32)
        "32-bit "
    #elif defined(ARCH_64)
        "64-bit "
    #endif

    #if defined(OS_LNX)
        "Linux";
    #elif defined(OS_WIN)
        "Windows";
    #elif defined(OS_MAC)
        "Mac OSX";
    #endif
    }

    template <typename T>
    static inline string toString(T val)
    {
        stringstream s;
        s << val;
        return s.str();
    }

    ///////////////////////////////////////////////////////////////////////////
    // Wrapper Functions
    ///////////////////////////////////////////////////////////////////////////
    string getInfo()
    {
        ostringstream info;
        info << "ArrayFire v" << AF_VERSION << AF_VERSION_MINOR
             << " (CUDA, " << get_system() << ", build " << REVISION << ")" << std::endl;
        info << getPlatformInfo();
        for (int i = 0; i < getDeviceCount(); ++i) {
            info << getDeviceInfo(i);
        }
        return info.str();
    }

    string getDeviceInfo(int device)
    {
        cudaDeviceProp dev = getDeviceProp(device);

        size_t mem_gpu_total = dev.totalGlobalMem;
        //double cc = double(dev.major) + double(dev.minor) / 10;

        bool show_braces = getActiveDeviceId() == device;

        string id = (show_braces ? string("[") : "-") + toString(device) +
                    (show_braces ? string("]") : "-");
        string name(dev.name);
        string memory = toString((mem_gpu_total / (1024 * 1024))
                              + !!(mem_gpu_total % (1024 * 1024)))
                        + string(" MB");
        string compute = string("CUDA Compute ") + toString(dev.major) + string(".") + toString(dev.minor);

        string info = id + string(" ")  +
                    name + string(", ") +
                  memory + string(", ") +
                 compute + string("\n");
        return info;
    }

    string getPlatformInfo()
    {
        string driverVersion = getDriverVersion();
        std::string cudaRuntime = getCUDARuntimeVersion();
        string platform = "Platform: CUDA Toolkit " + cudaRuntime;
        if (!driverVersion.empty()) {
            platform.append(", Driver: ");
            platform.append(driverVersion);
        }
        platform.append("\n");
        return platform;
    }

    string getDriverVersion()
    {
        char driverVersion[1024] = {" ",};
        int x = nvDriverVersion(driverVersion, sizeof(driverVersion));
        if (x != 1) {
            #if !defined(OS_MAC) && !defined(__arm__)  // HACK Mac OSX 10.7 needs new method for fetching driver
            throw runtime_error("Invalid driver");
            #endif
            int driver = 0;
            CUDA(cudaDriverGetVersion(&driver));
            return string("CUDA Driver Version: ") + toString(driver);
        } else {
            return string(driverVersion);
        }
    }

    string getCUDARuntimeVersion()
    {
        int runtime = 0;
        CUDA(cudaRuntimeGetVersion(&runtime));
        if(runtime / 100.f > 0)
            return toString((runtime / 1000) + (runtime % 1000)/ 100.);
        else
            return toString(runtime / 1000) + string(".0");

    }

    int getDeviceCount()
    {
        return DeviceManager::getInstance().nDevices;
    }

    int getActiveDeviceId()
    {
        return DeviceManager::getInstance().activeDev;
    }

    int getDeviceNativeId(int device)
    {
        if(device < (int)DeviceManager::getInstance().cuDevices.size())
            return DeviceManager::getInstance().cuDevices[device].nativeId;
        return -1;
    }

    int setDevice(int device)
    {
        return DeviceManager::getInstance().setActiveDevice(device);
    }

    cudaDeviceProp getDeviceProp(int device)
    {
        if(device < (int)DeviceManager::getInstance().cuDevices.size())
            return DeviceManager::getInstance().cuDevices[device].prop;
        return DeviceManager::getInstance().cuDevices[0].prop;
    }

    ///////////////////////////////////////////////////////////////////////////
    // DeviceManager Class Functions
    ///////////////////////////////////////////////////////////////////////////
    DeviceManager& DeviceManager::getInstance()
    {
        static DeviceManager my_instance;
        return my_instance;
    }

    DeviceManager::DeviceManager()
        : cuDevices(0), activeDev(0), nDevices(0)
    {
        CUDA(cudaGetDeviceCount(&nDevices));
        if (nDevices == 0)
            throw runtime_error("No CUDA-Capable devices found");

        cuDevices.reserve(nDevices);

        for(int i = 0; i < nDevices; i++) {
            cudaDevice_t dev;
            cudaGetDeviceProperties(&dev.prop, i);
            dev.flops = dev.prop.multiProcessorCount * compute2cores(dev.prop.major, dev.prop.minor) * dev.prop.clockRate;
            dev.nativeId = i;
            cuDevices.push_back(dev);
        }

        sortDevices();

        const char* deviceENV = getenv("AF_CUDA_DEFAULT_DEVICE");
        if(!deviceENV) {
            setActiveDevice(0);
        } else {
            stringstream s(deviceENV);
            int def_device = -1;
            s >> def_device;
            if(def_device < 0 || def_device >= nDevices) {
                printf("WARNING: AF_CUDA_DEFAULT_DEVICE is out of range\n");
                printf("Setting default device as 0\n");
                setActiveDevice(0);
            } else {
                setActiveDevice(def_device);
            }
        }
    }

    void DeviceManager::sortDevices(sort_mode mode)
    {
        switch(mode) {
            case memory :
                sort(cuDevices.begin(), cuDevices.end(), card_compare_mem);
                break;
            case flops :
                sort(cuDevices.begin(), cuDevices.end(), card_compare_flops);
                break;
            case compute :
                sort(cuDevices.begin(), cuDevices.end(), card_compare_compute);
                break;
            case none : default :
                sort(cuDevices.begin(), cuDevices.end(), card_compare_num);
                break;
        }
    }

    int DeviceManager::setActiveDevice(int device)
    {
        if(device > (int)cuDevices.size()) {
            return -1;
        } else {
            int old = activeDev;
            CUDA(cudaSetDevice(device));
            activeDev = device;
            return old;
        }
    }

    void sync(int device)
    {
        int currDevice = getActiveDeviceId();
        setDevice(device);
        CUDA_CHECK(cudaDeviceSynchronize());
        setDevice(currDevice);
    }
}


text:
from django.core.urlresolvers import reverse

from django.test.utils import override_settings

from functional_tests.base import FunctionalTest
from questionnaire.models import Questionnaire, QuestionnaireLink
from sample.tests.test_views import route_questionnaire_new

route_add_module = 'sample:add_module'

@override_settings(IS_ACTIVE_FEATURE_MODULE=True)
class AddModuleTest(FunctionalTest):

    fixtures = [
        'groups_permissions.json', 'global_key_values.json', 'sample.json',
        'samplemodule.json'
    ]

    def test_add_module(self):

        # Alice is not logged in. She sees that adding a module requires a login
        self.browser.get(self.live_server_url + reverse(route_add_module))
        self.findBy('xpath', '//input[@name="username"]')
        self.findByNot(
            'xpath', '//input[contains(@class, "link-search-field")]')

        # Alice logs in
        self.doLogin()

        # Again, she goes to the page to add a module
        self.browser.get(self.live_server_url + reverse(route_add_module))
        self.findByNot('xpath', '//input[@name="username"]')
        search_field = self.findBy(
            'xpath', '//input[contains(@class, "link-search-field")]')

        # Step 2 is not visible
        step_2 = self.findBy('id', 'modules-select-module')
        self.assertFalse(step_2.is_displayed())

        # She searches for a sample questionnaire which does not exist
        search_field.send_keys('Foo')
        self.wait_for('xpath', '//li[@class="ui-menu-item"]')
        self.findBy(
            'xpath',
            '//li[@class="ui-menu-item"]//strong[text()="No results found"]')\
            .click()

        # Step 2 is still not visible
        self.assertFalse(step_2.is_displayed())

        # She creates a sample questionnaire
        self.browser.get(self.live_server_url + reverse(
            route_questionnaire_new))

        self.click_edit_section('cat_1')
        self.findBy('name', 'qg_1-0-original_key_1').send_keys('Foo')
        self.findBy('name', 'qg_1-0-original_key_3').send_keys('Bar')
        self.findBy('id', 'button-submit').click()
        self.findBy('xpath', '//div[contains(@class, "success")]')

        # She goes back to the page to add a module
        self.browser.get(self.live_server_url + reverse(route_add_module))
        search_field = self.findBy(
            'xpath', '//input[contains(@class, "link-search-field")]')

        # Step 2 is not visible
        step_2 = self.findBy('id', 'modules-select-module')
        self.assertFalse(step_2.is_displayed())

        # Step 3 is not visible
        step_3 = self.findBy('id', 'modules-create')
        self.assertFalse(step_3.is_displayed())

        # She searches for the created questionnaire and selects the Q
        search_field.send_keys('Foo')
        self.wait_for('xpath', '//li[@class="ui-menu-item"]')
        self.findBy(
            'xpath',
            '//li[@class="ui-menu-item"]//strong[text()="Foo"'
            ']').click()

        # Step 2 is now visible
        self.assertTrue(step_2.is_displayed())

        # Step 3 is hidden
        self.assertFalse(step_3.is_displayed())

        # The preview of the link is displayed
        self.findBy(
            'xpath',
            '//div[contains(@class, "link-preview")]/div[text()="Foo"]')

        # She removes the selected questionnaire again
        self.findBy(
            'xpath',
            '//div[contains(@class, "link-preview")]/div[text()="Foo"]/'
            'a[contains(@class, "close")]').click()
        self.findByNot(
            'xpath',
            '//div[contains(@class, "link-preview")]/div[text()="Foo"]')

        # Step 2 is hidden again
        self.assertFalse(step_2.is_displayed())

        # Step 3 is still hidden
        self.assertFalse(step_3.is_displayed())

        # She reselects the questionnaire
        search_field.send_keys('Foo')
        self.wait_for('xpath', '//li[@class="ui-menu-item"]')
        self.findBy(
            'xpath',
            '//li[@class="ui-menu-item"]//strong[text()="Foo"'
            ']').click()

        # Step 2 is visible again and the preview is displayed
        self.assertTrue(step_2.is_displayed())
        self.findBy(
            'xpath',
            '//div[contains(@class, "link-preview")]/div[text()="Foo"]')

        # Step 3 is still hidden
        self.assertFalse(step_3.is_displayed())

        # She selects the samplemodule module
        samplemodule_radio = self.findBy(
            'xpath',
            '//input[@value="samplemodule" and @name="module"]', wait=True)
        samplemodule_radio.click()

        # She sees that step 3 is now visible.
        self.assertTrue(step_3.is_displayed())

        # She deselects the module and step 3 is hidden again
        samplemodule_radio.click()
        self.assertFalse(step_3.is_displayed())

        # She selects the module again - step 3 is shown again
        samplemodule_radio.click()
        self.assertTrue(step_3.is_displayed())

        # She removes the questionnaire and sees that step 2 and 3 are both
        # hidden again
        self.findBy(
            'xpath',
            '//div[contains(@class, "link-preview")]/div[text()="Foo"]/'
            'a[contains(@class, "close")]').click()
        self.assertFalse(step_2.is_displayed())
        self.assertFalse(step_3.is_displayed())

        # She selects everything again
        search_field.send_keys('Foo')
        self.wait_for('xpath', '//li[@class="ui-menu-item"]')
        self.findBy(
            'xpath',
            '//li[@class="ui-menu-item"]//strong[text()="Foo"'
            ']').click()

        # Wait for radio visibility before clicking it
        radio_xpath = '//input[@value="samplemodule" and @name="module"]'
        self.wait_for('xpath', radio_xpath)
        samplemodule_radio = self.findBy('xpath', radio_xpath)
        samplemodule_radio.click()

        self.assertEqual(Questionnaire.objects.count(), 1)
        self.assertEqual(QuestionnaireLink.objects.count(), 0)

        # She creates the link
        self.findBy('xpath', '//input[@type="submit"]').click()

        # She sees that she has been directed to the page to enter a new
        # samplemodule and she sees a success message.
        self.findBy('xpath', '//div[contains(@class, "is-samplemodule")]')
        self.findBy(
            'xpath',
            '//h1[contains('
            '@class, "tech-output-title") and text()="SAMPLEMODULE"]')
        self.findBy('xpath', '//div[contains(@class, "success")]')

        # The samplemodule questionnaire has already been created
        self.assertEqual(Questionnaire.objects.count(), 2)

        # There is a link between the questionnaire and the module
        self.assertEqual(QuestionnaireLink.objects.count(), 2)

        # She goes back to the page to add a module and tries to create the
        # module to the same questionnaire again.
        self.browser.get(self.live_server_url + reverse(route_add_module))
        search_field = self.findBy(
            'xpath', '//input[contains(@class, "link-search-field")]')
        search_field.send_keys('Foo')
        self.wait_for('xpath', '//li[@class="ui-menu-item"]')
        self.findBy(
            'xpath',
            '//li[@class="ui-menu-item"]//strong[text()="Foo"'
            ']').click()

        # She sees step 2 but does not see a radio button for the module.
        step_2 = self.findBy('id', 'modules-select-module')
        self.assertTrue(step_2.is_displayed())
        self.findByNot(
            'xpath',
            '//input[@value="samplemodule" and @name="module"]')


text:
package iterator_testing

import (
	"runtime"
	"settings"
	"strconv"
	"sync"
	"testing"

	cmap "github.com/streamrail/concurrent-map"
)

type T struct {
	iter int
}

func BenchmarkConcurrentIterator_RW(b *testing.B) {
	cmap := make(map[int64]T, settings.ITERATOR_NUM_ELEMS, runtime.GOMAXPROCS(0))

	// Initialize the map with a fixed number of elements.
	for i := int64(0); i < settings.ITERATOR_NUM_ELEMS; i++ {
		cmap[i] = T{}
	}

	// Begin iteration test
	b.ResetTimer()
	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			for k, v := range cmap {
				v.iter++
				// Read-Modify-Write operation to increment struct field atomically
				t := cmap[k]
				t.iter++
				cmap[k] = t
			}
		}
	})
}

func BenchmarkStreamrailConcurrentIterator_RW(b *testing.B) {
	scmap := cmap.New()

	// Initialize the map with a fixed number of elements.
	for i := int64(0); i < settings.ITERATOR_NUM_ELEMS; i++ {
		scmap.Set(strconv.FormatInt(i, 10), T{})
	}

	// Begin iteration test
	b.ResetTimer()
	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			for item := range scmap.IterBuffered() {
				scmap.Upsert(item.Key, item.Val, func(exists bool, valueInMap interface{}, newValue interface{}) interface{} {
					nv := newValue.(T)
					nv.iter++
					return nv
				})
			}
		}
	})
}

func BenchmarkSynchronizedIterator_RW(b *testing.B) {
	smap := make(map[int64]T, settings.ITERATOR_NUM_ELEMS)
	var mtx sync.Mutex

	// Initialize the map with a fixed number of elements.
	for i := int64(0); i < settings.ITERATOR_NUM_ELEMS; i++ {
		smap[i] = T{}
	}

	// Begin iteration test
	b.ResetTimer()
	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			// Required to lock before iteration begins... huge bottleneck
			mtx.Lock()
			for k, v := range smap {
				v.iter++

				// Read-Modify-Write operation to increment struct field atomically
				t := smap[k]
				t.iter++
				smap[k] = t
			}
			mtx.Unlock()
		}
	})
}

func BenchmarkReaderWriterIterator_RW(b *testing.B) {
	rwmap := make(map[int64]T, settings.ITERATOR_NUM_ELEMS)
	var mtx sync.RWMutex

	// Initialize the map with a fixed number of elements.
	for i := int64(0); i < settings.ITERATOR_NUM_ELEMS; i++ {
		rwmap[i] = T{}
	}

	// Begin iteration test
	b.ResetTimer()
	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			// Required to lock before iteration begins... huge bottleneck, plus no promotion from reader lock to write lock
			mtx.Lock()
			for k, v := range rwmap {
				v.iter++

				// Read-Modify-Write operation to increment struct field atomically
				t := rwmap[k]
				t.iter++
				rwmap[k] = t
			}
			mtx.Unlock()
		}
	})
}


text:
<tool id="Extend1" name="Extend">
  <description>coordinates upstream or downstream</description>
  <command interpreter="perl">extend.pl $input $where $len $input_startCol $input_endCol $input_strandCol > $out_file1</command>
  <inputs>
    <param format="interval" name="input" type="data">
      Extend coordinates of query
    </param>
    <param name="len" size="5" type="integer" value="100" help="(in bp)">
      by
    </param>
    <param name="where" type="select">
      <option value="u">Upstream</option>
      <option value="d">Downstream</option>
      <option value="ud">Both</option>
      to
    </param>
  </inputs>

  <outputs>
    <data format="input" name="out_file1" metadata_source="input" />
  </outputs>
  <help>

.. class:: warningmark

**Notice the difference** between handling of *plus* and *minus* strands.  If **no strand** is specified, regions are handled as if they are on the *plus* strand.

.. class:: infomark

**TIP:** *If your query does not appear in the pull down menu - it is not in INTERVAL format*

-----

**Syntax**

This tools extends coordinates of each genomic region by a specified number of bases. You can choose extending in only one direction (upstream or downstream) or both directions simultaneously.

-----

**Example**

- Input dataset::

    chr1 1000 2000 gene1 0 +
    chr1 5000 6000 gene2 0 -

- Extending it upstream by 100 bp will yield::

    chr1  900 2000 gene1 0 +
    chr1 5000 6100 gene2 0 -

</help>
</tool>