text:
(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("React"), require("ReactDOM"));
	else if(typeof define === 'function' && define.amd)
		define(["React", "ReactDOM"], factory);
	else if(typeof exports === 'object')
		exports["ReactAutocomplete"] = factory(require("React"), require("ReactDOM"));
	else
		root["ReactAutocomplete"] = factory(root["React"], root["ReactDOM"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;
/******/
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';

	module.exports = __webpack_require__(1);

/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {

	/* WEBPACK VAR INJECTION */(function(global) {'use strict';

	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 React = __webpack_require__(2);

	var _require = __webpack_require__(3);

	var findDOMNode = _require.findDOMNode;

	var scrollIntoView = __webpack_require__(4);

	var _debugStates = [];

	var Autocomplete = React.createClass({
	  displayName: 'Autocomplete',

	  propTypes: {
	    value: React.PropTypes.any,
	    onChange: React.PropTypes.func,
	    onSelect: React.PropTypes.func,
	    shouldItemRender: React.PropTypes.func,
	    sortItems: React.PropTypes.func,
	    getItemValue: React.PropTypes.func.isRequired,
	    renderItem: React.PropTypes.func.isRequired,
	    renderMenu: React.PropTypes.func,
	    menuStyle: React.PropTypes.object,
	    inputProps: React.PropTypes.object,
	    wrapperProps: React.PropTypes.object,
	    wrapperStyle: React.PropTypes.object,
	    debug: React.PropTypes.bool
	  },

	  getDefaultProps: function getDefaultProps() {
	    return {
	      value: '',
	      wrapperProps: {},
	      wrapperStyle: {
	        display: 'inline-block'
	      },
	      inputProps: {},
	      onChange: function onChange() {},
	      onSelect: function onSelect(value, item) {},
	      renderMenu: function renderMenu(items, value, style) {
	        return React.createElement('div', { style: _extends({}, style, this.menuStyle), children: items });
	      },
	      shouldItemRender: function shouldItemRender() {
	        return true;
	      },
	      menuStyle: {
	        borderRadius: '3px',
	        boxShadow: '0 2px 12px rgba(0, 0, 0, 0.1)',
	        background: 'rgba(255, 255, 255, 0.9)',
	        padding: '2px 0',
	        fontSize: '90%',
	        position: 'fixed',
	        overflow: 'auto',
	        maxHeight: '50%' }
	    };
	  },

	  // TODO: don't cheat, let it flow to the bottom
	  getInitialState: function getInitialState() {
	    return {
	      isOpen: false,
	      highlightedIndex: null
	    };
	  },

	  componentWillMount: function componentWillMount() {
	    this._ignoreBlur = false;
	    this._performAutoCompleteOnUpdate = false;
	    this._performAutoCompleteOnKeyUp = false;
	  },

	  componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
	    this._performAutoCompleteOnUpdate = true;
	    // If `items` has changed we want to reset `highlightedIndex`
	    // since it probably no longer refers to a relevant item
	    if (this.props.items !== nextProps.items ||
	    // The entries in `items` may have been changed even though the
	    // object reference remains the same, double check by seeing
	    // if `highlightedIndex` points to an existing item
	    this.state.highlightedIndex >= nextProps.items.length) {
	      this.setState({ highlightedIndex: null });
	    }
	  },

	  componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
	    if (this.state.isOpen === true && prevState.isOpen === false) this.setMenuPositions();

	    if (this.state.isOpen && this._performAutoCompleteOnUpdate) {
	      this._performAutoCompleteOnUpdate = false;
	      this.maybeAutoCompleteText();
	    }

	    this.maybeScrollItemIntoView();
	  },

	  maybeScrollItemIntoView: function maybeScrollItemIntoView() {
	    if (this.state.isOpen === true && this.state.highlightedIndex !== null) {
	      var itemNode = this.refs['item-' + this.state.highlightedIndex];
	      var menuNode = this.refs.menu;
	      scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), { onlyScrollIfNeeded: true });
	    }
	  },

	  handleKeyDown: function handleKeyDown(event) {
	    if (this.keyDownHandlers[event.key]) this.keyDownHandlers[event.key].call(this, event);else {
	      this.setState({
	        highlightedIndex: null,
	        isOpen: true
	      });
	    }
	  },

	  handleChange: function handleChange(event) {
	    this._performAutoCompleteOnKeyUp = true;
	    this.props.onChange(event, event.target.value);
	  },

	  handleKeyUp: function handleKeyUp() {
	    if (this._performAutoCompleteOnKeyUp) {
	      this._performAutoCompleteOnKeyUp = false;
	      this.maybeAutoCompleteText();
	    }
	  },

	  keyDownHandlers: {
	    ArrowDown: function ArrowDown(event) {
	      event.preventDefault();
	      var itemsLength = this.getFilteredItems().length;
	      if (!itemsLength) return;
	      var highlightedIndex = this.state.highlightedIndex;

	      var index = highlightedIndex === null || highlightedIndex === itemsLength - 1 ? 0 : highlightedIndex + 1;
	      this._performAutoCompleteOnKeyUp = true;
	      this.setState({
	        highlightedIndex: index,
	        isOpen: true
	      });
	    },

	    ArrowUp: function ArrowUp(event) {
	      event.preventDefault();
	      var itemsLength = this.getFilteredItems().length;
	      if (!itemsLength) return;
	      var highlightedIndex = this.state.highlightedIndex;

	      var index = highlightedIndex === 0 || highlightedIndex === null ? itemsLength - 1 : highlightedIndex - 1;
	      this._performAutoCompleteOnKeyUp = true;
	      this.setState({
	        highlightedIndex: index,
	        isOpen: true
	      });
	    },

	    Enter: function Enter(event) {
	      var _this = this;

	      if (this.state.isOpen === false) {
	        // menu is closed so there is no selection to accept -> do nothing
	        return;
	      } else if (this.state.highlightedIndex == null) {
	        // input has focus but no menu item is selected + enter is hit -> close the menu, highlight whatever's in input
	        this.setState({
	          isOpen: false
	        }, function () {
	          _this.refs.input.select();
	        });
	      } else {
	        // text entered + menu item has been highlighted + enter is hit -> update value to that of selected menu item, close the menu
	        event.preventDefault();
	        var item = this.getFilteredItems()[this.state.highlightedIndex];
	        var value = this.props.getItemValue(item);
	        this.setState({
	          isOpen: false,
	          highlightedIndex: null
	        }, function () {
	          //this.refs.input.focus() // TODO: file issue
	          _this.refs.input.setSelectionRange(value.length, value.length);
	          _this.props.onSelect(value, item);
	        });
	      }
	    },

	    Escape: function Escape(event) {
	      this.setState({
	        highlightedIndex: null,
	        isOpen: false
	      });
	    }
	  },

	  getFilteredItems: function getFilteredItems() {
	    var _this2 = this;

	    var items = this.props.items;

	    if (this.props.shouldItemRender) {
	      items = items.filter(function (item) {
	        return _this2.props.shouldItemRender(item, _this2.props.value);
	      });
	    }

	    if (this.props.sortItems) {
	      items.sort(function (a, b) {
	        return _this2.props.sortItems(a, b, _this2.props.value);
	      });
	    }

	    return items;
	  },

	  maybeAutoCompleteText: function maybeAutoCompleteText() {
	    if (this.props.value === '') return;
	    var highlightedIndex = this.state.highlightedIndex;

	    var items = this.getFilteredItems();
	    if (items.length === 0) return;
	    var matchedItem = highlightedIndex !== null ? items[highlightedIndex] : items[0];
	    var itemValue = this.props.getItemValue(matchedItem);
	    var itemValueDoesMatch = itemValue.toLowerCase().indexOf(this.props.value.toLowerCase()) === 0;
	    if (itemValueDoesMatch && highlightedIndex === null) this.setState({ highlightedIndex: 0 });
	  },

	  setMenuPositions: function setMenuPositions() {
	    var node = this.refs.input;
	    var rect = node.getBoundingClientRect();
	    var computedStyle = global.window.getComputedStyle(node);
	    var marginBottom = parseInt(computedStyle.marginBottom, 10) || 0;
	    var marginLeft = parseInt(computedStyle.marginLeft, 10) || 0;
	    var marginRight = parseInt(computedStyle.marginRight, 10) || 0;
	    this.setState({
	      menuTop: rect.bottom + marginBottom,
	      menuLeft: rect.left + marginLeft,
	      menuWidth: rect.width + marginLeft + marginRight
	    });
	  },

	  highlightItemFromMouse: function highlightItemFromMouse(index) {
	    this.setState({ highlightedIndex: index });
	  },

	  selectItemFromMouse: function selectItemFromMouse(item) {
	    var _this3 = this;

	    var value = this.props.getItemValue(item);
	    this.setState({
	      isOpen: false,
	      highlightedIndex: null
	    }, function () {
	      _this3.props.onSelect(value, item);
	      _this3.refs.input.focus();
	      _this3.setIgnoreBlur(false);
	    });
	  },

	  setIgnoreBlur: function setIgnoreBlur(ignore) {
	    this._ignoreBlur = ignore;
	  },

	  renderMenu: function renderMenu() {
	    var _this4 = this;

	    var items = this.getFilteredItems().map(function (item, index) {
	      var element = _this4.props.renderItem(item, _this4.state.highlightedIndex === index, { cursor: 'default' });
	      return React.cloneElement(element, {
	        onMouseDown: function onMouseDown() {
	          return _this4.setIgnoreBlur(true);
	        },
	        onMouseEnter: function onMouseEnter() {
	          return _this4.highlightItemFromMouse(index);
	        },
	        onClick: function onClick() {
	          return _this4.selectItemFromMouse(item);
	        },
	        ref: 'item-' + index
	      });
	    });
	    var style = {
	      left: this.state.menuLeft,
	      top: this.state.menuTop,
	      minWidth: this.state.menuWidth
	    };
	    var menu = this.props.renderMenu(items, this.props.value, style);
	    return React.cloneElement(menu, { ref: 'menu' });
	  },

	  handleInputBlur: function handleInputBlur() {
	    if (this._ignoreBlur) return;
	    this.setState({
	      isOpen: false,
	      highlightedIndex: null
	    });
	  },

	  handleInputFocus: function handleInputFocus() {
	    if (this._ignoreBlur) return;
	    // We don't want `selectItemFromMouse` to trigger when
	    // the user clicks into the input to focus it, so set this
	    // flag to cancel out the logic in `handleInputClick`.
	    // The event order is:  MouseDown -> Focus -> MouseUp -> Click
	    this._ignoreClick = true;
	    this.setState({ isOpen: true });
	  },

	  isInputFocused: function isInputFocused() {
	    var el = this.refs.input;
	    return el.ownerDocument && el === el.ownerDocument.activeElement;
	  },

	  handleInputClick: function handleInputClick() {
	    // Input will not be focused if it's disabled
	    if (this.isInputFocused() && this.state.isOpen === false) this.setState({ isOpen: true });else if (this.state.highlightedIndex !== null && !this._ignoreClick) this.selectItemFromMouse(this.getFilteredItems()[this.state.highlightedIndex]);
	    this._ignoreClick = false;
	  },

	  render: function render() {
	    var _this5 = this;

	    if (this.props.debug) {
	      // you don't like it, you love it
	      _debugStates.push({
	        id: _debugStates.length,
	        state: this.state
	      });
	    }

	    return React.createElement('div', _extends({ style: _extends({}, this.props.wrapperStyle) }, this.props.wrapperProps), React.createElement('input', _extends({}, this.props.inputProps, {
	      role: 'combobox',
	      'aria-autocomplete': 'list',
	      autoComplete: 'off',
	      ref: 'input',
	      onFocus: this.handleInputFocus,
	      onBlur: this.handleInputBlur,
	      onChange: function onChange(event) {
	        return _this5.handleChange(event);
	      },
	      onKeyDown: function onKeyDown(event) {
	        return _this5.handleKeyDown(event);
	      },
	      onKeyUp: function onKeyUp(event) {
	        return _this5.handleKeyUp(event);
	      },
	      onClick: this.handleInputClick,
	      value: this.props.value
	    })), this.state.isOpen && this.renderMenu(), this.props.debug && React.createElement('pre', { style: { marginLeft: 300 } }, JSON.stringify(_debugStates.slice(_debugStates.length - 5, _debugStates.length), null, 2)));
	  }
	});

	module.exports = Autocomplete;
	/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))

