text:
module DataTables
  module ActiveModelSerializers
    MEDIA_TYPE = 'application/json'.freeze
    HEADERS = {
      response: { 'CONTENT_TYPE'.freeze => MEDIA_TYPE },
      request:  { 'ACCEPT'.freeze => MEDIA_TYPE }
    }.freeze

    def self.install
      # actionpack/lib/action_dispatch/http/mime_types.rb
      Mime::Type.register_alias MEDIA_TYPE, :dt, %w( text/plain text/x-json application/jsonrequest application/dt application/datatable )

      # if Rails::VERSION::MAJOR >= 5
      #   ActionDispatch::Request.parameter_parsers[:dt] = parser
      # else
      #   ActionDispatch::ParamsParser::DEFAULT_PARSERS[Mime[:dt]] = parser
      # end

      ::ActionController::Renderers.add :dt do |json, options|
        json = serialize_dt(json, options).to_json(options) unless json.is_a?(String)
        self.content_type ||= Mime[:dt]
        self.response_body = json
      end
    end

    module ControllerSupport
      def serialize_dt(resource, options)
        options[:adapter] = :dt
        options.fetch(:serialization_context) do
          options[:serialization_context] = ::ActiveModelSerializers::SerializationContext.new(request)
        end
        # Magic happens here
        resource = DataTables::Responder.respond(resource, request.params)
        get_serializer(resource, options)
      end
    end
  end
end

DataTables::ActiveModelSerializers.install

ActiveSupport.on_load(:action_controller) do
  include DataTables::ActiveModelSerializers::ControllerSupport
end


text:
var RuntimeGenerator = {
  alloc: function(size, type, init, sep, ignoreAlign) {
    sep = sep || ';';
    var ret = type + 'TOP';
    if (init) {
      ret += sep + '_memset(' + type + 'TOP, 0, ' + size + ')';
    }
    ret += sep + type + 'TOP = (' + type + 'TOP + ' + size + ')|0';
    if ({{{ STACK_ALIGN }}} > 1 && !ignoreAlign) {
      ret += sep + RuntimeGenerator.alignMemory(type + 'TOP', {{{ STACK_ALIGN }}});
    }
    return ret;
  },

  // An allocation that lives as long as the current function call
  stackAlloc: function(size, sep) {
    sep = sep || ';';
    var ret = RuntimeGenerator.alloc(size, 'STACK', false, sep, USE_TYPED_ARRAYS != 2 || (isNumber(size) && parseInt(size) % {{{ STACK_ALIGN }}} == 0));
    if (ASSERTIONS) {
      ret += sep + 'assert(' + asmCoercion('(STACKTOP|0) < (STACK_MAX|0)', 'i32') + ')';
    }
    return ret;
  },

  stackEnter: function(initial, force) {
    if (initial === 0 && SKIP_STACK_IN_SMALL && !force) return '';
    var ret = 'var __stackBase__  = ' + (ASM_JS ? '0; __stackBase__ = ' : '') + 'STACKTOP';
    if (initial > 0) ret += '; STACKTOP = (STACKTOP + ' + initial + ')|0';
    if (USE_TYPED_ARRAYS == 2) {
      assert(initial % Runtime.STACK_ALIGN == 0);
      if (ASSERTIONS && Runtime.STACK_ALIGN == 4) {
        ret += '; assert(' + asmCoercion('!(STACKTOP&3)', 'i32') + ')';
      }
    }
    if (ASSERTIONS) {
      ret += '; assert(' + asmCoercion('(STACKTOP|0) < (STACK_MAX|0)', 'i32') + ')';
    }
    if (false) {
      ret += '; _memset(' + asmCoercion('__stackBase__', 'i32') + ', 0, ' + initial + ')';
    }
    return ret;
  },

  stackExit: function(initial, force) {
    if (initial === 0 && SKIP_STACK_IN_SMALL && !force) return '';
    var ret = '';
    if (SAFE_HEAP) {
      ret += 'var i = __stackBase__; while ((i|0) < (STACKTOP|0)) { SAFE_HEAP_CLEAR(i|0); i = (i+1)|0 }';
    }
    return ret += 'STACKTOP = __stackBase__';
  },

  // An allocation that cannot normally be free'd (except through sbrk, which once
  // called, takes control of STATICTOP)
  staticAlloc: function(size) {
    if (ASSERTIONS) size = '(assert(!staticSealed),' + size + ')'; // static area must not be sealed
    var ret = RuntimeGenerator.alloc(size, 'STATIC', INIT_HEAP);
    return ret;
  },

  // allocation on the top of memory, adjusted dynamically by sbrk
  dynamicAlloc: function(size) {
    if (ASSERTIONS) size = '(assert(DYNAMICTOP > 0),' + size + ')'; // dynamic area must be ready
    var ret = RuntimeGenerator.alloc(size, 'DYNAMIC', INIT_HEAP);
    if (USE_TYPED_ARRAYS) ret += '; if (DYNAMICTOP >= TOTAL_MEMORY) enlargeMemory();'
    return ret;
  },

  alignMemory: function(target, quantum) {
    if (typeof quantum !== 'number') {
      quantum = '(quantum ? quantum : {{{ STACK_ALIGN }}})';
    }
    return target + ' = ' + Runtime.forceAlign(target, quantum);
  },

  // Given two 32-bit unsigned parts of an emulated 64-bit number, combine them into a JS number (double).
  // Rounding is inevitable if the number is large. This is a particular problem for small negative numbers
  // (-1 will be rounded!), so handle negatives separately and carefully
  makeBigInt: function(low, high, unsigned) {
    var unsignedRet = '(' + asmCoercion(makeSignOp(low, 'i32', 'un', 1, 1), 'float') + '+(' + asmCoercion(makeSignOp(high, 'i32', 'un', 1, 1), 'float') + '*' + asmEnsureFloat(4294967296, 'float') + '))';
    var signedRet = '(' + asmCoercion(makeSignOp(low, 'i32', 'un', 1, 1), 'float') + '+(' + asmCoercion(makeSignOp(high, 'i32', 're', 1, 1), 'float') + '*' + asmEnsureFloat(4294967296, 'float') + '))';
    if (typeof unsigned === 'string') return '(' + unsigned + ' ? ' + unsignedRet + ' : ' + signedRet + ')';
    return unsigned ? unsignedRet : signedRet;
  }
};

function unInline(name_, params) {
  var src = '(function(' + params + ') { var ret = ' + RuntimeGenerator[name_].apply(null, params) + '; return ret; })';
  var ret = eval(src);
  return ret;
}

var Runtime = {
  stackSave: function() {
    return STACKTOP;
  },
  stackRestore: function(stackTop) {
    STACKTOP = stackTop;
  },

  forceAlign: function(target, quantum) {
    quantum = quantum || {{{ QUANTUM_SIZE }}};
    if (quantum == 1) return target;
    if (isNumber(target) && isNumber(quantum)) {
      return Math.ceil(target/quantum)*quantum;
    } else if (isNumber(quantum) && isPowerOfTwo(quantum)) {
      var logg = log2(quantum);
      return '((((' +target + ')+' + (quantum-1) + ')>>' + logg + ')<<' + logg + ')';
    }
    return 'Math.ceil((' + target + ')/' + quantum + ')*' + quantum;
  },

  isNumberType: function(type) {
    return type in Runtime.INT_TYPES || type in Runtime.FLOAT_TYPES;
  },

  isPointerType: isPointerType,
  isStructType: isStructType,

  INT_TYPES: set('i1', 'i8', 'i16', 'i32', 'i64'),
  FLOAT_TYPES: set('float', 'double'),

  // Imprecise bitops utilities
  or64: function(x, y) {
    var l = (x | 0) | (y | 0);
    var h = (Math.round(x / 4294967296) | Math.round(y / 4294967296)) * 4294967296;
    return l + h;
  },
  and64: function(x, y) {
    var l = (x | 0) & (y | 0);
    var h = (Math.round(x / 4294967296) & Math.round(y / 4294967296)) * 4294967296;
    return l + h;
  },
  xor64: function(x, y) {
    var l = (x | 0) ^ (y | 0);
    var h = (Math.round(x / 4294967296) ^ Math.round(y / 4294967296)) * 4294967296;
    return l + h;
  },

  //! Returns the size of a type, as C/C++ would have it (in 32-bit, for now), in bytes.
  //! @param type The type, by name.
  getNativeTypeSize: function(type, quantumSize) {
    if (Runtime.QUANTUM_SIZE == 1) return 1;
    var size = {
      '%i1': 1,
      '%i8': 1,
      '%i16': 2,
      '%i32': 4,
      '%i64': 8,
      "%float": 4,
      "%double": 8
    }['%'+type]; // add '%' since float and double confuse Closure compiler as keys, and also spidermonkey as a compiler will remove 's from '_i8' etc
    if (!size) {
      if (type.charAt(type.length-1) == '*') {
        size = Runtime.QUANTUM_SIZE; // A pointer
      } else if (type[0] == 'i') {
        var bits = parseInt(type.substr(1));
        assert(bits % 8 == 0);
        size = bits/8;
      }
    }
    return size;
  },

  //! Returns the size of a structure field, as C/C++ would have it (in 32-bit,
  //! for now).
  //! @param type The type, by name.
  getNativeFieldSize: function(type) {
    return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE);
  },

  dedup: dedup,

  set: set,

  STACK_ALIGN: {{{ STACK_ALIGN }}},

  // type can be a native type or a struct (or null, for structs we only look at size here)
  getAlignSize: function(type, size, vararg) {
    // we align i64s and doubles on 64-bit boundaries, unlike x86
#if TARGET_LE32
    if (type == 'i64' || type == 'double' || vararg) return 8;
    if (!type) return Math.min(size, 8); // align structures internally to 64 bits
#endif
    return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE);
  },

  // Calculate aligned size, just like C structs should be. TODO: Consider
  // requesting that compilation be done with #pragma pack(push) /n #pragma pack(1),
  // which would remove much of the complexity here.
  calculateStructAlignment: function calculateStructAlignment(type) {
    type.flatSize = 0;
    type.alignSize = 0;
    var diffs = [];
    var prev = -1;
    type.flatIndexes = type.fields.map(function(field) {
      var size, alignSize;
      if (Runtime.isNumberType(field) || Runtime.isPointerType(field)) {
        size = Runtime.getNativeTypeSize(field); // pack char; char; in structs, also char[X]s.
        alignSize = Runtime.getAlignSize(field, size);
      } else if (Runtime.isStructType(field)) {
        size = Types.types[field].flatSize;
        alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize);
      } else if (field[0] == 'b') {
        // bN, large number field, like a [N x i8]
        size = field.substr(1)|0;
        alignSize = 1;
      } else {
        throw 'Unclear type in struct: ' + field + ', in ' + type.name_ + ' :: ' + dump(Types.types[type.name_]);
      }
      if (type.packed) alignSize = 1;
      type.alignSize = Math.max(type.alignSize, alignSize);
      var curr = Runtime.alignMemory(type.flatSize, alignSize); // if necessary, place this on aligned memory
      type.flatSize = curr + size;
      if (prev >= 0) {
        diffs.push(curr-prev);
      }
      prev = curr;
      return curr;
    });
    type.flatSize = Runtime.alignMemory(type.flatSize, type.alignSize);
    if (diffs.length == 0) {
      type.flatFactor = type.flatSize;
    } else if (Runtime.dedup(diffs).length == 1) {
      type.flatFactor = diffs[0];
    }
    type.needsFlattening = (type.flatFactor != 1);
    return type.flatIndexes;
  },

  // Given details about a structure, returns its alignment. For example,
  // generateStructInfo(
  //    [
  //      ['i32', 'field1'],
  //      ['i8', 'field2']
  //    ]
  // ) will return
  //    { field1: 0, field2: 4 } (depending on QUANTUM_SIZE)
  //
  // Instead of [type, name], you can also provide just [name]. In that case
  // it will use type information present in LLVM bitcode. (It is safer to
  // specify the type though, as it will then check the type.) You must then
  // also specify the second parameter to generateStructInfo, which is the
  // LLVM structure name.
  //
  // Note that LLVM optimizations can remove some of the debug info generated
  // by -g.
  //
  // Note that you will need the full %struct.* name here at compile time,
  // but not at runtime. The reason is that during compilation we cannot
  // simplify the type names yet. At runtime, you can provide either the short
  // or the full name.
  //
  // When providing a typeName, you can generate information for nested
  // structs, for example, struct = ['field1', { field2: ['sub1', 'sub2', 'sub3'] }, 'field3']
  // which represents a structure whose 2nd field is another structure.
  generateStructInfo: function(struct, typeName, offset) {
    var type, alignment;
    if (typeName) {
      offset = offset || 0;
      type = (typeof Types === 'undefined' ? Runtime.typeInfo : Types.types)[typeName];
      if (!type) return null;
      if (type.fields.length != struct.length) {
        printErr('Number of named fields must match the type for ' + typeName + ': possibly duplicate struct names. Cannot return structInfo');
        return null;
      }
      alignment = type.flatIndexes;
    } else {
      var type = { fields: struct.map(function(item) { return item[0] }) };
      alignment = Runtime.calculateStructAlignment(type);
    }
    var ret = {
      __size__: type.flatSize
    };
    if (typeName) {
      struct.forEach(function(item, i) {
        if (typeof item === 'string') {
          ret[item] = alignment[i] + offset;
        } else {
          // embedded struct
          var key;
          for (var k in item) key = k;
          ret[key] = Runtime.generateStructInfo(item[key], type.fields[i], alignment[i]);
        }
      });
    } else {
      struct.forEach(function(item, i) {
        ret[item[1]] = alignment[i];
      });
    }
    return ret;
  },

  dynCall: function(sig, ptr, args) {
    if (args && args.length) {
#if ASSERTIONS
      assert(args.length == sig.length-1);
#endif
#if ASM_JS
      if (!args.splice) args = Array.prototype.slice.call(args);
      args.splice(0, 0, ptr);
      return Module['dynCall_' + sig].apply(null, args);
#else
      return FUNCTION_TABLE[ptr].apply(null, args);
#endif
    } else {
#if ASSERTIONS
      assert(sig.length == 1);
#endif
#if ASM_JS
      return Module['dynCall_' + sig].call(null, ptr);
#else
      return FUNCTION_TABLE[ptr]();
#endif
    }
  },

