text:
import {
  assign,
  find,
  isArray,
  without
} from 'min-dash';

import {
  getOrientation,
  getMid
} from './LayoutUtil';

import {
  pointInRect,
  pointDistance,
  pointsAligned,
  pointsOnLine
} from '../util/Geometry';

var MIN_SEGMENT_LENGTH = 20,
    POINT_ORIENTATION_PADDING = 5;

var round = Math.round;

var INTERSECTION_THRESHOLD = 20,
    ORIENTATION_THRESHOLD = {
      'h:h': 20,
      'v:v': 20,
      'h:v': -10,
      'v:h': -10
    };

function needsTurn(orientation, startDirection) {
  return !{
    t: /top/,
    r: /right/,
    b: /bottom/,
    l: /left/,
    h: /./,
    v: /./
  }[startDirection].test(orientation);
}

function canLayoutStraight(direction, targetOrientation) {
  return {
    t: /top/,
    r: /right/,
    b: /bottom/,
    l: /left/,
    h: /left|right/,
    v: /top|bottom/
  }[direction].test(targetOrientation);
}

function getSegmentBendpoints(a, b, directions) {
  var orientation = getOrientation(b, a, POINT_ORIENTATION_PADDING);

  var startDirection = directions.split(':')[0];

  var xmid = round((b.x - a.x) / 2 + a.x),
      ymid = round((b.y - a.y) / 2 + a.y);

  var segmentEnd, segmentDirections;

  var layoutStraight = canLayoutStraight(startDirection, orientation),
      layoutHorizontal = /h|r|l/.test(startDirection),
      layoutTurn = false;

  var turnNextDirections = false;

  if (layoutStraight) {
    segmentEnd = layoutHorizontal ? { x: xmid, y: a.y } : { x: a.x, y: ymid };

    segmentDirections = layoutHorizontal ? 'h:h' : 'v:v';
  } else {
    layoutTurn = needsTurn(orientation, startDirection);

    segmentDirections = layoutHorizontal ? 'h:v' : 'v:h';

    if (layoutTurn) {

      if (layoutHorizontal) {
        turnNextDirections = ymid === a.y;

        segmentEnd = {
          x: a.x + MIN_SEGMENT_LENGTH * (/l/.test(startDirection) ? -1 : 1),
          y: turnNextDirections ? ymid + MIN_SEGMENT_LENGTH : ymid
        };
      } else {
        turnNextDirections = xmid === a.x;

        segmentEnd = {
          x: turnNextDirections ? xmid + MIN_SEGMENT_LENGTH : xmid,
          y: a.y + MIN_SEGMENT_LENGTH * (/t/.test(startDirection) ? -1 : 1)
        };
      }

    } else {
      segmentEnd = {
        x: xmid,
        y: ymid
      };
    }
  }

  return {
    waypoints: getBendpoints(a, segmentEnd, segmentDirections).concat(segmentEnd),
    directions:  segmentDirections,
    turnNextDirections: turnNextDirections
  };
}

function getStartSegment(a, b, directions) {
  return getSegmentBendpoints(a, b, directions);
}

function getEndSegment(a, b, directions) {
  var invertedSegment = getSegmentBendpoints(b, a, invertDirections(directions));

  return {
    waypoints: invertedSegment.waypoints.slice().reverse(),
    directions: invertDirections(invertedSegment.directions),
    turnNextDirections: invertedSegment.turnNextDirections
  };
}

function getMidSegment(startSegment, endSegment) {

  var startDirection = startSegment.directions.split(':')[1],
      endDirection = endSegment.directions.split(':')[0];

  if (startSegment.turnNextDirections) {
    startDirection = startDirection == 'h' ? 'v' : 'h';
  }

  if (endSegment.turnNextDirections) {
    endDirection = endDirection == 'h' ? 'v' : 'h';
  }

  var directions = startDirection + ':' + endDirection;

  var bendpoints = getBendpoints(
    startSegment.waypoints[startSegment.waypoints.length - 1],
    endSegment.waypoints[0],
    directions
  );

  return {
    waypoints: bendpoints,
    directions: directions
  };
}

function invertDirections(directions) {
  return directions.split(':').reverse().join(':');
}

/**
 * Handle simple layouts with maximum two bendpoints.
 */
function getSimpleBendpoints(a, b, directions) {

  var xmid = round((b.x - a.x) / 2 + a.x),
      ymid = round((b.y - a.y) / 2 + a.y);

  // one point, right or left from a
  if (directions === 'h:v') {
    return [ { x: b.x, y: a.y } ];
  }

  // one point, above or below a
  if (directions === 'v:h') {
    return [ { x: a.x, y: b.y } ];
  }

  // vertical segment between a and b
  if (directions === 'h:h') {
    return [
      { x: xmid, y: a.y },
      { x: xmid, y: b.y }
    ];
  }

  // horizontal segment between a and b
  if (directions === 'v:v') {
    return [
      { x: a.x, y: ymid },
      { x: b.x, y: ymid }
    ];
  }

  throw new Error('invalid directions: can only handle varians of [hv]:[hv]');
}

/**
 * Returns the mid points for a manhattan connection between two points.
 *
 * @example h:h (horizontal:horizontal)
 *
 * [a]----[x]
 *         |
 *        [x]----[b]
 *
 * @example h:v (horizontal:vertical)
 *
 * [a]----[x]
 *         |
 *        [b]
 *
 * @example h:r (horizontal:right)
 *
 * [a]----[x]
 *         |
 *    [b]-[x]
 *
 * @param  {Point} a
 * @param  {Point} b
 * @param  {string} directions
 *
 * @return {Array<Point>}
 */
function getBendpoints(a, b, directions) {
  directions = directions || 'h:h';

  if (!isValidDirections(directions)) {
    throw new Error(
      'unknown directions: <' + directions + '>: ' +
      'must be specified as <start>:<end> ' +
      'with start/end in { h,v,t,r,b,l }'
    );
  }

  // compute explicit directions, involving trbl dockings
  // using a three segmented layouting algorithm
  if (isExplicitDirections(directions)) {
    var startSegment = getStartSegment(a, b, directions),
        endSegment = getEndSegment(a, b, directions),
        midSegment = getMidSegment(startSegment, endSegment);

    return [].concat(
      startSegment.waypoints,
      midSegment.waypoints,
      endSegment.waypoints
    );
  }

  // handle simple [hv]:[hv] cases that can be easily computed
  return getSimpleBendpoints(a, b, directions);
}

/**
 * Create a connection between the two points according
 * to the manhattan layout (only horizontal and vertical) edges.
 *
 * @param {Point} a
 * @param {Point} b
 *
 * @param {string} [directions='h:h'] specifies manhattan directions for each point as {adirection}:{bdirection}.
                   A directionfor a point is either `h` (horizontal) or `v` (vertical)
 *
 * @return {Array<Point>}
 */
export function connectPoints(a, b, directions) {

  var points = getBendpoints(a, b, directions);

  points.unshift(a);
  points.push(b);

  return withoutRedundantPoints(points);
}

/**
 * Connect two rectangles using a manhattan layouted connection.
 *
 * @param {Bounds} source source rectangle
 * @param {Bounds} target target rectangle
 * @param {Point} [start] source docking
 * @param {Point} [end] target docking
 *
 * @param {Object} [hints]
 * @param {string} [hints.preserveDocking=source] preserve docking on selected side
 * @param {Array<string>} [hints.preferredLayouts]
 * @param {Point|boolean} [hints.connectionStart] whether the start changed
 * @param {Point|boolean} [hints.connectionEnd] whether the end changed
 *
 * @return {Array<Point>} connection points
 */
export function connectRectangles(source, target, start, end, hints) {

  var preferredLayouts = hints && hints.preferredLayouts || [];

  var preferredLayout = without(preferredLayouts, 'straight')[0] || 'h:h';

  var threshold = ORIENTATION_THRESHOLD[preferredLayout] || 0;

  var orientation = getOrientation(source, target, threshold);

  var directions = getDirections(orientation, preferredLayout);

  start = start || getMid(source);
  end = end || getMid(target);

  var directionSplit = directions.split(':');

  // compute actual docking points for start / end
  // this ensures we properly layout only parts of the
  // connection that lies in between the two rectangles
  var startDocking = getDockingPoint(start, source, directionSplit[0], invertOrientation(orientation)),
      endDocking = getDockingPoint(end, target, directionSplit[1], orientation);

  return connectPoints(startDocking, endDocking, directions);
}

/**
 * Repair the connection between two rectangles, of which one has been updated.
 *
 * @param {Bounds} source
 * @param {Bounds} target
 * @param {Point} [start]
 * @param {Point} [end]
 * @param {Array<Point>} [waypoints]
 * @param {Object} [hints]
 * @param {Array<string>} [hints.preferredLayouts] list of preferred layouts
 * @param {boolean} [hints.connectionStart]
 * @param {boolean} [hints.connectionEnd]
 *
 * @return {Array<Point>} repaired waypoints
 */
export function repairConnection(source, target, start, end, waypoints, hints) {

  if (isArray(start)) {
    waypoints = start;
    hints = end;

    start = getMid(source);
    end = getMid(target);
  }

  hints = assign({ preferredLayouts: [] }, hints);
  waypoints = waypoints || [];

  var preferredLayouts = hints.preferredLayouts,
      preferStraight = preferredLayouts.indexOf('straight') !== -1,
      repairedWaypoints;

  // just layout non-existing or simple connections
  // attempt to render straight lines, if required

  // attempt to layout a straight line
  repairedWaypoints = preferStraight && tryLayoutStraight(source, target, start, end, hints);

  if (repairedWaypoints) {
    return repairedWaypoints;
  }

  // try to layout from end
  repairedWaypoints = hints.connectionEnd && tryRepairConnectionEnd(target, source, end, waypoints);

  if (repairedWaypoints) {
    return repairedWaypoints;
  }

  // try to layout from start
  repairedWaypoints = hints.connectionStart && tryRepairConnectionStart(source, target, start, waypoints);

  if (repairedWaypoints) {
    return repairedWaypoints;
  }

  // or whether nothing seems to have changed
  if (!hints.connectionStart && !hints.connectionEnd && waypoints && waypoints.length) {
    return waypoints;
  }

  // simply reconnect if nothing else worked
  return connectRectangles(source, target, start, end, hints);
}

