text:
namespace ash {

namespace internal {

namespace {

// The opacity of the backdrop.
const float kBackdropOpacity = 0.5f;

}  // namespace

WorkspaceBackdropDelegate::WorkspaceBackdropDelegate(aura::Window* container)
    : background_(NULL),
      container_(container),
      in_restacking_(false) {
  background_ = new views::Widget;
  views::Widget::InitParams params(
      views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
  params.parent = container_;
  params.bounds = container_->bounds();
  params.layer_type = aura::WINDOW_LAYER_SOLID_COLOR;
  // To disallow the MRU list from picking this window up it should not be
  // activateable.
  params.can_activate = false;
  background_->Init(params);
  background_->GetNativeView()->SetName("WorkspaceBackdropDelegate");
  background_->GetNativeView()->layer()->SetColor(SK_ColorBLACK);
  Show();
  RestackBackdrop();
  container_->AddObserver(this);
}

WorkspaceBackdropDelegate::~WorkspaceBackdropDelegate() {
  container_->RemoveObserver(this);
  ui::ScopedLayerAnimationSettings settings(
      background_->GetNativeView()->layer()->GetAnimator());
  background_->Close();
  settings.AddObserver(views::corewm::CreateHidingWindowAnimationObserver(
      background_->GetNativeView()));
  background_->GetNativeView()->layer()->SetOpacity(0.0f);
}

void WorkspaceBackdropDelegate::OnWindowBoundsChanged(
    aura::Window* window,
    const gfx::Rect& old_bounds,
    const gfx::Rect& new_bounds) {
  // The container size has changed and the layer needs to be adapt to it.
  AdjustToContainerBounds();
}

void WorkspaceBackdropDelegate::OnWindowAddedToLayout(aura::Window* child) {
  RestackBackdrop();
}

void WorkspaceBackdropDelegate::OnWindowRemovedFromLayout(aura::Window* child) {
  RestackBackdrop();
}

void WorkspaceBackdropDelegate::OnChildWindowVisibilityChanged(
    aura::Window* child,
    bool visible) {
  RestackBackdrop();
}

void WorkspaceBackdropDelegate::OnWindowStackingChanged(aura::Window* window) {
  RestackBackdrop();
}

void WorkspaceBackdropDelegate::OnPostWindowStateTypeChange(
    wm::WindowState* window_state,
    wm::WindowStateType old_type) {
  RestackBackdrop();
}

void WorkspaceBackdropDelegate::RestackBackdrop() {
  // Avoid recursive calls.
  if (in_restacking_)
    return;

  aura::Window* window = GetCurrentTopWindow();
  if (!window) {
    // Hide backdrop since no suitable window was found.
    background_->Hide();
    return;
  }
  if (window == background_->GetNativeWindow() &&
      background_->IsVisible()) {
    return;
  }
  // We are changing the order of windows which will cause recursion.
  base::AutoReset<bool> lock(&in_restacking_, true);
  if (!background_->IsVisible())
    Show();
  // Since the backdrop needs to be immediately behind the window and the
  // stacking functions only guarantee a "it's above or below", we need
  // to re-arrange the two windows twice.
  container_->StackChildAbove(background_->GetNativeView(), window);
  container_->StackChildAbove(window, background_->GetNativeView());
}

aura::Window* WorkspaceBackdropDelegate::GetCurrentTopWindow() {
  const aura::Window::Windows& windows = container_->children();
  for (aura::Window::Windows::const_reverse_iterator window_iter =
           windows.rbegin();
       window_iter != windows.rend(); ++window_iter) {
    aura::Window* window = *window_iter;
    if (window->TargetVisibility() &&
        window->type() == ui::wm::WINDOW_TYPE_NORMAL &&
        ash::wm::CanActivateWindow(window))
      return window;
  }
  return NULL;
}

void WorkspaceBackdropDelegate::AdjustToContainerBounds() {
  // Cover the entire container window.
  gfx::Rect target_rect(gfx::Point(0, 0), container_->bounds().size());
  if (target_rect != background_->GetNativeWindow()->bounds()) {
    // This needs to be instant.
    ui::ScopedLayerAnimationSettings settings(
        background_->GetNativeView()->layer()->GetAnimator());
    settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(0));
    background_->GetNativeWindow()->SetBounds(target_rect);
    if (!background_->IsVisible())
      background_->GetNativeView()->layer()->SetOpacity(kBackdropOpacity);
  }
}

void WorkspaceBackdropDelegate::Show() {
  background_->GetNativeView()->layer()->SetOpacity(0.0f);
  background_->Show();
  ui::ScopedLayerAnimationSettings settings(
      background_->GetNativeView()->layer()->GetAnimator());
  background_->GetNativeView()->layer()->SetOpacity(kBackdropOpacity);
}

}  // namespace internal
}  // namespace ash

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.baremetalinfrastructure.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstancePowerStateEnum;
import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalProvisioningStatesEnum;
import com.azure.resourcemanager.baremetalinfrastructure.models.HardwareProfile;
import com.azure.resourcemanager.baremetalinfrastructure.models.NetworkProfile;
import com.azure.resourcemanager.baremetalinfrastructure.models.OSProfile;
import com.azure.resourcemanager.baremetalinfrastructure.models.StorageProfile;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). */
@Fluent
public final class AzureBareMetalInstanceInner extends Resource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBareMetalInstanceInner.class);

    /*
     * AzureBareMetal instance properties
     */
    @JsonProperty(value = "properties")
    private AzureBareMetalInstanceProperties innerProperties;

    /*
     * The system metadata relating to this resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /**
     * Get the innerProperties property: AzureBareMetal instance properties.
     *
     * @return the innerProperties value.
     */
    private AzureBareMetalInstanceProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: The system metadata relating to this resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public AzureBareMetalInstanceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AzureBareMetalInstanceInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the hardwareProfile property: Specifies the hardware settings for the AzureBareMetal instance.
     *
     * @return the hardwareProfile value.
     */
    public HardwareProfile hardwareProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile();
    }

    /**
     * Set the hardwareProfile property: Specifies the hardware settings for the AzureBareMetal instance.
     *
     * @param hardwareProfile the hardwareProfile value to set.
     * @return the AzureBareMetalInstanceInner object itself.
     */
    public AzureBareMetalInstanceInner withHardwareProfile(HardwareProfile hardwareProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AzureBareMetalInstanceProperties();
        }
        this.innerProperties().withHardwareProfile(hardwareProfile);
        return this;
    }

    /**
     * Get the storageProfile property: Specifies the storage settings for the AzureBareMetal instance disks.
     *
     * @return the storageProfile value.
     */
    public StorageProfile storageProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().storageProfile();
    }

    /**
     * Set the storageProfile property: Specifies the storage settings for the AzureBareMetal instance disks.
     *
     * @param storageProfile the storageProfile value to set.
     * @return the AzureBareMetalInstanceInner object itself.
     */
    public AzureBareMetalInstanceInner withStorageProfile(StorageProfile storageProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AzureBareMetalInstanceProperties();
        }
        this.innerProperties().withStorageProfile(storageProfile);
        return this;
    }

    /**
     * Get the osProfile property: Specifies the operating system settings for the AzureBareMetal instance.
     *
     * @return the osProfile value.
     */
    public OSProfile osProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().osProfile();
    }

    /**
     * Set the osProfile property: Specifies the operating system settings for the AzureBareMetal instance.
     *
     * @param osProfile the osProfile value to set.
     * @return the AzureBareMetalInstanceInner object itself.
     */
    public AzureBareMetalInstanceInner withOsProfile(OSProfile osProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AzureBareMetalInstanceProperties();
        }
        this.innerProperties().withOsProfile(osProfile);
        return this;
    }

    /**
     * Get the networkProfile property: Specifies the network settings for the AzureBareMetal instance.
     *
     * @return the networkProfile value.
     */
    public NetworkProfile networkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().networkProfile();
    }

    /**
     * Set the networkProfile property: Specifies the network settings for the AzureBareMetal instance.
     *
     * @param networkProfile the networkProfile value to set.
     * @return the AzureBareMetalInstanceInner object itself.
     */
    public AzureBareMetalInstanceInner withNetworkProfile(NetworkProfile networkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AzureBareMetalInstanceProperties();
        }
        this.innerProperties().withNetworkProfile(networkProfile);
        return this;
    }

    /**
     * Get the azureBareMetalInstanceId property: Specifies the AzureBareMetal instance unique ID.
     *
     * @return the azureBareMetalInstanceId value.
     */
    public String azureBareMetalInstanceId() {
        return this.innerProperties() == null ? null : this.innerProperties().azureBareMetalInstanceId();
    }

    /**
     * Get the powerState property: Resource power state.
     *
     * @return the powerState value.
     */
    public AzureBareMetalInstancePowerStateEnum powerState() {
        return this.innerProperties() == null ? null : this.innerProperties().powerState();
    }

    /**
     * Get the proximityPlacementGroup property: Resource proximity placement group.
     *
     * @return the proximityPlacementGroup value.
     */
    public String proximityPlacementGroup() {
        return this.innerProperties() == null ? null : this.innerProperties().proximityPlacementGroup();
    }

    /**
     * Get the hwRevision property: Hardware revision of an AzureBareMetal instance.
     *
     * @return the hwRevision value.
     */
    public String hwRevision() {
        return this.innerProperties() == null ? null : this.innerProperties().hwRevision();
    }

    /**
     * Get the partnerNodeId property: ARM ID of another AzureBareMetalInstance that will share a network with this
     * AzureBareMetalInstance.
     *
     * @return the partnerNodeId value.
     */
    public String partnerNodeId() {
        return this.innerProperties() == null ? null : this.innerProperties().partnerNodeId();
    }

    /**
     * Set the partnerNodeId property: ARM ID of another AzureBareMetalInstance that will share a network with this
     * AzureBareMetalInstance.
     *
     * @param partnerNodeId the partnerNodeId value to set.
     * @return the AzureBareMetalInstanceInner object itself.
     */
    public AzureBareMetalInstanceInner withPartnerNodeId(String partnerNodeId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AzureBareMetalInstanceProperties();
        }
        this.innerProperties().withPartnerNodeId(partnerNodeId);
        return this;
    }

    /**
     * Get the provisioningState property: State of provisioning of the AzureBareMetalInstance.
     *
     * @return the provisioningState value.
     */
    public AzureBareMetalProvisioningStatesEnum provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}