#if ASM_JS
  functionPointers: new Array(RESERVED_FUNCTION_POINTERS),
#endif

  addFunction: function(func) {
#if ASM_JS
    for (var i = 0; i < Runtime.functionPointers.length; i++) {
      if (!Runtime.functionPointers[i]) {
        Runtime.functionPointers[i] = func;
        return 2 + 2*i;
      }
    }
    throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';
#else
    var table = FUNCTION_TABLE;
    var ret = table.length;
    table.push(func);
    table.push(0);
    return ret;
#endif
  },

  removeFunction: function(index) {
#if ASM_JS
    Runtime.functionPointers[(index-2)/2] = null;
#else
    var table = FUNCTION_TABLE;
    table[index] = null;
#endif
  },

  warnOnce: function(text) {
    if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {};
    if (!Runtime.warnOnce.shown[text]) {
      Runtime.warnOnce.shown[text] = 1;
      Module.printErr(text);
    }
  },

  funcWrappers: {},

  getFuncWrapper: function(func, sig) {
    assert(sig);
    if (!Runtime.funcWrappers[func]) {
      Runtime.funcWrappers[func] = function() {
        return Runtime.dynCall(sig, func, arguments);
      };
    }
    return Runtime.funcWrappers[func];
  },

  // Returns a processor of UTF.
  // processCChar() receives characters from a C-like UTF representation and returns JS string fragments.
  // processJSString() receives a JS string and returns a C-like UTF representation in an array
  UTF8Processor: function() {
    var buffer = [];
    var needed = 0;
    this.processCChar = function (code) {
      code = code & 0xff;
      if (needed) {
        buffer.push(code);
        needed--;
      }
      if (buffer.length == 0) {
        if (code < 128) return String.fromCharCode(code);
        buffer.push(code);
        if (code > 191 && code < 224) {
          needed = 1;
        } else {
          needed = 2;
        }
        return '';
      }
      if (needed > 0) return '';
      var c1 = buffer[0];
      var c2 = buffer[1];
      var c3 = buffer[2];
      var ret;
      if (c1 > 191 && c1 < 224) {
        ret = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
      } else {
        ret = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
      }
      buffer.length = 0;
      return ret;
    }
    this.processJSString = function(string) {
      string = unescape(encodeURIComponent(string));
      var ret = [];
      for (var i = 0; i < string.length; i++) {
        ret.push(string.charCodeAt(i));
      }
      return ret;
    }
  },

#if RUNTIME_DEBUG
  debug: true, // Switch to false at runtime to disable logging at the right times

  printObjectList: [],

  prettyPrint: function(arg) {
    if (typeof arg == 'undefined') return '!UNDEFINED!';
    if (typeof arg == 'boolean') arg = arg + 0;
    if (!arg) return arg;
    var index = Runtime.printObjectList.indexOf(arg);
    if (index >= 0) return '<' + arg + '|' + index + '>';
    if (arg.toString() == '[object HTMLImageElement]') {
      return arg + '\n\n';
    }
    if (arg.byteLength) {
      return '{' + Array.prototype.slice.call(arg, 0, Math.min(arg.length, 400)) + '}'; // Useful for correct arrays, less so for compiled arrays, see the code below for that
      var buf = new ArrayBuffer(32);
      var i8buf = new Int8Array(buf);
      var i16buf = new Int16Array(buf);
      var f32buf = new Float32Array(buf);
      switch(arg.toString()) {
        case '[object Uint8Array]':
          i8buf.set(arg.subarray(0, 32));
          break;
        case '[object Float32Array]':
          f32buf.set(arg.subarray(0, 5));
          break;
        case '[object Uint16Array]':
          i16buf.set(arg.subarray(0, 16));
          break;
        default:
          alert('unknown array for debugging: ' + arg);
          throw 'see alert';
      }
      var ret = '{' + arg.byteLength + ':\n';
      var arr = Array.prototype.slice.call(i8buf);
      ret += 'i8:' + arr.toString().replace(/,/g, ',') + '\n';
      arr = Array.prototype.slice.call(f32buf, 0, 8);
      ret += 'f32:' + arr.toString().replace(/,/g, ',') + '}';
      return ret;
    }
    if (typeof arg == 'object') {
      Runtime.printObjectList.push(arg);
      return '<' + arg + '|' + (Runtime.printObjectList.length-1) + '>';
    }
    if (typeof arg == 'number') {
      if (arg > 0) return '0x' + arg.toString(16) + ' (' + arg + ')';
    }
    return arg;
  }
#endif
};

Runtime.stackAlloc = unInline('stackAlloc', ['size']);
Runtime.staticAlloc = unInline('staticAlloc', ['size']);
Runtime.dynamicAlloc = unInline('dynamicAlloc', ['size']);
Runtime.alignMemory = unInline('alignMemory', ['size', 'quantum']);
Runtime.makeBigInt = unInline('makeBigInt', ['low', 'high', 'unsigned']);

function getRuntime() {
  var ret = 'var Runtime = {\n';
  for (i in Runtime) {
    var item = Runtime[i];
    ret += '  ' + i + ': ';
    if (typeof item === 'function') {
      ret += item.toString();
    } else {
      ret += JSON.stringify(item);
    }
    ret += ',\n';
  }
  return ret + '  __dummy__: 0\n}\n';
}

// Additional runtime elements, that need preprocessing

// Converts a value we have as signed, into an unsigned value. For
// example, -1 in int32 would be a very large number as unsigned.
function unSign(value, bits, ignore, sig) {
  if (value >= 0) {
    return value;
  }
#if CHECK_SIGNS
  if (!ignore) throw 'UnSign';
#endif
  return bits <= 32 ? 2*Math.abs(1 << (bits-1)) + value // Need some trickery, since if bits == 32, we are right at the limit of the bits JS uses in bitshifts
                    : Math.pow(2, bits)         + value;
}

// Converts a value we have as unsigned, into a signed value. For
// example, 200 in a uint8 would be a negative number.
function reSign(value, bits, ignore, sig) {
  if (value <= 0) {
    return value;
  }
  var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32
                        : Math.pow(2, bits-1);
#if CHECK_SIGNS
  var noted = false;
#endif
  if (value >= half && (bits <= 32 || value > half)) { // for huge values, we can hit the precision limit and always get true here. so don't do that
                                                       // but, in general there is no perfect solution here. With 64-bit ints, we get rounding and errors
                                                       // TODO: In i64 mode 1, resign the two parts separately and safely
#if CHECK_SIGNS
    if (!ignore) throw 'ReSign';
#endif
    value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts
  }
#if CHECK_SIGNS
  // If this is a 32-bit value, then it should be corrected at this point. And,
  // without CHECK_SIGNS, we would just do the |0 shortcut, so check that that
  // would indeed give the exact same result.
  if (bits === 32 && (value|0) !== value && typeof value !== 'boolean') {
    if (!ignore) throw 'ReSign';
  }
#endif
  return value;
}

// The address globals begin at. Very low in memory, for code size and optimization opportunities.
// Above 0 is static memory, starting with globals.
// Then the stack.
// Then 'dynamic' memory for sbrk.
Runtime.GLOBAL_BASE = Runtime.alignMemory(1);

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2015 ETH Zurich. All rights reserved
#include "gdfmm/gdfmm.h"

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <iostream>
#include <cassert>
#include <eigen3/Eigen/Eigen>

#include <cstdio>

#define CHECK(expr) if (!(expr)) { throw "Failed expression: " #expr "\n";}