function inRange(a, start, end) {
  return a >= start && a <= end;
}

function isInRange(axis, a, b) {
  var size = {
    x: 'width',
    y: 'height'
  };

  return inRange(a[axis], b[axis], b[axis] + b[size[axis]]);
}

/**
 * Layout a straight connection
 *
 * @param {Bounds} source
 * @param {Bounds} target
 * @param {Point} start
 * @param {Point} end
 * @param {Object} [hints]
 *
 * @return {Array<Point>|null} waypoints if straight layout worked
 */
export function tryLayoutStraight(source, target, start, end, hints) {
  var axis = {},
      primaryAxis,
      orientation;

  orientation = getOrientation(source, target);

  // only layout a straight connection if shapes are
  // horizontally or vertically aligned
  if (!/^(top|bottom|left|right)$/.test(orientation)) {
    return null;
  }

  if (/top|bottom/.test(orientation)) {
    primaryAxis = 'x';
  }

  if (/left|right/.test(orientation)) {
    primaryAxis = 'y';
  }

  if (hints.preserveDocking === 'target') {

    if (!isInRange(primaryAxis, end, source)) {
      return null;
    }

    axis[primaryAxis] = end[primaryAxis];

    return [
      {
        x: axis.x !== undefined ? axis.x : start.x,
        y: axis.y !== undefined ? axis.y : start.y,
        original: {
          x: axis.x !== undefined ? axis.x : start.x,
          y: axis.y !== undefined ? axis.y : start.y
        }
      },
      {
        x: end.x,
        y: end.y
      }
    ];

  } else {

    if (!isInRange(primaryAxis, start, target)) {
      return null;
    }

    axis[primaryAxis] = start[primaryAxis];

    return [
      {
        x: start.x,
        y: start.y
      },
      {
        x: axis.x !== undefined ? axis.x : end.x,
        y: axis.y !== undefined ? axis.y : end.y,
        original: {
          x: axis.x !== undefined ? axis.x : end.x,
          y: axis.y !== undefined ? axis.y : end.y
        }
      }
    ];
  }

}

/**
 * Repair a connection from start.
 *
 * @param {Bounds} moved
 * @param {Bounds} other
 * @param {Point} newDocking
 * @param {Array<Point>} points originalPoints from moved to other
 *
 * @return {Array<Point>|null} the repaired points between the two rectangles
 */
function tryRepairConnectionStart(moved, other, newDocking, points) {
  return _tryRepairConnectionSide(moved, other, newDocking, points);
}

/**
 * Repair a connection from end.
 *
 * @param {Bounds} moved
 * @param {Bounds} other
 * @param {Point} newDocking
 * @param {Array<Point>} points originalPoints from moved to other
 *
 * @return {Array<Point>|null} the repaired points between the two rectangles
 */
function tryRepairConnectionEnd(moved, other, newDocking, points) {
  var waypoints = points.slice().reverse();

  waypoints = _tryRepairConnectionSide(moved, other, newDocking, waypoints);

  return waypoints ? waypoints.reverse() : null;
}

/**
 * Repair a connection from one side that moved.
 *
 * @param {Bounds} moved
 * @param {Bounds} other
 * @param {Point} newDocking
 * @param {Array<Point>} points originalPoints from moved to other
 *
 * @return {Array<Point>} the repaired points between the two rectangles
 */
function _tryRepairConnectionSide(moved, other, newDocking, points) {

  function needsRelayout(points) {
    if (points.length < 3) {
      return true;
    }

    if (points.length > 4) {
      return false;
    }

    // relayout if two points overlap
    // this is most likely due to
    return !!find(points, function(p, idx) {
      var q = points[idx - 1];

      return q && pointDistance(p, q) < 3;
    });
  }

  function repairBendpoint(candidate, oldPeer, newPeer) {

    var alignment = pointsAligned(oldPeer, candidate);

    switch (alignment) {
    case 'v':

      // repair horizontal alignment
      return { x: newPeer.x, y: candidate.y };
    case 'h':

      // repair vertical alignment
      return { x: candidate.x, y: newPeer.y };
    }

    return { x: candidate.x, y: candidate. y };
  }

  function removeOverlapping(points, a, b) {
    var i;

    for (i = points.length - 2; i !== 0; i--) {

      // intersects (?) break, remove all bendpoints up to this one and relayout
      if (pointInRect(points[i], a, INTERSECTION_THRESHOLD) ||
          pointInRect(points[i], b, INTERSECTION_THRESHOLD)) {

        // return sliced old connection
        return points.slice(i);
      }
    }

    return points;
  }

  // (0) only repair what has layoutable bendpoints

  // (1) if only one bendpoint and on shape moved onto other shapes axis
  //     (horizontally / vertically), relayout

  if (needsRelayout(points)) {
    return null;
  }

  var oldDocking = points[0],
      newPoints = points.slice(),
      slicedPoints;

  // (2) repair only last line segment and only if it was layouted before

  newPoints[0] = newDocking;
  newPoints[1] = repairBendpoint(newPoints[1], oldDocking, newDocking);

  // (3) if shape intersects with any bendpoint after repair,
  //     remove all segments up to this bendpoint and repair from there
  slicedPoints = removeOverlapping(newPoints, moved, other);

  if (slicedPoints !== newPoints) {
    newPoints = _tryRepairConnectionSide(moved, other, newDocking, slicedPoints);
  }

  // (4) do NOT repair if repaired bendpoints are aligned
  if (newPoints && pointsAligned(newPoints)) {
    return null;
  }

  return newPoints;
}

/**
 * Returns the manhattan directions connecting two rectangles
 * with the given orientation.
 *
 * Will always return the default layout, if it is specific
 * regarding sides already (trbl).
 *
 * @example
 *
 * getDirections('top'); // -> 'v:v'
 * getDirections('intersect'); // -> 't:t'
 *
 * getDirections('top-right', 'v:h'); // -> 'v:h'
 * getDirections('top-right', 'h:h'); // -> 'h:h'
 *
 *
 * @param {string} orientation
 * @param {string} defaultLayout
 *
 * @return {string}
 */
function getDirections(orientation, defaultLayout) {

  // don't override specific trbl directions
  if (isExplicitDirections(defaultLayout)) {
    return defaultLayout;
  }

  switch (orientation) {
  case 'intersect':
    return 't:t';

  case 'top':
  case 'bottom':
    return 'v:v';

  case 'left':
  case 'right':
    return 'h:h';

  // 'top-left'
  // 'top-right'
  // 'bottom-left'
  // 'bottom-right'
  default:
    return defaultLayout;
  }
}

function isValidDirections(directions) {
  return directions && /^h|v|t|r|b|l:h|v|t|r|b|l$/.test(directions);
}

function isExplicitDirections(directions) {
  return directions && /t|r|b|l/.test(directions);
}

function invertOrientation(orientation) {
  return {
    'top': 'bottom',
    'bottom': 'top',
    'left': 'right',
    'right': 'left',
    'top-left': 'bottom-right',
    'bottom-right': 'top-left',
    'top-right': 'bottom-left',
    'bottom-left': 'top-right',
  }[orientation];
}

function getDockingPoint(point, rectangle, dockingDirection, targetOrientation) {

  // ensure we end up with a specific docking direction
  // based on the targetOrientation, if <h|v> is being passed

  if (dockingDirection === 'h') {
    dockingDirection = /left/.test(targetOrientation) ? 'l' : 'r';
  }

  if (dockingDirection === 'v') {
    dockingDirection = /top/.test(targetOrientation) ? 't' : 'b';
  }

  if (dockingDirection === 't') {
    return { original: point, x: point.x, y: rectangle.y };
  }

  if (dockingDirection === 'r') {
    return { original: point, x: rectangle.x + rectangle.width, y: point.y };
  }

  if (dockingDirection === 'b') {
    return { original: point, x: point.x, y: rectangle.y + rectangle.height };
  }

  if (dockingDirection === 'l') {
    return { original: point, x: rectangle.x, y: point.y };
  }

  throw new Error('unexpected dockingDirection: <' + dockingDirection + '>');
}

/**
 * Return list of waypoints with redundant ones filtered out.
 *
 * @example
 *
 * Original points:
 *
 *   [x] ----- [x] ------ [x]
 *                         |
 *                        [x] ----- [x] - [x]
 *
 * Filtered:
 *
 *   [x] ---------------- [x]
 *                         |
 *                        [x] ----------- [x]
 *
 * @param  {Array<Point>} waypoints
 *
 * @return {Array<Point>}
 */
export function withoutRedundantPoints(waypoints) {
  return waypoints.reduce(function(points, p, idx) {

    var previous = points[points.length - 1],
        next = waypoints[idx + 1];

    if (!pointsOnLine(previous, next, p, 0)) {
      points.push(p);
    }

    return points;
  }, []);
}


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

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>xierpa3 — Xierpa 3 0.1 documentation</title>

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

    <link rel="top" title="Xierpa 3 0.1 documentation" href="index.html" />

Navigation

          index

          modules |

Xierpa 3 0.1 documentation »

xierpa3¶

xierpa3 package

Subpackages

xierpa3.adapters package

Subpackages

Submodules

xierpa3.adapters.adapter module

xierpa3.adapters.adaptertester module

xierpa3.adapters.blurbadapter module

xierpa3.adapters.dynamodbadapter module

xierpa3.adapters.phpadapter module

xierpa3.adapters.s3adapter module

xierpa3.adapters.simpledbadapter module