text:
package org.bulkframework.webapp.fileupload;

/**
 * 文件上传处理接口.
 *
 * 访问已上传的文件时,可以使用应用服务器的虚拟目录功能.
 *
 * @author wiflish
 * @since Apr 8, 2013
 */
public interface FileUploadContext<T> {
    /**
     * 注入文件上传的根路径.
     *
     * @param basePath
     */
    void setBasePath(String basePath);

    /**
     * 注入命名策略.
     *
     * @param fileUploadNameStrategy
     */
    void setFileUploadNameStrategy(FileUploadNameStrategy<T> fileUploadNameStrategy);

    /**
     * 文件上传.(使用初始化注入的文件命名策略)
     *
     * @param fileUploadOption {@link FileUploadOption}
     * @return 返回上传处理后的文件名(包含文件相对路径).
     */
    String upload(T fileUploadOption) throws FileUploadException;

    /**
     * 上传文件,上传后的文件名根据指定的文件命名策略。
     *
     * @param fileUploadOption {@link FileUploadOption}
     * @param strategy 命名策略
     * @return
     */
    String upload(T fileUploadOption, FileUploadNameStrategy<T> strategy) throws FileUploadException;

    /**
     * 删除已上传的文件.
     *
     * @param fileUploadOption
     */
    void delete(T fileUploadOption);
}


text:
namespace moducom { namespace pipeline {

namespace experimental {

struct IReader
{
    // regular classic stream oriented read
    virtual size_t read_experimental(MemoryChunk& chunk);
};

}

class IPipelineReader
{
public:
    // returns a memory chunk with NULLS if no pipeline data was present
    // TODO: Consider turning this into a more traditional read(buf, len) operation and save
    // the more advanced one for IBufferedPipelineReader
    virtual PipelineMessage read() = 0;
};

class IBufferedPipelineReader : public IPipelineReader
{
public:
    // inspect what we would get if we performed a read() operation
    // be careful because status operations are still "live" as with
    // a regular read
    virtual PipelineMessage peek() = 0;

    // move read pointer forward, expected consumer will heed
    // result of peek and then advance past "paid attention to"
    // data from peek.  If length == MemoryChunk::length on
    // first iteration of a peek()/advance_read() combo then
    // operation is implicitly identical to regular read()
    virtual bool advance_read(size_t length) = 0;
};

}}

#endif //MC_COAP_TEST_PIPELINE_READER_H