namespace gdfmm {
using std::set;
using std::pair;

static float ComputeSpeed(const cv::Mat &gradientStrength,
                          const Point &position);

GDFMM::GDFMM(float sigmaDistance,
        float sigmaColor,
        float blurSigma,
        int windowSize)
  : distExpCache_(sigmaDistance, windowSize),
    colorExpCache_(sigmaColor, 255),
    windowSize_(windowSize),
    blurSigma_(blurSigma)
  {
  assert(windowSize_ % 2 == 1 && windowSize >= 3);
}

static pair<float, float> ComputeDepthGradient(
                            const cv::Mat &depthImage,
                            int x, int y) {
  float dx = 0, dy = 0;
  int wx = 0, wy = 0;
  assert(depthImage.depth() == CV_32F);

  if (x > 0 && depthImage.at<float>(y,x) != 0
            && depthImage.at<float>(y,x-1) != 0) {
    dx += depthImage.at<float>(y,x) - depthImage.at<float>(y,x-1);
    wx++;
  }
  if (x+1 < depthImage.cols
            && depthImage.at<float>(y,x+1) != 0
            && depthImage.at<float>(y,x) != 0) {
    dx += depthImage.at<float>(y,x+1) - depthImage.at<float>(y,x);
    wx++;
  }

  if (y > 0 && depthImage.at<float>(y,x) != 0
            && depthImage.at<float>(y-1,x) != 0) {
    dy += depthImage.at<float>(y,x) - depthImage.at<float>(y-1,x);
    wy++;
  }
  if (y+1 < depthImage.rows
            && depthImage.at<float>(y+1,x) != 0
            && depthImage.at<float>(y,x) != 0) {
    dy += depthImage.at<float>(y+1,x) - depthImage.at<float>(y,x);
    wy++;
  }

//  depthGradientX->at<float>(y,x) = (wx > 0) ? dx / wx : 0;
//  depthGradientY->at<float>(y,x) = (wy > 0) ? dy / wy : 0;
  return std::make_pair(
      (wx > 0) ? dx / wx : 0,
      (wy > 0) ? dy / wy : 0
      );
}

cv::Mat GDFMM::InPaint(const cv::Mat &depthImage,
                      const cv::Mat &rgbImageOriginal,
                      cv::Mat *output) {
  return InPaintBase(depthImage,
                      rgbImageOriginal,
                      output,
                      [this] (const cv::Mat &dI,
                          const cv::Mat &rgbI,
                          int x, int y) {
                        return PredictDepth(dI, rgbI, x, y);
                      });
}

cv::Mat GDFMM::InPaint2(const cv::Mat &depthImage,
                      const cv::Mat &rgbImageOriginal,
                      float epsilon,
                      float constant,
                      float truncation,
                      cv::Mat *output) {
  return InPaintBase(depthImage,
                      rgbImageOriginal,
                      output,
                      [this, epsilon, constant, truncation]
                      (const cv::Mat &dI,
                       const cv::Mat &rgbI,
                             int x, int y) {
                        return PredictDepth2(dI, rgbI,
                                             x, y,
                                             epsilon, constant,
                                             truncation);
                      });
}

template <class PredictMethod>
cv::Mat GDFMM::InPaintBase(const cv::Mat &depthImageOriginal,
                const cv::Mat &rgbImage,
                cv::Mat *output,
                const PredictMethod &predict) {
  if (rgbImage.cols != depthImageOriginal.cols ||
      rgbImage.rows != depthImageOriginal.rows) {
    throw std::runtime_error("Images must have same size.");
  }
  cv::Mat depthImage;

  CHECK(depthImageOriginal.channels() == 1);
  CHECK(rgbImage.channels() == 3);
  //cv::Mat result(depthImageOriginal.rows, depthImageOriginal.cols,
  //                CV_32F);

  // depth gradient
//  cv::Mat depthGradientX(depthImageOriginal.rows, depthImageOriginal.cols, CV_32F);
//  cv::Mat depthGradientY(depthImageOriginal.rows, depthImageOriginal.cols, CV_32F);

  // Cannot use Sobel, because depth is sometimes unknown
  depthImageOriginal.convertTo(depthImage, CV_32F);
// ComputeDepthGradients(depthImage, &depthGradientX, &depthGradientY);

  // gradient image, then (Gaussian blur)
  // resize rgb to depth image (specifically for Tango device)
  cv::Mat rgbGradientX(rgbImage.rows, rgbImage.cols, CV_32FC3);
  cv::Mat rgbGradientY(rgbImage.rows, rgbImage.cols, CV_32FC3);
  cv::Mat tmp;

  cv::GaussianBlur(rgbImage, tmp, cv::Size(0,0), blurSigma_, blurSigma_);
  cv::Sobel(tmp, rgbGradientX, CV_32F, 1, 0, 3);
  cv::Sobel(tmp, rgbGradientY, CV_32F, 0, 1, 3);

  cv::Mat rgbGradientStrength(rgbImage.rows, rgbImage.cols, CV_32FC3);

  for (int y=0; y<rgbImage.rows; y++) {
    for (int x=0; x<rgbImage.cols; x++) {
      for (int c=0; c<3; c++) {
        rgbGradientStrength.at<cv::Vec3f>(y, x)[c] =
            rgbGradientX.at<cv::Vec3f>(y, x)[c] * rgbGradientX.at<cv::Vec3f>(y, x)[c] +
            rgbGradientY.at<cv::Vec3f>(y, x)[c] * rgbGradientY.at<cv::Vec3f>(y, x)[c];
      }
    }
  }
  // Debug ComputeSpeed
//  {
//  cv::Mat rescaled(rgbImage.rows, rgbImage.cols, CV_32FC1);
//  for (int y=0; y<rgbImage.rows; y++) {
//    for (int x=0; x<rgbImage.cols; x++) {
//      rescaled.at<float>(y,x) = -ComputeSpeed(rgbGradientStrength, Point{x,y});
//    }
//  }
//  cv::imshow("what", rescaled);
//  cv::waitKey(0);
//  }

  // build the priority queue
  typedef pair<float, Point> BandItem;
  auto compare = [](const BandItem &p1, const BandItem &p2) -> bool { return p1.first < p2.first; };
  std::priority_queue<BandItem, std::vector<BandItem>, decltype(compare)>
          narrowBand(compare);

  // initialize narrowBand
  for (int y=0; y<depthImage.rows; y++) {
    for (int x=0; x<depthImage.cols; x++) {
      if (depthImage.at<float>(y, x) != 0) {
        narrowBand.emplace(0, Point{x, y});
      }
    }
  }

  // propagate
  while (narrowBand.size() > 0) {
    float speed;
    Point position;

    std::tie(speed, position) = narrowBand.top();
    narrowBand.pop();

    // use 4-neighbour
    const Point neighbours[] {
      {0,1},{1,0},{-1,0},{0,-1}
    };
    for (const Point &d: neighbours) {
      Point neighbour{position.x + d.x, position.y + d.y};
      if (!(neighbour.x >= 0 &&
          neighbour.y >= 0 &&
          neighbour.x < depthImage.cols &&
          neighbour.y < depthImage.rows))
        continue;

      if (depthImage.at<float>(neighbour.y, neighbour.x) == 0) {
        float prediction =
              predict(depthImage,
                      rgbImage,
                      neighbour.x, neighbour.y);

        depthImage.at<float>(neighbour.y, neighbour.x) = prediction;

        if (prediction != 0) {
          float T = ComputeSpeed(rgbGradientStrength, neighbour);
          narrowBand.emplace(T, neighbour);
        }
        else {
          // re-try later
          if (speed < -20) {
            throw std::runtime_error("Too few known values. "
                "Try densifying your depth image first, "
                "or increasing the window size.");
          }
          narrowBand.emplace(speed - 1, position);
        }
      }
    }
  }

  if (output) {
    depthImage.convertTo(*output, CV_16U);
    return *output;
  }
  else {
    depthImage.convertTo(depthImage, CV_16U);
    return depthImage;
  }
}

float GDFMM::BilateralWeight(const Point &p1,
                      const Point &p2,
                      const cv::Mat &rgbImage) {
  assert(rgbImage.depth() == CV_8U);
  assert(rgbImage.channels() == 3);
  const uint8_t *c1 = rgbImage.at<uint8_t[3]>(p1.y, p1.x);
  const uint8_t *c2 = rgbImage.at<uint8_t[3]>(p2.y, p2.x);
  return
      distExpCache_(p2.x - p1.x) *
      distExpCache_(p2.y - p1.y) *
      colorExpCache_((int)c1[0] - (int)c2[0]) *
      colorExpCache_((int)c1[1] - (int)c2[1]) *
      colorExpCache_((int)c1[2] - (int)c2[2]);
}

// float CorrelationWeight(const Point &p1,
//                         const Point &p2,
//                         const cv::Mat &rgbImage,
//                         int windowRadius)
// {
//   // find mean intensity around p1
//   int lowerY = std::max(0, p1.y - windowRadius);
//   int lowerX = std::max(0, p1.x - windowRadius);
//   int upperY = std::min(rgbImage.rows - 1, static_cast<int>(p1.y + windowRadius));
//   int upperX = std::min(rgbImage.cols - 1, static_cast<int>(p1.x + windowRadius));
//
//   int num_known = 0;
//   Eigen::Vector3f sumI(0,0,0);
//   Eigen::Vector3f sumI2(0,0,0);
//   for (int n = lowerY; n <= upperY; n++) {
//     for (int m = lowerX; m <= upperX; m++) {
//       cv::Vec3b rgb = rgbImage.at<cv::Vec3b>(p1.y, p1.x);
//       Eigen::Vector3b rgbf(rgb[0], rgb[1], rgb[2]);
//       sumI += rgbf;
//       sumI2 += (rgbf.array() * rgbf.array()).matrix();
//     }
//   }
//   // compute covariance... (ah shit)
// }

float GDFMM::PredictDepth(const cv::Mat &depthImage,
                         const cv::Mat &rgbImage,
                         int x, int y) {
  assert(depthImage.cols == rgbImage.cols);
  assert(depthImage.rows == rgbImage.rows);

  float sumWeights = 0;
  float sumValues = 0;
  int count = 0;
  int windowRadius = windowSize_ / 2;

  for (int n = std::max(0, y - windowRadius);
       n <= std::min(depthImage.rows - 1, static_cast<int>(y + windowRadius));
       n++) {
    for (int m = std::max(0, x - windowRadius);
         m <= std::min(depthImage.cols - 1, static_cast<int>(x + windowRadius));
         m++) {
      float depth = depthImage.at<float>(n, m);
      if (depth == 0) // invalid
        continue;

      float weight = std::max((float)1e-6, BilateralWeight(Point{x,y}, Point{m,n}, rgbImage));
    ///  float weight2 = CorrelationWeight(Point{x,y}, Point{m,n}, rgbImage, windowRadius);

      float gX, gY;
      std::tie(gX, gY) = ComputeDepthGradient(depthImage, m, n);
      float gradientTerm = gX * (x-m) + gY * (y-n);

      sumValues += weight * (depth /*+ gradientTerm*/);
      sumWeights += weight;
      count ++;
    }
  }

  if (count <= 3) {
    return 0;
  }
  return sumValues / sumWeights;
}

/**
 * An alternative implementation for situations where the missing areas
 * are much larger. It uses the covariance matrix within the window instead.
 *
 * Because it uses regularized least squares, maybe you want to scale
 * your RGB image to [0,1] first
 * **/
float GDFMM::PredictDepth2(const cv::Mat &depthImage,
                         const cv::Mat &rgbImage,
                         int x, int y,
                         float epsilon,
                         float constant,
                         float truncation) {
  assert(depthImage.cols == rgbImage.cols);
  assert(depthImage.rows == rgbImage.rows);
  assert(depthImage.depth() == CV_32F);

  int windowRadius = windowSize_ / 2;

  // Count known pixels in the window
  int lowerY = std::max(0, y - windowRadius);
  int lowerX = std::max(0, x - windowRadius);
  int upperY = std::min(depthImage.rows - 1, static_cast<int>(y + windowRadius));
  int upperX = std::min(depthImage.cols - 1, static_cast<int>(x + windowRadius));

  int num_known = 0;
  for (int n = lowerY; n <= upperY; n++) {
    for (int m = lowerX; m <= upperX; m++) {
      if (depthImage.at<float>(n, m) == 0) {
        continue;
      }
      else {
        num_known++;
      }
    }
  }

  if (num_known <= 3) {
    return 0;
    throw std::runtime_error("Too few known values. "
        "Try densifying your depth image first, "
        "or increasing the window size.");
  }

  // Build the array
  Eigen::Array<float, Eigen::Dynamic, 4> X(num_known, 4);
  Eigen::Array<float, Eigen::Dynamic, 1> Y(num_known);
  int index = 0;
  for (int n = lowerY; n <= upperY; n++) {
    for (int m = lowerX; m <= upperX; m++) {
      if (depthImage.at<float>(n, m) == 0) {
        continue;
      }
      else {
        X(index, 0) = rgbImage.at<uint8_t[3]>(n, m)[0];
        X(index, 1) = rgbImage.at<uint8_t[3]>(n, m)[1];
        X(index, 2) = rgbImage.at<uint8_t[3]>(n, m)[2];
        X(index, 3) = 0;
        Y(index) = depthImage.at<float>(n, m);
        index++;
      }
    }
  }

  // Find mean
  Eigen::Array<float, 1, 4> mX = X.colwise().mean();
  Eigen::Array<float, 1, 1> mY = Y.colwise().mean();

  // normalize x...
  X = X.rowwise() - mX;
  Y = Y.rowwise() - mY;

  Eigen::Array<float, 1, 4> sX = sqrt((X * X).colwise().mean());
  sX = sX.max(0.00001);
  sX(0, 3) = 1;
  X.col(3).fill(constant);
  constant = std::max(0.00001f, constant);

  X = X.rowwise() / sX;

  // Find covariance
  Eigen::Matrix4f cov = X.transpose().matrix() * X.matrix();
  Eigen::Matrix4f reg;
  reg << epsilon, 0, 0, 0,
         0, epsilon, 0, 0,
         0, 0, epsilon, 0,
         0, 0, 0, epsilon;

  cov = cov + reg;

  // make prediction
  Eigen::Vector4f beta;
  Eigen::Array<float, 1, 4> xy = (X.colwise() * Y).colwise().sum();
  beta = cov.ldlt().solve(xy.matrix().transpose());
//  Eigen::Array<float, 1, 4> xy = (X.colwise() * Y).colwise().mean();
//  beta = cov.ldlt().solve(xy.matrix().transpose());

  Eigen::Vector4f test(
            rgbImage.at<uint8_t[3]>(y, x)[0],
            rgbImage.at<uint8_t[3]>(y, x)[1],
            rgbImage.at<uint8_t[3]>(y, x)[2],
            0);
  test = ( (test.transpose().array() - mX) / sX).transpose().matrix();
  test(3) = constant;

  assert(rgbImage.depth() == CV_8U);
  assert(rgbImage.channels() == 3);
//  std::cout << "Y" << std::endl
//            << Y.transpose() << std::endl;
//  std::cout << "X" << std::endl
//            << X.transpose() << std::endl;
//  std::cout << "beta: " << beta << std::endl;
//  std::cout << "test: " << test << std::endl;
//  std::cout << "cov: " << cov << std::endl;
//  std::cout << "xy: " << xy << std::endl;
//  std::cout << num_known << std::endl;
//  std::cout << beta.dot(test) << std::endl;
  float prediction = beta.dot(test) + mY(0,0);
  assert(!isnan(prediction));

  // constrain the results to within a sane range
//  float meanY = Y.mean();
//  Eigen::Matrix<float, Eigen::Dynamic, 1> Y_mY = (Y - meanY).matrix();
//  float varY = Y_mY.transpose() * Y_mY;
//  varY /= (num_known - 1);
//  float stdY = sqrt(varY);
//
//  prediction = std::max(meanY - 2 * stdY, prediction);
//  prediction = std::min(meanY + 2 * stdY, prediction);
//  float minY = Y.minCoeff();
//  float maxY = Y.maxCoeff();
//  float rangeY = maxY - minY;
//  prediction = std::max(minY - rangeY * truncation, prediction);
//  prediction = std::min(maxY + rangeY * truncation, prediction);

  return prediction;
}

static float ComputeSpeed(const cv::Mat &gradientStrength,
                          const Point &position)
{
  return -1.0f / (1 +
      gradientStrength.at<float[3]>(position.y, position.x)[0] +
      gradientStrength.at<float[3]>(position.y, position.x)[1] +
      gradientStrength.at<float[3]>(position.y, position.x)[2]
      );
}

};


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace PaladinPharmacyCOMv1.Encryption
{
    class PharmacyCOMEncryption
    {
        public PharmacyCOMEncryption(string pwd)
        {
            var hash = MD5.Create();
            this.key = hash.ComputeHash(Encoding.Unicode.GetBytes(pwd ?? string.Empty));
        }

        private byte[] key;

        public string Encrypt(string msg)
        {
            try
            {
                var aes = Aes.Create();
                aes.Key = key;
                aes.GenerateIV();

                var bytes = Encoding.Unicode.GetBytes(msg);
                byte[] encrypted;

                using (var ms = new MemoryStream())
                {
                    using (var cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write))
                    {
                        cs.Write(bytes, 0, bytes.Length);
                    }
                    encrypted = ms.ToArray();
                }

                //return iv prepended to data
                var totalBytes = new byte[encrypted.Length + aes.IV.Length];
                Buffer.BlockCopy(aes.IV, 0, totalBytes, 0, aes.IV.Length);
                Buffer.BlockCopy(encrypted, 0, totalBytes, aes.IV.Length, encrypted.Length);
                return Convert.ToBase64String(totalBytes);
            }
            catch
            {
                return string.Empty;
            }
        }

        public string Decrypt(string strEncrypted)
        {
            try
            {
                var encrypted = Convert.FromBase64String(strEncrypted);

                var aes = Aes.Create();
                aes.Key = key;

                //extract iv from byte array
                aes.IV = encrypted.Take(16).ToArray();
                encrypted = encrypted.Skip(16).ToArray();

                var decrypted = new byte[encrypted.Length];

                using (var ms = new MemoryStream(encrypted))
                {
                    using (var cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Read))
                    {
                        cs.Read(decrypted, 0, decrypted.Length);
                    }
                }

                return Encoding.Unicode.GetString(decrypted);
            }
            catch
            {
                return string.Empty;
            }

        }
    }
}


