text:
namespace Microsoft.Azure.Management.ContainerRegistry.Fluent
{
    using Microsoft.Azure.Management.ContainerRegistry.Fluent.Models;
    using Microsoft.Azure.Management.ContainerRegistry.Fluent.RegistrySourceTrigger.Definition;
    using Microsoft.Azure.Management.ContainerRegistry.Fluent.RegistrySourceTrigger.Update;
    using Microsoft.Azure.Management.ContainerRegistry.Fluent.RegistrySourceTrigger.UpdateDefinition;
    using Microsoft.Azure.Management.ContainerRegistry.Fluent.RegistryTask.Definition;
    using Microsoft.Azure.Management.ContainerRegistry.Fluent.RegistryTask.Update;
    using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
    using Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResource.Definition;
    using Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResource.Update;
    using Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResourceActions;
    using System.Collections.Generic;

    internal partial class RegistrySourceTriggerImpl
    {
        /// <summary>
        /// Gets the branch of the repository that is being used as source control. I.e., master.
        /// </summary>
        string Microsoft.Azure.Management.ContainerRegistry.Fluent.IRegistrySourceTrigger.SourceControlBranch
        {
            get
            {
                return this.SourceControlBranch();
            }
        }

        /// <summary>
        /// Gets the URL of the repository used as source control.
        /// </summary>
        string Microsoft.Azure.Management.ContainerRegistry.Fluent.IRegistrySourceTrigger.SourceControlRepositoryUrl
        {
            get
            {
                return this.SourceControlRepositoryUrl();
            }
        }

        /// <summary>
        /// Gets Returns the type of source control this trigger uses. I.e., Github, AzureDevOps etc.
        /// </summary>
        Models.SourceControlType Microsoft.Azure.Management.ContainerRegistry.Fluent.IRegistrySourceTrigger.SourceControlType
        {
            get
            {
                return this.SourceControlType();
            }
        }

        /// <summary>
        /// Gets the list of actions that trigger an event. I.e., a commit, a pull request etc.
        /// </summary>
        System.Collections.Generic.IReadOnlyList<Models.SourceTriggerEvent> Microsoft.Azure.Management.ContainerRegistry.Fluent.IRegistrySourceTrigger.SourceTriggerEvents
        {
            get
            {
                return this.SourceTriggerEvents();
            }
        }

        /// <summary>
        /// Gets the source trigger status. I.e., enabled, disabled.
        /// </summary>
        Models.TriggerStatus Microsoft.Azure.Management.ContainerRegistry.Fluent.IRegistrySourceTrigger.Status
        {
            get
            {
                return this.Status();
            }
        }

        /// <summary>
        /// Attaches the child definition to the parent resource update.
        /// </summary>
        /// <return>The next stage of the parent definition.</return>
        RegistryTask.Update.IUpdate Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResource.Update.IInUpdate<RegistryTask.Update.IUpdate>.Attach()
        {
            return this.Attach();
        }

        /// <summary>
        /// Attaches the child definition to the parent resource definiton.
        /// </summary>
        /// <return>The next stage of the parent definition.</return>
        RegistryTask.Definition.ITaskCreatable Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResource.Definition.IInDefinition<RegistryTask.Definition.ITaskCreatable>.Attach()
        {
            return this.Attach();
        }

        /// <summary>
        /// Begins an update for a child resource.
        /// This is the beginning of the builder pattern used to update child resources
        /// The final method completing the update and continue
        /// the actual parent resource update process in Azure is  Settable.parent().
        /// </summary>
        /// <return>The stage of  parent resource update.</return>
        RegistryTask.Update.IUpdate Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResourceActions.ISettable<RegistryTask.Update.IUpdate>.Parent()
        {
            return this.Parent();
        }

        /// <summary>
        /// The function that specifies Azure DevOps will be used as the type of source control.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.IRepositoryUrl RegistrySourceTrigger.Definition.IBlank.WithAzureDevOpsAsSourceControl()
        {
            return this.WithAzureDevOpsAsSourceControl();
        }

        /// <summary>
        /// The function that specifies Azure DevOps will be used as the type of source control.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.IRepositoryUrl RegistrySourceTrigger.UpdateDefinition.IBlank.WithAzureDevOpsAsSourceControl()
        {
            return this.WithAzureDevOpsAsSourceControl();
        }

        /// <summary>
        /// The function that specifies Azure DevOps will be used as the type of source control.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ISourceControlType.WithAzureDevOpsAsSourceControl()
        {
            return this.WithAzureDevOpsAsSourceControl();
        }

        /// <summary>
        /// The function that specifies a commit action will trigger a run.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ITriggerEventsDefinition.WithCommitTriggerEvent()
        {
            return this.WithCommitTriggerEvent();
        }

        /// <summary>
        /// The function that specifies a commit action will trigger a run.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.ITriggerEventsDefinition.WithCommitTriggerEvent()
        {
            return this.WithCommitTriggerEvent();
        }

        /// <summary>
        /// The function that specifies a commit action will trigger a run.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.ITriggerEventsDefinition.WithCommitTriggerEvent()
        {
            return this.WithCommitTriggerEvent();
        }

        /// <summary>
        /// The function that specifies Github will be used as the type of source control.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.IRepositoryUrl RegistrySourceTrigger.Definition.IBlank.WithGithubAsSourceControl()
        {
            return this.WithGithubAsSourceControl();
        }

        /// <summary>
        /// The function that specifies Github will be used as the type of source control.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.IRepositoryUrl RegistrySourceTrigger.UpdateDefinition.IBlank.WithGithubAsSourceControl()
        {
            return this.WithGithubAsSourceControl();
        }

        /// <summary>
        /// The function that specifies Github will be used as the type of source control.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ISourceControlType.WithGithubAsSourceControl()
        {
            return this.WithGithubAsSourceControl();
        }

        /// <summary>
        /// The function that specifies a pull action will trigger a run.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ITriggerEventsDefinition.WithPullTriggerEvent()
        {
            return this.WithPullTriggerEvent();
        }

        /// <summary>
        /// The function that specifies a pull action will trigger a run.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.ITriggerEventsDefinition.WithPullTriggerEvent()
        {
            return this.WithPullTriggerEvent();
        }

        /// <summary>
        /// The function that specifies a pull action will trigger a run.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.ITriggerEventsDefinition.WithPullTriggerEvent()
        {
            return this.WithPullTriggerEvent();
        }

        /// <summary>
        /// The function that allows the user to input the type of the token used for authentication and the token itself to authenticate to the source control repository.
        /// </summary>
        /// <param name="tokenType">The type of the token used to authenticate to the source control repository.</param>
        /// <param name="token">The token used to authenticate to the source control repository.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.IRepositoryBranchAndAuth.WithRepositoryAuthentication(TokenType tokenType, string token)
        {
            return this.WithRepositoryAuthentication(tokenType, token);
        }

        /// <summary>
        /// The function that allows the user to input the type of the token used for authentication and the token itself to authenticate to the source control repository.
        /// </summary>
        /// <param name="tokenType">The type of the token used to authenticate to the source control repository.</param>
        /// <param name="token">The token used to authenticate to the source control repository.</param>
        /// <param name="refreshToken">The token that is used to refresh the access token.</param>
        /// <param name="scope">The scope of the access token.</param>
        /// <param name="expiresIn">Time in seconds that the token remains valid.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.IRepositoryBranchAndAuth.WithRepositoryAuthentication(TokenType tokenType, string token, string refreshToken, string scope, int expiresIn)
        {
            return this.WithRepositoryAuthentication(tokenType, token, refreshToken, scope, expiresIn);
        }

        /// <summary>
        /// The function that allows the user to input the type of the token used for authentication and the token itself to authenticate to the source control repository.
        /// </summary>
        /// <param name="tokenType">The type of the token used to authenticate to the source control repository.</param>
        /// <param name="token">The token used to authenticate to the source control repository.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.IRepositoryBranchAndAuth.WithRepositoryAuthentication(TokenType tokenType, string token)
        {
            return this.WithRepositoryAuthentication(tokenType, token);
        }

        /// <summary>
        /// The function that allows the user to input the type of the token used for authentication and the token itself to authenticate to the source control repository.
        /// </summary>
        /// <param name="tokenType">The type of the token used to authenticate to the source control repository.</param>
        /// <param name="token">The token used to authenticate to the source control repository.</param>
        /// <param name="refreshToken">The token that is used to refresh the access token.</param>
        /// <param name="scope">The scope of the access token.</param>
        /// <param name="expiresIn">Time in seconds that the token remains valid.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.IRepositoryBranchAndAuth.WithRepositoryAuthentication(TokenType tokenType, string token, string refreshToken, string scope, int expiresIn)
        {
            return this.WithRepositoryAuthentication(tokenType, token, refreshToken, scope, expiresIn);
        }

        /// <summary>
        /// The function that allows the user to input the type of the token used for authentication and the token itself to authenticate to the source control repository.
        /// </summary>
        /// <param name="tokenType">The type of the token used to authenticate to the source control repository.</param>
        /// <param name="token">The token used to authenticate to the source control repository.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.IRepositoryBranchAndAuth.WithRepositoryAuthentication(TokenType tokenType, string token)
        {
            return this.WithRepositoryAuthentication(tokenType, token);
        }

        /// <summary>
        /// The function that allows the user to input the type of the token used for authentication and the token itself to authenticate to the source control repository.
        /// </summary>
        /// <param name="tokenType">The type of the token used to authenticate to the source control repository.</param>
        /// <param name="token">The token used to authenticate to the source control repository.</param>
        /// <param name="refreshToken">The token that is used to refresh the access token.</param>
        /// <param name="scope">The scope of the access token.</param>
        /// <param name="expiresIn">Time in seconds that the token remains valid.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.IRepositoryBranchAndAuth.WithRepositoryAuthentication(TokenType tokenType, string token, string refreshToken, string scope, int expiresIn)
        {
            return this.WithRepositoryAuthentication(tokenType, token, refreshToken, scope, expiresIn);
        }

        /// <summary>
        /// The function that specifies the branch of the respository to use.
        /// </summary>
        /// <param name="branch">The repository branch.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.IRepositoryBranchAndAuth.WithRepositoryBranch(string branch)
        {
            return this.WithRepositoryBranch(branch);
        }

        /// <summary>
        /// The function that specifies the branch of the respository to use.
        /// </summary>
        /// <param name="branch">The repository branch.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.IRepositoryBranchAndAuth.WithRepositoryBranch(string branch)
        {
            return this.WithRepositoryBranch(branch);
        }

