_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q57500 | train | function (propType) {
return {
propType: propType,
preCtorInit: function focusProperty_preCtorInit(element, options, data, displayName, propName, value) {
options[propName] = value;
},
update: function focusProperty_update(winjsComponent, propName,... | javascript | {
"resource": ""
} | |
q57501 | train | function (propType) {
return {
propType: propType,
preCtorInit: function domProperty_preCtorInit(element, options, data, displayName, propName, value) {
element[propName] = value;
},
update: function domProperty_update(winjsComponent, propName, old... | javascript | {
"resource": ""
} | |
q57502 | train | function (propType) {
return {
propType: propType,
update: function domAttribute_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
if (newValue !== null && newValue !== undefined) {
winjsCompone... | javascript | {
"resource": ""
} | |
q57503 | event_update | train | function event_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.winControl[propName.toLowerCase()] = newValue;
}
} | javascript | {
"resource": ""
} |
q57504 | PropHandlers_warn | train | function PropHandlers_warn(warnMessage) {
return {
// Don't need preCtorInit because this prop handler doesn't have any side
// effects on the WinJS control. update also runs during initialization so
// update is just as good as preCtorInit for our use case.
updat... | javascript | {
"resource": ""
} |
q57505 | PropHandlers_mountTo | train | function PropHandlers_mountTo(getMountPoint) {
return {
propType: React.PropTypes.element,
// Can't use preCtorInit because the mount point may not exist until the
// constructor has run.
update: function mountTo_update(winjsComponent, propName, oldValue, newValue... | javascript | {
"resource": ""
} |
q57506 | mountTo_update | train | function mountTo_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var version = (data.version || 0) + 1;
winjsComponent.data[propName] = {
// *mountComponent* may run asynchronously and we may queue... | javascript | {
"resource": ""
} |
q57507 | PropHandlers_syncChildrenWithBindingList | train | function PropHandlers_syncChildrenWithBindingList(bindingListName) {
return {
preCtorInit: function syncChildrenWithBindingList_preCtorInit(element, options, data, displayName, propName, value) {
var latest = processChildren(displayName, value, {});
data[propName] = {... | javascript | {
"resource": ""
} |
q57508 | train | function (winjsComponent, propName, oldValue, newValue) {
// TODO: dispose
ReactDOM.render(React.DOM.div(null, newValue), winjsComponent.winControl.element);
} | javascript | {
"resource": ""
} | |
q57509 | addMetaProperty | train | function addMetaProperty (object, propName, value) {
defineProperty(object, propName, {
enumerable: false,
value
})
} | javascript | {
"resource": ""
} |
q57510 | functionParameters | train | function functionParameters(f) {
assert(typeof f === 'function');
var matches = functionRegex.exec(f.toString());
if(!matches || !matches[2].length) {
return [];
}
return matches[2].split(/[,\s]+/).filter(function(str) {
return str.length;
});
} | javascript | {
"resource": ""
} |
q57511 | train | function(overrides) {
var result = this.cache;
if(!result) {
result = construct(type, functionParameters(type).map(function(paramName) {
return self.resolve(paramName, overrides);
}));
}
if(doCache) {
this.cache = result;
}
return result;
} | javascript | {
"resource": ""
} | |
q57512 | deserializeProperty | train | function deserializeProperty (bunsenId, value, bunsenModel) {
const subModel = getSubModel(bunsenModel, bunsenId)
switch (subModel.type) {
case 'integer':
return parseInt(value)
case 'number':
return parseFloat(value)
default:
return value
}
} | javascript | {
"resource": ""
} |
q57513 | serializeFormValue | train | function serializeFormValue (formValue) {
if (formValue.country) {
formValue.country = countryCodeToName(formValue.country)
}
if (typeOf(formValue.latitude) === 'number') {
formValue.latitude = `${formValue.latitude}`
}
if (typeOf(formValue.longitude) === 'number') {
formValue.longitude = `${for... | javascript | {
"resource": ""
} |
q57514 | normalizeItems | train | function normalizeItems ({data, labelAttribute, records, valueAttribute}) {
const labelAttr = labelAttribute || 'label'
const valueAttr = valueAttribute || 'id'
return data.concat(
records.map((record) => {
if (typeof record !== 'object') {
return {
label: `${record}`, // make sure la... | javascript | {
"resource": ""
} |
q57515 | shouldAddCurrentValue | train | function shouldAddCurrentValue ({items, valueRecord, labelAttribute, valueAttribute, filter}) {
const filterRegex = new RegExp(filter, 'i')
const valueRecordMatchesFilter = filterRegex.test(valueRecord.get(labelAttribute))
const itemsContainsValueRecord = items.find(item => item.value === valueRecord.get(valueAtt... | javascript | {
"resource": ""
} |
q57516 | train | function (rect) {
if (rect) {
this.context.clearRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)
} else {
this.canvas.width = this.canvas.width
if (cc.FLIP_Y_AXIS) {
this.context.scale(1, -1)
this.context.translate(... | javascript | {
"resource": ""
} | |
q57517 | train | function (opts) {
var target = opts.target,
priority = opts.priority,
paused = opts.paused
var i, len
var entry = {target: target, priority: priority, paused: paused}
var added = false
if (priority === 0) {
this.updates0.push(entry)
... | javascript | {
"resource": ""
} | |
q57518 | train | function (dt) {
var i, len, x
if (this.timeScale != 1.0) {
dt *= this.timeScale
}
var entry
for (i = 0, len = this.updatesNeg.length; i < len; i++) {
entry = this.updatesNeg[i]
if (entry && !entry.paused) {
entry.target.update(... | javascript | {
"resource": ""
} | |
q57519 | train | function (opts) {
if (!opts.target || !opts.method) {
return
}
var target = opts.target,
method = (typeof opts.method == 'function') ? opts.method : target[opts.method]
var element = this.hashForMethods[opts.target.id]
if (element) {
for (var... | javascript | {
"resource": ""
} | |
q57520 | train | function (target) {
if (!target) {
return
}
var id = target.id,
elementUpdate = this.hashForUpdates[id]
if (elementUpdate) {
// Remove from updates list
if (elementUpdate.priority === 0) {
this.updates0.splice(this.updates0.... | javascript | {
"resource": ""
} | |
q57521 | train | function () {
var i, x, entry
// Custom selectors
for (x in this.hashForMethods) {
if (this.hashForMethods.hasOwnProperty(x)) {
entry = this.hashForMethods[x]
this.unscheduleAllSelectorsForTarget(entry.target)
}
}
// Update... | javascript | {
"resource": ""
} | |
q57522 | train | function (target) {
if (!target) {
return
}
// Custom selector
var element = this.hashForMethods[target.id]
if (element) {
element.paused = true
element.timers = []; // Clear all timers
}
// Release HashMethodEntry object
... | javascript | {
"resource": ""
} | |
q57523 | train | function (opts) {
var targetID = opts.target.id
var element = this.targets[targetID]
if (!element) {
element = this.targets[targetID] = {
paused: false,
target: opts.target,
actions: []
}
}
element.actions... | javascript | {
"resource": ""
} | |
q57524 | train | function (action) {
var targetID = action.originalTarget.id,
element = this.targets[targetID]
if (!element) {
return
}
var actionIndex = element.actions.indexOf(action)
if (actionIndex == -1) {
return
}
if (this.currentTarge... | javascript | {
"resource": ""
} | |
q57525 | train | function(opts) {
var tag = opts.tag,
targetID = opts.target.id
var element = this.targets[targetID]
if (!element) {
return null
}
for (var i = 0; i < element.actions.length; i++ ) {
if (element.actions[i] &&
(element.actions[i]... | javascript | {
"resource": ""
} | |
q57526 | train | function (target) {
var targetID = target.id
var element = this.targets[targetID]
if (!element) {
return
}
delete this.targets[targetID]
// Delete everything in array but don't replace it incase something else has a reference
element.actions.splice(0... | javascript | {
"resource": ""
} | |
q57527 | train | function () {
var str = 'Usage: ' + path.basename(process.argv[1]) + ' ' + process.argv[2];
if (descriptors.opts.length) str += ' [options]';
if (descriptors.args.length) {
for (var i=0; i<descriptors.args.length; i++) {
if (descriptors.args[i].required) {
str += ' ' + descriptors.args[i].name;
... | javascript | {
"resource": ""
} | |
q57528 | train | function (opts) {
var name = opts.name || opts
var frame = this.spriteFrames[name]
if (!frame) {
// No frame, look for an alias
var key = this.spriteFrameAliases[name]
if (key) {
frame = this.spriteFrames[key]
}
if (... | javascript | {
"resource": ""
} | |
q57529 | train | function (pos) {
var layerSize = this.layerSize,
tiles = this.tiles
if (pos.x < 0 || pos.y < 0 || pos.x >= layerSize.width || pos.y >= layerSize.height) {
throw "TMX Layer: Invalid position"
}
var tile,
gid = this.tileGIDAt(pos)
// if GID is... | javascript | {
"resource": ""
} | |
q57530 | read | train | function read(file) {
var data = fs.readFileSync(file, 'ascii');
// Strip comments
data = data.replace(/#.*/g, '');
var lines = data.split('\n');
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i].trim();
if (!line) {
continue;
}
var ... | javascript | {
"resource": ""
} |
q57531 | train | function (opts) {
var name = opts.name,
animation = opts.animation
this.animations[name] = animation
} | javascript | {
"resource": ""
} | |
q57532 | train | function (opts) {
var objectName = opts.name
var object = null
this.objects.forEach(function (item) {
if (item.name == objectName) {
object = item
}
})
if (object !== null) {
return object
}
} | javascript | {
"resource": ""
} | |
q57533 | train | function (key) {
var next = false
if (~key.indexOf('.')) {
var tokens = key.split('.');
key = tokens.shift();
next = tokens.join('.');
}
var accessor = getAccessors(this)[key],
val;
if (accessor) {
val = accessor.targe... | javascript | {
"resource": ""
} | |
q57534 | train | function (key, value) {
var accessor = getAccessors(this)[key],
oldVal = this.get(key);
this.triggerBeforeChanged(key, oldVal);
if (accessor) {
accessor.target.set(accessor.key, value);
} else {
if (this['set_' + key]) {
this['set_'... | javascript | {
"resource": ""
} | |
q57535 | train | function (kvp) {
for (var x in kvp) {
if (kvp.hasOwnProperty(x)) {
this.set(x, kvp[x]);
}
}
} | javascript | {
"resource": ""
} | |
q57536 | train | function (key, target, targetKey, noNotify) {
targetKey = targetKey || key;
var self = this;
this.unbind(key);
var oldVal = this.get(key);
// When bound property changes, trigger a 'changed' event on this one too
getBindings(this)[key] = events.addListener(target, targe... | javascript | {
"resource": ""
} | |
q57537 | train | function () {
var keys = [],
bindings = getBindings(this);
for (var k in bindings) {
if (bindings.hasOwnProperty(k)) {
this.unbind(k);
}
}
} | javascript | {
"resource": ""
} | |
q57538 | train | function (i, value) {
this.array.splice(i, 0, value);
this.set('length', this.array.length);
events.trigger(this, 'insert_at', i);
} | javascript | {
"resource": ""
} | |
q57539 | train | function (i) {
var oldVal = this.array[i];
this.array.splice(i, 1);
this.set('length', this.array.length);
events.trigger(this, 'remove_at', i, oldVal);
return oldVal;
} | javascript | {
"resource": ""
} | |
q57540 | round10 | train | function round10(value, exp) {
var type = 'round';
// If the exp is undefined or zero...
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
... | javascript | {
"resource": ""
} |
q57541 | Director | train | function Director () {
if (Director._instance) {
throw new Error('Director instance already exists')
}
this.sceneStack = []
this.window = parent.window
this.document = this.window.document
// Prevent writing to some properties
util.makeReadonly(this, 'canvas context sceneStack wi... | javascript | {
"resource": ""
} |
q57542 | train | function () {
if (!Director._instance) {
if (window.navigator.userAgent.match(/(iPhone|iPod|iPad|Android)/)) {
Director._instance = new DirectorTouchScreen()
} else {
Director._instance = new this()
}
}
return Director._instanc... | javascript | {
"resource": ""
} | |
q57543 | train | function () {
var is = this.inScene,
os = this.outScene
/* clean up */
is.visible = true
is.position = geo.PointZero()
is.scale = 1.0
is.rotation = 0
os.visible = false
os.position = geo.PointZero()
os.scale = 1.0
os.rotation ... | javascript | {
"resource": ""
} | |
q57544 | train | function(manifest, compilation, props) {
const outputFolder = compilation.options.output.path;
const outputFile = path.join(outputFolder, props.fileName);
fse.outputFileSync(outputFile, manifest);
} | javascript | {
"resource": ""
} | |
q57545 | train | function(compilation, assetName) {
if (!compilation || !compilation.cache || typeof compilation.cache !== 'object') {
return null;
}
const cacheKeys = Object.keys(compilation.cache);
for (let keyIndex = 0; keyIndex < cacheKeys.length; keyIndex++) {
const cache = compilation.cache[cacheKeys... | javascript | {
"resource": ""
} | |
q57546 | hasFontLoaded | train | function hasFontLoaded (window, fontName) {
var testSize = 16
if (!fontTestElement) {
fontTestElement = window.document.createElement('canvas')
fontTestElement.width = testSize
fontTestElement.height = testSize
fontTestElement.style.display = 'none'
ctx = fontTestElement... | javascript | {
"resource": ""
} |
q57547 | train | function (opts) {
var layerName = opts.name,
layer = null
this.children.forEach(function (item) {
if (item instanceof TMXLayer && item.layerName == layerName) {
layer = item
}
})
if (layer !== null) {
return layer
}... | javascript | {
"resource": ""
} | |
q57548 | train | function (opts) {
var objectGroupName = opts.name,
objectGroup = null
this.objectGroups.forEach(function (item) {
if (item.name == objectGroupName) {
objectGroup = item
}
})
if (objectGroup !== null) {
return objectGroup
... | javascript | {
"resource": ""
} | |
q57549 | generateNSISScript | train | function generateNSISScript(files, callback) {
sys.puts('Generating NSIS script');
var installFileList = ' SetOverwrite try\n',
removeFileList = '',
removeDirList = '';
files = files.filter(function(file) {
// Ignore node-builds for other platforms
if (~file.indexOf('nod... | javascript | {
"resource": ""
} |
q57550 | findFilesToPackage | train | function findFilesToPackage(dir, callback) {
var cwd = process.cwd();
process.chdir(dir);
var gitls = spawn('git', ['ls-files']),
// This gets the full path to each file in each submodule
subls = spawn('git', ['submodule', 'foreach', 'for file in `git ls-files`; do echo "$path/$file"; done'... | javascript | {
"resource": ""
} |
q57551 | train | function () {
return new SpriteFrame({rect: this.rect, rotated: this.rotated, offset: this.offset, originalSize: this.originalSize, texture: this.texture})
} | javascript | {
"resource": ""
} | |
q57552 | handleResolution | train | function handleResolution(options, ws, resIdx, config, progress, callback) {
// Resolution object
let res = options.tiles.resolutions[resIdx];
// Workspace of this resolutions
let resWs;
if (options.tiles.resolutions.length == 1) {
resWs = ws;
} else {
resWs = ws + '/' + res.id;
}
// Create ... | javascript | {
"resource": ""
} |
q57553 | writeTile | train | function writeTile(file, url, request, callback) {
// Result of request
let res = null;
// FileWriteStream
let fileStream = fs.createWriteStream(file);
// Register finish callback of FileWriteStream
fileStream.on('finish', () => {
callback(null, res);
});
// Register error callback of FileWriteSt... | javascript | {
"resource": ""
} |
q57554 | train | function() {
//var logger = Logger.initialize(mockChildProcessFactory);
function MockChildProcess() {}
MockChildProcess.prototype.run = function run (command, args) {
// logger.debug("CHILD PROCESS MOCK!");
// logger.debug("command: "+command);
// logger.debug... | javascript | {
"resource": ""
} | |
q57555 | train | function() {
function MockWaterline() {}
MockWaterline.prototype.nodes = {};
MockWaterline.prototype.nodes.findByIdentifier = function (nodeId) {
//return instance of a node with settings in it...
return Promise.resolve({
obmSettings: [
... | javascript | {
"resource": ""
} | |
q57556 | _adjustIpStrFormat | train | function _adjustIpStrFormat(ipString) {
var ip = ipString.split('.');
ipString = '';
for (var i = 0; i < ip.length; i += 1) {
switch (ip[i].length) {
case 1:
ip[i] = '00' + ip[i];
break;
case 2:
... | javascript | {
"resource": ""
} |
q57557 | getRequestObject | train | function getRequestObject(config, url) {
if (!request) {
// Init request object
request = require('request').defaults({
'headers': {
'User-Agent': config.request.userAgent
},
strictSSL: false,
timeout: config.request.timeout
});
}
if (!requestProxy) {
// If intern... | javascript | {
"resource": ""
} |
q57558 | Logger | train | function Logger (module) {
// Set the intiial module to the provided string value if present.
this.module = module !== undefined ? module.toString() : 'No Module';
// If the module is a function then we'll look for di.js annotations to get the
// provide string.
if (_.isFunction... | javascript | {
"resource": ""
} |
q57559 | getSpecifierIdentifiers | train | function getSpecifierIdentifiers(specifiers = [], withPath = false) {
const collection = [];
function loop(path, index) {
const node = path.node
const item = !withPath ? node.local.name : { path, name: node.local.name }
switch (node.type) {
case 'ImportDefaultSpecifier':
case 'ImportSpecifie... | javascript | {
"resource": ""
} |
q57560 | UINT32 | train | function UINT32 (l, h) {
if ( !(this instanceof UINT32) )
return new UINT32(l, h)
this._low = 0
this._high = 0
this.remainder = null
if (typeof h == 'undefined')
return fromNumber.call(this, l)
if (typeof l == 'string')
return fromString.call(this, l, h)
fromBits.call(this, l, h)
} | javascript | {
"resource": ""
} |
q57561 | fromString | train | function fromString (s, radix) {
var value = parseInt(s, radix || 10)
this._low = value & 0xFFFF
this._high = value >>> 16
return this
} | javascript | {
"resource": ""
} |
q57562 | GetCatalogValuesJob | train | function GetCatalogValuesJob(options, context, taskId){
GetCatalogValuesJob.super_.call(this, logger, options, context, taskId);
this.nodeId = context.target;
this.options = options;
this.logger = logger;
} | javascript | {
"resource": ""
} |
q57563 | createGetMap | train | function createGetMap(wms, bbox, width, height) {
let getmap = wms.getmap.url;
for (let key in wms.getmap.kvp) {
getmap += encodeURIComponent(key) + '=' + encodeURIComponent(wms.getmap.kvp[key]) + '&';
}
getmap += 'BBOX=' + encodeURIComponent(bbox) + '&';
getmap += 'WIDTH=' + encodeURIComponent(width) +... | javascript | {
"resource": ""
} |
q57564 | handleWMS | train | function handleWMS(options, ws, res, wmsIdx, config, progress, callback) {
// WMS object
let wms = options.wms[wmsIdx];
// Workspace of this WMS
let wmsWs = ws;
if (options.wms.length > 1) {
wmsWs += '/' + wms.id;
}
// Create directory of WMS workspace
fs.ensureDir(wmsWs, function (err) {
//... | javascript | {
"resource": ""
} |
q57565 | determineGroundResolution | train | function determineGroundResolution(res) {
//iterate over all resolutions
for (let int = 0; int < res.length; int++) {
let r = res[int];
//calculate the resolution if not available
if (!r.groundResolution) {
r.groundResolution = (0.0254 * r.scale) / r.dpi;
}
}
} | javascript | {
"resource": ""
} |
q57566 | parseSnmpLine | train | function parseSnmpLine(line) {
if (typeof line !== 'string') {
throw new Error("Data is not in string format");
}
var data = line.trim();
var errString = 'No Such Object available on this agent at this OID';
if (data.indexOf(errString) >= 0) {
throw new ... | javascript | {
"resource": ""
} |
q57567 | parseSnmpData | train | function parseSnmpData(snmpData) {
var lines = snmpData.trim().split('\n');
return _.compact(_.map(lines, function(line) {
return parseSnmpLine(line);
}));
} | javascript | {
"resource": ""
} |
q57568 | DownloadFileJob | train | function DownloadFileJob(options, context, taskId) {
var self = this;
DownloadFileJob.super_.call(self, logger, options, context, taskId);
self.nodeId = self.context.target;
if (self.options.filePath) {
self.options.filePath = self.options.filePath.trim();
if (_.... | javascript | {
"resource": ""
} |
q57569 | getVersion | train | function getVersion () {
const url = 'https://raw.githubusercontent.com/mapbox/node-sqlite3/master/package.json'
return new Promise((resolve, reject) => {
https.get(url, res => {
let data = ''
res.setEncoding('utf8')
if (res.statusCode !== 200) return reject(res.statusMessage)
res.on('da... | javascript | {
"resource": ""
} |
q57570 | main | train | async function main () {
const version = await getVersion()
for (const MODULE of ELECTRON_MODULES) {
for (const PLATFORM of PLATFORMS) {
for (const ARCH of ARCHS) {
const name = getElectronName(MODULE, PLATFORM, ARCH)
const filename = name + '.tar.gz'
const url = getUrl(version, n... | javascript | {
"resource": ""
} |
q57571 | _parseControllerInfoOneDriveData | train | function _parseControllerInfoOneDriveData(dataBlock) {
//split output by empty line
var dataSegments = dataBlock.split(/\n/); //Divided by line
var drvObj = {};
_.forEach(dataSegments, function(data) {
data = data.trim();
// Ignore empty line
if (data... | javascript | {
"resource": ""
} |
q57572 | _parseSmartOneDriveData | train | function _parseSmartOneDriveData(dataBlock) {
//split output by empty line
var dataSegments = dataBlock.split(/\r?\n\s*\r?\n/); //Divided by empty line
var drvObj = {};
_.forEach(dataSegments, function(data) {
data = data.trim();
//remove the empty data segment ... | javascript | {
"resource": ""
} |
q57573 | _parseSmartInfoSection | train | function _parseSmartInfoSection(lines) {
/*
*Example data:
=== START OF INFORMATION SECTION ===
Device Model: Micron_P400e-MTFDDAK200MAR
Serial Number: 1144031E6FB3
LU WWN Device Id: 5 00a075 1031e6fb3
Firmware Version: 0135
User Capacity: ... | javascript | {
"resource": ""
} |
q57574 | _parseSmartSelfAssessment | train | function _parseSmartSelfAssessment(lines) {
/*
Example 1:
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Example 2:
=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
*/
... | javascript | {
"resource": ""
} |
q57575 | _parseSmartCapabilities | train | function _parseSmartCapabilities(lines) {
var combineLines = [];
var strBuf = '';
/*
The first line is 'General SMART Values:', it should be discarded.
Some of the entry information is divided into multiline,
so first we try to combine these lines to achieve a regula... | javascript | {
"resource": ""
} |
q57576 | _parseSmartAttributes | train | function _parseSmartAttributes(lines) {
var attrObj = {};
/* Example data:
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED
1 Raw_Read_Error_Rat... | javascript | {
"resource": ""
} |
q57577 | _parseSmartErrorLog | train | function _parseSmartErrorLog(lines) {
var resultObj = {};
//Parse first line to get revision number
//Example data:
//SMART Error Log Version: 1
if (lines.length > 0) {
resultObj.Revision = (lines[0].substring(
lines[0].lastIndexOf(' ') + 1)).trim();
... | javascript | {
"resource": ""
} |
q57578 | _parseSmartTable | train | function _parseSmartTable(lines,
ignoreLinesCount,
regSplitRow,
funcCheckTableEnd)
{
/* Example 1:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED
1 Raw_Read_Error_Rate ... | javascript | {
"resource": ""
} |
q57579 | findDriveWwidByIndex | train | function findDriveWwidByIndex(catalog, isEsx, driveIndex) {
var wwid = null;
_.forEach(catalog, function(entry) {
if (entry.identifier === driveIndex) {
wwid = isEsx ? entry.esxiWwid : entry.linuxWwid;
return false; //have found the result, so we can exit iter... | javascript | {
"resource": ""
} |
q57580 | getDriveIdCatalog | train | function getDriveIdCatalog(nodeId, filter) {
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'driveId'
}).then(function (catalog) {
if (!catalog || !_.has(catalog, 'data[0]')) {
return Promise.reject(
new Error('Cou... | javascript | {
"resource": ""
} |
q57581 | getVirtualDiskCatalog | train | function getVirtualDiskCatalog(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-virtual-disks'
})
.then(function (virtualDiskCatalog) {
if (!_.has(virtualDiskCatalog, 'data.Controllers[0]')) {
return Promise.r... | javascript | {
"resource": ""
} |
q57582 | getPhysicalDiskCatalog | train | function getPhysicalDiskCatalog(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-physical-drives'
})
.then(function(physicalDiskCatalog){
if (!_.has(physicalDiskCatalog, 'data')) {
return Promise.reject(
... | javascript | {
"resource": ""
} |
q57583 | getRaidControllerVendor | train | function getRaidControllerVendor(nodeId){
return waterline.catalogs.findMostRecent({
node: nodeId,
source: 'megaraid-controllers'
})
.then(function (controllerCatalog) {
if (!_.has(controllerCatalog, 'data.Controllers')) {
return Promise.reject... | javascript | {
"resource": ""
} |
q57584 | getDriveIdCatalogExt | train | function getDriveIdCatalogExt(nodeId, filter, extendJbod) {
return getDriveIdCatalog(nodeId, filter)
.then(function (driveIds) {
// get virtualDisk data from megaraid-virtual-disks catalog
var foundVdHasValue = _.find(driveIds, function (driveId) {
return !_.isEmp... | javascript | {
"resource": ""
} |
q57585 | _getVdExtDriveIdCatalog | train | function _getVdExtDriveIdCatalog(nodeId, driveId, virtualDiskData, vendors){
var match = driveId.virtualDisk.match(/^\/c(\d+)\/v(\d+)/);
if (!match) {
return driveId;
}
var vid = match[2];
var cid = match[1];
var vdInfo;
_.forEach(virtualDiskData.Contr... | javascript | {
"resource": ""
} |
q57586 | _getJbodExtDriveIdCatalog | train | function _getJbodExtDriveIdCatalog(nodeId, driveId, physicalDiskData, vendors){
//Devide ID in SCSI ID is used to match megaraid DID
//This feature is only qualified on servers with one RAID card
//An alternative method is to use logic wwid
//to find "OS Device Name" in smart catalog and... | javascript | {
"resource": ""
} |
q57587 | handleCommonOptions | train | function handleCommonOptions(options) {
// check the task timeout, if not specified, then set a default one.
if (!options.hasOwnProperty('_taskTimeout') && options.schedulerOverrides &&
options.schedulerOverrides.hasOwnProperty('timeout')) {
options._taskTimeout = options.sch... | javascript | {
"resource": ""
} |
q57588 | createWorldFile | train | function createWorldFile(x0, y0, res) {
let halfPxInM = res / 2.0;
let ret = res + '\n';
ret += '0.0' + '\n';
ret += '0.0' + '\n';
ret += '-' + res + '\n';
ret += x0 + halfPxInM + '\n';
ret += y0 - halfPxInM;
return ret;
} | javascript | {
"resource": ""
} |
q57589 | ObmService | train | function ObmService(nodeId, obmServiceFactory, obmSettings, options) {
assert.object(obmSettings);
assert.object(obmSettings.config);
assert.string(obmSettings.service);
assert.func(obmServiceFactory);
assert.isMongoId(nodeId);
this.params = options || {};
this.r... | javascript | {
"resource": ""
} |
q57590 | _getValidSku | train | function _getValidSku (node) {
if (node.sku) {
return waterline.skus.findOne({ id: node.sku }).then(function (sku) {
if (sku && sku.name) {
node.sku = sku.name;
}
else {
return Promise.reject();
}... | javascript | {
"resource": ""
} |
q57591 | UINT64 | train | function UINT64 (a00, a16, a32, a48) {
if ( !(this instanceof UINT64) )
return new UINT64(a00, a16, a32, a48)
this.remainder = null
if (typeof a00 == 'string')
return fromString.call(this, a00, a16)
if (typeof a16 == 'undefined')
return fromNumber.call(this, a00)
fromBits.apply(this, arguments)
} | javascript | {
"resource": ""
} |
q57592 | fromBits | train | function fromBits (a00, a16, a32, a48) {
if (typeof a32 == 'undefined') {
this._a00 = a00 & 0xFFFF
this._a16 = a00 >>> 16
this._a32 = a16 & 0xFFFF
this._a48 = a16 >>> 16
return this
}
this._a00 = a00 | 0
this._a16 = a16 | 0
this._a32 = a32 | 0
this._a48 = a48 | 0
return this
} | javascript | {
"resource": ""
} |
q57593 | fromString | train | function fromString (s, radix) {
radix = radix || 10
this._a00 = 0
this._a16 = 0
this._a32 = 0
this._a48 = 0
/*
In Javascript, bitwise operators only operate on the first 32 bits
of a number, even though parseInt() encodes numbers with a 53 bits
mantissa.
Therefore UINT64(<Number>) can only ... | javascript | {
"resource": ""
} |
q57594 | _findMatchingMac | train | function _findMatchingMac(nodeLldpData, lldpMacList) {
var relationsList = {};
return Promise.all(
_.forEach(_.keys(nodeLldpData.data), function (ethPort) {
//validate mac first
var lldpMac = catalogSearch.getPath(nodeLldpData.data[ethPort], 'chassis.mac');
if... | javascript | {
"resource": ""
} |
q57595 | _adjustMacStrFormat | train | function _adjustMacStrFormat(macString) {
macString = macString.toLowerCase();
var mac = macString.split(':');
macString = '';
for (var i = 0; i < mac.length; i += 1) {
if (mac[i].length === 1) {
mac[i] = '0' + mac[i];
}
macString += ma... | javascript | {
"resource": ""
} |
q57596 | cropTile | train | function cropTile(oldFile, newFile, tileSizePx, gutterSizePx, callback) {
if (oldFile.endsWith('.svg') && newFile.endsWith('.svg')) {
// vector images
fs.readFile(oldFile, { encoding: 'utf8' }, (err, content) => {
if (err) {
callback(err);
} else {
const parser = new xml2js.Parse... | javascript | {
"resource": ""
} |
q57597 | _verifyFiltering | train | function _verifyFiltering(filters, counts, data) {
var reading = data.data.alert.reading;
if (_.isEmpty(reading)) {
return false;
}
var filter = filters[0];
var count = counts[0];
var matched = true;
_.map(filter, function(value, key){
if (... | javascript | {
"resource": ""
} |
q57598 | _extractEsxBootCfgValue | train | function _extractEsxBootCfgValue(data, pattern) {
var pos = data.indexOf(pattern);
if (pos >= 0) {
pos += pattern.length;
var lineEndPos = data.indexOf('\n', pos);
if (lineEndPos >= 0) {
return data.substring(pos, lineEndPos);
}
}
... | javascript | {
"resource": ""
} |
q57599 | RestJob | train | function RestJob(options, context, taskId){
var self = this;
self.options = options;
self.context = context;
RestJob.super_.call(self, logger, options, context, taskId);
self.restClient = new HttpTool();
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.