text:
#ifndef VOOL_TESTSUIT_H_INCLUDED
#define VOOL_TESTSUIT_H_INCLUDED

#include "GNP.h"

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cassert>

#include <chrono>
#include <random>

namespace vool
{

namespace test_suit_util
{
	using plot_t = plot_data_2D<int64_t>;
	using point_t = plot_t::point_t;
	using graph_t = std::vector<plot_t>;

	class result_t;
}

struct suit_config
{
	uint32_t x_res;
	uint32_t y_res;
	bool warnings_active;
	bool png_output;
	bool persistent;
	size_t steps;
	size_t repetitions;
	gnuplot::filepath_t gnuplot_path;
	gnuplot::filepath_t output_filepath;
	gnuplot::filepath_t filename;
	std::string x_name;
	std::string y_name;

	explicit suit_config()
		: x_res(1000), y_res(500),
		warnings_active(true),
		png_output(true),
		persistent(false),
		steps(20),
		repetitions(3),
		gnuplot_path("C:\\ProgramData\\gnuplot\\bin\\gnuplot"),
		output_filepath(""),
		filename("Result"),
		x_name("Size"), y_name("Full Time in nanoseconds")
	{}
};

template<typename... TestCategorys> class test_suit
{
public:
	using result_t = test_suit_util::result_t;

	explicit test_suit(
		const suit_config&,
		TestCategorys&&...
	);

	test_suit(const test_suit&) = delete;
	test_suit(test_suit&&) = default;

	test_suit& operator=(const test_suit&) = delete;
	test_suit& operator=(test_suit&&) = default;

	void perform_categorys(const size_t, const size_t);

	void render_category(const result_t&);

	void render_results();

private:
	std::tuple<TestCategorys...> _categorys;

	std::vector<result_t> _results;

	suit_config _suit_config;

	gnuplot _gnuplot;

	bool valid_graph(const test_suit_util::graph_t&);

	void pipe_result(const result_t&);
};

namespace test_suit_util
{
class result_t
{
public:
	graph_t graph;
	std::string category_name;

	explicit result_t(
		graph_t g,
		std::string n
	)
		: graph(std::move(g)), category_name(std::move(n))
	{ }

	result_t(const result_t&) = delete;
	result_t(result_t&&) = default;

