//////////////////////////////////////////////////////////////////// ocap mode
761625
function(ocap, values, k) {
            var is_ocap = false, str;
            try {
                is_ocap |= ocap.r_attributes['class'] === 'OCref';
                str = ocap[0];
            } catch (e) {};
            if(!is_ocap) {
                try {
                    is_ocap |= ocap.attributes.value[0].value.value[0] === 'OCref';
                    str = ocap.value[0];
                } catch (e) {};
            }
            if (!is_ocap) {
                k(new Error("Expected an ocap, instead got " + ocap), undefined);
                return;
            }
            var params = [str];
            params.push.apply(params, values);
            // determine the proper queue from the OCAP prefix
            var queue = (str.charCodeAt(0) == 64) ? compute_queue : ctrl_queue;
            _cmd(Rserve.Rsrv.CMD_OCcall, _encode_value(params, Rserve.Rsrv.XT_LANG_NOTAG),
                 k, "", queue);
        }
1357052
function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
  let flattenSpans = mode.flattenSpans
  if (flattenSpans == null) flattenSpans = cm.options.flattenSpans
  let curStart = 0, curStyle = null
  let stream = new StringStream(text, cm.options.tabSize, context), style
  let inner = cm.options.addModeClass && [null]
  if (text == "") extractLineClasses(callBlankLine(mode, context.state), lineClasses)
  while (!stream.eol()) {
    if (stream.pos > cm.options.maxHighlightLength) {
      flattenSpans = false
      if (forceToEnd) processLine(cm, text, context, stream.pos)
      stream.pos = text.length
      style = null
    } else {
      style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses)
    }
    if (inner) {
      let mName = inner[0].name
      if (mName) style = "m-" + (style ? mName + " " + style : mName)
    }
    if (!flattenSpans || curStyle != style) {
      while (curStart < stream.start) {
        curStart = Math.min(stream.start, curStart + 5000)
        f(curStart, curStyle)
      }
      curStyle = style
    }
    stream.start = stream.pos
  }
  while (curStart < stream.pos) {
    // Webkit seems to refuse to render text nodes longer than 57444
    // characters, and returns inaccurate measurements in nodes
    // starting around 5000 chars.
    let pos = Math.min(stream.pos, curStart + 5000)
    f(pos, curStyle)
    curStart = pos
  }
}
286816
function (o, cb) {
    if (!o.src) {
      throw new Error('glob missing');
    }
    if (!o.out) {
      throw new Error('output dir missing');
    }

    var opts = _.extend({}, defaults, o);
    if (opts.style && path.basename(opts.style).indexOf('.') === -1) {
      opts.style = path.join(opts.style, replaceExtension(opts.name, '.' + opts.processor));
    }
    vfs.src(opts.src)
      .pipe(sprite(opts))
      .pipe(through2.obj(writeFile))
      .on('data', noop)
      .on('end', function () {
        if (_.isFunction(cb)) {
          cb();
        }
      });
  }
670915
T clipInput(T input, T output) {
		double ratioInput = input.width/(double)input.height;
		double ratioOutput = output.width/(double)output.height;

		T a = input;

		if( ratioInput > ratioOutput ) { // clip the width
			int width = input.height*output.width/output.height;
			int x0 = (input.width-width)/2;
			int x1 = x0 + width;

			clipped = input.subimage(x0,0,x1,input.height, clipped);
			a = clipped;
		} else if( ratioInput < ratioOutput ) { // clip the height
			int height = input.width*output.height/output.width;
			int y0 = (input.height-height)/2;
			int y1 = y0 + height;

			clipped = input.subimage(0,y0,input.width,y1, clipped);
			a = clipped;
		}

		return a;
	}
1249511
func isAllCaps(s string) bool {
	for _, r := range s {
		if unicode.IsLetter(r) && !unicode.IsUpper(r) {
			return false
		}
	}
	return true
}
263269
function (oVersionInfo) {
				var bResult = false,
					sFrameworkInfo = "";

				try {
					sFrameworkInfo = oVersionInfo.gav ? oVersionInfo.gav : oVersionInfo.name;
					bResult = sFrameworkInfo.indexOf('openui5') !== -1 ? true : false;
				} catch (e) {
					 return bResult;
				}

				return bResult;
			}
