text:
from __future__ import print_function
from collections import OrderedDict
import re

regexes = {
    'nf-core/methylseq': ['v_pipeline.txt', r"(\S+)"],
    'Nextflow': ['v_nextflow.txt', r"(\S+)"],
    'Bismark genomePrep': ['v_bismark_genome_preparation.txt', r"Bismark Genome Preparation Version: v(\S+)"],
    'FastQC': ['v_fastqc.txt', r"FastQC v(\S+)"],
    'Cutadapt': ['v_cutadapt.txt', r"(\S+)"],
    'Trim Galore!': ['v_trim_galore.txt', r"version (\S+)"],
    'Bismark': ['v_bismark.txt', r"Bismark Version: v(\S+)"],
    'Bismark Deduplication': ['v_deduplicate_bismark.txt', r"Deduplicator Version: v(\S+)"],
    'Bismark methXtract': ['v_bismark_methylation_extractor.txt', r"Bismark Extractor Version: v(\S+)"],
    'Bismark Report': ['v_bismark2report.txt', r"bismark2report version: v(\S+)"],
    'Bismark Summary': ['v_bismark2summary.txt', r"bismark2summary version: (\S+)"],
    'HISAT2': ['v_hisat2.txt', r"version (\S+)"],
    'Samtools': ['v_samtools.txt', r"samtools (\S+)"],
    'BWA': ['v_bwa.txt', r"Version: (\S+)"],
    'bwa-meth': ['v_bwameth.txt', r"bwa-meth\.py (\S+)"],
    'Picard MarkDuplicates': ['v_picard_markdups.txt', r"([\d\.]+)"],
    'MethylDackel': ['v_methyldackel.txt', r"(.+)"],
    'Qualimap': ['v_qualimap.txt', r"QualiMap v.(\S+)"],
    'Preseq': ['v_preseq.txt', r"Version: (\S+)"],
    'MultiQC': ['v_multiqc.txt', r"multiqc, version (\S+)"],
}
results = OrderedDict()
results['nf-core/methylseq'] = 'N/A'
results['Nextflow'] = 'N/A'
results['Bismark genomePrep'] = 'N/A'
results['FastQC'] = 'N/A'
results['Cutadapt'] = 'N/A'
results['Trim Galore!'] = 'N/A'
results['Bismark'] = 'N/A'
results['Bismark Deduplication'] = 'N/A'
results['Bismark methXtract'] = 'N/A'
results['Bismark Report'] = 'N/A'
results['Bismark Summary'] = 'N/A'
results['Samtools'] = 'N/A'
results['BWA'] = 'N/A'
results['bwa-meth'] = 'N/A'
results['Picard MarkDuplicates'] = 'N/A'
results['MethylDackel'] = 'N/A'
results['Qualimap'] = 'N/A'
results['Preseq'] = 'N/A'
results['MultiQC'] = 'N/A'

# Search each file using its regex
for k, v in regexes.items():
    try:
        with open(v[0]) as x:
            versions = x.read()
            match = re.search(v[1], versions)
            if match:
                results[k] = "v{}".format(match.group(1))
    except IOError:
        results[k] = False

# Remove software set to false in results
for k in list(results):
    if not results[k]:
        del results[k]