	result_t& operator= (const result_t&) = delete;
	result_t& operator= (result_t&&) = default;
};

template<typename Func> class test
{
public:
	explicit test(const std::string&, Func&&);

	test(const test&) = default;
	test(test&&) = default;

	test& operator= (const test&) = default;
	test& operator= (test&&) = default;

	point_t run_test(const size_t, const size_t);

	void flag_invisible() { _visible = false; }

	const std::string& name() const { return _name; }
	const bool visible() const { return _visible; }

private:
	Func _func;
	std::string _name;
	bool _visible;

	inline const auto start_timer() const
	{
		return std::chrono::high_resolution_clock::now();
	}

	inline point_t stop_timer(
		const std::chrono::high_resolution_clock::time_point&,
		const size_t,
		const size_t
	);
};

template<typename... Tests> class test_category
{
public:
	explicit test_category(const std::string&, Tests&&...);

	test_category(const test_category&) = default;
	test_category(test_category&&) = default;

	test_category& operator= (const test_category&) = default;
	test_category& operator= (test_category&&) = default;

	graph_t perform_tests(
		const size_t,
		const size_t,
		const size_t,
		const size_t
	);

	const std::string& name() const { return _name; }

private:
	std::tuple<Tests...> _tests;
	std::string _name;

	using graph_plots_t = std::vector<std::pair<
		std::vector<point_t>, std::string>
	>;

	graph_plots_t build_graph_plots(const size_t);

	void benchmark_size(const size_t, const size_t, graph_plots_t&);
};
}

template<typename T> struct ContainerConfig
{
	using type = T;

	size_t size; // resulting size of the container
	T lower_bound; // lowest possible value in container
	T upper_bound; // highest possible value in container
	bool unique; // true should make all values unique

	ContainerConfig() :
		size(0),
		lower_bound(std::numeric_limits<T>::min()),
		upper_bound(std::numeric_limits<T>::max()),
		unique(true)
	{
		static_assert(std::is_arithmetic<T>::value, "Type T has to be arithmetic!");
	}
};

template<typename T> std::vector<T> generate_container(ContainerConfig<T>);

// ----- IMPLEMENTATION -----

namespace test_suit_util
{

// iteration, only tuple as argument
template<typename F, typename... Ts, std::size_t... Is>
void for_each_in_tuple(std::tuple<Ts...>& tuple, F func, std::index_sequence<Is...>)
{
	// execution order matters
	static_cast<void>
		(std::initializer_list<int> { (func(std::get<Is>(tuple)), 0)... });
}

template<typename F, typename...Ts>
void for_each_in_tuple(std::tuple<Ts...>& tuple, F func)
{
	// call for_each_in_tuple with the constructed index_sequence
	for_each_in_tuple(tuple, func, std::make_index_sequence<sizeof...(Ts)>());
}

// --- test ---

template<typename T> test<T>::test(
	const std::string& name,
	T&& func
)
	:
	_name(name),
	_func(std::forward<T>(func)),
	_visible(true)
{ }

template<typename T> inline test_suit_util::point_t test<T>::stop_timer(
	const std::chrono::high_resolution_clock::time_point& start,
	const size_t iterations,
	const size_t repetitions
)
{
	auto end = std::chrono::high_resolution_clock::now();

	assert(repetitions != 0 && "Repeating task 0 times!");
	int64_t delta_time = std::chrono::duration_cast<std::chrono::nanoseconds>
		(end - start).count() / repetitions;

	return{ static_cast<int64_t>(iterations), delta_time };
}

template<typename T> test_suit_util::point_t test<T>::run_test(
	const size_t size,
	const size_t repetitions
)
{
	auto start = start_timer();
	for (size_t i = 0; i < repetitions; ++i)
		_func(size);
	return stop_timer(start, size, repetitions);
}

// --- test_category ---

template<typename... Ts> test_category<Ts...>::test_category(
	const std::string& categoryName,
	Ts&&... tests
)
	: _name(categoryName),
	_tests(std::forward<Ts>(tests)...)
{ }

template<typename... Ts> auto test_category<Ts...>::build_graph_plots(
	const size_t reserve_size
) -> graph_plots_t
{
	graph_plots_t graph_plots;

	for_each_in_tuple(_tests,
		[&](auto& test)
		{
			graph_plots.emplace_back(
				std::vector<point_t>{},
				test.name()
			);
			graph_plots.back().first.reserve(reserve_size);
		}
	);

	return graph_plots;
}

template<typename... Ts> void test_category<Ts...>::benchmark_size(
	const size_t size,
	const size_t repetitions,
	graph_plots_t& graph_plots
)
{
	auto graph_plots_it = graph_plots.begin();

	for_each_in_tuple(_tests,
		[&graph_plots_it, size, repetitions](auto& test)
		{
			auto result = test.run_test(size, repetitions);

			if (test.visible())
			{
				graph_plots_it->first.push_back(result);
				++graph_plots_it;
			}
		}
	);
};

template<typename... Ts> graph_t test_category<Ts...>::perform_tests(
	const size_t min,
	const size_t max,
	const size_t steps,
	const size_t repetitions
)
{
	auto graph_plots = build_graph_plots(steps + 2);

	for (size_t size = min; size < max; size += 1 + max / steps)
		benchmark_size(size, repetitions, graph_plots);

	benchmark_size(max, repetitions, graph_plots);

	std::sort(graph_plots.begin(), graph_plots.end(),
		[](const auto& a, const auto& b)
		{ return a.first.back().second > b.first.back().second; }
	);

	uint32_t index = {};
	graph_t category_graph;

	std::for_each(graph_plots.begin(), graph_plots.end(),
		[&category_graph, &index](const auto& plot)
		{ category_graph.emplace_back(std::move(plot.first), index++, plot.second); }
	);

	return category_graph;
}

}

// --- test_suit ---

template<typename... Ts> test_suit<Ts...>::test_suit(
	const suit_config& suit_configuration,
	Ts&&... categorys
) :
	_suit_config(suit_configuration),
	_categorys(std::forward<Ts>(categorys)...),
	_gnuplot(_suit_config.gnuplot_path)
{
	_gnuplot.set_terminal_window(_suit_config.x_res, _suit_config.y_res);

	_gnuplot("set samples 500");
	_gnuplot.add_linestyle(1, "#FF5A62", 2, 3, 5, 1.5f);
	_gnuplot.add_linestyle(2, "#2E9ACC", 2, 3, 6, 1.5f);
	_gnuplot.add_linestyle(3, "#9871FF", 2, 3, 7, 1.5f);
	_gnuplot.add_linestyle(4, "#E8803A", 2, 3, 8, 1.5f);
	_gnuplot.add_linestyle(5, "#46E86C", 2, 3, 9, 1.5f);
	_gnuplot.add_grid();
	_gnuplot.name_axis(_suit_config.x_name, _suit_config.y_name);
}

template<typename... Ts> void test_suit<Ts...>::perform_categorys(
	const size_t min,
	const size_t max
)
{
	if (max == 0 || max < min)
		return;

	_results.clear();

	test_suit_util::for_each_in_tuple(_categorys,
		[
			min,
			max,
			&results = _results,
			steps = _suit_config.steps,
			repetitions = _suit_config.repetitions
		](auto& category)
		{
			results.emplace_back(
				category.perform_tests(min, max, steps, repetitions),
				category.name()
			);
		}
	);
}

template<typename... Ts> bool test_suit<Ts...>::valid_graph(
	const test_suit_util::graph_t& graph
)
{
	if (graph.size() == 0)
		return false;

	size_t plotSize = graph.back().points().size();
	for (const auto& plot : graph)
		if (plot.points().size() == 0 || plot.points().size() != plotSize)
			return false;

	return true;
}

template<typename... Ts> void test_suit<Ts...>::pipe_result(
	const result_t& result
)
{
	if (result.graph.size() == 0)
		return;

	std::string filename(_suit_config.output_filepath + result.category_name + ".dat");

	_gnuplot.write_and_plot(
		result.graph,
		filename.c_str()
	);

	if (_suit_config.png_output)
	{
		_gnuplot.set_terminal_png(_suit_config.x_res, _suit_config.y_res);
		_gnuplot.set_png_filename(
			std::string(_suit_config.filename + result.category_name).c_str()
		);
		_gnuplot.plot(
			result.graph,
			filename.c_str()
		);
	}
}

template<typename... Ts> void test_suit<Ts...>::render_category(
	const result_t& result
)
{
	if (valid_graph(result.graph))
	{
		pipe_result(result);
	}
	else if (_suit_config.warnings_active)
	{
		std::cout
			<< "The category: \""
			<< result.category_name
			<< "\" had invalid plots!\n";
	}
}

template<typename... Ts> void test_suit<Ts...>::render_results()
{
	for (const auto& result : _results)
	{
		if (result.graph.size() > 0)
		{
			render_category(result);
		}
		else if (_suit_config.warnings_active)
		{
			std::cout
				<< "The category: \""
				<< result.category_name
				<< "\" had 0 plots!\n";
		}
	}
}

// --- make funcitons ---

template<typename T> test_suit_util::test<T> make_test(
	const std::string& testName, T func
)
{
	return test_suit_util::test<T>(testName, std::forward<T>(func));
}

template<typename... Ts> test_suit_util::test_category<Ts...>make_test_category(
	const std::string& categoryName, Ts&&... tests
)
{
	return test_suit_util::test_category<Ts...>(
		categoryName,
		std::forward<Ts>(tests)...
	);
}

template <typename... Ts> test_suit<Ts...> make_test_suit(
	const suit_config& suit_configuration, Ts&&... categorys
)
{
	return test_suit<Ts...>(
		suit_configuration,
		std::forward<Ts>(categorys)...
	);
}

// --- generate_container ---

template<typename T> std::vector<T> generate_container(ContainerConfig<T> config)
{
	static_assert(std::is_arithmetic<T>::value, "Type T has to be arithmetic!");

	std::vector<T> ret(config.size);

	using distribution_t = std::conditional_t<
		std::is_floating_point<T>::value,
		std::uniform_real_distribution<T>,
		std::uniform_int_distribution<T>
	>;

	std::mt19937_64 generator(1580); // fixed seed for reproducibility

	distribution_t distribution(config.lower_bound, config.upper_bound);

	if (config.unique)
	{
		assert(
			!(std::is_integral<T>::value
			&& config.upper_bound - config.lower_bound < config.size)
			&& "container cannot be unique, given config boundarys"
		);

		std::unordered_set<T> set;
		for (auto& element : ret)
		{
			do
			{
				element = distribution(generator);
			} while (set.count(element) != 0);
			set.insert(element);
		}
	}
	else
		std::generate(ret.begin(), ret.end(), [&]() { return distribution(generator); });

	return ret;
}

}

#endif // VOOL_TESTSUIT_H_INCLUDED


text:
OIIOapp
=======

OIIO is an open source concept of modular interface, which allows different artistic disciplines and mediums to real-time communicate.


text:
package gcloud

import (
	"fmt"
	"io/ioutil"
	"os"

	"github.com/spf13/cobra"
	"google.golang.org/api/compute/v1"

	"github.com/coreos/mantle/platform/api/gcloud"
)

var (
	cmdCreate = &cobra.Command{
		Use:   "create-instances --image <gce image name> --n <number of instances>",
		Short: "Create cluster on GCE",
		Run:   runCreate,
	}

	createConfig       string
	createNumInstances int
)

func init() {
	cmdCreate.Flags().StringVar(&createConfig, "config", "", "path to cloud config file")
	cmdCreate.Flags().IntVar(&createNumInstances, "n", 1, "number of instances")
	GCloud.AddCommand(cmdCreate)
}

func runCreate(cmd *cobra.Command, args []string) {
	if len(args) != 0 {
		fmt.Fprintf(os.Stderr, "Unrecognized args in ore create-instances: %v\n", args)
		os.Exit(2)
	}

	var cloudConfig string
	if createConfig != "" {
		b, err := ioutil.ReadFile(createConfig)
		if err != nil {
			fmt.Fprintf(os.Stderr, "Could not read cloud config file: %v\n", err)
			os.Exit(1)
		}
		cloudConfig = string(b)
	}

	var vms []*compute.Instance
	for i := 0; i < createNumInstances; i++ {
		vm, err := api.CreateInstance(cloudConfig, nil)
		if err != nil {
			fmt.Fprintf(os.Stderr, "Failed creating vm: %v\n", err)
			os.Exit(1)
		}
		vms = append(vms, vm)
		fmt.Println("Instance created")
	}

	fmt.Printf("All instances created, add your ssh keys here: https://console.developers.google.com/project/%v/compute/metadata/sshKeys\n", opts.Project)
	for _, vm := range vms {
		_, extIP := gcloud.InstanceIPs(vm)
		fmt.Printf("To access %v use cmd:\n", vm.Name)
		fmt.Printf("ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no core@%v\n", extIP)
	}
}