679949
func ensureCap(s []byte, n int) []byte {
	if n <= cap(s) {
		return s
	}
	// logic adapted from appendslice1 in runtime
	m := cap(s)
	if m == 0 {
		m = n
	} else {
		for {
			if m < 1024 {
				m += m
			} else {
				m += m / 4
			}
			if m >= n {
				break
			}
		}
	}
	t := make([]byte, len(s), m)
	copy(t, s)
	return t
}
919877
async function cappedSTO_launch(stoConfig, factoryAddress) {
  console.log(chalk.blue('Launch STO - Capped STO in No. of Tokens'));

  let cappedSTOFactoryABI = abis.cappedSTOFactory();
  let cappedSTOFactory = new web3.eth.Contract(cappedSTOFactoryABI, factoryAddress);
  cappedSTOFactory.setProvider(web3.currentProvider);
  let stoFee = new web3.utils.BN(await cappedSTOFactory.methods.getSetupCost().call());

  let contractBalance = new web3.utils.BN(await polyToken.methods.balanceOf(securityToken._address).call());
  if (contractBalance.lt(stoFee)) {
    let transferAmount = stoFee.sub(contractBalance);
    let ownerBalance = new web3.utils.BN(await polyToken.methods.balanceOf(Issuer.address).call());
    if (ownerBalance.lt(transferAmount)) {
      console.log(chalk.red(`\n**************************************************************************************************************************************************`));
      console.log(chalk.red(`Not enough balance to pay the CappedSTO fee, Requires ${web3.utils.fromWei(transferAmount)} POLY but have ${web3.utils.fromWei(ownerBalance)} POLY. Access POLY faucet to get the POLY to complete this txn`));
      console.log(chalk.red(`**************************************************************************************************************************************************\n`));
      return;
    } else {
      let transferAction = polyToken.methods.transfer(securityToken._address, transferAmount);
      let receipt = await common.sendTransaction(transferAction, { factor: 2 });
      let event = common.getEventFromLogs(polyToken._jsonInterface, receipt.logs, 'Transfer');
      console.log(`Number of POLY sent: ${web3.utils.fromWei(new web3.utils.BN(event._value))}`)
    }
  }

  let oneMinuteFromNow = new web3.utils.BN((Math.floor(Date.now() / 1000) + 60));
  let oneMonthFromNow = new web3.utils.BN((Math.floor(Date.now() / 1000) + (30 * 24 * 60 * 60)));

  let cappedSTOconfig = {};
  let useConfigFile = typeof stoConfig !== 'undefined';
  if (!useConfigFile) {
    cappedSTOconfig.cap = readlineSync.question('How many tokens do you plan to sell on the STO? (500.000): ');
    if (cappedSTOconfig.cap == "") cappedSTOconfig.cap = 500000;

    cappedSTOconfig.raiseType = readlineSync.question('Enter' + chalk.green(` P `) + 'for POLY raise or leave empty for Ether raise (E): ');
    if (cappedSTOconfig.raiseType.toUpperCase() == 'P') {
      cappedSTOconfig.raiseType = [gbl.constants.FUND_RAISE_TYPES.POLY];
    } else {
      cappedSTOconfig.raiseType = [gbl.constants.FUND_RAISE_TYPES.ETH];
    }

    cappedSTOconfig.rate = readlineSync.question(`Enter the rate (1 ${cappedSTOconfig.raiseType == gbl.constants.FUND_RAISE_TYPES.POLY ? 'POLY' : 'ETH'} = X ${tokenSymbol}) for the STO (1000): `);
    if (cappedSTOconfig.rate == "") cappedSTOconfig.rate = 1000;

    cappedSTOconfig.wallet = readlineSync.question('Enter the address that will receive the funds from the STO (' + Issuer.address + '): ');
    if (cappedSTOconfig.wallet == "") cappedSTOconfig.wallet = Issuer.address;

    cappedSTOconfig.startTime = readlineSync.question('Enter the start time for the STO (Unix Epoch time)\n(1 minutes from now = ' + oneMinuteFromNow + ' ): ');

    cappedSTOconfig.endTime = readlineSync.question('Enter the end time for the STO (Unix Epoch time)\n(1 month from now = ' + oneMonthFromNow + ' ): ');
  } else {
    cappedSTOconfig = stoConfig;
  }

  if (cappedSTOconfig.startTime == "") cappedSTOconfig.startTime = oneMinuteFromNow;
  if (cappedSTOconfig.endTime == "") cappedSTOconfig.endTime = oneMonthFromNow;

  let cappedSTOABI = abis.cappedSTO();
  let configureFunction = cappedSTOABI.find(o => o.name === 'configure' && o.type === 'function');
  let bytesSTO = web3.eth.abi.encodeFunctionCall(configureFunction,
    [cappedSTOconfig.startTime,
    cappedSTOconfig.endTime,
    web3.utils.toWei(cappedSTOconfig.cap.toString()),
    web3.utils.toWei(cappedSTOconfig.rate.toString()),
    cappedSTOconfig.raiseType,
    cappedSTOconfig.wallet]
  );

  let addModuleAction = securityToken.methods.addModule(cappedSTOFactory.options.address, bytesSTO, stoFee, 0);
  let receipt = await common.sendTransaction(addModuleAction);
  let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'ModuleAdded');
  console.log(`STO deployed at address: ${event._module}`);

  let cappedSTO = new web3.eth.Contract(cappedSTOABI, event._module);
  cappedSTO.setProvider(web3.currentProvider);

  return cappedSTO;
}
1280089
function (mode, code, tokens, flags, scope, parseMode) {
    var index = code.index,
        length = code.length;

    if ( /* <!-- */
        code.codePointAt(index) === 0x003c &&
        code.codePointAt(++index) === 0x0021 &&
        code.codePointAt(++index) === 0x002d &&
        code.codePointAt(++index) === 0x002d
    ) {
        index++;

        for (; index < length; index++) {
            if ( /* --> */
                code.codePointAt(index) === 0x002d &&
                code.codePointAt(index + 1) === 0x002d &&
                code.codePointAt(index + 2) === 0x003e
            ) {
                index += 3;
                code.index = index;

                return true;
            }
        }

        throw code.makeError(
            code.index, code.index + 4,
            'Unclosed Comment: Expected "-->" to fallow "<!--".'
        );
    }

    return null;
}
1244133
ProtobufSystemInfo.Section toProtobuf(MemoryMXBean memoryBean) {
    ProtobufSystemInfo.Section.Builder protobuf = ProtobufSystemInfo.Section.newBuilder();
    protobuf.setName(name);
    addAttributeInMb(protobuf,"Max Memory (MB)", Runtime.getRuntime().maxMemory());
    addAttributeInMb(protobuf, "Free Memory (MB)", Runtime.getRuntime().freeMemory());
    MemoryUsage heap = memoryBean.getHeapMemoryUsage();
    addAttributeInMb(protobuf, "Heap Committed (MB)", heap.getCommitted());
    addAttributeInMb(protobuf, "Heap Init (MB)", heap.getInit());
    addAttributeInMb(protobuf, "Heap Max (MB)", heap.getMax());
    addAttributeInMb(protobuf, "Heap Used (MB)", heap.getUsed());
    MemoryUsage nonHeap = memoryBean.getNonHeapMemoryUsage();
    addAttributeInMb(protobuf, "Non Heap Committed (MB)", nonHeap.getCommitted());
    addAttributeInMb(protobuf, "Non Heap Init (MB)", nonHeap.getInit());
    addAttributeInMb(protobuf, "Non Heap Max (MB)", nonHeap.getMax());
    addAttributeInMb(protobuf, "Non Heap Used (MB)", nonHeap.getUsed());
    OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
    setAttribute(protobuf,"System Load Average", format(Locale.ENGLISH, "%.1f%% (last minute)", os.getSystemLoadAverage() * 100.0));
    ThreadMXBean thread = ManagementFactory.getThreadMXBean();
    setAttribute(protobuf, "Threads", thread.getThreadCount());

    return protobuf.build();
  }