# Dump to YAML
print(
    """
id: 'software_versions'
section_name: 'nf-core/methylseq Software Versions'
section_href: 'https://github.com/nf-core/methylseq'
plot_type: 'html'
description: 'are collected at run time from the software output.'
data: |

"""
)
for k, v in results.items():
    print("
{}

<samp>{}</samp>
".format(k, v))
print("
")

# Write out regexes as csv file:
with open("software_versions.csv", "w") as f:
    for k, v in results.items():
        f.write("{}\t{}\n".format(k, v))


text:
{% if customHeader %}
  {{ customHeader|safe }}
{% else %}

        {% if headerTitle %}

            {{ headerTitle }}

        {% endif %}
        {% if headerDescription %}

          {% autoescape off %}{{ headerDescription }}{% endautoescape %}

        {% endif %}

      {% if headerButtons %}

        {% for button in headerButtons %}
        {{ button.label }}
        {% endfor %}

      {% endif %}

    {% include "includes/lower-tabs.html" %}

{% endif %}

redpajama_set_name: RedPajamaGithub


text:
StoneSteps

Don't mistake activity with achievement.

John Wooden

      <form method ="post" action="<?php echo base_url(); ?>login/receiveData" id="loginForm">

          <?php
            if (isset($_SESSION['error-user']))
              echo "Error: ".$_SESSION['error-user']['error'];
          ?>

            <input name="email" type="email" class="validate" value="<?php if(isset($_SESSION['error-user'])) echo $_SESSION['error-user']['email']; ?>" required>
            Email

            <input name="password" type="password" class="validate" required>
            Password

      </form>

        <input type="submit" form="loginForm" id="login-button" class="btn-main accent col s8 offset-s2 m6 offset-m3 l4 offset-l4" value="Log In">

        <a href="<?php echo base_url(); ?>signup" id="signin-button" class="btn-main dark-primary col s8 offset-s2 m6 offset-m3 l4 offset-l4">Sign Up


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _reactRedux = require('react-redux');

var _createFieldProps2 = require('./createFieldProps');

var _createFieldProps3 = _interopRequireDefault(_createFieldProps2);

var _plain = require('./structure/plain');

var _plain2 = _interopRequireDefault(_plain);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var propsToNotUpdateFor = ['_reduxForm'];

var createConnectedFields = function createConnectedFields(_ref) {
  var deepEqual = _ref.deepEqual;
  var getIn = _ref.getIn;

  var getSyncError = function getSyncError(syncErrors, name) {
    var error = _plain2.default.getIn(syncErrors, name);
    // Because the error for this field might not be at a level in the error structure where
    // it can be set directly, it might need to be unwrapped from the _error property
    return error && error._error ? error._error : error;
  };

  var getSyncWarning = function getSyncWarning(syncWarnings, name) {
    var warning = _plain2.default.getIn(syncWarnings, name);
    // Because the warning for this field might not be at a level in the warning structure where
    // it can be set directly, it might need to be unwrapped from the _warning property
    return warning && warning._warning ? warning._warning : warning;
  };

  var ConnectedFields = function (_Component) {
    _inherits(ConnectedFields, _Component);

    function ConnectedFields() {
      _classCallCheck(this, ConnectedFields);

      return _possibleConstructorReturn(this, (ConnectedFields.__proto__ || Object.getPrototypeOf(ConnectedFields)).apply(this, arguments));
    }

    _createClass(ConnectedFields, [{
      key: 'shouldComponentUpdate',
      value: function shouldComponentUpdate(nextProps) {
        var _this2 = this;

        var nextPropsKeys = Object.keys(nextProps);
        var thisPropsKeys = Object.keys(this.props);
        return nextPropsKeys.length !== thisPropsKeys.length || nextPropsKeys.some(function (prop) {
          return !~propsToNotUpdateFor.indexOf(prop) && !deepEqual(_this2.props[prop], nextProps[prop]);
        });
      }
    }, {
      key: 'isDirty',
      value: function isDirty() {
        var _fields = this.props._fields;

        return Object.keys(_fields).some(function (name) {
          return _fields[name].dirty;
        });
      }
    }, {
      key: 'getValues',
      value: function getValues() {
        var _fields = this.props._fields;

        return Object.keys(_fields).reduce(function (accumulator, name) {
          return _plain2.default.setIn(accumulator, name, _fields[name].value);
        }, {});
      }
    }, {
      key: 'getRenderedComponent',
      value: function getRenderedComponent() {
        return this.refs.renderedComponent;
      }
    }, {
      key: 'render',
      value: function render() {
        var _props = this.props;
        var component = _props.component;
        var withRef = _props.withRef;
        var _fields = _props._fields;
        var _reduxForm = _props._reduxForm;

        var rest = _objectWithoutProperties(_props, ['component', 'withRef', '_fields', '_reduxForm']);

        var asyncValidate = _reduxForm.asyncValidate;
        var blur = _reduxForm.blur;
        var change = _reduxForm.change;
        var focus = _reduxForm.focus;

        var _Object$keys$reduce = Object.keys(_fields).reduce(function (accumulator, name) {
          var connectedProps = _fields[name];

          var _createFieldProps = (0, _createFieldProps3.default)(getIn, name, _extends({}, connectedProps, rest, {
            blur: blur,
            change: change,
            focus: focus
          }), asyncValidate);

          var custom = _createFieldProps.custom;

          var fieldProps = _objectWithoutProperties(_createFieldProps, ['custom']);

          accumulator.custom = custom;
          return _plain2.default.setIn(accumulator, name, fieldProps);
        }, {});

        var custom = _Object$keys$reduce.custom;

        var props = _objectWithoutProperties(_Object$keys$reduce, ['custom']);

        if (withRef) {
          props.ref = 'renderedComponent';
        }

        return (0, _react.createElement)(component, _extends({}, props, custom));
      }
    }]);

    return ConnectedFields;
  }(_react.Component);

  ConnectedFields.propTypes = {
    component: _react.PropTypes.oneOfType([_react.PropTypes.func, _react.PropTypes.string]).isRequired,
    _fields: _react.PropTypes.object.isRequired,
    props: _react.PropTypes.object
  };

  var connector = (0, _reactRedux.connect)(function (state, ownProps) {
    var names = ownProps.names;
    var _ownProps$_reduxForm = ownProps._reduxForm;
    var initialValues = _ownProps$_reduxForm.initialValues;
    var getFormState = _ownProps$_reduxForm.getFormState;

    var formState = getFormState(state);
    return {
      _fields: names.reduce(function (accumulator, name) {
        var initialState = getIn(formState, 'initial.' + name);
        var initial = initialState !== undefined ? initialState : initialValues && getIn(initialValues, name);
        var value = getIn(formState, 'values.' + name);
        var syncError = getSyncError(getIn(formState, 'syncErrors'), name);
        var syncWarning = getSyncWarning(getIn(formState, 'syncWarnings'), name);
        var submitting = getIn(formState, 'submitting');
        var pristine = value === initial;
        accumulator[name] = {
          asyncError: getIn(formState, 'asyncErrors.' + name),
          asyncValidating: getIn(formState, 'asyncValidating') === name,
          dirty: !pristine,
          pristine: pristine,
          state: getIn(formState, 'fields.' + name),
          submitError: getIn(formState, 'submitErrors.' + name),
          submitting: submitting,
          syncError: syncError,
          syncWarning: syncWarning,
          value: value,
          _value: ownProps.value // save value passed in (for checkboxes)
        };
        return accumulator;
      }, {})
    };
  }, undefined, undefined, { withRef: true });
  return connector(ConnectedFields);
};

exports.default = createConnectedFields;


text:
require 'rails_helper'
include Warden::Test::Helpers

RSpec.describe 'Adults' do
  before(:all) { Capybara.default_driver = :rack_test }

  before(:all) do
    Warden.test_mode!
    create_cub_scout_unit
  end

  before(:each) do
    Warden.test_reset!
    login_as(@user, scope: :user)
    visit unit_adults_path(@unit)
  end

  context 'when viewing a list of unit adults' do
    it 'shows the adult name, den, leadership position, and scouts' do
      within 'body .container-fluid table' do
        expect(page).to have_link('Karl, Tara')
        # expect(page).to have_text('Den 44, Den 55') -- we no longer display related patrols
        expect(page).to have_text('Committee Chair')
        expect(page).to have_link("Bocephus Jones")
        expect(page).to have_link("Aydan Russel")
      end
    end
  end

  context 'when adding a new adult' do
    before { click_link 'New Adult' }

    context 'with valid data' do
      before do
        within 'form#new_adult' do
          fill_in 'adult_first_name', with: 'Rusty'
          fill_in 'adult_last_name', with: 'Balls'
        end
      end

      it 'enter new adult info, submit, goto to adult show and display show adult page' do
        expect(page).to have_text('New Adult in Cub Scout Pack 134')

        within 'form#new_adult' do
          fill_in 'Email', with: 'rusty.balls@aol.com'
          select 'Webmaster', from: 'adult_unit_positions_attributes_0_leadership'
          fill_in 'adult_unit_positions_attributes_0_additional', with: 'Joker'
          select '1955', from: 'adult_birth_1i'
          select 'February', from: 'adult_birth_2i'
          select '14', from: 'adult_birth_3i'
          fill_in 'Address1', with: '3660 N Lake Shore Dr'
          fill_in 'adult_city', with: 'Chicago'
          select 'Illinois', from: 'adult_state'
          fill_in 'adult_zip_code', with: '60657'
          # this should be tested later with javascript
          select 'Russel, Aydan', from: 'adult_scout_ids'
        end

        click_button 'Create Adult'

        rusty_balls = User.find_by_first_name('Rusty')
        expect(page.current_path).to eq(unit_adult_path(@unit, rusty_balls))
        expect(page).to have_text('Rusty Balls was successfully created')
        expect(page).to have_text('Adult: Rusty Balls')
        expect(page).to have_text('Cub Scout Pack 134')
        expect(page).to have_text('rusty.balls@aol.com')
        expect(page).to have_text('Webmaster, Joker')
        expect(page).to have_text('3660 N Lake Shore Dr')
        expect(page).to have_text('Chicago, IL 60657')
        expect(page).to have_link('Aydan Russel')
      end

      it 'allows the adult to have multiple related scouts' do
        within 'form#new_adult' do
          select 'Russel, Aydan', from: 'adult_scout_ids'
          select 'Jones, Bocephus', from: 'adult_scout_ids'
        end

        click_button 'Create Adult'

        expect(page).to have_text('Rusty Balls was successfully created')
        expect(page).to have_link('Aydan Russel')
        expect(page).to have_link('Bocephus Jones')
      end

      it 'allows an adult to have no related scouts' do
        click_button 'Create Adult'

        expect(page).to have_text('Rusty Balls was successfully created')
        expect(page).to_not have_link('Aydan Russel')
        expect(page).to_not have_link('Bocephus Jones')
      end
    end

    context 'with invalid data' do
      it 'displays flash messages with errors' do
        click_button 'Create Adult'

        expect(page).to have_text('First name can\'t be blank')
        expect(page).to have_text('Last name can\'t be blank')
      end

      it 'entered data is persisted' do
        within 'form#new_adult' do
          fill_in 'adult_last_name', with: 'Eustus'
        end

        click_button 'Create Adult'

        expect(page).to have_text('First name can\'t be blank')
        expect(page).to have_field('adult_last_name', with: 'Eustus')
      end
    end

    context 'clicking cancel' do
      it 'returns to adult list' do
        click_link 'Cancel'

        expect(page.current_path).to eq(unit_adults_path(@unit))
      end
    end
  end

  context 'when showing an existing adult' do
    before do
      click_link 'Karl, Tara'
    end

    it 'clicking the name of the users goes to the edit view' do
      expect(page.current_path).to eq(unit_adult_path(@unit, @user))
      expect(page).to have_text('Adult: Tara Karl')
    end

    it 'clicking unit_name adults returns to adult list' do
      click_link 'Pack 134 Adults'

      expect(page).to have_text('Adults in Pack 134')
      expect(page.current_path).to eq(unit_adults_path(@unit))
    end

    it 'clicking change edits the adult' do
      click_link "Edit"

      expect(page).to have_text('Edit Adult')
      expect(page.current_path).to eq(edit_unit_adult_path(@unit, @user))
    end
  end

  context 'deleting an adult' do
    before do
      @user2 = FactoryGirl.create(:adult, first_name: 'Bonnie', last_name: 'Doom')
      @user2.units << @unit
      visit unit_adult_path(@unit, @user2)
    end

    it 'deletes the user and returns to the adult list' do
      click_link 'Destroy Bonnie'

      expect(page.current_path).to eq(unit_adults_path(@unit))
      expect(page).to have_text('Bonnie Doom, and all associated data, was permanently deleted')
      expect(page).to_not have_text('Doom, Bonnie')
    end
  end

  context 'editing an adult' do
    before do
      @user2 = FactoryGirl.create(:adult, first_name: 'Bonnie', last_name: 'Doom')
      @user2.units << @unit
      visit unit_adult_path(@unit, @user2)
      click_link "Edit"

      within "form#edit_adult_#{@user2.id}" do
        fill_in 'adult_first_name', with: 'Fionula'
        fill_in 'adult[unit_positions_attributes][0][additional]', with: 'Jester'
      end
    end

    after do
      @user2.destroy
    end

    it 'updates fields when changed and returns to the show page' do
      click_button 'Update Adult'

      expect(page.current_path).to eq(unit_adult_path(@unit, @user2))
      expect(page).to have_text('Fionula Doom was successfully updated')
      expect(page).to have_text('Fionula Doom')
      expect(page).to_not have_text('Bonnie Doom')
      expect(page).to have_text('Jester')
    end

    it 'canceling update does not change data and returns to show page' do
      click_link 'Cancel'

      expect(page.current_path).to eq(unit_adult_path(@unit, @user2))
      expect(page).to have_text('Bonnie Doom')
      expect(page).to_not have_text('Fionula Doom')
    end
  end

end


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

namespace AssemblyImporter.CLR.CIL
{
    // II.25.4.1
    public class Method
    {
        private const uint CorILMethod_TinyFormat = 0x2;
        private const uint CorILMethod_FatFormat = 0x3;
        private const uint CorILMethod_MoreSects = 0x8;
        private const uint CorILMethod_InitLocals = 0x10;

        public uint MaxStack { get; private set; }
        public CLRSigLocalVarSig LocalVarSig { get; private set; }
        public MethodDataSection[] Sections { get; private set; }
        public HLInstruction[] Instructions { get; private set; }

        private Dictionary<uint, uint> m_offsetToInstruction;
        private List<uint> m_instructionToOffset;

        public Method(CLRMetaDataParser parser)
        {
            m_offsetToInstruction = new Dictionary<uint, uint>();
            m_instructionToOffset = new List<uint>();

            byte headByte = parser.ReadU8();
            uint codeSize;
            bool haveSections;

            int format = (headByte & 0x3);
            if (format == CorILMethod_TinyFormat)
            {
                // Tiny format (II.25.4.2)
                codeSize = ((uint)headByte >> 2);

                MaxStack = 8;
                haveSections = false;
            }
            else if (format == CorILMethod_FatFormat)
            {
                // Fat format (II.25.4.3)
                byte highByte = parser.ReadU8();
                uint flagsAndSize = ((uint)headByte | ((uint)highByte << 8));

                uint headerSizeInDWords = (flagsAndSize >> 12) & 0xf;

                if (headerSizeInDWords != 3)
                    throw new ParseFailedException("Unsupported method format");
                MaxStack = parser.ReadU16();
                codeSize = parser.ReadU32();
                CLRStandAloneSigRow localSig = (CLRStandAloneSigRow)parser.ReadFatToken();
                if (localSig != null)
                    LocalVarSig = new CLRSigLocalVarSig(new CLRSignatureParser(localSig.Signature, parser.Tables));

                haveSections = ((flagsAndSize & CorILMethod_MoreSects) != 0);
            }
            else
                throw new ParseFailedException("Invalid IL method format");

            ParseCode(parser, codeSize);

            List<MethodDataSection> sections = new List<MethodDataSection>();
            while (haveSections)
            {
                parser.Align(4);
                sections.Add(MethodDataSection.Parse(parser, m_offsetToInstruction, out haveSections));
            }
            Sections = sections.ToArray();
        }

        public void ParseCode(CLRMetaDataParser parser, uint codeSize)
        {
            InstructionParser instParser = new InstructionParser(parser.ReadBytes(codeSize), parser.Tables, parser.BinData);

            List<HLInstruction> instructions = new List<HLInstruction>();
            while (!instParser.AtEnd)
            {
                long pos = instParser.Position;
                m_offsetToInstruction[(uint)pos] = (uint)instructions.Count;
                m_instructionToOffset.Add((uint)pos);
                instructions.Add(instParser.DecodeInstruction());
            }
            m_instructionToOffset.Add((uint)instParser.Position);

            // Unpatch instructions
            for (int i = 0; i < instructions.Count; i++)
            {
                HLInstruction instr = instructions[i];
                if ((instr.Flags & HLOpFlags.Br) != 0)
                {
                    instr.ConvertBranchTargets(m_instructionToOffset[i + 1], m_offsetToInstruction);
                    instructions[i] = instr;
                }
            }

            Instructions = instructions.ToArray();
        }

        public uint OffsetForInstruction(int instr)
        {
            return m_instructionToOffset[instr];
        }
    }
}


text:
namespace Engine
{
    namespace RenderPass
    {
        std::shared_ptr<SwapChain> SwapChain::instance = nullptr;

        std::shared_ptr<SwapChain> SwapChain::getInstance()
        {
            if(instance == nullptr)
                instance = std::shared_ptr<SwapChain>(new SwapChain());
            return instance;
        }

        SwapChain::SwapChain()
        {
            auto app_data = ApplicationData::data;

            // Create SwapchainKHR
            {
                vk::SwapchainCreateInfoKHR swapChainCI = buildSwapChainCI();
                swap_chain_ = app_data->device.createSwapchainKHR(swapChainCI);
            }

            // Create Swapchain Image Buffer
            {
                vk::Result res = app_data->device.getSwapchainImagesKHR(swap_chain_, &image_count_, nullptr, {});
                assert(res == vk::Result::eSuccess && image_count_ > 0);

                auto* swap_chain_images_ = (vk::Image *) malloc(image_count_ * sizeof(vk::Image));
                assert(swap_chain_images_);

                res = app_data->device.getSwapchainImagesKHR(swap_chain_, &image_count_, swap_chain_images_);
                assert(res == vk::Result::eSuccess && image_count_ > 0);

                // Create Swapchain Buffer
                for (uint32_t i = 0; i < image_count_; i++)
                {
                    Memory::ImageProps img_props = {};
                    img_props.format = Memory::ImageFormats::getSurfaceFormat().format;
                    img_props.component = {
                        vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG,
                        vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA
                    };

                    swap_chain_buffer_.push_back(std::make_unique<Memory::BufferImage>(img_props, swap_chain_images_[i]));
                }
            }
        }

        void SwapChain::reset()
        {
            ApplicationData::data->device.destroySwapchainKHR(instance->swap_chain_);
            instance->swap_chain_buffer_.clear();
            instance.reset();
        }

        uint32_t SwapChain::getImageCount() const
        {
            return image_count_;
        }

        vk::ImageView SwapChain::getSwapChainImageView(uint32_t swapchain_index) const
        {
            return swap_chain_buffer_[swapchain_index]->view;
        }

        vk::SwapchainKHR SwapChain::getSwapChainKHR() const
        {
            return swap_chain_;
        }

        vk::SwapchainCreateInfoKHR SwapChain::buildSwapChainCI()
        {
            auto app_data = ApplicationData::data;

            vk::Result res;
            vk::SurfaceCapabilitiesKHR surfCapabilities;
            surfCapabilities = app_data->gpu.getSurfaceCapabilitiesKHR(app_data->surface);

            vk::PresentModeKHR swapchainPresentMode = vk::PresentModeKHR::eFifo;
            {
                std::vector<vk::PresentModeKHR> presentation_modes = {};
                uint32_t presentation_modes_count = 0;

                res = app_data->gpu.getSurfacePresentModesKHR(app_data->surface, &presentation_modes_count, nullptr,
                                                              {});
                assert(res == vk::Result::eSuccess && presentation_modes_count > 0);
                presentation_modes.resize(presentation_modes_count);
                res = app_data->gpu.getSurfacePresentModesKHR(app_data->surface, &presentation_modes_count,
                                                              presentation_modes.data());
                assert(res == vk::Result::eSuccess && presentation_modes_count > 0);

                // The FIFO present mode is guaranteed by the spec to be supported
                // Also note that current Android driver only supports FIFO
                for (short i = 0; i < presentation_modes_count; i++) {
                    // Use MailBox if supported
                    if (presentation_modes[i] == vk::PresentModeKHR::eMailbox) {
                        swapchainPresentMode = presentation_modes[i];
                        break;
                    }
                }
            }

            vk::Extent2D swapchainExtent;
            {
                // width and height are either both 0xFFFFFFFF, or both not 0xFFFFFFFF.
                if (surfCapabilities.currentExtent.width == 0xFFFFFFFF) {
                    // If the surface size is undefined, the size is set to
                    // the size of the images requested.
                    swapchainExtent.width  = app_data->view_width;
                    swapchainExtent.height = app_data->view_height;
                    if (swapchainExtent.width < surfCapabilities.minImageExtent.width) {
                        swapchainExtent.width = surfCapabilities.minImageExtent.width;
                    } else if (swapchainExtent.width > surfCapabilities.maxImageExtent.width) {
                        swapchainExtent.width = surfCapabilities.maxImageExtent.width;
                    }

                    if (swapchainExtent.height < surfCapabilities.minImageExtent.height) {
                        swapchainExtent.height = surfCapabilities.minImageExtent.height;
                    } else if (swapchainExtent.height > surfCapabilities.maxImageExtent.height) {
                        swapchainExtent.height = surfCapabilities.maxImageExtent.height;
                    }
                } else {
                    // If the surface size is defined, the swap chain size must match
                    swapchainExtent = surfCapabilities.currentExtent;
                }
            }

            // Determine the number of vk::Image's to use in the swap chain.
            // We need to acquire only 1 presentable image at at time.
            // Asking for minImageCount images ensures that we can acquire
            // 1 presentable image as long as we present it before attempting
            // to acquire another.
            image_count_ = surfCapabilities.minImageCount + 1;
            if ((surfCapabilities.maxImageCount > 0) && (image_count_ > surfCapabilities.maxImageCount))
                image_count_ = surfCapabilities.maxImageCount;

            vk::SurfaceTransformFlagBitsKHR preTransform;
            if (surfCapabilities.supportedTransforms & vk::SurfaceTransformFlagBitsKHR::eIdentity) {
                preTransform = vk::SurfaceTransformFlagBitsKHR::eIdentity;
            } else {
                preTransform = surfCapabilities.currentTransform;
            }

            // Find a supported composite alpha mode - one of these is guaranteed to be set
            vk::CompositeAlphaFlagBitsKHR compositeAlpha = vk::CompositeAlphaFlagBitsKHR::eOpaque;
            vk::CompositeAlphaFlagBitsKHR compositeAlphaFlags[4] = {
                vk::CompositeAlphaFlagBitsKHR::eOpaque,
                vk::CompositeAlphaFlagBitsKHR::ePreMultiplied,
                vk::CompositeAlphaFlagBitsKHR::ePostMultiplied,
                vk::CompositeAlphaFlagBitsKHR::eInherit,
            };

            for (uint32_t i = 0; i < sizeof(compositeAlphaFlags); i++) {
                if (surfCapabilities.supportedCompositeAlpha & compositeAlphaFlags[i]) {
                    compositeAlpha = compositeAlphaFlags[i];
                    break;
                }
            }

            vk::SurfaceFormatKHR surface_format = Memory::ImageFormats::getSurfaceFormat();

            vk::SwapchainCreateInfoKHR swapchain_ci = {};
            swapchain_ci.pNext 					= nullptr;
            swapchain_ci.surface 				= app_data->surface;
            swapchain_ci.minImageCount 			= image_count_;
            swapchain_ci.imageFormat 			= surface_format.format;
            swapchain_ci.imageColorSpace		= surface_format.colorSpace;
            swapchain_ci.imageUsage 			= vk::ImageUsageFlagBits::eTransferSrc | vk::ImageUsageFlagBits::eTransferDst | vk::ImageUsageFlagBits::eColorAttachment;
            swapchain_ci.imageSharingMode 		= vk::SharingMode::eExclusive;
            swapchain_ci.imageExtent.width 		= swapchainExtent.width;
            swapchain_ci.imageExtent.height 	= swapchainExtent.height;
            swapchain_ci.preTransform 			= preTransform;
            swapchain_ci.compositeAlpha 		= compositeAlpha;
            swapchain_ci.imageArrayLayers 		= 1;
            swapchain_ci.presentMode 			= swapchainPresentMode;
            swapchain_ci.oldSwapchain 			= nullptr;
            swapchain_ci.clipped 				= VK_TRUE;
            swapchain_ci.queueFamilyIndexCount  = 0;
            swapchain_ci.pQueueFamilyIndices 	= nullptr;

            uint32_t graphics_queue_family_index_ = Queue::GetGraphicQueueIndex();
            uint32_t present_queue_family_index_  = Queue::GetPresentQueueIndex();

            if (graphics_queue_family_index_ != present_queue_family_index_) {
                // If the graphics and present queues are from different queue families,
                // we either have to explicitly transfer ownership of images between the
                // queues, or we have to create the swapchain with imageSharingMode
                // as VK_SHARING_MODE_CONCURRENT

                std::array<uint32_t, 2> queueFamilyIndices = {
                    (uint32_t)graphics_queue_family_index_,
                    (uint32_t)present_queue_family_index_
                };

                swapchain_ci.imageSharingMode 		= vk::SharingMode::eConcurrent;
                swapchain_ci.queueFamilyIndexCount 	= queueFamilyIndices.size();
                swapchain_ci.pQueueFamilyIndices 	= queueFamilyIndices.data();
            }

            return swapchain_ci;
        }

    }
}


text:
=========================================
Python SWIG Wrappers for VMWare VIX C API
=========================================
:author: Mika Eloranta
:version control: https://github.com/melor/swig-vix
:license: MIT (see LICENSE)

Overview
--------
This is a draft SWIG based VIX API for Python.


text:
package com.amazonaws.services.elasticache.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * A value that applies only to a certain cache node type.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CacheNodeTypeSpecificValue implements Serializable, Cloneable {

    /**
     *

     * The cache node type for which this value applies.
     *

     */
    private String cacheNodeType;
    /**
     *

     * The value for the cache node type.
     *

     */
    private String value;

    /**
     *

     * The cache node type for which this value applies.
     *

     *
     * @param cacheNodeType
     *        The cache node type for which this value applies.
     */

    public void setCacheNodeType(String cacheNodeType) {
        this.cacheNodeType = cacheNodeType;
    }

    /**
     *

     * The cache node type for which this value applies.
     *

     *
     * @return The cache node type for which this value applies.
     */

    public String getCacheNodeType() {
        return this.cacheNodeType;
    }

    /**
     *

     * The cache node type for which this value applies.
     *

     *
     * @param cacheNodeType
     *        The cache node type for which this value applies.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CacheNodeTypeSpecificValue withCacheNodeType(String cacheNodeType) {
        setCacheNodeType(cacheNodeType);
        return this;
    }

    /**
     *

     * The value for the cache node type.
     *

     *
     * @param value
     *        The value for the cache node type.
     */

    public void setValue(String value) {
        this.value = value;
    }

    /**
     *

     * The value for the cache node type.
     *

     *
     * @return The value for the cache node type.
     */

    public String getValue() {
        return this.value;
    }

    /**
     *

     * The value for the cache node type.
     *

     *
     * @param value
     *        The value for the cache node type.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CacheNodeTypeSpecificValue withValue(String value) {
        setValue(value);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getCacheNodeType() != null)
            sb.append("CacheNodeType: ").append(getCacheNodeType()).append(",");
        if (getValue() != null)
            sb.append("Value: ").append(getValue());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof CacheNodeTypeSpecificValue == false)
            return false;
        CacheNodeTypeSpecificValue other = (CacheNodeTypeSpecificValue) obj;
        if (other.getCacheNodeType() == null ^ this.getCacheNodeType() == null)
            return false;
        if (other.getCacheNodeType() != null && other.getCacheNodeType().equals(this.getCacheNodeType()) == false)
            return false;
        if (other.getValue() == null ^ this.getValue() == null)
            return false;
        if (other.getValue() != null && other.getValue().equals(this.getValue()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getCacheNodeType() == null) ? 0 : getCacheNodeType().hashCode());
        hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode());
        return hashCode;
    }

    @Override
    public CacheNodeTypeSpecificValue clone() {
        try {
            return (CacheNodeTypeSpecificValue) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
namespace blink {

namespace {

MediaQueryExpValue IdentValue(CSSValueID id) {
  return MediaQueryExpValue(id);
}

MediaQueryExpValue RatioValue(unsigned numerator, unsigned denominator) {
  return MediaQueryExpValue(numerator, denominator);
}

MediaQueryExpValue PxValue(double value) {
  return MediaQueryExpValue(value, CSSPrimitiveValue::UnitType::kPixels);
}

MediaQueryExpValue EmValue(double value) {
  return MediaQueryExpValue(value, CSSPrimitiveValue::UnitType::kEms);
}

MediaQueryExpValue RemValue(double value) {
  return MediaQueryExpValue(value, CSSPrimitiveValue::UnitType::kRems);
}

MediaQueryExpValue InvalidValue() {
  return MediaQueryExpValue();
}

MediaQueryExpComparison NoCmp(MediaQueryExpValue v) {
  return MediaQueryExpComparison(v);
}

MediaQueryExpComparison LtCmp(MediaQueryExpValue v) {
  return MediaQueryExpComparison(v, MediaQueryOperator::kLt);
}

MediaQueryExpComparison LeCmp(MediaQueryExpValue v) {
  return MediaQueryExpComparison(v, MediaQueryOperator::kLe);
}

MediaQueryExpComparison GtCmp(MediaQueryExpValue v) {
  return MediaQueryExpComparison(v, MediaQueryOperator::kGt);
}

MediaQueryExpComparison GeCmp(MediaQueryExpValue v) {
  return MediaQueryExpComparison(v, MediaQueryOperator::kGe);
}

MediaQueryExpComparison EqCmp(MediaQueryExpValue v) {
  return MediaQueryExpComparison(v, MediaQueryOperator::kEq);
}

MediaQueryExp LeftExp(String feature, MediaQueryExpComparison cmp) {
  return MediaQueryExp::Create(feature,
                               MediaQueryExpBounds(cmp, NoCmp(InvalidValue())));
}

MediaQueryExp RightExp(String feature, MediaQueryExpComparison cmp) {
  return MediaQueryExp::Create(feature,
                               MediaQueryExpBounds(NoCmp(InvalidValue()), cmp));
}

MediaQueryExp PairExp(String feature,
                      MediaQueryExpComparison left,
                      MediaQueryExpComparison right) {
  return MediaQueryExp::Create(feature, MediaQueryExpBounds(left, right));
}

std::unique_ptr<MediaQueryExpNode> FeatureNode(MediaQueryExp expr) {
  return std::make_unique<MediaQueryFeatureExpNode>(expr);
}

std::unique_ptr<MediaQueryExpNode> EnclosedFeatureNode(MediaQueryExp expr) {
  return MediaQueryExpNode::Nested(
      std::make_unique<MediaQueryFeatureExpNode>(expr));
}

std::unique_ptr<MediaQueryExpNode> NestedNode(
    std::unique_ptr<MediaQueryExpNode> child) {
  return MediaQueryExpNode::Nested(std::move(child));
}

std::unique_ptr<MediaQueryExpNode> NotNode(
    std::unique_ptr<MediaQueryExpNode> operand) {
  return MediaQueryExpNode::Not(std::move(operand));
}

std::unique_ptr<MediaQueryExpNode> AndNode(
    std::unique_ptr<MediaQueryExpNode> left,
    std::unique_ptr<MediaQueryExpNode> right) {
  return MediaQueryExpNode::And(std::move(left), std::move(right));
}

std::unique_ptr<MediaQueryExpNode> OrNode(
    std::unique_ptr<MediaQueryExpNode> left,
    std::unique_ptr<MediaQueryExpNode> right) {
  return MediaQueryExpNode::Or(std::move(left), std::move(right));
}

std::unique_ptr<MediaQueryExpNode> UnknownNode(String string) {
  return std::make_unique<MediaQueryUnknownExpNode>(string);
}

}  // namespace

TEST(MediaQueryExpTest, ValuesType) {
  EXPECT_TRUE(IdentValue(CSSValueID::kTop).IsId());
  EXPECT_TRUE(PxValue(10).IsNumeric());
  EXPECT_TRUE(RatioValue(0, 1).IsRatio());
}

TEST(MediaQueryExpTest, ValueEquality) {
  EXPECT_EQ(PxValue(10), PxValue(10));
  EXPECT_EQ(EmValue(10), EmValue(10));
  EXPECT_EQ(IdentValue(CSSValueID::kTop), IdentValue(CSSValueID::kTop));
  EXPECT_EQ(IdentValue(CSSValueID::kTop), IdentValue(CSSValueID::kTop));
  EXPECT_EQ(RatioValue(1, 2), RatioValue(1, 2));

  // Mismatched values:
  EXPECT_NE(PxValue(10), PxValue(20));
  EXPECT_NE(EmValue(20), EmValue(10));
  EXPECT_NE(IdentValue(CSSValueID::kTop), IdentValue(CSSValueID::kLeft));
  EXPECT_NE(RatioValue(16, 9), RatioValue(4, 3));

  // Mismatched unit:
  EXPECT_NE(PxValue(10), EmValue(10));

  // Mismatched types:
  EXPECT_NE(PxValue(10), IdentValue(CSSValueID::kTop));
  EXPECT_NE(PxValue(10), RatioValue(1, 2));

  // Mismatched validity:
  EXPECT_NE(PxValue(10), InvalidValue());
  EXPECT_NE(PxValue(0), InvalidValue());
  EXPECT_NE(RatioValue(0, 1), InvalidValue());
}

TEST(MediaQueryExpTest, ComparisonEquality) {
  auto px1 = PxValue(10.0);
  auto px2 = PxValue(20.0);

  EXPECT_EQ(LtCmp(px1), LtCmp(px1));

  EXPECT_NE(LtCmp(px1), LeCmp(px1));
  EXPECT_NE(LtCmp(px1), LtCmp(px2));
}

TEST(MediaQueryExpTest, BoundaryEquality) {
  auto px1 = PxValue(10.0);
  auto px2 = PxValue(20.0);

  EXPECT_EQ(MediaQueryExpBounds(LtCmp(px1), LeCmp(px1)),
            MediaQueryExpBounds(LtCmp(px1), LeCmp(px1)));

  EXPECT_NE(MediaQueryExpBounds(LtCmp(px1), LeCmp(px1)),
            MediaQueryExpBounds(GtCmp(px1), LeCmp(px1)));
  EXPECT_NE(MediaQueryExpBounds(LtCmp(px1), LeCmp(px1)),
            MediaQueryExpBounds(LtCmp(px1), GeCmp(px1)));
  EXPECT_NE(MediaQueryExpBounds(LtCmp(px1), LeCmp(px2)),
            MediaQueryExpBounds(LtCmp(px1), LeCmp(px1)));
}

TEST(MediaQueryExpTest, ExpEquality) {
  auto px1 = PxValue(10.0);
  auto px2 = PxValue(20.0);

  EXPECT_EQ(LeftExp("width", LtCmp(px1)), LeftExp("width", LtCmp(px1)));

  EXPECT_NE(LeftExp("width", LtCmp(px1)), LeftExp("height", LtCmp(px1)));
  EXPECT_NE(LeftExp("width", LtCmp(px2)), LeftExp("width", LtCmp(px1)));
  EXPECT_NE(LeftExp("width", LtCmp(px1)), RightExp("width", LtCmp(px1)));
  EXPECT_NE(LeftExp("width", LtCmp(px1)), LeftExp("width", GtCmp(px1)));
}

TEST(MediaQueryExpTest, Serialize) {
  // Boolean feature:
  EXPECT_EQ("color", RightExp("color", NoCmp(InvalidValue())).Serialize());

  auto px = PxValue(10.0);

  // Plain feature:
  EXPECT_EQ("width: 10px", RightExp("width", NoCmp(px)).Serialize());

  // Ranges:
  EXPECT_EQ("width = 10px", RightExp("width", EqCmp(px)).Serialize());
  EXPECT_EQ("width < 10px", RightExp("width", LtCmp(px)).Serialize());
  EXPECT_EQ("width <= 10px", RightExp("width", LeCmp(px)).Serialize());
  EXPECT_EQ("width > 10px", RightExp("width", GtCmp(px)).Serialize());
  EXPECT_EQ("width >= 10px", RightExp("width", GeCmp(px)).Serialize());

  EXPECT_EQ("10px = width", LeftExp("width", EqCmp(px)).Serialize());
  EXPECT_EQ("10px < width", LeftExp("width", LtCmp(px)).Serialize());
  EXPECT_EQ("10px <= width", LeftExp("width", LeCmp(px)).Serialize());
  EXPECT_EQ("10px > width", LeftExp("width", GtCmp(px)).Serialize());
  EXPECT_EQ("10px >= width", LeftExp("width", GeCmp(px)).Serialize());

  EXPECT_EQ(
      "10px < width < 20px",
      PairExp("width", LtCmp(PxValue(10.0)), LtCmp(PxValue(20.0))).Serialize());
  EXPECT_EQ(
      "20px > width > 10px",
      PairExp("width", GtCmp(PxValue(20.0)), GtCmp(PxValue(10.0))).Serialize());
  EXPECT_EQ(
      "10px <= width <= 20px",
      PairExp("width", LeCmp(PxValue(10.0)), LeCmp(PxValue(20.0))).Serialize());
  EXPECT_EQ(
      "20px > width >= 10px",
      PairExp("width", GtCmp(PxValue(20.0)), GeCmp(PxValue(10.0))).Serialize());
}

TEST(MediaQueryExpTest, Copy) {
  // width < 10px
  MediaQueryExp width_lt10 = RightExp("width", LtCmp(PxValue(10)));
  // height < 10px
  MediaQueryExp height_lt10 = RightExp("height", LtCmp(PxValue(10)));

  Vector<std::unique_ptr<MediaQueryExpNode>> nodes;
  nodes.push_back(FeatureNode(width_lt10));
  nodes.push_back(EnclosedFeatureNode(width_lt10));
  nodes.push_back(NotNode(EnclosedFeatureNode(width_lt10)));
  nodes.push_back(NestedNode(EnclosedFeatureNode(width_lt10)));
  nodes.push_back(AndNode(EnclosedFeatureNode(width_lt10),
                          EnclosedFeatureNode(height_lt10)));
  nodes.push_back(OrNode(EnclosedFeatureNode(width_lt10),
                         EnclosedFeatureNode(height_lt10)));
  nodes.push_back(UnknownNode("foo(1)"));

  for (const auto& node : nodes) {
    EXPECT_EQ(node->GetType(), node->Copy()->GetType());
    EXPECT_EQ(node->Serialize(), node->Copy()->Serialize());
  }
}

TEST(MediaQueryExpTest, SerializeNode) {
  EXPECT_EQ("width < 10px",
            FeatureNode(RightExp("width", LtCmp(PxValue(10))))->Serialize());

  EXPECT_EQ(
      "(width < 10px)",
      EnclosedFeatureNode(RightExp("width", LtCmp(PxValue(10))))->Serialize());

  EXPECT_EQ(
      "(width < 10px) and (11px >= thing) and (height = 12px)",
      AndNode(
          EnclosedFeatureNode(RightExp("width", LtCmp(PxValue(10)))),
          AndNode(EnclosedFeatureNode(LeftExp("thing", GeCmp(PxValue(11)))),
                  EnclosedFeatureNode(RightExp("height", EqCmp(PxValue(12))))))
          ->Serialize());

  // Same as previous, but with 'or' instead:
  EXPECT_EQ(
      "(width < 10px) or (11px >= thing) or (height = 12px)",
      OrNode(
          EnclosedFeatureNode(RightExp("width", LtCmp(PxValue(10)))),
          OrNode(EnclosedFeatureNode(LeftExp("thing", GeCmp(PxValue(11)))),
                 EnclosedFeatureNode(RightExp("height", EqCmp(PxValue(12))))))
          ->Serialize());

  EXPECT_EQ("not (width < 10px)",
            NotNode(EnclosedFeatureNode(RightExp("width", LtCmp(PxValue(10)))))
                ->Serialize());

  EXPECT_EQ(
      "((width < 10px))",
      NestedNode(EnclosedFeatureNode(RightExp("width", LtCmp(PxValue(10)))))
          ->Serialize());
  EXPECT_EQ("(((width < 10px)))",
            NestedNode(NestedNode(EnclosedFeatureNode(
                           RightExp("width", LtCmp(PxValue(10))))))
                ->Serialize());

  EXPECT_EQ(
      "not ((11px >= thing) and (height = 12px))",
      NotNode(NestedNode(AndNode(
                  EnclosedFeatureNode(LeftExp("thing", GeCmp(PxValue(11)))),
                  EnclosedFeatureNode(RightExp("height", EqCmp(PxValue(12)))))))
          ->Serialize());
}

TEST(MediaQueryExpTest, CollectExpressions) {
  MediaQueryExp width_lt10 = RightExp("width", LtCmp(PxValue(10)));
  MediaQueryExp height_lt10 = RightExp("height", LtCmp(PxValue(10)));

  // (width < 10px)
  {
    Vector<MediaQueryExp> expressions;
    EnclosedFeatureNode(width_lt10)->CollectExpressions(expressions);
    ASSERT_EQ(1u, expressions.size());
    EXPECT_EQ(width_lt10, expressions[0]);
  }

  // (width < 10px) and (height < 10px)
  {
    Vector<MediaQueryExp> expressions;
    AndNode(EnclosedFeatureNode(width_lt10), EnclosedFeatureNode(height_lt10))
        ->CollectExpressions(expressions);
    ASSERT_EQ(2u, expressions.size());
    EXPECT_EQ(width_lt10, expressions[0]);
    EXPECT_EQ(height_lt10, expressions[1]);
  }

  // (width < 10px) or (height < 10px)
  {
    Vector<MediaQueryExp> expressions;
    OrNode(EnclosedFeatureNode(width_lt10), EnclosedFeatureNode(height_lt10))
        ->CollectExpressions(expressions);
    ASSERT_EQ(2u, expressions.size());
    EXPECT_EQ(width_lt10, expressions[0]);
    EXPECT_EQ(height_lt10, expressions[1]);
  }

  // ((width < 10px))
  {
    Vector<MediaQueryExp> expressions;
    NestedNode(EnclosedFeatureNode(width_lt10))
        ->CollectExpressions(expressions);
    ASSERT_EQ(1u, expressions.size());
    EXPECT_EQ(width_lt10, expressions[0]);
  }

  // not (width < 10px)
  {
    Vector<MediaQueryExp> expressions;
    NotNode(EnclosedFeatureNode(width_lt10))->CollectExpressions(expressions);
    ASSERT_EQ(1u, expressions.size());
    EXPECT_EQ(width_lt10, expressions[0]);
  }

  // unknown
  {
    Vector<MediaQueryExp> expressions;
    UnknownNode("foo")->CollectExpressions(expressions);
    EXPECT_EQ(0u, expressions.size());
  }
}

TEST(MediaQueryExpTest, UnitFlags) {
  // width < 10px
  EXPECT_EQ(MediaQueryExpValue::UnitFlags::kNone,
            RightExp("width", LtCmp(PxValue(10.0))).GetUnitFlags());
  // width < 10em
  EXPECT_EQ(MediaQueryExpValue::UnitFlags::kFontRelative,
            RightExp("width", LtCmp(EmValue(10.0))).GetUnitFlags());
  // width < 10rem
  EXPECT_EQ(MediaQueryExpValue::UnitFlags::kRootFontRelative,
            RightExp("width", LtCmp(RemValue(10.0))).GetUnitFlags());
  // 10px < width
  EXPECT_EQ(MediaQueryExpValue::UnitFlags::kNone,
            LeftExp("width", LtCmp(PxValue(10.0))).GetUnitFlags());
  // 10em <  width
  EXPECT_EQ(MediaQueryExpValue::UnitFlags::kFontRelative,
            LeftExp("width", LtCmp(EmValue(10.0))).GetUnitFlags());
  // 10rem < width
  EXPECT_EQ(MediaQueryExpValue::UnitFlags::kRootFontRelative,
            LeftExp("width", LtCmp(RemValue(10.0))).GetUnitFlags());
}

TEST(MediaQueryExpTest, UtilsNullptrHandling) {
  MediaQueryExp exp = RightExp("width", LtCmp(PxValue(10)));

  EXPECT_FALSE(MediaQueryExpNode::Nested(nullptr));
  EXPECT_FALSE(MediaQueryExpNode::Function(nullptr, "test"));
  EXPECT_FALSE(MediaQueryExpNode::Not(nullptr));
  EXPECT_FALSE(MediaQueryExpNode::And(nullptr, FeatureNode(exp)));
  EXPECT_FALSE(MediaQueryExpNode::And(FeatureNode(exp), nullptr));
  EXPECT_FALSE(MediaQueryExpNode::And(nullptr, nullptr));
  EXPECT_FALSE(MediaQueryExpNode::Or(nullptr, FeatureNode(exp)));
  EXPECT_FALSE(MediaQueryExpNode::Or(FeatureNode(exp), nullptr));
  EXPECT_FALSE(MediaQueryExpNode::Or(nullptr, nullptr));
}

}  // namespace blink


text:
using ::testing::_;
using ::testing::Assign;
using ::testing::AtLeast;
using ::testing::DeleteArg;
using ::testing::DoAll;
using ::testing::InSequence;
using ::testing::Invoke;
using ::testing::InvokeWithoutArgs;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SetArgumentPointee;
using ::testing::StrictMock;
using ::testing::NiceMock;
using ::testing::WithArgs;

using WebKit::WebURLError;
using WebKit::WebFrameClient;
using WebKit::WebURLResponse;
using WebKit::WebView;

namespace webkit_glue {

static const char* kHttpUrl = "http://test";
static const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing";
static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2";
static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2";
static const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing";

static const int kDataSize = 1024;
static const int kHttpOK = 200;
static const int kHttpPartialContent = 206;

enum NetworkState {
  NONE,
  LOADED,
  LOADING
};

// Submit a request completed event to the resource loader due to request
// being canceled. Pretending the event is from external.
ACTION_P(RequestCanceled, loader) {
  WebURLError error;
  error.reason = net::ERR_ABORTED;
  error.domain = WebString::fromUTF8(net::kErrorDomain);
  loader->didFail(NULL, error);
}

class BufferedResourceLoaderTest : public testing::Test {
 public:
  BufferedResourceLoaderTest() {
    for (int i = 0; i < kDataSize; ++i)
      data_[i] = i;
  }

  virtual ~BufferedResourceLoaderTest() {
  }

  void Initialize(const char* url, int first_position, int last_position) {
    gurl_ = GURL(url);
    first_position_ = first_position;
    last_position_ = last_position;

    frame_.reset(new NiceMock<MockWebFrame>());

    url_loader_ = new NiceMock<MockWebURLLoader>();
    loader_ = new BufferedResourceLoader(gurl_,
                                         first_position_, last_position_);
    loader_->SetURLLoaderForTest(url_loader_);
  }

  void SetLoaderBuffer(size_t forward_capacity, size_t backward_capacity) {
    loader_->buffer_.reset(
        new media::SeekableBuffer(backward_capacity, forward_capacity));
  }

  void Start() {
    InSequence s;
    EXPECT_CALL(*url_loader_, loadAsynchronously(_, loader_.get()));
    loader_->Start(
        NewCallback(this, &BufferedResourceLoaderTest::StartCallback),
        NewCallback(this, &BufferedResourceLoaderTest::NetworkCallback),
        frame_.get());
  }

  void FullResponse(int64 instance_size) {
    FullResponse(instance_size, net::OK);
  }

  void FullResponse(int64 instance_size, int status) {
    EXPECT_CALL(*this, StartCallback(status));
    if (status != net::OK) {
      EXPECT_CALL(*url_loader_, cancel())
          .WillOnce(RequestCanceled(loader_));
    }

    WebURLResponse response(gurl_);
    response.setHTTPHeaderField(WebString::fromUTF8("Content-Length"),
                                WebString::fromUTF8(base::StringPrintf("%"
                                    PRId64, instance_size)));
    response.setExpectedContentLength(instance_size);
    response.setHTTPStatusCode(kHttpOK);
    loader_->didReceiveResponse(url_loader_, response);

    if (status == net::OK) {
      EXPECT_EQ(instance_size, loader_->content_length());
      EXPECT_EQ(instance_size, loader_->instance_size());
    }

    EXPECT_FALSE(loader_->range_supported());
  }

  void PartialResponse(int64 first_position, int64 last_position,
                       int64 instance_size) {
    PartialResponse(first_position, last_position, instance_size, false, true);
  }

  void PartialResponse(int64 first_position, int64 last_position,
                       int64 instance_size, bool chunked, bool accept_ranges) {
    EXPECT_CALL(*this, StartCallback(net::OK));

    WebURLResponse response(gurl_);
    response.setHTTPHeaderField(WebString::fromUTF8("Content-Range"),
                                WebString::fromUTF8(base::StringPrintf("bytes "
                                            "%" PRId64 "-%" PRId64 "/%" PRId64,
                                            first_position,
                                            last_position,
                                            instance_size)));

    // HTTP 1.1 doesn't permit Content-Length with Transfer-Encoding: chunked.
    int64 content_length = -1;
    if (chunked) {
      response.setHTTPHeaderField(WebString::fromUTF8("Transfer-Encoding"),
                                  WebString::fromUTF8("chunked"));
    } else {
      content_length = last_position - first_position + 1;
    }
    response.setExpectedContentLength(content_length);

    // A server isn't required to return Accept-Ranges even though it might.
    if (accept_ranges) {
      response.setHTTPHeaderField(WebString::fromUTF8("Accept-Ranges"),
                                  WebString::fromUTF8("bytes"));
    }

    response.setHTTPStatusCode(kHttpPartialContent);
    loader_->didReceiveResponse(url_loader_, response);

    // XXX: what's the difference between these two? For example in the chunked
    // range request case, Content-Length is unspecified (because it's chunked)
    // but Content-Range: a-b/c can be returned, where c == Content-Length
    //
    // Can we eliminate one?
    EXPECT_EQ(content_length, loader_->content_length());
    EXPECT_EQ(instance_size, loader_->instance_size());

    // A valid partial response should always result in this being true.
    EXPECT_TRUE(loader_->range_supported());
  }

  void Redirect(const char* url) {
    GURL redirectUrl(url);
    WebKit::WebURLRequest newRequest(redirectUrl);
    WebKit::WebURLResponse redirectResponse(gurl_);

    loader_->willSendRequest(url_loader_, newRequest, redirectResponse);

    MessageLoop::current()->RunAllPending();
  }

  void StopWhenLoad() {
    InSequence s;
    EXPECT_CALL(*url_loader_, cancel())
        .WillOnce(RequestCanceled(loader_));
    loader_->Stop();
    loader_ = NULL;
  }

  // Helper method to write to |loader_| from |data_|.
  void WriteLoader(int position, int size) {
    EXPECT_CALL(*this, NetworkCallback())
        .RetiresOnSaturation();
    loader_->didReceiveData(url_loader_,
                            reinterpret_cast<char*>(data_ + position),
                            size,
                            size);
  }

  // Helper method to read from |loader_|.
  void ReadLoader(int64 position, int size, uint8* buffer) {
    loader_->Read(position, size, buffer,
                  NewCallback(this, &BufferedResourceLoaderTest::ReadCallback));
  }

  // Verifis that data in buffer[0...size] is equal to data_[pos...pos+size].
  void VerifyBuffer(uint8* buffer, int pos, int size) {
    EXPECT_EQ(0, memcmp(buffer, data_ + pos, size));
  }

  void ConfirmLoaderDeferredState(bool expectedVal) {
    EXPECT_EQ(loader_->deferred_, expectedVal);
  }

  MOCK_METHOD1(StartCallback, void(int error));
  MOCK_METHOD1(ReadCallback, void(int error));
  MOCK_METHOD0(NetworkCallback, void());

 protected:
  GURL gurl_;
  int64 first_position_;
  int64 last_position_;

  scoped_refptr<BufferedResourceLoader> loader_;
  NiceMock<MockWebURLLoader>* url_loader_;
  scoped_ptr<NiceMock<MockWebFrame> > frame_;

  uint8 data_[kDataSize];

 private:
  DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoaderTest);
};

TEST_F(BufferedResourceLoaderTest, StartStop) {
  Initialize(kHttpUrl, -1, -1);
  Start();
  StopWhenLoad();
}

// Tests that a bad HTTP response is recived, e.g. file not found.
TEST_F(BufferedResourceLoaderTest, BadHttpResponse) {
  Initialize(kHttpUrl, -1, -1);
  Start();

  EXPECT_CALL(*this, StartCallback(net::ERR_FAILED));
  EXPECT_CALL(*url_loader_, cancel())
      .WillOnce(RequestCanceled(loader_));

  WebURLResponse response(gurl_);
  response.setHTTPStatusCode(404);
  response.setHTTPStatusText("Not Found\n");
  loader_->didReceiveResponse(url_loader_, response);
}

// Tests that partial content is requested but not fulfilled.
TEST_F(BufferedResourceLoaderTest, NotPartialResponse) {
  Initialize(kHttpUrl, 100, -1);
  Start();
  FullResponse(1024, net::ERR_INVALID_RESPONSE);
}

// Tests that a 200 response is received.
TEST_F(BufferedResourceLoaderTest, FullResponse) {
  Initialize(kHttpUrl, -1, -1);
  Start();
  FullResponse(1024);
  StopWhenLoad();
}

// Tests that a partial content response is received.
TEST_F(BufferedResourceLoaderTest, PartialResponse) {
  Initialize(kHttpUrl, 100, 200);
  Start();
  PartialResponse(100, 200, 1024);
  StopWhenLoad();
}

TEST_F(BufferedResourceLoaderTest, PartialResponse_Chunked) {
  Initialize(kHttpUrl, 100, 200);
  Start();
  PartialResponse(100, 200, 1024, true, true);
  StopWhenLoad();
}

TEST_F(BufferedResourceLoaderTest, PartialResponse_NoAcceptRanges) {
  Initialize(kHttpUrl, 100, 200);
  Start();
  PartialResponse(100, 200, 1024, false, false);
  StopWhenLoad();
}

TEST_F(BufferedResourceLoaderTest, PartialResponse_ChunkedNoAcceptRanges) {
  Initialize(kHttpUrl, 100, 200);
  Start();
  PartialResponse(100, 200, 1024, true, false);
  StopWhenLoad();
}

// Tests that an invalid partial response is received.
TEST_F(BufferedResourceLoaderTest, InvalidPartialResponse) {
  Initialize(kHttpUrl, 0, 10);
  Start();

  EXPECT_CALL(*this, StartCallback(net::ERR_INVALID_RESPONSE));
  EXPECT_CALL(*url_loader_, cancel())
      .WillOnce(RequestCanceled(loader_));

  WebURLResponse response(gurl_);
  response.setHTTPHeaderField(WebString::fromUTF8("Content-Range"),
                              WebString::fromUTF8(base::StringPrintf("bytes "
                                  "%d-%d/%d", 1, 10, 1024)));
  response.setExpectedContentLength(10);
  response.setHTTPStatusCode(kHttpPartialContent);
  loader_->didReceiveResponse(url_loader_, response);
}

// Tests the logic of sliding window for data buffering and reading.
TEST_F(BufferedResourceLoaderTest, BufferAndRead) {
  Initialize(kHttpUrl, 10, 29);
  loader_->UpdateDeferStrategy(BufferedResourceLoader::kThresholdDefer);
  Start();
  PartialResponse(10, 29, 30);

  uint8 buffer[10];
  InSequence s;

  // Writes 10 bytes and read them back.
  WriteLoader(10, 10);
  EXPECT_CALL(*this, ReadCallback(10));
  ReadLoader(10, 10, buffer);
  VerifyBuffer(buffer, 10, 10);

  // Writes 10 bytes and read 2 times.
  WriteLoader(20, 10);
  EXPECT_CALL(*this, ReadCallback(5));
  ReadLoader(20, 5, buffer);
  VerifyBuffer(buffer, 20, 5);
  EXPECT_CALL(*this, ReadCallback(5));
  ReadLoader(25, 5, buffer);
  VerifyBuffer(buffer, 25, 5);

  // Read backward within buffer.
  EXPECT_CALL(*this, ReadCallback(10));
  ReadLoader(10, 10, buffer);
  VerifyBuffer(buffer, 10, 10);

  // Read backward outside buffer.
  EXPECT_CALL(*this, ReadCallback(net::ERR_CACHE_MISS));
  ReadLoader(9, 10, buffer);

  // Response has completed.
  EXPECT_CALL(*this, NetworkCallback());
  loader_->didFinishLoading(url_loader_, 0);

  // Try to read 10 from position 25 will just return with 5 bytes.
  EXPECT_CALL(*this, ReadCallback(5));
  ReadLoader(25, 10, buffer);
  VerifyBuffer(buffer, 25, 5);

  // Try to read outside buffered range after request has completed.
  EXPECT_CALL(*this, ReadCallback(net::ERR_CACHE_MISS));
  ReadLoader(5, 10, buffer);

  // Try to read beyond the instance size.
  EXPECT_CALL(*this, ReadCallback(0));
  ReadLoader(30, 10, buffer);
}

TEST_F(BufferedResourceLoaderTest, ReadOutsideBuffer) {
  Initialize(kHttpUrl, 10, 0x00FFFFFF);
  loader_->UpdateDeferStrategy(BufferedResourceLoader::kThresholdDefer);
  Start();
  PartialResponse(10, 0x00FFFFFF, 0x01000000);

  uint8 buffer[10];
  InSequence s;

  // Read very far aheard will get a cache miss.
  EXPECT_CALL(*this, ReadCallback(net::ERR_CACHE_MISS));
  ReadLoader(0x00FFFFFF, 1, buffer);

  // The following call will not call ReadCallback() because it is waiting for
  // data to arrive.
  ReadLoader(10, 10, buffer);

  // Writing to loader will fulfill the read request.
  EXPECT_CALL(*this, ReadCallback(10));
  WriteLoader(10, 20);
  VerifyBuffer(buffer, 10, 10);

  // The following call cannot be fulfilled now.
  ReadLoader(25, 10, buffer);

  EXPECT_CALL(*this, ReadCallback(5));
  EXPECT_CALL(*this, NetworkCallback());
  loader_->didFinishLoading(url_loader_, 0);
}

TEST_F(BufferedResourceLoaderTest, RequestFailedWhenRead) {
  Initialize(kHttpUrl, 10, 29);
  Start();
  PartialResponse(10, 29, 30);

  uint8 buffer[10];
  InSequence s;

  ReadLoader(10, 10, buffer);
  EXPECT_CALL(*this, ReadCallback(net::ERR_FAILED));
  EXPECT_CALL(*this, NetworkCallback());
  WebURLError error;
  error.reason = net::ERR_FAILED;
  loader_->didFail(url_loader_, error);
}

// Tests the data buffering logic of NeverDefer strategy.
TEST_F(BufferedResourceLoaderTest, NeverDeferStrategy) {
  Initialize(kHttpUrl, 10, 99);
  SetLoaderBuffer(10, 20);
  loader_->UpdateDeferStrategy(BufferedResourceLoader::kNeverDefer);
  Start();
  PartialResponse(10, 99, 100);

  uint8 buffer[10];

  // Read past the buffer size; should not defer regardless.
  WriteLoader(10, 10);
  WriteLoader(20, 50);
  ConfirmLoaderDeferredState(false);

  // Should move past window.
  EXPECT_CALL(*this, ReadCallback(net::ERR_CACHE_MISS));
  ReadLoader(10, 10, buffer);

  StopWhenLoad();
}

// Tests the data buffering logic of ReadThenDefer strategy.
TEST_F(BufferedResourceLoaderTest, ReadThenDeferStrategy) {
  Initialize(kHttpUrl, 10, 99);
  SetLoaderBuffer(10, 20);
  loader_->UpdateDeferStrategy(BufferedResourceLoader::kReadThenDefer);
  Start();
  PartialResponse(10, 99, 100);

  uint8 buffer[10];

  // Make an outstanding read request.
  // We should disable deferring after the read request, so expect
  // a network event.
  EXPECT_CALL(*this, NetworkCallback());
  ReadLoader(10, 10, buffer);

  // Receive almost enough data to cover, shouldn't defer.
  WriteLoader(10, 9);
  ConfirmLoaderDeferredState(false);

  // As soon as we have received enough data to fulfill the read, defer.
  EXPECT_CALL(*this, NetworkCallback());
  EXPECT_CALL(*this, ReadCallback(10));
  WriteLoader(19, 1);

  ConfirmLoaderDeferredState(true);
  VerifyBuffer(buffer, 10, 10);

  StopWhenLoad();
}

// Tests the data buffering logic of ThresholdDefer strategy.
TEST_F(BufferedResourceLoaderTest, ThresholdDeferStrategy) {
  Initialize(kHttpUrl, 10, 99);
  SetLoaderBuffer(10, 20);
  loader_->UpdateDeferStrategy(BufferedResourceLoader::kThresholdDefer);
  Start();
  PartialResponse(10, 99, 100);

  uint8 buffer[10];

  WriteLoader(10, 5);
  // Haven't reached threshold, don't defer.
  ConfirmLoaderDeferredState(false);

  // We're at the threshold now, let's defer.
  EXPECT_CALL(*this, NetworkCallback());
  WriteLoader(15, 5);
  ConfirmLoaderDeferredState(true);

  // Now we've read over half of the buffer, disable deferring.
  EXPECT_CALL(*this, ReadCallback(6));
  EXPECT_CALL(*this, NetworkCallback());
  ReadLoader(10, 6, buffer);

  ConfirmLoaderDeferredState(false);
  VerifyBuffer(buffer, 10, 6);

  StopWhenLoad();
}

// NOTE: This test will need to be reworked a little once
// http://code.google.com/p/chromium/issues/detail?id=72578
// is fixed.
TEST_F(BufferedResourceLoaderTest, HasSingleOrigin) {
  // Make sure no redirect case works as expected.
  Initialize(kHttpUrl, -1, -1);
  Start();
  FullResponse(1024);
  EXPECT_TRUE(loader_->HasSingleOrigin());
  StopWhenLoad();

  // Test redirect to the same domain.
  Initialize(kHttpUrl, -1, -1);
  Start();
  Redirect(kHttpRedirectToSameDomainUrl1);
  FullResponse(1024);
  EXPECT_TRUE(loader_->HasSingleOrigin());
  StopWhenLoad();

  // Test redirect twice to the same domain.
  Initialize(kHttpUrl, -1, -1);
  Start();
  Redirect(kHttpRedirectToSameDomainUrl1);
  Redirect(kHttpRedirectToSameDomainUrl2);
  FullResponse(1024);
  EXPECT_TRUE(loader_->HasSingleOrigin());
  StopWhenLoad();

  // Test redirect to a different domain.
  Initialize(kHttpUrl, -1, -1);
  Start();
  Redirect(kHttpRedirectToDifferentDomainUrl1);
  EXPECT_FALSE(loader_->HasSingleOrigin());
  StopWhenLoad();

  // Test redirect to the same domain and then to a different domain.
  Initialize(kHttpUrl, -1, -1);
  Start();
  Redirect(kHttpRedirectToSameDomainUrl1);
  Redirect(kHttpRedirectToDifferentDomainUrl1);
  EXPECT_FALSE(loader_->HasSingleOrigin());
  StopWhenLoad();
}

// TODO(hclam): add unit test for defer loading.

}  // namespace webkit_glue


text:
\c dsp_db1

show gp_default_storage_options;

SET gp_default_storage_options="appendonly=true,checksum=true";
show gp_default_storage_options;

-- Table with no options
Drop table if exists  ao_ss_ck_t1;
Create table  ao_ss_ck_t1 ( i int, j int);

Insert into  ao_ss_ck_t1 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t1;

\d+  ao_ss_ck_t1;

select relkind, relstorage, reloptions from pg_class where relname='ao_ss_ck_t1';
select compresslevel, compresstype, blocksize, checksum, columnstore from pg_appendonly where relid = (select oid from pg_class where relname='ao_ss_ck_t1');

Drop table  ao_ss_ck_t1;

-- Create table with checksum=true

Drop table if exists  ao_ss_ck_t2;
Create table  ao_ss_ck_t2 ( i int, j int) with(checksum=true);

Insert into  ao_ss_ck_t2 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t2;

\d+  ao_ss_ck_t2;

select relkind, relstorage, reloptions from pg_class where relname='ao_ss_ck_t2';
select compresslevel, compresstype, blocksize, checksum, columnstore from pg_appendonly where relid = (select oid from pg_class where relname='ao_ss_ck_t2');

Drop table  ao_ss_ck_t2;

-- Create table with checksum=false

Drop table if exists  ao_ss_ck_t3;
Create table  ao_ss_ck_t3 ( i int, j int) with(checksum=false);

Insert into  ao_ss_ck_t3 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t3;

\d+  ao_ss_ck_t3;

select relkind, relstorage, reloptions from pg_class where relname='ao_ss_ck_t3';
select compresslevel, compresstype, blocksize, checksum, columnstore from pg_appendonly where relid = (select oid from pg_class where relname='ao_ss_ck_t3');

Drop table  ao_ss_ck_t3;

-- Create table with invalid value for checksum

Drop table if exists  ao_ss_ck_t4;
Create table  ao_ss_ck_t4 ( i int, j int) with(checksum=xxxx);

-- Create a table with appendonly=false

Drop table if exists  ao_ss_ck_t5;
Create table  ao_ss_ck_t5 ( i int, j int) with(appendonly=false);

Insert into  ao_ss_ck_t5 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t5;

\d+  ao_ss_ck_t5;

select relstorage,reloptions from pg_class where relname='ao_ss_ck_t5';

Drop table  ao_ss_ck_t5;

-- Create CO table with checksum true, Alter to add a column with encoding
Drop table if exists  ao_ss_ck_t6;
Create table  ao_ss_ck_t6 ( i int, j int) with(orientation=column);

Insert into  ao_ss_ck_t6 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t6;

\d+  ao_ss_ck_t6;
select relkind, relstorage, reloptions from pg_class where relname='ao_ss_ck_t6';
select compresslevel, compresstype, blocksize, checksum, columnstore from pg_appendonly where relid = (select oid from pg_class where relname='ao_ss_ck_t6');

Alter table ao_ss_ck_t6 add column k int default 2 encoding(compresstype=quicklz,blocksize=8192);

select attnum, attoptions from pg_attribute_encoding where attrelid='ao_ss_ck_t6'::regclass order by attnum;

Drop table ao_ss_ck_t6;

Drop table if exists ao_ss_ck_t7;
Create table ao_ss_ck_t7 (
   a int encoding (compresstype=zlib,compresslevel=2), b float,c varchar encoding(blocksize=8192),d bigint
) with (appendonly=true, orientation=column, checksum=false) distributed by (a);

Insert into ao_ss_ck_t7 values(1, 2.0, 'varchar', 21);

select attnum, attoptions from pg_attribute_encoding where attrelid='ao_ss_ck_t7'::regclass order by attnum;

Drop table ao_ss_ck_t7;
-- ========================================
-- Set the session level guc to false

SET gp_default_storage_options="appendonly=true,checksum=false";

show gp_default_storage_options;

-- Table with no options
Drop table if exists  ao_ss_ck_t1;
Create table  ao_ss_ck_t1 ( i int, j int);

Insert into  ao_ss_ck_t1 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t1;

\d+  ao_ss_ck_t1;

select relkind, relstorage, reloptions from pg_class where relname='ao_ss_ck_t1';
select compresslevel, compresstype, blocksize, checksum, columnstore from pg_appendonly where relid = (select oid from pg_class where relname='ao_ss_ck_t1');

Drop table  ao_ss_ck_t1;

-- Create table with checksum=true

Drop table if exists  ao_ss_ck_t2;
Create table  ao_ss_ck_t2 ( i int, j int) with(checksum=true);

Insert into  ao_ss_ck_t2 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t2;

\d+  ao_ss_ck_t2;

select relkind, relstorage, reloptions from pg_class where relname='ao_ss_ck_t2';
select compresslevel, compresstype, blocksize, checksum, columnstore from pg_appendonly where relid = (select oid from pg_class where relname='ao_ss_ck_t2');

Drop table  ao_ss_ck_t2;

-- Create table with checksum=false

Drop table if exists  ao_ss_ck_t3;
Create table  ao_ss_ck_t3 ( i int, j int) with(checksum=false);

Insert into  ao_ss_ck_t3 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t3;

\d+  ao_ss_ck_t3;

select relstorage, reloptions,checksum from pg_class c , pg_appendonly a where c.oid=a.relid and c.relname='ao_ss_ck_t3';

Drop table  ao_ss_ck_t3;

-- Create table with invalid value for checksum

Drop table if exists  ao_ss_ck_t4;
Create table  ao_ss_ck_t4 ( i int, j int) with(checksum=xxxx);

-- Create table with appendonly=false
Drop table if exists ao_ss_ck_t5;
Create table ao_ss_ck_t5( i int, j int) with(appendonly=false);

select relstorage, reloptions from pg_class where relname='ao_ss_ck_t5';

Drop table  ao_ss_ck_t5;

-- Create CO table with checksum false, Alter to add a column with encoding
Drop table if exists  ao_ss_ck_t6;
Create table  ao_ss_ck_t6 ( i int, j int) with(orientation=column);

Insert into  ao_ss_ck_t6 select i, i+1 from generate_series(1,10) i;
Select count(*) from  ao_ss_ck_t6;

\d+  ao_ss_ck_t6;
select relstorage, reloptions,checksum from pg_class c , pg_appendonly a where c.oid=a.relid and c.relname='ao_ss_ck_t6';

Alter table ao_ss_ck_t6 add column k int default 2 encoding(compresstype=quicklz,blocksize=8192);

select attnum, attoptions from pg_attribute_encoding where attrelid='ao_ss_ck_t6'::regclass order by attnum;

Drop table ao_ss_ck_t6;

--- =====================================
-- GUC with invalid value
SET gp_default_storage_options="appendonly=true,checksum=xxx";

-- GUC without appedonly=true specified
SET gp_default_storage_options="checksum=true";

show gp_default_storage_options;

-- With no option it will a heap table
Drop table if exists ao_ss_ck_t1;
Create table ao_ss_ck_t1( i int, j int);

Insert into ao_ss_ck_t1 select i, i+1 from generate_series(1,10) i;
Select count(*) from ao_ss_ck_t1;

\d+ ao_ss_ck_t1;

select relkind, relstorage,reloptions from pg_class where relname='ao_ss_ck_t1';

Drop table ao_ss_ck_t1;
-- with appendonly=true specified the table will be created as AO table with checksum=true

Drop table if exists ao_ss_ck_t2;
Create table ao_ss_ck_t2( i int, j int) with(appendonly=true);
Insert into ao_ss_ck_t2 select i, i+1 from generate_series(1,10) i;
Select count(*) from ao_ss_ck_t2;

\d+ ao_ss_ck_t2;

select relkind, relstorage,reloptions from pg_class where relname='ao_ss_ck_t2';

Drop table ao_ss_ck_t2;

-- GUC with appendonly=false
SET gp_default_storage_options="appendonly=false";

show gp_default_storage_options;

Drop table if exists  ao_ss_ck_t5;
Create table  ao_ss_ck_t5 ( i int, j int) with(checksum=true);

-- Reset guc to default value

RESET gp_default_storage_options;
show gp_default_storage_options;


text:
namespace SimpleUI {

LRESULT CALLBACK Window::WindowRoutingProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	Window* window = (Window*)::GetWindowLongPtr(hwnd, GWL_USERDATA);
	LRESULT result;
	bool processed = false;
	if (window) {
		typedef Window::MessageMapType::iterator iter_type;
		std::pair<iter_type, iter_type> range = window->route_map_.equal_range(uMsg);
		iter_type iter;
		for (iter = range.first; iter != range.second && !processed; ++iter) {
			if (iter->second) {
				processed = iter->second(window, uMsg, wParam, lParam, &result);
			}
		}
	}
	return processed ? result : CallWindowProc(window->orginal_wndproc(), hwnd, uMsg, wParam, lParam);
}

void Window::AddMessageHandler(UINT msg, WindowMessageHandlerType handler) {
	if (!this->orginal_wndproc_) {
		//×ÓÀ໯
		this->orginal_wndproc_ = (WNDPROC)this->GetWindowLongPtr(GWL_WNDPROC);
		this->SetWindowLongPtr(GWL_USERDATA, (LONG_PTR)this);
		this->SetWindowLongPtr(GWL_WNDPROC, (LONG_PTR)WindowRoutingProc);
	}
	this->route_map_.insert(std::pair<UINT, WindowMessageHandlerType>(msg, handler));
}

bool Window::GetClientCursorPos(LPPOINT lpPoint) {
	return GetCursorPos(lpPoint) == TRUE &&	ScreenToClient(this->handle(), lpPoint) == TRUE;
}

bool Window::IsCursorOver() {
	RECT rect;
	POINT pt;
	this->GetClientCursorPos(&pt);
	this->GetClientRect(&rect);
	return PtInRect(&rect, pt) == TRUE;
}

HWND Window::GetVisibleChildWindowFromPoint(LPPOINT lpPoint) {
	return this->ChildWindowFromPointEx(*lpPoint, CWP_SKIPINVISIBLE);
}

Window::Window(HWND handle) {
	WindowManager::GetInstance()->Add(this);
	InitializeCriticalSectionAndSpinCount(&(this->critical_section_), 0x00000400);

	this->orginal_wndproc_ = NULL; //Ö®ËùÒÔ²»Ö±½Ó»ñÈ¡ÊÇÒòΪ²ÎÊýÓпÉÄÜÊÇNULL
	this->handle_ = handle;
	this->parent_ = NULL;
	this->text_buffer_ = NULL;
}

Window::~Window() {
	if (this->text_buffer_) {
		delete [] this->text_buffer_;
		this->text_buffer_ = NULL;
	}
	DeleteCriticalSection(&(this->critical_section_));
	WindowManager::GetInstance()->Remove(this);
}

} //namespace


text:
require 'uri'

module Typhoeus
  class Request
    ACCESSOR_OPTIONS = [
      :method,
      :params,
      :body,
      :headers,
      :connect_timeout,
      :timeout,
      :user_agent,
      :response,
      :cache_timeout,
      :follow_location,
      :max_redirects,
      :proxy,
      :proxy_username,
      :proxy_password,
      :disable_ssl_peer_verification,
      :disable_ssl_host_verification,
      :interface,
      :ssl_cert,
      :ssl_cert_type,
      :ssl_key,
      :ssl_key_type,
      :ssl_key_password,
      :ssl_cacert,
      :ssl_capath,
      :ssl_version,
      :verbose,
      :username,
      :password,
      :auth_method,
      :user_agent,
      :proxy_auth_method,
      :proxy_type
    ]

    attr_reader   :url
    attr_accessor *ACCESSOR_OPTIONS

    # Initialize a new Request
    #
    # Options:
    # * +url+ : Endpoint (URL) of the request
    # * +options+   : A hash containing options among :
    # ** +:method+  : :get (default) / :post / :put
    # ** +:params+  : params as a Hash
    # ** +:body+
    # ** +:timeout+ : timeout (ms)
    # ** +:interface+ : interface or ip address (string)
    # ** +:connect_timeout+ : connect timeout (ms)
    # ** +:headers+  : headers as Hash
    # ** +:cache_timeout+ : cache timeout (ms)
    # ** +:follow_location
    # ** +:max_redirects
    # ** +:proxy
    # ** +:disable_ssl_peer_verification
    # ** +:disable_ssl_host_verification
    # ** +:ssl_cert
    # ** +:ssl_cert_type
    # ** +:ssl_key
    # ** +:ssl_key_type
    # ** +:ssl_key_password
    # ** +:ssl_cacert
    # ** +:ssl_capath
    # ** +:verbose
    # ** +:username
    # ** +:password
    # ** +:auth_method
    # ** +:user_agent+ : user agent (string) - DEPRECATED
    #
    def initialize(url, options = {})
      @method           = options[:method] || :get
      @params           = options[:params]
      @body             = options[:body]
      @timeout          = safe_to_i(options[:timeout])
      @connect_timeout  = safe_to_i(options[:connect_timeout])
      @interface        = options[:interface]
      @headers          = options[:headers] || {}

      if options.has_key?(:user_agent)
        @headers['User-Agent'] = options[:user_agent]
      end

      @cache_timeout    = safe_to_i(options[:cache_timeout])
      @follow_location  = options[:follow_location]
      @max_redirects    = options[:max_redirects]
      @proxy            = options[:proxy]
      @proxy_type       = options[:proxy_type]
      @proxy_username   = options[:proxy_username]
      @proxy_password   = options[:proxy_password]
      @proxy_auth_method = options[:proxy_auth_method]
      @disable_ssl_peer_verification = options[:disable_ssl_peer_verification]
      @disable_ssl_host_verification = options[:disable_ssl_host_verification]
      @ssl_cert         = options[:ssl_cert]
      @ssl_cert_type    = options[:ssl_cert_type]
      @ssl_key          = options[:ssl_key]
      @ssl_key_type     = options[:ssl_key_type]
      @ssl_key_password = options[:ssl_key_password]
      @ssl_cacert       = options[:ssl_cacert]
      @ssl_capath       = options[:ssl_capath]
      @ssl_version      = options[:ssl_version]
      @verbose          = options[:verbose]
      @username         = options[:username]
      @password         = options[:password]
      @auth_method      = options[:auth_method]

      if @method == :post
        @url = url
      else
        @url = @params ? "#{url}?#{params_string}" : url
      end

      @parsed_uri = URI.parse(@url)

      @on_complete      = nil
      @after_complete   = nil
      @handled_response = nil
    end

    LOCALHOST_ALIASES = %w[ localhost 127.0.0.1 0.0.0.0 ]

    def localhost?
      LOCALHOST_ALIASES.include?(@parsed_uri.host)
    end

    def user_agent
      headers['User-Agent']
    end

    def user_agent=(value)
      $stderr.puts "DEPRECATED: Typhoeus::Request#user_agent=(value). This will be removed in a later version."
      headers['User-Agent'] = value
    end

    def host
      slash_location = @url.index('/', 8)
      if slash_location
        @url.slice(0, slash_location)
      else
        query_string_location = @url.index('?')
        return query_string_location ? @url.slice(0, query_string_location) : @url
      end
    end

    def host_domain
      @parsed_uri.host
    end

    def params_string
      traversal = Typhoeus::Utils.traverse_params_hash(params)
      Typhoeus::Utils.traversal_to_param_string(traversal)
    end

    def on_complete(&block)
      @on_complete = block
    end

    def on_complete=(proc)
      @on_complete = proc
    end

    def after_complete(&block)
      @after_complete = block
    end

    def after_complete=(proc)
      @after_complete = proc
    end

    def call_handlers
      if @on_complete
        @handled_response = @on_complete.call(response)
        call_after_complete
      end
    end

    def call_after_complete
      @after_complete.call(@handled_response) if @after_complete
    end

    def handled_response=(val)
      @handled_response = val
    end

    def handled_response
      @handled_response || response
    end

    def inspect
      result = ":method => #{self.method.inspect},\n" <<
               "\t:url => #{URI.parse(self.url).to_s}"
      if self.body and !self.body.empty?
        result << ",\n\t:body => #{self.body.inspect}"
      end

      if self.params and !self.params.empty?
        result << ",\n\t:params => #{self.params.inspect}"
      end

      if self.headers and !self.headers.empty?
        result << ",\n\t:headers => #{self.headers.inspect}"
      end

      result
    end

    def cache_key
      Digest::SHA1.hexdigest(url)
    end

    def self.run(url, params)
      r = new(url, params)
      Typhoeus::Hydra.hydra.queue r
      Typhoeus::Hydra.hydra.run
      r.response
    end

    def self.get(url, params = {})
      run(url, params.merge(:method => :get))
    end

    def self.post(url, params = {})
      run(url, params.merge(:method => :post))
    end

    def self.put(url, params = {})
      run(url, params.merge(:method => :put))
    end

    def self.delete(url, params = {})
      run(url, params.merge(:method => :delete))
    end

    def self.head(url, params = {})
      run(url, params.merge(:method => :head))
    end

  protected

    # Return the important data needed to serialize this Request, except the
    # `on_complete` and `after_complete` handlers, since they cannot be
    # marshalled.
    def marshal_dump
      (instance_variables - ['@on_complete', '@after_complete', :@on_complete, :@after_complete]).map do |name|
        [name, instance_variable_get(name)]
      end
    end

    def marshal_load(attributes)
      attributes.each { |name, value| instance_variable_set(name, value) }
    end

    def self.options
      ACCESSOR_OPTIONS
    end

  private

    def safe_to_i(value)
      return value if value.is_a?(Fixnum)
      return nil if value.nil?
      return nil if value.respond_to?(:empty?) && value.empty?
      value.to_i
    end
  end
end


text:
import { Directive, ElementRef, Renderer, HostListener } from '@angular/core';

@Directive({ selector: '[numbersOnly]' })
export class NumbersOnlyDirective {

    constructor(el: ElementRef, renderer: Renderer) {
      //
    }

    /** Catch all keypresses and only allow numbers through */
    @HostListener('keypress', ['$event']) onKeyPress(e:any) {
      e = (e) ? e : window.event;
      var charCode = (e.which) ? e.which : e.keyCode;
      if (charCode > 31 && (charCode < 48 || charCode > 57)) {
          return false;
      }
      return true;
    }

    /** Catch all inputs and remove all numbers (to catch pasting data) */
    @HostListener('input', ['$event']) onInput(e:any) {
      let newStr = e.srcElement.value.replace(/([^0-9])/g, '');
      e.srcElement.value = newStr;
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>convert_gempak_color — MetPy 0.12</title>

    <link rel="shortcut icon" href="../../_static/metpy_32x32.ico"/>

    <link rel="canonical" href="https://unidata.github.io/MetPy/latest/api/generated/metpy.plots.convert_gempak_color.html"/>

    <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />

    <link rel="stylesheet" href="../../_static/theme_override.css" type="text/css" />

    <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />

    <link rel="stylesheet" href="../../_static/gallery-binder.css" type="text/css" />

    <link rel="stylesheet" href="../../_static/gallery-dataframe.css" type="text/css" />

        <link rel="index" title="Index"
              href="../../genindex.html"/>
        <link rel="search" title="Search" href="../../search.html"/>
    <link rel="top" title="MetPy 0.12" href="../../index.html"/>
        <link rel="up" title="plots" href="metpy.plots.html"/>
        <link rel="next" title="read_colortable" href="metpy.plots.read_colortable.html"/>
        <link rel="prev" title="add_unidata_logo" href="metpy.plots.add_unidata_logo.html"/>

             MetPy

                    <select class="version-list" id="version-list">
                      <option value=''>0.12</option>

                          <option value="../latest">latest</option>

                          <option value="../dev">dev</option>

                    </select>

  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Installation Guide

Getting Started with MetPy

Unit Support

Examples

Python Gallery (separate site)

Tutorials

Reference Guide

constants

units

io

calc

plots

add_metpy_logo

add_timestamp

add_unidata_logo

convert_gempak_color

read_colortable

wx_code_to_numeric

BarbPlot

ContourPlot

FilledContourPlot

Hodograph

ImagePlot

MapPanel

PanelContainer

PlotObs

PlotScalar

PlotVector

Plots2D

SkewT

StationPlot

StationPlotLayout

ctables

interpolate

xarray

MetPy Roadmap

GEMPAK Conversion Guide

Support

Contributors Guide

Infrastructure Guide

Citing MetPy

References

          MetPy

Docs »

Reference Guide »

plots »

convert_gempak_color

                 Improve this page

convert_gempak_color¶

metpy.plots.convert_gempak_color(c, style='psc')[source]¶

Convert GEMPAK color numbers into corresponding Matplotlib colors.

Takes a sequence of GEMPAK color numbers and turns them into
equivalent Matplotlib colors. Various GEMPAK quirks are respected,
such as treating negative values as equivalent to 0.

Parameters

c (int or sequence of ints) – GEMPAK color number(s)

style (str, optional) – The GEMPAK 'device' to use to interpret color numbers. May be 'psc'
(the default; best for a white background) or 'xw' (best for a black background).

Returns

List of strings of Matplotlib colors, or a single string if only one color requested.

        Next

         Previous

        © Copyright 2019, MetPy Developers. Development supported by National Science Foundation grants AGS-1344155, OAC-1740315, and AGS-1901712..
      Last updated on Aug 06, 2020 at 20:22:57.

  Built with Sphinx using a theme provided by Read the Docs.


text:
package com.alachisoft.tayzgrid.caching.statistics;

import com.alachisoft.tayzgrid.serialization.core.io.ICompactSerializable;
import com.alachisoft.tayzgrid.serialization.core.io.CacheObjectInput;
import com.alachisoft.tayzgrid.serialization.core.io.CacheObjectOutput;
import java.io.IOException;

public class BucketStatistics implements ICompactSerializable, java.io.Serializable {

    private long _count;
    private long _dataSize;

    public BucketStatistics() {
    }

    public final long getCount() {
        return _count;
    }

    public final void setCount(long value) {
        _count = value;
    }

    public final long getDataSize() {
        return _dataSize;
    }

    public final void setDataSize(long value) {
        _dataSize = value;
    }

    public final void Increment(long dataSize) {
        synchronized (this) {
            _count++;
            _dataSize += dataSize;
        }
    }

    public final void Decrement(long dataSize) {
        synchronized (this) {
            _count--;
            _dataSize -= dataSize;
        }
    }

    public final void Clear() {
        synchronized (this) {
            _count = 0;
            _dataSize = 0;
        }
    }

    public final void SerializeLocal(CacheObjectOutput writer) throws IOException {
        writer.writeLong(_count);
        writer.writeLong(_dataSize);
    }

    public final void DeserializeLocal(CacheObjectInput reader) throws IOException {
        _count = reader.readLong();
        _dataSize = reader.readLong();
    }

    public void deserialize(CacheObjectInput reader) throws ClassNotFoundException, IOException {
        _count = reader.readLong();
        _dataSize = reader.readLong();
    }

    public void serialize(CacheObjectOutput writer) throws IOException {
        writer.writeLong(_count);
        writer.writeLong(_dataSize);
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>@yield('title')</title>
    <link rel="stylesheet" href="/css/app.css">

        @include('inc.navbar')

          @if (Request::is('/'))
            @include('inc.showcase')
          @endif
            @include('inc.messages')

                  @yield('content')

                @include('inc.sidebar')

© <?php echo date('Y'); ?> Example LLC. All Rights Reserved.


text:
module.exports = function(sequelize, DataTypes) {
    return sequelize.define('locationPoint', {
            id: {
                type: DataTypes.BIGINT,
                field: 'id',
                autoIncrement: true,
                primaryKey: true
            },
            user_fk: {
                type: DataTypes.BIGINT,
                field: 'user_fk',
                notNull: true,
                references: {
                    model: 'users',
                    key: 'id'
                }
            },
            longitude: {
                type: DataTypes.DOUBLE,
                field: 'longitude',
                notNull: true
            },
            latitude: {
                type: DataTypes.DOUBLE,
                field: 'latitude',
                notNull: true
            },
            createdDate: {
                type: DataTypes.DATEONLY,
                field: 'createdDate',
                notNull: true
            }
        }
    );
};


text:
BREAKING CHANGES:

- `NewSocketClient` and `NewGRPCClient` no longer start the client automatically, and don't return errors. The caller is responsible for running `client.Start()` and checking the error.
- `NewSocketServer` and `NewGRPCServer` no longer start the server automatically, and don't return errors. The caller is responsible for running `server.Start()` and checking the error.

FEATURES:

- [types] new method `func (res Result) IsSameCode(compare Result) bool` checks whether two results have the same code
- [types] new methods `func (r *ResponseCheckTx) Result() Result` and `func (r *ResponseDeliverTx) Result() Result` to convert from protobuf types (for control over json serialization)
- [types] new method `func (r *ResponseQuery) Result() *ResultQuery` and struct `ResultQuery` to convert from protobuf types (for control over json serializtion)

IMPROVEMENTS:

- Update imports for new `tmlibs` repository
- Use the new logger
- [abci-cli] Add flags to the query command for `path`, `height`, and `prove`
- [types] use `data.Bytes` and `json` tags in the `Result` struct

BUG FIXES:

## 0.4.1 (April 18, 2017)

IMPROVEMENTS:

- Update dependencies

## 0.4.0 (March 6, 2017)

BREAKING CHANGES:

- Query takes RequestQuery and returns ResponseQuery. The request is split into `data` and `path`,
can specify a height to query the state from, and whether or not the response should come with a proof.
The response returns the corresponding key-value pair, with proof if requested.

```
message RequestQuery{
	bytes data = 1;
	string path = 2;
	uint64 height = 3;
	bool prove = 4;
}

message ResponseQuery{
	CodeType          code        = 1;
	int64             index       = 2;
	bytes             key         = 3;
	bytes             value       = 4;
	bytes             proof       = 5;
	uint64            height      = 6;
	string            log         = 7;
}
```

IMPROVEMENTS:

- Updates to Makefile
- Various cleanup
- BaseApplication can be embedded by new apps to avoid implementing empty methods
- Drop BlockchainAware and make BeginBlock/EndBlock part of the `type Application interface`

## 0.3.0 (January 12, 2017)

BREAKING CHANGES:

- TMSP is now ABCI (Application/Asynchronous/A BlockChain Interface or Atomic BroadCast Interface)
- AppendTx is now DeliverTx (conforms to the literature)
- BeginBlock takes a Header:

```
message RequestBeginBlock{
	bytes hash = 1;
	Header header = 2;
}
```

- Info returns a ResponseInfo, containing last block height and app hash:

```
message ResponseInfo {
	string data = 1;
	string version = 2;
	uint64 last_block_height = 3;
	bytes last_block_app_hash = 4;
}
```

- EndBlock returns a ResponseEndBlock, containing the changed validators:

```
message ResponseEndBlock{
	repeated Validator diffs = 4;
}
```

- Hex strings are 0x-prefixed in the CLI
- Query on the Dummy app now uses hex-strings

FEATURES:

- New app, PersistentDummy, uses Info/BeginBlock to recover from failures and supports validator set changes
- New message types for blockchain data:

```
//----------------------------------------
// Blockchain Types

message Header {
	string chain_id = 1;
	uint64 height = 2;
	uint64 time = 3;
	uint64 num_txs = 4;
	BlockID last_block_id = 5;
	bytes last_commit_hash = 6;
	bytes data_hash = 7;
	bytes validators_hash = 8;
	bytes app_hash = 9;
}

message BlockID {
	bytes hash = 1;
	PartSetHeader parts = 2;
}

message PartSetHeader {
	uint64 total = 1;
	bytes hash = 2;
}

message Validator {
            bytes             pubKey      = 1;
            uint64            power       = 2;
}
```

- Add support for Query to Counter app

IMPROVEMENT:

- Don't exit the tmsp-cli console on bad args

BUG FIXES:

- Fix parsing in the Counter app to handle invalid transactions

## 0.2.1 (September 12, 2016)

IMPROVEMENTS

- Better error handling in console

## 0.2.0 (July 23, 2016)

BREAKING CHANGES:

- Use `oneof` types in protobuf

FEATURES:

- GRPC support

## PreHistory

##### Mar 26h, 2016
* Introduce BeginBlock

##### Mar 6th, 2016

* Added InitChain, EndBlock

##### Feb 14th, 2016

* s/GetHash/Commit/g
* Document Protobuf request/response fields

##### Jan 23th, 2016

* Added CheckTx/Query ABCI message types
* Added Result/Log fields to DeliverTx/CheckTx/SetOption
* Removed Listener messages
* Removed Code from ResponseSetOption and ResponseGetHash
* Made examples BigEndian

##### Jan 12th, 2016

* Added "RetCodeBadNonce = 0x06" return code

##### Jan 8th, 2016

* Tendermint/ABCI now comes to consensus on the order first before DeliverTx.


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>View Sources</title>
    <link href="/struts2-showcase-2.0.6/styles/main.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="/struts2-showcase-2.0.6/struts/niftycorners/niftyCorners.css" rel="stylesheet" type="text/css"/>
    <link href="/struts2-showcase-2.0.6/struts/niftycorners/niftyPrint.css" rel="stylesheet" type="text/css" media="print"/>

<link rel="stylesheet" href="/struts2-showcase-2.0.6/struts/xhtml/styles.css" type="text/css"/>

    <link rel="stylesheet" type="text/css" href="/struts2-showcase-2.0.6/struts/tabs.css?page=%2Fajax%2Fremoteforms%2Findex.jsp">
    <link rel="stylesheet" type="text/css" href="/struts2-showcase-2.0.6/struts/niftycorners/niftyCorners.css?page=%2Fajax%2Fremoteforms%2Findex.jsp">
    <link rel="stylesheet" type="text/css" href="/struts2-showcase-2.0.6/struts/niftycorners/niftyPrint.css?page=%2Fajax%2Fremoteforms%2Findex.jsp" media="print">

Struts Showcase

2007/04/06 03:17:08

View Sources

/ajax/remoteforms/index.jsp

1: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2: <%@ taglib prefix="s" uri="/struts-tags" %>
3:
4: <html>
5: <head>
6:     <title>Ajax Examples</title>
7:     <s:head theme="ajax"/>
8:
9:     <script language="JavaScript" type="text/javascript">
10:         function doSomething() {
11:             alert('you can manipulate the form before it gets submitted');
12:             return true;
13:         }
14:     </script>
15:
16: </head>
17:
18: <body>
19:
20:
21: Remote form replacing another div:<br/>
22:
23: <div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
24: <s:form
25:         id='theForm2'
26:         cssStyle="border: 1px solid green;"
27:         action='AjaxRemoteForm'
28:         method='post'
29:         theme="ajax">
30:
31:     <input type='text' name='data' value='Struts User'>
32:
33:     <s:submit value="GO2" theme="ajax" targets="two"/>
34:
35: </s:form>
36:
37:
38: Remote form replacing the forms content:<br/>
39: <s:form
40:         id='theForm3'
41:         cssStyle="border: 1px solid green;"
42:         action='AjaxRemoteForm'
43:         method='post'
44:         theme="ajax">
45:
46:     <input type='text' name='data' value='Struts User'>
47:
48:     <s:submit value="GO3" theme="ajax" targets="theForm3"/>
49:
50: </s:form>
51:
52: Remote form evaluating suplied JS on completion:<br/>
53: <s:form
54:         id='theForm4'
55:         cssStyle="border: 1px solid green;"
56:         action='AjaxRemoteForm'
57:         method='post'
58:         theme="ajax">
59:
60:     <input type='text' name='data' value='Struts User'>
61:
62:     <s:submit value="GO4" theme="ajax"/>
63:
64: </s:form>
65:
66: Remote form replacing the forms content after confirming results:<br/>
67: <s:form
68:         id='theForm5'
69:         cssStyle="border: 1px solid green;"
70:         action='AjaxRemoteForm'
71:         method='post'
72:         theme="ajax">
73:
74:     <input type='text' name='data' value='Struts User'>
75:
76:     <s:submit value="GO3" theme="ajax" targets="theForm5" />
77:
78: </s:form>
79:
80: Remote form replacing the forms content after running a function:<br/>
81: <s:form
82:         id='theForm6'
83:         cssStyle="border: 1px solid green;"
84:         action='AjaxRemoteForm'
85:         method='post'
86:         theme="ajax">
87:
88:     <input type='text' name='data' value='Struts User'>
89:
90:     <s:submit value="GO3" theme="ajax" targets="theForm6" />
91:
92: </s:form>
93:
94: A form with no remote submit (so should not be ajaxified):<br/>
95: <s:form
96:         id='theForm7'
97:         cssStyle="border: 1px solid green;"
98:         action='AjaxRemoteForm'
99:         method='post'
100:         theme="ajax">
101:
102:     <input type='text' name='data' value='Struts User'>
103:
104:     <s:submit value="Go AWAY" targets="theForm7" />
105:
106: </s:form>
107:
108: </body>
109: </html>

Unknown configuration

Unknown or unavailable Action class

Navigation

Home

Ajax

Ajax Chat

Action Chaining

Config Browser

Conversion

CRUD

Execute & Wait

File Download

File Upload

Freemarker

Hangman

JavaServer Faces

Person Manager

Tags

Tiles

Token

Validation

Help

        View Sources

Copyright © 2003-2007 The Apache Software Foundation.