/***/ },
/* 2 */
/***/ function(module, exports) {

	module.exports = __WEBPACK_EXTERNAL_MODULE_2__;

/***/ },
/* 3 */
/***/ function(module, exports) {

	module.exports = __WEBPACK_EXTERNAL_MODULE_3__;

/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {

	module.exports = __webpack_require__(5);

/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {

	var util = __webpack_require__(6);

	function scrollIntoView(elem, container, config) {
	  config = config || {};
	  // document 归一化到 window
	  if (container.nodeType === 9) {
	    container = util.getWindow(container);
	  }

	  var allowHorizontalScroll = config.allowHorizontalScroll;
	  var onlyScrollIfNeeded = config.onlyScrollIfNeeded;
	  var alignWithTop = config.alignWithTop;
	  var alignWithLeft = config.alignWithLeft;

	  allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;

	  var isWin = util.isWindow(container);
	  var elemOffset = util.offset(elem);
	  var eh = util.outerHeight(elem);
	  var ew = util.outerWidth(elem);
	  var containerOffset, ch, cw, containerScroll,
	    diffTop, diffBottom, win,
	    winScroll, ww, wh;

	  if (isWin) {
	    win = container;
	    wh = util.height(win);
	    ww = util.width(win);
	    winScroll = {
	      left: util.scrollLeft(win),
	      top: util.scrollTop(win)
	    };
	    // elem 相对 container 可视视窗的距离
	    diffTop = {
	      left: elemOffset.left - winScroll.left,
	      top: elemOffset.top - winScroll.top
	    };
	    diffBottom = {
	      left: elemOffset.left + ew - (winScroll.left + ww),
	      top: elemOffset.top + eh - (winScroll.top + wh)
	    };
	    containerScroll = winScroll;
	  } else {
	    containerOffset = util.offset(container);
	    ch = container.clientHeight;
	    cw = container.clientWidth;
	    containerScroll = {
	      left: container.scrollLeft,
	      top: container.scrollTop
	    };
	    // elem 相对 container 可视视窗的距离
	    // 注意边框, offset 是边框到根节点
	    diffTop = {
	      left: elemOffset.left - (containerOffset.left +
	      (parseFloat(util.css(container, 'borderLeftWidth')) || 0)),
	      top: elemOffset.top - (containerOffset.top +
	      (parseFloat(util.css(container, 'borderTopWidth')) || 0))
	    };
	    diffBottom = {
	      left: elemOffset.left + ew -
	      (containerOffset.left + cw +
	      (parseFloat(util.css(container, 'borderRightWidth')) || 0)),
	      top: elemOffset.top + eh -
	      (containerOffset.top + ch +
	      (parseFloat(util.css(container, 'borderBottomWidth')) || 0))
	    };
	  }

	  if (diffTop.top < 0 || diffBottom.top > 0) {
	    // 强制向上
	    if (alignWithTop === true) {
	      util.scrollTop(container, containerScroll.top + diffTop.top);
	    } else if (alignWithTop === false) {
	      util.scrollTop(container, containerScroll.top + diffBottom.top);
	    } else {
	      // 自动调整
	      if (diffTop.top < 0) {
	        util.scrollTop(container, containerScroll.top + diffTop.top);
	      } else {
	        util.scrollTop(container, containerScroll.top + diffBottom.top);
	      }
	    }
	  } else {
	    if (!onlyScrollIfNeeded) {
	      alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;
	      if (alignWithTop) {
	        util.scrollTop(container, containerScroll.top + diffTop.top);
	      } else {
	        util.scrollTop(container, containerScroll.top + diffBottom.top);
	      }
	    }
	  }

	  if (allowHorizontalScroll) {
	    if (diffTop.left < 0 || diffBottom.left > 0) {
	      // 强制向上
	      if (alignWithLeft === true) {
	        util.scrollLeft(container, containerScroll.left + diffTop.left);
	      } else if (alignWithLeft === false) {
	        util.scrollLeft(container, containerScroll.left + diffBottom.left);
	      } else {
	        // 自动调整
	        if (diffTop.left < 0) {
	          util.scrollLeft(container, containerScroll.left + diffTop.left);
	        } else {
	          util.scrollLeft(container, containerScroll.left + diffBottom.left);
	        }
	      }
	    } else {
	      if (!onlyScrollIfNeeded) {
	        alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;
	        if (alignWithLeft) {
	          util.scrollLeft(container, containerScroll.left + diffTop.left);
	        } else {
	          util.scrollLeft(container, containerScroll.left + diffBottom.left);
	        }
	      }
	    }
	  }
	}

	module.exports = scrollIntoView;

/***/ },
/* 6 */
/***/ function(module, exports) {

	var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;

	function getClientPosition(elem) {
	  var box, x, y;
	  var doc = elem.ownerDocument;
	  var body = doc.body;
	  var docElem = doc && doc.documentElement;
	  // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
	  box = elem.getBoundingClientRect();

	  // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
	  // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
	  // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin

	  x = box.left;
	  y = box.top;

	  // In IE, most of the time, 2 extra pixels are added to the top and left
	  // due to the implicit 2-pixel inset border.  In IE6/7 quirks mode and
	  // IE6 standards mode, this border can be overridden by setting the
	  // document element's border to zero -- thus, we cannot rely on the
	  // offset always being 2 pixels.

	  // In quirks mode, the offset can be determined by querying the body's
	  // clientLeft/clientTop, but in standards mode, it is found by querying
	  // the document element's clientLeft/clientTop.  Since we already called
	  // getClientBoundingRect we have already forced a reflow, so it is not
	  // too expensive just to query them all.

	  // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
	  // 窗口边框标准是设 documentElement ,quirks 时设置 body
	  // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
	  // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
	  // 标准 ie 下 docElem.clientTop 就是 border-top
	  // ie7 html 即窗口边框改变不了。永远为 2
	  // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0

	  x -= docElem.clientLeft || body.clientLeft || 0;
	  y -= docElem.clientTop || body.clientTop || 0;

	  return {left: x, top: y};
	}

	function getScroll(w, top) {
	  var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
	  var method = 'scroll' + (top ? 'Top' : 'Left');
	  if (typeof ret !== 'number') {
	    var d = w.document;
	    //ie6,7,8 standard mode
	    ret = d.documentElement[method];
	    if (typeof ret !== 'number') {
	      //quirks mode
	      ret = d.body[method];
	    }
	  }
	  return ret;
	}

	function getScrollLeft(w) {
	  return getScroll(w);
	}

	function getScrollTop(w) {
	  return getScroll(w, true);
	}

	function getOffset(el) {
	  var pos = getClientPosition(el);
	  var doc = el.ownerDocument;
	  var w = doc.defaultView || doc.parentWindow;
	  pos.left += getScrollLeft(w);
	  pos.top += getScrollTop(w);
	  return pos;
	}
	function _getComputedStyle(elem, name, computedStyle) {
	  var val = '';
	  var d = elem.ownerDocument;

	  // https://github.com/kissyteam/kissy/issues/61
	  if ((computedStyle = (computedStyle || d.defaultView.getComputedStyle(elem, null)))) {
	    val = computedStyle.getPropertyValue(name) || computedStyle[name];
	  }

	  return val;
	}

	var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
	var RE_POS = /^(top|right|bottom|left)$/,
	  CURRENT_STYLE = 'currentStyle',
	  RUNTIME_STYLE = 'runtimeStyle',
	  LEFT = 'left',
	  PX = 'px';

	function _getComputedStyleIE(elem, name) {
	  // currentStyle maybe null
	  // http://msdn.microsoft.com/en-us/library/ms535231.aspx
	  var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];

	  // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
	  // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
	  // 在 ie 下不对,需要直接用 offset 方式
	  // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了

	  // From the awesome hack by Dean Edwards
	  // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
	  // If we're not dealing with a regular pixel number
	  // but a number that has a weird ending, we need to convert it to pixels
	  // exclude left right for relativity
	  if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
	    // Remember the original values
	    var style = elem.style,
	      left = style[LEFT],
	      rsLeft = elem[RUNTIME_STYLE][LEFT];

	    // prevent flashing of content
	    elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];

	    // Put in the new values to get a computed value out
	    style[LEFT] = name === 'fontSize' ? '1em' : (ret || 0);
	    ret = style.pixelLeft + PX;

	    // Revert the changed values
	    style[LEFT] = left;

	    elem[RUNTIME_STYLE][LEFT] = rsLeft;
	  }
	  return ret === '' ? 'auto' : ret;
	}

	var getComputedStyleX;
	if (typeof window !== 'undefined') {
	  getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
	}

	// 设置 elem 相对 elem.ownerDocument 的坐标
	function setOffset(elem, offset) {
	  // set position first, in-case top/left are set even on static elem
	  if (css(elem, 'position') === 'static') {
	    elem.style.position = 'relative';
	  }

	  var old = getOffset(elem),
	    ret = {},
	    current, key;

	  for (key in offset) {
	    current = parseFloat(css(elem, key)) || 0;
	    ret[key] = current + offset[key] - old[key];
	  }
	  css(elem, ret);
	}

	function each(arr, fn) {
	  for (var i = 0; i < arr.length; i++) {
	    fn(arr[i]);
	  }
	}

	function isBorderBoxFn(elem) {
	  return getComputedStyleX(elem, 'boxSizing') === 'border-box';
	}

	var BOX_MODELS = ['margin', 'border', 'padding'],
	  CONTENT_INDEX = -1,
	  PADDING_INDEX = 2,
	  BORDER_INDEX = 1,
	  MARGIN_INDEX = 0;

	function swap(elem, options, callback) {
	  var old = {},
	    style = elem.style,
	    name;

	  // Remember the old values, and insert the new ones
	  for (name in options) {
	    old[name] = style[name];
	    style[name] = options[name];
	  }

	  callback.call(elem);

	  // Revert the old values
	  for (name in options) {
	    style[name] = old[name];
	  }
	}

	function getPBMWidth(elem, props, which) {
	  var value = 0, prop, j, i;
	  for (j = 0; j < props.length; j++) {
	    prop = props[j];
	    if (prop) {
	      for (i = 0; i < which.length; i++) {
	        var cssProp;
	        if (prop === 'border') {
	          cssProp = prop + which[i] + 'Width';
	        } else {
	          cssProp = prop + which[i];
	        }
	        value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
	      }
	    }
	  }
	  return value;
	}

	/**
	 * A crude way of determining if an object is a window
	 * @member util
	 */
	function isWindow(obj) {
	  // must use == for ie8
	  /*jshint eqeqeq:false*/
	  return obj != null && obj == obj.window;
	}

	var domUtils = {};

	each(['Width', 'Height'], function (name) {
	  domUtils['doc' + name] = function (refWin) {
	    var d = refWin.document;
	    return Math.max(
	      //firefox chrome documentElement.scrollHeight< body.scrollHeight
	      //ie standard mode : documentElement.scrollHeight> body.scrollHeight
	      d.documentElement['scroll' + name],
	      //quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
	      d.body['scroll' + name],
	      domUtils['viewport' + name](d));
	  };

	  domUtils['viewport' + name] = function (win) {
	    // pc browser includes scrollbar in window.innerWidth
	    var prop = 'client' + name,
	      doc = win.document,
	      body = doc.body,
	      documentElement = doc.documentElement,
	      documentElementProp = documentElement[prop];
	    // 标准模式取 documentElement
	    // backcompat 取 body
	    return doc.compatMode === 'CSS1Compat' && documentElementProp ||
	      body && body[prop] || documentElementProp;
	  };
	});

	/*
	 得到元素的大小信息
	 @param elem
	 @param name
	 @param {String} [extra]  'padding' : (css width) + padding
	 'border' : (css width) + padding + border
	 'margin' : (css width) + padding + border + margin
	 */
	function getWH(elem, name, extra) {
	  if (isWindow(elem)) {
	    return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
	  } else if (elem.nodeType === 9) {
	    return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
	  }
	  var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'],
	    borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
	  var computedStyle = getComputedStyleX(elem);
	  var isBorderBox = isBorderBoxFn(elem, computedStyle);
	  var cssBoxValue = 0;
	  if (borderBoxValue == null || borderBoxValue <= 0) {
	    borderBoxValue = undefined;
	    // Fall back to computed then un computed css if necessary
	    cssBoxValue = getComputedStyleX(elem, name);
	    if (cssBoxValue == null || (Number(cssBoxValue)) < 0) {
	      cssBoxValue = elem.style[name] || 0;
	    }
	    // Normalize '', auto, and prepare for extra
	    cssBoxValue = parseFloat(cssBoxValue) || 0;
	  }
	  if (extra === undefined) {
	    extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
	  }
	  var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
	  var val = borderBoxValue || cssBoxValue;
	  if (extra === CONTENT_INDEX) {
	    if (borderBoxValueOrIsBorderBox) {
	      return val - getPBMWidth(elem, ['border', 'padding'],
	          which, computedStyle);
	    } else {
	      return cssBoxValue;
	    }
	  } else if (borderBoxValueOrIsBorderBox) {
	    return val + (extra === BORDER_INDEX ? 0 :
	        (extra === PADDING_INDEX ?
	          -getPBMWidth(elem, ['border'], which, computedStyle) :
	          getPBMWidth(elem, ['margin'], which, computedStyle)));
	  } else {
	    return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra),
	        which, computedStyle);
	  }
	}

	var cssShow = {position: 'absolute', visibility: 'hidden', display: 'block'};

	// fix #119 : https://github.com/kissyteam/kissy/issues/119
	function getWHIgnoreDisplay(elem) {
	  var val, args = arguments;
	  // in case elem is window
	  // elem.offsetWidth === undefined
	  if (elem.offsetWidth !== 0) {
	    val = getWH.apply(undefined, args);
	  } else {
	    swap(elem, cssShow, function () {
	      val = getWH.apply(undefined, args);
	    });
	  }
	  return val;
	}

	each(['width', 'height'], function (name) {
	  var first = name.charAt(0).toUpperCase() + name.slice(1);
	  domUtils['outer' + first] = function (el, includeMargin) {
	    return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
	  };
	  var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];

	  domUtils[name] = function (elem, val) {
	    if (val !== undefined) {
	      if (elem) {
	        var computedStyle = getComputedStyleX(elem);
	        var isBorderBox = isBorderBoxFn(elem);
	        if (isBorderBox) {
	          val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
	        }
	        return css(elem, name, val);
	      }
	      return;
	    }
	    return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
	  };
	});

	function css(el, name, value) {
	  if (typeof name === 'object') {
	    for (var i in name) {
	      css(el, i, name[i]);
	    }
	    return;
	  }
	  if (typeof value !== 'undefined') {
	    if (typeof value === 'number') {
	      value = value + 'px';
	    }
	    el.style[name] = value;
	  } else {
	    return getComputedStyleX(el, name);
	  }
	}

	function mix(to, from) {
	  for (var i in from) {
	    to[i] = from[i];
	  }
	  return to;
	}

	var utils = module.exports = {
	  getWindow: function (node) {
	    var doc = node.ownerDocument || node;
	    return doc.defaultView || doc.parentWindow;
	  },
	  offset: function (el, value) {
	    if (typeof value !== 'undefined') {
	      setOffset(el, value);
	    } else {
	      return getOffset(el);
	    }
	  },
	  isWindow: isWindow,
	  each: each,
	  css: css,
	  clone: function (obj) {
	    var ret = {};
	    for (var i in obj) {
	      ret[i] = obj[i];
	    }
	    var overflow = obj.overflow;
	    if (overflow) {
	      for (i in obj) {
	        ret.overflow[i] = obj.overflow[i];
	      }
	    }
	    return ret;
	  },
	  mix: mix,
	  scrollLeft: function (w, v) {
	    if (isWindow(w)) {
	      if (v === undefined) {
	        return getScrollLeft(w);
	      } else {
	        window.scrollTo(v, getScrollTop(w));
	      }
	    } else {
	      if (v === undefined) {
	        return w.scrollLeft;
	      } else {
	        w.scrollLeft = v;
	      }
	    }
	  },
	  scrollTop: function (w, v) {
	    if (isWindow(w)) {
	      if (v === undefined) {
	        return getScrollTop(w);
	      } else {
	        window.scrollTo(getScrollLeft(w), v);
	      }
	    } else {
	      if (v === undefined) {
	        return w.scrollTop;
	      } else {
	        w.scrollTop = v;
	      }
	    }
	  },
	  merge: function () {
	    var ret = {};
	    for (var i = 0; i < arguments.length; i++) {
	      utils.mix(ret, arguments[i]);
	    }
	    return ret;
	  },
	  viewportWidth: 0,
	  viewportHeight: 0
	};

	mix(utils, domUtils);