        /// <summary>
        /// The function that specifies the branch of the respository to use.
        /// </summary>
        /// <param name="branch">The repository branch.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.IRepositoryBranchAndAuth.WithRepositoryBranch(string branch)
        {
            return this.WithRepositoryBranch(branch);
        }

        /// <summary>
        /// The function that allows the user to input their own kind of source control.
        /// </summary>
        /// <param name="sourceControl">The source control the user wishes to use.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.IRepositoryUrl RegistrySourceTrigger.Definition.IBlank.WithSourceControl(SourceControlType sourceControl)
        {
            return this.WithSourceControl(sourceControl);
        }

        /// <summary>
        /// The function that allows the user to input their own kind of source control.
        /// </summary>
        /// <param name="sourceControl">The source control the user wishes to use.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.IRepositoryUrl RegistrySourceTrigger.UpdateDefinition.IBlank.WithSourceControl(SourceControlType sourceControl)
        {
            return this.WithSourceControl(sourceControl);
        }

        /// <summary>
        /// The function that allows the user to input their own kind of source control.
        /// </summary>
        /// <param name="sourceControl">The source control the user wishes to use.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ISourceControlType.WithSourceControl(SourceControlType sourceControl)
        {
            return this.WithSourceControl(sourceControl);
        }

        /// <summary>
        /// The function that specifies the URL of the source control repository.
        /// </summary>
        /// <param name="sourceControlRepositoryUrl">The URL of the source control repository.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.IRepositoryUrl.WithSourceControlRepositoryUrl(string sourceControlRepositoryUrl)
        {
            return this.WithSourceControlRepositoryUrl(sourceControlRepositoryUrl);
        }

        /// <summary>
        /// The function that specifies the URL of the source control repository.
        /// </summary>
        /// <param name="sourceControlRepositoryUrl">The URL of the source control repository.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ITriggerEventsDefinition RegistrySourceTrigger.Definition.IRepositoryUrl.WithSourceControlRepositoryUrl(string sourceControlRepositoryUrl)
        {
            return this.WithSourceControlRepositoryUrl(sourceControlRepositoryUrl);
        }

        /// <summary>
        /// The function that specifies the URL of the source control repository.
        /// </summary>
        /// <param name="sourceControlRepositoryUrl">The URL of the source control repository.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ITriggerEventsDefinition RegistrySourceTrigger.UpdateDefinition.IRepositoryUrl.WithSourceControlRepositoryUrl(string sourceControlRepositoryUrl)
        {
            return this.WithSourceControlRepositoryUrl(sourceControlRepositoryUrl);
        }

        /// <summary>
        /// The function that allows the user to specify an action that will trigger a run when it is executed.
        /// </summary>
        /// <param name="sourceTriggerEvent">The action that will trigger a run.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ITriggerEventsDefinition.WithTriggerEvent(SourceTriggerEvent sourceTriggerEvent)
        {
            return this.WithTriggerEvent(sourceTriggerEvent);
        }

        /// <summary>
        /// The function that allows the user to specify an action that will trigger a run when it is executed.
        /// </summary>
        /// <param name="sourceTriggerEvent">The action that will trigger a run.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.ITriggerEventsDefinition.WithTriggerEvent(SourceTriggerEvent sourceTriggerEvent)
        {
            return this.WithTriggerEvent(sourceTriggerEvent);
        }

        /// <summary>
        /// The function that allows the user to specify an action that will trigger a run when it is executed.
        /// </summary>
        /// <param name="sourceTriggerEvent">The action that will trigger a run.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.ITriggerEventsDefinition.WithTriggerEvent(SourceTriggerEvent sourceTriggerEvent)
        {
            return this.WithTriggerEvent(sourceTriggerEvent);
        }

        /// <summary>
        /// The function that allows the user to input the state of the trigger status.
        /// </summary>
        /// <param name="triggerStatus">The user's choice for the trigger status.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ITriggerStatusDefinition.WithTriggerStatus(TriggerStatus triggerStatus)
        {
            return this.WithTriggerStatus(triggerStatus);
        }

        /// <summary>
        /// The function that allows the user to input the state of the trigger status.
        /// </summary>
        /// <param name="triggerStatus">The user's choice for the trigger status.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.ITriggerStatusDefinition.WithTriggerStatus(TriggerStatus triggerStatus)
        {
            return this.WithTriggerStatus(triggerStatus);
        }

        /// <summary>
        /// The function that allows the user to input the state of the trigger status.
        /// </summary>
        /// <param name="triggerStatus">The user's choice for the trigger status.</param>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.ITriggerStatusDefinition.WithTriggerStatus(TriggerStatus triggerStatus)
        {
            return this.WithTriggerStatus(triggerStatus);
        }

        /// <summary>
        /// The function that sets the trigger status to be disabled.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ITriggerStatusDefinition.WithTriggerStatusDisabled()
        {
            return this.WithTriggerStatusDisabled();
        }

        /// <summary>
        /// The function that sets the trigger status to be disabled.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.ITriggerStatusDefinition.WithTriggerStatusDisabled()
        {
            return this.WithTriggerStatusDisabled();
        }

        /// <summary>
        /// The function that sets the trigger status to be disabled.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.ITriggerStatusDefinition.WithTriggerStatusDisabled()
        {
            return this.WithTriggerStatusDisabled();
        }

        /// <summary>
        /// The function that sets the trigger status to be enabled.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Update.IUpdate RegistrySourceTrigger.Update.ITriggerStatusDefinition.WithTriggerStatusEnabled()
        {
            return this.WithTriggerStatusEnabled();
        }

        /// <summary>
        /// The function that sets the trigger status to be enabled.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.Definition.ISourceTriggerAttachable RegistrySourceTrigger.Definition.ITriggerStatusDefinition.WithTriggerStatusEnabled()
        {
            return this.WithTriggerStatusEnabled();
        }

        /// <summary>
        /// The function that sets the trigger status to be enabled.
        /// </summary>
        /// <return>The next stage of the container registry source trigger definition.</return>
        RegistrySourceTrigger.UpdateDefinition.ISourceTriggerAttachable RegistrySourceTrigger.UpdateDefinition.ITriggerStatusDefinition.WithTriggerStatusEnabled()
        {
            return this.WithTriggerStatusEnabled();
        }
    }
}


text:
$:.unshift(File.expand_path('../../lib', __FILE__))
$:.unshift(File.expand_path('../../../aws-sdk-core/features', __FILE__))
$:.unshift(File.expand_path('../../../aws-sdk-core/lib', __FILE__))
$:.unshift(File.expand_path('../../../aws-sigv4/lib', __FILE__))

require 'features_helper'
require 'aws-sdk-redshiftserverless'

Aws::RedshiftServerless::Client.add_plugin(ApiCallTracker)

redpajama_set_name: RedPajamaGithub


text:
    h_1 => h_2 => h_3 => ... => h_n
     |      |      |             |
     .      .      .             .
     |      |      |             |
    h_1 => h_2 => h_3 => ... => h_n
     |      |      |             |
     |      |      |             |
    x_1    x_2    x_3           x_n

Inherits from [onmt.Sequencer](onmt+modules+Sequencer).
--]]
local Encoder, parent = torch.class('onmt.Encoder', 'onmt.Sequencer')

--[[ Construct an encoder layer.

Parameters:

  * `inputNetwork` - input module.
  * `rnn` - recurrent module.
]]
function Encoder:__init(inputNetwork, rnn)
  self.rnn = rnn
  self.inputNet = inputNetwork

  self.args = {}
  self.args.rnnSize = self.rnn.outputSize
  self.args.numEffectiveLayers = self.rnn.numEffectiveLayers

  parent.__init(self, self:_buildModel())

  self:resetPreallocation()
end

--[[ Return a new Encoder using the serialized data `pretrained`. ]]
function Encoder.load(pretrained)
  local self = torch.factory('onmt.Encoder')()

  self.args = pretrained.args
  parent.__init(self, pretrained.modules[1])

  self:resetPreallocation()

  return self
end

--[[ Return data to serialize. ]]
function Encoder:serialize()
  return {
    modules = self.modules,
    args = self.args
  }
end

function Encoder:resetPreallocation()
  -- Prototype for preallocated hidden and cell states.
  self.stateProto = torch.Tensor()

  -- Prototype for preallocated output gradients.
  self.gradOutputProto = torch.Tensor()

  -- Prototype for preallocated context vector.
  self.contextProto = torch.Tensor()
end

function Encoder:maskPadding()
  self.maskPad = true
end

--[[ Build one time-step of an encoder

Returns: An nn-graph mapping

  $${(c^1_{t-1}, h^1_{t-1}, .., c^L_{t-1}, h^L_{t-1}, x_t) =>
  (c^1_{t}, h^1_{t}, .., c^L_{t}, h^L_{t})}$$

  Where $$c^l$$ and $$h^l$$ are the hidden and cell states at each layer,
  $$x_t$$ is a sparse word to lookup.
--]]
function Encoder:_buildModel()
  local inputs = {}
  local states = {}

  -- Inputs are previous layers first.
  for _ = 1, self.args.numEffectiveLayers do
    local h0 = nn.Identity()() -- batchSize x rnnSize
    table.insert(inputs, h0)
    table.insert(states, h0)
  end

  -- Input word.
  local x = nn.Identity()() -- batchSize
  table.insert(inputs, x)

  -- Compute input network.
  local input = self.inputNet(x)
  table.insert(states, input)

  -- Forward states and input into the RNN.
  local outputs = self.rnn(states)
  return nn.gModule(inputs, { outputs })
end