text:
package br.ufc.lps.model.visualization.chartjs.config;

public class ScaleLabelSet {

	private Boolean display;
	private String labelString;

	public Boolean getDisplay() {
		return display;
	}
	public void setDisplay(Boolean display) {
		this.display = display;
	}
	public String getLabelString() {
		return labelString;
	}
	public void setLabelString(String labelString) {
		this.labelString = labelString;
	}

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Grevillea 20(no. 96): 113 (1892)

#### Original name
Myrothecium cinereum Cooke

### Remarks
null


text:
/*	$FreeBSD: soc2013/dpl/head/contrib/ipfilter/ipf.h 170311 2007-06-04 02:54:36Z darrenr $	*/

/*
 * Copyright (C) 1993-2001, 2003 by Darren Reed.
 *
 * See the IPFILTER.LICENCE file for details on licencing.
 *
 * @(#)ipf.h	1.12 6/5/96
 * $Id: ipf.h,v 2.71.2.15 2007/05/11 10:44:14 darrenr Exp $
 */

#ifndef	__IPF_H__
#define	__IPF_H__

#if defined(__osf__)
# define radix_mask ipf_radix_mask
# define radix_node ipf_radix_node
# define radix_node_head ipf_radix_node_head
#endif

#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>
/*
 * This is a workaround for <sys/uio.h> troubles on FreeBSD, HPUX, OpenBSD.
 * Needed here because on some systems <sys/uio.h> gets included by things
 * like <sys/socket.h>
 */
#ifndef _KERNEL
# define ADD_KERNEL
# define _KERNEL
# define KERNEL
#endif
#ifdef __OpenBSD__
struct file;
#endif
#include <sys/uio.h>
#ifdef ADD_KERNEL
# undef _KERNEL
# undef KERNEL
#endif
#include <sys/time.h>
#include <sys/socket.h>
#include <net/if.h>
#if __FreeBSD_version >= 300000
# include <net/if_var.h>
#endif
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#ifndef	TCP_PAWS_IDLE	/* IRIX */
# include <netinet/tcp.h>
#endif
#include <netinet/udp.h>

#include <arpa/inet.h>

#include <errno.h>
#include <limits.h>
#include <netdb.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#if !defined(__SVR4) && !defined(__svr4__) && defined(sun)
# include <strings.h>
#endif
#include <string.h>
#include <unistd.h>

#include "netinet/ip_compat.h"
#include "netinet/ip_fil.h"
#include "netinet/ip_nat.h"
#include "netinet/ip_frag.h"
#include "netinet/ip_state.h"
#include "netinet/ip_proxy.h"
#include "netinet/ip_auth.h"
#include "netinet/ip_lookup.h"
#include "netinet/ip_pool.h"
#include "netinet/ip_scan.h"
#include "netinet/ip_htable.h"
#include "netinet/ip_sync.h"

#include "opts.h"

#ifndef __P
# ifdef __STDC__
#  define	__P(x)	x
# else
#  define	__P(x)	()
# endif
#endif
#ifndef __STDC__
# undef		const
# define	const
#endif

#ifndef	U_32_T
# define	U_32_T	1
# if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
    defined(__sgi)
typedef	u_int32_t	u_32_t;
# else
#  if defined(__alpha__) || defined(__alpha) || defined(_LP64)
typedef unsigned int	u_32_t;
#  else
#   if SOLARIS2 >= 6
typedef uint32_t	u_32_t;
#   else
typedef unsigned int	u_32_t;
#   endif
#  endif
# endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __sgi */
#endif /* U_32_T */

#ifndef	MAXHOSTNAMELEN
# define	MAXHOSTNAMELEN	256
#endif

#define	MAX_ICMPCODE	16
#define	MAX_ICMPTYPE	19

struct	ipopt_names	{
	int	on_value;
	int	on_bit;
	int	on_siz;
	char	*on_name;
};

typedef struct  alist_s {
	struct	alist_s	*al_next;
	int		al_not;
	i6addr_t	al_i6addr;
	i6addr_t	al_i6mask;
} alist_t;

#define	al_addr	al_i6addr.in4_addr
#define	al_mask	al_i6mask.in4_addr
#define	al_1	al_addr
#define	al_2	al_mask

typedef	struct	{
	u_short	fb_c;
	u_char	fb_t;
	u_char	fb_f;
	u_32_t	fb_k;
} fakebpf_t;

#if defined(__NetBSD__) || defined(__OpenBSD__) || \
        (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000) || \
	SOLARIS || defined(__sgi) || defined(__osf__) || defined(linux)
# include <stdarg.h>
typedef	int	(* ioctlfunc_t) __P((int, ioctlcmd_t, ...));
#else
typedef	int	(* ioctlfunc_t) __P((dev_t, ioctlcmd_t, void *));
#endif
typedef	void	(* addfunc_t) __P((int, ioctlfunc_t, void *));
typedef	int	(* copyfunc_t) __P((void *, void *, size_t));

/*
 * SunOS4
 */
#if defined(sun) && !defined(__SVR4) && !defined(__svr4__)
extern	int	ioctl __P((int, int, void *));
#endif

extern	char	thishost[];
extern	char	flagset[];
extern	u_char	flags[];
extern	struct ipopt_names ionames[];
extern	struct ipopt_names secclass[];
extern	char	*icmpcodes[MAX_ICMPCODE + 1];
extern	char	*icmptypes[MAX_ICMPTYPE + 1];
extern	int	use_inet6;
extern	int	lineNum;
extern	struct ipopt_names v6ionames[];

extern int addicmp __P((char ***, struct frentry *, int));
extern int addipopt __P((char *, struct ipopt_names *, int, char *));
extern void alist_free __P((alist_t *));
extern alist_t *alist_new __P((int, char *));
extern void binprint __P((void *, size_t));
extern void initparse __P((void));
extern u_32_t buildopts __P((char *, char *, int));
extern int checkrev __P((char *));
extern int count6bits __P((u_32_t *));
extern int count4bits __P((u_32_t));
extern char *fac_toname __P((int));
extern int fac_findname __P((char *));
extern void fill6bits __P((int, u_int *));
extern int gethost __P((char *, u_32_t *));
extern int getport __P((struct frentry *, char *, u_short *));
extern int getportproto __P((char *, int));
extern int getproto __P((char *));
extern char *getnattype __P((struct nat *, int));
extern char *getsumd __P((u_32_t));
extern u_32_t getoptbyname __P((char *));
extern u_32_t getoptbyvalue __P((int));
extern u_32_t getv6optbyname __P((char *));
extern u_32_t getv6optbyvalue __P((int));
extern void initparse __P((void));
extern void ipf_dotuning __P((int, char *, ioctlfunc_t));
extern void ipf_addrule __P((int, ioctlfunc_t, void *));
extern int ipf_parsefile __P((int, addfunc_t, ioctlfunc_t *, char *));
extern int ipf_parsesome __P((int, addfunc_t, ioctlfunc_t *, FILE *));
extern int ipmon_parsefile __P((char *));
extern int ipmon_parsesome __P((FILE *));
extern void ipnat_addrule __P((int, ioctlfunc_t, void *));
extern int ipnat_parsefile __P((int, addfunc_t, ioctlfunc_t, char *));
extern int ipnat_parsesome __P((int, addfunc_t, ioctlfunc_t, FILE *));
extern int ippool_parsefile __P((int, char *, ioctlfunc_t));
extern int ippool_parsesome __P((int, FILE *, ioctlfunc_t));
extern int kmemcpywrap __P((void *, void *, size_t));
extern char *kvatoname __P((ipfunc_t, ioctlfunc_t));
extern alist_t *load_file __P((char *));
extern int load_hash __P((struct iphtable_s *, struct iphtent_s *,
			  ioctlfunc_t));
extern int load_hashnode __P((int, char *, struct iphtent_s *, ioctlfunc_t));
extern alist_t *load_http __P((char *));
extern int load_pool __P((struct ip_pool_s *list, ioctlfunc_t));
extern int load_poolnode __P((int, char *, ip_pool_node_t *, ioctlfunc_t));
extern alist_t *load_url __P((char *));
extern alist_t *make_range __P((int, struct in_addr, struct in_addr));
extern ipfunc_t nametokva __P((char *, ioctlfunc_t));
extern void nat_setgroupmap __P((struct ipnat *));
extern int ntomask __P((int, int, u_32_t *));
extern u_32_t optname __P((char ***, u_short *, int));
extern struct frentry *parse __P((char *, int));
extern char *portname __P((int, int));
extern int pri_findname __P((char *));
extern char *pri_toname __P((int));
extern void print_toif __P((char *, struct frdest *));
extern void printaps __P((ap_session_t *, int));
extern void printbuf __P((char *, int, int));
extern void printfr __P((struct frentry *, ioctlfunc_t));
extern void printtunable __P((ipftune_t *));
extern struct iphtable_s *printhash __P((struct iphtable_s *, copyfunc_t,
					 char *, int));
extern struct iphtable_s *printhash_live __P((iphtable_t *, int, char *, int));
extern void printhashdata __P((iphtable_t *, int));
extern struct iphtent_s *printhashnode __P((struct iphtable_s *,
					    struct iphtent_s *,
					    copyfunc_t, int));
extern void printhostmask __P((int, u_32_t *, u_32_t *));
extern void printip __P((u_32_t *));
extern void printlog __P((struct frentry *));
extern void printlookup __P((i6addr_t *addr, i6addr_t *mask));
extern void printmask __P((u_32_t *));
extern void printpacket __P((struct ip *));
extern void printpacket6 __P((struct ip *));
extern struct ip_pool_s *printpool __P((struct ip_pool_s *, copyfunc_t,
					char *, int));
extern struct ip_pool_s *printpool_live __P((struct ip_pool_s *, int,
					     char *, int));
extern void printpooldata __P((ip_pool_t *, int));
extern struct ip_pool_node *printpoolnode __P((struct ip_pool_node *, int));
extern void printproto __P((struct protoent *, int, struct ipnat *));
extern void printportcmp __P((int, struct frpcmp *));
extern void optprint __P((u_short *, u_long, u_long));
#ifdef	USE_INET6
extern void optprintv6 __P((u_short *, u_long, u_long));
#endif
extern int remove_hash __P((struct iphtable_s *, ioctlfunc_t));
extern int remove_hashnode __P((int, char *, struct iphtent_s *, ioctlfunc_t));
extern int remove_pool __P((ip_pool_t *, ioctlfunc_t));
extern int remove_poolnode __P((int, char *, ip_pool_node_t *, ioctlfunc_t));
extern u_char tcp_flags __P((char *, u_char *, int));
extern u_char tcpflags __P((char *));
extern void printc __P((struct frentry *));
extern void printC __P((int));
extern void emit __P((int, int, void *, struct frentry *));
extern u_char secbit __P((int));
extern u_char seclevel __P((char *));
extern void printfraginfo __P((char *, struct ipfr *));
extern void printifname __P((char *, char *, void *));
extern char *hostname __P((int, void *));
extern struct ipstate *printstate __P((struct ipstate *, int, u_long));
extern void printsbuf __P((char *));
extern void printnat __P((struct ipnat *, int));
extern void printactivenat __P((struct nat *, int, int, u_long));
extern void printhostmap __P((struct hostmap *, u_int));
extern void printtqtable __P((ipftq_t *));

extern void set_variable __P((char *, char *));
extern char *get_variable __P((char *, char **, int));
extern void resetlexer __P((void));

#if SOLARIS
extern int gethostname __P((char *, int ));
extern void sync __P((void));
#endif

#endif /* __IPF_H__ */


text:
package androidx.leanback.widget;

/**
 * Interface for receiving notification when a item view holder is clicked.  This interface expects
 * row object to be sub class of {@link Row}.
 */
public interface OnItemViewClickedListener extends BaseOnItemViewClickedListener<Row> {

}


text:
using System;
using System.Linq;
using Bridge;
using Retyped;
using Widgetoko.Twitter;
using Platform = Retyped.node.NodeJS.Platform;
using lit = Retyped.electron.Literals;

namespace Widgetoko.MainProcess
{
    public class App
    {
        [Init(InitPosition.Top)]
        public static void InitGlobals()
        {
            node.require.Self("./bridge.js");
            node.require.Self("./UserSettings.js");
            node.require.Self("./newtonsoft.json.js");

            // The call below is required to initialize a global var 'Electron'.
            var Electron = (electron.Electron.AllElectron)node.require.Self("electron");

            // Keep a global reference of the window object, if you don't, the window will
            // be closed automatically when the JavaScript object is garbage collected.
            electron.Electron.BrowserWindow win = null;
        }