xierpa3.adapters.sqladapter module

xierpa3.adapters.textilefileadapter module

Module contents

xierpa3.apps package

Module contents

xierpa3.attributes package

Submodules

xierpa3.attributes.attribute module

xierpa3.attributes.frames module

xierpa3.attributes.gradient module

xierpa3.attributes.shadow module

xierpa3.attributes.transition module

xierpa3.attributes.url module

xierpa3.attributes.values module

Module contents

xierpa3.builders package

Subpackages

Submodules

xierpa3.builders.angularbuilder module

xierpa3.builders.builder module

xierpa3.builders.cssbuilder module

xierpa3.builders.htmlbuilder module

xierpa3.builders.indesignbuilder module

xierpa3.builders.javascriptbuilder module

xierpa3.builders.phpbuilder module

xierpa3.builders.sassbuilder module

Module contents

xierpa3.components package

Subpackages

Submodules

xierpa3.components.article module

xierpa3.components.column module

xierpa3.components.component module

xierpa3.components.container module

xierpa3.components.documentation module

xierpa3.components.footer module

xierpa3.components.googletranslate module

xierpa3.components.graph module

xierpa3.components.group module

xierpa3.components.header module

xierpa3.components.logo module

xierpa3.components.menu module

xierpa3.components.message module

xierpa3.components.navigation module

xierpa3.components.nothing module

xierpa3.components.page module

xierpa3.components.ruler module

xierpa3.components.sidebar module

xierpa3.components.socialmedia module

xierpa3.components.springgraph module

xierpa3.components.tagcloud module

xierpa3.components.text module

xierpa3.components.theme module

xierpa3.components.title module

Module contents

xierpa3.constants package

Subpackages

Submodules

xierpa3.constants.constants module

Module contents

xierpa3.contributions package

Subpackages

Module contents

xierpa3.descriptors package

Submodules

xierpa3.descriptors.blueprint module

xierpa3.descriptors.environment module

xierpa3.descriptors.media module

xierpa3.descriptors.state module

xierpa3.descriptors.style module

Module contents

xierpa3.imaging package

Submodules

xierpa3.imaging.color module

Module contents

xierpa3.sandbox package

Subpackages

Module contents

xierpa3.server package

Subpackages

Submodules

xierpa3.server.client module

xierpa3.server.server module

Module contents

xierpa3.sites package

Subpackages

Module contents

xierpa3.themes package

Subpackages

Module contents

xierpa3.toolbox package

Subpackages

Submodules

xierpa3.toolbox.coloring module

xierpa3.toolbox.dating module

xierpa3.toolbox.fileio module

xierpa3.toolbox.formdict module

xierpa3.toolbox.stack module

xierpa3.toolbox.transformer module

Module contents

Module contents

This Page

Show Source

Quick search

    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

Xierpa 3 0.1 documentation »

        © Copyright 2014, Petr van Blokland, Michiel Kauw-A-Tjoe, Kirsten Langmuur..
      Created using Sphinx 1.2.3.

redpajama_set_name: RedPajamaGithub


text:
PROJECT := XY
PACKAGE := xy
SOURCES := Makefile setup.py $(shell find $(PACKAGE) -name '*.py')

ENV := env
DEPENDS_CI := $(ENV)/.depends.ci
DEPENDS_DEV := $(ENV)/.depends.dev
EGG_INFO := $(subst -,_,$(PROJECT)).egg-info

PLATFORM := $(shell python -c 'import sys; print(sys.platform)')

ifneq ($(findstring win32, $(PLATFORM)), )
	SYS_PYTHON := C:\\Python33\\python.exe
	SYS_VIRTUALENV := C:\\Python33\\Scripts\\virtualenv.exe
	BIN := $(ENV)/Scripts
	EXE := .exe
	OPEN := cmd /c start
	# https://bugs.launchpad.net/virtualenv/+bug/449537
	export TCL_LIBRARY=C:\\Python33\\tcl\\tcl8.5
else
	SYS_PYTHON := python3
	SYS_VIRTUALENV := virtualenv
	BIN := $(ENV)/bin
	ifneq ($(findstring cygwin, $(PLATFORM)), )
		OPEN := cygstart
	else
		OPEN := open
	endif
endif

MAN := man
SHARE := share

PYTHON := $(BIN)/python$(EXE)
PIP := $(BIN)/pip$(EXE)
RST2HTML := $(BIN)/rst2html.py
PDOC := $(BIN)/pdoc
PEP8 := $(BIN)/pep8$(EXE)
PEP257 := $(BIN)/pep257$(EXE)
PYLINT := $(BIN)/pylint$(EXE)
NOSE := $(BIN)/nosetests$(EXE)

# Installation ###############################################################

.PHONY: all
all: env

.PHONY: env
env: .virtualenv $(EGG_INFO)
$(EGG_INFO): Makefile setup.py
	$(PYTHON) setup.py develop
	touch $(EGG_INFO)  # flag to indicate package is installed

.PHONY: .virtualenv
.virtualenv: $(PIP)
$(PIP):
	$(SYS_VIRTUALENV) --python $(SYS_PYTHON) $(ENV)

.PHONY: depends
depends: .depends-ci .depends-dev

.PHONY: .depends-ci
.depends-ci: .virtualenv Makefile $(DEPENDS_CI)
$(DEPENDS_CI): Makefile
	$(PIP) install pep8 pep257 nose coverage
	touch $(DEPENDS_CI)  # flag to indicate dependencies are installed

.PHONY: .depends-dev
.depends-dev: .virtualenv Makefile $(DEPENDS_DEV)
$(DEPENDS_DEV): Makefile
	$(PIP) install docutils pdoc pylint wheel
	touch $(DEPENDS_DEV)  # flag to indicate dependencies are installed

# Documentation ##############################################################

.PHONY: doc
doc: readme apidocs

.PHONY: readme
readme: .depends-ci docs/README-github.html docs/README-pypi.html
docs/README-github.html: README.md
	pandoc -f markdown_github -t html -o docs/README-github.html README.md
docs/README-pypi.html: README.rst
	$(PYTHON) $(RST2HTML) README.rst docs/README-pypi.html
README.rst: README.md
	pandoc -f markdown_github -t rst -o README.rst README.md

.PHONY: apidocs
apidocs: .depends-ci apidocs/$(PACKAGE)/index.html
apidocs/$(PACKAGE)/index.html: $(SOURCES)
	$(PYTHON) $(PDOC) --html --overwrite $(PACKAGE) --html-dir apidocs

.PHONY: read
read: doc
	$(OPEN) apidocs/$(PACKAGE)/index.html
	$(OPEN) docs/README-pypi.html
	$(OPEN) docs/README-github.html

# Static Analysis ############################################################

.PHONY: pep8
pep8: env .depends-ci
	$(PEP8) $(PACKAGE) --ignore=E501

.PHONY: pep257
pep257: env .depends-ci
	$(PEP257) $(PACKAGE) --ignore=E501

.PHONY: pylint
pylint: env .depends-ci
	$(PYLINT) $(PACKAGE) --reports no \
	                     --msg-template="{msg_id}:{line:3d},{column}:{msg}" \
	                     --max-line-length=79 \
	                     --disable=I0011,W0142,W0511,R0801

.PHONY: check
check: pep8 pep257 pylint

# Testing ####################################################################

.PHONY: test
test: env .depends-ci
	$(NOSE)

.PHONY: tests
tests: env .depends-ci
	TEST_INTEGRATION=1 $(NOSE) --verbose --stop --cover-package=$(PACKAGE)

.PHONY: ci
ci: pep8 pep257 test tests

# Cleanup ####################################################################

.PHONY: clean
clean: .clean-dist .clean-test .clean-doc .clean-build

.PHONY: clean-all
clean-all: clean .clean-env

.PHONY: .clean-env
.clean-env:
	rm -rf $(ENV)

.PHONY: .clean-build
.clean-build:
	find $(PACKAGE) -name '*.pyc' -delete
	find $(PACKAGE) -name '__pycache__' -delete
	rm -rf *.egg-info

.PHONY: .clean-doc
.clean-doc:
	rm -rf apidocs docs/README*.html README.rst

.PHONY: .clean-test
.clean-test:
	rm -rf .coverage

.PHONY: .clean-dist
.clean-dist:
	rm -rf dist build

# Release ####################################################################

.PHONY: .git-no-changes
.git-no-changes:
	@if git diff --name-only --exit-code;         \
	then                                          \
		echo Git working copy is clean...;        \
	else                                          \
		echo ERROR: Git working copy is dirty!;   \
		echo Commit your changes and try again.;  \
		exit -1;                                  \
	fi;

.PHONY: dist
dist: .git-no-changes env depends check test tests doc
	$(PYTHON) setup.py sdist
	$(PYTHON) setup.py bdist_wheel
	$(MAKE) read

.PHONY: upload
upload: .git-no-changes env depends doc
	$(PYTHON) setup.py register sdist upload
	$(PYTHON) setup.py bdist_wheel upload
	$(MAKE) dev  # restore the development environment

.PHONY: dev
dev:
	python setup.py develop


text:
'use strict';

// Configuring the Articles module
angular.module('cars').run(['Menus',
  function (Menus) {
    // Add the cars dropdown item
    Menus.addMenuItem('topbar', {
      title: 'Cars',
      state: 'cars',
      type: 'dropdown',
      roles: ['*']
    });

    // Add the dropdown list item
    Menus.addSubMenuItem('topbar', 'cars', {
      title: 'List Cars',
      state: 'cars.list'
    });

    // Add the dropdown create item
    Menus.addSubMenuItem('topbar', 'cars', {
      title: 'Create Cars',
      state: 'cars.create',
      roles: ['user']
    });
  }
]);


text:
layout: page
title: Resume
permalink: /resume/
---

>  Generalist Software Engineer, experienced in full stacked development experience,
>  in search of new challenge.

----

Education
---------