text:
package org.apache.pulsar.broker.service.persistent;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.service.BrokerService;
import org.apache.pulsar.common.naming.NamespaceName;
import org.apache.pulsar.common.naming.TopicName;
import org.apache.pulsar.common.policies.data.DispatchRate;
import org.apache.pulsar.common.policies.data.Policies;
import org.apache.pulsar.common.util.RateLimiter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DispatchRateLimiter {

    public enum Type {
        TOPIC,
        SUBSCRIPTION,
        REPLICATOR,
        BROKER
    }

    private final PersistentTopic topic;
    private final String topicName;
    private final String subscriptionName;
    private final Type type;

    private final BrokerService brokerService;
    private RateLimiter dispatchRateLimiterOnMessage;
    private RateLimiter dispatchRateLimiterOnByte;

    public DispatchRateLimiter(PersistentTopic topic, Type type) {
        this(topic, null, type);
    }

    public DispatchRateLimiter(PersistentTopic topic, String subscriptionName, Type type) {
        this.topic = topic;
        this.topicName = topic.getName();
        this.subscriptionName = subscriptionName;
        this.brokerService = topic.getBrokerService();
        this.type = type;
        updateDispatchRate();
    }

    public DispatchRateLimiter(BrokerService brokerService) {
        this.topic = null;
        this.topicName = null;
        this.subscriptionName = null;
        this.brokerService = brokerService;
        this.type = Type.BROKER;
        updateDispatchRate();
    }

    /**
     * returns available msg-permit if msg-dispatch-throttling is enabled else it returns -1.
     *
     * @return
     */
    public long getAvailableDispatchRateLimitOnMsg() {
        return dispatchRateLimiterOnMessage == null ? -1 : dispatchRateLimiterOnMessage.getAvailablePermits();
    }

    /**
     * returns available byte-permit if msg-dispatch-throttling is enabled else it returns -1.
     *
     * @return
     */
    public long getAvailableDispatchRateLimitOnByte() {
        return dispatchRateLimiterOnByte == null ? -1 : dispatchRateLimiterOnByte.getAvailablePermits();
    }

    /**
     * It acquires msg and bytes permits from rate-limiter and returns if acquired permits succeed.
     *
     * @param msgPermits
     * @param bytePermits
     * @return
     */
    public boolean tryDispatchPermit(long msgPermits, long bytePermits) {
        boolean acquiredMsgPermit = msgPermits <= 0 || dispatchRateLimiterOnMessage == null
        // acquiring permits must be < configured msg-rate;
                || dispatchRateLimiterOnMessage.tryAcquire(msgPermits);
        boolean acquiredBytePermit = bytePermits <= 0 || dispatchRateLimiterOnByte == null
        // acquiring permits must be < configured msg-rate;
                || dispatchRateLimiterOnByte.tryAcquire(bytePermits);
        return acquiredMsgPermit && acquiredBytePermit;
    }

    /**
     * checks if dispatch-rate limit is configured and if it's configured then check if permits are available or not.
     *
     * @return
     */
    public boolean hasMessageDispatchPermit() {
        return (dispatchRateLimiterOnMessage == null || dispatchRateLimiterOnMessage.getAvailablePermits() > 0)
                && (dispatchRateLimiterOnByte == null || dispatchRateLimiterOnByte.getAvailablePermits() > 0);
    }

    /**
     * Checks if dispatch-rate limiting is enabled.
     *
     * @return
     */
    public boolean isDispatchRateLimitingEnabled() {
        return dispatchRateLimiterOnMessage != null || dispatchRateLimiterOnByte != null;
    }

    /**
     * createDispatchRate according to broker service config.
     *
     * @return
     */
    private DispatchRate createDispatchRate() {
        int dispatchThrottlingRateInMsg;
        long dispatchThrottlingRateInByte;
        ServiceConfiguration config = brokerService.pulsar().getConfiguration();

        switch (type) {
            case TOPIC:
                dispatchThrottlingRateInMsg = config.getDispatchThrottlingRatePerTopicInMsg();
                dispatchThrottlingRateInByte = config.getDispatchThrottlingRatePerTopicInByte();
                break;
            case SUBSCRIPTION:
                dispatchThrottlingRateInMsg = config.getDispatchThrottlingRatePerSubscriptionInMsg();
                dispatchThrottlingRateInByte = config.getDispatchThrottlingRatePerSubscriptionInByte();
                break;
            case REPLICATOR:
                dispatchThrottlingRateInMsg = config.getDispatchThrottlingRatePerReplicatorInMsg();
                dispatchThrottlingRateInByte = config.getDispatchThrottlingRatePerReplicatorInByte();
                break;
            case BROKER:
                dispatchThrottlingRateInMsg = config.getDispatchThrottlingRateInMsg();
                dispatchThrottlingRateInByte = config.getDispatchThrottlingRateInByte();
                break;
            default:
                dispatchThrottlingRateInMsg = -1;
                dispatchThrottlingRateInByte = -1;
        }

        return DispatchRate.builder()
                .dispatchThrottlingRateInMsg(dispatchThrottlingRateInMsg)
                .dispatchThrottlingRateInByte(dispatchThrottlingRateInByte)
                .ratePeriodInSecond(1)
                .relativeToPublishRate(type != Type.BROKER && config.isDispatchThrottlingRateRelativeToPublishRate())
                .build();
    }

    /**
     * Update dispatch-throttling-rate.
     * Topic-level has the highest priority, then namespace-level, and finally use dispatch-throttling-rate in
     * broker-level
     */
    public void updateDispatchRate() {
        DispatchRate dispatchRate;
        switch (type) {
            case TOPIC:
                dispatchRate = topic.getDispatchRate();
                break;
            case SUBSCRIPTION:
                dispatchRate = topic.getSubscriptionDispatchRate(subscriptionName);
                break;
            case REPLICATOR:
                dispatchRate = topic.getReplicatorDispatchRate();
                break;
            case BROKER:
                dispatchRate = createDispatchRate();
                break;
            default:
                log.warn("ignore configured dispatch rate for type {}", type);
                return;
        }
        if (type == Type.BROKER) {
            log.info("configured broker message-dispatch rate {}", dispatchRate);
        } else {
            log.info("[{}] configured {} message-dispatch rate at broker {}",
                this.topicName, type, dispatchRate);
        }
        updateDispatchRate(dispatchRate);
    }

    public static CompletableFuture<Optional<Policies>> getPoliciesAsync(BrokerService brokerService,
         String topicName) {
        final NamespaceName namespace = TopicName.get(topicName).getNamespaceObject();
        return brokerService.pulsar().getPulsarResources().getNamespaceResources().getPoliciesAsync(namespace);
    }

    public static Optional<Policies> getPolicies(BrokerService brokerService, String topicName) {
        final NamespaceName namespace = TopicName.get(topicName).getNamespaceObject();
        return brokerService.pulsar().getPulsarResources().getNamespaceResources().getPoliciesIfCached(namespace);
    }

    /**
     * Update dispatch rate by updating msg and byte rate-limiter. If dispatch-rate is configured < 0 then it closes
     * the rate-limiter and disables appropriate rate-limiter.
     *
     * @param dispatchRate
     */
    public synchronized void updateDispatchRate(DispatchRate dispatchRate) {
        // synchronized to prevent race condition from concurrent zk-watch
        log.info("setting message-dispatch-rate {}", dispatchRate);

        long msgRate = dispatchRate.getDispatchThrottlingRateInMsg();
        long byteRate = dispatchRate.getDispatchThrottlingRateInByte();
        long ratePeriod = dispatchRate.getRatePeriodInSecond();

        Supplier<Long> permitUpdaterMsg = dispatchRate.isRelativeToPublishRate()
                ? () -> getRelativeDispatchRateInMsg(dispatchRate)
                : null;
        // update msg-rateLimiter
        if (msgRate > 0) {
            if (this.dispatchRateLimiterOnMessage == null) {
                this.dispatchRateLimiterOnMessage =
                        RateLimiter.builder()
                                .scheduledExecutorService(brokerService.pulsar().getExecutor())
                                .permits(msgRate)
                                .rateTime(ratePeriod)
                                .timeUnit(TimeUnit.SECONDS)
                                .permitUpdater(permitUpdaterMsg)
                                .isDispatchOrPrecisePublishRateLimiter(true)
                                .build();
            } else {
                this.dispatchRateLimiterOnMessage.setRate(msgRate, dispatchRate.getRatePeriodInSecond(),
                        TimeUnit.SECONDS, permitUpdaterMsg);
            }
        } else {
            // message-rate should be disable and close
            if (this.dispatchRateLimiterOnMessage != null) {
                this.dispatchRateLimiterOnMessage.close();
                this.dispatchRateLimiterOnMessage = null;
            }
        }

        Supplier<Long> permitUpdaterByte = dispatchRate.isRelativeToPublishRate()
                ? () -> getRelativeDispatchRateInByte(dispatchRate)
                : null;
        // update byte-rateLimiter
        if (byteRate > 0) {
            if (this.dispatchRateLimiterOnByte == null) {
                this.dispatchRateLimiterOnByte =
                        RateLimiter.builder()
                                .scheduledExecutorService(brokerService.pulsar().getExecutor())
                                .permits(byteRate)
                                .rateTime(ratePeriod)
                                .timeUnit(TimeUnit.SECONDS)
                                .permitUpdater(permitUpdaterByte)
                                .isDispatchOrPrecisePublishRateLimiter(true)
                                .build();
            } else {
                this.dispatchRateLimiterOnByte.setRate(byteRate, dispatchRate.getRatePeriodInSecond(),
                        TimeUnit.SECONDS, permitUpdaterByte);
            }
        } else {
            // message-rate should be disable and close
            if (this.dispatchRateLimiterOnByte != null) {
                this.dispatchRateLimiterOnByte.close();
                this.dispatchRateLimiterOnByte = null;
            }
        }
    }

    private long getRelativeDispatchRateInMsg(DispatchRate dispatchRate) {
        return (topic != null && dispatchRate != null)
                ? (long) topic.getLastUpdatedAvgPublishRateInMsg() + dispatchRate.getDispatchThrottlingRateInMsg()
                : 0;
    }

    private long getRelativeDispatchRateInByte(DispatchRate dispatchRate) {
        return (topic != null && dispatchRate != null)
                ? (long) topic.getLastUpdatedAvgPublishRateInByte() + dispatchRate.getDispatchThrottlingRateInByte()
                : 0;
    }

    /**
     * Get configured msg dispatch-throttling rate. Returns -1 if not configured
     *
     * @return
     */
    public long getDispatchRateOnMsg() {
        return dispatchRateLimiterOnMessage != null ? dispatchRateLimiterOnMessage.getRate() : -1;
    }

    /**
     * Get configured byte dispatch-throttling rate. Returns -1 if not configured
     *
     * @return
     */
    public long getDispatchRateOnByte() {
        return dispatchRateLimiterOnByte != null ? dispatchRateLimiterOnByte.getRate() : -1;
    }

    public static boolean isDispatchRateEnabled(DispatchRate dispatchRate) {
        return dispatchRate != null && (dispatchRate.getDispatchThrottlingRateInMsg() > 0
                || dispatchRate.getDispatchThrottlingRateInByte() > 0);
    }

    public void close() {
        // close rate-limiter
        if (dispatchRateLimiterOnMessage != null) {
            dispatchRateLimiterOnMessage.close();
            dispatchRateLimiterOnMessage = null;
        }
        if (dispatchRateLimiterOnByte != null) {
            dispatchRateLimiterOnByte.close();
            dispatchRateLimiterOnByte = null;
        }
    }

    private static final Logger log = LoggerFactory.getLogger(DispatchRateLimiter.class);
}


text:
/*
 * Changes for GemFireXD distributed data platform (some marked by "GemStone changes")
 *
 * Portions Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */

package com.pivotal.gemfirexd.internal.impl.jdbc;

import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.SQLException;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;

/* ---- New jdbc 2.0 types ----- */
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Ref;

import java.net.URL;
import java.util.Map;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;

import java.util.Calendar;

import com.pivotal.gemfirexd.internal.iapi.error.StandardException;
import com.pivotal.gemfirexd.internal.iapi.reference.JDBC30Translation;
import com.pivotal.gemfirexd.internal.iapi.reference.SQLState;
import com.pivotal.gemfirexd.internal.iapi.services.io.StreamStorable;
import com.pivotal.gemfirexd.internal.iapi.sql.conn.StatementContext;
import com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor;
import com.pivotal.gemfirexd.internal.impl.jdbc.EmbedConnection;
import com.pivotal.gemfirexd.internal.impl.jdbc.EmbedResultSet;
import com.pivotal.gemfirexd.internal.impl.jdbc.Util;

/**
 * This class extends the EmbedCallableStatement class in order to support new
 * methods and classes that come with JDBC 2.0.
 *
 *	@see com.pivotal.gemfirexd.internal.impl.jdbc.EmbedCallableStatement
 *
 */
