text:
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/ec2/EC2Request.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/ec2/model/TargetCapacityUnitType.h>
#include <aws/ec2/model/InstanceRequirementsWithMetadataRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace EC2
{
namespace Model
{

  /**
   */
  class AWS_EC2_API GetSpotPlacementScoresRequest : public EC2Request
  {
  public:
    GetSpotPlacementScoresRequest();

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

    Aws::String SerializePayload() const override;

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

  public:

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

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

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline bool InstanceTypesHasBeenSet() const { return m_instanceTypesHasBeenSet; }

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline void SetInstanceTypes(const Aws::Vector<Aws::String>& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes = value; }

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline void SetInstanceTypes(Aws::Vector<Aws::String>&& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes = std::move(value); }

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline GetSpotPlacementScoresRequest& WithInstanceTypes(const Aws::Vector<Aws::String>& value) { SetInstanceTypes(value); return *this;}

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline GetSpotPlacementScoresRequest& WithInstanceTypes(Aws::Vector<Aws::String>&& value) { SetInstanceTypes(std::move(value)); return *this;}

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline GetSpotPlacementScoresRequest& AddInstanceTypes(const Aws::String& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes.push_back(value); return *this; }

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline GetSpotPlacementScoresRequest& AddInstanceTypes(Aws::String&& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes.push_back(std::move(value)); return *this; }

    /**
     *
The instance types. We recommend that you specify at least three instance
     * types. If you specify one or two instance types, or specify variations of a
     * single instance type (for example, an m3.xlarge with and without
     * instance storage), the returned placement score will always be low.

If
     * you specify InstanceTypes, you can't specify
     * InstanceRequirementsWithMetadata.

     */
    inline GetSpotPlacementScoresRequest& AddInstanceTypes(const char* value) { m_instanceTypesHasBeenSet = true; m_instanceTypes.push_back(value); return *this; }

    /**
     *
The target capacity.

     */
    inline int GetTargetCapacity() const{ return m_targetCapacity; }

    /**
     *
The target capacity.

     */
    inline bool TargetCapacityHasBeenSet() const { return m_targetCapacityHasBeenSet; }

    /**
     *
The target capacity.

     */
    inline void SetTargetCapacity(int value) { m_targetCapacityHasBeenSet = true; m_targetCapacity = value; }

    /**
     *
The target capacity.

     */
    inline GetSpotPlacementScoresRequest& WithTargetCapacity(int value) { SetTargetCapacity(value); return *this;}

    /**
     *
The unit for the target capacity.

Default: units
     * (translates to number of instances)

     */
    inline const TargetCapacityUnitType& GetTargetCapacityUnitType() const{ return m_targetCapacityUnitType; }

    /**
     *
The unit for the target capacity.

Default: units
     * (translates to number of instances)

     */
    inline bool TargetCapacityUnitTypeHasBeenSet() const { return m_targetCapacityUnitTypeHasBeenSet; }

    /**
     *
The unit for the target capacity.

Default: units
     * (translates to number of instances)

     */
    inline void SetTargetCapacityUnitType(const TargetCapacityUnitType& value) { m_targetCapacityUnitTypeHasBeenSet = true; m_targetCapacityUnitType = value; }

    /**
     *
The unit for the target capacity.

Default: units
     * (translates to number of instances)

     */
    inline void SetTargetCapacityUnitType(TargetCapacityUnitType&& value) { m_targetCapacityUnitTypeHasBeenSet = true; m_targetCapacityUnitType = std::move(value); }

    /**
     *
The unit for the target capacity.

Default: units
     * (translates to number of instances)

     */
    inline GetSpotPlacementScoresRequest& WithTargetCapacityUnitType(const TargetCapacityUnitType& value) { SetTargetCapacityUnitType(value); return *this;}

    /**
     *
The unit for the target capacity.

Default: units
     * (translates to number of instances)

     */
    inline GetSpotPlacementScoresRequest& WithTargetCapacityUnitType(TargetCapacityUnitType&& value) { SetTargetCapacityUnitType(std::move(value)); return *this;}

    /**
     *
Specify true so that the response returns a list of scored
     * Availability Zones. Otherwise, the response returns a list of scored
     * Regions.

A list of scored Availability Zones is useful if you want to
     * launch all of your Spot capacity into a single Availability Zone.

     */
    inline bool GetSingleAvailabilityZone() const{ return m_singleAvailabilityZone; }

    /**
     *
Specify true so that the response returns a list of scored
     * Availability Zones. Otherwise, the response returns a list of scored
     * Regions.

A list of scored Availability Zones is useful if you want to
     * launch all of your Spot capacity into a single Availability Zone.

     */
    inline bool SingleAvailabilityZoneHasBeenSet() const { return m_singleAvailabilityZoneHasBeenSet; }

    /**
     *
Specify true so that the response returns a list of scored
     * Availability Zones. Otherwise, the response returns a list of scored
     * Regions.

A list of scored Availability Zones is useful if you want to
     * launch all of your Spot capacity into a single Availability Zone.

     */
    inline void SetSingleAvailabilityZone(bool value) { m_singleAvailabilityZoneHasBeenSet = true; m_singleAvailabilityZone = value; }

    /**
     *
Specify true so that the response returns a list of scored
     * Availability Zones. Otherwise, the response returns a list of scored
     * Regions.

A list of scored Availability Zones is useful if you want to
     * launch all of your Spot capacity into a single Availability Zone.

     */
    inline GetSpotPlacementScoresRequest& WithSingleAvailabilityZone(bool value) { SetSingleAvailabilityZone(value); return *this;}

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

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

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline bool RegionNamesHasBeenSet() const { return m_regionNamesHasBeenSet; }

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline void SetRegionNames(const Aws::Vector<Aws::String>& value) { m_regionNamesHasBeenSet = true; m_regionNames = value; }

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline void SetRegionNames(Aws::Vector<Aws::String>&& value) { m_regionNamesHasBeenSet = true; m_regionNames = std::move(value); }

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline GetSpotPlacementScoresRequest& WithRegionNames(const Aws::Vector<Aws::String>& value) { SetRegionNames(value); return *this;}

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline GetSpotPlacementScoresRequest& WithRegionNames(Aws::Vector<Aws::String>&& value) { SetRegionNames(std::move(value)); return *this;}

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline GetSpotPlacementScoresRequest& AddRegionNames(const Aws::String& value) { m_regionNamesHasBeenSet = true; m_regionNames.push_back(value); return *this; }

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline GetSpotPlacementScoresRequest& AddRegionNames(Aws::String&& value) { m_regionNamesHasBeenSet = true; m_regionNames.push_back(std::move(value)); return *this; }

    /**
     *
The Regions used to narrow down the list of Regions to be scored. Enter the
     * Region code, for example, us-east-1.

     */
    inline GetSpotPlacementScoresRequest& AddRegionNames(const char* value) { m_regionNamesHasBeenSet = true; m_regionNames.push_back(value); return *this; }

    /**
     *
The attributes for the instance types. When you specify instance attributes,
     * Amazon EC2 will identify instance types with those attributes.

If you
     * specify InstanceRequirementsWithMetadata, you can't specify
     * InstanceTypes.

     */
    inline const InstanceRequirementsWithMetadataRequest& GetInstanceRequirementsWithMetadata() const{ return m_instanceRequirementsWithMetadata; }

    /**
     *
The attributes for the instance types. When you specify instance attributes,
     * Amazon EC2 will identify instance types with those attributes.

If you
     * specify InstanceRequirementsWithMetadata, you can't specify
     * InstanceTypes.

     */
    inline bool InstanceRequirementsWithMetadataHasBeenSet() const { return m_instanceRequirementsWithMetadataHasBeenSet; }

    /**
     *
The attributes for the instance types. When you specify instance attributes,
     * Amazon EC2 will identify instance types with those attributes.

If you
     * specify InstanceRequirementsWithMetadata, you can't specify
     * InstanceTypes.

     */
    inline void SetInstanceRequirementsWithMetadata(const InstanceRequirementsWithMetadataRequest& value) { m_instanceRequirementsWithMetadataHasBeenSet = true; m_instanceRequirementsWithMetadata = value; }

    /**
     *
The attributes for the instance types. When you specify instance attributes,
     * Amazon EC2 will identify instance types with those attributes.

If you
     * specify InstanceRequirementsWithMetadata, you can't specify
     * InstanceTypes.

     */
    inline void SetInstanceRequirementsWithMetadata(InstanceRequirementsWithMetadataRequest&& value) { m_instanceRequirementsWithMetadataHasBeenSet = true; m_instanceRequirementsWithMetadata = std::move(value); }

    /**
     *
The attributes for the instance types. When you specify instance attributes,
     * Amazon EC2 will identify instance types with those attributes.

If you
     * specify InstanceRequirementsWithMetadata, you can't specify
     * InstanceTypes.

     */
    inline GetSpotPlacementScoresRequest& WithInstanceRequirementsWithMetadata(const InstanceRequirementsWithMetadataRequest& value) { SetInstanceRequirementsWithMetadata(value); return *this;}

    /**
     *
The attributes for the instance types. When you specify instance attributes,
     * Amazon EC2 will identify instance types with those attributes.

If you
     * specify InstanceRequirementsWithMetadata, you can't specify
     * InstanceTypes.

     */
    inline GetSpotPlacementScoresRequest& WithInstanceRequirementsWithMetadata(InstanceRequirementsWithMetadataRequest&& value) { SetInstanceRequirementsWithMetadata(std::move(value)); return *this;}

    /**
     *
Checks whether you have the required permissions for the action, without
     * actually making the request, and provides an error response. If you have the
     * required permissions, the error response is DryRunOperation.
     * Otherwise, it is UnauthorizedOperation.

     */
    inline bool GetDryRun() const{ return m_dryRun; }

    /**
     *
Checks whether you have the required permissions for the action, without
     * actually making the request, and provides an error response. If you have the
     * required permissions, the error response is DryRunOperation.
     * Otherwise, it is UnauthorizedOperation.

     */
    inline bool DryRunHasBeenSet() const { return m_dryRunHasBeenSet; }

    /**
     *
Checks whether you have the required permissions for the action, without
     * actually making the request, and provides an error response. If you have the
     * required permissions, the error response is DryRunOperation.
     * Otherwise, it is UnauthorizedOperation.

     */
    inline void SetDryRun(bool value) { m_dryRunHasBeenSet = true; m_dryRun = value; }

    /**
     *
Checks whether you have the required permissions for the action, without
     * actually making the request, and provides an error response. If you have the
     * required permissions, the error response is DryRunOperation.
     * Otherwise, it is UnauthorizedOperation.

     */
    inline GetSpotPlacementScoresRequest& WithDryRun(bool value) { SetDryRun(value); return *this;}

    /**
     *
The maximum number of results to return in a single call. Specify a value
     * between 1 and
 1000. The default value is 1000. To retrieve the remaining
     * results, make another call with
 the returned NextToken
     * value.

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

    /**
     *
The maximum number of results to return in a single call. Specify a value
     * between 1 and
 1000. The default value is 1000. To retrieve the remaining
     * results, make another call with
 the returned NextToken
     * value.

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

    /**
     *
The maximum number of results to return in a single call. Specify a value
     * between 1 and
 1000. The default value is 1000. To retrieve the remaining
     * results, make another call with
 the returned NextToken
     * value.

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

    /**
     *
The maximum number of results to return in a single call. Specify a value
     * between 1 and
 1000. The default value is 1000. To retrieve the remaining
     * results, make another call with
 the returned NextToken
     * value.

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

    /**
     *
The token for the next set of results.

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

    /**
     *
The token for the next set of results.

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

    /**
     *
The token for the next set of results.

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

    /**
     *
The token for the next set of results.

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

    /**
     *
The token for the next set of results.

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

    /**
     *
The token for the next set of results.

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

    /**
     *
The token for the next set of results.

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

    /**
     *
The token for the next set of results.

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

  private:

    Aws::Vector<Aws::String> m_instanceTypes;
    bool m_instanceTypesHasBeenSet = false;

    int m_targetCapacity;
    bool m_targetCapacityHasBeenSet = false;

    TargetCapacityUnitType m_targetCapacityUnitType;
    bool m_targetCapacityUnitTypeHasBeenSet = false;

    bool m_singleAvailabilityZone;
    bool m_singleAvailabilityZoneHasBeenSet = false;

    Aws::Vector<Aws::String> m_regionNames;
    bool m_regionNamesHasBeenSet = false;

    InstanceRequirementsWithMetadataRequest m_instanceRequirementsWithMetadata;
    bool m_instanceRequirementsWithMetadataHasBeenSet = false;

    bool m_dryRun;
    bool m_dryRunHasBeenSet = false;

    int m_maxResults;
    bool m_maxResultsHasBeenSet = false;

    Aws::String m_nextToken;
    bool m_nextTokenHasBeenSet = false;
  };

} // namespace Model
} // namespace EC2
} // namespace Aws


text:
import * as React from 'react';
import Email from '../src/libs/reactstrap/fields/Email';
import { boolean, withKnobs, text, select } from '@storybook/addon-knobs';

const EmailFieldStory = () => {
  return <Email field={{
    placeholder: 'email...',
    size: 'sm'
  }} />;
}

export default EmailFieldStory;

redpajama_set_name: RedPajamaGithub


text:
require_relative '../../spec_helper'
require 'set'
require_relative 'shared/collect'

describe "Set#map!" do
  it_behaves_like :set_collect_bang, :map!
end


text:
#region MIT
//
// Gorgon.
// Copyright (C) 2020 Michael Winsor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// Created: January 22, 2020 10:28:50 PM
//
#endregion

using Gorgon.Diagnostics;
using Gorgon.Editor.Services;

namespace Gorgon.Editor.PlugIns
{
    /// <summary>
    /// A list of services passed from the host application to plug ins.
    /// </summary>
    public interface IHostServices
    {
        /// <summary>
        /// Property to return the log for debug messages.
        /// </summary>
        IGorgonLog Log
        {
            get;
        }

        /// <summary>
        /// Property to return the serivce used to show busy states.
        /// </summary>
        IBusyStateService BusyService
        {
            get;
        }

        /// <summary>
        /// Property to return the service used to show message dialogs.
        /// </summary>
        IMessageDisplayService MessageDisplay
        {
            get;
        }

        /// <summary>
        /// Property to return the service used to send and retrieve data to and from the clipboard.
        /// </summary>
        IClipboardService ClipboardService
        {
            get;
        }
    }
}


text:
package es.usc.citius.lab.hipster.collection;

import es.usc.citius.lab.hipster.collections.HashQueue;
import org.junit.Test;

import java.util.Iterator;
;import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class HashQueueTest {
    @Test
    public void testOffer() throws Exception {
        HashQueue<String> queue = new HashQueue<String>();
        queue.offer("element");
        assertEquals(1, queue.size());
    }

    @Test
    public void testPoll() throws Exception {
        HashQueue<String> queue = new HashQueue<String>();
        queue.offer("element");
        assertEquals("element", queue.poll());
        assertEquals(0, queue.size());
    }

    @Test
    public void testPeek() throws Exception {
        HashQueue<String> queue = new HashQueue<String>();
        queue.offer("element");
        assertEquals("element", queue.peek());
        assertEquals(1, queue.size());
    }

    @Test
    public void testIterator() throws Exception {
        HashQueue<String> queue = new HashQueue<String>();
        String[] elements = new String[]{"element-1","element-2","element-3"};
        queue.offer(elements[0]);
        queue.offer(elements[1]);
        queue.offer(elements[2]);
        Iterator<String> it = queue.iterator();
        assertTrue(it.hasNext());
        int i=0;
        while(it.hasNext()){
            assertEquals(elements[i++],it.next());
        }
        assertEquals(3, queue.size());
    }

    @Test
    public void testContains() throws Exception {
        HashQueue<String> queue = new HashQueue<String>();
        String[] elements = new String[]{"element-1","element-2","element-3"};
        queue.offer(elements[0]);
        queue.offer(elements[1]);
        queue.offer(elements[2]);
        assertTrue(queue.contains("element-1"));
        assertTrue(queue.contains("element-2"));
        assertTrue(queue.contains("element-3"));
    }
}


text:
module EventMachine
  module WebSocket
    class Connection < EventMachine::Connection
      include Debugger

      attr_writer :max_frame_size

      # define WebSocket callbacks
      def onopen(&blk);     @onopen = blk;    end
      def onclose(&blk);    @onclose = blk;   end
      def onerror(&blk);    @onerror = blk;   end
      def onmessage(&blk);  @onmessage = blk; end
      def onbinary(&blk);   @onbinary = blk; end
      def onping(&blk);     @onping = blk;    end
      def onpong(&blk);     @onpong = blk;    end

      def trigger_on_message(msg)
        @onmessage.call(msg) if defined? @onmessage
      end
      def trigger_on_binary(msg)
        @onbinary.call(msg) if defined? @onbinary
      end
      def trigger_on_open(handshake)
        @onopen.call(handshake) if defined? @onopen
      end
      def trigger_on_close(event = {})
        @onclose.call(event) if defined? @onclose
      end
      def trigger_on_ping(data)
        @onping.call(data) if defined? @onping
      end
      def trigger_on_pong(data)
        @onpong.call(data) if defined? @onpong
      end
      def trigger_on_error(reason)
        return false unless defined? @onerror
        @onerror.call(reason)
        true
      end

      def initialize(options)
        @options = options
        @debug = options[:debug] || false
        @secure = options[:secure] || false
        @secure_proxy = options[:secure_proxy] || false
        @tls_options = options[:tls_options] || {}
        @close_timeout = options[:close_timeout]
        @outbound_limit = options[:outbound_limit] || 0

        @handler = nil

        debug [:initialize]
      end

      # Use this method to close the websocket connection cleanly
      # This sends a close frame and waits for acknowlegement before closing
      # the connection
      def close(code = nil, body = nil)
        if code && !acceptable_close_code?(code)
          raise "Application code may only use codes from 1000, 3000-4999"
        end

        close_websocket_private(code, body)
      end

      # Deprecated, to be removed in version 0.6
      alias :close_websocket :close

      def post_init
        start_tls(@tls_options) if @secure
      end

      def receive_data(data)
        debug [:receive_data, data]

        if @handler
          @handler.receive_data(data)
        else
          dispatch(data)
        end
      rescue => e
        debug [:error, e]

        # There is no code defined for application errors, so use 3000
        # (which is reserved for frameworks)
        close_websocket_private(3000, "Application error")

        # These are application errors - raise unless onerror defined
        trigger_on_error(e) || raise(e)
      end

      def send_data(data)
        if @outbound_limit > 0 &&
            get_outbound_data_size + data.bytesize > @outbound_limit
          abort(:outbound_limit_reached)
          return 0
        end

        super(data)
      end

      def unbind
        debug [:unbind, :connection]

        @handler.unbind if @handler
      rescue => e
        debug [:error, e]
        # These are application errors - raise unless onerror defined
        trigger_on_error(e) || raise(e)
      end

      def dispatch(data)
        if data.match(%r|^GET /healthcheck|)
          send_healthcheck_response
        elsif data.match(/\A<policy-file-request\s*\/>/)
          send_flash_cross_domain_file
        else
          @handshake ||= begin
            handshake = Handshake.new(@secure || @secure_proxy)

            handshake.callback { |upgrade_response, handler_klass|
              debug [:accepting_ws_version, handshake.protocol_version]
              debug [:upgrade_response, upgrade_response]
              self.send_data(upgrade_response)
              @handler = handler_klass.new(self, @debug)
              @handshake = nil
              trigger_on_open(handshake)
            }

            handshake.errback { |e|
              debug [:error, e]
              trigger_on_error(e)
              # Handshake errors require the connection to be aborted
              abort(:handshake_error)
            }

            handshake
          end

          @handshake.receive_data(data)
        end
      end

      def send_healthcheck_response
        debug [:healthcheck, 'OK']

        healthcheck_res = ["HTTP/1.1 200 OK"]
        healthcheck_res << "Content-Type: text/plain"
        healthcheck_res << "Content-Length: 2"

        healthcheck_res = healthcheck_res.join("\r\n") + "\r\n\r\nOK"

        send_data healthcheck_res

        # handle the healthcheck request transparently
        # no need to notify the user about this connection
        @onclose = nil
        close_connection_after_writing
      end

      def send_flash_cross_domain_file
        file =  '<?xml version="1.0"?><cross-domain-policy><allow-access-from domain="*" to-ports="*"/></cross-domain-policy>'
        debug [:cross_domain, file]
        send_data file

        # handle the cross-domain request transparently
        # no need to notify the user about this connection
        @onclose = nil
        close_connection_after_writing
      end

      # Cache encodings since it's moderately expensive to look them up each time
      ENCODING_SUPPORTED = "string".respond_to?(:force_encoding)
      UTF8 = Encoding.find("UTF-8") if ENCODING_SUPPORTED
      BINARY = Encoding.find("BINARY") if ENCODING_SUPPORTED

      # Send a WebSocket text frame.
      #
      # A WebSocketError may be raised if the connection is in an opening or a
      # closing state, or if the passed in data is not valid UTF-8
      #
      def send_text(data)
        # If we're using Ruby 1.9, be pedantic about encodings
        if ENCODING_SUPPORTED
          # Also accept ascii only data in other encodings for convenience
          unless (data.encoding == UTF8 && data.valid_encoding?) || data.ascii_only?
            raise WebSocketError, "Data sent to WebSocket must be valid UTF-8 but was #{data.encoding} (valid: #{data.valid_encoding?})"
          end
          # This labels the encoding as binary so that it can be combined with
          # the BINARY framing
          data.force_encoding(BINARY)
        else
          # TODO: Check that data is valid UTF-8
        end

        if @handler
          @handler.send_text_frame(data)
        else
          raise WebSocketError, "Cannot send data before onopen callback"
        end

        # Revert data back to the original encoding (which we assume is UTF-8)
        # Doing this to avoid duping the string - there may be a better way
        data.force_encoding(UTF8) if ENCODING_SUPPORTED
        return nil
      end

      alias :send :send_text

      # Send a WebSocket binary frame.
      #
      def send_binary(data)
        if @handler
          @handler.send_frame(:binary, data)
        else
          raise WebSocketError, "Cannot send binary before onopen callback"
        end
      end

      # Send a ping to the client. The client must respond with a pong.
      #
      # In the case that the client is running a WebSocket draft < 01, false
      # is returned since ping & pong are not supported
      #
      def ping(body = '')
        if @handler
          @handler.pingable? ? @handler.send_frame(:ping, body) && true : false
        else
          raise WebSocketError, "Cannot ping before onopen callback"
        end
      end

      # Send an unsolicited pong message, as allowed by the protocol. The
      # client is not expected to respond to this message.
      #
      # em-websocket automatically takes care of sending pong replies to
      # incoming ping messages, as the protocol demands.
      #
      def pong(body = '')
        if @handler
          @handler.pingable? ? @handler.send_frame(:pong, body) && true : false
        else
          raise WebSocketError, "Cannot ping before onopen callback"
        end
      end

      # Test whether the connection is pingable (i.e. the WebSocket draft in
      # use is >= 01)
      def pingable?
        if @handler
          @handler.pingable?
        else
          raise WebSocketError, "Cannot test whether pingable before onopen callback"
        end
      end

      def supports_close_codes?
        if @handler
          @handler.supports_close_codes?
        else
          raise WebSocketError, "Cannot test before onopen callback"
        end
      end

      def state
        @handler ? @handler.state : :handshake
      end

      # Returns the IP address for the remote peer
      def remote_ip
        get_peername[2,6].unpack('nC4')[1..4].join('.')
      end

      # Returns the maximum frame size which this connection is configured to
      # accept. This can be set globally or on a per connection basis, and
      # defaults to a value of 10MB if not set.
      #
      # The behaviour when a too large frame is received varies by protocol,
      # but in the newest protocols the connection will be closed with the
      # correct close code (1009) immediately after receiving the frame header
      #
      def max_frame_size
        defined?(@max_frame_size) ? @max_frame_size : WebSocket.max_frame_size
      end

      def close_timeout
        @close_timeout || WebSocket.close_timeout
      end

      private

      # As definited in draft 06 7.2.2, some failures require that the server
      # abort the websocket connection rather than close cleanly
      def abort(reason)
        debug [:abort, reason]
        close_connection
      end

      def close_websocket_private(code, body)
        if @handler
          debug [:closing, code]
          @handler.close_websocket(code, body)
        else
          # The handshake hasn't completed - should be safe to terminate
          abort(:handshake_incomplete)
        end
      end

      # Allow applications to close with 1000, 1003, 1008, 1011, 3xxx or 4xxx.
      #
      # em-websocket uses a few other codes internally which should not be
      # used by applications
      #
      # Browsers generally allow connections to be closed with code 1000,
      # 3xxx, and 4xxx. em-websocket allows closing with a few other codes
      # which seem reasonable (for discussion see
      # https://github.com/igrigorik/em-websocket/issues/98)
      #
      # Usage from the rfc:
      #
      # 1000 indicates a normal closure
      #
      # 1003 indicates that an endpoint is terminating the connection
      # because it has received a type of data it cannot accept
      #
      # 1008 indicates that an endpoint is terminating the connection because
      # it has received a message that violates its policy
      #
      # 1011 indicates that a server is terminating the connection because it
      # encountered an unexpected condition that prevented it from fulfilling
      # the request
      #
      # Status codes in the range 3000-3999 are reserved for use by libraries,
      # frameworks, and applications
      #
      # Status codes in the range 4000-4999 are reserved for private use and
      # thus can't be registered
      #
      def acceptable_close_code?(code)
        case code
        when 1000, 1003, 1008, 1011, (3000..4999)
          true
        else
          false
        end
      end
    end
  end
end


text: Linear programming (Interior point methods)


text:
var Util = {
    randomUUID: function() {
        return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
            var r = Math.random()*16|0, v = c === "x" ? r : (r&0x3|0x8);
            return v.toString(16);
        });
    },

    getISO8601DateString: function() {
        var convert = function(x) { return x.length === 1 ? "0"+x : x; }
        var dateObj = new Date();
        var year = dateObj.getUTCFullYear().toString();
        var month = convert((dateObj.getUTCMonth()+1).toString());
        var date = convert(dateObj.getUTCDate().toString());
        var hours = convert(dateObj.getUTCHours().toString());
        var minutes = convert(dateObj.getUTCMinutes().toString());
        var seconds = convert(dateObj.getUTCSeconds().toString());
        var str = year + "-" + month + "-" + date + "T" + hours + ":" + minutes + ":" + seconds + ".000Z";
        return str;
    },

    formatDateString: function(dateStr, dateOnly) {
        var date = new Date();
        date.setUTCFullYear(parseInt(dateStr.substring(0,4),10));
        date.setUTCMonth(parseInt(dateStr.substring(5,7),10)-1);
        date.setUTCDate(parseInt(dateStr.substring(8,10),10));
        if (dateOnly && dateOnly === true) {
            return date.toLocaleDateString();
        }

        date.setUTCHours(parseInt(dateStr.substring(11,13),10));
        date.setUTCMinutes(parseInt(dateStr.substring(14,16),10));
        date.setUTCSeconds(parseInt(dateStr.substring(17,19),10));
        date.setUTCMilliseconds(0);
        return date.toLocaleString();
    },

    // pass results of this into array.sort() function
    sortBy: function(field, desc, primer){
        var key = function (x) {return primer ? primer(x[field]) : x[field]};

        return function (a,b) {
            var A = key(a), B = key(b);
            return ( (A < B) ? -1 : ((A > B) ? 1 : 0) ) * [-1,1][+!desc];
        }
    },

    arrayToString: function(arr, prop) {
        if (!arr) return "";
        var strArr = prop ? [] : arr.slice(0);
        if (prop) {
            for (var i = 0; i < arr.length; i++) {
                strArr[i] = arr[i][prop];
            }
        }

        var result = "";
        for (var j = 0; j < strArr.length; j++) {
            result += (j>0 ? ", " : "") + strArr[j];
        }
        return result;
    },

    findInArray: function(arr, value, partialMatch) {
        for (var i = 0, len = arr.length; i < len; i++) {
            if (!partialMatch || partialMatch === false) {
                if (arr[i] === value) {
                    return arr[i];
                }
            }
            else if (arr[i].contains(value)) {
                return arr[i];
            }
        }
        return null;
    },

    findInObjectArray: function(arr, prop1, value1, prop2, value2, partialMatch) {
        for (var i = 0, len = arr.length; i < len; i++) {
            if (!partialMatch || partialMatch === false) {
                if (prop1 && arr[i][prop1] === value1) {
                    if (!prop2 || arr[i][prop2] === value2) {
                        return arr[i];
                    }
                }
            }
            else if ((prop1 && arr[i][prop1].contains(value1))
                    || (prop2 && arr[i][prop2].contains(value2))) {
                return arr[i];
            }
        }
        return null;
    },

    findMultipleInObjectArray: function(arr, properties, value) {
        var isMatch,
            results = [],
            index = 0;

        value = value.toLowerCase();
        for (var i = 0; i < arr.length; i++) {
            isMatch = false;
            for (var j = 0; j < properties.length; j++) {
                var prop = arr[i][properties[j]].toLowerCase();
                if (prop.indexOf(value) !== -1) {
                    isMatch = true;
                    break;
                }
            }
            if (isMatch === true) {
                results[index++] = arr[i];
            }
        }
        return results;
    },

    roundNumber = function(number, digits) {
        var multiple = Math.pow(10, digits);
        var rndedNum = Math.round(number * multiple) / multiple;
        return rndedNum;
    }
};


text:
launch-helper-android-dev
=========================

Helper for launching applications while reinstall frequently.


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

namespace Orbital7.Extensions.Models
{
    public interface IAddress
    {
        string Address1 { get; set; }

        string Address2 { get; set; }

        string City { get; set; }

        USState? State { get; set; }

        string ZipCode { get; set; }
    }
}


text:
Security Advisory

    Back to advisories

        <?php get_template_part('advisories/advisory-side'); ?>

Privilege escalation in the contacts application (oC-SA-2013-018)

19th April 2013

Risk level: Medium

Description

Due to not properly checking the ownership of a single contact, an authenticated attacker is able to download contacts of other users in all ownCloud versions prior to 5.0.5 including the 4.5.x branch.

Note: Successful exploitation of this privilege escalation requires the "contacts" app to be enabled (enabled by default).

Affected Software

ownCloud Server < 5.0.5 (CVE-2013-1963)

ownCloud Server < 4.5.10 (CVE-2013-1963)

Action Taken

It is recommended that all instances are upgraded to ownCloud Server 5.0.5 or 4.5.10.

Acknowledgements

The ownCloud team thanks the following people for their research and responsible disclosure of the above advisory:

Lukas Reschke - ownCloud Inc. (lukas@owncloud.org) - Vulnerability discovery and disclosure.


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
	<bean id="helloWorld" class="com.ilad.spring.HelloWorld">
		<property name="message" value="Hello World!"/>
	</bean>
	<bean id="singleton" class="com.ilad.spring.HelloWorld"
		scope="singleton">
	</bean>
	<bean id="prototype" class="com.ilad.spring.HelloWorld"
		scope="prototype">
	</bean>
	<!-- Definition for textEditor bean -->
	<bean id="textEditor" class="com.ilad.spring.TextEditor">
		<property name="spellChecker">
			<bean id="spellChecker" class="com.ilad.spring.SpellChecker"/>
		</property>
	</bean>
</beans>