1021406
func (c *containerCapabilities) ApplyCaps() error {
	c.pid.Clear(allCapabilityTypes)
	c.pid.Set(capability.BOUNDS, c.bounding...)
	c.pid.Set(capability.PERMITTED, c.permitted...)
	c.pid.Set(capability.INHERITABLE, c.inheritable...)
	c.pid.Set(capability.EFFECTIVE, c.effective...)
	c.pid.Set(capability.AMBIENT, c.ambient...)
	return c.pid.Apply(allCapabilityTypes)
}
1229025
function(data) {
        var TTML_BODY = '',
            index = 0,
            splitText,
            captions = data;

        TTML_BODY += TTML.header.join('\n') + '\n';
        captions.forEach(function(caption) {
            if (caption.text.length > 0 && validateText(caption.text)) {
                if ((/&/.test(caption.text)) && !(/&amp;/.test(caption.text))) {
                    caption.text = caption.text.replace(/&/g, '&amp;');
                }
                if ((/</.test(caption.text)) && !(/&lt;/.test(caption.text))) {
                    caption.text = caption.text.replace(/</g, '&lt;');
                }
                if ((/>/.test(caption.text)) && !(/&gt;/.test(caption.text))) {
                    caption.text = caption.text.replace(/>/g, '&gt;');
                }
                if (/\{break\}/.test(caption.text)) {
                    splitText = caption.text.split('{break}');
                    //TODO this should count for number of breaks and add the appropriate pops where needed.
                    for (index = 0; index < splitText.length; index++) {
                        TTML_BODY += TTML.lineTemplate.replace('{region}', 'pop' + (index + 1))
                            .replace('{startTime}', module.exports.formatTime(caption.startTimeMicro))
                            .replace('{endTime}', module.exports.formatTime(caption.endTimeMicro))
                            .replace('{text}', module.exports.renderMacros(macros.fixItalics(macros.cleanMacros(splitText[index])))) + '\n';
                    }
                } else {
                    TTML_BODY += TTML.lineTemplate.replace('{region}', 'pop1')
                        .replace('{startTime}', module.exports.formatTime(caption.startTimeMicro))
                        .replace('{endTime}', module.exports.formatTime(caption.endTimeMicro))
                        .replace('{text}', module.exports.renderMacros(macros.fixItalics(macros.cleanMacros(caption.text)))) + '\n';
                }
            }
        });

        return TTML_BODY + TTML.footer.join('\n') + '\n';
    }