public abstract class EmbedCallableStatement20
	extends com.pivotal.gemfirexd.internal.impl.jdbc.EmbedCallableStatement
{

	//////////////////////////////////////////////////////////////
	//
	// CONSTRUCTORS
	//
	//////////////////////////////////////////////////////////////
//GemStone changes BEGIN
	public EmbedCallableStatement20 (EmbedConnection conn, String sql,
								   int resultSetType,
								   int resultSetConcurrency,
								   int resultSetHoldability,
								   long id, short execFlags)
		throws SQLException
	{
		super(conn, sql, resultSetType, resultSetConcurrency,
		    resultSetHoldability, id, execFlags);
	}
//      GemStone changes END
	/////////////////////////////////////////////////////////////////////////
	//
	//	JDBC 2.0	-	New public methods
	//
	/////////////////////////////////////////////////////////////////////////

    /**
     * JDBC 2.0
     *
     * Get the value of a NUMERIC parameter as a java.math.BigDecimal object.
     *
     * @param parameterIndex the first parameter is 1, the second is 2, ...
     * @return the parameter value (full precision); if the value is SQL NULL,
     * the result is null
     * @exception SQLException if a database-access error occurs.
     */
    public BigDecimal getBigDecimal(int parameterIndex) throws SQLException
	{
		checkStatus();
		try {
			DataValueDescriptor dvd = getParms().getParameterForGet(parameterIndex-1);
			if (wasNull = dvd.isNull())
				return null;

			return com.pivotal.gemfirexd.internal.iapi.types.SQLDecimal.getBigDecimal(dvd);

		} catch (StandardException e)
		{
			throw EmbedResultSet.noStateChangeException(e,
			    "parameter index " + parameterIndex /* GemStoneAddition */);
		}
	}

    /**
     * JDBC 2.0
     *
     * Returns an object representing the value of OUT parameter @i.
     * Use the @map to determine the class from which to construct
     * data of SQL structured and distinct types.
     *
     * @param i the first parameter is 1, the second is 2, ...
     * @param map the mapping from SQL type names to Java classes
     * @return a java.lang.Object holding the OUT parameter value.
     * @exception SQLException if a database-access error occurs.
     */
	public Object  getObject (int i, java.util.Map map) throws SQLException
	{
		checkStatus();
		if( map == null)
            throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,map,"map",
                                              "java.sql.CallableStatement.getObject");
        if(!(map.isEmpty()))
            throw Util.notImplemented();
        // Map is empty call the normal getObject method.
        return getObject(i);
	}

    /**
     * JDBC 2.0
     *
     * Get a REF(<structured-type>) OUT parameter.
     *
     * @param i the first parameter is 1, the second is 2, ...
     * @return an object representing data of an SQL REF Type
     * @exception SQLException if a database-access error occurs.
     */
	public Ref getRef (int i) throws SQLException {
		throw Util.notImplemented();
	}

    /**
     * JDBC 2.0
     *
     * Get an Array OUT parameter.
     *
     * @param i the first parameter is 1, the second is 2, ...
     * @return an object representing an SQL array
     * @exception SQLException if a database-access error occurs.
     */
    public Array getArray (int i) throws SQLException {
		throw Util.notImplemented();
	}

	/*
	 * Note: all the JDBC 2.0 Prepared statement methods are duplicated in here
	 * because this class inherits from Local/EmbedCallableStatement, which
	 * inherits from local/PreparedStatement.  This class should inherit from a
	 * local20/PreparedStatement.  Since java does not allow multiple inheritance,
	 * duplicate the code here.
	 */

     /**
      * JDBC 2.0
      *
      * Set a REF(<structured-type>) parameter.
      *
      * @param i the first parameter is 1, the second is 2, ...
      * @param x an object representing data of an SQL REF Type
      * @exception SQLException Feature not implemented for now.
      */
     public void setRef (int i, Ref x) throws SQLException {
 		throw Util.notImplemented();
	 }

     /**
      * JDBC 2.0
      *
      * Set an Array parameter.
      *
      * @param i the first parameter is 1, the second is 2, ...
      * @param x an object representing an SQL array
      * @exception SQLException Feature not implemented for now.
      */
     public void setArray (int i, Array x) throws SQLException {
 		throw Util.notImplemented();
	 }

	/////////////////////////////////////////////////////////////////////////
	//
	//	JDBC 3.0	-	New public methods
	//
	/////////////////////////////////////////////////////////////////////////

	/**
    * JDBC 3.0
    *
    * Registers the OUT parameter named parameterName to the JDBC type sqlType.
    * All OUT parameters must be registered before a stored procedure is executed.
    *
    * @param parameterName - the name of the parameter
    * @param sqlType - the JDBC type code defined by java.sql.Types. If the
    * parameter is of JDBC type NUMERIC or DECIMAL, the version of registerOutParameter
    * that accepts a scale value should be used.
    * @exception SQLException Feature not implemented for now.
	*/
	public void registerOutParameter(String parameterName,
					int sqlType)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Registers the designated output parameter. This version of the method
    * registerOutParameter should be used for a user-named or REF output parameter.
    *
    * @param parameterName - the name of the parameter
    * @param sqlType - the SQL type code defined by java.sql.Types.
    * @param typeName - the fully-qualified name of an SQL structure type
    * @exception SQLException Feature not implemented for now.
	*/
	public void registerOutParameter(String parameterName,
					int sqlType, String typeName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Registers the parameter named parameterName to the JDBC type sqlType.
    * This method must be called before a stored procedure is executed.
    *
    * @param parameterName - the name of the parameter
    * @param sqlType - the SQL type code defined by java.sql.Types.
    * @param scale - the desired number of digits to the right of the decimal point.
    * It must be greater than or equal to zero.
    * @exception SQLException Feature not implemented for now.
	*/
	public void registerOutParameter(String parameterName,
					int sqlType, int scale)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC REF (<structured-type) parameter as a Ref object
    * in the Java programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value as a Ref object in the Java Programming language.
    * If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Ref getRef(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC BLOB parameter as a Blob object
    * in the Java programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value as a Blob object in the Java Programming language.
    * If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Blob getBlob(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC CLOB parameter as a Clob object
    * in the Java programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value as a Clob object in the Java Programming language.
    * If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Clob getClob(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC ARRAY parameter as an Array object
    * in the Java programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value as a Array object in the Java Programming language.
    * If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Array getArray(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to SQL NULL.
    *
    * @param parameterName - the name of the parameter
    * @param sqlType - the SQL type code defined in java.sql.Types
    * @exception SQLException Feature not implemented for now.
	*/
	public void setNull(String parameterName, int sqlType)
    throws SQLException
	{
		throw Util.notImplemented();
	}
	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to SQL NULL.
    *
    * @param parameterName - the name of the parameter
    * @param sqlType - the SQL type code defined in java.sql.Types
    * @param typeName - the fully-qualified name of an SQL user-defined type
    * @exception SQLException Feature not implemented for now.
	*/
	public void setNull(String parameterName, int sqlType, String typeName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java boolean value. The driver
    * converts this to an SQL BIT value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setBoolean(String parameterName, boolean x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC BIT parameter as a boolean in the Java
    * programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is false.
    * @exception SQLException Feature not implemented for now.
	*/
	public boolean getBoolean(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java byte value. The driver
    * converts this to an SQL TINYINT value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setByte(String parameterName, byte x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC TINYINT parameter as a byte in the Java
    * programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is 0.
    * @exception SQLException Feature not implemented for now.
	*/
	public byte getByte(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java short value. The driver
    * converts this to an SQL SMALLINT value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setShort(String parameterName, short x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC SMALLINT parameter as a short in the Java
    * programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is 0.
    * @exception SQLException Feature not implemented for now.
	*/
	public short getShort(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java int value. The driver
    * converts this to an SQL INTEGER value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setInt(String parameterName, int x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC INTEGER parameter as a int in the Java
    * programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is 0.
    * @exception SQLException Feature not implemented for now.
	*/
	public int getInt(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java long value. The driver
    * converts this to an SQL BIGINT value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setLong(String parameterName, long x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC BIGINT parameter as a long in the Java
    * programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is 0.
    * @exception SQLException Feature not implemented for now.
	*/
	public long getLong(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java float value. The driver
    * converts this to an SQL FLOAT value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setFloat(String parameterName, float x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC FLOAT parameter as a float in the Java
    * programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is 0.
    * @exception SQLException Feature not implemented for now.
	*/
	public float getFloat(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java double value. The driver
    * converts this to an SQL DOUBLE value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setDouble(String parameterName, double x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC DOUBLE parameter as a double in the Java
    * programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is 0.
    * @exception SQLException Feature not implemented for now.
	*/
	public double getDouble(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given java.math.BigDecimal value. The driver
    * converts this to an SQL NUMERIC value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setBigDecimal(String parameterName, BigDecimal x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC NUMERIC parameter as a java.math.BigDecimal
    * object with as many digits to the right of the decimal point as the value contains
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is 0.
    * @exception SQLException Feature not implemented for now.
	*/
	public BigDecimal getBigDecimal(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java String value. The driver
    * converts this to an SQL VARCHAR OR LONGVARCHAR value (depending on the
    * argument's size relative the driver's limits on VARCHAR values) when it
    * sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setString(String parameterName, String x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC CHAR, VARCHAR, or LONGVARCHAR parameter as
    * a String in the Java programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public String getString(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Java array of bytes. The driver
    * converts this to an SQL VARBINARY OR LONGVARBINARY (depending on the argument's
    * size relative to the driver's limits on VARBINARY values)when it sends it to
    * the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setBytes(String parameterName, byte[] x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC BINARY or VARBINARY parameter as an array
    * of byte values in the Java programming language.
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public byte[] getBytes(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given java.sql.Date value. The driver
    * converts this to an SQL DATE value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setDate(String parameterName, Date x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given java.sql.Date value, using the given
    * Calendar object.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @param cal - the Calendar object the driver will use to construct the date
    * @exception SQLException Feature not implemented for now.
	*/
	public void setDate(String parameterName, Date x, Calendar cal)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC DATE parameter as ajava.sql.Date object
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Date getDate(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC DATE parameter as a java.sql.Date object,
    * using the given Calendar object to construct the date object.
    *
    * @param parameterName - the name of the parameter
    * @param cal - the Calendar object the driver will use to construct the date
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Date getDate(String parameterName, Calendar cal)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given java.sql.Time value. The driver
    * converts this to an SQL TIME value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setTime(String parameterName, Time x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC TIME parameter as ajava.sql.Time object
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Time getTime(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC TIME parameter as a java.sql.Time object,
    * using the given Calendar object to construct the time object.
    *
    * @param parameterName - the name of the parameter
    * @param cal - the Calendar object the driver will use to construct the time
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Time getTime(String parameterName, Calendar cal)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given java.sql.Time value using the
    * Calendar object
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @param cal - the Calendar object the driver will use to construct the time
    * @exception SQLException Feature not implemented for now.
	*/
	public void setTime(String parameterName, Time x, Calendar cal)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given java.sql.Timestamp value. The driver
    * converts this to an SQL TIMESTAMP value when it sends it to the database.
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setTimestamp(String parameterName, Timestamp x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given java.sql.Timestamp value, using the
    * given Calendar object
    *
    * @param parameterName - the name of the parameter
    * @param x - the parameter value
    * @param cal - the Calendar object the driver will use to construct the timestamp.
    * @exception SQLException Feature not implemented for now.
	*/
	public void setTimestamp(String parameterName, Timestamp x, Calendar cal)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object
    *
    * @param parameterName - the name of the parameter
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Timestamp getTimestamp(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object,
    * using the given Calendar object to construct the Timestamp object.
    *
    * @param parameterName - the name of the parameter
    * @param cal - the Calendar object the driver will use to construct the Timestamp
    * @return the parameter value. If the value is SQL NULL, the result is null.
    * @exception SQLException Feature not implemented for now.
	*/
	public Timestamp getTimestamp(String parameterName, Calendar cal)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given input stream, which will have the
    * specified number of bytes.
    *
    * @param parameterName - the name of the parameter
    * @param x - the Java input stream that contains the ASCII parameter value
    * @param length - the number of bytes in the stream
    * @exception SQLException Feature not implemented for now.
	*/
	public void setAsciiStream(String parameterName, InputStream x, int length)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given input stream, which will have the
    * specified number of bytes.
    *
    * @param parameterName - the name of the parameter
    * @param x - the Java input stream that contains the binary parameter value
    * @param length - the number of bytes in the stream
    * @exception SQLException Feature not implemented for now.
	*/
	public void setBinaryStream(String parameterName, InputStream x, int length)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the designated parameter to the given Reader object, which is the given
    * number of characters long.
    *
    * @param parameterName - the name of the parameter
    * @param reader - the java.io.Reader object that contains the UNICODE data
    * @param length - the number of characters in the stream
    * @exception SQLException Feature not implemented for now.
	*/
	public void setCharacterStream(String parameterName, Reader reader, int length)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the value of the designated parameter with the given object. The second
    * argument must be an object type; for integral values, the java.lang equivalent
    * objects should be used.
    *
    * @param parameterName - the name of the parameter
    * @param x - the object containing the input parameter value
    * @param targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to
    * the database. The scale argument may further qualify this type.
    * @param scale - for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this
    * is the number of digits after the decimal point. For all other types, this value
    * will be ignored.
    * @exception SQLException Feature not implemented for now.
	*/
	public void setObject(String parameterName, Object x, int targetSqlType, int scale)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Retrieves the value of a parameter as an Object in the java programming language.
    *
    * @param parameterName - the name of the parameter
    * @return a java.lang.Object holding the OUT parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public Object getObject(String parameterName)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Returns an object representing the value of OUT parameter i and uses map for
    * the custom mapping of the parameter value.
    *
    * @param parameterName - the name of the parameter
    * @param map - the mapping from SQL type names to Java classes
    * @return a java.lang.Object holding the OUT parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public Object getObject(String parameterName, Map map)
    throws SQLException
	{
		checkStatus();
		if( map == null)
            throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,map,"map",
                                              "java.sql.CallableStatement.getObject");
        if(!(map.isEmpty()))
            throw Util.notImplemented();

        // Map is empty so call the normal getObject method.
        return getObject(parameterName);
	}

	/**
    * JDBC 3.0
    *
    * Sets the value of the designated parameter with the given object. This method
    * is like the method setObject above, except that it assumes a scale of zero.
    *
    * @param parameterName - the name of the parameter
    * @param x - the object containing the input parameter value
    * @param targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to
    * the database.
    * @exception SQLException Feature not implemented for now.
	*/
	public void setObject(String parameterName, Object x, int targetSqlType)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/**
    * JDBC 3.0
    *
    * Sets the value of the designated parameter with the given object. The second
    * parameter must be of type Object; therefore, the java.lang equivalent objects
    * should be used for built-in types.
    *
    * @param parameterName - the name of the parameter
    * @param x - the object containing the input parameter value
    * @exception SQLException Feature not implemented for now.
	*/
	public void setObject(String parameterName, Object x)
    throws SQLException
	{
		throw Util.notImplemented();
	}

	/*
	** Methods using BigDecimal, moved out of EmbedPreparedStatement
	** to allow that class to support JSR169.
	*/
	/**
     * Set a parameter to a java.lang.BigDecimal value.
     * The driver converts this to a SQL NUMERIC value when
     * it sends it to the database.
     *
     * @param parameterIndex the first parameter is 1, the second is 2, ...
     * @param x the parameter value
	 * @exception SQLException thrown on failure.
     */
    public final void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
		checkStatus();
		try {
			/* JDBC is one-based, DBMS is zero-based */
			getParms().getParameterForSet(parameterIndex - 1).setBigDecimal(x);

		} catch (Throwable t) {
			throw EmbedResultSet.noStateChangeException(t,
			    "parameter index " + parameterIndex /* GemStoneAddition */);
		}
	}
    /**
	 * @see CallableStatement#getBigDecimal
     * @exception SQLException NoOutputParameters thrown.
     * @deprecated
     */
    public final BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
	{
    	BigDecimal v = getBigDecimal(parameterIndex);
    	if (v != null)
    		v = v.setScale(scale, BigDecimal.ROUND_HALF_DOWN);
    	return v;
	}
	/**
		Allow explict setObject conversions by sub-classes for classes
		not supported by this variant. In this case handle BigDecimal.
		@return true if the object was set successfully, false if no valid
		conversion exists.

		@exception SQLException value could not be set.
	*/
	boolean setObjectConvert(int parameterIndex, Object x) throws SQLException
	{
		if (x instanceof BigDecimal) {
			setBigDecimal(parameterIndex, (BigDecimal) x);
			return true;
		}
		return false;
	}

    /////////////////////////////////////////////////////////////////////////
    //
    //	JDBC 4.0	-	New public methods
    //
    /////////////////////////////////////////////////////////////////////////

    /**
     * Retrieves the value of the designated parameter as a
     * <code>java.io.Reader</code> object in the Java programming language.
     * Introduced in JDBC 4.0.
     *
     * @param parameterIndex the first parameter is 1, the second is 2, ...
     * @return a <code>java.io.Reader</code> object that contains the parameter
     *         value; if the value is SQL <code>NULL</code>, the value returned
     *         is <code>null</code> in the Java programming language.
     * @throws SQLException if a database access error occurs or this method is
     *                      called on a closed <code>CallableStatement</code>
     */
    public Reader getCharacterStream(int parameterIndex)
        throws SQLException {
        checkStatus();
        // Make sure the specified parameter has mode OUT or IN/OUT.
        switch (getParms().getParameterMode(parameterIndex)) {
            case JDBC30Translation.PARAMETER_MODE_IN:
            case JDBC30Translation.PARAMETER_MODE_UNKNOWN:
                throw newSQLException(SQLState.LANG_NOT_OUTPUT_PARAMETER,
                                      Integer.toString(parameterIndex));
        }
        Reader reader = null;
        int paramType = getParameterJDBCType(parameterIndex);
        switch (paramType) {
            // Handle character/string types.
            case Types.CHAR:
            case Types.VARCHAR:
            case Types.LONGVARCHAR:
            case Types.CLOB:
                boolean pushStack = false;
                Object syncObject = getConnectionSynchronization();
                synchronized (syncObject) {
                try {
                    DataValueDescriptor param =
                        getParms().getParameterForGet(parameterIndex -1);
                    if (param.isNull()) {
                        break;
                    }
                    pushStack = true;
                    setupContextStack(false);

                    StreamStorable ss = (StreamStorable)param;
                    InputStream stream = ss.returnStream();
                    if (stream == null) {
                        reader = new StringReader(param.getString());
                    } else {
                        reader = new UTF8Reader(stream, 0, this, syncObject);
                    }
                } catch (Throwable t) {
                    throw EmbedResultSet.noStateChangeException(t,
                        "parameter index " + parameterIndex /* GemStoneAddition */);
                } finally {
                    if (pushStack) {
                        restoreContextStack();
                    }
                }
                } // End synchronized block
                break;

            // Handle binary types.
            // JDBC says to support these, but no defintion exists for the output.
            // Match JCC which treats the bytes as a UTF-16BE stream.
            case Types.BINARY:
            case Types.VARBINARY:
            case Types.LONGVARBINARY:
            case Types.BLOB:
                try {
                    InputStream is = getBinaryStream(parameterIndex);
                    if (is != null) {
                        reader = new InputStreamReader(is, "UTF-16BE");
                    }
                    break;
                } catch (UnsupportedEncodingException uee) {
                    throw newSQLException(uee.getMessage());
                }

            default:
                throw newSQLException(SQLState.LANG_DATA_TYPE_GET_MISMATCH,
                        "java.io.Reader", Util.typeName(paramType), parameterIndex);
        }
        // Update wasNull.
        wasNull = (reader == null);
        return reader;
    }

    // Private utility classes

    /**
     * Get binary stream for a parameter.
     *
     * @param parameterIndex first parameter is 1, second is 2 etc.
     * @return a stream for the binary parameter, or <code>null</code>.
     *
     * @throws SQLException if a database access error occurs.
     */
    private InputStream getBinaryStream(int parameterIndex)
        throws SQLException {
        int paramType = getParameterJDBCType(parameterIndex);
        switch (paramType) {
            case Types.BINARY:
            case Types.VARBINARY:
            case Types.LONGVARBINARY:
            case Types.BLOB:
                break;
            default:
                throw newSQLException(SQLState.LANG_DATA_TYPE_GET_MISMATCH,
                        "java.io.InputStream", Util.typeName(paramType), parameterIndex);
        }

        boolean pushStack = false;
        synchronized (getConnectionSynchronization()) {
            try {
                DataValueDescriptor param =
                    getParms().getParameterForGet(parameterIndex -1);
                wasNull = param.isNull();
                if (wasNull) {
                    return null;
                }
                pushStack = true;
                setupContextStack(false);

                StreamStorable ss = (StreamStorable)param;
                InputStream stream = ss.returnStream();
                if (stream == null) {
                    stream = new ByteArrayInputStream(param.getBytes());
                } else {
                    stream = new BinaryToRawStream(stream, param);
                }
                return stream;
            } catch (Throwable t) {
                throw EmbedResultSet.noStateChangeException(t,
                    "parameter index " + parameterIndex /* GemStoneAddition */);
            } finally {
                if (pushStack) {
                    restoreContextStack();
                }
            }
        } // End synchronized block
    }
}


text:
<?xml version="1.0" ?><para version="5.0" xml:lang="zh" xmlns="http://docbook.org/ns/docbook">

Description of catalog configuration options

    <col width="50%"/>
    <col width="50%"/>

        Configuration option = Default value
        描述

        [catalog]

        <option>cache_time</option> = <replaceable>无</replaceable>
        (IntOpt) Time to cache catalog data (in seconds). This has no effect unless global and catalog caching are enabled.

        <option>caching</option> = <replaceable>True</replaceable>
        (BoolOpt) Toggle for catalog caching. This has no effect unless global caching is enabled.

        <option>driver</option> = <replaceable>keystone.catalog.backends.sql.Catalog</replaceable>
        (StrOpt) Catalog backend driver.

        <option>list_limit</option> = <replaceable>无</replaceable>
        (IntOpt) Maximum number of entities that will be returned in a catalog collection.

        <option>template_file</option> = <replaceable>default_catalog.templates</replaceable>
        (StrOpt) Catalog template file name for use with the template catalog backend.

</para>


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

//those tables from login site

//bas system setup tables
$config['table_system_assigned_group'] = 'bas_system_assigned_group';
$config['table_system_user_group'] = 'bas_system_user_group';
$config['table_system_task'] = 'bas_system_task';
$config['table_system_user_group_role'] = 'bas_system_user_group_role';
$config['table_system_history'] = 'bas_system_history';
$config['table_system_history_hack'] = 'bas_system_history_hack';
$config['table_system_site_offline'] = 'bas_system_site_offline';


text:
#include <iostream>

#include "gtest/gtest.h"
#include "composite_offsets_test/MessageHeader.h"
#include "composite_offsets_test/TestMessage1.h"

using namespace composite::offsets::test;

class CompositeOffsetsCodeGenTest : public testing::Test
{
public:

    std::uint64_t encodeHdr(char *buffer, std::uint64_t offset, std::uint64_t bufferLength)
    {
        m_hdr.wrap(buffer, offset, 0, bufferLength)
            .blockLength(TestMessage1::sbeBlockLength())
            .templateId(TestMessage1::sbeTemplateId())
            .schemaId(TestMessage1::sbeSchemaId())
            .version(TestMessage1::sbeSchemaVersion());

        return m_hdr.encodedLength();
    }

    std::uint64_t encodeMsg(char *buffer, std::uint64_t offset, std::uint64_t bufferLength)
    {
        m_msg.wrapForEncode(buffer, offset, bufferLength);

        TestMessage1::Entries &entries = m_msg.entriesCount(2);

        entries.next()
            .tagGroup1(10)
            .tagGroup2(20);

        entries.next()
            .tagGroup1(30)
            .tagGroup2(40);

        return m_msg.encodedLength();
    }

    MessageHeader m_hdr;
    MessageHeader m_hdrDecoder;
    TestMessage1 m_msg;
    TestMessage1 m_msgDecoder;
};

TEST_F(CompositeOffsetsCodeGenTest, shouldReturnCorrectValuesForMessageHeaderStaticFields)
{
    EXPECT_EQ(MessageHeader::encodedLength(), 12u);
    // only checking the block length field
    EXPECT_EQ(MessageHeader::blockLengthNullValue(), 65535);
    EXPECT_EQ(MessageHeader::blockLengthMinValue(), 0);
    EXPECT_EQ(MessageHeader::blockLengthMaxValue(), 65534);
}

TEST_F(CompositeOffsetsCodeGenTest, shouldReturnCorrectValuesForTestMessage1StaticFields)
{
    EXPECT_EQ(TestMessage1::sbeBlockLength(), 0);
    EXPECT_EQ(TestMessage1::sbeTemplateId(), 1);
    EXPECT_EQ(TestMessage1::sbeSchemaId(), 15);
    EXPECT_EQ(TestMessage1::sbeSchemaVersion(), 0);
    EXPECT_EQ(std::string(TestMessage1::sbeSemanticType()), std::string(""));
    EXPECT_EQ(TestMessage1::Entries::sbeBlockLength(), 16u);
    EXPECT_EQ(TestMessage1::Entries::sbeHeaderSize(), 8u);
}

TEST_F(CompositeOffsetsCodeGenTest, shouldBeAbleToEncodeMessageHeaderCorrectly)
{
    char buffer[2048];
    const char *bp = buffer;

    std::uint64_t sz = encodeHdr(buffer, 0, sizeof(buffer));

    EXPECT_EQ(sz, 12u);
    EXPECT_EQ(*((::uint16_t *)bp), TestMessage1::sbeBlockLength());
    EXPECT_EQ(*((::uint16_t *)(bp + 4)), TestMessage1::sbeTemplateId());
    EXPECT_EQ(*((::uint16_t *)(bp + 8)), TestMessage1::sbeSchemaId());
    EXPECT_EQ(*((::uint16_t *)(bp + 10)), TestMessage1::sbeSchemaVersion());
}

TEST_F(CompositeOffsetsCodeGenTest, shouldBeAbleToEncodeAndDecodeMessageHeaderCorrectly)
{
    char buffer[2048];

    encodeHdr(buffer, 0, sizeof(buffer));

    m_hdrDecoder.wrap(buffer, 0, 0, sizeof(buffer));
    EXPECT_EQ(m_hdrDecoder.blockLength(), TestMessage1::sbeBlockLength());
    EXPECT_EQ(m_hdrDecoder.templateId(), TestMessage1::sbeTemplateId());
    EXPECT_EQ(m_hdrDecoder.schemaId(), TestMessage1::sbeSchemaId());
    EXPECT_EQ(m_hdrDecoder.version(), TestMessage1::sbeSchemaVersion());
}

TEST_F(CompositeOffsetsCodeGenTest, shouldBeAbleToEncodeMessageCorrectly)
{
    char buffer[2048];
    const char *bp = buffer;
    std::uint64_t sz = encodeMsg(buffer, 0, sizeof(buffer));

    EXPECT_EQ(sz, 40u);

    EXPECT_EQ(*(::uint16_t *)bp, TestMessage1::Entries::sbeBlockLength());
    EXPECT_EQ(*(::uint8_t *)(bp + 7), 2u);
    EXPECT_EQ(*(::uint64_t *)(bp + 8), 10u);
    EXPECT_EQ(*(::int64_t *)(bp + 16), 20u);
    EXPECT_EQ(*(::uint64_t *)(bp + 24), 30u);
    EXPECT_EQ(*(::int64_t *)(bp + 32), 40u);
}

TEST_F(CompositeOffsetsCodeGenTest, shouldBeAbleToDecodeHeaderAndMsgCorrectly)
{
    char buffer[2048];
    std::uint64_t hdrSz = encodeHdr(buffer, 0, sizeof(buffer));
    std::uint64_t sz = encodeMsg(buffer, hdrSz, sizeof(buffer));

    EXPECT_EQ(hdrSz, 12u);
    EXPECT_EQ(sz, 40u);

    m_hdrDecoder.wrap(buffer, 0, 0, hdrSz + sz);

    EXPECT_EQ(m_hdrDecoder.blockLength(), TestMessage1::sbeBlockLength());
    EXPECT_EQ(m_hdrDecoder.templateId(), TestMessage1::sbeTemplateId());
    EXPECT_EQ(m_hdrDecoder.schemaId(), TestMessage1::sbeSchemaId());
    EXPECT_EQ(m_hdrDecoder.version(), TestMessage1::sbeSchemaVersion());

    m_msgDecoder.wrapForDecode(buffer, hdrSz, TestMessage1::sbeBlockLength(), TestMessage1::sbeSchemaVersion(), hdrSz + sz);

    TestMessage1::Entries entries = m_msgDecoder.entries();
    EXPECT_EQ(entries.count(), 2u);

    ASSERT_TRUE(entries.hasNext());
    entries.next();
    EXPECT_EQ(entries.tagGroup1(), 10u);
    EXPECT_EQ(entries.tagGroup2(), 20u);

    ASSERT_TRUE(entries.hasNext());
    entries.next();
    EXPECT_EQ(entries.tagGroup1(), 30u);
    EXPECT_EQ(entries.tagGroup2(), 40u);

    EXPECT_EQ(m_msgDecoder.encodedLength(), 40u);
}


text:
(function() {
  var App, Output, SyncPrompt, commands,
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  SyncPrompt = require('./sync_prompt');

  Output = require('./output/local_output');

  commands = require('./commands');

  App = (function() {
    App.prototype._commands = [];

    function App(scope) {
      this.scope = scope;
      this.find_command = __bind(this.find_command, this);
      this.typeahead = __bind(this.typeahead, this);
      this.output = new Output();
      this.prompt = new SyncPrompt({
        typeahead: this.typeahead
      });
      this.prompt.on('data', this.find_command);
    }

    App.prototype.commands = function() {
      var command, i;
      if (this._commands.length === 0) {
        for (i in commands) {
          command = commands[i];
          this._commands.push(new command({
            output: this.output,
            scope: this.scope
          }));
        }
      }
      return this._commands;
    };

    App.prototype.typeahead = function(input) {
      var command, items, _i, _len, _ref;
      if (input == null) {
        input = '';
      }
      items = [];
      _ref = this.commands();
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        command = _ref[_i];
        items = items.concat(command.typeahead(input));
      }
      if (input) {
        items = items.filter(function(item) {
          return item.indexOf(input) === 0;
        });
      }
      return [items, input];
    };

    App.prototype.find_command = function(input, chain) {
      var args, command, match, _i, _len, _ref;
      _ref = this.commands();
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        command = _ref[_i];
        if (match = command.match(input.trim())) {
          args = String(match[1]).trim().split(' ');
          return command.execute.call(command, args, chain);
        }
      }
      return false;
    };

    App.prototype.open = function() {
      this.prompt.type('whereami');
      return this.prompt.open();
    };

    return App;

  })();

  module.exports = App;

}).call(this);


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**OriginationUrls** | [**[]TrunkingV1OriginationUrl**](TrunkingV1OriginationUrl.md) |  |[optional]
**Meta** | [**ListCredentialListResponseMeta**](ListCredentialListResponseMeta.md) |  |[optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
OBJCXX_SOURCES := main.mm myobject.mm
include Makefile.rules
CFLAGS_NO_DEBUG =
ifeq "$(OS)" "Darwin"
		CFLAGS_NO_DEBUG += -arch $(ARCH)
endif

# myobject.o needs to be built without debug info
myobject.o: myobject.mm
	$(CXX) $(CFLAGS_NO_DEBUG) -c -o $@ $<


text:
trait ListItem<'a> {
    fn list_name() -> &'a str;
}

trait Collection { fn len(&self) -> usize; }

struct List<'a, T: ListItem<'a>> {
    slice: &'a [T]
//~^ ERROR the parameter type `T` may not live long enough
//~| HELP consider adding an explicit lifetime bound
//~| NOTE ...so that the reference type `&'a [T]` does not outlive the data it points at
}
impl<'a, T: ListItem<'a>> Collection for List<'a, T> {
    fn len(&self) -> usize {
        0
    }
}

fn main() {}


text:
@extends('layouts.default')

@section('title', 'Product')
@section('top_script')

@endsection
@section('content')

@lang('actions.create')

                    {!! Form::open(['route' => ['product.store'], 'class' => 'form-horizontal', 'id' => 'product-form', 'files' => true]) !!}

has('photos') ? ' has-error' : '' }}">
                            {{ Form::label('photos', trans('forms.photos'), ['class' => 'col-md-3 control-label']) }}

                                <input id="files" class="inputfile" name='photos[]' type="file" multiple/>
                                Select Images
                                <output id="result" />

                                @if ($errors->has('photos'))

                                        {{ $errors->first('photos') }}

                                @endif

has('name') ? ' has-error' : '' }}">
                            {{ Form::label('name', trans('forms.name'), ['class' => 'col-md-3 control-label']) }}

                                {{ Form::text('name', null, ['class' => 'form-control']) }}

                                @if ($errors->has('name'))

                                        {{ $errors->first('name') }}

                                @endif

has('author') ? ' has-error' : '' }}">
                            {{ Form::label('author', trans('forms.author'), ['class' => 'col-md-3 control-label']) }}

                                {{ Form::text('author', null, ['class' => 'form-control']) }}

                                {{ trans('forms.author_helper') }}
                                @if ($errors->has('author'))

                                        {{ $errors->first('author') }}

                                @endif

has('category_id') ? ' has-error' : '' }}">
                            {{ Form::label('category_id', trans('forms.category'), ['class' => 'col-md-3 control-label']) }}

                                {{ Form::select('category_id', $categories, null, ['placeholder' => trans('forms.category').'...', 'class' => 'form-control', 'id' => 'category_id']) }}

                                @if ($errors->has('category_id'))

                                        {{ $errors->first('category_id') }}

                                @endif

has('subcategory_id') ? ' has-error' : '' }}">
                            {{ Form::label('subcategory_id', trans('forms.subcategory'), ['class' => 'col-md-3 control-label']) }}

                                {{ Form::select('subcategory_id', $subcategories, null, ['placeholder' => trans('forms.subcategory').'...', 'class' => 'form-control', 'id' => 'subcategory_id']) }}

                                @if ($errors->has('subcategory_id'))

                                        {{ $errors->first('subcategory_id') }}

                                @endif

has('price') ? ' has-error' : '' }}">
                            {{ Form::label('price', trans('forms.price'), ['class' => 'col-md-3 control-label']) }}

									Rp
									{{ Form::text('price', null, ['class' => 'form-control', 'id' => 'price']) }}

                                @if ($errors->has('price'))

                                        {{ $errors->first('price') }}

                                @endif

has('condition') ? ' has-error' : '' }}">
                            {{ Form::label('condition', trans('forms.condition'), ['class' => 'col-md-3 control-label']) }}

                                {{ Form::select('condition', ['Baru' => 'Baru', 'Bekas' => 'Bekas'], null, ['placeholder' => trans('forms.condition').'...', 'class' => 'form-control', 'id' => 'condition']) }}

                                @if ($errors->has('condition_id'))

                                        {{ $errors->first('condition_id') }}

                                @endif

has('weight') ? ' has-error' : '' }}">
                            {{ Form::label('weight', trans('forms.weight'), ['class' => 'col-md-3 control-label']) }}

									{{ Form::text('weight', null, ['class' => 'form-control']) }}
									Gram

                                @if ($errors->has('weight'))

                                        {{ $errors->first('weight') }}

                                @endif

has('synopsis') ? ' has-error' : '' }}">
                            {{ Form::label('synopsis', trans('forms.synopsis'), ['class' => 'col-md-3 control-label']) }}

                                {{ Form::textarea('synopsis', null, ['class' => 'form-control', 'rows' => '4']) }}

                                @if ($errors->has('synopsis'))

                                        {{ $errors->first('synopsis') }}

                                @endif

has('notes') ? ' has-error' : '' }}">
                            {{ Form::label('notes', trans('forms.notes'), ['class' => 'col-md-3 control-label']) }}

                                {{ Form::textarea('notes', null, ['class' => 'form-control', 'rows' => '2']) }}

                                @if ($errors->has('notes'))

                                        {{ $errors->first('notes') }}

                                @endif

                                {{ Form::submit(trans('actions.save'), ['class' => 'btn btn-info']) }}
                                @lang('actions.cancel')

                    {!! Form::close() !!}

@endsection

@section('bottom_script')

@endsection


text:
extern int test_st_malloc();
extern int test_st_object();
extern int test_st_array();
extern int test_st_dict();

int main() {
    int errors = 0;

    errors += test_st_malloc();
    errors += test_st_object();
    errors += test_st_array();
    errors += test_st_dict();

    return errors;
}


text:
I am ZnWebSocketControlFrameHandledEvent.
I am a ZnLogEvent.

I am emitted when a WebSocket control frame is handled automatically. I know the type of frame that is being handled.


text:
package com.ibm.xsp.theme.bootstrap.plugin;

import org.eclipse.core.runtime.Plugin;

import com.ibm.xsp.theme.bootstrap.minifier.Loader;

import com.ibm.xsp.extlib.minifier.ExtLibLoaderExtension;

public class Activator extends Plugin {

	public static Activator instance;

	public Activator() {
		instance = this;

        ExtLibLoaderExtension.getExtensions().add(new Loader());
	}
}


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

   reset.css
   * Resets default browser CSS.

-------------------------------------------------------------- */

html {
	margin:0;
	padding:0;
	border:0;
}

body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, code,
del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, dialog, figure, footer, header,
hgroup, nav, section {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

/* This helps to make newer HTML5 elements behave like DIVs in older browers */
article, aside, details, figcaption, figure, dialog,
footer, header, hgroup, menu, nav, section {
    display:block;
}

/* Line-height should always be unitless! */
body {
  line-height: 1.5;
  background: white;
}

/* Tables still need 'cellspacing="0"' in the markup. */
table {
	border-collapse: separate;
	border-spacing: 0;
}
/* float:none prevents the span-x classes from breaking table-cell display */
caption, th, td {
	text-align: left;
	font-weight: normal;
	float:none !important;
}
table, th, td {
	vertical-align: middle;
}

/* Remove possible quote marks (") from <q>, <blockquote>. */
blockquote:before, blockquote:after, q:before, q:after { content: ''; }
blockquote, q { quotes: "" ""; }

/* Remove annoying border on linked images. */
a img { border: none; }

/* Remember to define your own focus styles! */
:focus { outline: 0; }


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

/**
 * @fileoverview Component for set of algebraic identifier editor.
 */

// Every editor directive should implement an alwaysEditable option. There
// may be additional customization options for the editor that should be passed
// in via initArgs.

import { ChangeDetectorRef } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { downgradeComponent } from '@angular/upgrade/static';
import { AppConstants } from 'app.constants';
import { GuppyInitializationService } from 'services/guppy-initialization.service';

interface SetOfAlgebraicIdentifierEditorSchema {
  type: 'list';
  items: {
    type: 'unicode';
    choices: string[];
  };
  validators: [{
    id: 'is_uniquified';
  }];
}

@Component({
  selector: 'set-of-algebraic-identifier-editor',
  templateUrl: './set-of-algebraic-identifier-editor.component.html',
  styleUrls: []
})
export class SetOfAlgebraicIdentifierEditorComponent implements OnInit {
  // These properties are initialized using Angular lifecycle hooks
  // and we need to do non-null assertion, for more information see
  // https://github.com/oppia/oppia/wiki/Guide-on-defining-types#ts-7-1
  @Input() modalId!: symbol;
  @Input() value!: string[];
  SCHEMA!: SetOfAlgebraicIdentifierEditorSchema;
  @Output() valueChanged = new EventEmitter();
  PLACEHOLDER_INFO = (
    'NOTE: This rule will consider each side of the equation ' +
    'independently and won\'t allow reordering of terms ' +
    'around the = sign.');

  constructor(
    private guppyInitializationService: GuppyInitializationService,
    private changeDetectorRef: ChangeDetectorRef
  ) { }

  ngOnInit(): void {
    let customOskLetters = (
      this.guppyInitializationService.getCustomOskLetters());

    let choices = (
      customOskLetters ? customOskLetters :
      AppConstants.VALID_ALGEBRAIC_IDENTIFIERS);

    this.SCHEMA = {
      type: 'list',
      items: {
        type: 'unicode',
        choices: choices as unknown as string[]
      },
      validators: [{
        id: 'is_uniquified'
      }]
    };

    if (!this.value) {
      this.value = [];
    }
  }

  getSchema(): SetOfAlgebraicIdentifierEditorSchema {
    return this.SCHEMA;
  }

  updateValue(newValue: string[]): void {
    if (this.value !== newValue) {
      this.value = newValue;
      this.valueChanged.emit(this.value);
      this.changeDetectorRef.detectChanges();
    }
  }
}

angular.module('oppia').directive(
  'setOfAlgebraicIdentifierEditor', downgradeComponent({
    component: SetOfAlgebraicIdentifierEditorComponent
  }) as angular.IDirectiveFactory);


text:
from weblab.comm.codes import WEBLAB_GENERAL_EXCEPTION_CODE, PYTHON_GENERAL_EXCEPTION_CODE
from voodoo.sessions.session_id import SessionId
import weblab.comm.web_server as WebFacadeServer
import weblab.experiment.util as Util

FILE_SENT = 'file_sent'
FILE_INFO = 'file_info'
SESSION_ID = 'session_id'
IS_ASYNC = 'is_async'

BASE_HTML_TEMPLATE="""<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>WebLab upload</title>
    </head>
    <body>%(MESSAGE)s</body>
</html>
"""

SUCCESS_HTML_TEMPLATE = BASE_HTML_TEMPLATE % {
		"MESSAGE" : "SUCCESS@%(RESULT)s"
	}

FAULT_HTML_TEMPLATE = BASE_HTML_TEMPLATE % {
		"MESSAGE" : "ERROR@%(THE_FAULT_CODE)s@%(THE_FAULT_MESSAGE)s"
	}

class FileUploadMethod(WebFacadeServer.Method):
    path = '/upload/'

    def run(self):
        """
        run()
        Handles file uploading. It will extract the required parameters FILE_SENT, FILE_INFO,
        SESSION_ID, and the optional parameter IS_ASYNC, and call either send_file or
        send_async_file depending on this last one.
        @return HTML defined above, with the success or failure response.
        """
        try:
            file_info, file_sent, session_id, is_async = self._check_arguments()
            file_content = Util.serialize(file_sent)
            sid = SessionId(session_id)

            if(not is_async):
                result = self.server.send_file(sid, file_content, file_info)
            else:
                result = self.server.send_async_file(sid, file_content, file_info)

        except FileUploadError as fue:
            code, message = fue.args
            return FAULT_HTML_TEMPLATE % {
                        'THE_FAULT_CODE' : code,
                        'THE_FAULT_MESSAGE' : message
                    }
        except Exception as e:
            message = e.args[0]
            return FAULT_HTML_TEMPLATE % {
                        'THE_FAULT_CODE' : PYTHON_GENERAL_EXCEPTION_CODE,
                        'THE_FAULT_MESSAGE' : message
                    }
        else:

            if not is_async:
                resultstr = result.commandstring
            else:
                resultstr = result

            print "[DBG] Returning result from file upload: " + resultstr

            return SUCCESS_HTML_TEMPLATE % {
                            'RESULT' : resultstr
                    }

    def _check_arguments(self):
        """
        _check_arguments()
        Retrieves the arguments which describe the file being sent.
        These areguments are the file_sent, the file-info, the sessionid, and optionally
        @return file_info, file_sent, session_id, is_async
        """
        file_info = self.get_argument(FILE_INFO)
        if file_info is None:
            raise FileUploadError(WEBLAB_GENERAL_EXCEPTION_CODE, "%s argument not provided!" % FILE_INFO)
        file_sent = self.get_argument(FILE_SENT)
        if file_sent is None:
            raise FileUploadError(WEBLAB_GENERAL_EXCEPTION_CODE, "%s argument not provided!" % FILE_SENT)
        session_id = self.get_argument(SESSION_ID)
        if session_id is None:
            raise FileUploadError(WEBLAB_GENERAL_EXCEPTION_CODE, "%s argument not provided!" % SESSION_ID)

        # Read the IS_ASYNC parameter, which will indicate us whether we should execute the send_file asynchronously
        # or synchronously.
        is_async_str = self.get_argument(IS_ASYNC)
        if is_async_str is None:
            is_async = False
        else:
            is_async_str = is_async_str.lower()
            if is_async_str in ("true", "yes", "1"):
                is_async = True
            elif is_async_str in ("false", "no", "0"):
                is_async = False
            else:
                raise FileUploadError(WEBLAB_GENERAL_EXCEPTION_CODE, "%s argument is present but not valid (should be a boolean)!" % IS_ASYNC)
        return file_info, file_sent, session_id, is_async

class FileUploadError(Exception):
    pass


text:
GitVersion is a tool to help you achieve *Semantic Versioning* on your project.

This influences many of the decisions GitVersion has made, please read and understand this page as it will help you start using GitVersion effectively!

## Compatibility
GitVersion works on Mac, Linux with Mono and Windows.

Tip: If you get `System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux/x86_64/libgit2-baa87df.so`

You likely need to install `libcurl3`. Run `sudo get-get install libcurl3`

## Assumptions/Rules
### Tags override other rules
If a commit is tagged, then GitVersion will *always* use that version over any calculated versions. This is so if you rebuild a tag then the same version will be produced.

### The Semantic Version does not increment every commit
This trips a lot of people up, by default GitVersion *does not* increment the SemVer every commit. This means that you will get multiple builds producing the *same version* of your application.

Read more at [version increments](more-info/version-increments.md)

### Version sources
There are a number of sources GitVersion can get its versions from, they include:

 - Tags
 - Version numbers in branches (e.g. `release/2.0.0`)
 - Merge messages (for branches with versions in them, e.g. `Merged branch 'release/2.0.0' into master`)
 - Track version of another branch (e.g. develop tracks master, so when master increments so does develop)
 - GitVersion.yml file (e.g `next-version: 2.0.0`)

Read more at [version sources](more-info/version-sources.md)

## Configuration
GitVersion v3 was rewritten to be very configuration driven rather than hardcoding git workflows into it. This has made it a lot more flexible. Configuration options can be set globally or per branch.

Read more about [configuration](configuration.md)

## Output Variables
We recognise that a single formatted version number does not work for all cases. A simple example is NuGet, it doesn't support SemVer 2.0 meaning that the SemVer of `1.3.5-beta.10+500` needs to be formatted as `1.3.5-beta0010` so it will sort properly.

You can just run `GitVersion.exe` in your repository to see what variables are available (by default a json object is returned).

## Exe or MSBuild Task
There are two ways to consume GitVersion, the first is by running GitVersion.exe. The second is an MSBuild task. The MSBuild task is really easy to get up and running, simply install GitVersionTask from NuGet and it will integrate into your project and write out variables to your build server if it's running on one. The exe offers more options and works for .NET projects as well as other project types.

Read more about [using GitVersion](usage/usage.md)

## Supported languages and frameworks
GitVersion is language and framework agnostic.

### Automatic update of version in projects
GitVersion supports the following projects to automatically update its version information.

| ProjectType                           | Command Line Tool           | MS Build Task  |
| :------------------------------------ | :-------------------------- | :------------- |
| C# Project with `AssemblyInfo.cs`     | Supported                   | Supported      |
| VB.NET Project with `AssemblyInfo.vb` | Supported                   | Supported      |