--[[Compute the context representation of an input.

Parameters:

  * `batch` - as defined in batch.lua.

Returns:

  1. - final hidden states
  2. - context matrix H
--]]
function Encoder:forward(batch)

  -- TODO: Change `batch` to `input`.

  local finalStates
  local outputSize = self.args.rnnSize

  if self.statesProto == nil then
    self.statesProto = onmt.utils.Tensor.initTensorTable(self.args.numEffectiveLayers,
                                                         self.stateProto,
                                                         { batch.size, outputSize })
  end

  -- Make initial states h_0.
  local states = onmt.utils.Tensor.reuseTensorTable(self.statesProto, { batch.size, outputSize })

  -- Preallocated output matrix.
  local context = onmt.utils.Tensor.reuseTensor(self.contextProto,
                                                { batch.size, batch.sourceLength, outputSize })

  if self.maskPad and not batch.sourceInputPadLeft then
    finalStates = onmt.utils.Tensor.recursiveClone(states)
  end
  if self.train then
    self.inputs = {}
  end

  -- Act like nn.Sequential and call each clone in a feed-forward
  -- fashion.
  for t = 1, batch.sourceLength do

    -- Construct "inputs". Prev states come first then source.
    local inputs = {}
    onmt.utils.Table.append(inputs, states)
    table.insert(inputs, batch:getSourceInput(t))

    if self.train then
      -- Remember inputs for the backward pass.
      self.inputs[t] = inputs
    end
    states = self:net(t):forward(inputs)

    -- Special case padding.
    if self.maskPad then
      for b = 1, batch.size do
        if batch.sourceInputPadLeft and t <= batch.sourceLength - batch.sourceSize[b] then
          for j = 1, #states do
            states[j][b]:zero()
          end
        elseif not batch.sourceInputPadLeft and t == batch.sourceSize[b] then
          for j = 1, #states do
            finalStates[j][b]:copy(states[j][b])
          end
        end
      end
    end

    -- Copy output (h^L_t = states[#states]) to context.
    context[{{}, t}]:copy(states[#states])
  end

  if finalStates == nil then
    finalStates = states
  end

  return finalStates, context
end

--[[ Backward pass (only called during training)

  Parameters:

  * `batch` - must be same as for forward
  * `gradStatesOutput` gradient of loss wrt last state
  * `gradContextOutput` - gradient of loss wrt full context.

  Returns: `gradInputs` of input network.
--]]
function Encoder:backward(batch, gradStatesOutput, gradContextOutput)
  -- TODO: change this to (input, gradOutput) as in nngraph.
  local outputSize = self.args.rnnSize
  if self.gradOutputsProto == nil then
    self.gradOutputsProto = onmt.utils.Tensor.initTensorTable(self.args.numEffectiveLayers,
                                                              self.gradOutputProto,
                                                              { batch.size, outputSize })
  end

  local gradStatesInput = onmt.utils.Tensor.copyTensorTable(self.gradOutputsProto, gradStatesOutput)
  local gradInputs = {}

  for t = batch.sourceLength, 1, -1 do
    -- Add context gradients to last hidden states gradients.
    gradStatesInput[#gradStatesInput]:add(gradContextOutput[{{}, t}])

    local gradInput = self:net(t):backward(self.inputs[t], gradStatesInput)

    -- Prepare next encoder output gradients.
    for i = 1, #gradStatesInput do
      gradStatesInput[i]:copy(gradInput[i])
    end

    -- Gather gradients of all user inputs.
    gradInputs[t] = {}
    for i = #gradStatesInput + 1, #gradInput do
      table.insert(gradInputs[t], gradInput[i])
    end

    if #gradInputs[t] == 1 then
      gradInputs[t] = gradInputs[t][1]
    end
  end
  -- TODO: make these names clearer.
  -- Useful if input came from another network.
  return gradInputs

end


text:
package com.yw.monitor.view;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.ColorRes;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import com.yw.monitor.view.adapter.InnerViewHolders;

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

/**
 * Created by heinigger on 16/8/25.
 */
public abstract class MonitorRecylerAdapter<T> extends RecyclerView.Adapter<InnerViewHolders> {
    protected List<T> datas = new ArrayList<>();
    private int layoutId;
    private Context mContext;
    private Activity mActivity;
    private Fragment mFragment;

    public MonitorRecylerAdapter(int layoutId, Context mContext, List<T> datas) {
        this.layoutId = layoutId;
        this.mContext = mContext;
        if (mContext instanceof Activity) {
            this.mActivity = (Activity) mContext;
        }
        if (datas != null && !datas.isEmpty()) {
            this.datas.addAll(datas);
        }
    }

    public MonitorRecylerAdapter(int layoutId, Fragment mFragment, List<T> datas) {
        this(layoutId, mFragment.getContext(), datas);
        this.mFragment = mFragment;
    }

    @Override
    public InnerViewHolders onCreateViewHolder(ViewGroup parent, int viewType) {
        InnerViewHolders viewHolders = new InnerViewHolders(layoutId, parent, mContext);
        if (mActivity != null) {
            viewHolders.setActivity(mActivity);
        } else if (mFragment != null) {
            viewHolders.setFragment(mFragment);
        }
        onPreCreate(viewHolders, viewType);
        return viewHolders;
    }

    protected void onPreCreate(InnerViewHolders holder, int viewType) {
    }

    @Override
    public void onBindViewHolder(InnerViewHolders holder, int position) {
        holder.setPosition(position);
        T t = datas.get(position);
        if (t != null) {
            convert(holder, position, holder.getConvertView(), t);
        }
    }

    protected abstract void convert(InnerViewHolders holder, int position, View convertView, T mItem);

    @Override
    public int getItemCount() {
        return datas == null ? 0 : datas.size();
    }

    public void addDatas(List<T> datas) {
        if (datas != null && !datas.isEmpty()) {
            if (this.datas == null) {
                this.datas = new ArrayList<>();
            }
            this.datas.addAll(datas);
            notifyDataSetChanged();
        }
    }

    public void addData(T data) {
        if (data != null) {
            if (this.datas == null) {
                this.datas = new ArrayList<>();
            }
            this.datas.add(data);
            notifyDataSetChanged();
        }
    }

    public void addData(T data, int index) {
        if (data != null) {
            if (this.datas == null) {
                this.datas = new ArrayList<>();
            }
            this.datas.add(index, data);
            notifyDataSetChanged();
        }
    }

    public void addData(List<T> data) {
        if (data != null) {
            if (this.datas == null) {
                this.datas = new ArrayList<>();
            }
            this.datas.addAll(data);
            notifyDataSetChanged();
        }
    }

    public List<T> getDatas() {
        if (datas == null) {
            datas = new ArrayList<>();
        }
        return datas;
    }

    public void setDatas(List<T> datas) {
        this.datas = datas;
        notifyDataSetChanged();
    }

    public void clearDatas() {
        if (this.datas != null && !this.datas.isEmpty()) {
            this.datas.clear();
        }
        if (this.datas == null) {
            this.datas = new ArrayList<>();
        }
        notifyDataSetChanged();
    }

    public T getItem(int position) {
        return datas.get(position);
    }

    public void startActivity(Intent intent) {
        getContext().startActivity(intent);
    }

    public void startActivityForResult(Intent mIntent, int requestId) {
        if (mContext instanceof Activity) {
            ((Activity) mContext).startActivityForResult(mIntent, requestId);
        }
    }

    public int getColor(@ColorRes int color) {
        return ContextCompat.getColor(mContext, color);
    }

    public Context getContext() {
        return mContext;
    }

    public String getString(@StringRes int stringId, Object... formatArgs) {
        return getContext().getString(stringId, formatArgs);
    }

    public String getString(@StringRes int stringRes) {
        return mContext.getResources().getString(stringRes);
    }

    public void remove(T mItem) {
        if (mItem == null) {
            return;
        }
        if (datas.contains(mItem)) {
            datas.remove(mItem);
            notifyDataSetChanged();
        }
    }

    public int getLayoutId() {
        return layoutId;
    }

    public Activity getmActivity() {
        return mActivity;
    }

    public Fragment getmFragment() {
        return mFragment;
    }

    /**
     * 更新Image的大小
     **/
    public void updateImageSize(InnerViewHolders holder, @IdRes int idRes, int imageSize) {
        View mParentView = holder.findView(idRes);
        if (mParentView.getLayoutParams() == null) {
            RecyclerView.LayoutParams layoutParam = new RecyclerView.LayoutParams(new ViewGroup.LayoutParams(imageSize, imageSize));
            layoutParam.width = layoutParam.height = imageSize;
            mParentView.setLayoutParams(layoutParam);
        } else {
            ViewGroup.LayoutParams layoutParam = mParentView.getLayoutParams();
            layoutParam.width = layoutParam.height = imageSize;
            mParentView.requestLayout();
        }
    }
}


text:
total_length = sum([item.length() for item in App.ActiveDocument.Sketch.Geometry if not item.Construction])

# Reference: https://www.freecadweb.org/wiki/index.php?title=Quantity

# Convert internal units into my current display units:
tu = FreeCAD.Units.parseQuantity

# How do I not hardcode "mm" here?:
(preferred, value, unit) = tu("{} mm".format(total_length)).getUserPreferred()

# This emits '3 "' for 3 inches. How do I print it as "3 in"?
print "Total length of all non-construction objects in sketcher: {}".format(preferred)


text:
package com.salesmanager.core.business.user.service;

import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.salesmanager.core.business.generic.exception.ServiceException;
import com.salesmanager.core.business.generic.service.SalesManagerEntityServiceImpl;
import com.salesmanager.core.business.user.dao.GroupDao;
import com.salesmanager.core.business.user.model.Group;
import com.salesmanager.core.business.user.model.GroupType;

@Service("groupService")
public class GroupServiceImpl extends
		SalesManagerEntityServiceImpl<Integer, Group> implements GroupService {

	GroupDao groupDao;

	@Autowired
	public GroupServiceImpl(GroupDao groupDao) {
		super(groupDao);
		this.groupDao = groupDao;

	}

	@Override
	public List<Group> listGroup(GroupType groupType) throws ServiceException {
		try {
			return groupDao.listGroup(groupType);
		} catch (Exception e) {
			throw new ServiceException(e);
		}
	}

	public List<Group> listGroupByIds(Set<Integer> ids) throws ServiceException {
		try {
			return groupDao.listGroupByIds(ids);
		} catch (Exception e) {
			throw new ServiceException(e);
		}
	}

}


text:
"""Module containing the LowerThanOperator class, defined below."""

from query.operators.base import Operator

class LowerThanOperator(Operator):

    """Generic query operator to represent a lower than comparison.

    In Python language, this operator would be a '<' sign.

    """

    name = "<"
    expression = "{field}{operator}{}"


text:
#include "phd.h"
#include "statswindow.h"

enum {
    TIMER_ID_COOLER = 101,
};

wxBEGIN_EVENT_TABLE(StatsWindow, wxWindow)
    EVT_BUTTON(BUTTON_GRAPH_LENGTH, StatsWindow::OnButtonLength)
    EVT_MENU_RANGE(MENU_LENGTH_BEGIN, MENU_LENGTH_END, StatsWindow::OnMenuLength)
    EVT_BUTTON(BUTTON_GRAPH_CLEAR, StatsWindow::OnButtonClear)
    EVT_TIMER(TIMER_ID_COOLER, StatsWindow::OnTimerCooler)
wxEND_EVENT_TABLE()

StatsWindow::StatsWindow(wxWindow *parent)
    : wxWindow(parent, wxID_ANY),
    m_visible(false),
    m_coolerTimer(this, TIMER_ID_COOLER),
    m_lastFrameSize(wxDefaultSize)
{
    SetBackgroundColour(*wxBLACK);

    m_grid1 = new wxGrid(this, wxID_ANY);

    m_grid1->CreateGrid(4, 3);
    m_grid1->SetRowLabelSize(1);
    m_grid1->SetColLabelSize(1);
    m_grid1->EnableEditing(false);
    m_grid1->SetDefaultCellBackgroundColour(*wxBLACK);
    m_grid1->SetDefaultCellTextColour(*wxLIGHT_GREY);
    m_grid1->SetGridLineColour(wxColour(40, 40, 40));

    int col = 0;
    int row = 0;
    m_grid1->SetCellValue(row, col++, "");
    m_grid1->SetCellValue(row, col++, _("RMS [px]"));
    m_grid1->SetCellValue(row, col++, _("Peak [px]"));
    ++row, col = 0;
    m_grid1->SetCellValue(row, col++, _("RA"));
    m_grid1->SetCellValue(row, col++, _T(" 99.99 (99.99'')"));
    m_grid1->SetCellValue(row, col++, _(" 99.99 (99.99'')"));
    ++row, col = 0;
    m_grid1->SetCellValue(row, col++, _("Dec"));
    ++row, col = 0;
    m_grid1->SetCellValue(row, col++, _("Total"));

    m_grid1->AutoSize();
    m_grid1->SetCellValue(1, 1, "");
    m_grid1->SetCellValue(1, 2, "");
    m_grid1->ClearSelection();

    m_grid2 = new wxGrid(this, wxID_ANY);
    m_grid2->CreateGrid(12, 2);
    m_grid2->SetRowLabelSize(1);
    m_grid2->SetColLabelSize(1);
    m_grid2->EnableEditing(false);
    m_grid2->SetDefaultCellBackgroundColour(*wxBLACK);
    m_grid2->SetDefaultCellTextColour(*wxLIGHT_GREY);
    m_grid2->SetGridLineColour(wxColour(40, 40, 40));

    row = 0, col = 0;
    m_grid2->SetCellValue(row, col++, _("RA Osc"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("RA Limited"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Dec Limited"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Star lost"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Declination"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Pier Side"));
    m_grid2->SetCellValue(3, 1, _T("MMMMMM"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Rotator Pos"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Camera binning"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Image size"));
    m_frameSizeRow = row;
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Pixel scale"));
    m_pixelScaleRow = row;
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Field of View"));
    // Make sure the column is big enough
    m_grid2->SetCellValue(row, col, _("nnn.n x nnn.n arc-min"));
    ++row, col = 0;
    m_grid2->SetCellValue(row, col++, _("Camera cooler"));
    m_grid2->SetCellValue(row, col, "-99" DEGREES_SYMBOL " / -99" DEGREES_SYMBOL ", 999%");
    m_coolerRow = row;

    m_grid2->AutoSize();
    m_grid2->SetCellValue(3, 1, wxEmptyString);
    m_grid2->SetCellValue(m_pixelScaleRow + 1, 1, wxEmptyString); // field of view row
    m_grid2->ClearSelection();

    wxSizer *sizer1 = new wxBoxSizer(wxHORIZONTAL);

    wxButton *clearButton = new wxButton(this, BUTTON_GRAPH_CLEAR, _("Clear"));
    clearButton->SetToolTip(_("Clear graph data and stats"));
    clearButton->SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
    sizer1->Add(clearButton, 0, wxALL, 10);

    m_pLengthButton = new OptionsButton(this, BUTTON_GRAPH_LENGTH, _T("XXXXXXX:888888"), wxDefaultPosition, wxSize(220, -1));
    m_pLengthButton->SetToolTip(_("Select the number of frames of history for stats and the graph"));
    m_length = dynamic_cast<MyFrame *>(parent)->pGraphLog->GetLength();
    m_pLengthButton->SetLabel(wxString::Format(_T("x:%3d"), m_length));
    sizer1->Add(m_pLengthButton, 0, wxALL, 10);

    wxSizer *sizer2 = new wxBoxSizer(wxVERTICAL);

    sizer2->Add(sizer1, 0, wxEXPAND, 10);
    sizer2->Add(m_grid1, wxSizerFlags(0).Border(wxALL, 10));
    sizer2->Add(m_grid2, wxSizerFlags(0).Border(wxALL, 10));

    SetSizerAndFit(sizer2);
}

StatsWindow::~StatsWindow(void)
{
}

void StatsWindow::SetState(bool is_active)
{
    m_visible = is_active;
    if (m_visible)
    {
        UpdateStats();
        UpdateCooler();
    }
}

static wxString arcsecs(double px, double sampling)
{
    if (sampling != 1.0)
        return wxString::Format("% 4.2f (%.2f'')", px, px * sampling);
    else
        return wxString::Format("% 4.2f", px);
}

void StatsWindow::UpdateStats(void)
{
    if (!m_visible)
        return;

    if (!pFrame || !pFrame->pGraphLog)
        return;

    int length = pFrame->pGraphLog->GetLength();
    if (m_length != length)
    {
        m_pLengthButton->SetLabel(wxString::Format(_T("x:%3d"), length));
        m_length = length;
    }

    const SummaryStats& stats = pFrame->pGraphLog->Stats();
    const double sampling = pFrame->GetCameraPixelScale();

    m_grid1->BeginBatch();
    m_grid2->BeginBatch();

    int row = 1, col = 1;
    m_grid1->SetCellValue(row++, col, arcsecs(stats.rms_ra, sampling));
    m_grid1->SetCellValue(row++, col, arcsecs(stats.rms_dec, sampling));
    m_grid1->SetCellValue(row++, col, arcsecs(stats.rms_tot, sampling));

    row = 1, col = 2;
    m_grid1->SetCellValue(row++, col, arcsecs(stats.ra_peak, sampling));
    m_grid1->SetCellValue(row++, col, arcsecs(stats.dec_peak, sampling));

    row = 0, col = 1;
    if (stats.osc_alert)
        m_grid2->SetCellTextColour(row, col, wxColour(185, 20, 0));
    else
        m_grid2->SetCellTextColour(row, col, *wxLIGHT_GREY);
    m_grid2->SetCellValue(row++, col, wxString::Format("% .02f", stats.osc_index));

    unsigned int historyItems = wxMax(pFrame->pGraphLog->GetHistoryItemCount(), 1); // avoid divide-by-zero
    if (stats.ra_limit_cnt > 0)
        m_grid2->SetCellTextColour(row, col, wxColour(185, 20, 0));
    else
        m_grid2->SetCellTextColour(row, col, *wxLIGHT_GREY);
    m_grid2->SetCellValue(row++, col, wxString::Format(" %u (%.f%%)", stats.ra_limit_cnt, stats.ra_limit_cnt * 100. / historyItems));

    if (stats.dec_limit_cnt > 0)
        m_grid2->SetCellTextColour(row, col, wxColour(185, 20, 0));
    else
        m_grid2->SetCellTextColour(row, col, *wxLIGHT_GREY);
    m_grid2->SetCellValue(row++, col, wxString::Format(" %u (%.f%%)", stats.dec_limit_cnt, stats.dec_limit_cnt * 100. / historyItems));

    m_grid2->SetCellValue(row++, col, wxString::Format(" %u", stats.star_lost_cnt));

    m_grid1->EndBatch();
    m_grid2->EndBatch();
}

static wxString CamCoolerStatus()
{
    bool on;
    double setpt, power, temp;
    bool err = pCamera->GetCoolerStatus(&on, &setpt, &power, &temp);
    if (err)
        return _("Camera error");
    else if (on)
        return wxString::Format(_("%.f%s / %.f%s, %.f%%"), temp, DEGREES_SYMBOL, setpt, DEGREES_SYMBOL, power);
    else
        return wxString::Format(_("%.f%s, Off"), temp, DEGREES_SYMBOL);
}

void StatsWindow::UpdateCooler()
{
    m_coolerTimer.Stop();

    if (!m_visible)
        return;

    wxString s;
    if (pCamera && pCamera->Connected)
    {
        if (pCamera->HasCooler)
        {
            s = CamCoolerStatus();
            enum { COOLER_POLL_INTERVAL_MS = 10000 };
            m_coolerTimer.StartOnce(COOLER_POLL_INTERVAL_MS);
        }
        else
            s = _("None");
    }
    m_grid2->SetCellValue(m_coolerRow, 1, s);
}

static wxString fov(const wxSize& sensorFormat, double sampling)
{
    if (sampling != 1.0)
        return wxString::Format("% 4.1f x % 4.1f  %s", sensorFormat.x * sampling / 60.0, sensorFormat.y * sampling / 60.0, _("arc-min"));
    else
        return " ";
}

void StatsWindow::UpdateImageSize(const wxSize& frameSize)
{
    if (m_visible && frameSize != m_lastFrameSize)
    {
        wxString sensorStr = wxString::Format("%d x %d %s", frameSize.x, frameSize.y, _("px"));
        m_grid2->SetCellValue(m_frameSizeRow, 1, sensorStr);
        const double sampling = pFrame ? pFrame->GetCameraPixelScale() : 1.0;
        m_grid2->SetCellValue(m_pixelScaleRow, 1, wxString::Format(_("%.1f\"/%s"), sampling, _("px")));
        m_grid2->SetCellValue(m_pixelScaleRow + 1, 1, fov(frameSize, sampling));
        m_lastFrameSize = frameSize;
    }
}

void StatsWindow::ResetImageSize()
{
    m_lastFrameSize = wxDefaultSize;
    m_grid2->SetCellValue(m_frameSizeRow, 1, wxEmptyString);
    m_grid2->SetCellValue(m_pixelScaleRow, 1, wxEmptyString);
    m_grid2->SetCellValue(m_pixelScaleRow + 1, 1, wxEmptyString);
}

void StatsWindow::OnTimerCooler(wxTimerEvent&)
{
    UpdateCooler();
}

static wxString RotatorPosStr()
{
    if (!pRotator)
        return _("N/A");
    double pos = Rotator::RotatorPosition();
    if (pos == Rotator::POSITION_UNKNOWN)
        return _("Unknown");
    else
        return wxString::Format("%5.1f", norm(pos, 0.0, 360.0));
}

void StatsWindow::UpdateScopePointing()
{
    if (pPointingSource)
    {
        double declination = pPointingSource->GetDeclination();
        PierSide pierSide = pPointingSource->SideOfPier();

        m_grid2->BeginBatch();
        int row = 4, col = 1;
        m_grid2->SetCellValue(row++, col, Mount::DeclinationStrTr(declination, "% .1f" DEGREES_SYMBOL));
        m_grid2->SetCellValue(row++, col, Mount::PierSideStrTr(pierSide));
        m_grid2->SetCellValue(row++, col, RotatorPosStr());
        m_grid2->SetCellValue(row++, col, pCamera ? wxString::Format("%hu", pCamera->Binning) : _("N/A"));
        m_grid2->EndBatch();
    }
}

void StatsWindow::OnButtonLength(wxCommandEvent& WXUNUSED(evt))
{
    wxMenu *menu = pFrame->pGraphLog->GetLengthMenu();

    PopupMenu(menu, m_pLengthButton->GetPosition().x,
        m_pLengthButton->GetPosition().y + m_pLengthButton->GetSize().GetHeight());

    delete menu;
}

void StatsWindow::OnMenuLength(wxCommandEvent& evt)
{
    pFrame->pGraphLog->OnMenuLength(evt);
}

void StatsWindow::OnButtonClear(wxCommandEvent& evt)
{
    pFrame->pGraphLog->OnButtonClear(evt);
}


text:
    git clone https://github.com/pantc12/CPRTeam-TelegramBOT.git
    cd CPRTeam-TelegramBOT
    cp config.sample.php config.php

## Create your Telegram Bot

1. Message [http://telegram.me/BotFather](http://telegram.me/BotFather) and follow the guide to create a new bot
2. Get your token, name and write it to ``config.php``

## Set UP webhook

1. Send a post request to ``https://api.telegram.org/bot{TOKEN}/setWebhook?url={YOUR_WEBHOOK_URL}``
2. You must include your server SSL crt (public key) file in a POST field ``certificate`` (POST type = file)
3. If correct, telegram api should response

```
{
    "ok": true,
    "result": true,
    "description": "Webhook was set"
}
```

## Watch the log
1. Message your bot
2. tail -f hooks.log

The log will contain timestamp and webhook data from telegram webhooks api.


text:
class FakeHttpRequest
  def initialize(callback_wanted)
    @callback = callback_wanted
    @callbacks = []
  end

  def callbacks=(rs)
    @callbacks += rs.reverse
  end

  def response
    @callbacks.pop unless @callbacks.nil? || @callbacks.empty?
  end

  def response_header
    self
  end

  def method_missing(method)
    self
  end

  def post(opts = nil);
    self
  end

  def get(opts = nil)
    self
  end

  def publish(opts = nil)
    self
  end

  def callback(&b)
    b.call if @callback == :success
  end

  def errback(&b)
    b.call if @callback == :failure
  end
end


text:
layout:     post
title:      "Gear List"
subtitle:   "A list of everything I'll be taking with me on my trip."
date:       "2017-05-07 00:03:26"
author:     "Randall"
header-img: "img/gearList-Header.jpg"
---

My original goal for a base weight (the weight of my backpack without any consumables like food, water, and fuel) was 15 pounds.
  I came in a few pounds heavy, but I figure I can always dump some of the things I don't end up using.


text:
package com.microsoft.azure.management.keyvault.v2016_10_01.implementation;

import com.microsoft.azure.management.keyvault.v2016_10_01.OperationDisplay;
import com.microsoft.azure.management.keyvault.v2016_10_01.ServiceSpecification;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.serializer.JsonFlatten;

/**
 * Key Vault REST API operation definition.
 */
@JsonFlatten
public class OperationInner {
    /**
     * Operation name: {provider}/{resource}/{operation}.
     */
    @JsonProperty(value = "name")
    private String name;

    /**
     * Display metadata associated with the operation.
     */
    @JsonProperty(value = "display")
    private OperationDisplay display;

    /**
     * The origin of operations.
     */
    @JsonProperty(value = "origin")
    private String origin;

    /**
     * One property of operation, include metric specifications.
     */
    @JsonProperty(value = "properties.serviceSpecification")
    private ServiceSpecification serviceSpecification;

    /**
     * Get the name value.
     *
     * @return the name value
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name value.
     *
     * @param name the name value to set
     * @return the OperationInner object itself.
     */
    public OperationInner withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the display value.
     *
     * @return the display value
     */
    public OperationDisplay display() {
        return this.display;
    }

    /**
     * Set the display value.
     *
     * @param display the display value to set
     * @return the OperationInner object itself.
     */
    public OperationInner withDisplay(OperationDisplay display) {
        this.display = display;
        return this;
    }

    /**
     * Get the origin value.
     *
     * @return the origin value
     */
    public String origin() {
        return this.origin;
    }

    /**
     * Set the origin value.
     *
     * @param origin the origin value to set
     * @return the OperationInner object itself.
     */
    public OperationInner withOrigin(String origin) {
        this.origin = origin;
        return this;
    }

    /**
     * Get the serviceSpecification value.
     *
     * @return the serviceSpecification value
     */
    public ServiceSpecification serviceSpecification() {
        return this.serviceSpecification;
    }

    /**
     * Set the serviceSpecification value.
     *
     * @param serviceSpecification the serviceSpecification value to set
     * @return the OperationInner object itself.
     */
    public OperationInner withServiceSpecification(ServiceSpecification serviceSpecification) {
        this.serviceSpecification = serviceSpecification;
        return this;
    }

}


text:
import {
  Rule,
  SchematicsException,
  apply,
  applyTemplates,
  branchAndMerge,
  chain,
  filter,
  mergeWith,
  move,
  noop,
  template,
  url,
  Tree,
  SchematicContext,
} from '@angular-devkit/schematics';
import {
  stringUtils,
  addReducerToState,
  addReducerImportToNgModule,
  getProjectPath,
  findModuleFromOptions,
  parseName,
  isIvyEnabled,
  getProject,
} from '../../schematics-core';
import { Schema as EntityOptions } from './schema';

export default function (options: EntityOptions): Rule {
  return (host: Tree, context: SchematicContext) => {
    const projectConfig = getProject(host, options);
    options.path = getProjectPath(host, options);

    const parsedPath = parseName(options.path, options.name);
    options.name = parsedPath.name;
    options.path = parsedPath.path;

    if (options.module) {
      options.module = findModuleFromOptions(host, options);
    }

    const templateOptions = {
      ...stringUtils,
      'if-flat': (s: string) => (options.flat ? '' : s),
      'group-actions': (name: string) =>
        stringUtils.group(name, options.group ? 'actions' : ''),
      'group-models': (name: string) =>
        stringUtils.group(name, options.group ? 'models' : ''),
      'group-reducers': (s: string) =>
        stringUtils.group(s, options.group ? 'reducers' : ''),
      isIvyEnabled:
        isIvyEnabled(host, 'tsconfig.json') &&
        isIvyEnabled(host, `${projectConfig.root}/tsconfig.app.json`),
      ...(options as object),
    };

    const commonTemplates = apply(url('./common-files'), [
      options.skipTests
        ? filter((path) => !path.endsWith('.spec.ts.template'))
        : noop(),
      applyTemplates(templateOptions),
      move(parsedPath.path),
    ]);

    const templateSource = apply(
      url(options.creators ? './creator-files' : './files'),
      [applyTemplates(templateOptions), move(parsedPath.path)]
    );

    return chain([
      addReducerToState({ ...options, plural: true }),
      addReducerImportToNgModule({ ...options, plural: true }),
      branchAndMerge(
        chain([mergeWith(commonTemplates), mergeWith(templateSource)])
      ),
    ])(host, context);
  };
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W29018_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">19900 — 20000
20000 — 20100

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DOLOMITE: Light tan, cream, translucent, sucrosic, well indurated, microcrystalline to crystalline, firm; rare sandstone, light gray, subangular to subrounded, firm; poor intergranular and intercrystalline porosity; solid, dull fluorescence; instant, thin cloudy cut.
DOLOMITE: Light tan, cream, translucent. microcrvstalline to crystalline, sucrosic. firm;

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">sandstone, light gray, off white, firm, fine grained, well sorted, dolomitic cementation; fair intercrystalline and intergranular porosity; solid, faint, fluorescence; instant, cloudy cut.

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">20100 — 20200
20200 — 20300
20300 — 20400

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DOLOMITE: Light tan, cream, translucent, sucrosic, well indurated, microcrystalline to crystalline, firm; rare sandstone, light gray, subangular to subrounded, fn-m; poor intergranular and intercrystalline porosity; solid, dull fluorescence; instant, thin cloudy cut.
DOLOMITE: Tan to light tan, cream, semi-translucent, off white, microcrystalline to crystalline, sucrosic, firm; rare sandstone, light gray, firm, fine grained, dolomitic cementation; poor
intercrystalline and intergranular porosity; solid, dull, fluorescence; instant, cloudy cut.
DOLOMITE: Tan, cream, translucent, off white, microcrystalline to crystalline, sucrosic, firm;

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">rare sandstone, llght gray, tum, nne gramed, well sorted, dolom1t1c cementauon; poor intercrystalline and intergranular porosity; solid, light, fluorescence; instant, cloudy cut.

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">20400 — 20500

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DOLOMITE: Tan, light tan, cream, occasionally translucent, sucrosic, microcrystalline to crvstalline. well indurated: sandv. Dale erav. verv fine grained. well sorted. fmn to hard; poor

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">intergranular and intercrystalline porosity; solid, dull fluorescence; instant milky cut.

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">20500 —— 20600

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DOLOMITE: Tan, light tan, cream, occasionally translucent, sucrosic, microcrystalline to

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">crystalline, well indurated; sandy, pale gray, very fine grained, well sorted, tum to hard; poor intergranular and intercrystalline porosity; solid, dull fluorescence; instant milky cut.

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">20600 — 20752 No sample: Not circulated up.
November 1", 2014 at 4:20 pm CT; reached TD at MD 20,752', with a projected TVD of 10,782'.

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">41

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans639.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2019.
  ~
  ~ 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.
  -->

<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <properties resource="db.properties"/>
    <!--导入属性配置 -->
    <context id="default" targetRuntime="MyBatis3">
        <!-- 插件 -->
        <plugin type="com.itfsw.mybatis.generator.plugins.LombokPlugin">
            <property name="@Accessors(chain = true)" value="true"/>
        </plugin>

        <!--jdbc的数据库连接 -->
        <jdbcConnection driverClass="${driver}" connectionURL="${url}" userId="${username}" password="${password}"/>
        <!-- Model模型生成器,用来生成含有主键key的类,记录类 以及查询Example类
            targetPackage     指定生成的model生成所在的包名
            targetProject     指定在该项目下所在的路径  -->
        <javaModelGenerator targetPackage="" targetProject=""/>
        <!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
        <sqlMapGenerator targetPackage="" targetProject=""/>
        <!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
            type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
            type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
            type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
        <javaClientGenerator targetPackage="" targetProject="" type="XMLMAPPER"/>

        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 要自动生成的表 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <table tableName="tb_lombok"/>
    </context>
</generatorConfiguration>


text:
This example combines the Organization bootstrap module with the Cloud Build submodule, to setup everything that is required to run subsequent infrastructure as code using cloud native tooling and limited external dependencies. For more details on what the Cloud Build module is doing, see the [readme](../../modules/cloudbuild).

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| billing\_account | The ID of the billing account to associate projects with. | `string` | n/a | yes |
| default\_region | Default region to create resources where applicable. | `string` | `"us-central1"` | no |
| group\_billing\_admins | Google Group for GCP Billing Administrators | `string` | n/a | yes |
| group\_org\_admins | Google Group for GCP Organization Administrators | `string` | n/a | yes |
| org\_id | GCP Organization ID | `string` | n/a | yes |
| org\_project\_creators | Additional list of members to have project creator role accross the organization. Prefix of group: user: or serviceAccount: is required. | `list(string)` | `[]` | no |
| project\_prefix | Name prefix to use for projects created. | `string` | `"cft"` | no |

## Outputs

| Name | Description |
|------|-------------|
| cloudbuild\_project\_id | Project where CloudBuild configuration and terraform container image will reside. |
| csr\_repos | List of Cloud Source Repos created by the module, linked to Cloud Build triggers. |
| gcs\_bucket\_cloudbuild\_artifacts | Bucket used to store Cloud/Build artifacts in CloudBuild project. |
| gcs\_bucket\_cloudbuild\_logs | Bucket used to store Cloud/Build logs in CloudBuild project. |
| gcs\_bucket\_tfstate | Bucket used for storing terraform state for foundations pipelines in seed project. |
| seed\_project\_id | Project where service accounts and core APIs will be enabled. |
| terraform\_sa\_email | Email for privileged service account for Terraform. |
| terraform\_sa\_name | Fully qualified name for privileged service account for Terraform. |
| tf\_runner\_artifact\_repo | GAR Repo created to store runner images |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->


text:
package com.hb.hkm.hypebeaststore.fragments.storefrontpage.filter;

import android.view.View;
import android.widget.TextView;

import com.hb.hkm.hypebeaststore.R;

/**
 * this is the view holder from the selection filter
 * Created by hesk on 2/11/15.
 */
public class ViewHolder {

    public final TextView text;
    // public final ImageView iv;
    public final View backdrop;

    public ViewHolder(View view) {
        // description = new cardbox((View) view.findViewById(R.id.description), "DESCRIPTION");
        //   iv = (ImageView) view.findViewById(R.id.imagevi);
        //  price_tag = (TextView) view.findViewById(R.id.price_tag);
        backdrop = view;
        text = (TextView) view.findViewById(R.id.label_field);

    }

}


text:
"""Script which allows analytics to run as stand alone app."""

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):
  """Handler for standalone app."""

  def get(self):
    self.redirect('/stats')

URLMAP = [
    ('/.*', MainPage),
    ]

app = webapp.WSGIApplication(URLMAP, debug=True)

def main():
  run_wsgi_app(app)

if __name__ == '__main__':
  main()


text:
package validator

import (
	"crypto/sha256"
	"fmt"
	"io"
	"os"
)

type FileSHA256HashCalculator struct{}

func NewSHA256Calculator() FileSHA256HashCalculator {
	return FileSHA256HashCalculator{}
}

func (c FileSHA256HashCalculator) Checksum(path string) (string, error) {
	file, err := os.Open(path)
	if err != nil {
		return "", err
	}
	defer file.Close()

	digest := sha256.New()
	_, err = io.Copy(digest, file)
	if err != nil {
		return "", err
	}

	return fmt.Sprintf("%x", digest.Sum(nil)), nil
}


text:
import subprocess
import os
import sys
import json
import pycco.main as pyccoLib
import anymarkup

REPO_PATH = 'git-repo'

def git_clone(url):
    r = subprocess.run(['git', 'clone', url, REPO_PATH])

    if (r.returncode == 0):
        return True
    else:
        print("[COUT] Git clone error: Invalid argument to exit", file=sys.stderr)
        print("[COUT] CO_RESULT = false")
        return False

def pycco(file_name, use_yaml):
    code = open(file_name, 'rb').read().decode('utf-8')
    language = pyccoLib.get_language(file_name, code)
    sections = pyccoLib.parse(code, language)
    pyccoLib.highlight(sections, language, outdir="docs")

    data = { 'file_path': trim_repo_path(file_name), 'sections': sections }
    if use_yaml:
        data = anymarkup.serialize(data, 'yaml')
        print('[COUT] CO_YAML_CONTENT {}'.format(str(data)[1:]))
    else:
        print('[COUT] CO_JSON_CONTENT {}'.format(json.dumps(data)))

    return True

def trim_repo_path(n):
    return n[len(REPO_PATH) + 1:]

def parse_argument():
    data = os.environ.get('CO_DATA', None)
    if not data:
        return {}

    validate = ['git-url', 'out-put-type']
    ret = {}
    for s in data.split(' '):
        s = s.strip()
        if not s:
            continue
        arg = s.split('=')
        if len(arg) < 2:
            print('[COUT] Unknown Parameter: [{}]'.format(s))
            continue

        if arg[0] not in validate:
            print('[COUT] Unknown Parameter: [{}]'.format(s))
            continue

        ret[arg[0]] = arg[1]

    return ret

def main():
    argv = parse_argument()
    git_url = argv.get('git-url')
    if not git_url:
        print("[COUT] The git-url value is null", file=sys.stderr)
        print("[COUT] CO_RESULT = false")
        return

    if not git_clone(git_url):
        return

    all_true = True

    use_yaml = argv.get('out-put-type', 'json') == 'yaml'

    for root, dirs, files in os.walk(REPO_PATH):
        for file_name in files:
            if file_name.endswith('.py'):
                o = pycco(os.path.join(root, file_name), use_yaml)
                all_true = all_true and o

    if all_true:
        print("[COUT] CO_RESULT = true")
    else:
        print("[COUT] CO_RESULT = false")

main()


text:
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \
    build-essential git automake libcurl4-openssl-dev curl gcc-multilib lib32z1-dev \
    dh-autoreconf bash-completion binutils-i686-linux-gnu \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*
run ln -s /bin/echo /bin/run-prove
run curl -L -O https://github.com/roswell/roswell/releases/download/v21.05.14.109/roswell_21.05.14.109-1_amd64.deb;dpkg -i roswell_21.05.14.109-1_amd64.deb; rm roswell_21.05.14.109-1_amd64.deb
run ros install sbcl-bin/2.0.0; ros run -- --version
run ros install snmsts/sn.github


text:
layout: post
title: How to configure chroot SFTP server in Linux
subtitle: Only SFTP access, not SSH
image: /images/uploads/home.jpg
redirect_from: /2018-01-23-How-To-Configure-Chroot-SFTP-Server-In-Linux/
tag: [sftp, secure ftp, ssh ftp]
---

* toc
{:toc}

## Introduction
SFTP stands for Secure File Transfer Protocol. One of the perfect way to upload and download files. Normal FTP is not that secure to transfer data as it has security vulnerabilities. SFTP doesn't need any additional package when we have openssh installed in our machine. If we have SSH credentials, they can also act as SFTP but that is not secure way to share with everyone as it provides access to all filesystem files. Some configuration tweaks in the `/etc/ssh/ssh_config` file can limited this access to specific directory called chroot access which will secure enough to accessible by public. This is exactly what we are going to demonstrate here.

## How-To-Do

### 1. Create new user

First of all, create a new user called **linuxmate** to provide people credentials who need access to the files:

```bash
sudo useradd linuxmate -s /sbin/nologin
sudo passwd linuxmate
```

### 2. Add entries to `sshd_config` file

Open-up `/etc/ssh/sshd_config` (careful with the file name, the same directory contains file named `ssh_config`) file and uncomment `Subsystem sftp /usr/lib/openssh/sftp-server` line then add new line:

```bash
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp  internal-sftp
```

Next we make provision access to a specific user which we created above:

```bash
Match User linuxmate
ChrootDirectory /sftpusers/chroot/
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
```

`Match User linuxmate` - Only provide access to linuxmate user, you can add group name with `Group` instead of `User` in the line.
`ChrootDirectory /sftpusers/chroot/` - It will be the sftp chroot directory.
`AllowTcpForwarding no` - It will not allow ssh jump connection. People will use the machine for SSH jump which can't be entertained as security will be compromised unless you are explicitly required.
`X11Forwarding no` - Restrict access to GUI applications.

Restart sshd service after successful configuration.

### SFTP client access

SFTP browser access can be achieved by adding browser extension or you are able to use FileZilla instead.

![sftp-client.png](/images/sftp-client.png)

`address` - IP address of the server
`username` - linuxmate
`password` - _whatever you have entered_
`port` - 22

For commnad-line users:

` sftp linuxmate@172.168.1.199`

<html>
<head>
  <link rel="stylesheet" type="text/css" href="/assets/css/asciinema-player.css" />
</head>
<body>
  <asciinema-player src="/cast/sftp.cast" speed="2" theme="asciinema" poster="data:text/plain,\e[1;37mHow to \e[1;33mconnect \e[1;37mto sftp server" cols="100" rows="22"></asciinema-player>
  <script src="/assets/js/asciinema-player.js"></script>
</body>
</html>

### Conclusion

I believe this tutorial is complete enough to make your own SFTP server. If you have business rule such as number of files to share with public or private, SFTP will be a much appropriate way of choice as it is encrypted and simple to configure from scratch compare to conventional FTP server. When we start deploy something, it is normal to rise doubts even if the documentation gives enough information. In that case, please don't hesitate to ask in the comment box below.


text:
<?php defined('SYSPATH') or die('No direct script access.'); ?>

2012-01-10 10:50:15 --- ERROR: ErrorException [ 8 ]: Undefined index: accion ~ APPPATH\views\user\inicio.php [ 12 ]


text:
<?php

namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface as FrameworkBundleEngineInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface;

class AutowiringTypesTest extends WebTestCase
{
    public function testAnnotationReaderAutowiring()
    {
        static::bootKernel(['root_config' => 'no_annotations_cache.yml', 'environment' => 'no_annotations_cache']);

        $annotationReader = static::$container->get('test.autowiring_types.autowired_services')->getAnnotationReader();
        $this->assertInstanceOf(AnnotationReader::class, $annotationReader);
    }

    public function testCachedAnnotationReaderAutowiring()
    {
        static::bootKernel();

        $annotationReader = static::$container->get('test.autowiring_types.autowired_services')->getAnnotationReader();
        $this->assertInstanceOf(CachedReader::class, $annotationReader);
    }

    /**
     * @group legacy
     */
    public function testTemplatingAutowiring()
    {
        static::bootKernel(['root_config' => 'templating.yml', 'environment' => 'templating']);

        $autowiredServices = static::$container->get('test.autowiring_types.autowired_services');
        $this->assertInstanceOf(FrameworkBundleEngineInterface::class, $autowiredServices->getFrameworkBundleEngine());
        $this->assertInstanceOf(ComponentEngineInterface::class, $autowiredServices->getEngine());
    }

    public function testEventDispatcherAutowiring()
    {
        static::bootKernel(['debug' => false]);

        $autowiredServices = static::$container->get('test.autowiring_types.autowired_services');
        $this->assertInstanceOf(EventDispatcher::class, $autowiredServices->getDispatcher(), 'The event_dispatcher service should be injected if the debug is not enabled');

        static::bootKernel(['debug' => true]);

        $autowiredServices = static::$container->get('test.autowiring_types.autowired_services');
        $this->assertInstanceOf(TraceableEventDispatcher::class, $autowiredServices->getDispatcher(), 'The debug.event_dispatcher service should be injected if the debug is enabled');
    }

    public function testCacheAutowiring()
    {
        static::bootKernel();

        $autowiredServices = static::$container->get('test.autowiring_types.autowired_services');
        $this->assertInstanceOf(FilesystemAdapter::class, $autowiredServices->getCachePool());
    }

    protected static function createKernel(array $options = [])
    {
        return parent::createKernel(['test_case' => 'AutowiringTypes'] + $options);
    }
}


text:
package org.example.componentsinfo;

import org.hippoecm.hst.configuration.hosting.Mount;
import org.hippoecm.hst.core.parameters.Color;
import org.hippoecm.hst.core.parameters.FieldGroup;
import org.hippoecm.hst.core.parameters.FieldGroupList;
import org.hippoecm.hst.core.parameters.Parameter;

@FieldGroupList({
        @FieldGroup(
                titleKey = "group.content",
                value = {"scope"}
        ),
        @FieldGroup(
                titleKey = "group.sorting",
                value = {}
        ),
        @FieldGroup(
                titleKey = "group.layout",
                value = {"cssClass", "bgColor"}
        )
})
public interface ListViewInfo extends GeneralListInfo {

    /**
     * Returns the scope to search below. Leading and trailing slashes do not have meaning and will be skipped when using the scope. The scope
     * is always relative to the current {@link Mount#getContentPath()}, even if it starts with a <code>/</code>
     * @return the scope to search below
     */
    @Parameter(name = "scope", defaultValue="/")
    String getScope();

    @Override
    @Parameter(name = "title", defaultValue="List")
    String getTitle();

    @Parameter(name = "cssClass", defaultValue="lightgrey")
    String getCssClass();

    @Parameter(name = "bgColor", defaultValue="")
    @Color
    String getBgColor();

}


text:
package pl.dpawlak.flocoge.log.util;

import pl.dpawlak.flocoge.log.ErrorLogger;

public class ErrorCollectingLogger extends ErrorLogger {

    private String error;

    public ErrorCollectingLogger() {
        super(false, null, null);
    }

    @Override
    public void error(String msg) {
        error = msg;
    }

    @Override
    public void error(String msg, Object... objects) {
        error = msg;
    }

    public String getError() {
        return error;
    }
}


text:
<bill session="110" type="hc" number="115" updated="2009-01-08T15:41:24-05:00">
	<status><introduced date="1176782400" datetime="2007-04-17"/></status>

	<introduced date="1176782400" datetime="2007-04-17"/>
	<titles>
		<title type="official" as="introduced">Urging all sides to the current political crisis in Ukraine to act responsibly and use dialogue to resolve the crisis and ensure a free and transparent democratic system in Ukraine based on the rule of law.</title>
	</titles>
	<sponsor id="400170"/>
	<cosponsors>
		<cosponsor id="400266" joined="2007-05-01"/>
		<cosponsor id="400268" joined="2007-05-15"/>
		<cosponsor id="400147" joined="2007-04-18"/>
		<cosponsor id="412186" joined="2007-05-22"/>
		<cosponsor id="400238" joined="2007-04-17"/>
		<cosponsor id="400378" joined="2007-04-24"/>
		<cosponsor id="400430" joined="2007-04-24"/>
		<cosponsor id="400211" joined="2007-04-17"/>
	</cosponsors>
	<actions>
		<action date="1176782400" datetime="2007-04-17"><text>Sponsor introductory remarks on measure. (CR E758)</text></action>
		<action date="1176782400" datetime="2007-04-17"><text>Referred to the House Committee on Foreign Affairs.</text></action>
	</actions>
	<committees>

	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>

	4/17/2007--Introduced.
Welcomes the strong relationship formed between the United States and Ukraine since the restoration of Ukraine's independence in 1991. Urges all sides to the current political crisis in Ukraine to act responsibly and use dialogue to resolve the crisis. Expresses support for the efforts of the Ukrainian people to establish a full democracy, the rule of law, and respect for human rights. Pledges continued assistance to the strengthening of a democratic system in Ukraine and to the continued development of a free market economy. Reaffirms the House of Representatives' commitment to Ukraine's independence, sovereignty and territorial integrity, and assumption of Ukraine's place as a full member of the international community of democracies.

</bill>


text:
git clone https://github.com/jandecaluwe/myhdl
cd myhdl
#git checkout 88cb76b
python setup.py install
make -C cosimulation/icarus
# copy the VPI to the test directory
cp cosimulation/icarus/myhdl.vpi ../test/test_cosim


text:
--// MIT License. Copyright (c) 2016 Maxim Kuzmin. Contacts: https://github.com/maxim-kuzmin

--// Author: Maxim Kuzmin

CREATE TRIGGER [dbo].[DummyManyToManyLink_Trigger] ON [dbo].[DummyManyToManyLink] FOR INSERT, UPDATE, DELETE
AS
BEGIN
	SET NOCOUNT ON;
	SET XACT_ABORT ON;

	if not exists(select * from inserted) and not exists(select * from deleted) return;

	declare @Action char(1);
	declare @Deleted [dbo].[DummyManyToManyLink_Trigger_TableType];
	declare @Inserted [dbo].[DummyManyToManyLink_Trigger_TableType];

	if not exists(select * from deleted) set @Action = 'I'
	else if exists(select * from inserted) set @Action = 'U'
	else set @Action = 'D'
	;

	if @Action = 'D' or @Action = 'U'
	begin;
		insert into @Deleted
		(
			[Id],
			[DummyId]
		)
		select
			[Id],
			[DummyId]
		from
			deleted
		;
	end;

	if @Action = 'I' or @Action = 'U'
	begin;
		insert into @Inserted
		(
			[Id],
			[DummyId]
		)
		select
			[Id],
			[DummyId]
		from
			inserted
		;
	end;

	exec [dbo].[DummyManyToManyLink_Trigger_Proc]
		@Action = @Action,
		@Deleted = @Deleted,
		@Inserted = @Inserted
	;
END


text:
package io.vivarium.ga;

public abstract class BehaviorBasedFitnessFunction extends FitnessFunction
{
}


text:
/**
 * Module dependencies.
 */

var express = require('express');
var routes = require('./routes');
var images = require('./routes/images');

var http = require('http');
var path = require('path');
var partials = require('express-partials');

var app = express();

// all environments
app.set('port', process.env.PORT || process.argv[2] || 8001);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(partials());
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());

// Ignore the /favicon.ico
app.use(express.favicon());

// Custom middleware
app.use(setSystemLoad);

// Error handling
app.use(function (err, req, res, next) {
    if (!err) return next();

    res.render('error', {title: 'Error', error: err});
});

// Routing
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', routes.index);
app.get('/ping', routes.ping);
app.get('/stats', routes.stats);
app.post('/images/upload', images.upload);

// Start
var port = app.get('port');
console.log("Starting instance on port " + port);
http.createServer(app).listen(port, function () {
    console.log('Express server listening on port ' + port);
});

var os = require('os');
function setSystemLoad(req, res, next) {
    res.set("x-imgcloud-osload", os.loadavg()[0]);
    res.set("x-imgcloud-host", req.headers['x-imgcloud-host']);
    res.set("x-imgcloud-start-lb", req.headers['x-imgcloud-start-lb']);
    res.set("x-imgcloud-start-app", +new Date);

    res.cookie("imgcloud-host", req.headers["x-imgcloud-host"]);
    next();
}


text:
// Copyright (c) 2021 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "WindowsProcessService/ProcessServiceImpl.h"

#include <absl/base/casts.h>
#include <absl/strings/str_format.h>
#include <absl/strings/str_join.h>
#include <stdint.h>

#include <filesystem>
#include <string>
#include <vector>

#include "GrpcProtos/module.pb.h"
#include "GrpcProtos/process.pb.h"
#include "ObjectUtils/ObjectFile.h"
#include "OrbitBase/File.h"
#include "OrbitBase/Logging.h"
#include "OrbitBase/Result.h"
#include "WindowsTracing/ListModulesETW.h"
#include "WindowsUtils/FindDebugSymbols.h"
#include "WindowsUtils/ListModules.h"
#include "WindowsUtils/ProcessList.h"
#include "WindowsUtils/ReadProcessMemory.h"

namespace orbit_windows_process_service {

using grpc::ServerContext;
using grpc::Status;
using grpc::StatusCode;

using orbit_grpc_protos::GetDebugInfoFileRequest;
using orbit_grpc_protos::GetDebugInfoFileResponse;
using orbit_grpc_protos::GetModuleListRequest;
using orbit_grpc_protos::GetModuleListResponse;
using orbit_grpc_protos::GetProcessListRequest;
using orbit_grpc_protos::GetProcessListResponse;
using orbit_grpc_protos::GetProcessMemoryRequest;
using orbit_grpc_protos::GetProcessMemoryResponse;
using orbit_grpc_protos::ModuleInfo;
using orbit_grpc_protos::ProcessInfo;

using orbit_windows_utils::Module;
using orbit_windows_utils::Process;

Status ProcessServiceImpl::GetProcessList(ServerContext*, const GetProcessListRequest*,
                                          GetProcessListResponse* response) {
  std::vector<const Process*> processes;

  {
    absl::MutexLock lock(&mutex_);
    if (process_list_ == nullptr) {
      process_list_ = orbit_windows_utils::ProcessList::Create();
    }
    auto result = process_list_->Refresh();
    if (result.has_error()) {
      return Status(StatusCode::NOT_FOUND,
                    absl::StrFormat("Error listing processes: %s", result.error().message()));
    }
    processes = process_list_->GetProcesses();
    ORBIT_CHECK(!processes.empty());
  }

  for (const Process* process : processes) {
    ProcessInfo* process_info = response->add_processes();
    process_info->set_pid(process->pid);
    process_info->set_name(process->name);
    process_info->set_full_path(process->full_path);
    process_info->set_build_id(process->build_id);
    process_info->set_is_64_bit(process->is_64_bit);
    process_info->set_cpu_usage(process->cpu_usage_percentage);
  }

  return Status::OK;
}

Status ProcessServiceImpl::GetModuleList(ServerContext* /*context*/,
                                         const GetModuleListRequest* request,
                                         GetModuleListResponse* response) {
  std::vector<Module> modules = orbit_windows_utils::ListModules(request->process_id());
  if (modules.empty()) {
    // Fallback on etw module enumeration which involves more work.
    modules = orbit_windows_tracing::ListModulesEtw(request->process_id());
  }

  if (modules.empty()) {
    return Status(StatusCode::NOT_FOUND, "Error listing modules");
  }

  for (const Module& module : modules) {
    ModuleInfo* module_info = response->add_modules();
    module_info->set_name(module.name);
    module_info->set_file_path(module.full_path);
    module_info->set_address_start(module.address_start);
    module_info->set_address_end(module.address_end);
    module_info->set_build_id(module.build_id);
    module_info->set_load_bias(module.load_bias);
    module_info->set_object_file_type(ModuleInfo::kCoffFile);
    for (const ModuleInfo::ObjectSegment& section : module.sections) {
      *module_info->add_object_segments() = section;
    }
  }

  return Status::OK;
}

Status ProcessServiceImpl::GetProcessMemory(ServerContext*, const GetProcessMemoryRequest* request,
                                            GetProcessMemoryResponse* response) {
  const uint64_t size = std::min(request->size(), kMaxGetProcessMemoryResponseSize);
  ErrorMessageOr<std::string> result =
      orbit_windows_utils::ReadProcessMemory(request->pid(), request->address(), size);

  if (result.has_error()) {
    return Status(StatusCode::PERMISSION_DENIED, result.error().message());
  }

  *response->mutable_memory() = std::move(result.value());
  return Status::OK;
}

Status ProcessServiceImpl::GetDebugInfoFile(ServerContext*, const GetDebugInfoFileRequest* request,
                                            GetDebugInfoFileResponse* response) {
  std::filesystem::path module_path(request->module_path());

  const ErrorMessageOr<std::filesystem::path> symbols_path =
      orbit_windows_utils::FindDebugSymbols(module_path, {});

  if (symbols_path.has_error()) {
    return Status(StatusCode::NOT_FOUND, symbols_path.error().message());
  }

  response->set_debug_info_file_path(symbols_path.value().string());
  return Status::OK;
}

}  // namespace orbit_windows_process_service


text:
<#
Copyright 2016 ASOS.com Limited

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.
#>

<#
.NAME
	Update-XPathValue.Tests

.SYNOPSIS
	Pester tests for Update-XPathValue.
#>
Set-StrictMode -Version Latest

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"

Describe "Update-XPathValue" {
    It "Should update the value at the given XPath location" {
        $tempFile = [System.IO.Path]::GetTempFileName() # Cant use the testdrive as $doc.Save($Path) doesn't support 'TestDrive:\'

        Set-Content $tempFile "<results>original</results>"

        Update-XPathValue -Path $tempFile -XPath "//results" -Value "replacement"

        Get-Content $tempFile | Should Be "<results>replacement</results>"

        Remove-Item $tempFile
    }

    It "Should update attributes at the given XPath location" {
        $tempFile = [System.IO.Path]::GetTempFileName() # Cant use the testdrive as $doc.Save($Path) doesn't support 'TestDrive:\'

        Set-Content $tempFile "<results attr=`"old`">original</results>"

        Update-XPathValue -Path $tempFile -XPath "//results/@attr" -Value "new"

        Get-Content $tempFile | Should Be "<results attr=`"new`">original</results>"

        Remove-Item $tempFile
    }

    It "Should throw if the path does not exist" {
        { Update-XPathValue -Path "TestDrive:\not-here.xml" -XPath "//results" -Value "replacement" } | Should Throw "File 'TestDrive:\not-here.xml' not found"
    }

    It "Should throw an exception if the xml is invalid" {
        $tempFile = [System.IO.Path]::GetTempFileName() # Cant use the testdrive as $doc.Save($Path) doesn't support 'TestDrive:\'

        Set-Content $tempFile "<resuldkasts attr=`"old`">original</results>"

        { Update-XPathValue -Path $tempFile -XPath "//results/@attr" -Value "new" } | Should Throw

        Remove-Item $tempFile
    }
}


text:
layout: page-fullwidth
meta_teaser:
teaser: ""
header:
    image: inspire2017ntx_low.jpg
    background-color: "#262930"
    caption: We did it mum
    caption_url:
image:
    thumb: inspire2017ntx_low.jpg
    homepage:
    caption:
    caption_url: ""
categories:
    - robotics
    - projects
title: Inspire Award Achieved
tags: [Inspire, Motivate, Connect, Innovate, Business, Outreach, Mechanical, Software, Video, Pinned ]
section: Business
personhours: 117
rollcall: [Max, Tycho, Jayesh, Caitlin, Omar, Darshan, Evan, Ethan, Janavi, Charlotte]
---

<title> {{ page.title }} </title>

By {{ page.rollcall | array_to_sentence_string }}

1st Place at North Texas Regional Championship

Iron Reign members left to right are Ethan Helfman (Build, Communications), Janavi Chada (Programming, Communications), Tycho Virani (Programming Lead, Main Driver), Jayesh Sharma (Business Lead, Build, Communications), Darshan Patel (Build), Caitlin Rogers (Communications Lead, Logistics, Business) and Charlotte Leakey (Programming, Logistics), with Evan Daane (from BTW, Build, Photography) in repose. Not shown: Max Virani (Design Lead, Programming), Omar Ramirez (Build Lead) and Rohit Shankar (Programming).

     Wow, we did it. I mean, we were going for it, but wow - we did it! Out of 118 teams competing in our region, we got 1st Place Inspire (Top Award) at our regional championship! We finally earned the coveted Inspire Banner. We've been building toward this for 7 years! Ever since we started as an FLL team.

Our total awards included Inspire 1st, Finalist Alliance 2nd, Motivate 2nd, Connect 3rd, Innovate 3rd.

Not going to Disney World yet

We are now qualified for the Texas State UIL Robotics Championship and the 12 State South Super Regionals. And we are preparing with the goal of making it to the World Championship.
We have an extended season and while some of us have been to super regionals before, this is the first time the whole team gets to go. Our coffers are empty, we need a whole new round of fundraising to keep up the progress for the extended season. We need your help! Please consider contributing to support our extended season and help us represent North Texas at Supers.

 In case you don't know how the game works, it's broken into a 30 second autonomous phase followed by a 2 minute driver controlled period. Two alliances of two robots each compete in each match. Here is our division winning match with alliance mates Technibots. Autonomous:

And Tele-Op:


text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="User" table="user">
    <unique-constraints>
      <unique-constraint name="UNIQ_957A647992FC23A8" columns="username_canonical"/>
      <unique-constraint name="UNIQ_957A6479A0D96FBF" columns="email_canonical"/>
    </unique-constraints>
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="username" type="string" column="username" length="255" nullable="false"/>
    <field name="usernameCanonical" type="string" column="username_canonical" length="255" nullable="false"/>
    <field name="email" type="string" column="email" length="255" nullable="false"/>
    <field name="emailCanonical" type="string" column="email_canonical" length="255" nullable="false"/>
    <field name="enabled" type="boolean" column="enabled" nullable="false"/>
    <field name="salt" type="string" column="salt" length="255" nullable="false"/>
    <field name="password" type="string" column="password" length="255" nullable="false"/>
    <field name="registrationTime" type="datetime" column="registration_time" nullable="false"/>
    <field name="lastLogin" type="datetime" column="last_login" nullable="true"/>
    <field name="locked" type="boolean" column="locked" nullable="false"/>
    <field name="expired" type="boolean" column="expired" nullable="false"/>
    <field name="expiresAt" type="datetime" column="expires_at" nullable="true"/>
    <field name="confirmationToken" type="string" column="confirmation_token" length="255" nullable="true"/>
    <field name="passwordRequestedAt" type="datetime" column="password_requested_at" nullable="true"/>
    <field name="roles" type="array" column="roles" nullable="false"/>
    <field name="credentialsExpired" type="boolean" column="credentials_expired" nullable="false"/>
    <field name="credentialsExpireAt" type="datetime" column="credentials_expire_at" nullable="true"/>
  </entity>
</doctrine-mapping>


text:
package com.ftfl.ftflicare.adapter;

import java.util.List;

import com.ftfl.ftflicare.R;
import com.ftfl.ftflicare.model.DietChartModel;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class DietItemUpcomingAdapter extends ArrayAdapter<DietChartModel>{

	TextView tvEvent, tvTime, tvManu;
	ImageView imageAlarm;

	private final Activity context;
	List<DietChartModel> allDailyDietChart;

	public DietItemUpcomingAdapter(Activity context, List<DietChartModel> allDailyDietChart) {
		super(context, R.layout.each_today_diet_item,allDailyDietChart);
		this.context = context;
		this.allDailyDietChart = allDailyDietChart;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		DietChartModel mDietChart;
		mDietChart = allDailyDietChart.get(position);

		LayoutInflater inflater = context.getLayoutInflater();

		View rowView = inflater.inflate(R.layout.each_today_diet_item, null, true);

		tvEvent = (TextView) rowView.findViewById(R.id.viewEvent);
		tvEvent.setText(mDietChart.getEventName().toString());

		tvTime = (TextView) rowView.findViewById(R.id.viewTime);
		tvTime.setText("Time:"+mDietChart.getTime().toString());

		tvManu = (TextView) rowView.findViewById(R.id.viewManu);
		tvManu.setText(mDietChart.getFoodMenu().toString());

		String mAlarm = mDietChart.getAlarm();
		if(mAlarm!=""){

			imageAlarm = (ImageView) rowView.findViewById(R.id.imageAlarm);
			imageAlarm.setImageResource(R.drawable.alarm_on);

			}else{
				imageAlarm.setImageResource(R.drawable.alarm_off);
			}

		return rowView;
	}

}