589597
function() {
			if (!this._oControl || this._bLoading) {
				return;
			}

			// if max item count not reached or if we do not know the count
			var oBinding = this._oControl.getBinding("items");
			if (oBinding && !oBinding.isLengthFinal() || this._iLimit < this._oControl.getMaxItemsCount()) {
				// The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control.
				if (this._oControl.getMetadata().hasProperty("enableBusyIndicator")) {
					this._bParentEnableBusyIndicator = this._oControl.getEnableBusyIndicator();
					this._oControl.setEnableBusyIndicator(false);
				}

				this._iLimit += this._oControl.getGrowingThreshold();
				this._updateTriggerDelayed(true);
				this.updateItems("Growing");
			}
		}
227089
@Override
    public void spr(char order, char Uplo, double alpha, INDArray X, INDArray Ap) {
        if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
            OpProfiler.getInstance().processBlasCall(false, Ap, X);


        // FIXME: int cast

        if (X.data().dataType() == DataType.DOUBLE) {
            DefaultOpExecutioner.validateDataType(DataType.DOUBLE, X);
            dspr(order, Uplo, (int) X.length(), alpha, X, X.stride(-1), Ap);
        } else {
            DefaultOpExecutioner.validateDataType(DataType.FLOAT, X);
            sspr(order, Uplo, (int) X.length(), (float) alpha, X, X.stride(-1), Ap);
        }

        OpExecutionerUtil.checkForAny(Ap);
    }
373884
static long addCap(long a, long b) {

        long res = a + b;
        if (res < 0L) {
            return Long.MAX_VALUE;
        }
        return res;
    }
1205158
function normalizeCaps(settings) {
	var features = settings.required_features, caps = {};

	function resolve(feature, value, strict) {
		// Feature notation is deprecated, use caps (this thing here is required for backward compatibility)
		var map = {
			chunks: 'slice_blob',
			jpgresize: 'send_binary_string',
			pngresize: 'send_binary_string',
			progress: 'report_upload_progress',
			multi_selection: 'select_multiple',
			dragdrop: 'drag_and_drop',
			drop_element: 'drag_and_drop',
			headers: 'send_custom_headers',
			urlstream_upload: 'send_binary_string',
			canSendBinary: 'send_binary',
			triggerDialog: 'summon_file_dialog'
		};

		if (map[feature]) {
			caps[map[feature]] = value;
		} else if (!strict) {
			caps[feature] = value;
		}
	}

	if (typeof(features) === 'string') {
		plupload.each(features.split(/\s*,\s*/), function(feature) {
			resolve(feature, true);
		});
	} else if (typeof(features) === 'object') {
		plupload.each(features, function(value, feature) {
			resolve(feature, value);
		});
	} else if (features === true) {
		// check settings for required features
		if (settings.chunk_size && settings.chunk_size > 0) {
			caps.slice_blob = true;
		}

		if (!plupload.isEmptyObj(settings.resize) || settings.multipart === false) {
			caps.send_binary_string = true;
		}

		if (settings.http_method) {
            caps.use_http_method = settings.http_method;
        }

		plupload.each(settings, function(value, feature) {
			resolve(feature, !!value, true); // strict check
		});
	}

	return caps;
}
352144
private String getConsoleIconPath(DesiredCapabilities cap) {
    String name = consoleIconName(cap);
    String path = "org/openqa/grid/images/";
    InputStream in =
        Thread.currentThread().getContextClassLoader()
            .getResourceAsStream(path + name + ".png");
    if (in == null) {
      return null;
    }
    return "/grid/resources/" + path + name + ".png";
  }