2010-2012 (No Graduation)
:   **MSC, Computer Science**; Bilkent University (Ankara/Turkey)

    *Thesis title: Software Architectural Analysis of Simulation Systems*

2005-2010
:   **BSc, Computer Science**; Bilkent University
     (Ankara/Turkey)

    *CGPA: 3.12*

Experience
----------

**Onur Inc. (July 2014-):**

* Developed Rest Webservice Framework with Python and Flask

* Full Stacked Development with Backbone.js, Django and Node.js

**KorvusSoft (April 2013- July 2014):**

* Involved in design and development of Zettabahn project. Zettabahn   offers big data platform that accepts incoming stream of tupples to make analytic operations and stores them in distributed fashion. It uses Hadoop for DFS, HBase as NoSQL solution, Twitter Storm for distributed stream processing.

* Worked on design and development of Social AD which is a Social Media Advertising Application which targets thousands of users. Developed both UI and backend of the system, as well as database design. I designed software models, database design and architecture of the system.

* Worked as a part of the team for development of Cloud Social Media Monitoring application. This application has a multi-tenant architecture and has sub-units like Scoring Social Media Users. I developed Webservices for serving both as provinding data to UI and as storing data into Hbase for backend of the application. I developed distributed Stream processing infrastructure of the system using open source Storm library. Besides I also developed User Interface using Ruby on Rails.

* Developed Question and Answer platform using Ruby on Rails and Postgresql. This application is developed in a very short period of time and maintained according to the needs of the client.

* Developed a Mass E-Mailing service using Ruby on Rails, Icewarp Mail Server and Mysql. This application can handle the operation of sending 100.000 emails daily.

**Meteksan Defense Inc. (June 2010- April 2013):**

As a software engineer, I was a part of team that developed one of the most important Naval Simulation
System projects in Turkey.:

* Designed and Developed System Model and Inventory Generator using C++, QT and Oracle DB

* Designed and Developed Scenario Generation Tool using C++, QT and Oracle DB

* Involved in development of Analysis and Report Tool using C#, C++, QT, DevExpress, Oracle DB and Sqlite

* Designed and Developed Employee Evaluation Application using PHP and Mysql

* Designed and Developed Employee Satisfaction Survey with abilities of reporting using Python, Django and Sqlite

* Designed and Developed ERP application for Business Development Division using PHP and Mysql

Technical Experience
--------------------

Technical Tools
:   **Programming Languages:** Java, C/C++, C#, Ruby, Python, PHP, JavaScript

:   **Libraries:** JUnit, Boost, QT, Ruby on Rails, Django, Primefaces, Storm, Devexpress, OpenCV, Jquery, Backbone.js, Node.js

:   **Database:** Oracle 11g R2, Mysql, Postgresql, Sqlite, Nosql(Hbase)

:   **Operating Systems:** Linux(Redhat, Centos, Fedora, Ubuntu), Windows(98-Windows 8)

:	**Web Servers:** Apache, Nginx, Tomcat, Thin, Unicorn

:   **Source Control:** Git, Mercurial, SVN

:   **Technical Tools:** Eclipse, Netbeans, VIM, Sublime Text, Enterprise Architect

:   **Software Methodlogies:** Object Oriented, Aspect Oriented and Model Driven Software Development, Big Data and Distributed Computing

:   **Miscellaneous:** Memcached, Redis, Flask, RabbitMq

[ref]: https://github.com/githubuser/superlongprojectname

Side Projects
--------------------