        [Template("Electron")]
        public static electron.Electron.AllElectron Electron;

        [Template("win")]
        public static electron.Electron.BrowserWindow Win;

        public static electron.Electron.Tray AppIcon;
        public static electron.Electron.Menu ContextMenu;

        private static UserSettings _settings;

        public static void Main()
        {
            var app = Electron.app;

            // This method will be called when Electron has finished
            // initialization and is ready to create browser windows.
            // Some APIs can only be used after this event occurs.
            app.on(lit.ready, StartApp);

            // Quit when all windows are closed.
            app.on(lit.window_all_closed, () =>
            {
                // On macOS it is common for applications and their menu bar
                // to stay active until the user quits explicitly with Cmd + Q
                if (node.process2.platform != Platform.darwin)
                {
                    app.quit();
                }
            });

            // On macOS it's common to re-create a window in the app when the
            // dock icon is clicked and there are no other windows open.
            app.on(lit.activate, (ev, hasVisibleWindows) =>
            {
                if (Win == null)
                {
                    StartApp(null);
                }
            });

            // Load User Settings:
            LoadUserSettings();

            // Init IPC message handlers:
            ConfigureIPC();
        }

        private static void ConfigureIPC()
        {
            Electron.ipcMain.on(Constants.IPC.GetCredentialsSync, new Action<electron.Electron.Event>(e =>
            {
                e.returnValue = _settings.Credentials;
            }));

            Electron.ipcMain.on(Constants.IPC.SetCredentials, new Action<electron.Electron.Event, TwitterCredentials>((e, cred) =>
            {
                _settings.Credentials = cred;
                SaveUserSettings();
            }));

            Electron.ipcMain.on(Constants.IPC.StartCapture, new Action<electron.Electron.Event>(e =>
            {
                App.ToggleStartStop(true);
            }));

            Electron.ipcMain.on(Constants.IPC.StopCapture, new Action<electron.Electron.Event>(e =>
            {
                App.ToggleStartStop(false);
            }));
        }

        private static void StartApp(object launchInfo)
        {
            var splash = CreateSplashScreen();

            splash.once(lit.ready_to_show, () =>
            {
                // to prevent showing not rendered window:
                splash.show();
            });

            node.setTimeout2(args =>
            {
                CreateMainWindow();

                Win.once(lit.ready_to_show, () =>
                {
                    // to prevent showing not rendered window:
                    Win.show();

                    // Splash screen should be closed after the main window is created
                    // to prevent application from being terminated.
                    splash.close();
                    splash = null;

                    Win.focus();

                    // Show the app icon in tray:
                    App.ShowTrayIcon();
                });

            }, 2000);
        }

        private static electron.Electron.BrowserWindow CreateSplashScreen()
        {
            var options = ObjectLiteral.Create<electron.Electron.BrowserWindowConstructorOptions>();
            options.width = 600;
            options.height = 400;
            options.icon = node.path.join(node.__dirname, "assets/app-icon/png/32.png");
            options.title = GetAppNameWithVersion(true);
            options.frame = false;
            options.skipTaskbar = true;
            options.show = false;

            // Create the browser window.
            var splash = new electron.Electron.BrowserWindow(options);
            App.LoadWindow(splash, "forms/SplashScreen.html");

            return splash;
        }

        private static void CreateMainWindow()
        {
            var options = ObjectLiteral.Create<electron.Electron.BrowserWindowConstructorOptions>();
            options.width = 600;
            options.height = 800;
            options.icon = node.path.join(node.__dirname, "assets/app-icon/png/32.png");
            options.title = GetAppNameWithVersion(true);
            options.show = false;

            // Create the browser window.
            Win = new electron.Electron.BrowserWindow(options);
            SetContextMenu(Win);

            App.SetMainMenu();

            App.LoadWindow(Win, "forms/MainForm.html");

            Win.on(lit.closed, () =>
            {
                // Dereference the window object, usually you would store windows
                // in an array if your app supports multi windows, this is the time
                // when you should delete the corresponding element.
                Win = null;
            });

            Win.on(lit.minimize, () =>
            {
                Win.setSkipTaskbar(true);
            });
        }

        private static electron.Electron.BrowserWindow CreateOptionsWindow()
        {
            var options = ObjectLiteral.Create<electron.Electron.BrowserWindowConstructorOptions>();
            options.width = 440;
            options.height = 565;
            options.title = "Options";
            options.icon = node.path.join(node.__dirname, "assets/app-icon/png/32.png");
            options.skipTaskbar = true;
            options.parent = Win;
            options.modal = true;
            options.show = false;
            options.maximizable = false;
            options.minimizable = false;
            options.resizable = false;

            // Create the browser window.
            var optionsWin = new electron.Electron.BrowserWindow(options);

            optionsWin.setMenu(null);
            SetContextMenu(optionsWin);

            App.LoadWindow(optionsWin, "forms/OptionsForm.html");

            return optionsWin;
        }

        private static void LoadWindow(electron.Electron.BrowserWindow win, string page)
        {
            var windowUrl = ObjectLiteral.Create<node.url.URL>();
            windowUrl.pathname = node.path.join(node.__dirname, page);
            windowUrl.protocol = "file:";

            var formattedUrl = node.url.format(windowUrl);

            // and load the index.html of the app.
            win.loadURL(formattedUrl);
        }

        private static void ShowTrayIcon()
        {
            var icon16Path = node.path.join(node.__dirname, "assets/app-icon/png/16.png");
            var icon32Path = node.path.join(node.__dirname, "assets/app-icon/png/32.png");

            Action showFn = () =>
            {
                if (!Win.isVisible())
                {
                    Win.show();
                }

                Win.focus();
                Win.setSkipTaskbar(false);
            };

            var openMenuItem = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Open",
                click = delegate { showFn(); }
            };

            var captureMenuItem = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Capture",
                submenu = new[]
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Start",
                        click = delegate
                        {
                            Win.webContents.send(Constants.IPC.StartCapture);
                            App.ToggleStartStopMenuItems(true);
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Stop",
                        enabled = false,
                        click = delegate
                        {
                            Win.webContents.send(Constants.IPC.StopCapture);
                            App.ToggleStartStopMenuItems(false);
                        }
                    }
                }
            };