/***/ }
/******/ ])
});
;
//# sourceMappingURL=react-autocomplete.js.map


text:
import os
import subprocess

class main():

	def __init__(self):
		self.init = True;
		self.options = {"single/file/local":[self._single_file_local,"Create the ball as a single local file."],
				"exit":[exit,"Leave script"]
				}

	def menu(self):
		print """
###########################
#Welcome to Ball and Chain#
######  generate.py  ######

		"""

		print "--- Options ---"
		for i in self.options:
			print i, ":", self.options[i][1]
		print "Please type the name of the option you would like"

		choice = ""
		while choice not in self.options:
			choice = raw_input(">>> ")
		self.options[choice][0]()

	def tosize(self, num, suffix='B'):
		for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
		        if abs(num) < 1024.0:
        		    return "%3.1f%s%s" % (num, unit, suffix)
        		num /= 1024.0
    		return "%.1f%s%s" % (num, 'Yi', suffix)

	def _single_file_local(self):
		#enter
		print " "
		print "You need to decide on a byte length for the keys."
		print "This will inform the size of the ball."
		print "Enter a value for 2^x to see more about it."

		confirm = "n"
		bytenum = 0
		while confirm.lower() != "y" and confirm.lower() != "yes":
			bytenum = raw_input(">>>")
			try:
				bytenum = int(bytenum)
			except:
				bytenum = ""
			if isinstance( bytenum, (int , long)) and bytenum > 10 and bytenum < 46:
				print "key (bytes): %s, array: %s" % (bytenum, self.tosize(2**bytenum))
				confirm = raw_input("Good? [Y/n]:") or "y"

			elif bytenum == "exit":
				print "exiting..."
				exit()
			else:
				print "Please enter a number ( 46 > x > 10 ) or \"exit\""

		intval = 2**bytenum

		print " "
		print "Now we need a file to write to"
		filename = raw_input("filename>>> ")

		if(os.path.exists(filename)):
			print "This file already exists"
			print "Quitting..."
			exit()

		fi = open(filename, "a")

		while intval > 1:
			fi.write(os.urandom(1024))
			intval -= 1024
		fi.close()

		fi = open("openbac.conf","r")
		data = fi.read()
		fi.close()

		temp = []
		for line in data.split("\n"):
			if line[0:3] == "poi" and "pointerlengths: " in line:
				line = "pointerlengths: %s" % str(bytenum)
			if line[0:3] == "arr" and "arrayfile: " in line:
				line = "arrayfile: %s" % str(filename)

			temp.append(line)

		data = "\n".join(temp)

		fi = open("openbac.conf","w")
		fi.write(data)
		fi.close()

		print "Operation complete\n"
		print "--- Results ---"
		print "File: %s\nKeylen (bytes): %s\nFilelen %s" % (filename, bytenum, self.tosize(2**bytenum))