turkishsixpacks
:   turkishsixpacks.com, an online magazine for Fitness and Aesthetics enthusiasts. I personally wrote and translated over 100 articles and interviewed more than 20 athletes. [link](http://www.turkishsixpacks.com)

    * Works on Wordpress CMS

bireyselantrenor
:    Web Application for Personal Trainers Developed with **Ruby on Rails**, **Jquery**, **Mysql** and **HTML5**
    (with [link](http://bireyselantrenor.com))

Image Recognition Tool
:    Application for detecting static objects from moving Camera and moving objects from static camera. Developed with **C++**, **OpenCV** and **Matlab**

Awards and Certifications
---------

2010-2012
:   Tuition scholarship during graduate study by Bilkent University

2005-2010
:   Full scholarship during undergraduate study by Bilkent University

2005
:	Among top 500 students in University Entrance Exam

Additional Skills and Interests
----------------------------------------

* Spoken Languages:

     * Turkish (native speaker)
     * English (Fluent)
     * German (Basic)

* Weight Lifting. Fitness

* Blogging, writing, reading about Technology

----

> <aytugmurataydin@gmail.com> • +90 (533) 716 5329 • 27 years old\
> Address - Ankara, TURKEY


text:
package org.kidneyomics.fluidigm;

public class AlignArgs {

	private int numGatkThreads;

	public int getNumGatkThreads() {
		return numGatkThreads;
	}

	public void setNumGatkThreads(int numGatkThreads) {
		this.numGatkThreads = numGatkThreads;
	}

	private String primerList;

	public String getPrimerList() {
		return primerList;
	}

	public void setPrimerList(String primerList) {
		this.primerList = primerList;
	}

}


text:
const keystone = require('keystone');
const transform = require('model-transform');

const Types = keystone.Field.Types;
const Area = new keystone.List('Area');

Area.add({
   name: { type: String, initial: true, required: true, index: true },
   location: { type: Types.Location },
});

Area.relationship({ ref: 'Mission', path: 'missions', refPath: 'area' });

transform.toJSON(Area);

Area.register();


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\REFERRALS */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'REFERRAL_NAME')->textInput(['maxlength' => 60]) ?>

    <?= $form->field($model, 'ADDRESS')->textInput(['maxlength' => 60]) ?>

    <?= $form->field($model, 'CITY')->textInput(['maxlength' => 45]) ?>

    <?= $form->field($model, 'STATE')->textInput(['maxlength' => 45]) ?>

    <?= $form->field($model, 'ZIP')->textInput(['maxlength' => 45]) ?>

    <?= $form->field($model, 'EMAIL')->textInput(['maxlength' => 45]) ?>

    <?= $form->field($model, 'PHONE')->textInput(['maxlength' => 45]) ?>

    <?= $form->field($model, 'COMMENTS')->textarea(['rows' => 6]) ?>

        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
from distutils.core import setup

setup(name='mimic',
      version='0.0.2',
      py_modules=['mimic', 'stubout'],
      url='http://code.google.com/p/pymox/',
      maintainer='Gavin McQuillan',
      maintainer_email='gavin dot mcquillan at {gmail.com}',
      license='Apache License, Version 2.0',
      description='Mock object framework',
      long_description='''Mimic is based on Mox, a mock object framework
for Python based (in turn) on the Java mock object framework EasyMock.''',
      )


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>
O3D Canvas
</title>

O3D Canvas Sample


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

<title>Graphic_Canvas</title>
<meta name="date" content="2014-07-23">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

depauw.edu.myro.android.sandbox

Class Graphic_Canvas

java.lang.Object

Activity

depauw.edu.myro.android.sandbox.Graphic_Canvas

public class Graphic_Canvas
extends Activity

Builds the canvas activity which uses the drawing view functionality. Allows
 users to draw shapes on a canvas and add photos. In order to take a picture
 using the scribbler robot, there must be scribbler connected

 Used tutorial from
 http://www.c-sharpcorner.com/UploadFile/e14021/capture-image
 -from-camera-and-selecting-image-from-gallery-o/ to allow the application to
 access the android camera and gallery

Version:

Summer 2014

Author:

Leonora Bresette Buccino and Alexander Miller

Constructor Summary

Constructors

Constructor and Description

Graphic_Canvas()

Method Summary

Methods

Modifier and Type
Method and Description

boolean
dispatchKeyEvent(KeyEvent event)

Used to help maintain clean activity across the app.

void
onClick(View view)

Initialize the on click method for the given view.

boolean
onCreateOptionsMenu(Menu menu)

Initialize the contents of the option menu

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Graphic_Canvas

public Graphic_Canvas()

Method Detail

onCreateOptionsMenu

public boolean onCreateOptionsMenu(Menu menu)

Initialize the contents of the option menu

onClick

public void onClick(View view)

Initialize the on click method for the given view. This controls the
 creation of the shapes on the canvas by controlling the buttons.

dispatchKeyEvent

public boolean dispatchKeyEvent(KeyEvent event)

Used to help maintain clean activity across the app. If someone is
 connected to the Scribbler, they should disconnect before leaving the
 app. This function ensures that happens.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
var keystone = require('keystone'),
	async = require('async');

var User = keystone.list('User');

exports = module.exports = function(req, res) {

	var view = new keystone.View(req, res),
		locals = res.locals;

	locals.section = 'tools';

	// Keep it secret, keep it safe

	if (!req.user || req.user && !req.user.isAdmin) {
		console.warn('===== ALERT =====');
		console.warn('===== A non-admin attempted to access the Notification Center =====');
		return res.redirect('/');
	}

	// Notify all Babylon subscribers

	view.on('post', { action: 'notify.subscriber' }, function(next) {
		if (!locals.subscribers) {
			req.flash('warning', 'There aren\'t any subscribers at the moment' );
			return next();
		} else {
			async.each(locals.subscribers, function(subscriber, doneSubscriber) {
				new keystone.Email('member-notification').send({
					subscriber: subscriber,
					subject: req.body.subscriber_email_subject || 'Notification from Babylon',
					content: req.body.subscriber_email_content,
					link_label: req.body.subscriber_email_link_label,
					link_url: req.body.subscriber_email_link_url,
					to: subscriber.email,
					from: {
						name: 'Babylon',
						email: 'hello@babylon.com'
					}
				}, doneSubscriber);
			}, function(err) {
				if (err) {
					req.flash('error', 'There was an error sending the emails, please check the logs for more info.');
					console.error("===== Failed to send subscriber emails =====");
					console.error(err);
				} else {
					req.flash('success', 'Email sent to ' + keystone.utils.plural(locals.subscribers.length, '* subscriber'));
				}
				next();
			});
		}
	});

	view.render(keystone.lang + '/tools/notification-center');

}


text:
package com.yubico.bitcoin.soft;

import com.google.bitcoin.core.ECKey;
import com.google.bitcoin.core.Sha256Hash;
import com.google.bitcoin.crypto.ChildNumber;
import com.google.bitcoin.crypto.DeterministicHierarchy;
import com.google.bitcoin.crypto.DeterministicKey;
import com.google.bitcoin.crypto.HDKeyDerivation;
import com.yubico.bitcoin.api.*;
import org.spongycastle.asn1.sec.SECNamedCurves;
import org.spongycastle.asn1.x9.X9ECParameters;
import org.spongycastle.math.ec.ECPoint;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;

/**
 * This is a software implementation of YkneoBitcoin which is meant to be used for testing purposed only!
 *
 * It will allow you to test interop with YkneoBitcoin without requiring a physical YubiKey NEO with the applet.
 */
public class YkneoBitcoinSoft implements YkneoBitcoin {
    private static final String VERSION = "0.1.0";
    private static final int DEFAULT_PIN_TRIES = 6;

    private final SecureRandom random = new SecureRandom();

    private DeterministicHierarchy master;

    private String userPin = "000000";
    private String adminPin = "00000000";
    private boolean allowExport = false;

    private int userMaxRetries = DEFAULT_PIN_TRIES;
    private int adminMaxRetries = DEFAULT_PIN_TRIES;
    private int userTries = userMaxRetries;
    private int adminTries = adminMaxRetries;
    private boolean userLocked = true;
    private boolean adminLocked = true;

    public YkneoBitcoinSoft() {
    }

    @Override
    public byte[] exportExtendedPublicKey() throws PinModeLockedException, IOException, OperationNotPermittedException, NoKeyLoadedException {
        ensurePin(PinMode.ADMIN);
        ensureKey();
        if(!allowExport) {
            throw new OperationNotPermittedException();
        }
        return master.getRootKey().serializePublic();
    }

    @Override
    public String getAppletVersion() {
        return VERSION;
    }

    @Override
    public boolean isKeyLoaded() {
        return master != null;
    }

    @Override
    public void unlockUser(String pin) throws IncorrectPINException, IOException {
        if (userPin.equals(pin)) {
            userLocked = false;
            userTries = userMaxRetries;
            return;
        } else if (userTries > 0) {
            userTries--;
        }
        userLocked = true;
        throw new IncorrectPINException(PinMode.USER, userTries);
    }

    @Override
    public void unlockAdmin(String pin) throws IncorrectPINException, IOException {
        if (adminPin.equals(pin)) {
            adminLocked = false;
            adminTries = adminMaxRetries;
            return;
        } else if (adminTries > 0) {
            adminTries--;
        }
        adminLocked = true;
        throw new IncorrectPINException(PinMode.ADMIN, adminTries);
    }

    @Override
    public boolean isUserUnlocked() {
        return !userLocked;
    }

    @Override
    public boolean isAdminUnlocked() {
        return !adminLocked;
    }

    @Override
    public void setUserPin(String oldPin, String newPin) throws IncorrectPINException, IOException {
        unlockUser(oldPin);
        userPin = newPin;
    }

    @Override
    public void setAdminPin(String oldPin, String newPin) throws IncorrectPINException, IOException {
        unlockAdmin(oldPin);
        adminPin = newPin;
    }

    private void ensurePin(PinMode mode) throws PinModeLockedException {
        switch (mode) {
            case USER:
                if (isUserUnlocked()) {
                    return;
                }
                break;
            case ADMIN:
                if (isAdminUnlocked()) {
                    return;
                }
                break;
        }
        throw new PinModeLockedException(mode);
    }

    @Override
    public void resetUserPin(String newPin) throws PinModeLockedException, IOException {
        ensurePin(PinMode.ADMIN);
        userPin = newPin;
        userTries = userMaxRetries;
    }

    private void ensureKey() throws NoKeyLoadedException {
        if (master == null) {
            throw new NoKeyLoadedException();
        }
    }

    @Override
    public byte[] getHeader() throws PinModeLockedException, IOException, NoKeyLoadedException {
        ensurePin(PinMode.USER);
        ensureKey();
        byte[] header = new byte[13];
        System.arraycopy(master.getRootKey().serializePrivate(), 0, header, 0, 13);
        return header;
    }

    private DeterministicKey getKey(int... index) throws PinModeLockedException, NoKeyLoadedException {
        ensurePin(PinMode.USER);
        ensureKey();
        List<ChildNumber> path = new ArrayList<ChildNumber>();
        for(int i : index) {
            if((i & 0x80000000) != 0) {
                path.add(new ChildNumber(i & 0x7fffffff, true));
            } else {
                path.add(new ChildNumber(i, false));
            }
        }

        return master.get(path, true, true);
    }

    @Override
    public void setAdminRetryCount(int attempts) throws PinModeLockedException, IOException {
        ensurePin(PinMode.ADMIN);
        adminMaxRetries = attempts;
        adminTries = adminMaxRetries;
    }

    @Override
    public void setUserRetryCount(int attempts) throws PinModeLockedException, IOException {
        ensurePin(PinMode.USER);
        userMaxRetries = attempts;
        userTries = userMaxRetries;
    }

    @Override
    public byte[] getPublicKey(boolean compress, int... index) throws PinModeLockedException, UnusableIndexException, IOException, NoKeyLoadedException {
        DeterministicKey key = getKey(index);
        X9ECParameters params = SECNamedCurves.getByName("secp256k1");
        ECPoint point = params.getCurve().decodePoint(key.toECKey().getPubKey());
        point = new ECPoint.Fp(point.getCurve(), point.getX(), point.getY(), compress);
        return point.getEncoded();
    }

    @Override
    public byte[] sign(byte[] hash, int... index) throws PinModeLockedException, UnusableIndexException, IOException, NoKeyLoadedException {
        DeterministicKey key = getKey(index);
        ECKey.ECDSASignature signature = key.toECKey().sign(new Sha256Hash(hash));
        return signature.encodeToDER();
    }

    @Override
    public byte[] generateMasterKeyPair(boolean allowExport, boolean returnPrivateKey, boolean testnetKey) throws PinModeLockedException, IOException {
        ensurePin(PinMode.ADMIN);
        master = new DeterministicHierarchy(HDKeyDerivation.createMasterPrivateKey(random.generateSeed(32)));
        this.allowExport = allowExport;
        return returnPrivateKey ? master.getRootKey().serializePrivate() : new byte[0];
    }

    @Override
    public void importExtendedKeyPair(byte[] extendedPrivateKey, boolean allowExport) throws PinModeLockedException, IOException {
        ensurePin(PinMode.ADMIN);
        byte[] privkey = new byte[33];
        byte[] chaincode = new byte[32];
        System.arraycopy(extendedPrivateKey, 13, chaincode, 0, 32);
        System.arraycopy(extendedPrivateKey, 45, privkey, 0, 33);

        master = new DeterministicHierarchy(HDKeyDerivation.createMasterPrivKeyFromBytes(privkey, chaincode));
        this.allowExport = allowExport;
    }
}


text:
Az SG tuning célja, hogy funkcióival kényelmesebbé varázsolja az sg.hu-n történő böngészést.

## Letöltés

**Chrome:** [Chrome internetes áruház](https://chrome.google.com/webstore/detail/sg-fórum-tuning/hlppljcclmahjmaegnhcaefknenohnck)

**Opera:** [Opera-kiegészítők](https://addons.opera.com/hu/extensions/details/sg-forum-tuning/)

**Firefox:** [Firefox kiegészítők](https://addons.mozilla.org/hu/firefox/addon/sg-f%C3%B3rum-tuning/)

**Maxthon:** Maxthon mappában lévő .mxaddon-t letöltitek, behúzzátok maxthonba, majd megnyitás gombra nyomtok és telepítitek a kiegészítőt. [link](https://raw.githubusercontent.com/JimMorrison723/SG.hu-Extension/master/Maxthon/Sg-tuning.mxaddon)

## A bővítmény funkciói

- Chat elrejtése
- 'Ugrás az utolsó olvasatlan üzenethez' több oldalon keresztül
- Csak olvasatlan üzenettel rendelkező kedvencek mutatása [Ötlet: Malakai]
- Rövid kommentjelzők
- Egyéni tiltólista [Ötlet: cSuwwi]
- Egyedi megjelenés pár helyen
- Az oldal aljára érve automatikusan előtölti a következő oldal kommentjeit
- Navigációs gombok a topikokban
- Animált válaszerre üzenet lenyitás
- Overlay commentbox
- Nekem érkező üzenetek kiemelése
- Üzenetek szálonkénti elrendezése
- Említett kommentek beidézése
- Oldalsáv blokkok átrendezése, rejtése
- Kedvencek automatikus frissítése
- Összes topik olvasottnak jelölése
- Reklámok eltávolítása
- WYSIWYG Editor [Ötlet: tomsolo]
- Smilek típusuk szerinti csoportosítása
- Topic fehérlista
- Üzenetközpont
- Topikba érkező üzenetek automatikus kinyerése
- Felhasználói profilcsoportok
- Beállítások szinkronizálása
- Topikon belül lekérhető a felhasználó adatlapja
- Gyors beszúrás: Vágólapról bemásolt linkeket/képeket autómatikusan BBCODE-ok közé illeszti

### Készítők

Fejlesztő:

- Gera János "dzsani", http://kreaturamedia.com
- JimMorrison723, http://jimmorrison723.hu

Közreműködők:

- Viszt Péter "passatgt", http://visztpeter.me
- Krupa György "pyro", http://kreaturamedia.com


text:
import { protractor } from 'protractor';

import { scenarioLifeCycleNotifier } from './cucumber_serenity_notifier';
import { synchronise } from './webdriver_synchroniser';

export = function() {

    this.registerListener(scenarioLifeCycleNotifier());

    synchronise(this, protractor.browser.driver.controlFlow());
};


text:
package org.apereo.cas.config;

import lombok.extern.slf4j.Slf4j;
import org.apereo.cas.authentication.AuthenticationServiceSelectionPlan;
import org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy;
import org.apereo.cas.authentication.AuthenticationServiceSelectionStrategyConfigurer;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * This is {@link CasCoreAuthenticationServiceSelectionStrategyConfiguration}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@Configuration("casCoreAuthenticationServiceSelectionStrategyConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
@Slf4j
public class CasCoreAuthenticationServiceSelectionStrategyConfiguration implements AuthenticationServiceSelectionStrategyConfigurer {

    @Override
    public void configureAuthenticationServiceSelectionStrategy(final AuthenticationServiceSelectionPlan plan) {
        plan.registerStrategy(new DefaultAuthenticationServiceSelectionStrategy());
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>T62119442628349952</title>
  <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600">
  <link rel="stylesheet" href="/style.css">
  <link rel="stylesheet" href="/custom.css">

  <link rel="alternate" type="application/rss+xml" title="Des Paroz" href="http://desparoz.me/feed.xml" />
  <link rel="alternate" type="application/json" title="Des Paroz" href="http://desparoz.me/feed.json" />
  <link rel="EditURI" type="application/rsd+xml" href="/rsd.xml" />

  <link rel="me" href="https://micro.blog/desparoz" />

  	<link rel="me" href="https://twitter.com/desparoz" />

  	<link rel="me" href="https://github.com/desparoz" />

  <link rel="authorization_endpoint" href="https://indieauth.com/auth" />
  <link rel="token_endpoint" href="https://tokens.indieauth.com/token" />
  <link rel="micropub" href="https://micro.blog/micropub" />
  <link rel="webmention" href="https://micro.blog/webmention" />

    Des Paroz

    <time class="dt-published" datetime="2011-04-24 21:43:00 +1000">24 Apr 2011</time>

I'm at Kammadhenu Malaysian/Indian (171 King St, O'Connell Street, Sydney) 4sq.com/fm2Es6


text:
package code.gen.entity;

import code.gen.entity.base.BaseVariable;

/**
 * Created by LiuXunming on 2014-07-22.
 */
public class OneToMany extends BaseVariable {
    private String mappedBy;

    public String getMappedBy() {
        return mappedBy;
    }

    public void setMappedBy(String mappedBy) {
        this.mappedBy = mappedBy;
    }
}


text:
package com.melvin.share.adapter;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.melvin.share.R;
import com.melvin.share.databinding.ReceiveAddressItemBinding;
import com.melvin.share.databinding.SearchProductItemBinding;
import com.melvin.share.model.BaseModel;
import com.melvin.share.model.Product;
import com.melvin.share.model.User;
import com.melvin.share.modelview.item.ManageAddressItemViewModel;
import com.melvin.share.modelview.item.SearchProductItemViewModel;

import java.util.List;

/**
 * Author: Melvin
 *

 * Data: 2017/4/4
 *

 * 描述: 搜索出商品来的页面Adapter
 */
public class SearchProductAdapter extends BaseAdapter<SearchProductAdapter.BindingHolder> {
    private List<BaseModel> list;
    private Context context;

    public SearchProductAdapter(Context context, List<BaseModel> list) {
        this.list = list;
        this.context = context;
    }

    @Override
    public SearchProductAdapter.BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        SearchProductItemBinding binding = DataBindingUtil.inflate(
                LayoutInflater.from(parent.getContext()),
                R.layout.search_product_item,
                parent,
                false);
        return new BindingHolder(binding);
    }

    @Override
    public void onBindViewHolder(BindingHolder holder, int position) {
        holder.bindObject((Product) list.get(position));
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    /**
     * Holder
     */
    public class BindingHolder extends RecyclerView.ViewHolder {
        final SearchProductItemBinding binding;

        public BindingHolder(SearchProductItemBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }

        void bindObject(final Product bean) {
            if (binding.getViewModel() == null) {
                binding.setViewModel(new SearchProductItemViewModel(context, bean));
            } else {
                binding.getViewModel().setEntity(bean);
            }
        }
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using FacetedWorlds.Reversi.Model;
using FacetedWorlds.Reversi.GameLogic;
using UpdateControls;
using FacetedWorlds.Reversi.NavigationModels;

namespace FacetedWorlds.Reversi.Client.NavigationModels
{
    public class LocalGameState
    {
        private LocalGame _game;
        private MainNavigationModel _mainNavigation;

        private GameBoard _priorBoardRaw;
        private GameBoard _gameBoardRaw;
        private Dependent _depGameBoardRaw;

        private GameBoard _priorBoard;
        private GameBoard _gameBoard;
        private Dependent _depGameBoard;

        private GameBoard _previewBoard;
        private Dependent _depPreviewBoard;

        private static int _updateCount = 0;

        public LocalGameState(LocalGame game, MainNavigationModel mainNavigation)
        {
            _game = game;
            _mainNavigation = mainNavigation;

            _depGameBoardRaw = new Dependent(UpdateGameBoardRaw);
            _depGameBoard = new Dependent(UpdateGameBoard);
            _depPreviewBoard = new Dependent(UpdatePreviewBoard);
        }

        public LocalGame Game
        {
            get { return _game; }
        }

        public PieceColor MyColor
        {
            get
            {
                GameBoard gameBoard = GetGameBoard();
                return gameBoard != null ? gameBoard.ToMove : PieceColor.Empty;
            }
        }

        public PieceColor ToMove
        {
            get
            {
                GameBoard previewBoard = GetPreviewBoard();
                return previewBoard.ToMove;
            }
        }

        public bool Resigned
        {
            get
            {
                return
                    _game != null &&
                    _game.Outcome != null &&
                    _game.Outcome.Winner != null &&
                    _game.Outcome.Resigned == 1;
            }
        }

        public bool BlackWon
        {
            get
            {
                return
                    _game != null &&
                    _game.Outcome != null &&
                    _game.Outcome.Winner != null &&
                    _game.Outcome.Resigned != 1 &&
                    _game.Outcome.Winner.Index == 0;
            }
        }

        public bool WhiteWon
        {
            get
            {
                return
                    _game != null &&
                    _game.Outcome != null &&
                    _game.Outcome.Winner != null &&
                    _game.Outcome.Resigned != 1 &&
                    _game.Outcome.Winner.Index == 1;
            }
        }

        public bool Draw
        {
            get
            {
                return
                    _game != null &&
                    _game.Outcome != null &&
                    _game.Outcome.Winner == null;
            }
        }

        public PieceColor PieceAt(Square square)
        {
            GameBoard gameBoard = GetGameBoard();
            return gameBoard == null ? PieceColor.Empty : gameBoard.PieceAt(square);
        }

        public bool IsPriorMove(Square square)
        {
            GameBoard gameBoard = GetGameBoard();
            GameBoard priorBoard = GetPriorBoard();
            return
                _mainNavigation.PreviewMove == null &&
                priorBoard.PieceAt(square) == PieceColor.Empty &&
                gameBoard.PieceAt(square) != PieceColor.Empty;
        }

        public bool IsPriorCapture(Square square)
        {
            GameBoard gameBoard = GetGameBoard();
            GameBoard priorBoard = GetPriorBoard();
            return
                _mainNavigation.PreviewMove == null &&
                priorBoard.PieceAt(square) != PieceColor.Empty &&
                gameBoard.PieceAt(square) != priorBoard.PieceAt(square);
        }

        public bool IsPreviewCapture(Square square)
        {
            GameBoard gameBoard = GetGameBoard();
            GameBoard previewBoard = GetPreviewBoard();
            return
                _mainNavigation.PreviewMove != square &&
                gameBoard.PieceAt(square) != previewBoard.PieceAt(square);
        }

        public bool IsPreviewCede(Square square)
        {
            GameBoard previewBoard = GetPreviewBoard();
            return
                previewBoard.LegalMoves.Contains(square);
        }

        public int BlackCount
        {
            get
            {
                GameBoard gameBoard = GetPreviewBoard();
                return gameBoard.BlackCount;
            }
        }

        public int WhiteCount
        {
            get
            {
                GameBoard gameBoard = GetPreviewBoard();
                return gameBoard.WhiteCount;
            }
        }

        public bool SetPreviewMove(Square square)
        {
            GameBoard gameBoard = GetGameBoard();
            if (square != null && !gameBoard.LegalMoves.Contains(square))
                square = null;
            if (!Object.Equals(_mainNavigation.PreviewMove, square))
            {
                _mainNavigation.PreviewMove = square;
                return square != null;
            }
            return false;
        }

        public void MakeMove(Square square)
        {
            _mainNavigation.PreviewMove = null;
            GameBoard gameBoard = GetGameBoard();
            if (_mainNavigation.PendingMove == null && gameBoard.LegalMoves.Contains(square))
            {
                _mainNavigation.PendingMoveIndex = gameBoard.MoveIndex;
                _mainNavigation.PendingMove = square;
            }
        }

        public bool IsMovePending
        {
            get { return _mainNavigation.PendingMove != null; }
        }

        public void CommitMove()
        {
            if (_mainNavigation.PendingMove != null)
            {
                GameBoard priorBoard = GetPriorBoard();
                int playerIndexToMove = priorBoard.ToMove == PieceColor.Black ? 0 : 1;
                LocalPlayer playerToMove = _game.Players.FirstOrDefault(player => player.Index == playerIndexToMove);
                if (playerToMove != null)
                {
                    playerToMove.MakeMove(_mainNavigation.PendingMoveIndex, _mainNavigation.PendingMove.Index);
                    _mainNavigation.PendingMove = null;

                    GameBoard gameBoard = GetGameBoard();
                    if (gameBoard.ToMove == PieceColor.Empty)
                    {
                        int blackCount = gameBoard.BlackCount;
                        int whiteCount = gameBoard.WhiteCount;
                        if (blackCount > whiteCount)
                            _game.DeclareWinner(_game.Players.Single(p => p.Index == 0), false);
                        else if (blackCount < whiteCount)
                            _game.DeclareWinner(_game.Players.Single(p => p.Index == 1), false);
                        else
                            _game.DeclareWinner(null, false);
                    }
                }
            }
        }

        public void CancelMove()
        {
            if (_mainNavigation.PendingMove != null)
            {
                _mainNavigation.PendingMove = null;
            }
        }

        private void UpdateGameBoardRaw()
        {
            _priorBoardRaw = GameBoard.OpeningPosition;
            _gameBoardRaw = GameBoard.OpeningPosition;
            if (_game != null)
            {
                List<LocalMove> moves = _game.Moves.ToList();
                moves.Sort(new LocalMoveComparer());
                int expectedIndex = 0;
                foreach (LocalMove move in moves)
                {
                    if (move.Index != expectedIndex)
                        return;
                    if (move.Player.Index == 0 && _gameBoardRaw.ToMove != PieceColor.Black)
                        return;
                    if (move.Player.Index == 1 && _gameBoardRaw.ToMove != PieceColor.White)
                        return;

                    Square square = Square.FromIndex(move.Square);
                    if (!_gameBoardRaw.LegalMoves.Contains(square))
                        return;

                    _priorBoardRaw = _gameBoardRaw;
                    _gameBoardRaw = _priorBoardRaw.AfterMove(square);
                    ++expectedIndex;
                }
            }
        }

        private void UpdateGameBoard()
        {
            _depGameBoardRaw.OnGet();
            _priorBoard = _priorBoardRaw;
            _gameBoard = _gameBoardRaw;

            if (_mainNavigation.PendingMove != null && _gameBoard.LegalMoves.Contains(_mainNavigation.PendingMove))
            {
                _priorBoard = _gameBoard;
                _gameBoard = _priorBoard.AfterMove(_mainNavigation.PendingMove);
            }
        }

        private void UpdatePreviewBoard()
        {
            System.Diagnostics.Debug.WriteLine("UpdatePreviewBoard " + ++_updateCount);
            GameBoard gameBoard = GetGameBoard();
            if (_mainNavigation.PreviewMove != null && gameBoard.LegalMoves.Contains(_mainNavigation.PreviewMove))
                _previewBoard = gameBoard.AfterMove(_mainNavigation.PreviewMove);
            else
                _previewBoard = gameBoard;
        }

        private GameBoard GetGameBoard()
        {
            _depGameBoard.OnGet();
            return _gameBoard;
        }

        private GameBoard GetPriorBoard()
        {
            _depGameBoard.OnGet();
            return _priorBoard;
        }

        private GameBoard GetPreviewBoard()
        {
            _depPreviewBoard.OnGet();
            return _previewBoard;
        }

        public override bool Equals(object obj)
        {
            if (obj == this)
                return true;
            LocalGameState that = obj as LocalGameState;
            if (that == null)
                return false;
            return this._game.Equals(that._game);
        }

        public override int GetHashCode()
        {
            return _game.GetHashCode();
        }
    }
}


text:
void PDStateDestroy(PDStateRef state)
{
    PDInteger i;
    if (state->symbols) {
        for (i = state->symbols-1; i >= 0; i--) {
            //printf("releasing %s :: %s (symop)\n", state->name, state->symbol[i]);
            free(state->symbol[i]);
            PDRelease(state->symbolOp[i]);
        }
        free(state->symbol);
        free(state->symbolOp);
    }

    if (state->symindex)
        free(state->symindex);

    PDRelease(state->delimiterOp);
    PDRelease(state->numberOp);
    PDRelease(state->fallbackOp);
    free(state->name);
}

PDStateRef PDStateCreate(char *name)
{
    PDStateRef state = PDAllocTyped(PDInstanceTypeState, sizeof(struct PDState), PDStateDestroy, true);
    state->name = strdup(name);
    return state;
}

void PDStateDefineSymbolOperator(PDStateRef state, const char *symbol, PDOperatorRef op)
{
    PDInteger syms = state->symbols;
    state->symbols++;
    state->symbol = realloc(state->symbol, sizeof(char*) * state->symbols);
    state->symbolOp = realloc(state->symbolOp, sizeof(PDOperatorRef) * state->symbols);
    state->symbol[syms] = strdup(symbol);
    state->symbolOp[syms] = PDRetain(op);
}

void PDStateDefineNumberOperator(PDStateRef state, PDOperatorRef op)
{
    if (state->numberOp) PDRelease(state->numberOp);
    state->numberOp = PDRetain(op);
}

void PDStateDefineDelimiterOperator(PDStateRef state, PDOperatorRef op)
{
    if (state->delimiterOp) PDRelease(state->delimiterOp);
    state->delimiterOp = PDRetain(op);
}

void PDStateDefineFallbackOperator(PDStateRef state, PDOperatorRef op)
{
    if (state->fallbackOp) PDRelease(state->fallbackOp);
    state->fallbackOp = PDRetain(op);
}

void PDStateDefineOperatorsWithDefinition(PDStateRef state, const void **defs)
{
    PDOperatorRef op;
    const char *c;
    PDInteger i = 0;
    while (defs[i]) {
        c = defs[i++];

        op = PDOperatorCreateFromDefinition((const void **)defs[i++]);
        switch (c[0]) {
            case 'F': // fallback operator
                PDStateDefineFallbackOperator(state, op);
                break;
            case 'D': // delimiter operator
                PDStateDefineDelimiterOperator(state, op);
                break;
            case 'N': // number operator
                PDStateDefineNumberOperator(state, op);
                break;
            case 'S': // symbol operator
                PDStateDefineSymbolOperator(state, &c[1], op);
                break;
            default: // ???
                PDAssert(0); // undefined operator type
                break;
        }
        PDRelease(op);
    }
}

void PDStateCompile(PDStateRef state)
{
    PDInteger i, j;
    if (state->symindex) return; // already compiled

    PDInteger symbols = state->symbols;
    short *hashes = calloc(symbols, sizeof(short));

    PDInteger slen;
    char *sym;
    short hash;
    for (i = 0; i < symbols; i++) {
        hash = 0;
        sym = state->symbol[i];
        slen = strlen(sym);
        for (j = 0; j < slen; j++)
            hash -= (PDOperatorSymbolGlob[(unsigned char)sym[j]] - 1) * sym[j];
        hashes[i] = 10 * abs(hash) + slen;
    }

    // we want to define the symindex as 2^n >= symbols with minimal collision and minimal n
    PDInteger n = 2;
    PDInteger m;
    while (n < symbols) n <<= 1;    // weak to (very) big symbol tables

    short coll = 0;
    PDInteger *index;
    do {
        m = n - 1;

        // n = e.g. 64 = 1000000
        // m = e.g. 63 = 0111111

        index = calloc(n, sizeof(PDInteger));
        for (i = 0; i < symbols; i++) {
            hash = hashes[i] & m;
            if (index[hash]) {
                coll++;
                while (hash < n && index[hash]) hash++;
                if (hash == n) {
                    coll = n;
                    hash = 0;
                    i = symbols;
                }
            }
            index[hash] = i+1;
        }
        if (coll + symbols <= n) break;
        free(index);
        n <<= 1;
    } while (true);
    free(hashes);

    state->symindices = n;
    state->symindex = index;

    for (i = state->symbols - 1; i >= 0; i--) {
        PDOperatorCompileStates(state->symbolOp[i]);
    }
    if (state->delimiterOp) PDOperatorCompileStates(state->delimiterOp);
    if (state->fallbackOp)  PDOperatorCompileStates(state->fallbackOp);
    if (state->numberOp)    PDOperatorCompileStates(state->numberOp);
}


text:
jQuery(function($) {
  var $bodyEl = $('body'),
      $sidedrawerEl = $('#sidedrawer');

  function showSidedrawer() {
    // show overlay
    var options = {
      onclose: function() {
        $sidedrawerEl
          .removeClass('active')
          .appendTo(document.body);
      }
    };

    var $overlayEl = $(mui.overlay('on', options));

    // show element
    $sidedrawerEl.appendTo($overlayEl);
    setTimeout(function() {
      $sidedrawerEl.addClass('active');
    }, 20);
  }

  function hideSidedrawer() {
    $bodyEl.toggleClass('hide-sidedrawer');
  }

  $('.js-show-sidedrawer').on('click', showSidedrawer);
  $('.js-hide-sidedrawer').on('click', hideSidedrawer);

  // get menu clicks
    $(function(){
        $(document).on('click','a',function(){
            var id = $(this).attr('id');
            menuItems.parent().removeClass("active")
            $(this).addClass("active");
        })
    })
    var topMenu = $("#sidedrawer-list"),
    topOffset = $("header").outerHeight(),
    // All list items
    menuItems = topMenu.find("a"),
    // Anchors corresponding to menu items
    scrollItems = menuItems.map(function(){
      var item = $($(this).attr("href"));
      if (item.length) { return item; }
    });

    // Bind to scroll
    $(window).scroll(function(){
       // Get container scroll position
       var fromTop = $(this).scrollTop();

       // Get id of current scroll item
       var curDist = 100000;
       var cur = this;
       scrollItems.each(function(i, el){
        var newDist = el.offset().top - fromTop;
         if (newDist < curDist && newDist >= 0){
             curDist = newDist;
             cur = el;
         }
       });
       // Get the id of the current element
       var id = cur && cur.length ? cur[0].id : "";
       // Set/remove active class
       menuItems
         .parent().removeClass("active")
         .end().filter("[href='#"+id+"']").parent().addClass("active");
    });

});


text:
Qlearning::Qlearning()
{
    //ctor
}

Qlearning::Qlearning(int initialPosition, std::string aName, int savedRewardSize, int environmentSize, double alphaValue, double gammaValue, double epsilonValue):Agent(initialPosition, aName, savedRewardSize){
    this->numberOfStates    = environmentSize*savedRewardSize;
    this->environmentStates = environmentSize;
    this->alpha             = alphaValue;
    this->gamma             = gammaValue;
    this->epsilon           = epsilonValue;
    this->startupPosition   = initialPosition;
    this->Qmatrix = new double*[numberOfStates];
    for(int i = 0; i < numberOfStates; ++i){
         this->Qmatrix[i] = new double[9]; // numberOfStates = environmentSize
    }
     initializeQmatrix();
     //printQmatrix();
}

Qlearning::~Qlearning()
{
    //dtor
}

double Qlearning::getMaxRowValue(int rowIndex){
    double maxValue = Qmatrix[rowIndex-1][0];
    try{
    for(int i = 1; i < 9; ++i){
        if (Qmatrix[rowIndex-1][i] > maxValue) {
            maxValue = Qmatrix[rowIndex-1][i];
        }
    }
    if (maxValue < -999 || maxValue > 999){
        throw 106;
    }
    }catch(int z){
    std::cout<<"Max state/action value can take values in [-999,999], ERROR NUMBER: "<< z<<std::endl;
    }
    return maxValue;
}

void Qlearning::updateQMatrix(){
    this->Qmatrix[previousState-1][lastAction-1] +=  alpha*((getLastReward() + gamma*getMaxRowValue(getPosition())) - (this->Qmatrix[previousState-1][lastAction-1]));
}
int Qlearning::performAction(int currentIteration){
    int currentState        = getPosition() + (environmentStates*(currentIteration-1));
    double stateActionMax   = getMaxRowValue(currentState);
    std::vector<int> maxIndecies;
    int action;
    // choose either explore or exploit
    if (epsilon < rand()%1 + 1){ // exploit
        maxIndecies   = findMaxRewardingActions(stateActionMax, currentState);      // maxValue = max(state_action);
        action        = maxIndecies.at(rand()%(maxIndecies.size())) + 1;
    }
    else {                      // explore
        action        = (rand()%9 + 1);                                     // choose 1 action randomly
    }
    try{
    if (action > 9 || action < 1){
        throw 120;
    }
    }catch(int z){
    std::cout<<"Action can only be in [1,2,3,4,5,6,7,8,9], ERROR NUMBER: "<< z<<std::endl;
    }
    this->lastAction    = action;
    //this->previousState = currentState;
    return action;
}

std::vector<int> Qlearning::findMaxRewardingActions(double maxValue, int currentState){
    std::vector<int> maxIndecies;
    for (int i=0; i<9;i++){
        if (Qmatrix[currentState-1][i] == maxValue){
            maxIndecies.push_back(i);
        }
    }
    try{
    if (maxIndecies.empty()){
        throw 105;
    }
    }catch(int z){
    std::cout<<"There must be at least one maximum, ERROR NUMBER: "<< z<<std::endl;
    }
    return maxIndecies;
}

void Qlearning::setAlpha(double alphaValue){
    this->alpha = alphaValue;
}
void Qlearning::setGamma(double gammaValue){
    this->gamma = gammaValue;
}
double Qlearning::getAlpha(){
    return alpha;
}
double Qlearning::getGamma(){
    return gamma;
}
void Qlearning::setEpsilon(double epsilonValue){
    this->epsilon = epsilonValue;
}
double Qlearning::getEpsilon(){
    return epsilon;
}
void Qlearning::printQmatrix()
{
  for (int R = 0; R < numberOfStates; R++){
    for (int C = 0; C < 9; C++){
       std::cout << Qmatrix[R][C];
    }
    std::cout<<"\n";
  }
}
void Qlearning::initializeQmatrix(){
  for (int R = 0; R < numberOfStates; R++){
    for (int C = 0; C < 9; C++){
       this->Qmatrix[R][C] = 2;
    }
  }
}

void Qlearning::reset(){
    this->previousState = getStartupPosition();
    this->lastAction    = -99;
    //printQmatrix();
    Agent::reset();
}
void Qlearning::resetAll(int aStartupPosition){
    Agent::resetAll(aStartupPosition);
    this->previousState = aStartupPosition;
    this->lastAction    = -99;
    initializeQmatrix();
}
int Qlearning::setPosition(int action, int columns, int currentIteration){
    //this->lastPosition  = getPosition();
    this->previousState = getPosition() + (environmentStates*(currentIteration-1));
    return Agent::setPosition(action, columns, environmentStates);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--    <color name="colorPrimary">#3F51B5</color>-->

    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="textColorPrimary">#FFFFFF</color>
    <color name="windowBackground">#FFFFFF</color>
    <color name="navigationBarColor">#000000</color>
    <color name="colorAccent">#FF4081</color>

    <color name="textColor">#FFFFFF</color>
    <color name="primaryText">#212121</color>
    <color name="secondaryText">#727272</color>
    <color name="dividerColor">#B6B6B6</color>

    <color name="tabIndicator">#0000FE</color>
    <color name="background_tab_pressed">#6633B5E5</color>

    <color name="button_material_light">#AAF2F2F2</color>
    <color name="ripple_material_light">#ECECEC</color>
    <color name="primary_text_default_material_light">#de000000</color>
    <color name="secondary_text_default_material_light">#8a000000</color>

    <color name="tab_unselected">#7B88CC</color>

</resources>


text:
/**
 * @file result.hpp
 * @brief 存放返回结果
 * @author chxuan, 787280310@qq.com
 * @version 1.0.0
 * @date 2017-11-05
 */
#pragma once

#include "easyrpc/codec/codec.h"

namespace easyrpc
{

struct result
{
    result(int serial, message_model mod, const std::shared_ptr<google::protobuf::Message>& msg)
        : serial_num(serial), model(mod), message(msg) {}
    int serial_num;
    message_model model;
    std::shared_ptr<google::protobuf::Message> message;
};

}


text:
require "httparty"
require "json"

module TotallyCoolArt

  class Gallery

    def list_of_galleries
      response = HTTParty.get('http://arts-api.herokuapp.com/galleries').parsed_response
    end

    def specific_gallery(number)
      response = HTTParty.get("http://arts-api.herokuapp.com/galleries/#{number}").parsed_response
    end

    def exhibitions_at_gallery(number)
      response = HTTParty.get("http://arts-api.herokuapp.com/galleries/#{number}/exhibitions").parsed_response
    end

  end

  # puts Gallery.new.list_of_galleries
end


text:
package voldemort;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

import voldemort.client.DefaultStoreClient;
import voldemort.client.StoreClient;
import voldemort.client.StoreClientFactory;
import voldemort.store.Store;
import voldemort.versioning.InconsistencyResolver;
import voldemort.versioning.Versioned;

/**
 * A simple test store client factory that returns stores from a predetermined
 * list.
 *
 * If the factory is supplied with N stores then the first N calls to
 * getRawStore will return the stores in succession. After that all calls will
 * return the Nth store.
 *
 * This is intended to help simultate things like MetadataExceptions which may
 * require having an out-of-date Store.
 *
 * @author jay
 *
 */
public class StaticStoreClientFactory implements StoreClientFactory {

    private final AtomicInteger current;
    private final List<Store<?, ?>> stores;

    public StaticStoreClientFactory(Store<?, ?>... stores) {
        if(stores.length < 1)
            throw new IllegalArgumentException("Must provide at least one store.");
        this.stores = Arrays.asList(stores);
        current = new AtomicInteger(0);
    }

    @SuppressWarnings("unchecked")
    public <K, V> Store<K, V> getRawStore(String storeName,
                                          InconsistencyResolver<Versioned<V>> resolver) {
        return (Store<K, V>) stores.get(Math.max(current.getAndIncrement(), stores.size() - 1));
    }

    @SuppressWarnings("unchecked")
    public <K, V> StoreClient<K, V> getStoreClient(String storeName) {
        return new DefaultStoreClient(storeName, null, this, 3);
    }

    @SuppressWarnings("unchecked")
    public <K, V> StoreClient<K, V> getStoreClient(String storeName,
                                                   InconsistencyResolver<Versioned<V>> resolver) {
        return new DefaultStoreClient(storeName, resolver, this, 3);
    }

    public void close() {
        for(Store<?, ?> store: stores)
            store.close();
    }

}


text:
from django.conf.urls import patterns, include, url

urlpatterns = patterns('players.views',
    url(r'^$', 'players', name='players'),
)


text:
<?php

namespace Eshopera\Core\Form\Backend;

use Eshopera\Core\Lib\Forms\Form;
use Phalcon\Forms\Element;
use Phalcon\Validation\Validator;

/**
 * Backend login form
 */
class LoginForm extends Form
{

    public function initialize()
    {
        parent::initialize();

        // username field
        $label = $this->translate->t('CORE_USER_USERNAME');
        $username = new Element\Text('username', [
            'class' => 'form-control',
            'placeholder' => $label,
            'required' => 'required'
        ]);
        $username->setFilters(['trim', 'string']);
        $username->addValidator(new Validator\PresenceOf([
            'message' => $this->translate->t('CORE_VALIDATION_REQUIRED', ['name' => $label])
        ]));

        $this->add($username);

        // password field
        $label = $this->translate->t('CORE_USER_PASSWORD');
        $passwd = new Element\Password('password', [
            'class' => 'form-control',
            'placeholder' => $label,
            'required' => 'required',
            'autocomplete' => 'off',
            'data-focus' => '1'
        ]);
        $passwd->addValidator(new Validator\PresenceOf([
            'message' => $this->translate->t('CORE_VALIDATION_REQUIRED', ['name' => $label])
        ]));

        $this->add($passwd);

        // back url field
        $back = new Element\Hidden('back');

        $this->add($back);
    }
}