            var visitMenuItem = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Visit Bridge.NET",
                click = delegate { Electron.shell.openExternal("http://bridge.net/"); }
            };

            var exitMenuItem = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Exit",
                role = "quit"
            };

            ContextMenu = electron.Electron.Menu.buildFromTemplate(new[] { openMenuItem, captureMenuItem, visitMenuItem, exitMenuItem });

            var iconPath = node.process2.platform == Platform.darwin ? icon16Path : icon32Path;

            AppIcon = new electron.Electron.Tray(iconPath);
            AppIcon.setToolTip(Constants.AppTitle);
            AppIcon.setContextMenu(ContextMenu);
            AppIcon.on("click", () =>
            {
                showFn();
            });
        }

        private static void SetMainMenu()
        {
            var fileMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "File",
                submenu = new []
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Options",
                        accelerator = CreateMenuAccelerator("F2"),
                        click = (i, w, e) =>
                        {
                            var optionsWin = App.CreateOptionsWindow();
                            optionsWin.once(lit.ready_to_show, () =>
                            {
                                // to prevent showing not rendered window:
                                optionsWin.show();
                            });
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Exit",
                        role = "quit"
                    }
                }
            };

            var editMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Edit",
                submenu = new[]
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "undo",
                        accelerator = CreateMenuAccelerator("Ctrl+Z")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "redo",
                        accelerator = CreateMenuAccelerator("Ctrl+Y")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "cut",
                        accelerator = CreateMenuAccelerator("Ctrl+X")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "copy",
                        accelerator = CreateMenuAccelerator("Ctrl+C")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "paste",
                        accelerator = CreateMenuAccelerator("Ctrl+V")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "selectall",
                        accelerator = CreateMenuAccelerator("Ctrl+A")
                    }
                }
            };

            var viewMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "View",
                submenu = new []
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Reload",
                        accelerator = CreateMenuAccelerator("Ctrl+R"),
                        click = (i, w, e) =>
                        {
                            w?.webContents.reload();
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Toggle DevTools",
                        accelerator = CreateMenuAccelerator("F12"),
                        click = (i, w, e) =>
                        {
                            w?.webContents.toggleDevTools();
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Theme",
                        submenu = new []
                        {
                            new electron.Electron.MenuItemConstructorOptions
                            {
                                type = lit.radio,
                                label = "Light",
                                @checked = true,
                                click = (i, w, e) =>
                                {
                                    Win.webContents.send(Constants.IPC.ToggleTheme);
                                }

                            },
                            new electron.Electron.MenuItemConstructorOptions
                            {
                                type = lit.radio,
                                label = "Dark",
                                click = (i, w, e) =>
                                {
                                    Win.webContents.send(Constants.IPC.ToggleTheme);
                                }
                            }
                        }
                    }
                }
            };

            var captureMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Capture",
                submenu = new[]
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Start",
                        accelerator = CreateMenuAccelerator("F5"),
                        click = (i, w, e) =>
                        {
                            App.ToggleStartStop(true);
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Stop",
                        accelerator = CreateMenuAccelerator("F6"),
                        enabled = false,
                        click = (i, w, e) =>
                        {
                            App.ToggleStartStop(false);
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Clear captured tweets",
                        accelerator = CreateMenuAccelerator("F7"),
                        click = (i, w, e) =>
                        {
                            Win.webContents.send(Constants.IPC.ClearCapture);
                        }
                    }
                }
            };

            var helpMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Help",
                submenu = new[]
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Visit Bridge.NET",
                        click = delegate
                        {
                            Electron.shell.openExternal("http://bridge.net/");
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Visit Retyped",
                        click = delegate { Electron.shell.openExternal("https://retyped.com/"); }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Visit Widgetoko",
                        click = delegate { Electron.shell.openExternal("https://github.com/bridgedotnet/Widgetoko"); }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Visit Electron API Demos",
                        click = delegate { Electron.shell.openExternal("https://github.com/electron/electron-api-demos"); }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Visit Twitter API Reference",
                        click = delegate { Electron.shell.openExternal("https://dev.twitter.com/streaming/overview"); }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "About",
                        click = delegate
                        {
                            var msgBoxOpts = ObjectLiteral.Create<electron.Electron.MessageBoxOptions>();
                            msgBoxOpts.type = "info";
                            msgBoxOpts.title = "About";
                            msgBoxOpts.buttons = new[] {"OK"};
                            msgBoxOpts.message = GetAppNameWithVersion(false) + @"

Node: " + node.process2.versions.node + @"
Chrome: " + node.process2.versions["chrome"] + @"
Electron: " + node.process2.versions["electron"];

                            Electron.dialog.showMessageBox(msgBoxOpts);
                        }
                    }
                }
            };

            var appMenu = electron.Electron.Menu.buildFromTemplate(new[] { fileMenu, editMenu, captureMenu, viewMenu, helpMenu });
            electron.Electron.Menu.setApplicationMenu(appMenu);
        }

        private static void SetMainMenuForOptions(electron.Electron.BrowserWindow win)
        {
            var fileMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "File",
                submenu = new[]
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Close",
                        role = "close"
                    }
                }
            };

            var editMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "Edit",
                submenu = new[]
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "undo",
                        accelerator = CreateMenuAccelerator("Ctrl+Z")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "redo",
                        accelerator = CreateMenuAccelerator("Ctrl+Y")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "cut",
                        accelerator = CreateMenuAccelerator("Ctrl+X")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "copy",
                        accelerator = CreateMenuAccelerator("Ctrl+C")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "paste",
                        accelerator = CreateMenuAccelerator("Ctrl+V")
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        role = "selectall",
                        accelerator = CreateMenuAccelerator("Ctrl+A")
                    }
                }
            };

            var viewMenu = new electron.Electron.MenuItemConstructorOptions
            {
                label = "View",
                submenu = new[]
                {
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Reload",
                        accelerator = CreateMenuAccelerator("Ctrl+R"),
                        click = (i, w, e) =>
                        {
                            w?.webContents.reload();
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Toggle DevTools",
                        accelerator = CreateMenuAccelerator("F12"),
                        click = (i, w, e) =>
                        {
                            w?.webContents.toggleDevTools();
                        }
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        type = lit.separator
                    },
                    new electron.Electron.MenuItemConstructorOptions
                    {
                        label = "Theme",
                        submenu = new []
                        {
                            new electron.Electron.MenuItemConstructorOptions
                            {
                                type = lit.radio,
                                label = "Light",
                                @checked = true,
                                click = (i, w, e) =>
                                {
                                    Win.webContents.send(Constants.IPC.ToggleTheme);
                                }

                            },
                            new electron.Electron.MenuItemConstructorOptions
                            {
                                type = lit.radio,
                                label = "Dark",
                                click = (i, w, e) =>
                                {
                                    Win.webContents.send(Constants.IPC.ToggleTheme);
                                }
                            }
                        }
                    }
                }
            };

            var optionsMenu = electron.Electron.Menu.buildFromTemplate(new[] { fileMenu, editMenu, viewMenu });
            win.setMenu(optionsMenu);
        }

        private static void SetContextMenu(electron.Electron.BrowserWindow win)
        {
            var selectionMenuTemplate = new[]
            {
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "copy",
                    accelerator = CreateMenuAccelerator("Ctrl+C")
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    type = lit.separator
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "selectall",
                    accelerator = CreateMenuAccelerator("Ctrl+A")
                }
            };

            var inputMenuTemplate = new[]
            {
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "undo",
                    accelerator = CreateMenuAccelerator("Ctrl+Z")
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "redo",
                    accelerator = CreateMenuAccelerator("Ctrl+Y")
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    type = lit.separator
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "cut",
                    accelerator = CreateMenuAccelerator("Ctrl+X")
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "copy",
                    accelerator = CreateMenuAccelerator("Ctrl+C")
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "paste",
                    accelerator = CreateMenuAccelerator("Ctrl+V")
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    type = lit.separator
                },
                new electron.Electron.MenuItemConstructorOptions
                {
                    role = "selectall",
                    accelerator = CreateMenuAccelerator("Ctrl+A")
                }
            };

            var selectionMenu = electron.Electron.Menu.buildFromTemplate(selectionMenuTemplate);
            var inputMenu = electron.Electron.Menu.buildFromTemplate(inputMenuTemplate);

            win.webContents.on(lit.context_menu, (e, props) =>
            {
                if (props.isEditable)
                {
                    inputMenu.popup(win);
                }
                else if(props.selectionText != null && !string.IsNullOrEmpty(props.selectionText.Trim()))
                {
                    selectionMenu.popup(win);
                }
            });
        }

        private static electron.Electron.Accelerator CreateMenuAccelerator(string value)
        {
            if (node.process2.platform == Platform.darwin)
            {
                value = value.Replace("Ctrl", "Command");
            }

            return value.As<electron.Electron.Accelerator>();
        }

        private static void ToggleStartStop(bool isStart)
        {
            Win.webContents.send(isStart ? Constants.IPC.StartCapture : Constants.IPC.StopCapture);
            App.ToggleStartStopMenuItems(isStart);
        }

        private static void ToggleStartStopMenuItems(bool isStarted)
        {
            var appMenu = electron.Electron.Menu.getApplicationMenu();
            var captureMenu = appMenu.items
                .First(x => x.label == "Capture")
                ["submenu"]
                .As<electron.Electron.Menu>();

            var startMenuItem = captureMenu.items.First(x => x.label == "Start");
            var stopMenuItem = captureMenu.items.First(x => x.label == "Stop");

            startMenuItem.enabled = !isStarted;
            stopMenuItem.enabled = isStarted;

            if (AppIcon != null && ContextMenu != null)
            {
                var captureCtxMenu = ContextMenu.items
                    .First(x => x.label == "Capture")
                    ["submenu"]
                    .As<electron.Electron.Menu>();

                var startMenuCtxItem = captureCtxMenu.items.First(x => x.label == "Start");
                var stopMenuCtxItem = captureCtxMenu.items.First(x => x.label == "Stop");

                startMenuCtxItem.enabled = !isStarted;
                stopMenuCtxItem.enabled = isStarted;
            }

            Win.setTitle($"{Constants.AppTitle} ({(isStarted ? "Running" : "Stopped")})");
        }

        private static void LoadUserSettings()
        {
            var userDataPath = Electron.app.getPath("userData");
            var settingsPath = node.path.join(userDataPath, Constants.UserSettingsFileName);

            if (node.fs.existsSync(settingsPath))
            {
                var fileData = node.fs.readFileSync((node.fs.PathLike)settingsPath, (Union<node.fs.readFile2Config2, string>)"utf8");
                _settings = UserSettings.Deserialize(fileData);
            }
            else
            {
                _settings = new UserSettings
                {
                    Credentials = new TwitterCredentials()
                };
            }
        }

        private static void SaveUserSettings()
        {
            var userDataPath = Electron.app.getPath("userData");
            var settingsPath = node.path.join(userDataPath, Constants.UserSettingsFileName);
            var data = _settings.Serialize();

            node.fs.writeFileSync((node.fs.PathLike)settingsPath, data);
        }

        private static string GetAppNameWithVersion(bool getDisplayedVersion)
        {
            var fullVersion = Electron.app.getVersion();

            var version = getDisplayedVersion
                ? string.Join(".", fullVersion.Split('.').Take(2))
                : fullVersion;

            return $"{Constants.AppTitle} {version}";
        }
    }
}


text:
package chatty.bot.RemoteControl;

import chatty.bot.commands.Cmd;

public class CmdPlainString extends Cmd {
	public CmdPlainString(String name, String msg) {
		super(name);
		this.msg = msg;
	}

	private String msg;

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public void CallRemoteBot(RemoteControlBot rb) {
		rb.parseWhisper(this.getName(), msg);
	}

}


text:
var render = function(theme, data, meta, require) {
    var log = new Log();
    var navigation = 'navigation';
    var navigationContext = data;
    switch (data.assetTypeCount) {
        case 1:
            navigation = 'navigation-single';
            break;
        default:
            break;
    }
    //var assets = require('/helpers/assets.js');
    theme('2-column-right', {
        title: data.meta.title,
        header: [{
            partial: 'header',
            context: data
        }],
        navigation: [{
            partial: navigation,
            context: navigationContext
        }],
        body: [
            {
                partial: 'sort-assets',
                context: data
             },
            {
                partial: 'assets',
                context: data
             }
            // {
            //     partial: 'pagination',
            //     context: require('/helpers/pagination.js').format(data.paging)
            // }
        ],
        right: [
            {
                partial: 'my-assets-link',
                context: data
            },
            {
                partial: 'recent-assets',
                context: data
            },
            {
                partial: 'tags',
                context: data
            }
        ]
    });
};


text:
#include "src/core/surface/lame_client.h"

#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include <grpc/support/log.h>

static void *tag(gpr_intptr x) { return (void *)x; }

int main(int argc, char **argv) {
  grpc_channel *chan;
  grpc_call *call;
  grpc_metadata md = {"a", "b", 1};
  grpc_completion_queue *cq;
  cq_verifier *cqv;

  grpc_test_init(argc, argv);
  grpc_init();

  chan = grpc_lame_client_channel_create();
  GPR_ASSERT(chan);
  call = grpc_channel_create_call_old(chan, "/Foo", "anywhere",
                                      GRPC_TIMEOUT_SECONDS_TO_DEADLINE(100));
  GPR_ASSERT(call);
  cq = grpc_completion_queue_create();
  cqv = cq_verifier_create(cq);

  /* we should be able to add metadata */
  GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata_old(call, &md, 0));

  /* and invoke the call */
  GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke_old(call, cq, tag(2), tag(3), 0));

  /* the call should immediately fail */
  cq_expect_client_metadata_read(cqv, tag(2), NULL);
  cq_expect_finished(cqv, tag(3), NULL);
  cq_verify(cqv);

  grpc_call_destroy(call);
  grpc_channel_destroy(chan);
  cq_verifier_destroy(cqv);
  grpc_completion_queue_destroy(cq);

  grpc_shutdown();

  return 0;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Boletus squamosus Huds., 1778

### Remarks
null


text:
Resource

Historique

Version 1

				<button class="submit btn btn-primary"
					data-render="renderRestoreBtn">Restaurer</button>

		<button type="button" class="close" data-dismiss="modal"
			aria-hidden="true">×</button>

Restore Dialog

The resource has been restored successfully.

		<button class="btn btn-primary" data-dismiss="modal"
			aria-hidden="true">Ok</button>