if __name__ == "__main__":
	m = main()
	m.menu()

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.kurento.client.RTCRTPStreamStats (Kurento Client API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Kurento Client 6.18.0-SNAPSHOT

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.kurento.client.RTCRTPStreamStats

Uses of RTCRTPStreamStats in org.kurento.client

Subclasses of RTCRTPStreamStats in org.kurento.client

Modifier and Type
Class and Description

class
RTCInboundRTPStreamStats

Statistics that represents the measurement metrics for the incoming media stream.

class
RTCOutboundRTPStreamStats

Statistics that represents the measurement metrics for the outgoing media stream.

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Kurento Client 6.18.0-SNAPSHOT

Prev

Next

Frames

No Frames

All Classes

Copyright © 2022 Kurento. All rights reserved.


text:
---
layout: post101
title:  Global HTTP Session Sharing
categories: XAP101TUT
parent: none
weight: 1500
---

{% section %}
{% column width=10% %}
![counter-logo.jpg](/attachment_files/subject/httpsession.png)
{% endcolumn %}
{% column width=90% %}
{%summary%}{%endsummary%}
{% endcolumn %}
{% endsection %}

{%section%}
{%column width=70% %}

With XAP you can share HTTP session data across multiple data centers, multiple web server instances or different types of web servers.

[{%pdf%}](/attachment_files/httpsession/globalhttpsessionsharing-screencast2014.pdf) Global HTTP Session Sharing Screencast.
{%endcolumn%}
{%column width=30% %}
{%youtube gRdGWMigJBI | Global HTTP Session sharing%}
{%endcolumn%}
{%endsection%}

This tutorial will show you:

1.	Run Single-Applications Session Sharing – sharing the same session between different Tomcat instances.

2.	Run Multiple-Applications Session Sharing – sharing the same session between different applications running in different Web servers - Tomcat and JBoss.

# Prior running the Tutorial

Make sure you have enough disk space to install:

- XAP 10 - 150MB
- Tomcat 7.0.23 - 80MB
- JBoss 7 - 200MB

The demo application can be downloaded:

[demo-app.war](/attachment_files/httpsession/demo-app.war)

[demo-app2.war](/attachment_files/httpsession/demo-app2.war)

{%comment%}
[Apache Tomcat](http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.zip)
[JBoss](http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip)

Download the demo app:
https://dl.dropboxusercontent.com/u/7390820/demo-app.war
https://dl.dropboxusercontent.com/u/7390820/demo-app2.war

Documentation:
http://docs.gigaspaces.com/xap100/global-http-session-sharing-overview.html

Deck:
https://dl.dropboxusercontent.com/u/7390820/GlobalHttpSessionSharing-Screencast2014.pptx

Screencast:
https://dl.dropboxusercontent.com/u/7390820/http-session-screencast-part1.wmv
https://dl.dropboxusercontent.com/u/7390820/http-session-screencast-part2.wmv
https://dl.dropboxusercontent.com/u/7390820/http-session-screencast-part3.wmv
{%endcomment%}

# Single Application Session Sharing

With this session sharing model, the web user interacting with multiple web servers through a load balancer where each web server running the same web application. In most cases you will have multiple instances of the same web app running in a cluster configuration.  The load balancer rout requests based on the sticky session configuration to the relevant web server instance.

![http-session-1](/attachment_files/httpsession/http-session1.png)

In this scenario the session is shared via its **ID**. Where there is a web server failure or when a new web server is added to the cluster the session **ID** is used to retrieve the session from the IMDG. Only the updated attributes (delta) are sent to the IMDG when the session is updated. This ensure best application performance and minimal network bandwidth usage.

### Demo Flow
With this demo we will simulate session sharing between different tomcat instances by starting tomcat , running the application, terminating tomcat and later restarting tomcat without losing application HTTP Session data.

-	{%download http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.zip%} Tomcat 7.0.23
-	Install Tomcat by unzipping it into `c:\` or `d:\`
-	Install XAP by unzipping it into `c:\` or `d:\`
-	Start Tomcat by running `\apache-tomcat-7.0.23\bin\startup.bat`
-	Move to the `\gigaspaces-xap-premium-10.0.1-ga\bin` folder and start GigaSpaces agent by running:

{%highlight console%}
gs-agent.bat
{%endhighlight%}

-	Deploy a space named **sessionSpace**. You may have a single instance Space or deploy a clustered Space using the command line , GS-UI or the Web-UI. Here is how you can do this via the CLI

{%highlight console%}
gs.bat deploy-space sessionSpace
{%endhighlight%}

-	Double check the **shiro.ini** within the `demo-app.war` file located under the `WEB-INF` folder includes the lookup service host name as part of the `connector.url` property. With the example below we are using a lookup service running locally - hence the `localhost` is used:

{%highlight console%}
connector.url=jini://localhost/*/sessionSpace
{%endhighlight%}

-	Deploy the `demo-app.war` into Tomcat by placing it into \apache-tomcat-7.0.23\webapps
-	Start your web browser and access the web application via the following URL:

{%highlight console%}
http://localhost:8080/demo-app
{%endhighlight%}

The URL above assumes the Tomcat is configured to use port 8080.

{%panel%}
![http-session](/attachment_files/httpsession/http-session2.png)
{%endpanel%}

-	Add some attributes using the interface provided
-	View the session updated within the space via the GS-UI or Web-UI

![http-session](/attachment_files/httpsession/http-session3.png)

-	Identify the Session ID

![http-session](/attachment_files/httpsession/http-session4.png)

-	Terminate Tomcat by terminating its process
-	Refresh the page (press the `F5` key) – you should get an error. There is no web server to serve the HTTP request.
-	Start Tomcat again using :

{%highlight console%}
\apache-tomcat-7.0.23\bin\startup.bat
{%endhighlight%}

-	Refresh the page on the browser (press the `F5` key).
-	The session will be reloaded from the data grid. See tomcat console for log messages.

# Multi-Applications Session Sharing
With this session sharing model , the web user interacting with multiple web servers through a load balancer where each running a **different web application**. It may be one big web application that has been broken down into different modules each running within a different web server potentially running on a different host. Each web application may access different web application instance during the life cycle of the application.

In this scenario the session user login – the **principle** , used to identify the session to be shared across the different applications. You may have also multiple instances of each web application running to scale its activity. All will be sharing the same HTTP session.

Any new web server that will be added dynamically will be able to share the session. When the HTTP session is updated only the updated session attributes (delta) is sent to the IMDG. When the session is shared between different web applications where each might have a different version of the session - a timestamp check is performed to ensure the recent session is passed between the apps and also to be stored within the IMDG. In such a case , HTTP session attributes are merged to ensure no data is lost when navigating between the different web application modules.

### Demo Flow
With this demo we will simulate session sharing between Tomcat and JBoss web servers instances by starting Tomcat and JBoss , running the application on both , updating the HTTP session in both – where the session will be shared implicitly , terminating tomcat and JBoss and later restarting these without losing application HTTP session data.

-	{%download http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip%} JBoss 7.
-	Install JBoss 7 by unzipping it into `c:\` or `d:\`

![http-session](/attachment_files/httpsession/http-session5.png)

-	Double check the **shiro.ini** within the `demo-app2.war` file located under the `WEB-INF` folder includes the lookup service host name as part of the `connector.url` property. With the example below we are using a lookup service running locally - hence the `localhost` is used:
{%highlight console%}
connector.url=jini://localhost/*/sessionSpace
{%endhighlight%}
-	Deploy `demo-app2.war` into Tomcat by placing it into `\apache-tomcat-7.0.23\webapps`
-	Deploy `demo-app2.war` into JBoss by placing it into `\jboss-as-7.1.1.Final\standalone\deployments`
-	Edit `\jboss-as-7.1.1.Final\standalone\configuration\standalone.xml`

To have:

{%highlight xml%}
<socket-binding name="http" port="8081"/>
{%endhighlight%}

-	Start JBoss by running :

{%highlight console%}
\jboss-as-7.1.1.Final\bin\standalone.bat
{%endhighlight%}

-	Start your web browser and access the web application running in Tomcat via the following URL:

{%highlight console%}
http://localhost:8080/demo-app2
{%endhighlight%}

-	Login into the application running on Tomcat using :
    -	user : root
    -	password : secret

{%panel%}
![http-session](/attachment_files/httpsession/http-session6.png)
{%endpanel%}

-	Add some attributes using the interface provided

{%panel%}
![http-session](/attachment_files/httpsession/http-session7.png)
{%endpanel%}

-	Start your browser and access the web application running in JBoss via the following URL:

{%highlight console%}
http://localhost:8081/demo-app2
{%endhighlight%}

-	Login into the application running on JBoss using :
    -	user : `root`
    -	password : `secret`

{%panel%}
![http-session](/attachment_files/httpsession/http-session8.png)
{%endpanel%}

-	You should see all attributes added into the session via Tomcat are shared with the application running on JBoss.

{%panel%}
![http-session](/attachment_files/httpsession/http-session9.png)
{%endpanel%}

-	Add / Modify some attributes

{%panel%}
![http-session](/attachment_files/httpsession/http-session10.png)
{%endpanel%}

-	Switch to Tomcat:

{%highlight console%}
http://localhost:8080/demo-app2
{%endhighlight%}

-	Refresh the page (press the `F5` key) – see all the attributes been updated.

{%panel%}
![http-session](/attachment_files/httpsession/http-session11.png)
{%endpanel%}

-	Terminate both Tomcat and JBoss by terminating their process
-	Refresh these by press the `F5` key :

{%highlight console%}
http://localhost:8080/demo-app2
http://localhost:8081/demo-app2

{%endhighlight%}

-	An error message will be displayed as both Tomcat and JBoss cannot serve the HTTP request.
-	Start Tomcat and JBoss
-	Refresh the pages served by Tomcat and JBoss by pressing the `F5` key
-	Login via user: `root`, password: `secret`
-	See session been fully recovered.

{%panel%}
{%section%}
{%column width=50% %}
![http-session](/attachment_files/httpsession/http-session12.png)
{%endcolumn%}
{%column width=50% %}
![http-session](/attachment_files/httpsession/http-session13.png)
{%endcolumn%}
{%endsection%}
{%endpanel%}

{%learn%} {%currentjavaurl%}/global-http-session-sharing-overview.html{%endlearn%}


text:
import logging.config
logging.config.fileConfig("logging.ini")

@app.route('/magic/<number>/')
def do_magic(number):
    try:
        logging.debug("About to do some magic with {0}".format(number))
        response = magic(number)
    except Exception as e:
        logging.exception("Got an exception {0} :(".format(e))
        abort(500, "Oops :(")
    else:
        logging.info("Magic done: {0}".format(response))
        return response

"""
Output:

2016-06-01 22:23:41,549 DEBUG example4 root PID: 7179  About to do some magic with 0
2016-06-01 22:23:41,549 ERROR example4 root PID: 7179  Got an exception MagicException :(
Traceback (most recent call last):
  File "/tmp/bla.py", line 8, in <module>
    raise ValueError('MagicException')
ValueError: MagicException
2016-06-01 22:23:41,549 DEBUG example4 root PID: 7179  About to do some magic with 1
2016-06-01 22:23:41,550 DEBUG example4 root PID: 7179  About to do some magic with 2
2016-06-01 22:23:41,549 INFO example4 root PID: 7179  Magic done: 1
2016-06-01 22:23:41,550 INFO example4 root PID: 7179  Magic done: 2
"""


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Provisioning.Comm.Console.RESTAPI
{
    public class Metadata
    {
        public string type { get; set; }
    }

    public class Metadata2
    {
        public string type { get; set; }
    }

    public class SupportedSchemaVersions
    {
        public Metadata2 __metadata { get; set; }
        public List<string> results { get; set; }
    }

    public class GetContextWebInformation
    {
        public Metadata __metadata { get; set; }
        public int FormDigestTimeoutSeconds { get; set; }
        public string FormDigestValue { get; set; }
        public string LibraryVersion { get; set; }
        public string SiteFullUrl { get; set; }
        public SupportedSchemaVersions SupportedSchemaVersions { get; set; }
        public string WebFullUrl { get; set; }
    }

    public class D
    {
        public GetContextWebInformation GetContextWebInformation { get; set; }
    }

    public class RootObject
    {
        public D d { get; set; }
    }
}


text:
layout: post
title:  "CSAW 2015 ~ Keep Calm and CTF: Forensics 100"
author: Vivi
date:   2015-09-18 21:59:33 -0700
categories: CTF Stego
tags: Stego CTF CSAW
---

>My friend sends me pictures before every ctf. He told me this one was special.

>Note: this flag doesn't follow the "flag{}" format

>[img.jpg]({{site.url}}/images/csaw/img.jpg)

This one had a super easy solution. First it gave us a jpg.
[![img.jpg]({{site.url}}/images/csaw/img.jpg)]({{site.url}}/images/csaw/img.jpg)

First thing I always do is run strings

>strings img.jpg | grep flag

Nothing popped up.

Next thing you always do for any kind of picture, well any forensics for that matter is look at metadeta. Simply upload the data to [Jeffrey's Exif viewer](http://regex.info/exif.cgi) or use some tools we gathered over years of experience (LOL) such as "exiftool", a tool to look at metadeta for everything.

>exiftool img.jpg

which gives me

```
ExifTool Version Number         : 9.46
File Name                       : img.jpg
Directory                       : .
File Size                       : 92 kB
File Modification Date/Time     : 2015:09:18 15:52:29-07:00
File Access Date/Time           : 2015:09:20 13:25:40-07:00
File Inode Change Date/Time     : 2015:09:20 13:25:40-07:00
File Permissions                : rw-------
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
X Resolution                    : 72
Y Resolution                    : 72
Exif Byte Order                 : Big-endian (Motorola, MM)
Resolution Unit                 : inches
Y Cb Cr Positioning             : Centered
Copyright                       : h1d1ng_in_4lm0st_pla1n_sigh7
Image Width                     : 600
Image Height                    : 700
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 600x700
```

Looking at the copyright section
>Copyright                       : h1d1ng_in_4lm0st_pla1n_sigh7

you get the flag.

h1d1ng_in_4lm0st_pla1n_sigh7


text:
/*! \file
 *
 * \date Created on: 25.09.2017
 * \author jochen.ulrich
 */

#ifndef QTPROMISE_PROMISE_IMPL_H_
#define QTPROMISE_PROMISE_IMPL_H_

#include <cstddef>

namespace QtPromise {

template<typename ResolvedFunc, typename RejectedFunc, typename NotifiedFunc>
Promise::Ptr Promise::then(ResolvedFunc&& resolvedCallback, RejectedFunc&& rejectedCallback, NotifiedFunc&& notifiedCallback) const
{

#if __cplusplus >= 201703L
	static_assert(   std::is_same<ResolvedFunc, std::nullptr_t>::value
	              || std::is_invocable_r<void, ResolvedFunc, const QVariant&>::value
	              || std::is_invocable_r<QVariant, ResolvedFunc, const QVariant&>::value
	              || std::is_invocable_r<Promise::Ptr, ResolvedFunc, const QVariant&>::value,
	              "resolvedCallback must be invocable with a const QVariant& and return void, QVariant or Promise::Ptr "
	              "or it must be nullptr");
	static_assert(   std::is_same<RejectedFunc, std::nullptr_t>::value
	              || std::is_invocable_r<void, RejectedFunc, const QVariant&>::value
	              || std::is_invocable_r<QVariant, RejectedFunc, const QVariant&>::value
	              || std::is_invocable_r<Promise::Ptr, RejectedFunc, const QVariant&>::value,
		          "rejectedCallback must be invocable with a const QVariant& and return void, QVariant or Promise::Ptr "
		          "or it must be nullptr");
	static_assert(   std::is_same<NotifiedFunc, std::nullptr_t>::value
	              || std::is_invocable_r<void, NotifiedFunc, const QVariant&>::value
	              || std::is_invocable_r<QVariant, NotifiedFunc, const QVariant&>::value
	              || std::is_invocable_r<Promise::Ptr, NotifiedFunc, const QVariant&>::value,
		          "notifiedCallback must be invocable with a const QVariant& and return void, QVariant or Promise::Ptr "
		          "or it must be nullptr");
#endif

	switch(this->state())
	{
	case Deferred::Resolved:
		return callCallback(std::forward<ResolvedFunc>(resolvedCallback));
	case Deferred::Rejected:
		return callCallback(std::forward<RejectedFunc>(rejectedCallback));
	case Deferred::Pending:
	default:
		ChildDeferred::Ptr newDeferred = ChildDeferred::create(m_deferred);

		newDeferred->connectParent(m_deferred,       createCallbackWrapper(newDeferred.data(), std::forward<ResolvedFunc>(resolvedCallback), Deferred::Resolved),
		                                             createCallbackWrapper(newDeferred.data(), std::forward<RejectedFunc>(rejectedCallback), Deferred::Rejected),
		                                       createNotifyCallbackWrapper(newDeferred.data(), std::forward<NotifiedFunc>(notifiedCallback)));

		return create(newDeferred.staticCast<Deferred>());
	}
}

template<typename NullCallbackFunc, typename std::enable_if<std::is_same<NullCallbackFunc, std::nullptr_t>::value>::type*>
Promise::Ptr Promise::callCallback(NullCallbackFunc&&) const
{
	return create(m_deferred);
}

template<typename VoidCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<VoidCallbackFunc(const QVariant&)>::type, void>::value>::type*>
Promise::Ptr Promise::callCallback(VoidCallbackFunc&& func) const
{
	func(m_deferred->data());
	return create(m_deferred);
}

template<typename VariantCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<VariantCallbackFunc(const QVariant&)>::type, QVariant>::value>::type*>
Promise::Ptr Promise::callCallback(VariantCallbackFunc&& func) const
{
	QVariant newValue(func(m_deferred->data()));
	Deferred::Ptr newDeferred = Deferred::create();
	/* We always resolve the new deferred since returning a value from a RejectedFunc means
	 * "the problem has been resolved".
	 */
	newDeferred->resolve(newValue);
	return create(newDeferred);
}

template<typename PromiseCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<PromiseCallbackFunc(const QVariant&)>::type, Promise::Ptr>::value>::type*>
Promise::Ptr Promise::callCallback(PromiseCallbackFunc&& func) const
{
	return func(m_deferred->data());
}

template <typename NullCallbackFunc, typename std::enable_if<std::is_same<NullCallbackFunc, std::nullptr_t>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createCallbackWrapper(ChildDeferred* newDeferred, NullCallbackFunc, Deferred::State state)
{
	Q_ASSERT_X(state != Deferred::Pending, "Promise::createCallbackWrapper()", "state must not be Pending (this is a bug in QtPromise)");
	using namespace std::placeholders;

	if (state == Deferred::Resolved)
		return std::bind(&ChildDeferred::resolve, newDeferred, _1);
	else // state == Deferred::Rejected
		return std::bind(&ChildDeferred::reject, newDeferred, _1);
}

template <typename VoidCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<VoidCallbackFunc(const QVariant&)>::type, void>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createCallbackWrapper(ChildDeferred* newDeferred, VoidCallbackFunc func, Deferred::State state)
{
	Q_ASSERT_X(state != Deferred::Pending, "Promise::createCallbackWrapper()", "state must not be Pending (this is a bug in QtPromise)");
	if (state == Deferred::Resolved)
		return [newDeferred, func](const QVariant& data) {
		func(data);
		newDeferred->resolve(data);
	};
	else // state == Deferred::Rejected
		return [newDeferred, func](const QVariant& data) {
		func(data);
		newDeferred->reject(data);
	};
}

template<typename VariantCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<VariantCallbackFunc(const QVariant&)>::type, QVariant>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createCallbackWrapper(ChildDeferred* newDeferred, VariantCallbackFunc func, Deferred::State)
{
	return [newDeferred, func](const QVariant& data) {
		QVariant newValue = QVariant::fromValue(func(data));
		/* We always resolve the new deferred since returning a value from a RejectedFunc means
		 * "the problem has been resolved".
		 */
		newDeferred->resolve(newValue);
	};
}

template<typename PromiseCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<PromiseCallbackFunc(const QVariant&)>::type, Promise::Ptr>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createCallbackWrapper(ChildDeferred* newDeferred, PromiseCallbackFunc func, Deferred::State)
{
	return [newDeferred, func](const QVariant& data) {
		Deferred::Ptr intermedDeferred = func(data)->m_deferred;
		switch (intermedDeferred->state())
		{
		case Deferred::Resolved:
			newDeferred->resolve(intermedDeferred->data());
			break;
		case Deferred::Rejected:
			newDeferred->reject(intermedDeferred->data());
			break;
		case Deferred::Pending:
		default:
			// Disconnect and remove all previous parents
			newDeferred->removeParents(true);
			// The intermedDeferred is the new parent
			newDeferred->setParent(intermedDeferred);
			using namespace std::placeholders;
			newDeferred->connectParent(intermedDeferred, std::bind(&ChildDeferred::resolve, newDeferred, _1),
			                                             std::bind(&ChildDeferred::reject, newDeferred, _1),
			                                             std::bind(&ChildDeferred::notify, newDeferred, _1));
			break;
		}
	};
}

template <typename NullCallbackFunc, typename std::enable_if<std::is_same<NullCallbackFunc, std::nullptr_t>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createNotifyCallbackWrapper(ChildDeferred* newDeferred, NullCallbackFunc)
{
	using namespace std::placeholders;
	return std::bind(&ChildDeferred::notify, newDeferred, _1);
}

template <typename VoidCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<VoidCallbackFunc(const QVariant&)>::type, void>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createNotifyCallbackWrapper(ChildDeferred* newDeferred, VoidCallbackFunc func)
{
	return [newDeferred, func](const QVariant& data) {
		func(data);
		newDeferred->notify(data);
	};
}

template<typename VariantCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<VariantCallbackFunc(const QVariant&)>::type, QVariant>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createNotifyCallbackWrapper(ChildDeferred* newDeferred, VariantCallbackFunc func)
{
	return [newDeferred, func](const QVariant& data) {
		newDeferred->notify(func(data));
	};
}

template<typename PromiseCallbackFunc, typename std::enable_if<std::is_convertible<typename std::result_of<PromiseCallbackFunc(const QVariant&)>::type, Promise::Ptr>::value>::type*>
ChildDeferred::WrappedCallbackFunc Promise::createNotifyCallbackWrapper(ChildDeferred* newDeferred, PromiseCallbackFunc func)
{
	return [newDeferred, func](const QVariant& data) {
		Deferred::Ptr intermedDeferred = func(data)->m_deferred;
		switch (intermedDeferred->state())
		{
		case Deferred::Pending:
		{
			newDeferred->addParent(intermedDeferred);
			QObject::connect(intermedDeferred.data(), &Deferred::resolved, newDeferred, &Deferred::notify);
			QObject::connect(intermedDeferred.data(), &Deferred::notified, newDeferred, &Deferred::notify);
			break;
		}
		case Deferred::Resolved:
			newDeferred->notify(intermedDeferred->data());
			break;
		case Deferred::Rejected:
		default:
			break;
		}
	};
}

template<typename PromiseContainer>
Promise::Ptr Promise::all_impl(const PromiseContainer& promises)
{
	auto deferreds = deferredsOfPromises(promises);
	ChildDeferred::Ptr combinedDeferred = ChildDeferred::create(deferreds, true);

	QObject::connect(combinedDeferred.data(), &ChildDeferred::parentsResolved, combinedDeferred.data(), &Deferred::resolve);
	QObject::connect(combinedDeferred.data(), &ChildDeferred::parentRejected, combinedDeferred.data(), &Deferred::reject);

	return create(combinedDeferred);
}

template<typename PromiseContainer>
Promise::Ptr Promise::any_impl(const PromiseContainer& promises)
{
	auto deferreds = deferredsOfPromises(promises);
	ChildDeferred::Ptr combinedDeferred = ChildDeferred::create(deferreds, true);
	QObject::connect(combinedDeferred.data(), &ChildDeferred::parentResolved, combinedDeferred.data(), &Deferred::resolve);
	QObject::connect(combinedDeferred.data(), &ChildDeferred::parentsRejected, combinedDeferred.data(), &Deferred::reject);

	return create(combinedDeferred);
}

template<typename PromiseContainer>
Promise::Ptr Promise::whenFinished_impl(const PromiseContainer& promises)
{
	QList<Promise::Ptr> promiseList;
	for (Promise::Ptr promise : promises)
		promiseList.append(promise);

	auto deferreds = deferredsOfPromises(promises);
	ChildDeferred::Ptr combinedDeferred = ChildDeferred::create(deferreds, true);
	auto rawCombinedDeferred = combinedDeferred.data();
	QObject::connect(rawCombinedDeferred, &ChildDeferred::parentsFinished, rawCombinedDeferred, [rawCombinedDeferred, promiseList]() {
		rawCombinedDeferred->resolve(QVariant::fromValue(promiseList));
	});

	return create(combinedDeferred);
}

template<typename PromiseContainer>
QVector<Deferred::Ptr> Promise::deferredsOfPromises(const PromiseContainer& promises)
{
	QVector<Deferred::Ptr> deferreds;
	for (Promise::Ptr promise : promises)
		deferreds.append(promise->m_deferred);
	return deferreds;
}

} // namespace QtPromise

#endif /* QTPROMISE_PROMISE_IMPL_H_ */


text:
package service

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"net/http"

	"github.com/go-openapi/runtime"

	"github.com/cilium/cilium/api/v1/models"
)

// DeleteServiceIDOKCode is the HTTP code returned for type DeleteServiceIDOK
const DeleteServiceIDOKCode int = 200

/*DeleteServiceIDOK Success

swagger:response deleteServiceIdOK
*/
type DeleteServiceIDOK struct {
}

// NewDeleteServiceIDOK creates DeleteServiceIDOK with default headers values
func NewDeleteServiceIDOK() *DeleteServiceIDOK {
	return &DeleteServiceIDOK{}
}

// WriteResponse to the client
func (o *DeleteServiceIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.WriteHeader(200)
}

// DeleteServiceIDNotFoundCode is the HTTP code returned for type DeleteServiceIDNotFound
const DeleteServiceIDNotFoundCode int = 404

/*DeleteServiceIDNotFound Service not found

swagger:response deleteServiceIdNotFound
*/
type DeleteServiceIDNotFound struct {
}

// NewDeleteServiceIDNotFound creates DeleteServiceIDNotFound with default headers values
func NewDeleteServiceIDNotFound() *DeleteServiceIDNotFound {
	return &DeleteServiceIDNotFound{}
}

// WriteResponse to the client
func (o *DeleteServiceIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.WriteHeader(404)
}

// DeleteServiceIDFailureCode is the HTTP code returned for type DeleteServiceIDFailure
const DeleteServiceIDFailureCode int = 500

/*DeleteServiceIDFailure Service deletion failed

swagger:response deleteServiceIdFailure
*/
type DeleteServiceIDFailure struct {

	/*
	  In: Body
	*/
	Payload models.Error `json:"body,omitempty"`
}

// NewDeleteServiceIDFailure creates DeleteServiceIDFailure with default headers values
func NewDeleteServiceIDFailure() *DeleteServiceIDFailure {
	return &DeleteServiceIDFailure{}
}

// WithPayload adds the payload to the delete service Id failure response
func (o *DeleteServiceIDFailure) WithPayload(payload models.Error) *DeleteServiceIDFailure {
	o.Payload = payload
	return o
}

// SetPayload sets the payload to the delete service Id failure response
func (o *DeleteServiceIDFailure) SetPayload(payload models.Error) {
	o.Payload = payload
}

// WriteResponse to the client
func (o *DeleteServiceIDFailure) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.WriteHeader(500)
	payload := o.Payload
	if err := producer.Produce(rw, payload); err != nil {
		panic(err) // let the recovery middleware deal with this
	}

}


text:
'use strict';

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

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

var _coreFactoryMaker = require('../../core/FactoryMaker');

var _coreFactoryMaker2 = _interopRequireDefault(_coreFactoryMaker);

/**
 * @module ObjectUtils
 * @description Provides utility functions for objects
 */
function ObjectUtils() {

  var instance = undefined;

  /**
   * Returns true if objects resolve to the same string. Only really useful
   * when the user controls the object generation
   * @return {boolean}
   * @param {object} obj1
   * @param {object} obj2
   * @memberof module:ObjectUtils
   * @instance
   */
  function areSimpleEquivalent(obj1, obj2) {
    return JSON.stringify(obj1) === JSON.stringify(obj2);
  }

  instance = {
    areSimpleEquivalent: areSimpleEquivalent
  };

  return instance;
}

ObjectUtils.__dashjs_factory_name = 'ObjectUtils';
exports['default'] = _coreFactoryMaker2['default'].getSingletonFactory(ObjectUtils);
module.exports = exports['default'];
//# sourceMappingURL=ObjectUtils.js.map


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="DCP Setup Maker - release" default="release" basedir=".">

    <description>
        DevComPack Setup Maker Ant build file.
		Continous Integration online at https://travis-ci.org/DevComPack/setupmaker
    </description>

	<loadproperties srcfile="${basedir}/src/resources/app.properties" />

	<property name="target" location="${basedir}/target"/>
	<property name="jar_name" value="DCP-SNAPSHOT.jar"/>
	<property name="jar_name.out" value="dcpsetupmaker.jar"/>
	<property name="jar_file" value="${basedir}/${jar_name}"/>
	<property name="exe_name" value="dcpsetupmaker.exe"/>
	<property name="exe_name.out" value="DCPSM-${version}.exe"/>

	<property name="releases" value="${target}/dist"/>
	<property name="current_release" value="${releases}/DCP_${version}/"/>

	<property name="doc.dir" value="../gh-pages/doc"/>
	<property name="launch4j.dir" value="C:/bin/launch4j"/>

	<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask"
		classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />

	<target name="dcp.console" description="DCP console packaging" >
		<echo message="Starting.."/>
		<java jar="${basedir}/${jar_name}" fork="true" failonerror="true" maxmemory="256m">
			<arg value="${basedir}/saves/dcp.dcp"/>
		</java>
		<echo message="Complete"/>
	</target>

	<target name="exe" description="Generating exe file for jar" >
		<echo message="Generating exe file for jar"/>
		<launch4j configFile="${basedir}/dev/launch4j.xml" outfile="${basedir}/${exe_name}"
					fileVersion="${version}.0" txtFileVersion="${version}.0"
					productVersion="${version}.0" txtProductVersion="${version}.0" />
	</target>

	<target name="release" description="prepare release archive">
		<echo message="Release Package start"/>
		<mkdir dir="${releases}"/>
		<mkdir dir="${current_release}"/>
		<zip destfile="${current_release}/DCP-${version}.zip">
			<fileset dir="${basedir}" includes="lib/dcp/"/>
			<fileset dir="${basedir}" includes="res/bat/ res/langpacks/ res/xml/"/>
			<zipfileset dir="${basedir}" includes="${jar_name}" fullpath="DCPSM-${version}.jar"/>
			<zipfileset dir="${basedir}" includes="settings.json" fullpath="settings.json"/>
			<zipfileset dir="${basedir}" includes="README.md" fullpath="README"/>
			<zipfileset dir="${basedir}" includes="LICENSE" fullpath="LICENSE"/>
			<zipfileset dir="${basedir}" includes="res/release_notes.txt" fullpath="changelog.txt"/>
		</zip>
		<echo message="Release success"/>
	</target>

	<target name="release.win" description="prepare release archive for windows">
		<echo message="Generating exe file for jar"/>
		<launch4j>
			<config headerType="gui" outfile="${target}/${exe_name}"
					dontWrapJar="true" jarPath="${jar_name.out}"
					icon="${basedir}/res/dcpsm.ico" >
				<classPath mainClass="com.dcp.sm.App">
					<cp>dcpsetupmaker.jar</cp>
					<cp>lib/truezip-samples-7.7.1-jar-with-dependencies.jar</cp>
					<cp>lib/ant.jar</cp>
					<cp>lib/ant-launcher.jar</cp>
					<cp>lib/ant-apache-regexp.jar</cp>
					<cp>lib/ant-contrib.jar</cp>
					<cp>lib/bcel-5.2.jar</cp>
					<cp>lib/stax2-api-3.1.1.jar</cp>
					<cp>lib/staxmate-2.2.0.jar</cp>
					<cp>lib/woodstox-core-asl-4.1.5.jar</cp>
					<cp>lib/standalone-compiler.jar</cp>
					<cp>lib/json-simple-1.1.1.jar</cp>
					<cp>lib/jsch-0.1.50.jar</cp>
					<cp>lib/pivot-charts.jar</cp>
					<cp>lib/pivot-core.jar</cp>
					<cp>lib/pivot-wtk.jar</cp>
					<cp>lib/pivot-wtk-terra.jar</cp>
					<cp>lib/commons-io-2.4.jar</cp>
				</classPath>
				<jre minVersion="1.7.0_02" />
				<splash file="${basedir}/res/splash.bmp" waitForWindow="true" />
				<versionInfo fileVersion="${version}.0" txtFileVersion="${version}.0"
					productVersion="${version}.0" txtProductVersion="${version}.0"
					productName="${name}" companyName="DevComPack"
					fileDescription="${name}" originalFilename="${exe_name.out}"
					internalName="dcpsetupmaker" copyright="${username}" />
			</config>
		</launch4j>
		<echo message="Release Package start"/>
		<mkdir dir="${releases}"/>
		<mkdir dir="${current_release}"/>
		<zip destfile="${current_release}/DCP-${version}-win.zip">
			<fileset dir="${target}" includes="lib/ lib/dcp/"/>
			<fileset dir="${basedir}" includes="res/bat/ res/langpacks/ res/utils/ res/ps/ res/xml/"/>
			<zipfileset dir="${basedir}" includes="${jar_name}" fullpath="${jar_name.out}"/>
			<zipfileset dir="${target}" includes="${exe_name}" fullpath="${exe_name.out}"/>
			<zipfileset dir="${basedir}" includes="settings.json" fullpath="settings.json"/>
			<zipfileset dir="${basedir}" includes="README.md" fullpath="README"/>
			<zipfileset dir="${basedir}" includes="LICENSE" fullpath="LICENSE"/>
			<zipfileset dir="${basedir}" includes="res/release_notes.txt" fullpath="changelog.txt"/>
		</zip>
		<echo message="Windows Release success"/>
	</target>

	<target name="doc.clean" description="prepare documentation for publish">
		<replaceregexp byline="true">
			<regexp pattern="
Created with.*
"/>
			<substitution expression=""/>
			<fileset dir="${doc.dir}">
				<include name="*.html" />
				<exclude name="toc.html" />
				<exclude name="index.html" />
			</fileset>
		</replaceregexp>
	</target>

</project>


text:
class TestShapePopulationBase
{
public:
    TestShapePopulationBase();

    bool testBackgroundUnselectedColor(std::string filename);
};

#endif // TESTBACKGROUNDUNSELECTEDCOLOR_H


text:
<?php

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');
JHtml::_('jquery.framework'); // load jquery
JHtml::_('jquery.ui');

/**
 * Temas View
 */
class AngelgirlsViewinbox extends JViewLegacy
{
	/**
	 * Temas view display method
	 * @return void
	 */
	function display($tpl = null)
	{

		// Set the document
		$this->setDocument();

		// Set the toolbar
		$this->addToolBar();

		// Display the template
		parent::display($tpl);

	}

	/**
	 * Setting the toolbar
	 */
	protected function addToolBar()
	{

		$caixa = JRequest::getVar('caixa');
		$document = JFactory::getDocument();
		$pathway = JFactory::getApplication()->getPathway();
		$pathway->addItem('Inbox', JRoute::_('index.php?option=com_angelgirls&view=inbox&task=inboxMensagens'));

		//$document->setMetadata('content-language', 'pt-br');
		$document->setMetadata('APPLICATION-NAME','Angel Girls');

		$document->setTitle('Inbox - Mensagens');
		$document->setDescription('Inbox sua caixa de comuncação.');
		//$document->setMetadata('mensagens, mensagem, inbox');

	}

	/**
	 * Method to set up the document properties
	 *
	 *
	 * @return void
	 */
	protected function setDocument()
	{
		$document = JFactory::getDocument();
		//$document->setTitle(JText::_('Angelgirls Manager - Administrator'));
	}
}
?>


text:
// Copyright (c) Autofac Project. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace Autofac.Extras.AttributeMetadata.Test.ScenarioTypes.StrongTypedMetadataAttributeScenario
{
    public interface IStrongTypedScenarioMetadata
    {
        int Age { get; }

        string Name { get; }
    }
}


text:
<?php

$schema['em_subscribers_webhook']['allow'] = true;

return $schema;


text:
This is what I start with whencreating a new static website.

Don't forget to change your .gitignore once you branch.


text:
package androidx.wear.watchface.client;

/** Tests that Java interfaces implementing kotlin interfaces with defaults compile. */
public class JavaCompatTest {
    class ClientDisconnectListenerImpl implements
            InteractiveWatchFaceClient.ClientDisconnectListener {
        @Override
        @SuppressWarnings("deprecation")
        public void onClientDisconnected() {}
    }
}


text:
package org.elasticsearch.action.bench;

import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;

import java.io.IOException;

/**
 * Node-level response for the status of a benchmark abort request
 */
public class AbortBenchmarkNodeResponse extends ActionResponse implements Streamable, ToXContent {

    private String benchmarkName;
    private String nodeName;
    private String errorMessage;

    public AbortBenchmarkNodeResponse() { }

    public AbortBenchmarkNodeResponse(String benchmarkName, String nodeName) {
        this.benchmarkName = benchmarkName;
        this.nodeName = nodeName;
    }

    public void nodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public String nodeName() {
        return nodeName;
    }

    public String benchmarkName() {
        return benchmarkName;
    }

    public String errorMessage() {
        return errorMessage;
    }

    @Override
    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
        builder.field(Fields.NODE, nodeName);
        builder.field(Fields.NAME, benchmarkName);
        builder.field(Fields.ERRMSG, errorMessage);
        return builder;
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        super.readFrom(in);
        benchmarkName = in.readString();
        nodeName = in.readString();
        errorMessage = in.readOptionalString();
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        super.writeTo(out);
        out.writeString(benchmarkName);
        out.writeString(nodeName);
        out.writeOptionalString(errorMessage);
    }

    static final class Fields {
        static final XContentBuilderString NODE = new XContentBuilderString("node");
        static final XContentBuilderString NAME = new XContentBuilderString("benchmark_name");
        static final XContentBuilderString ERRMSG = new XContentBuilderString("error_message");
    }
}


text:
class CreateGcmRegistrations < ActiveRecord::Migration
  def change
    create_table :gcm_registrations do |t|
      t.string :token
    end
  end
end


text:
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)

ADD ./start.sh /start.sh
ADD ./check.sh /check.sh

COPY config-internal.sh config-external.sh /opt/kolla/

CMD ["/start.sh"]


text:
Monkey Nuts Framework
=====================

A Sass front end framework.


text:
require File.dirname(__FILE__) + "/../spec_helper"
require File.dirname(__FILE__) + "/../content_spec_helper"

describe ContentModel do
  include ContentSpecHelper

  reset_domain_tables :content_models,:content_model_fields,:content_model_features,:content_nodes,:content_types

  describe "Table Migration" do

    before(:each) do
      DataCache.reset_local_cache
      connect_to_migrator_database
      ContentModel.connection.execute('DROP TABLE IF EXISTS cms_spec_tests')
    end

    it "should be able to create a database table and a content type" do
      cm = ContentModel.create(:name => 'spec_test')
      cm.create_table # Should create a table

      ContentModel.connection.execute('DROP TABLE cms_spec_tests')
    end

    it "should correctly generate valid table names" do
      cm = ContentModel.create(:name => 'This---is a test of the emergency broadcast system')
      migrator_mock = mock("ContentMigrator",:update_up => nil, :migrate_domain => nil, :suppress_messages => nil)
      ContentMigrator.should_receive(:clone).at_least(:once).and_return(migrator_mock)
      cm.create_table # Should create a table

      cm.table_name.should == 'cms_this_is_a_test_of_the_emes'

      cm.name = 'My Model - List of things'
      cm.create_table
      cm.table_name.should == 'cms_my_model_list_of_things'

      cm.name = 'ALLUPPERCASE!!!'
      cm.create_table
      cm.table_name.should == 'cms_alluppercases'

      cm = ContentModel.create(:name => 'ALLUPPERCASE')

      cm.create_table
      cm.table_name.should == 'cms_alluppercase_2s'

    end

    it "should be able to add entries to the table (no fields, just id)" do
      cm = ContentModel.create(:name => 'spec_test')
      cm.create_table # Should create a table

      cls = cm.content_model

      entry = cls.create
      entry.id.should == 1

      cls.count.should == 1

      entry = cls.create
      cls.count.should == 2

      ContentModel.connection.execute('DROP TABLE cms_spec_tests')
    end

  end

  describe "Content Node Creation" do

    before(:each) do
     DataCache.reset_local_cache
     connect_to_migrator_database
     ContentModel.connection.execute('DROP TABLE IF EXISTS cms_spec_tests')
    end

    it "should create a content type and content nodes after save" do
      ContentType.count.should == 0
      @cm = create_spec_test_content_model
      ContentType.count.should == 1

      ContentNode.count.should == 0
      @cm.content_model.create
      ContentNode.count.should == 1
    end

    it "should destroy content nodes after updating content node" do
      ContentType.count.should == 0
      @cm = create_spec_test_content_model
      ContentType.count.should == 1

      ContentNode.count.should == 0
      @cm.content_model.create
      ContentNode.count.should == 1

      @cm = ContentModel.find(:last)
      @cm.create_nodes = false
      @cm.save

      ContentNode.count.should == 0
    end

    it "should destroy content nodes after setting create_nodes to false" do
      ContentType.count.should == 0
      @cm = create_spec_test_content_model
      ContentType.count.should == 1

      ContentNode.count.should == 0
      @cm.content_model.create
      ContentNode.count.should == 1

      @cm = ContentModel.find(:last)
      @cm.create_nodes = false
      @cm.save

      ContentNode.count.should == 0
    end

    it "should try to recreate content_nodes after setting create_nodes to true" do
      ContentType.count.should == 0
      @cm = create_spec_test_content_model(:create_nodes => false)
      ContentType.count.should == 1

      ContentNode.count.should == 0
      @cm.content_model.create
      @cm.content_model.create
      @cm.content_model.create
      ContentNode.count.should == 0

      @cm = ContentModel.find(:last)
      @cm.should_receive(:run_worker).with(:recreate_all_content_nodes)
      @cm.create_nodes = true
      @cm.save

      @cm = ContentModel.find(:last)
      @cm.recreate_all_content_nodes
      ContentNode.count.should == 3
    end

  end

end


text:
package org.apache.http.nio.protocol;

import org.apache.http.HttpRequest;
import org.apache.http.annotation.ThreadSafe;
import org.apache.http.protocol.UriPatternMatcher;
import org.apache.http.util.Args;

/**
 * Maintains a map of HTTP request handlers keyed by a request URI pattern.
 *

 * Patterns may have three formats:
 *

 *
*

 *
*<uri>

 *
<uri>*

 *

 *

 * This class can be used to map an instance of {@link HttpAsyncRequestHandler}
 * matching a particular request URI. Usually the mapped request handler
 * will be used to process the request with the specified request URI.
 *
 * @since 4.3
 */
@ThreadSafe
public class UriHttpAsyncRequestHandlerMapper implements HttpAsyncRequestHandlerMapper {

    private final UriPatternMatcher<HttpAsyncRequestHandler<?>> matcher;

    protected UriHttpAsyncRequestHandlerMapper(final UriPatternMatcher<HttpAsyncRequestHandler<?>> matcher) {
        super();
        this.matcher = Args.notNull(matcher, "Pattern matcher");
    }

    public UriHttpAsyncRequestHandlerMapper() {
        this(new UriPatternMatcher<HttpAsyncRequestHandler<?>>());
    }

    /**
     * Registers the given {@link HttpAsyncRequestHandler} as a handler for URIs
     * matching the given pattern.
     *
     * @param pattern the pattern to register the handler for.
     * @param handler the handler.
     */
    public void register(final String pattern, final HttpAsyncRequestHandler<?> handler) {
        matcher.register(pattern, handler);
    }

    /**
     * Removes registered handler, if exists, for the given pattern.
     *
     * @param pattern the pattern to unregister the handler for.
     */
    public void unregister(final String pattern) {
        matcher.unregister(pattern);
    }

    /**
     * Extracts request path from the given {@link HttpRequest}
     */
    protected String getRequestPath(final HttpRequest request) {
        String uriPath = request.getRequestLine().getUri();
        int index = uriPath.indexOf("?");
        if (index != -1) {
            uriPath = uriPath.substring(0, index);
        } else {
            index = uriPath.indexOf("#");
            if (index != -1) {
                uriPath = uriPath.substring(0, index);
            }
        }
        return uriPath;
    }

    /**
     * Looks up a handler matching the given request URI.
     *
     * @param request the request
     * @return handler or null if no match is found.
     */
    public HttpAsyncRequestHandler<?> lookup(final HttpRequest request) {
        return matcher.lookup(getRequestPath(request));
    }

}


text:
package instance

import (
	"bytes"

	bosherr "github.com/cloudfoundry/bosh-utils/errors"
)

func (vg SoftlayerVirtualGuestService) SetMetadata(id int, vmMetadata Metadata) error {
	tags, err := vg.extractTagsFromVMMetadata(vmMetadata)
	if err != nil {
		return bosherr.WrapError(err, "Extracting tags from vm metadata")
	}

	err = vg.softlayerClient.SetTags(id, tags)
	if err != nil {
		return bosherr.WrapErrorf(err, "Settings tags on virtualGuest '%d'", id)
	}

	return nil
}

func (vg SoftlayerVirtualGuestService) extractTagsFromVMMetadata(vmMetadata Metadata) (string, error) {
	var tagStringBuffer bytes.Buffer
	i := 0
	for key, value := range vmMetadata {
		stringValue, err := value.(string)
		if !err {
			return "", bosherr.Errorf("Converting tags metadata value `%v` to string failed", value)
		}
		tagStringBuffer.WriteString(key + ":" + stringValue)
		if i != len(vmMetadata)-1 {
			tagStringBuffer.WriteString(", ")
		}
		i += 1
	}

	return tagStringBuffer.String(), nil
}


text:
import cli
(output, error) = cli.run('echo hi')
print(output)
print(error)


text:
@interface MyMapTeachingArea : NSObject <Displayable>

@property (nonatomic) NSString *teachingArea;
@property (nonatomic) NSString *effectiveDate;
@property (nonatomic) NSString *expiredDate;
@property (nonatomic) NSString *name;
@property (nonatomic) NSString *academicUnitId;
@property (nonatomic) NSString *unitName;
@property (nonatomic) NSString *previousTeachingArea;
@property (nonatomic) NSString *dateTimeUpdated;
@property (nonatomic) NSString *updatedById;
@property (nonatomic) NSString *updatedByName;

+(MyMapTeachingArea *)teachingAreaWithDictionary:(NSDictionary *)dict;

@end


text:
package gobblin.util.request_allocation;

import java.util.Iterator;
import java.util.concurrent.Callable;

import com.google.common.base.Function;
import com.google.common.collect.Iterators;

import gobblin.util.iterators.InterruptibleIterator;

import javax.annotation.Nullable;
import lombok.extern.slf4j.Slf4j;

/**
 * A {@link RequestAllocator} that selects {@link Request}s without any order guarantees until the {@link ResourcePool}
 * is full, then stops. This allocator will mostly ignore the prioritizer.
 *
 * <p>
 *   This allocator is useful when there is no prioritization or fairness required. It is generally the fastest and least
 *   memory intensive implementation.
 * </p>
 */
@Slf4j
public class GreedyAllocator<T extends Request<T>> extends PriorityIterableBasedRequestAllocator<T> {

  public static class Factory implements RequestAllocator.Factory {
    @Override
    public <T extends Request<T>> RequestAllocator<T> createRequestAllocator(RequestAllocatorConfig<T> configuration) {
      return new GreedyAllocator<>(configuration);
    }
  }

  public GreedyAllocator(RequestAllocatorConfig<T> configuration) {
    super(log, configuration);
  }

  @Override
  protected Iterator<T> getJoinIterator(Iterator<? extends Requestor<T>> requestors,
      final ConcurrentBoundedPriorityIterable<T> requestIterable) {
    Iterator<T> unionIterator = Iterators.concat(Iterators.transform(requestors, new Function<Requestor<T>, Iterator<T>>() {
      @Nullable
      @Override
      public Iterator<T> apply(Requestor<T> input) {
        return input.iterator();
      }
    }));

    return new InterruptibleIterator<>(unionIterator, new Callable<Boolean>() {
      @Override
      public Boolean call()
          throws Exception {
        return requestIterable.isFull();
      }
    });
  }
}