text
stringlengths 2
100k
| meta
dict |
---|---|
/**
* Module dependencies.
*/
var utils = require('../utils');
/**
* Expose `Route`.
*/
module.exports = Route;
/**
* Initialize `Route` with the given HTTP `method`, `path`,
* and an array of `callbacks` and `options`.
*
* Options:
*
* - `sensitive` enable case-sensitive routes
* - `strict` enable strict matching for trailing slashes
*
* @param {String} method
* @param {String} path
* @param {Array} callbacks
* @param {Object} options.
* @api private
*/
function Route(method, path, callbacks, options) {
options = options || {};
this.path = path;
this.method = method;
this.callbacks = callbacks;
this.regexp = utils.pathRegexp(path
, this.keys = []
, options.sensitive
, options.strict);
}
/**
* Check if this route matches `path`, if so
* populate `.params`.
*
* @param {String} path
* @return {Boolean}
* @api private
*/
Route.prototype.match = function(path){
var keys = this.keys
, params = this.params = []
, m = this.regexp.exec(path);
if (!m) return false;
for (var i = 1, len = m.length; i < len; ++i) {
var key = keys[i - 1];
var val = 'string' == typeof m[i]
? decodeURIComponent(m[i])
: m[i];
if (key) {
params[key.name] = val;
} else {
params.push(val);
}
}
return true;
};
| {
"pile_set_name": "Github"
} |
'use strict';
var $export = require('./_export');
var toObject = require('./_to-object');
var toPrimitive = require('./_to-primitive');
$export($export.P + $export.F * require('./_fails')(function () {
return new Date(NaN).toJSON() !== null
|| Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1;
}), 'Date', {
// eslint-disable-next-line no-unused-vars
toJSON: function toJSON(key) {
var O = toObject(this);
var pv = toPrimitive(O);
return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
}
});
| {
"pile_set_name": "Github"
} |
"""Unicode Properties (autogen)."""
from __future__ import unicode_literals
unicode_blocks = {
"basiclatin": "\u0000-\u007f",
"^basiclatin": "\u0080-\U0010ffff",
"latin1supplement": "\u0080-\u00ff",
"^latin1supplement": "\u0000-\u007f\u0100-\U0010ffff",
"latinextendeda": "\u0100-\u017f",
"^latinextendeda": "\u0000-\u00ff\u0180-\U0010ffff",
"latinextendedb": "\u0180-\u024f",
"^latinextendedb": "\u0000-\u017f\u0250-\U0010ffff",
"ipaextensions": "\u0250-\u02af",
"^ipaextensions": "\u0000-\u024f\u02b0-\U0010ffff",
"spacingmodifierletters": "\u02b0-\u02ff",
"^spacingmodifierletters": "\u0000-\u02af\u0300-\U0010ffff",
"combiningdiacriticalmarks": "\u0300-\u036f",
"^combiningdiacriticalmarks": "\u0000-\u02ff\u0370-\U0010ffff",
"greekandcoptic": "\u0370-\u03ff",
"^greekandcoptic": "\u0000-\u036f\u0400-\U0010ffff",
"cyrillic": "\u0400-\u04ff",
"^cyrillic": "\u0000-\u03ff\u0500-\U0010ffff",
"cyrillicsupplement": "\u0500-\u052f",
"^cyrillicsupplement": "\u0000-\u04ff\u0530-\U0010ffff",
"armenian": "\u0530-\u058f",
"^armenian": "\u0000-\u052f\u0590-\U0010ffff",
"hebrew": "\u0590-\u05ff",
"^hebrew": "\u0000-\u058f\u0600-\U0010ffff",
"arabic": "\u0600-\u06ff",
"^arabic": "\u0000-\u05ff\u0700-\U0010ffff",
"syriac": "\u0700-\u074f",
"^syriac": "\u0000-\u06ff\u0750-\U0010ffff",
"arabicsupplement": "\u0750-\u077f",
"^arabicsupplement": "\u0000-\u074f\u0780-\U0010ffff",
"thaana": "\u0780-\u07bf",
"^thaana": "\u0000-\u077f\u07c0-\U0010ffff",
"nko": "\u07c0-\u07ff",
"^nko": "\u0000-\u07bf\u0800-\U0010ffff",
"samaritan": "\u0800-\u083f",
"^samaritan": "\u0000-\u07ff\u0840-\U0010ffff",
"mandaic": "\u0840-\u085f",
"^mandaic": "\u0000-\u083f\u0860-\U0010ffff",
"arabicextendeda": "\u08a0-\u08ff",
"^arabicextendeda": "\u0000-\u089f\u0900-\U0010ffff",
"devanagari": "\u0900-\u097f",
"^devanagari": "\u0000-\u08ff\u0980-\U0010ffff",
"bengali": "\u0980-\u09ff",
"^bengali": "\u0000-\u097f\u0a00-\U0010ffff",
"gurmukhi": "\u0a00-\u0a7f",
"^gurmukhi": "\u0000-\u09ff\u0a80-\U0010ffff",
"gujarati": "\u0a80-\u0aff",
"^gujarati": "\u0000-\u0a7f\u0b00-\U0010ffff",
"oriya": "\u0b00-\u0b7f",
"^oriya": "\u0000-\u0aff\u0b80-\U0010ffff",
"tamil": "\u0b80-\u0bff",
"^tamil": "\u0000-\u0b7f\u0c00-\U0010ffff",
"telugu": "\u0c00-\u0c7f",
"^telugu": "\u0000-\u0bff\u0c80-\U0010ffff",
"kannada": "\u0c80-\u0cff",
"^kannada": "\u0000-\u0c7f\u0d00-\U0010ffff",
"malayalam": "\u0d00-\u0d7f",
"^malayalam": "\u0000-\u0cff\u0d80-\U0010ffff",
"sinhala": "\u0d80-\u0dff",
"^sinhala": "\u0000-\u0d7f\u0e00-\U0010ffff",
"thai": "\u0e00-\u0e7f",
"^thai": "\u0000-\u0dff\u0e80-\U0010ffff",
"lao": "\u0e80-\u0eff",
"^lao": "\u0000-\u0e7f\u0f00-\U0010ffff",
"tibetan": "\u0f00-\u0fff",
"^tibetan": "\u0000-\u0eff\u1000-\U0010ffff",
"myanmar": "\u1000-\u109f",
"^myanmar": "\u0000-\u0fff\u10a0-\U0010ffff",
"georgian": "\u10a0-\u10ff",
"^georgian": "\u0000-\u109f\u1100-\U0010ffff",
"hanguljamo": "\u1100-\u11ff",
"^hanguljamo": "\u0000-\u10ff\u1200-\U0010ffff",
"ethiopic": "\u1200-\u137f",
"^ethiopic": "\u0000-\u11ff\u1380-\U0010ffff",
"ethiopicsupplement": "\u1380-\u139f",
"^ethiopicsupplement": "\u0000-\u137f\u13a0-\U0010ffff",
"cherokee": "\u13a0-\u13ff",
"^cherokee": "\u0000-\u139f\u1400-\U0010ffff",
"unifiedcanadianaboriginalsyllabics": "\u1400-\u167f",
"^unifiedcanadianaboriginalsyllabics": "\u0000-\u13ff\u1680-\U0010ffff",
"ogham": "\u1680-\u169f",
"^ogham": "\u0000-\u167f\u16a0-\U0010ffff",
"runic": "\u16a0-\u16ff",
"^runic": "\u0000-\u169f\u1700-\U0010ffff",
"tagalog": "\u1700-\u171f",
"^tagalog": "\u0000-\u16ff\u1720-\U0010ffff",
"hanunoo": "\u1720-\u173f",
"^hanunoo": "\u0000-\u171f\u1740-\U0010ffff",
"buhid": "\u1740-\u175f",
"^buhid": "\u0000-\u173f\u1760-\U0010ffff",
"tagbanwa": "\u1760-\u177f",
"^tagbanwa": "\u0000-\u175f\u1780-\U0010ffff",
"khmer": "\u1780-\u17ff",
"^khmer": "\u0000-\u177f\u1800-\U0010ffff",
"mongolian": "\u1800-\u18af",
"^mongolian": "\u0000-\u17ff\u18b0-\U0010ffff",
"unifiedcanadianaboriginalsyllabicsextended": "\u18b0-\u18ff",
"^unifiedcanadianaboriginalsyllabicsextended": "\u0000-\u18af\u1900-\U0010ffff",
"limbu": "\u1900-\u194f",
"^limbu": "\u0000-\u18ff\u1950-\U0010ffff",
"taile": "\u1950-\u197f",
"^taile": "\u0000-\u194f\u1980-\U0010ffff",
"newtailue": "\u1980-\u19df",
"^newtailue": "\u0000-\u197f\u19e0-\U0010ffff",
"khmersymbols": "\u19e0-\u19ff",
"^khmersymbols": "\u0000-\u19df\u1a00-\U0010ffff",
"buginese": "\u1a00-\u1a1f",
"^buginese": "\u0000-\u19ff\u1a20-\U0010ffff",
"taitham": "\u1a20-\u1aaf",
"^taitham": "\u0000-\u1a1f\u1ab0-\U0010ffff",
"balinese": "\u1b00-\u1b7f",
"^balinese": "\u0000-\u1aff\u1b80-\U0010ffff",
"sundanese": "\u1b80-\u1bbf",
"^sundanese": "\u0000-\u1b7f\u1bc0-\U0010ffff",
"batak": "\u1bc0-\u1bff",
"^batak": "\u0000-\u1bbf\u1c00-\U0010ffff",
"lepcha": "\u1c00-\u1c4f",
"^lepcha": "\u0000-\u1bff\u1c50-\U0010ffff",
"olchiki": "\u1c50-\u1c7f",
"^olchiki": "\u0000-\u1c4f\u1c80-\U0010ffff",
"sundanesesupplement": "\u1cc0-\u1ccf",
"^sundanesesupplement": "\u0000-\u1cbf\u1cd0-\U0010ffff",
"vedicextensions": "\u1cd0-\u1cff",
"^vedicextensions": "\u0000-\u1ccf\u1d00-\U0010ffff",
"phoneticextensions": "\u1d00-\u1d7f",
"^phoneticextensions": "\u0000-\u1cff\u1d80-\U0010ffff",
"phoneticextensionssupplement": "\u1d80-\u1dbf",
"^phoneticextensionssupplement": "\u0000-\u1d7f\u1dc0-\U0010ffff",
"combiningdiacriticalmarkssupplement": "\u1dc0-\u1dff",
"^combiningdiacriticalmarkssupplement": "\u0000-\u1dbf\u1e00-\U0010ffff",
"latinextendedadditional": "\u1e00-\u1eff",
"^latinextendedadditional": "\u0000-\u1dff\u1f00-\U0010ffff",
"greekextended": "\u1f00-\u1fff",
"^greekextended": "\u0000-\u1eff\u2000-\U0010ffff",
"generalpunctuation": "\u2000-\u206f",
"^generalpunctuation": "\u0000-\u1fff\u2070-\U0010ffff",
"superscriptsandsubscripts": "\u2070-\u209f",
"^superscriptsandsubscripts": "\u0000-\u206f\u20a0-\U0010ffff",
"currencysymbols": "\u20a0-\u20cf",
"^currencysymbols": "\u0000-\u209f\u20d0-\U0010ffff",
"combiningdiacriticalmarksforsymbols": "\u20d0-\u20ff",
"^combiningdiacriticalmarksforsymbols": "\u0000-\u20cf\u2100-\U0010ffff",
"letterlikesymbols": "\u2100-\u214f",
"^letterlikesymbols": "\u0000-\u20ff\u2150-\U0010ffff",
"numberforms": "\u2150-\u218f",
"^numberforms": "\u0000-\u214f\u2190-\U0010ffff",
"arrows": "\u2190-\u21ff",
"^arrows": "\u0000-\u218f\u2200-\U0010ffff",
"mathematicaloperators": "\u2200-\u22ff",
"^mathematicaloperators": "\u0000-\u21ff\u2300-\U0010ffff",
"miscellaneoustechnical": "\u2300-\u23ff",
"^miscellaneoustechnical": "\u0000-\u22ff\u2400-\U0010ffff",
"controlpictures": "\u2400-\u243f",
"^controlpictures": "\u0000-\u23ff\u2440-\U0010ffff",
"opticalcharacterrecognition": "\u2440-\u245f",
"^opticalcharacterrecognition": "\u0000-\u243f\u2460-\U0010ffff",
"enclosedalphanumerics": "\u2460-\u24ff",
"^enclosedalphanumerics": "\u0000-\u245f\u2500-\U0010ffff",
"boxdrawing": "\u2500-\u257f",
"^boxdrawing": "\u0000-\u24ff\u2580-\U0010ffff",
"blockelements": "\u2580-\u259f",
"^blockelements": "\u0000-\u257f\u25a0-\U0010ffff",
"geometricshapes": "\u25a0-\u25ff",
"^geometricshapes": "\u0000-\u259f\u2600-\U0010ffff",
"miscellaneoussymbols": "\u2600-\u26ff",
"^miscellaneoussymbols": "\u0000-\u25ff\u2700-\U0010ffff",
"dingbats": "\u2700-\u27bf",
"^dingbats": "\u0000-\u26ff\u27c0-\U0010ffff",
"miscellaneousmathematicalsymbolsa": "\u27c0-\u27ef",
"^miscellaneousmathematicalsymbolsa": "\u0000-\u27bf\u27f0-\U0010ffff",
"supplementalarrowsa": "\u27f0-\u27ff",
"^supplementalarrowsa": "\u0000-\u27ef\u2800-\U0010ffff",
"braillepatterns": "\u2800-\u28ff",
"^braillepatterns": "\u0000-\u27ff\u2900-\U0010ffff",
"supplementalarrowsb": "\u2900-\u297f",
"^supplementalarrowsb": "\u0000-\u28ff\u2980-\U0010ffff",
"miscellaneousmathematicalsymbolsb": "\u2980-\u29ff",
"^miscellaneousmathematicalsymbolsb": "\u0000-\u297f\u2a00-\U0010ffff",
"supplementalmathematicaloperators": "\u2a00-\u2aff",
"^supplementalmathematicaloperators": "\u0000-\u29ff\u2b00-\U0010ffff",
"miscellaneoussymbolsandarrows": "\u2b00-\u2bff",
"^miscellaneoussymbolsandarrows": "\u0000-\u2aff\u2c00-\U0010ffff",
"glagolitic": "\u2c00-\u2c5f",
"^glagolitic": "\u0000-\u2bff\u2c60-\U0010ffff",
"latinextendedc": "\u2c60-\u2c7f",
"^latinextendedc": "\u0000-\u2c5f\u2c80-\U0010ffff",
"coptic": "\u2c80-\u2cff",
"^coptic": "\u0000-\u2c7f\u2d00-\U0010ffff",
"georgiansupplement": "\u2d00-\u2d2f",
"^georgiansupplement": "\u0000-\u2cff\u2d30-\U0010ffff",
"tifinagh": "\u2d30-\u2d7f",
"^tifinagh": "\u0000-\u2d2f\u2d80-\U0010ffff",
"ethiopicextended": "\u2d80-\u2ddf",
"^ethiopicextended": "\u0000-\u2d7f\u2de0-\U0010ffff",
"cyrillicextendeda": "\u2de0-\u2dff",
"^cyrillicextendeda": "\u0000-\u2ddf\u2e00-\U0010ffff",
"supplementalpunctuation": "\u2e00-\u2e7f",
"^supplementalpunctuation": "\u0000-\u2dff\u2e80-\U0010ffff",
"cjkradicalssupplement": "\u2e80-\u2eff",
"^cjkradicalssupplement": "\u0000-\u2e7f\u2f00-\U0010ffff",
"kangxiradicals": "\u2f00-\u2fdf",
"^kangxiradicals": "\u0000-\u2eff\u2fe0-\U0010ffff",
"ideographicdescriptioncharacters": "\u2ff0-\u2fff",
"^ideographicdescriptioncharacters": "\u0000-\u2fef\u3000-\U0010ffff",
"cjksymbolsandpunctuation": "\u3000-\u303f",
"^cjksymbolsandpunctuation": "\u0000-\u2fff\u3040-\U0010ffff",
"hiragana": "\u3040-\u309f",
"^hiragana": "\u0000-\u303f\u30a0-\U0010ffff",
"katakana": "\u30a0-\u30ff",
"^katakana": "\u0000-\u309f\u3100-\U0010ffff",
"bopomofo": "\u3100-\u312f",
"^bopomofo": "\u0000-\u30ff\u3130-\U0010ffff",
"hangulcompatibilityjamo": "\u3130-\u318f",
"^hangulcompatibilityjamo": "\u0000-\u312f\u3190-\U0010ffff",
"kanbun": "\u3190-\u319f",
"^kanbun": "\u0000-\u318f\u31a0-\U0010ffff",
"bopomofoextended": "\u31a0-\u31bf",
"^bopomofoextended": "\u0000-\u319f\u31c0-\U0010ffff",
"cjkstrokes": "\u31c0-\u31ef",
"^cjkstrokes": "\u0000-\u31bf\u31f0-\U0010ffff",
"katakanaphoneticextensions": "\u31f0-\u31ff",
"^katakanaphoneticextensions": "\u0000-\u31ef\u3200-\U0010ffff",
"enclosedcjklettersandmonths": "\u3200-\u32ff",
"^enclosedcjklettersandmonths": "\u0000-\u31ff\u3300-\U0010ffff",
"cjkcompatibility": "\u3300-\u33ff",
"^cjkcompatibility": "\u0000-\u32ff\u3400-\U0010ffff",
"cjkunifiedideographsextensiona": "\u3400-\u4dbf",
"^cjkunifiedideographsextensiona": "\u0000-\u33ff\u4dc0-\U0010ffff",
"yijinghexagramsymbols": "\u4dc0-\u4dff",
"^yijinghexagramsymbols": "\u0000-\u4dbf\u4e00-\U0010ffff",
"cjkunifiedideographs": "\u4e00-\u9fff",
"^cjkunifiedideographs": "\u0000-\u4dff\ua000-\U0010ffff",
"yisyllables": "\ua000-\ua48f",
"^yisyllables": "\u0000-\u9fff\ua490-\U0010ffff",
"yiradicals": "\ua490-\ua4cf",
"^yiradicals": "\u0000-\ua48f\ua4d0-\U0010ffff",
"lisu": "\ua4d0-\ua4ff",
"^lisu": "\u0000-\ua4cf\ua500-\U0010ffff",
"vai": "\ua500-\ua63f",
"^vai": "\u0000-\ua4ff\ua640-\U0010ffff",
"cyrillicextendedb": "\ua640-\ua69f",
"^cyrillicextendedb": "\u0000-\ua63f\ua6a0-\U0010ffff",
"bamum": "\ua6a0-\ua6ff",
"^bamum": "\u0000-\ua69f\ua700-\U0010ffff",
"modifiertoneletters": "\ua700-\ua71f",
"^modifiertoneletters": "\u0000-\ua6ff\ua720-\U0010ffff",
"latinextendedd": "\ua720-\ua7ff",
"^latinextendedd": "\u0000-\ua71f\ua800-\U0010ffff",
"sylotinagri": "\ua800-\ua82f",
"^sylotinagri": "\u0000-\ua7ff\ua830-\U0010ffff",
"commonindicnumberforms": "\ua830-\ua83f",
"^commonindicnumberforms": "\u0000-\ua82f\ua840-\U0010ffff",
"phagspa": "\ua840-\ua87f",
"^phagspa": "\u0000-\ua83f\ua880-\U0010ffff",
"saurashtra": "\ua880-\ua8df",
"^saurashtra": "\u0000-\ua87f\ua8e0-\U0010ffff",
"devanagariextended": "\ua8e0-\ua8ff",
"^devanagariextended": "\u0000-\ua8df\ua900-\U0010ffff",
"kayahli": "\ua900-\ua92f",
"^kayahli": "\u0000-\ua8ff\ua930-\U0010ffff",
"rejang": "\ua930-\ua95f",
"^rejang": "\u0000-\ua92f\ua960-\U0010ffff",
"hanguljamoextendeda": "\ua960-\ua97f",
"^hanguljamoextendeda": "\u0000-\ua95f\ua980-\U0010ffff",
"javanese": "\ua980-\ua9df",
"^javanese": "\u0000-\ua97f\ua9e0-\U0010ffff",
"cham": "\uaa00-\uaa5f",
"^cham": "\u0000-\ua9ff\uaa60-\U0010ffff",
"myanmarextendeda": "\uaa60-\uaa7f",
"^myanmarextendeda": "\u0000-\uaa5f\uaa80-\U0010ffff",
"taiviet": "\uaa80-\uaadf",
"^taiviet": "\u0000-\uaa7f\uaae0-\U0010ffff",
"meeteimayekextensions": "\uaae0-\uaaff",
"^meeteimayekextensions": "\u0000-\uaadf\uab00-\U0010ffff",
"ethiopicextendeda": "\uab00-\uab2f",
"^ethiopicextendeda": "\u0000-\uaaff\uab30-\U0010ffff",
"meeteimayek": "\uabc0-\uabff",
"^meeteimayek": "\u0000-\uabbf\uac00-\U0010ffff",
"hangulsyllables": "\uac00-\ud7af",
"^hangulsyllables": "\u0000-\uabff\ud7b0-\U0010ffff",
"hanguljamoextendedb": "\ud7b0-\ud7ff",
"^hanguljamoextendedb": "\u0000-\ud7af\ud800-\U0010ffff",
"highsurrogates": "\ud800-\udb7f",
"^highsurrogates": "\u0000-\ud7ff\udb80-\U0010ffff",
"highprivateusesurrogates": "\udb80-\udbff",
"^highprivateusesurrogates": "\u0000-\udb7f\udc00-\U0010ffff",
"lowsurrogates": "\udc00-\udfff",
"^lowsurrogates": "\u0000-\udbff\ue000-\U0010ffff",
"privateusearea": "\ue000-\uf8ff",
"^privateusearea": "\u0000-\udfff\uf900-\U0010ffff",
"cjkcompatibilityideographs": "\uf900-\ufaff",
"^cjkcompatibilityideographs": "\u0000-\uf8ff\ufb00-\U0010ffff",
"alphabeticpresentationforms": "\ufb00-\ufb4f",
"^alphabeticpresentationforms": "\u0000-\ufaff\ufb50-\U0010ffff",
"arabicpresentationformsa": "\ufb50-\ufdff",
"^arabicpresentationformsa": "\u0000-\ufb4f\ufe00-\U0010ffff",
"variationselectors": "\ufe00-\ufe0f",
"^variationselectors": "\u0000-\ufdff\ufe10-\U0010ffff",
"verticalforms": "\ufe10-\ufe1f",
"^verticalforms": "\u0000-\ufe0f\ufe20-\U0010ffff",
"combininghalfmarks": "\ufe20-\ufe2f",
"^combininghalfmarks": "\u0000-\ufe1f\ufe30-\U0010ffff",
"cjkcompatibilityforms": "\ufe30-\ufe4f",
"^cjkcompatibilityforms": "\u0000-\ufe2f\ufe50-\U0010ffff",
"smallformvariants": "\ufe50-\ufe6f",
"^smallformvariants": "\u0000-\ufe4f\ufe70-\U0010ffff",
"arabicpresentationformsb": "\ufe70-\ufeff",
"^arabicpresentationformsb": "\u0000-\ufe6f\uff00-\U0010ffff",
"halfwidthandfullwidthforms": "\uff00-\uffef",
"^halfwidthandfullwidthforms": "\u0000-\ufeff\ufff0-\U0010ffff",
"specials": "\ufff0-\uffff",
"^specials": "\u0000-\uffef\U00010000-\U0010ffff",
"linearbsyllabary": "\U00010000-\U0001007f",
"^linearbsyllabary": "\u0000-\uffff\U00010080-\U0010ffff",
"linearbideograms": "\U00010080-\U000100ff",
"^linearbideograms": "\u0000-\U0001007f\U00010100-\U0010ffff",
"aegeannumbers": "\U00010100-\U0001013f",
"^aegeannumbers": "\u0000-\U000100ff\U00010140-\U0010ffff",
"ancientgreeknumbers": "\U00010140-\U0001018f",
"^ancientgreeknumbers": "\u0000-\U0001013f\U00010190-\U0010ffff",
"ancientsymbols": "\U00010190-\U000101cf",
"^ancientsymbols": "\u0000-\U0001018f\U000101d0-\U0010ffff",
"phaistosdisc": "\U000101d0-\U000101ff",
"^phaistosdisc": "\u0000-\U000101cf\U00010200-\U0010ffff",
"lycian": "\U00010280-\U0001029f",
"^lycian": "\u0000-\U0001027f\U000102a0-\U0010ffff",
"carian": "\U000102a0-\U000102df",
"^carian": "\u0000-\U0001029f\U000102e0-\U0010ffff",
"olditalic": "\U00010300-\U0001032f",
"^olditalic": "\u0000-\U000102ff\U00010330-\U0010ffff",
"gothic": "\U00010330-\U0001034f",
"^gothic": "\u0000-\U0001032f\U00010350-\U0010ffff",
"ugaritic": "\U00010380-\U0001039f",
"^ugaritic": "\u0000-\U0001037f\U000103a0-\U0010ffff",
"oldpersian": "\U000103a0-\U000103df",
"^oldpersian": "\u0000-\U0001039f\U000103e0-\U0010ffff",
"deseret": "\U00010400-\U0001044f",
"^deseret": "\u0000-\U000103ff\U00010450-\U0010ffff",
"shavian": "\U00010450-\U0001047f",
"^shavian": "\u0000-\U0001044f\U00010480-\U0010ffff",
"osmanya": "\U00010480-\U000104af",
"^osmanya": "\u0000-\U0001047f\U000104b0-\U0010ffff",
"cypriotsyllabary": "\U00010800-\U0001083f",
"^cypriotsyllabary": "\u0000-\U000107ff\U00010840-\U0010ffff",
"imperialaramaic": "\U00010840-\U0001085f",
"^imperialaramaic": "\u0000-\U0001083f\U00010860-\U0010ffff",
"phoenician": "\U00010900-\U0001091f",
"^phoenician": "\u0000-\U000108ff\U00010920-\U0010ffff",
"lydian": "\U00010920-\U0001093f",
"^lydian": "\u0000-\U0001091f\U00010940-\U0010ffff",
"meroitichieroglyphs": "\U00010980-\U0001099f",
"^meroitichieroglyphs": "\u0000-\U0001097f\U000109a0-\U0010ffff",
"meroiticcursive": "\U000109a0-\U000109ff",
"^meroiticcursive": "\u0000-\U0001099f\U00010a00-\U0010ffff",
"kharoshthi": "\U00010a00-\U00010a5f",
"^kharoshthi": "\u0000-\U000109ff\U00010a60-\U0010ffff",
"oldsoutharabian": "\U00010a60-\U00010a7f",
"^oldsoutharabian": "\u0000-\U00010a5f\U00010a80-\U0010ffff",
"avestan": "\U00010b00-\U00010b3f",
"^avestan": "\u0000-\U00010aff\U00010b40-\U0010ffff",
"inscriptionalparthian": "\U00010b40-\U00010b5f",
"^inscriptionalparthian": "\u0000-\U00010b3f\U00010b60-\U0010ffff",
"inscriptionalpahlavi": "\U00010b60-\U00010b7f",
"^inscriptionalpahlavi": "\u0000-\U00010b5f\U00010b80-\U0010ffff",
"oldturkic": "\U00010c00-\U00010c4f",
"^oldturkic": "\u0000-\U00010bff\U00010c50-\U0010ffff",
"ruminumeralsymbols": "\U00010e60-\U00010e7f",
"^ruminumeralsymbols": "\u0000-\U00010e5f\U00010e80-\U0010ffff",
"brahmi": "\U00011000-\U0001107f",
"^brahmi": "\u0000-\U00010fff\U00011080-\U0010ffff",
"kaithi": "\U00011080-\U000110cf",
"^kaithi": "\u0000-\U0001107f\U000110d0-\U0010ffff",
"sorasompeng": "\U000110d0-\U000110ff",
"^sorasompeng": "\u0000-\U000110cf\U00011100-\U0010ffff",
"chakma": "\U00011100-\U0001114f",
"^chakma": "\u0000-\U000110ff\U00011150-\U0010ffff",
"sharada": "\U00011180-\U000111df",
"^sharada": "\u0000-\U0001117f\U000111e0-\U0010ffff",
"takri": "\U00011680-\U000116cf",
"^takri": "\u0000-\U0001167f\U000116d0-\U0010ffff",
"cuneiform": "\U00012000-\U000123ff",
"^cuneiform": "\u0000-\U00011fff\U00012400-\U0010ffff",
"cuneiformnumbersandpunctuation": "\U00012400-\U0001247f",
"^cuneiformnumbersandpunctuation": "\u0000-\U000123ff\U00012480-\U0010ffff",
"egyptianhieroglyphs": "\U00013000-\U0001342f",
"^egyptianhieroglyphs": "\u0000-\U00012fff\U00013430-\U0010ffff",
"bamumsupplement": "\U00016800-\U00016a3f",
"^bamumsupplement": "\u0000-\U000167ff\U00016a40-\U0010ffff",
"miao": "\U00016f00-\U00016f9f",
"^miao": "\u0000-\U00016eff\U00016fa0-\U0010ffff",
"kanasupplement": "\U0001b000-\U0001b0ff",
"^kanasupplement": "\u0000-\U0001afff\U0001b100-\U0010ffff",
"byzantinemusicalsymbols": "\U0001d000-\U0001d0ff",
"^byzantinemusicalsymbols": "\u0000-\U0001cfff\U0001d100-\U0010ffff",
"musicalsymbols": "\U0001d100-\U0001d1ff",
"^musicalsymbols": "\u0000-\U0001d0ff\U0001d200-\U0010ffff",
"ancientgreekmusicalnotation": "\U0001d200-\U0001d24f",
"^ancientgreekmusicalnotation": "\u0000-\U0001d1ff\U0001d250-\U0010ffff",
"taixuanjingsymbols": "\U0001d300-\U0001d35f",
"^taixuanjingsymbols": "\u0000-\U0001d2ff\U0001d360-\U0010ffff",
"countingrodnumerals": "\U0001d360-\U0001d37f",
"^countingrodnumerals": "\u0000-\U0001d35f\U0001d380-\U0010ffff",
"mathematicalalphanumericsymbols": "\U0001d400-\U0001d7ff",
"^mathematicalalphanumericsymbols": "\u0000-\U0001d3ff\U0001d800-\U0010ffff",
"arabicmathematicalalphabeticsymbols": "\U0001ee00-\U0001eeff",
"^arabicmathematicalalphabeticsymbols": "\u0000-\U0001edff\U0001ef00-\U0010ffff",
"mahjongtiles": "\U0001f000-\U0001f02f",
"^mahjongtiles": "\u0000-\U0001efff\U0001f030-\U0010ffff",
"dominotiles": "\U0001f030-\U0001f09f",
"^dominotiles": "\u0000-\U0001f02f\U0001f0a0-\U0010ffff",
"playingcards": "\U0001f0a0-\U0001f0ff",
"^playingcards": "\u0000-\U0001f09f\U0001f100-\U0010ffff",
"enclosedalphanumericsupplement": "\U0001f100-\U0001f1ff",
"^enclosedalphanumericsupplement": "\u0000-\U0001f0ff\U0001f200-\U0010ffff",
"enclosedideographicsupplement": "\U0001f200-\U0001f2ff",
"^enclosedideographicsupplement": "\u0000-\U0001f1ff\U0001f300-\U0010ffff",
"miscellaneoussymbolsandpictographs": "\U0001f300-\U0001f5ff",
"^miscellaneoussymbolsandpictographs": "\u0000-\U0001f2ff\U0001f600-\U0010ffff",
"emoticons": "\U0001f600-\U0001f64f",
"^emoticons": "\u0000-\U0001f5ff\U0001f650-\U0010ffff",
"transportandmapsymbols": "\U0001f680-\U0001f6ff",
"^transportandmapsymbols": "\u0000-\U0001f67f\U0001f700-\U0010ffff",
"alchemicalsymbols": "\U0001f700-\U0001f77f",
"^alchemicalsymbols": "\u0000-\U0001f6ff\U0001f780-\U0010ffff",
"cjkunifiedideographsextensionb": "\U00020000-\U0002a6df",
"^cjkunifiedideographsextensionb": "\u0000-\U0001ffff\U0002a6e0-\U0010ffff",
"cjkunifiedideographsextensionc": "\U0002a700-\U0002b73f",
"^cjkunifiedideographsextensionc": "\u0000-\U0002a6ff\U0002b740-\U0010ffff",
"cjkunifiedideographsextensiond": "\U0002b740-\U0002b81f",
"^cjkunifiedideographsextensiond": "\u0000-\U0002b73f\U0002b820-\U0010ffff",
"cjkcompatibilityideographssupplement": "\U0002f800-\U0002fa1f",
"^cjkcompatibilityideographssupplement": "\u0000-\U0002f7ff\U0002fa20-\U0010ffff",
"tags": "\U000e0000-\U000e007f",
"^tags": "\u0000-\U000dffff\U000e0080-\U0010ffff",
"variationselectorssupplement": "\U000e0100-\U000e01ef",
"^variationselectorssupplement": "\u0000-\U000e00ff\U000e01f0-\U0010ffff",
"supplementaryprivateuseareaa": "\U000f0000-\U000fffff",
"^supplementaryprivateuseareaa": "\u0000-\U000effff\U00100000-\U0010ffff",
"supplementaryprivateuseareab": "\U00100000-\U0010ffff",
"^supplementaryprivateuseareab": "\u0000-\U000fffff",
"noblock": "\u0860-\u089f\u1ab0-\u1aff\u1c80-\u1cbf\u2fe0-\u2fef\ua9e0-\ua9ff\uab30-\uabbf\U00010200-\U0001027f\U000102e0-\U000102ff\U00010350-\U0001037f\U000103e0-\U000103ff\U000104b0-\U000107ff\U00010860-\U000108ff\U00010940-\U0001097f\U00010a80-\U00010aff\U00010b80-\U00010bff\U00010c50-\U00010e5f\U00010e80-\U00010fff\U00011150-\U0001117f\U000111e0-\U0001167f\U000116d0-\U00011fff\U00012480-\U00012fff\U00013430-\U000167ff\U00016a40-\U00016eff\U00016fa0-\U0001afff\U0001b100-\U0001cfff\U0001d250-\U0001d2ff\U0001d380-\U0001d3ff\U0001d800-\U0001edff\U0001ef00-\U0001efff\U0001f650-\U0001f67f\U0001f780-\U0001ffff\U0002a6e0-\U0002a6ff\U0002b820-\U0002f7ff\U0002fa20-\U000dffff\U000e0080-\U000e00ff\U000e01f0-\U000effff",
"^noblock": "\u0000-\u085f\u08a0-\u1aaf\u1b00-\u1c7f\u1cc0-\u2fdf\u2ff0-\ua9df\uaa00-\uab2f\uabc0-\U000101ff\U00010280-\U000102df\U00010300-\U0001034f\U00010380-\U000103df\U00010400-\U000104af\U00010800-\U0001085f\U00010900-\U0001093f\U00010980-\U00010a7f\U00010b00-\U00010b7f\U00010c00-\U00010c4f\U00010e60-\U00010e7f\U00011000-\U0001114f\U00011180-\U000111df\U00011680-\U000116cf\U00012000-\U0001247f\U00013000-\U0001342f\U00016800-\U00016a3f\U00016f00-\U00016f9f\U0001b000-\U0001b0ff\U0001d000-\U0001d24f\U0001d300-\U0001d37f\U0001d400-\U0001d7ff\U0001ee00-\U0001eeff\U0001f000-\U0001f64f\U0001f680-\U0001f77f\U00020000-\U0002a6df\U0002a700-\U0002b81f\U0002f800-\U0002fa1f\U000e0000-\U000e007f\U000e0100-\U000e01ef",
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef SDL_directsound_h_
#define SDL_directsound_h_
#include "../../core/windows/SDL_directx.h"
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
/* The DirectSound objects */
struct SDL_PrivateAudioData
{
LPDIRECTSOUND sound;
LPDIRECTSOUNDBUFFER mixbuf;
LPDIRECTSOUNDCAPTURE capture;
LPDIRECTSOUNDCAPTUREBUFFER capturebuf;
int num_buffers;
DWORD lastchunk;
Uint8 *locked_buf;
};
#endif /* SDL_directsound_h_ */
/* vi: set ts=4 sw=4 expandtab: */
| {
"pile_set_name": "Github"
} |
{
"type": "Document",
"raw": "TEXT\r\nTHIS TEXT IS CRLF line break\r\nCRLF!!!!\r\n",
"range": [
0,
46
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 0
}
},
"children": [
{
"type": "Paragraph",
"raw": "TEXT",
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"children": [
{
"type": "Str",
"raw": "TEXT",
"value": "TEXT",
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
}
}
]
},
{
"type": "Break",
"raw": "\r\n",
"value": "\r\n",
"range": [
4,
6
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 6
}
}
},
{
"type": "Paragraph",
"raw": "THIS TEXT IS CRLF line break",
"range": [
6,
34
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 28
}
},
"children": [
{
"type": "Str",
"raw": "THIS TEXT IS CRLF line break",
"value": "THIS TEXT IS CRLF line break",
"range": [
6,
34
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 28
}
}
}
]
},
{
"type": "Break",
"raw": "\r\n",
"value": "\r\n",
"range": [
34,
36
],
"loc": {
"start": {
"line": 2,
"column": 28
},
"end": {
"line": 2,
"column": 30
}
}
},
{
"type": "Paragraph",
"raw": "CRLF!!!!",
"range": [
36,
44
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 8
}
},
"children": [
{
"type": "Str",
"raw": "CRLF!!!!",
"value": "CRLF!!!!",
"range": [
36,
44
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 8
}
}
}
]
},
{
"type": "Break",
"raw": "\r\n",
"value": "\r\n",
"range": [
44,
46
],
"loc": {
"start": {
"line": 3,
"column": 8
},
"end": {
"line": 3,
"column": 10
}
}
}
]
} | {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 282eeacb5819529479abe25e3f2e2d19
timeCreated: 1444711561
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d7;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Field\FieldConfigInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Tests creation of comment reference fields for each comment type defined
* in Drupal 7.
*
* @group comment
*/
class MigrateCommentFieldInstanceTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(static::$modules);
$this->executeMigrations([
'd7_node_type',
'd7_comment_type',
'd7_comment_field',
'd7_comment_field_instance',
]);
}
/**
* Asserts a comment field entity.
*
* @param string $id
* The entity ID.
* @param string $field_name
* The field name.
* @param string $bundle
* The bundle ID.
* @param int $default_mode
* The field's default_mode setting.
* @param int $per_page
* The field's per_page setting.
* @param bool $anonymous
* The field's anonymous setting.
* @param int $form_location
* The field's form_location setting.
* @param bool $preview
* The field's preview setting.
*/
protected function assertEntity($id, $field_name, $bundle, $default_mode, $per_page, $anonymous, $form_location, $preview) {
$entity = FieldConfig::load($id);
$this->assertTrue($entity instanceof FieldConfigInterface);
/** @var \Drupal\field\FieldConfigInterface $entity */
$this->assertIdentical('node', $entity->getTargetEntityTypeId());
$this->assertIdentical('Comments', $entity->label());
$this->assertTrue($entity->isRequired());
$this->assertIdentical($field_name, $entity->getFieldStorageDefinition()->getName());
$this->assertIdentical($bundle, $entity->getTargetBundle());
$this->assertTrue($entity->get('default_value')[0]['status']);
$this->assertEqual($default_mode, $entity->getSetting('default_mode'));
$this->assertIdentical($per_page, $entity->getSetting('per_page'));
$this->assertEqual($anonymous, $entity->getSetting('anonymous'));
// This assertion fails because 1 !== TRUE. It's extremely strange that
// the form_location setting is returning a boolean, but this appears to
// be a problem with the entity, not with the migration.
// $this->asserIdentical($form_location, $entity->getSetting('form_location'));
$this->assertEqual($preview, $entity->getSetting('preview'));
}
/**
* Tests the migrated fields.
*/
public function testMigration() {
$this->assertEntity('node.page.comment_node_page', 'comment_node_page', 'page', TRUE, 50, FALSE, CommentItemInterface::FORM_BELOW, TRUE);
$this->assertEntity('node.article.comment_node_article', 'comment_node_article', 'article', TRUE, 50, FALSE, CommentItemInterface::FORM_BELOW, TRUE);
$this->assertEntity('node.blog.comment_node_blog', 'comment_node_blog', 'blog', TRUE, 50, FALSE, CommentItemInterface::FORM_BELOW, TRUE);
$this->assertEntity('node.book.comment_node_book', 'comment_node_book', 'book', TRUE, 50, FALSE, CommentItemInterface::FORM_BELOW, TRUE);
$this->assertEntity('node.forum.comment_node_forum', 'comment_node_forum', 'forum', TRUE, 50, FALSE, CommentItemInterface::FORM_BELOW, TRUE);
$this->assertEntity('node.test_content_type.comment_node_test_content_type', 'comment_node_test_content_type', 'test_content_type', TRUE, 30, FALSE, CommentItemInterface::FORM_BELOW, TRUE);
}
}
| {
"pile_set_name": "Github"
} |
{
"name": "DJM-900NXS2",
"description": "A DJ mixer.",
"url": "https://www.pioneerdj.com/en-us/product/mixer/djm-900nxs2/black/overview/"
}
| {
"pile_set_name": "Github"
} |
/*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package runtime
import (
"fmt"
"net/url"
"reflect"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/conversion"
)
// Scheme defines methods for serializing and deserializing API objects, a type
// registry for converting group, version, and kind information to and from Go
// schemas, and mappings between Go schemas of different versions. A scheme is the
// foundation for a versioned API and versioned configuration over time.
//
// In a Scheme, a Type is a particular Go struct, a Version is a point-in-time
// identifier for a particular representation of that Type (typically backwards
// compatible), a Kind is the unique name for that Type within the Version, and a
// Group identifies a set of Versions, Kinds, and Types that evolve over time. An
// Unversioned Type is one that is not yet formally bound to a type and is promised
// to be backwards compatible (effectively a "v1" of a Type that does not expect
// to break in the future).
//
// Schemes are not expected to change at runtime and are only threadsafe after
// registration is complete.
type Scheme struct {
// versionMap allows one to figure out the go type of an object with
// the given version and name.
gvkToType map[unversioned.GroupVersionKind]reflect.Type
// typeToGroupVersion allows one to find metadata for a given go object.
// The reflect.Type we index by should *not* be a pointer.
typeToGVK map[reflect.Type][]unversioned.GroupVersionKind
// unversionedTypes are transformed without conversion in ConvertToVersion.
unversionedTypes map[reflect.Type]unversioned.GroupVersionKind
// unversionedKinds are the names of kinds that can be created in the context of any group
// or version
// TODO: resolve the status of unversioned types.
unversionedKinds map[string]reflect.Type
// Map from version and resource to the corresponding func to convert
// resource field labels in that version to internal version.
fieldLabelConversionFuncs map[string]map[string]FieldLabelConversionFunc
// converter stores all registered conversion functions. It also has
// default coverting behavior.
converter *conversion.Converter
// cloner stores all registered copy functions. It also has default
// deep copy behavior.
cloner *conversion.Cloner
}
// Function to convert a field selector to internal representation.
type FieldLabelConversionFunc func(label, value string) (internalLabel, internalValue string, err error)
// NewScheme creates a new Scheme. This scheme is pluggable by default.
func NewScheme() *Scheme {
s := &Scheme{
gvkToType: map[unversioned.GroupVersionKind]reflect.Type{},
typeToGVK: map[reflect.Type][]unversioned.GroupVersionKind{},
unversionedTypes: map[reflect.Type]unversioned.GroupVersionKind{},
unversionedKinds: map[string]reflect.Type{},
cloner: conversion.NewCloner(),
fieldLabelConversionFuncs: map[string]map[string]FieldLabelConversionFunc{},
}
s.converter = conversion.NewConverter(s.nameFunc)
s.AddConversionFuncs(DefaultEmbeddedConversions()...)
// Enable map[string][]string conversions by default
if err := s.AddConversionFuncs(DefaultStringConversions...); err != nil {
panic(err)
}
if err := s.RegisterInputDefaults(&map[string][]string{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields); err != nil {
panic(err)
}
if err := s.RegisterInputDefaults(&url.Values{}, JSONKeyMapper, conversion.AllowDifferentFieldTypeNames|conversion.IgnoreMissingFields); err != nil {
panic(err)
}
return s
}
// nameFunc returns the name of the type that we wish to use to determine when two types attempt
// a conversion. Defaults to the go name of the type if the type is not registered.
func (s *Scheme) nameFunc(t reflect.Type) string {
// find the preferred names for this type
gvks, ok := s.typeToGVK[t]
if !ok {
return t.Name()
}
for _, gvk := range gvks {
internalGV := gvk.GroupVersion()
internalGV.Version = "__internal" // this is hacky and maybe should be passed in
internalGVK := internalGV.WithKind(gvk.Kind)
if internalType, exists := s.gvkToType[internalGVK]; exists {
return s.typeToGVK[internalType][0].Kind
}
}
return gvks[0].Kind
}
// fromScope gets the input version, desired output version, and desired Scheme
// from a conversion.Scope.
func (s *Scheme) fromScope(scope conversion.Scope) (inVersion, outVersion string, scheme *Scheme) {
scheme = s
inVersion = scope.Meta().SrcVersion
outVersion = scope.Meta().DestVersion
return inVersion, outVersion, scheme
}
// Converter allows access to the converter for the scheme
func (s *Scheme) Converter() *conversion.Converter {
return s.converter
}
// AddUnversionedTypes registers the provided types as "unversioned", which means that they follow special rules.
// Whenever an object of this type is serialized, it is serialized with the provided group version and is not
// converted. Thus unversioned objects are expected to remain backwards compatible forever, as if they were in an
// API group and version that would never be updated.
//
// TODO: there is discussion about removing unversioned and replacing it with objects that are manifest into
// every version with particular schemas. Resolve this method at that point.
func (s *Scheme) AddUnversionedTypes(version unversioned.GroupVersion, types ...Object) {
s.AddKnownTypes(version, types...)
for _, obj := range types {
t := reflect.TypeOf(obj).Elem()
gvk := version.WithKind(t.Name())
s.unversionedTypes[t] = gvk
if _, ok := s.unversionedKinds[gvk.Kind]; ok {
panic(fmt.Sprintf("%v has already been registered as unversioned kind %q - kind name must be unique", reflect.TypeOf(t), gvk.Kind))
}
s.unversionedKinds[gvk.Kind] = t
}
}
// AddKnownTypes registers all types passed in 'types' as being members of version 'version'.
// All objects passed to types should be pointers to structs. The name that go reports for
// the struct becomes the "kind" field when encoding. Version may not be empty - use the
// APIVersionInternal constant if you have a type that does not have a formal version.
func (s *Scheme) AddKnownTypes(gv unversioned.GroupVersion, types ...Object) {
if len(gv.Version) == 0 {
panic(fmt.Sprintf("version is required on all types: %s %v", gv, types[0]))
}
for _, obj := range types {
t := reflect.TypeOf(obj)
if t.Kind() != reflect.Ptr {
panic("All types must be pointers to structs.")
}
t = t.Elem()
if t.Kind() != reflect.Struct {
panic("All types must be pointers to structs.")
}
gvk := gv.WithKind(t.Name())
s.gvkToType[gvk] = t
s.typeToGVK[t] = append(s.typeToGVK[t], gvk)
}
}
// AddKnownTypeWithName is like AddKnownTypes, but it lets you specify what this type should
// be encoded as. Useful for testing when you don't want to make multiple packages to define
// your structs. Version may not be empty - use the APIVersionInternal constant if you have a
// type that does not have a formal version.
func (s *Scheme) AddKnownTypeWithName(gvk unversioned.GroupVersionKind, obj Object) {
t := reflect.TypeOf(obj)
if len(gvk.Version) == 0 {
panic(fmt.Sprintf("version is required on all types: %s %v", gvk, t))
}
if t.Kind() != reflect.Ptr {
panic("All types must be pointers to structs.")
}
t = t.Elem()
if t.Kind() != reflect.Struct {
panic("All types must be pointers to structs.")
}
s.gvkToType[gvk] = t
s.typeToGVK[t] = append(s.typeToGVK[t], gvk)
}
// KnownTypes returns the types known for the given version.
func (s *Scheme) KnownTypes(gv unversioned.GroupVersion) map[string]reflect.Type {
types := make(map[string]reflect.Type)
for gvk, t := range s.gvkToType {
if gv != gvk.GroupVersion() {
continue
}
types[gvk.Kind] = t
}
return types
}
// ObjectKind returns the group,version,kind of the go object,
// or an error if it's not a pointer or is unregistered.
func (s *Scheme) ObjectKind(obj Object) (unversioned.GroupVersionKind, error) {
gvks, err := s.ObjectKinds(obj)
if err != nil {
return unversioned.GroupVersionKind{}, err
}
return gvks[0], nil
}
// ObjectKinds returns all possible group,version,kind of the go object,
// or an error if it's not a pointer or is unregistered.
func (s *Scheme) ObjectKinds(obj Object) ([]unversioned.GroupVersionKind, error) {
v, err := conversion.EnforcePtr(obj)
if err != nil {
return nil, err
}
t := v.Type()
gvks, ok := s.typeToGVK[t]
if !ok {
return nil, ¬RegisteredErr{t: t}
}
return gvks, nil
}
// Recognizes returns true if the scheme is able to handle the provided group,version,kind
// of an object.
func (s *Scheme) Recognizes(gvk unversioned.GroupVersionKind) bool {
_, exists := s.gvkToType[gvk]
return exists
}
func (s *Scheme) IsUnversioned(obj Object) (bool, bool) {
v, err := conversion.EnforcePtr(obj)
if err != nil {
return false, false
}
t := v.Type()
if _, ok := s.typeToGVK[t]; !ok {
return false, false
}
_, ok := s.unversionedTypes[t]
return ok, true
}
// New returns a new API object of the given version and name, or an error if it hasn't
// been registered. The version and kind fields must be specified.
func (s *Scheme) New(kind unversioned.GroupVersionKind) (Object, error) {
if t, exists := s.gvkToType[kind]; exists {
return reflect.New(t).Interface().(Object), nil
}
if t, exists := s.unversionedKinds[kind.Kind]; exists {
return reflect.New(t).Interface().(Object), nil
}
return nil, ¬RegisteredErr{gvk: kind}
}
// Log sets a logger on the scheme. For test purposes only
func (s *Scheme) Log(l conversion.DebugLogger) {
s.converter.Debug = l
}
// AddIgnoredConversionType identifies a pair of types that should be skipped by
// conversion (because the data inside them is explicitly dropped during
// conversion).
func (s *Scheme) AddIgnoredConversionType(from, to interface{}) error {
return s.converter.RegisterIgnoredConversion(from, to)
}
// AddConversionFuncs adds functions to the list of conversion functions. The given
// functions should know how to convert between two of your API objects, or their
// sub-objects. We deduce how to call these functions from the types of their two
// parameters; see the comment for Converter.Register.
//
// Note that, if you need to copy sub-objects that didn't change, you can use the
// conversion.Scope object that will be passed to your conversion function.
// Additionally, all conversions started by Scheme will set the SrcVersion and
// DestVersion fields on the Meta object. Example:
//
// s.AddConversionFuncs(
// func(in *InternalObject, out *ExternalObject, scope conversion.Scope) error {
// // You can depend on Meta() being non-nil, and this being set to
// // the source version, e.g., ""
// s.Meta().SrcVersion
// // You can depend on this being set to the destination version,
// // e.g., "v1".
// s.Meta().DestVersion
// // Call scope.Convert to copy sub-fields.
// s.Convert(&in.SubFieldThatMoved, &out.NewLocation.NewName, 0)
// return nil
// },
// )
//
// (For more detail about conversion functions, see Converter.Register's comment.)
//
// Also note that the default behavior, if you don't add a conversion function, is to
// sanely copy fields that have the same names and same type names. It's OK if the
// destination type has extra fields, but it must not remove any. So you only need to
// add conversion functions for things with changed/removed fields.
func (s *Scheme) AddConversionFuncs(conversionFuncs ...interface{}) error {
for _, f := range conversionFuncs {
if err := s.converter.RegisterConversionFunc(f); err != nil {
return err
}
}
return nil
}
// Similar to AddConversionFuncs, but registers conversion functions that were
// automatically generated.
func (s *Scheme) AddGeneratedConversionFuncs(conversionFuncs ...interface{}) error {
for _, f := range conversionFuncs {
if err := s.converter.RegisterGeneratedConversionFunc(f); err != nil {
return err
}
}
return nil
}
// AddDeepCopyFuncs adds a function to the list of deep-copy functions.
// For the expected format of deep-copy function, see the comment for
// Copier.RegisterDeepCopyFunction.
func (s *Scheme) AddDeepCopyFuncs(deepCopyFuncs ...interface{}) error {
for _, f := range deepCopyFuncs {
if err := s.cloner.RegisterDeepCopyFunc(f); err != nil {
return err
}
}
return nil
}
// Similar to AddDeepCopyFuncs, but registers deep-copy functions that were
// automatically generated.
func (s *Scheme) AddGeneratedDeepCopyFuncs(deepCopyFuncs ...interface{}) error {
for _, f := range deepCopyFuncs {
if err := s.cloner.RegisterGeneratedDeepCopyFunc(f); err != nil {
return err
}
}
return nil
}
// AddFieldLabelConversionFunc adds a conversion function to convert field selectors
// of the given kind from the given version to internal version representation.
func (s *Scheme) AddFieldLabelConversionFunc(version, kind string, conversionFunc FieldLabelConversionFunc) error {
if s.fieldLabelConversionFuncs[version] == nil {
s.fieldLabelConversionFuncs[version] = map[string]FieldLabelConversionFunc{}
}
s.fieldLabelConversionFuncs[version][kind] = conversionFunc
return nil
}
// AddStructFieldConversion allows you to specify a mechanical copy for a moved
// or renamed struct field without writing an entire conversion function. See
// the comment in conversion.Converter.SetStructFieldCopy for parameter details.
// Call as many times as needed, even on the same fields.
func (s *Scheme) AddStructFieldConversion(srcFieldType interface{}, srcFieldName string, destFieldType interface{}, destFieldName string) error {
return s.converter.SetStructFieldCopy(srcFieldType, srcFieldName, destFieldType, destFieldName)
}
// RegisterInputDefaults sets the provided field mapping function and field matching
// as the defaults for the provided input type. The fn may be nil, in which case no
// mapping will happen by default. Use this method to register a mechanism for handling
// a specific input type in conversion, such as a map[string]string to structs.
func (s *Scheme) RegisterInputDefaults(in interface{}, fn conversion.FieldMappingFunc, defaultFlags conversion.FieldMatchingFlags) error {
return s.converter.RegisterInputDefaults(in, fn, defaultFlags)
}
// AddDefaultingFuncs adds functions to the list of default-value functions.
// Each of the given functions is responsible for applying default values
// when converting an instance of a versioned API object into an internal
// API object. These functions do not need to handle sub-objects. We deduce
// how to call these functions from the types of their two parameters.
//
// s.AddDefaultingFuncs(
// func(obj *v1.Pod) {
// if obj.OptionalField == "" {
// obj.OptionalField = "DefaultValue"
// }
// },
// )
func (s *Scheme) AddDefaultingFuncs(defaultingFuncs ...interface{}) error {
for _, f := range defaultingFuncs {
err := s.converter.RegisterDefaultingFunc(f)
if err != nil {
return err
}
}
return nil
}
// Copy does a deep copy of an API object.
func (s *Scheme) Copy(src Object) (Object, error) {
dst, err := s.DeepCopy(src)
if err != nil {
return nil, err
}
return dst.(Object), nil
}
// Performs a deep copy of the given object.
func (s *Scheme) DeepCopy(src interface{}) (interface{}, error) {
return s.cloner.DeepCopy(src)
}
// Convert will attempt to convert in into out. Both must be pointers. For easy
// testing of conversion functions. Returns an error if the conversion isn't
// possible. You can call this with types that haven't been registered (for example,
// a to test conversion of types that are nested within registered types), but in
// that case, the conversion.Scope object passed to your conversion functions won't
// have SrcVersion or DestVersion fields set correctly in Meta().
func (s *Scheme) Convert(in, out interface{}) error {
inVersion := unversioned.GroupVersion{Group: "unknown", Version: "unknown"}
outVersion := unversioned.GroupVersion{Group: "unknown", Version: "unknown"}
if inObj, ok := in.(Object); ok {
if gvk, err := s.ObjectKind(inObj); err == nil {
inVersion = gvk.GroupVersion()
}
}
if outObj, ok := out.(Object); ok {
if gvk, err := s.ObjectKind(outObj); err == nil {
outVersion = gvk.GroupVersion()
}
}
flags, meta := s.generateConvertMeta(inVersion, outVersion, in)
if flags == 0 {
flags = conversion.AllowDifferentFieldTypeNames
}
return s.converter.Convert(in, out, flags, meta)
}
// Converts the given field label and value for an kind field selector from
// versioned representation to an unversioned one.
func (s *Scheme) ConvertFieldLabel(version, kind, label, value string) (string, string, error) {
if s.fieldLabelConversionFuncs[version] == nil {
return "", "", fmt.Errorf("No field label conversion function found for version: %s", version)
}
conversionFunc, ok := s.fieldLabelConversionFuncs[version][kind]
if !ok {
return "", "", fmt.Errorf("No field label conversion function found for version %s and kind %s", version, kind)
}
return conversionFunc(label, value)
}
// ConvertToVersion attempts to convert an input object to its matching Kind in another
// version within this scheme. Will return an error if the provided version does not
// contain the inKind (or a mapping by name defined with AddKnownTypeWithName). Will also
// return an error if the conversion does not result in a valid Object being
// returned. The serializer handles loading/serializing nested objects.
func (s *Scheme) ConvertToVersion(in Object, outVersion string) (Object, error) {
gv, err := unversioned.ParseGroupVersion(outVersion)
if err != nil {
return nil, err
}
switch in.(type) {
case *Unknown, *Unstructured, *UnstructuredList:
old := in.GetObjectKind().GroupVersionKind()
defer in.GetObjectKind().SetGroupVersionKind(old)
setTargetVersion(in, s, gv)
return in, nil
}
t := reflect.TypeOf(in)
if t.Kind() != reflect.Ptr {
return nil, fmt.Errorf("only pointer types may be converted: %v", t)
}
t = t.Elem()
if t.Kind() != reflect.Struct {
return nil, fmt.Errorf("only pointers to struct types may be converted: %v", t)
}
var kind unversioned.GroupVersionKind
if unversionedKind, ok := s.unversionedTypes[t]; ok {
kind = unversionedKind
} else {
kinds, ok := s.typeToGVK[t]
if !ok || len(kinds) == 0 {
return nil, fmt.Errorf("%v is not a registered type and cannot be converted into version %q", t, outVersion)
}
kind = kinds[0]
}
outKind := gv.WithKind(kind.Kind)
inKind, err := s.ObjectKind(in)
if err != nil {
return nil, err
}
out, err := s.New(outKind)
if err != nil {
return nil, err
}
flags, meta := s.generateConvertMeta(inKind.GroupVersion(), gv, in)
if err := s.converter.Convert(in, out, flags, meta); err != nil {
return nil, err
}
setTargetVersion(out, s, gv)
return out, nil
}
// generateConvertMeta constructs the meta value we pass to Convert.
func (s *Scheme) generateConvertMeta(srcGroupVersion, destGroupVersion unversioned.GroupVersion, in interface{}) (conversion.FieldMatchingFlags, *conversion.Meta) {
flags, meta := s.converter.DefaultMeta(reflect.TypeOf(in))
meta.SrcVersion = srcGroupVersion.String()
meta.DestVersion = destGroupVersion.String()
return flags, meta
}
func setTargetVersion(obj Object, raw *Scheme, gv unversioned.GroupVersion) {
if gv.Version == APIVersionInternal {
// internal is a special case
obj.GetObjectKind().SetGroupVersionKind(nil)
} else {
gvk, _ := raw.ObjectKind(obj)
obj.GetObjectKind().SetGroupVersionKind(&unversioned.GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: gvk.Kind})
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_23) on Mon May 02 03:14:24 KST 2011 -->
<TITLE>
Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor
</TITLE>
<META NAME="date" CONTENT="2011-05-02">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.html" title="class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../../index.html?org/eclipse/cdt/managedbuilder/llvm/ui/preferences/\class-useLibraryPathListEditor.html" target="_top"><B>FRAMES</B></A>
<A HREF="LibraryPathListEditor.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor</B></H2>
</CENTER>
No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.html" title="class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../../index.html?org/eclipse/cdt/managedbuilder/llvm/ui/preferences/\class-useLibraryPathListEditor.html" target="_top"><B>FRAMES</B></A>
<A HREF="LibraryPathListEditor.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef struct vetor{
double x;
double y;
} vetor;
bool menorX(vetor a, vetor b){
if (a.x<b.x) return true;
else return false;
}
bool menorY(vetor* a, vetor* b){
if (a->y<b->y) return true;
else return false;
}
double dist(vetor* a, vetor* b){
return sqrt((a->x-b->x)*(a->x-b->x) + (a->y-b->y)*(a->y-b->y));
}
vetor vet[10009], *aux[10009];
double trmin(double a, double b, double c){
c = (c>a?a:c);
return (c>b?b:c);
}
double twmin(double a, double b){
return (a>b?b:a);
}
double menorDist(int a, int b){
if (a+2==b){
return trmin(dist(&vet[a], &vet[a+1]), dist(&vet[a], &vet[a+2]), dist(&vet[a+1], &vet[a+2]));
}
if (a+1==b) return dist(&vet[a], &vet[b]);
if (a==b) return 10009.0;
int med = (a+b)/2, pdivisa=0;
double d = twmin(menorDist(a, med), menorDist(med+1, b));
double p = (vet[med].x + vet[med+1].x)/2.0;
for (int i=med; i>=a && p - vet[i].x < d; i--) aux[pdivisa++]=&vet[i];
for (int i=med+1; i<=b && vet[i].x - p < d; i++) aux[pdivisa++]=&vet[i];
sort(aux, aux+pdivisa, &menorY);
for(int i=0; i<pdivisa; i++){
for(int j=i+1; j<pdivisa && aux[j]->y - aux[i]->y < d; j++){
d = twmin(d, dist(aux[i], aux[j]));
}
}
return d;
}
int main()
{
int N;
double Dmin;
while(true){
scanf("%d", &N);
if (N==0) break;
for(int i=0; i<N; i++){
scanf("%lf %lf", &vet[i].x, &vet[i].y);
}
sort(vet, vet+N, &menorX);
Dmin = menorDist(0, N-1);
if (Dmin>10000.0) printf("INFINITY\n");
else printf("%.4f\n", Dmin);
}
return 0;
}
| {
"pile_set_name": "Github"
} |
/***************************************************************************
* *
* Copyright (C) 2017 Seamly, LLC *
* *
* https://github.com/fashionfreedom/seamly2d *
* *
***************************************************************************
**
** Seamly2D is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Seamly2D is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************
************************************************************************
**
** @file dialogtriangle.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Seamly2D project
** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
**
** Seamly2D is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Seamly2D is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGTRIANGLE_H
#define DIALOGTRIANGLE_H
#include <qcompilerdetection.h>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../vmisc/def.h"
#include "dialogtool.h"
namespace Ui
{
class DialogTriangle;
}
/**
* @brief The DialogTriangle class dialog for ToolTriangle. Help create point and edit option.
*/
class DialogTriangle : public DialogTool
{
Q_OBJECT
public:
DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
virtual ~DialogTriangle() Q_DECL_OVERRIDE;
quint32 GetAxisP1Id() const;
void SetAxisP1Id(const quint32 &value);
quint32 GetAxisP2Id() const;
void SetAxisP2Id(const quint32 &value);
quint32 GetFirstPointId() const;
void SetFirstPointId(const quint32 &value);
quint32 GetSecondPointId() const;
void SetSecondPointId(const quint32 &value);
void SetPointName(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
virtual void PointNameChanged() Q_DECL_OVERRIDE;
protected:
virtual void ShowVisualization() Q_DECL_OVERRIDE;
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogTriangle)
/** @brief ui keeps information about user interface */
Ui::DialogTriangle *ui;
};
#endif // DIALOGTRIANGLE_H
| {
"pile_set_name": "Github"
} |
#ifndef __SPLAY_H
#define __SPLAY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1997 - 2009, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
struct Curl_tree {
struct Curl_tree *smaller; /* smaller node */
struct Curl_tree *larger; /* larger node */
struct Curl_tree *same; /* points to a node with identical key */
struct timeval key; /* this node's "sort" key */
void *payload; /* data the splay code doesn't care about */
};
struct Curl_tree *Curl_splay(struct timeval i,
struct Curl_tree *t);
struct Curl_tree *Curl_splayinsert(struct timeval key,
struct Curl_tree *t,
struct Curl_tree *newnode);
#if 0
struct Curl_tree *Curl_splayremove(struct timeval key,
struct Curl_tree *t,
struct Curl_tree **removed);
#endif
struct Curl_tree *Curl_splaygetbest(struct timeval key,
struct Curl_tree *t,
struct Curl_tree **removed);
int Curl_splayremovebyaddr(struct Curl_tree *t,
struct Curl_tree *removenode,
struct Curl_tree **newroot);
#define Curl_splaycomparekeys(i,j) ( ((i.tv_sec) < (j.tv_sec)) ? -1 : \
( ((i.tv_sec) > (j.tv_sec)) ? 1 : \
( ((i.tv_usec) < (j.tv_usec)) ? -1 : \
( ((i.tv_usec) > (j.tv_usec)) ? 1 : 0 ))))
#ifdef DEBUGBUILD
void Curl_splayprint(struct Curl_tree * t, int d, char output);
#else
#define Curl_splayprint(x,y,z)
#endif
#endif
| {
"pile_set_name": "Github"
} |
import Sprite from "./Sprite.js";
import AnimManager from "./AnimManager.js";
class TileSprite extends Sprite {
constructor(texture, w, h) {
super(texture);
this.tileW = w;
this.tileH = h;
this.frame = { x: 0, y: 0 };
this.anims = new AnimManager(this);
}
update(dt) {
this.anims.update(dt);
}
get w() {
return this.tileW * Math.abs(this.scale.x);
}
get h() {
return this.tileH * Math.abs(this.scale.y);
}
}
export default TileSprite;
| {
"pile_set_name": "Github"
} |
/* DO NOT EDIT THIS FILE.
It has been auto-edited by fixincludes from:
"fixinc/tests/inc/string.h"
This had to be done to correct non-standard usages in the
original, manufacturer supplied header file. */
#if defined( SVR4_DISABLE_OPT_CHECK )
#endif /* SVR4_DISABLE_OPT_CHECK */
| {
"pile_set_name": "Github"
} |
<?php
namespace Oro\Bundle\ShippingBundle\Tests\Unit\Context;
use Oro\Bundle\ShippingBundle\Context\ShippingContextInterface;
/**
* @method \PHPUnit\Framework\MockObject\MockObject createMock(string $originalClassName)
*/
trait ShippingContextMockTrait
{
/**
* @return mixed
*/
private function createShippingContextMock()
{
return $this->createMock(ShippingContextInterface::class);
}
}
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of PHPExifTool.
*
* (c) 2012 Romain Neutron <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\DICOM;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class OverlayDescriptorBlue extends AbstractTag
{
protected $Id = '60xx,1103';
protected $Name = 'OverlayDescriptorBlue';
protected $FullName = 'DICOM::Main';
protected $GroupName = 'DICOM';
protected $g0 = 'DICOM';
protected $g1 = 'DICOM';
protected $g2 = 'Image';
protected $Type = '?';
protected $Writable = false;
protected $Description = 'Overlay Descriptor Blue';
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* sysPass
*
* @author nuxsmin
* @link https://syspass.org
* @copyright 2012-2019, Rubén Domínguez nuxsmin@$syspass.org
*
* This file is part of sysPass.
*
* sysPass is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sysPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\Providers\Auth;
use SP\DataModel\UserLoginData;
/**
* Interface AuthInterface
*
* @package Auth
*/
interface AuthInterface
{
/**
* Autentificar al usuario
*
* @param UserLoginData $UserData Datos del usuario
*
* @return mixed|AuthDataBase
*/
public function authenticate(UserLoginData $UserData);
/**
* Indica si es requerida para acceder a la aplicación
*
* @return boolean
*/
public function isAuthGranted();
} | {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc.
* This file is part of the GNU LIBICONV Library.
*
* The GNU LIBICONV Library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* The GNU LIBICONV Library is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
* If not, see <http://www.gnu.org/licenses/>.
*/
/*
* CP1125
*/
static const unsigned short cp1125_2uni[80] = {
/* 0xb0 */
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510,
/* 0xc0 */
0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f,
0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567,
/* 0xd0 */
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b,
0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580,
/* 0xe0 */
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f,
/* 0xf0 */
0x0401, 0x0451, 0x0490, 0x0491, 0x0404, 0x0454, 0x0406, 0x0456,
0x0407, 0x0457, 0x00b7, 0x221a, 0x2116, 0x00a4, 0x25a0, 0x00a0,
};
static int
cp1125_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
{
unsigned char c = *s;
if (c < 0x80)
*pwc = (ucs4_t) c;
else if (c < 0xb0)
*pwc = (ucs4_t) c + 0x0390;
else
*pwc = (ucs4_t) cp1125_2uni[c-0xb0];
return 1;
}
static const unsigned char cp1125_page00[24] = {
0xff, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, /* 0xb0-0xb7 */
};
static const unsigned char cp1125_page04[152] = {
0x00, 0xf0, 0x00, 0x00, 0xf4, 0x00, 0xf6, 0xf8, /* 0x00-0x07 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x10-0x17 */
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x18-0x1f */
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x20-0x27 */
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x28-0x2f */
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x30-0x37 */
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x38-0x3f */
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */
0x00, 0xf1, 0x00, 0x00, 0xf5, 0x00, 0xf7, 0xf9, /* 0x50-0x57 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
0xf2, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
};
static const unsigned char cp1125_page25[168] = {
0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
0xd9, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, /* 0x18-0x1f */
0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0x20-0x27 */
0x00, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, /* 0x28-0x2f */
0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, /* 0x30-0x37 */
0x00, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, /* 0x38-0x3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
0xcd, 0xba, 0xd5, 0xd6, 0xc9, 0xb8, 0xb7, 0xbb, /* 0x50-0x57 */
0xd4, 0xd3, 0xc8, 0xbe, 0xbd, 0xbc, 0xc6, 0xc7, /* 0x58-0x5f */
0xcc, 0xb5, 0xb6, 0xb9, 0xd1, 0xd2, 0xcb, 0xcf, /* 0x60-0x67 */
0xd0, 0xca, 0xd8, 0xd7, 0xce, 0x00, 0x00, 0x00, /* 0x68-0x6f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
0xdf, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, /* 0x80-0x87 */
0xdb, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, /* 0x88-0x8f */
0xde, 0xb0, 0xb1, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
};
static int
cp1125_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
{
unsigned char c = 0;
if (wc < 0x0080) {
*r = wc;
return 1;
}
else if (wc >= 0x00a0 && wc < 0x00b8)
c = cp1125_page00[wc-0x00a0];
else if (wc >= 0x0400 && wc < 0x0498)
c = cp1125_page04[wc-0x0400];
else if (wc == 0x2116)
c = 0xfc;
else if (wc == 0x221a)
c = 0xfb;
else if (wc >= 0x2500 && wc < 0x25a8)
c = cp1125_page25[wc-0x2500];
if (c != 0) {
*r = c;
return 1;
}
return RET_ILUNI;
}
| {
"pile_set_name": "Github"
} |
# negotiator
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
An HTTP content negotiator for Node.js
## Installation
```sh
$ npm install negotiator
```
## API
```js
var Negotiator = require('negotiator')
```
### Accept Negotiation
```js
availableMediaTypes = ['text/html', 'text/plain', 'application/json']
// The negotiator constructor receives a request object
negotiator = new Negotiator(request)
// Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8'
negotiator.mediaTypes()
// -> ['text/html', 'image/jpeg', 'application/*']
negotiator.mediaTypes(availableMediaTypes)
// -> ['text/html', 'application/json']
negotiator.mediaType(availableMediaTypes)
// -> 'text/html'
```
You can check a working example at `examples/accept.js`.
#### Methods
##### mediaType()
Returns the most preferred media type from the client.
##### mediaType(availableMediaType)
Returns the most preferred media type from a list of available media types.
##### mediaTypes()
Returns an array of preferred media types ordered by the client preference.
##### mediaTypes(availableMediaTypes)
Returns an array of preferred media types ordered by priority from a list of
available media types.
### Accept-Language Negotiation
```js
negotiator = new Negotiator(request)
availableLanguages = 'en', 'es', 'fr'
// Let's say Accept-Language header is 'en;q=0.8, es, pt'
negotiator.languages()
// -> ['es', 'pt', 'en']
negotiator.languages(availableLanguages)
// -> ['es', 'en']
language = negotiator.language(availableLanguages)
// -> 'es'
```
You can check a working example at `examples/language.js`.
#### Methods
##### language()
Returns the most preferred language from the client.
##### language(availableLanguages)
Returns the most preferred language from a list of available languages.
##### languages()
Returns an array of preferred languages ordered by the client preference.
##### languages(availableLanguages)
Returns an array of preferred languages ordered by priority from a list of
available languages.
### Accept-Charset Negotiation
```js
availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5']
negotiator = new Negotiator(request)
// Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2'
negotiator.charsets()
// -> ['utf-8', 'iso-8859-1', 'utf-7']
negotiator.charsets(availableCharsets)
// -> ['utf-8', 'iso-8859-1']
negotiator.charset(availableCharsets)
// -> 'utf-8'
```
You can check a working example at `examples/charset.js`.
#### Methods
##### charset()
Returns the most preferred charset from the client.
##### charset(availableCharsets)
Returns the most preferred charset from a list of available charsets.
##### charsets()
Returns an array of preferred charsets ordered by the client preference.
##### charsets(availableCharsets)
Returns an array of preferred charsets ordered by priority from a list of
available charsets.
### Accept-Encoding Negotiation
```js
availableEncodings = ['identity', 'gzip']
negotiator = new Negotiator(request)
// Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5'
negotiator.encodings()
// -> ['gzip', 'identity', 'compress']
negotiator.encodings(availableEncodings)
// -> ['gzip', 'identity']
negotiator.encoding(availableEncodings)
// -> 'gzip'
```
You can check a working example at `examples/encoding.js`.
#### Methods
##### encoding()
Returns the most preferred encoding from the client.
##### encoding(availableEncodings)
Returns the most preferred encoding from a list of available encodings.
##### encodings()
Returns an array of preferred encodings ordered by the client preference.
##### encodings(availableEncodings)
Returns an array of preferred encodings ordered by priority from a list of
available encodings.
## See Also
The [accepts](https://npmjs.org/package/accepts#readme) module builds on
this module and provides an alternative interface, mime type validation,
and more.
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/negotiator.svg
[npm-url]: https://npmjs.org/package/negotiator
[node-version-image]: https://img.shields.io/node/v/negotiator.svg
[node-version-url]: http://nodejs.org/download/
[travis-image]: https://img.shields.io/travis/jshttp/negotiator/master.svg
[travis-url]: https://travis-ci.org/jshttp/negotiator
[coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg
[coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master
[downloads-image]: https://img.shields.io/npm/dm/negotiator.svg
[downloads-url]: https://npmjs.org/package/negotiator
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.lang.model.util;
import javax.lang.model.type.*;
import javax.annotation.processing.SupportedSourceVersion;
import static javax.lang.model.SourceVersion.*;
import javax.lang.model.SourceVersion;
/**
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for the {@link SourceVersion#RELEASE_7
* RELEASE_7} source version. For {@linkplain
* TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
* <p> Methods in this class may be overridden subject to their
* general contract. Note that annotating methods in concrete
* subclasses with {@link java.lang.Override @Override} will help
* ensure that methods are overridden as intended.
*
* <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
* by this class may have methods added to it in the future to
* accommodate new, currently unknown, language structures added to
* future versions of the Java™ programming language.
* Therefore, methods whose names begin with {@code "visit"} may be
* added to this class in the future; to avoid incompatibilities,
* classes which extend this class should not declare any instance
* methods with names beginning with {@code "visit"}.
*
* <p>When such a new visit method is added, the default
* implementation in this class will be to call the {@link
* #visitUnknown visitUnknown} method. A new type kind visitor class
* will also be introduced to correspond to the new language level;
* this visitor will have different default behavior for the visit
* method in question. When the new visitor is introduced, all or
* portions of this visitor may be deprecated.
*
* <p>Note that adding a default implementation of a new visit method
* in a visitor class will occur instead of adding a <em>default
* method</em> directly in the visitor interface since a Java SE 8
* language feature cannot be used to this version of the API since
* this version is required to be runnable on Java SE 7
* implementations. Future versions of the API that are only required
* to run on Java SE 8 and later may take advantage of default methods
* in this situation.
*
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
* methods. Use {@code Void} for visitors that do not need an
* additional parameter.
*
* @see TypeKindVisitor6
* @see TypeKindVisitor8
* @since 1.7
*/
@SupportedSourceVersion(RELEASE_7)
public class TypeKindVisitor7<R, P> extends TypeKindVisitor6<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
* for the default value.
*/
protected TypeKindVisitor7() {
super(null);
}
/**
* Constructor for concrete subclasses to call; uses the argument
* for the default value.
*
* @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
*/
protected TypeKindVisitor7(R defaultValue) {
super(defaultValue);
}
/**
* This implementation visits a {@code UnionType} by calling
* {@code defaultAction}.
*
* @param t {@inheritDoc}
* @param p {@inheritDoc}
* @return the result of {@code defaultAction}
*/
@Override
public R visitUnion(UnionType t, P p) {
return defaultAction(t, p);
}
}
| {
"pile_set_name": "Github"
} |
<view class='new-con'>
<view class='title-wrapper'>
<view class='title-box'>
<text>{{newContent.title}}</text>
<text class='line'></text>
</view>
<view class='time-box'>
<text>时间:{{newContent.add_time}}</text> <text>浏览量:{{newContent.visit}}</text>
</view>
</view>
<view class='content-box'>
<template is="wxParse" data="{{wxParseData:content.nodes}}"/>
</view>
</view>
<import src="/wxParse/wxParse.wxml"/>
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "[email protected]",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
| {
"pile_set_name": "Github"
} |
package fse
import (
"errors"
"fmt"
)
const (
tablelogAbsoluteMax = 15
)
// Decompress a block of data.
// You can provide a scratch buffer to avoid allocations.
// If nil is provided a temporary one will be allocated.
// It is possible, but by no way guaranteed that corrupt data will
// return an error.
// It is up to the caller to verify integrity of the returned data.
// Use a predefined Scrach to set maximum acceptable output size.
func Decompress(b []byte, s *Scratch) ([]byte, error) {
s, err := s.prepare(b)
if err != nil {
return nil, err
}
s.Out = s.Out[:0]
err = s.readNCount()
if err != nil {
return nil, err
}
err = s.buildDtable()
if err != nil {
return nil, err
}
err = s.decompress()
if err != nil {
return nil, err
}
return s.Out, nil
}
// readNCount will read the symbol distribution so decoding tables can be constructed.
func (s *Scratch) readNCount() error {
var (
charnum uint16
previous0 bool
b = &s.br
)
iend := b.remain()
if iend < 4 {
return errors.New("input too small")
}
bitStream := b.Uint32()
nbBits := uint((bitStream & 0xF) + minTablelog) // extract tableLog
if nbBits > tablelogAbsoluteMax {
return errors.New("tableLog too large")
}
bitStream >>= 4
bitCount := uint(4)
s.actualTableLog = uint8(nbBits)
remaining := int32((1 << nbBits) + 1)
threshold := int32(1 << nbBits)
gotTotal := int32(0)
nbBits++
for remaining > 1 {
if previous0 {
n0 := charnum
for (bitStream & 0xFFFF) == 0xFFFF {
n0 += 24
if b.off < iend-5 {
b.advance(2)
bitStream = b.Uint32() >> bitCount
} else {
bitStream >>= 16
bitCount += 16
}
}
for (bitStream & 3) == 3 {
n0 += 3
bitStream >>= 2
bitCount += 2
}
n0 += uint16(bitStream & 3)
bitCount += 2
if n0 > maxSymbolValue {
return errors.New("maxSymbolValue too small")
}
for charnum < n0 {
s.norm[charnum&0xff] = 0
charnum++
}
if b.off <= iend-7 || b.off+int(bitCount>>3) <= iend-4 {
b.advance(bitCount >> 3)
bitCount &= 7
bitStream = b.Uint32() >> bitCount
} else {
bitStream >>= 2
}
}
max := (2*(threshold) - 1) - (remaining)
var count int32
if (int32(bitStream) & (threshold - 1)) < max {
count = int32(bitStream) & (threshold - 1)
bitCount += nbBits - 1
} else {
count = int32(bitStream) & (2*threshold - 1)
if count >= threshold {
count -= max
}
bitCount += nbBits
}
count-- // extra accuracy
if count < 0 {
// -1 means +1
remaining += count
gotTotal -= count
} else {
remaining -= count
gotTotal += count
}
s.norm[charnum&0xff] = int16(count)
charnum++
previous0 = count == 0
for remaining < threshold {
nbBits--
threshold >>= 1
}
if b.off <= iend-7 || b.off+int(bitCount>>3) <= iend-4 {
b.advance(bitCount >> 3)
bitCount &= 7
} else {
bitCount -= (uint)(8 * (len(b.b) - 4 - b.off))
b.off = len(b.b) - 4
}
bitStream = b.Uint32() >> (bitCount & 31)
}
s.symbolLen = charnum
if s.symbolLen <= 1 {
return fmt.Errorf("symbolLen (%d) too small", s.symbolLen)
}
if s.symbolLen > maxSymbolValue+1 {
return fmt.Errorf("symbolLen (%d) too big", s.symbolLen)
}
if remaining != 1 {
return fmt.Errorf("corruption detected (remaining %d != 1)", remaining)
}
if bitCount > 32 {
return fmt.Errorf("corruption detected (bitCount %d > 32)", bitCount)
}
if gotTotal != 1<<s.actualTableLog {
return fmt.Errorf("corruption detected (total %d != %d)", gotTotal, 1<<s.actualTableLog)
}
b.advance((bitCount + 7) >> 3)
return nil
}
// decSymbol contains information about a state entry,
// Including the state offset base, the output symbol and
// the number of bits to read for the low part of the destination state.
type decSymbol struct {
newState uint16
symbol uint8
nbBits uint8
}
// allocDtable will allocate decoding tables if they are not big enough.
func (s *Scratch) allocDtable() {
tableSize := 1 << s.actualTableLog
if cap(s.decTable) < int(tableSize) {
s.decTable = make([]decSymbol, tableSize)
}
s.decTable = s.decTable[:tableSize]
if cap(s.ct.tableSymbol) < 256 {
s.ct.tableSymbol = make([]byte, 256)
}
s.ct.tableSymbol = s.ct.tableSymbol[:256]
if cap(s.ct.stateTable) < 256 {
s.ct.stateTable = make([]uint16, 256)
}
s.ct.stateTable = s.ct.stateTable[:256]
}
// buildDtable will build the decoding table.
func (s *Scratch) buildDtable() error {
tableSize := uint32(1 << s.actualTableLog)
highThreshold := tableSize - 1
s.allocDtable()
symbolNext := s.ct.stateTable[:256]
// Init, lay down lowprob symbols
s.zeroBits = false
{
largeLimit := int16(1 << (s.actualTableLog - 1))
for i, v := range s.norm[:s.symbolLen] {
if v == -1 {
s.decTable[highThreshold].symbol = uint8(i)
highThreshold--
symbolNext[i] = 1
} else {
if v >= largeLimit {
s.zeroBits = true
}
symbolNext[i] = uint16(v)
}
}
}
// Spread symbols
{
tableMask := tableSize - 1
step := tableStep(tableSize)
position := uint32(0)
for ss, v := range s.norm[:s.symbolLen] {
for i := 0; i < int(v); i++ {
s.decTable[position].symbol = uint8(ss)
position = (position + step) & tableMask
for position > highThreshold {
// lowprob area
position = (position + step) & tableMask
}
}
}
if position != 0 {
// position must reach all cells once, otherwise normalizedCounter is incorrect
return errors.New("corrupted input (position != 0)")
}
}
// Build Decoding table
{
tableSize := uint16(1 << s.actualTableLog)
for u, v := range s.decTable {
symbol := v.symbol
nextState := symbolNext[symbol]
symbolNext[symbol] = nextState + 1
nBits := s.actualTableLog - byte(highBits(uint32(nextState)))
s.decTable[u].nbBits = nBits
newState := (nextState << nBits) - tableSize
if newState >= tableSize {
return fmt.Errorf("newState (%d) outside table size (%d)", newState, tableSize)
}
if newState == uint16(u) && nBits == 0 {
// Seems weird that this is possible with nbits > 0.
return fmt.Errorf("newState (%d) == oldState (%d) and no bits", newState, u)
}
s.decTable[u].newState = newState
}
}
return nil
}
// decompress will decompress the bitstream.
// If the buffer is over-read an error is returned.
func (s *Scratch) decompress() error {
br := &s.bits
br.init(s.br.unread())
var s1, s2 decoder
// Initialize and decode first state and symbol.
s1.init(br, s.decTable, s.actualTableLog)
s2.init(br, s.decTable, s.actualTableLog)
// Use temp table to avoid bound checks/append penalty.
var tmp = s.ct.tableSymbol[:256]
var off uint8
// Main part
if !s.zeroBits {
for br.off >= 8 {
br.fillFast()
tmp[off+0] = s1.nextFast()
tmp[off+1] = s2.nextFast()
br.fillFast()
tmp[off+2] = s1.nextFast()
tmp[off+3] = s2.nextFast()
off += 4
// When off is 0, we have overflowed and should write.
if off == 0 {
s.Out = append(s.Out, tmp...)
if len(s.Out) >= s.DecompressLimit {
return fmt.Errorf("output size (%d) > DecompressLimit (%d)", len(s.Out), s.DecompressLimit)
}
}
}
} else {
for br.off >= 8 {
br.fillFast()
tmp[off+0] = s1.next()
tmp[off+1] = s2.next()
br.fillFast()
tmp[off+2] = s1.next()
tmp[off+3] = s2.next()
off += 4
if off == 0 {
s.Out = append(s.Out, tmp...)
// When off is 0, we have overflowed and should write.
if len(s.Out) >= s.DecompressLimit {
return fmt.Errorf("output size (%d) > DecompressLimit (%d)", len(s.Out), s.DecompressLimit)
}
}
}
}
s.Out = append(s.Out, tmp[:off]...)
// Final bits, a bit more expensive check
for {
if s1.finished() {
s.Out = append(s.Out, s1.final(), s2.final())
break
}
br.fill()
s.Out = append(s.Out, s1.next())
if s2.finished() {
s.Out = append(s.Out, s2.final(), s1.final())
break
}
s.Out = append(s.Out, s2.next())
if len(s.Out) >= s.DecompressLimit {
return fmt.Errorf("output size (%d) > DecompressLimit (%d)", len(s.Out), s.DecompressLimit)
}
}
return br.close()
}
// decoder keeps track of the current state and updates it from the bitstream.
type decoder struct {
state uint16
br *bitReader
dt []decSymbol
}
// init will initialize the decoder and read the first state from the stream.
func (d *decoder) init(in *bitReader, dt []decSymbol, tableLog uint8) {
d.dt = dt
d.br = in
d.state = uint16(in.getBits(tableLog))
}
// next returns the next symbol and sets the next state.
// At least tablelog bits must be available in the bit reader.
func (d *decoder) next() uint8 {
n := &d.dt[d.state]
lowBits := d.br.getBits(n.nbBits)
d.state = n.newState + lowBits
return n.symbol
}
// finished returns true if all bits have been read from the bitstream
// and the next state would require reading bits from the input.
func (d *decoder) finished() bool {
return d.br.finished() && d.dt[d.state].nbBits > 0
}
// final returns the current state symbol without decoding the next.
func (d *decoder) final() uint8 {
return d.dt[d.state].symbol
}
// nextFast returns the next symbol and sets the next state.
// This can only be used if no symbols are 0 bits.
// At least tablelog bits must be available in the bit reader.
func (d *decoder) nextFast() uint8 {
n := d.dt[d.state]
lowBits := d.br.getBitsFast(n.nbBits)
d.state = n.newState + lowBits
return n.symbol
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<StartAction>Project</StartAction>
<ExternalConsole>false</ExternalConsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Extra' ">
<StartAction>Project</StartAction>
<ExternalConsole>false</ExternalConsole>
</PropertyGroup>
</Project> | {
"pile_set_name": "Github"
} |
#!/bin/tcsh
#
# This script will configure, build and run HOMME using the
# NGGPS benchmark problem
#
# 128 levels
# 10 tracers
#
# ne4 ultra-low-res for testing
# ne30 (1 degree)
# ne120 (1/4 degree)
#
#
#
#SBATCH --job-name nggpsbench
#SBATCH -N 1
#SBATCH -C knl
#SBATCH --time=0:15:00
#XSBATCH --account=FY150001
#XSBATCH -p ec
#
# set paths to source code, build directory and run directory
#
set wdir = ~/scratch2/knl/nggpsbench # run directory
set HOMME = `pwd`/../../.. # /path/to/acme/components/homme
set MACH = $HOMME/cmake/machineFiles/cori-knl.cmake
#
# Which problem? tiny, ne30 or ne120 configuration
#
# use 4 nodes
set namelist = nggps-tiny.nl ; set name = tiny
# good Edison nodes: 64 128 256 512 1024 2048 4096 5462
# elem/node 6144 3072 1536 768 384 192 96 71/72
#
# good KNL nodes: 9145 6144 3072 2048 1024 512 256 128 64
# ele/node 42/43 64 128 192
# elem/core 0/1 1 2 3 6 12 24 48 96 ( using 64 cores/node )
#set namelist = nggps-ne256.nl ; set name = ne256
#
# mpi run command
#
setenv OMP_STACKSIZE 16M # Cori has 96GB per node. had to lower to 8M on 3K nodes
setenv PER_NODE 64 # MPI per node
setenv OMP_NUM_THREADS 2
# number of virtual cores per MPI task
set VC_PER_MPI = 256 # Set this to 272 if using PER_NODE divides 272 instead of 256
@ VC_PER_MPI /= $PER_NODE
setenv KMP_AFFINITY granularity=core,scatter
set bind = --cpu_bind=core
#setenv KMP_AFFINITY granularity=thread,scatter
#set bind = --cpu_bind=thread
# compute number of MPI tasks
if (! ${?SLURM_NNODES} ) then
# not running in batch system. set some defaults so this script
# will work on a workstation
set SLURM_NNODES=1
endif
set NNODES = $SLURM_NNODES
if ($#argv >= 1) then
# override number of nodes with $1
set NNODES = $1
endif
set NMPI = $NNODES
@ NMPI *= $PER_NODE
if ( $NMPI > 393216 ) set NMPI = 393216 # max number of elements in NE=256 mesh
echo NODES = $NNODES
echo NMPI_PER_NODE = $PER_NODE
echo NTHREADS_PER_MPI = $OMP_NUM_THREADS
# note: in tests on 4K nodes,the --bcase and --compress options were much slower. DONT USE:
#set mpirun = "srun --bcast=/tmp/${SLURM_JOB_ID} --compress=lz4 -n $NMPI -N $NNODES -c $VC_PER_MPI $bind"
set mpirun = "srun -n $NMPI -N $NNODES -c $VC_PER_MPI $bind"
echo mpi commnand:
echo $mpirun
set input = $HOMME/test/benchmarks/NGGPS # input files for test case
set vdir = $HOMME/test/vcoord # vertical coordinate files
set bld = $wdir/bld
set run = $wdir/run-$NNODES-$OMP_NUM_THREADS-$$
set nlev = 128
set qsize = 10
#
# BUILD PREQX
# rm $bld/CMakeCache.txt to force re-configure
#
# default build is haswell. switch to knl:
module unload craype-haswell ; module load craype-mic-knl
mkdir -p $bld
cd $bld
set exe = $bld/src/preqx/preqx
set build = 1 # set to 1 to force build
# rm $bld/CMakeCache.txt # remove this file to force re-configure
if (! -f CMakeCache.txt) then
rm -rf CMakeFiles CMakeCache.txt src
echo "running CMAKE to configure the model"
cmake -C $MACH -DQSIZE_D=$qsize -DPREQX_PLEV=$nlev -DPREQX_NP=4 \
-DBUILD_HOMME_SWEQX=FALSE -DPREQX_USE_PIO=TRUE \
-DPREQX_USE_ENERGY=FALSE $HOMME
if ($status) exit
make -j4 clean
endif
if ( ! -f $exe) then
make -j4 preqx
if ($status) exit
endif
#
# Run the code
#
mkdir -p $run/movies
cd $run
# copy all vertical levels to run directory
rsync -a $vdir/sab?-128.ascii $run
# namelist has to be called input.nl for perf settings to be read
\rm -f input.nl
\cp -f $input/$namelist input.nl
date
$mpirun $exe < input.nl
date
if (-f HommeTime ) then
# save timings from run
set timingfile = $name.nodes${NNODES}.HommeTime
set summary = $name.nodes${NNODES}.summary
mv HommeTime $timingfile
# total run time (not counting init)
grep -a prim_main_loop $timingfile | head -1 | tee $summary
# breakdown dyn, tracers, remap. about 97% of the cost:
grep -a prim_step_dyn $timingfile | head -1 | tee -a $summary
grep -a PAT_remap $timingfile | head -1 | tee -a $summary
grep -a vertical_remap $timingfile | head -1 | tee -a $summary
echo "run parameters:" >> $summary
cat input.nl >> $summary
endif
| {
"pile_set_name": "Github"
} |
// MESSAGE HIGHRES_IMU PACKING
#define MAVLINK_MSG_ID_HIGHRES_IMU 105
MAVPACKED(
typedef struct __mavlink_highres_imu_t {
uint64_t time_usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
float xacc; /*< X acceleration (m/s^2)*/
float yacc; /*< Y acceleration (m/s^2)*/
float zacc; /*< Z acceleration (m/s^2)*/
float xgyro; /*< Angular speed around X axis (rad / sec)*/
float ygyro; /*< Angular speed around Y axis (rad / sec)*/
float zgyro; /*< Angular speed around Z axis (rad / sec)*/
float xmag; /*< X Magnetic field (Gauss)*/
float ymag; /*< Y Magnetic field (Gauss)*/
float zmag; /*< Z Magnetic field (Gauss)*/
float abs_pressure; /*< Absolute pressure in millibar*/
float diff_pressure; /*< Differential pressure in millibar*/
float pressure_alt; /*< Altitude calculated from pressure*/
float temperature; /*< Temperature in degrees celsius*/
uint16_t fields_updated; /*< Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature*/
}) mavlink_highres_imu_t;
#define MAVLINK_MSG_ID_HIGHRES_IMU_LEN 62
#define MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN 62
#define MAVLINK_MSG_ID_105_LEN 62
#define MAVLINK_MSG_ID_105_MIN_LEN 62
#define MAVLINK_MSG_ID_HIGHRES_IMU_CRC 93
#define MAVLINK_MSG_ID_105_CRC 93
#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
105, \
"HIGHRES_IMU", \
15, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
{ "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
{ "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
{ "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
{ "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
{ "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
{ "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
{ "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
{ "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
{ "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
{ "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
{ "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
{ "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
{ "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
{ "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
} \
}
#else
#define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
"HIGHRES_IMU", \
15, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
{ "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
{ "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
{ "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
{ "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
{ "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
{ "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
{ "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
{ "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
{ "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
{ "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
{ "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
{ "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
{ "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
{ "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
} \
}
#endif
/**
* @brief Pack a highres_imu message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param xacc X acceleration (m/s^2)
* @param yacc Y acceleration (m/s^2)
* @param zacc Z acceleration (m/s^2)
* @param xgyro Angular speed around X axis (rad / sec)
* @param ygyro Angular speed around Y axis (rad / sec)
* @param zgyro Angular speed around Z axis (rad / sec)
* @param xmag X Magnetic field (Gauss)
* @param ymag Y Magnetic field (Gauss)
* @param zmag Z Magnetic field (Gauss)
* @param abs_pressure Absolute pressure in millibar
* @param diff_pressure Differential pressure in millibar
* @param pressure_alt Altitude calculated from pressure
* @param temperature Temperature in degrees celsius
* @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#else
mavlink_highres_imu_t packet;
packet.time_usec = time_usec;
packet.xacc = xacc;
packet.yacc = yacc;
packet.zacc = zacc;
packet.xgyro = xgyro;
packet.ygyro = ygyro;
packet.zgyro = zgyro;
packet.xmag = xmag;
packet.ymag = ymag;
packet.zmag = zmag;
packet.abs_pressure = abs_pressure;
packet.diff_pressure = diff_pressure;
packet.pressure_alt = pressure_alt;
packet.temperature = temperature;
packet.fields_updated = fields_updated;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
}
/**
* @brief Pack a highres_imu message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param xacc X acceleration (m/s^2)
* @param yacc Y acceleration (m/s^2)
* @param zacc Z acceleration (m/s^2)
* @param xgyro Angular speed around X axis (rad / sec)
* @param ygyro Angular speed around Y axis (rad / sec)
* @param zgyro Angular speed around Z axis (rad / sec)
* @param xmag X Magnetic field (Gauss)
* @param ymag Y Magnetic field (Gauss)
* @param zmag Z Magnetic field (Gauss)
* @param abs_pressure Absolute pressure in millibar
* @param diff_pressure Differential pressure in millibar
* @param pressure_alt Altitude calculated from pressure
* @param temperature Temperature in degrees celsius
* @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_highres_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float xmag,float ymag,float zmag,float abs_pressure,float diff_pressure,float pressure_alt,float temperature,uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#else
mavlink_highres_imu_t packet;
packet.time_usec = time_usec;
packet.xacc = xacc;
packet.yacc = yacc;
packet.zacc = zacc;
packet.xgyro = xgyro;
packet.ygyro = ygyro;
packet.zgyro = zgyro;
packet.xmag = xmag;
packet.ymag = ymag;
packet.zmag = zmag;
packet.abs_pressure = abs_pressure;
packet.diff_pressure = diff_pressure;
packet.pressure_alt = pressure_alt;
packet.temperature = temperature;
packet.fields_updated = fields_updated;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
}
/**
* @brief Encode a highres_imu struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param highres_imu C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_highres_imu_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
{
return mavlink_msg_highres_imu_pack(system_id, component_id, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
}
/**
* @brief Encode a highres_imu struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param highres_imu C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_highres_imu_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
{
return mavlink_msg_highres_imu_pack_chan(system_id, component_id, chan, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
}
/**
* @brief Send a highres_imu message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param xacc X acceleration (m/s^2)
* @param yacc Y acceleration (m/s^2)
* @param zacc Z acceleration (m/s^2)
* @param xgyro Angular speed around X axis (rad / sec)
* @param ygyro Angular speed around Y axis (rad / sec)
* @param zgyro Angular speed around Z axis (rad / sec)
* @param xmag X Magnetic field (Gauss)
* @param ymag Y Magnetic field (Gauss)
* @param zmag Z Magnetic field (Gauss)
* @param abs_pressure Absolute pressure in millibar
* @param diff_pressure Differential pressure in millibar
* @param pressure_alt Altitude calculated from pressure
* @param temperature Temperature in degrees celsius
* @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_highres_imu_send(mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
mavlink_highres_imu_t packet;
packet.time_usec = time_usec;
packet.xacc = xacc;
packet.yacc = yacc;
packet.zacc = zacc;
packet.xgyro = xgyro;
packet.ygyro = ygyro;
packet.zgyro = zgyro;
packet.xmag = xmag;
packet.ymag = ymag;
packet.zmag = zmag;
packet.abs_pressure = abs_pressure;
packet.diff_pressure = diff_pressure;
packet.pressure_alt = pressure_alt;
packet.temperature = temperature;
packet.fields_updated = fields_updated;
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#endif
}
/**
* @brief Send a highres_imu message
* @param chan MAVLink channel to send the message
* @param struct The MAVLink struct to serialize
*/
static inline void mavlink_msg_highres_imu_send_struct(mavlink_channel_t chan, const mavlink_highres_imu_t* highres_imu)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
mavlink_msg_highres_imu_send(chan, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)highres_imu, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#endif
}
#if MAVLINK_MSG_ID_HIGHRES_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_highres_imu_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
mavlink_highres_imu_t *packet = (mavlink_highres_imu_t *)msgbuf;
packet->time_usec = time_usec;
packet->xacc = xacc;
packet->yacc = yacc;
packet->zacc = zacc;
packet->xgyro = xgyro;
packet->ygyro = ygyro;
packet->zgyro = zgyro;
packet->xmag = xmag;
packet->ymag = ymag;
packet->zmag = zmag;
packet->abs_pressure = abs_pressure;
packet->diff_pressure = diff_pressure;
packet->pressure_alt = pressure_alt;
packet->temperature = temperature;
packet->fields_updated = fields_updated;
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#endif
}
#endif
#endif
// MESSAGE HIGHRES_IMU UNPACKING
/**
* @brief Get field time_usec from highres_imu message
*
* @return Timestamp (microseconds, synced to UNIX time or since system boot)
*/
static inline uint64_t mavlink_msg_highres_imu_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field xacc from highres_imu message
*
* @return X acceleration (m/s^2)
*/
static inline float mavlink_msg_highres_imu_get_xacc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field yacc from highres_imu message
*
* @return Y acceleration (m/s^2)
*/
static inline float mavlink_msg_highres_imu_get_yacc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field zacc from highres_imu message
*
* @return Z acceleration (m/s^2)
*/
static inline float mavlink_msg_highres_imu_get_zacc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field xgyro from highres_imu message
*
* @return Angular speed around X axis (rad / sec)
*/
static inline float mavlink_msg_highres_imu_get_xgyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field ygyro from highres_imu message
*
* @return Angular speed around Y axis (rad / sec)
*/
static inline float mavlink_msg_highres_imu_get_ygyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field zgyro from highres_imu message
*
* @return Angular speed around Z axis (rad / sec)
*/
static inline float mavlink_msg_highres_imu_get_zgyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field xmag from highres_imu message
*
* @return X Magnetic field (Gauss)
*/
static inline float mavlink_msg_highres_imu_get_xmag(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Get field ymag from highres_imu message
*
* @return Y Magnetic field (Gauss)
*/
static inline float mavlink_msg_highres_imu_get_ymag(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 36);
}
/**
* @brief Get field zmag from highres_imu message
*
* @return Z Magnetic field (Gauss)
*/
static inline float mavlink_msg_highres_imu_get_zmag(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 40);
}
/**
* @brief Get field abs_pressure from highres_imu message
*
* @return Absolute pressure in millibar
*/
static inline float mavlink_msg_highres_imu_get_abs_pressure(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 44);
}
/**
* @brief Get field diff_pressure from highres_imu message
*
* @return Differential pressure in millibar
*/
static inline float mavlink_msg_highres_imu_get_diff_pressure(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 48);
}
/**
* @brief Get field pressure_alt from highres_imu message
*
* @return Altitude calculated from pressure
*/
static inline float mavlink_msg_highres_imu_get_pressure_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 52);
}
/**
* @brief Get field temperature from highres_imu message
*
* @return Temperature in degrees celsius
*/
static inline float mavlink_msg_highres_imu_get_temperature(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 56);
}
/**
* @brief Get field fields_updated from highres_imu message
*
* @return Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
*/
static inline uint16_t mavlink_msg_highres_imu_get_fields_updated(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 60);
}
/**
* @brief Decode a highres_imu message into a struct
*
* @param msg The message to decode
* @param highres_imu C-struct to decode the message contents into
*/
static inline void mavlink_msg_highres_imu_decode(const mavlink_message_t* msg, mavlink_highres_imu_t* highres_imu)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
highres_imu->time_usec = mavlink_msg_highres_imu_get_time_usec(msg);
highres_imu->xacc = mavlink_msg_highres_imu_get_xacc(msg);
highres_imu->yacc = mavlink_msg_highres_imu_get_yacc(msg);
highres_imu->zacc = mavlink_msg_highres_imu_get_zacc(msg);
highres_imu->xgyro = mavlink_msg_highres_imu_get_xgyro(msg);
highres_imu->ygyro = mavlink_msg_highres_imu_get_ygyro(msg);
highres_imu->zgyro = mavlink_msg_highres_imu_get_zgyro(msg);
highres_imu->xmag = mavlink_msg_highres_imu_get_xmag(msg);
highres_imu->ymag = mavlink_msg_highres_imu_get_ymag(msg);
highres_imu->zmag = mavlink_msg_highres_imu_get_zmag(msg);
highres_imu->abs_pressure = mavlink_msg_highres_imu_get_abs_pressure(msg);
highres_imu->diff_pressure = mavlink_msg_highres_imu_get_diff_pressure(msg);
highres_imu->pressure_alt = mavlink_msg_highres_imu_get_pressure_alt(msg);
highres_imu->temperature = mavlink_msg_highres_imu_get_temperature(msg);
highres_imu->fields_updated = mavlink_msg_highres_imu_get_fields_updated(msg);
#else
uint8_t len = msg->len < MAVLINK_MSG_ID_HIGHRES_IMU_LEN? msg->len : MAVLINK_MSG_ID_HIGHRES_IMU_LEN;
memset(highres_imu, 0, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
memcpy(highres_imu, _MAV_PAYLOAD(msg), len);
#endif
}
| {
"pile_set_name": "Github"
} |
// Licensed to Cloudera, Inc. under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. Cloudera, Inc. licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.cloudera.csd.validation.monitoring.constraints;
import com.cloudera.csd.descriptors.MetricDescriptor;
import com.cloudera.csd.validation.monitoring.AbstractMonitoringValidator;
import com.cloudera.csd.validation.monitoring.MonitoringValidationContext;
import com.cloudera.csd.validation.references.components.DescriptorPathImpl;
import com.google.common.base.Preconditions;
import java.util.List;
import javax.validation.ConstraintViolation;
import org.apache.commons.lang.StringUtils;
/**
* See getDescription for more details.
*/
public class ConsistentMetricDefinitionValidator
extends AbstractMonitoringValidator<MetricDescriptor> {
@Override
public String getDescription() {
return
"Validates that metric definitions are consistent if that metric is " +
"defined for multiple entity types.";
}
@Override
public <T> List<ConstraintViolation<T>> validate(
MonitoringValidationContext context,
MetricDescriptor metricDescriptor,
DescriptorPathImpl path) {
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(metricDescriptor);
Preconditions.checkNotNull(path);
MetricDescriptor definition =
context.metricsDefined.get(metricDescriptor.getName());
Preconditions.checkNotNull(definition);
if (!StringUtils.equals(
metricDescriptor.getLabel(),
definition.getLabel())) {
String msg = String.format(
"Inconsistent labels for metric '%s': '%s' and '%s'. ",
metricDescriptor.getName(),
metricDescriptor.getLabel(),
definition.getLabel());
return forViolation(
msg, metricDescriptor, metricDescriptor.getLabel(), path);
}
if (!StringUtils.equals(
metricDescriptor.getDescription(),
definition.getDescription())) {
String msg = String.format(
"Inconsistent descriptions for metric '%s': '%s' and '%s'. ",
metricDescriptor.getName(),
metricDescriptor.getDescription(),
definition.getDescription());
return forViolation(
msg, metricDescriptor, metricDescriptor.getDescription(), path);
}
if (!StringUtils.equals(
metricDescriptor.getNumeratorUnit(),
definition.getNumeratorUnit())) {
String msg = String.format(
"Inconsistent numerator units for metric '%s': '%s' and '%s'. ",
metricDescriptor.getName(),
metricDescriptor.getNumeratorUnit(),
definition.getNumeratorUnit());
return forViolation(
msg, metricDescriptor, metricDescriptor.getNumeratorUnit(), path);
}
if (!StringUtils.equals(
metricDescriptor.getDenominatorUnit(),
definition.getDenominatorUnit())) {
String msg = String.format(
"Inconsistent denominator units for metric '%s': '%s' and '%s'. ",
metricDescriptor.getName(),
metricDescriptor.getDenominatorUnit(),
definition.getDenominatorUnit());
return forViolation(
msg, metricDescriptor, metricDescriptor.getDenominatorUnit(), path);
}
if (metricDescriptor.isCounter() != definition.isCounter()) {
String msg = String.format(
"Inconsistent counter definitions for metric '%s': '%s' and '%s'. ",
metricDescriptor.getName(),
metricDescriptor.isCounter(),
definition.isCounter());
return forViolation(
msg, metricDescriptor, metricDescriptor.isCounter(), path);
}
if (!StringUtils.equals(
metricDescriptor.getWeightingMetricName(),
definition.getWeightingMetricName())) {
String msg = String.format(
"Inconsistent weighting metric names for metric '%s': '%s' and '%s'. ",
metricDescriptor.getName(),
metricDescriptor.getWeightingMetricName(),
definition.getWeightingMetricName());
return forViolation(
msg, metricDescriptor, metricDescriptor.getWeightingMetricName(), path);
}
return noViolations();
}
}
| {
"pile_set_name": "Github"
} |
// MESSAGE MISSION_CURRENT PACKING
#define MAVLINK_MSG_ID_MISSION_CURRENT 42
typedef struct __mavlink_mission_current_t
{
uint16_t seq; ///< Sequence
} mavlink_mission_current_t;
#define MAVLINK_MSG_ID_MISSION_CURRENT_LEN 2
#define MAVLINK_MSG_ID_42_LEN 2
#define MAVLINK_MSG_ID_MISSION_CURRENT_CRC 28
#define MAVLINK_MSG_ID_42_CRC 28
#define MAVLINK_MESSAGE_INFO_MISSION_CURRENT { \
"MISSION_CURRENT", \
1, \
{ { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_current_t, seq) }, \
} \
}
/**
* @brief Pack a mission_current message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param seq Sequence
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_mission_current_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint16_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN];
_mav_put_uint16_t(buf, 0, seq);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#else
mavlink_mission_current_t packet;
packet.seq = seq;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_MISSION_CURRENT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
}
/**
* @brief Pack a mission_current message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param seq Sequence
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_mission_current_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint16_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN];
_mav_put_uint16_t(buf, 0, seq);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#else
mavlink_mission_current_t packet;
packet.seq = seq;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_MISSION_CURRENT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
}
/**
* @brief Encode a mission_current struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param mission_current C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_mission_current_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current)
{
return mavlink_msg_mission_current_pack(system_id, component_id, msg, mission_current->seq);
}
/**
* @brief Encode a mission_current struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param mission_current C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_mission_current_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current)
{
return mavlink_msg_mission_current_pack_chan(system_id, component_id, chan, msg, mission_current->seq);
}
/**
* @brief Send a mission_current message
* @param chan MAVLink channel to send the message
*
* @param seq Sequence
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_mission_current_send(mavlink_channel_t chan, uint16_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN];
_mav_put_uint16_t(buf, 0, seq);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
#else
mavlink_mission_current_t packet;
packet.seq = seq;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_MISSION_CURRENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_mission_current_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint16_t(buf, 0, seq);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
#else
mavlink_mission_current_t *packet = (mavlink_mission_current_t *)msgbuf;
packet->seq = seq;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE MISSION_CURRENT UNPACKING
/**
* @brief Get field seq from mission_current message
*
* @return Sequence
*/
static inline uint16_t mavlink_msg_mission_current_get_seq(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 0);
}
/**
* @brief Decode a mission_current message into a struct
*
* @param msg The message to decode
* @param mission_current C-struct to decode the message contents into
*/
static inline void mavlink_msg_mission_current_decode(const mavlink_message_t* msg, mavlink_mission_current_t* mission_current)
{
#if MAVLINK_NEED_BYTE_SWAP
mission_current->seq = mavlink_msg_mission_current_get_seq(msg);
#else
memcpy(mission_current, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
#endif
}
| {
"pile_set_name": "Github"
} |
package com.wzgiceman.rxretrofitlibrary.retrofit_rx;
import android.app.Application;
/**
* 全局app
* Created by WZG on 2016/12/12.
*/
public class RxRetrofitApp {
private static Application application;
private static boolean debug;
public static void init(Application app){
setApplication(app);
setDebug(true);
}
public static void init(Application app,boolean debug){
setApplication(app);
setDebug(debug);
}
public static Application getApplication() {
return application;
}
private static void setApplication(Application application) {
RxRetrofitApp.application = application;
}
public static boolean isDebug() {
return debug;
}
public static void setDebug(boolean debug) {
RxRetrofitApp.debug = debug;
}
}
| {
"pile_set_name": "Github"
} |
<library:CustomApplication x:Class="CustomApplicationClass.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:library="clr-namespace:CustomApplicationClient;assembly=CustomApplicationClient"
StartupUri="MainWindow.xaml"/>
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
* Author(s): Vikas Manocha, <[email protected]> for STMicroelectronics.
*/
#include <linux/bitops.h>
#include <asm/armv7m.h>
#include <asm/armv7_mpu.h>
#include <asm/io.h>
#define V7M_MPU_CTRL_ENABLE BIT(0)
#define V7M_MPU_CTRL_DISABLE (0 << 0)
#define V7M_MPU_CTRL_HFNMIENA BIT(1)
#define V7M_MPU_CTRL_PRIVDEFENA BIT(2)
#define VALID_REGION BIT(4)
void disable_mpu(void)
{
writel(0, &V7M_MPU->ctrl);
}
void enable_mpu(void)
{
writel(V7M_MPU_CTRL_ENABLE | V7M_MPU_CTRL_PRIVDEFENA, &V7M_MPU->ctrl);
/* Make sure new mpu config is effective for next memory access */
dsb();
isb(); /* Make sure instruction stream sees it */
}
void mpu_config(struct mpu_region_config *reg_config)
{
uint32_t attr;
attr = get_attr_encoding(reg_config->mr_attr);
writel(reg_config->start_addr | VALID_REGION | reg_config->region_no,
&V7M_MPU->rbar);
writel(reg_config->xn << XN_SHIFT | reg_config->ap << AP_SHIFT | attr
| reg_config->reg_size << REGION_SIZE_SHIFT | ENABLE_REGION
, &V7M_MPU->rasr);
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright © 2002 Instituto Superior Técnico
*
* This file is part of FenixEdu Academic.
*
* FenixEdu Academic is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FenixEdu Academic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FenixEdu Academic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.fenixedu.academic.domain;
import java.util.Comparator;
import org.fenixedu.academic.domain.degreeStructure.EctsConversionTable;
import org.fenixedu.academic.domain.organizationalStructure.Unit;
import org.fenixedu.academic.domain.student.curriculum.ICurriculumEntry;
import org.fenixedu.academic.domain.thesis.Thesis;
import org.joda.time.DateTime;
public interface IEnrolment extends ICurriculumEntry {
static final public Comparator<IEnrolment> COMPARATOR_BY_APPROVEMENT_DATE = new Comparator<IEnrolment>() {
@Override
public int compare(IEnrolment o1, IEnrolment o2) {
if (o1.getApprovementDate() == null && o2.getApprovementDate() == null) {
return 0;
}
if (o1.getApprovementDate() == null) {
return -1;
}
if (o2.getApprovementDate() == null) {
return 1;
}
return o1.getApprovementDate().compareTo(o2.getApprovementDate());
}
};
@Override
String getExternalId();
/**
* @deprecated
* Use {@link ICurriculumEntry#getGrade()} instead.
* Code should not assume that final grades are integers.
* This method will be removed on next major release
*
*
*/
@Deprecated
Integer getFinalGrade();
String getDescription();
Double getEctsCredits();
Grade getEctsGrade(StudentCurricularPlan scp, DateTime processingDate);
EctsConversionTable getEctsConversionTable(StudentCurricularPlan scp, DateTime processingDate);
boolean isAnual();
String getEnrolmentTypeName();
Double getWeigth();
Unit getAcademicUnit();
boolean isApproved();
boolean isEnroled();
boolean isExternalEnrolment();
boolean isEnrolment();
/**
* Obtains the last valid thesis for this enrolment. The returned thesis may
* not be evaluated. You can used {@link Thesis#isFinalThesis()} and {@link Thesis#isFinalAndApprovedThesis()} to distinguish
* between a thesis
* currently in evaluation and a final thesis.
*
* @return the last valid thesis for this enrolment
*/
Thesis getThesis();
void delete();
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2019-2020, somewhere ([email protected]).
* <p>
* Licensed under the GNU Lesser General Public License 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.albedo.java.modules.tool.repository;
import com.albedo.java.common.persistence.repository.BaseRepository;
import com.albedo.java.modules.tool.domain.EmailConfig;
/**
* @author somewhere
* @since 2019/2/1
*/
public interface EmailConfigRepository extends BaseRepository<EmailConfig> {
}
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 15cc9c62605319f4a9b20b15918913fa
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
| {
"pile_set_name": "Github"
} |
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::sigFpe
Description
Set up trapping for floating point exceptions (signal FPE).
Controlled by two env vars:
\param FOAM_SIGFPE \n
exception trapping
\param FOAM_SETNAN \n
initialization of all malloced memory to NaN. If FOAM_SIGFPE
also set, this will cause usage of uninitialized scalars to trigger
an abort.
SourceFiles
sigFpe.C
\*---------------------------------------------------------------------------*/
#ifndef sigFpe_H
#define sigFpe_H
#include <signal.h>
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
# define LINUX
#endif
#if defined(LINUX) && defined(__GNUC__)
# define LINUX_GNUC
#endif
#include "UList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class sigFpe Declaration
\*---------------------------------------------------------------------------*/
class sigFpe
{
// Private data
//- Saved old signal trapping setting
static struct sigaction oldAction_;
# ifdef LINUX
//- Saved old malloc
static void *(*oldMallocHook_)(size_t, const void *);
//- NaN malloc function. From malloc_hook manpage.
static void* nanMallocHook_(size_t size, const void *caller);
# endif
// Static data members
# ifdef LINUX_GNUC
//- Handler for caught signals
static void sigHandler(int);
# endif
public:
// Constructors
//- Construct null
sigFpe();
//- Destructor
~sigFpe();
// Member functions
//- Activate SIGFPE signal handler when FOAM_SIGFPE is %set
// Fill memory with NaN when FOAM_SETNAN is %set
void set(const bool verbose);
//- Helper: fill block of data with NaN
static void fillSignallingNan(UList<scalar>&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppActivateAction</key>
<string>Activate</string>
<key>AppHideAction</key>
<string>Hide</string>
<key>AppHideOthersAction</key>
<string>Hide Others</string>
<key>AppLaunchAction</key>
<string>Launch</string>
<key>AppLaunchAgainAction</key>
<string>Launch Another Copy</string>
<key>AppOpenFileAction</key>
<string>Open File...</string>
<key>AppQuitOthersAction</key>
<string>Quit Others</string>
<key>AppQuitAction</key>
<string>Quit</string>
<key>AppRelaunchAction</key>
<string>Relaunch</string>
<key>AppReopenAction</key>
<string>Open</string>
<key>AppRootLaunchAction</key>
<string>Launch as Root</string>
<key>AppShowHideAction</key>
<string>Toggle Application</string>
<key>AppleScriptOpenFilesAction</key>
<string>Open File...</string>
<key>AppleScriptProcessTextAction</key>
<string>Process Text...</string>
<key>AppleScriptRunAction</key>
<string>Run</string>
<key>AppleScriptRunTextAction</key>
<string>Run as AppleScript</string>
<key>ContactEditAction</key>
<string>Edit</string>
<key>ContactEmailAction</key>
<string>Email</string>
<key>ContactIMAction</key>
<string>IM Person</string>
<key>ContactSendItemEmailAction</key>
<string>Email Item...</string>
<key>ContactSendItemIMAction</key>
<string>IM text...</string>
<key>ContactSendTextEmailAction</key>
<string>Send Text...</string>
<key>ContactShowAction</key>
<string>Show</string>
<key>DiskEjectAction</key>
<string>Eject</string>
<key>DiskForceEjectAction</key>
<string>Force Eject</string>
<key>FileCompressAction</key>
<string>Compress</string>
<key>FileCopyToAction</key>
<string>Copy To...</string>
<key>FileDecompressAction</key>
<string>Decompress</string>
<key>FileDeleteAction</key>
<string>Delete (Erase)</string>
<key>FileGetInfoAction</key>
<string>Get Info</string>
<key>FileGetPathAction</key>
<string>Get Path</string>
<key>FileGetPosixPathAction</key>
<string>Get Absolute (POSIX) Path</string>
<key>FileGetURLAction</key>
<string>Get File URL</string>
<key>FileGetHFSPathAction</key>
<string>Get File Location</string>
<key>FileMakeAliasInAction</key>
<string>Make Alias In...</string>
<key>FileMakeHardLinkInAction</key>
<string>Make Hard Link In...</string>
<key>FileMakeLinkInAction</key>
<string>Make Link In...</string>
<key>FileMoveToAction</key>
<string>Move To...</string>
<key>FileOpenAction</key>
<string>Open</string>
<key>FileOpenWithAction</key>
<string>Open With...</string>
<key>FileAlwaysOpenTypeWithAction</key>
<string>Always Open Type With...</string>
<key>FileRenameAction</key>
<string>Rename...</string>
<key>FileRevealAction</key>
<string>Reveal</string>
<key>FileToTrashAction</key>
<string>Move to Trash</string>
<key>ItemSendToContactEmailAction</key>
<string>Email To...</string>
<key>ItemSendToContactIMAction</key>
<string>IM To Person...</string>
<key>PasteboardCopyAction</key>
<string>Copy to Clipboard</string>
<key>PasteboardPasteAction</key>
<string>Paste</string>
<key>PasteboardPasteActionAsPlainText</key>
<string>Paste as Plain Text</string>
<key>ProcessKillAction</key>
<string>Force Quit (Kill)</string>
<key>ProcessLowerPriorityAction</key>
<string>Lower Priority</string>
<key>ProcessRaisePriorityAction</key>
<string>Raise Priority</string>
<key>ProcessResumeAction</key>
<string>Continue Execution (Resume)</string>
<key>ProcessSuspendAction</key>
<string>Pause Execution (Suspend)</string>
<key>QSObjectAssignMnemonic</key>
<string>Assign Abbreviation...</string>
<key>QSObjectSelectAction</key>
<string>Select in Command Window</string>
<key>QSAIMSMSAction</key>
<string>Send SMS (AIM/iChat)</string>
<key>QSAirPortNetworkSelectAction</key>
<string>Switch Airport</string>
<key>QSCLExecuteAction</key>
<string>Run</string>
<key>QSCLExecuteTextAction</key>
<string>Run Command in Shell</string>
<key>QSCLExecuteShellCommandAction</key>
<string>Run Command in Shell</string>
<key>QSCLExecuteWithArgsAction</key>
<string>Run [...]</string>
<key>QSCLTermExecuteTextAction</key>
<string>Run a Text Command in Terminal</string>
<key>QSCLTermExecuteShellCommandAction</key>
<string>Run a Text Command in Terminal</string>
<key>QSCLTermExecuteWithArgsAction</key>
<string>Run in Terminal [...]</string>
<key>QSCLTermShowDirectoryAction</key>
<string>Go To Directory in Terminal</string>
<key>QSCLTermShowManPageAction</key>
<string>Show Man Page</string>
<key>QSCatalogEntryRescanAction</key>
<string>Rescan Catalog Entry</string>
<key>QSCatalogEntryShowAction</key>
<string>Show Entry in Catalog</string>
<key>QSCommandSaveAction</key>
<string>Save Command to File...</string>
<key>QSCommandAddTriggerAction</key>
<string>Add Trigger</string>
<key>QSCommandExecuteAction</key>
<string>Run</string>
<key>QSCommandExecuteAfterDelayAction</key>
<string>Run after Delay...</string>
<key>QSComposeEmailItemAction</key>
<string>Email Item... (Compose)</string>
<key>QSCommandExecuteAtTimeAction</key>
<string>Run at Time...</string>
<key>QSComposeEmailItemReverseAction</key>
<string>Email To... (Compose)</string>
<key>QSCreateFileAction</key>
<string>Create File [...]</string>
<key>QSCreateFileTemplate</key>
<string>Make New...</string>
<key>QSDialNumberAction</key>
<string>Dial</string>
<key>QSEditAction</key>
<string>Edit</string>
<key>QSEmailAction</key>
<string>Email</string>
<key>QSEmailItemAction</key>
<string>Email Item... (Send)</string>
<key>QSEmailItemReverseAction</key>
<string>Email To... (Send)</string>
<key>QSHFSLockAction</key>
<string>Lock</string>
<key>QSHFSMakeInvisibleAction</key>
<string>Make Invisible</string>
<key>QSHFSMakeVisibleAction</key>
<string>Make Visible</string>
<key>QSHFSUnlockAction</key>
<string>Unlock</string>
<key>QSNewFolderAction</key>
<string>New Folder...</string>
<key>QSLargeTypeAction</key>
<string>Large Type</string>
<key>QSLoginItemAddAction</key>
<string>Open at Login</string>
<key>QSLoginItemRemoveAction</key>
<string>Do Not Open at Login</string>
<key>QSNUTDContactShowAction</key>
<string>Show Contact</string>
<key>QSNetworkLocationSelectAction</key>
<string>Switch to Location</string>
<key>QSObjCSendMessageAction</key>
<string>Run</string>
<key>QSObjectSearchChildrenAction</key>
<string>Search Contents</string>
<key>QSObjectShowChildMenu</key>
<string>Show Contents Menu</string>
<key>QSObjectShowMenu</key>
<string>Show Menu</string>
<key>QSObjectShowActionMenu</key>
<string>Show Action Menu</string>
<key>QSObjectShowChildrenAction</key>
<string>Show Contents</string>
<key>QSObjectShowSourceAction</key>
<string>Show Source in Catalog</string>
<key>QSPutOnShelfAction</key>
<string>Put on Shelf</string>
<key>QSShelfShowAction</key>
<string>Show</string>
<key>QSShellScriptRunAction</key>
<string>Run [...]</string>
<key>QSTextShowDialogAction</key>
<string>Display Dialog</string>
<key>QSTextSpeakAction</key>
<string>Speak Text (Say)</string>
<key>QSTextAppendAction</key>
<string>Append Text To...</string>
<key>QSTextDiffAction</key>
<string>Differences From...</string>
<key>QSTextPrependAction</key>
<string>Prepend Text To...</string>
<key>QSTextTypeAction</key>
<string>Type Text</string>
<key>QSUserSwitchAction</key>
<string>Switch to User</string>
<key>QSiPhotoAlbumShowAction</key>
<string>Show Album</string>
<key>QSiPhotoAlbumSlideShowAction</key>
<string>Play Slide Show</string>
<key>QSiTunesAppendItemAction</key>
<string>Queue</string>
<key>QSiTunesPlayItemAction</key>
<string>Play</string>
<key>ShellScriptRunAction</key>
<string>Run Shell Script</string>
<key>URLEmailAction</key>
<string>Open E-mail URL</string>
<key>URLFindWithAction</key>
<string>Find on Site...</string>
<key>URLJSAction</key>
<string>Run Javascript</string>
<key>URLOpenAction</key>
<string>Open URL</string>
<key>URLOpenActionInBackground</key>
<string>Open URL in Background</string>
<key>URLOpenWithAction</key>
<string>Open URL With...</string>
<key>URLSearchAction</key>
<string>Search</string>
<key>URLSearchForAction</key>
<string>Search For...</string>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
(function () {
'use strict';
angular
.module('<%= scriptAppName %>.listImage', ['<%= scriptAppName %>.lodash'])
.factory('AlphabetColor', AlphabetColor)
.directive('listImage', listImage);
AlphabetColor.$inject = ['_'];
function AlphabetColor(_) {
var colors = [
'#f9a43e',
'#59a2be',
'#67bf74',
'#f58559',
'#e4c62e',
'#f16364',
'#2093cd',
'#ad62a7'
];
var numberOfColors = colors.length;
return getColor;
function hashCode(str) {
var hash = 0,
length = str.length,
i, chr;
if (length === 0) {
return hash;
}
for (i = 0; i < length; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
function getColor(string) {
var color = Math.abs(hashCode(string.charAt(0))) % numberOfColors;
return colors[color];
}
}
listImage.$inject = ['$mdTheming', 'AlphabetColor'];
function listImage($mdTheming, AlphabetColor) {
var templateString = [
'<div ng-style="{background: bgColor}">',
'<span>{{::firstLetter}}</span>',
'</div>'].join('');
return {
restrict: 'E',
template: templateString,
link: function ($scope, element, attrs) {
$mdTheming(element);
$scope.firstLetter = attrs.string.charAt(0);
$scope.bgColor = AlphabetColor($scope.firstLetter);
}
};
}
})();
| {
"pile_set_name": "Github"
} |
-- Andreas, 2017-11-12, issue #2803
-- Problem: names of hidden variable patterns
-- can get lost during case splitting.
-- They actually get lost already during lhs type checking,
-- but it is noticed only when printed back to the user
-- during case splitting.
-- {-# OPTIONS -v tc.lhs:40 #-}
record HFun (A B : Set) : Set where
field apply : {a : A} → B
postulate A : Set
test : HFun A (A → A)
HFun.apply test {β} = {!!} -- C-c C-c
-- YIELDS:
-- HFun.apply test {a} x = ?
-- EXPECTED:
-- HFun.apply test {β} x = ?
open import Agda.Builtin.Bool
test' : {a b : Bool} → Bool → Bool
test' {b = z} x = {!x!}
-- Splitting on x should yield
-- test {b = z} false = {!!}
-- test {b = z} true = {!!}
| {
"pile_set_name": "Github"
} |
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_FOTG210_H
#define __LINUX_FOTG210_H
#include <linux/usb/ehci-dbgp.h>
/* definitions used for the EHCI driver */
/*
* __hc32 and __hc16 are "Host Controller" types, they may be equivalent to
* __leXX (normally) or __beXX (given FOTG210_BIG_ENDIAN_DESC), depending on
* the host controller implementation.
*
* To facilitate the strongest possible byte-order checking from "sparse"
* and so on, we use __leXX unless that's not practical.
*/
#define __hc32 __le32
#define __hc16 __le16
/* statistics can be kept for tuning/monitoring */
struct fotg210_stats {
/* irq usage */
unsigned long normal;
unsigned long error;
unsigned long iaa;
unsigned long lost_iaa;
/* termination of urbs from core */
unsigned long complete;
unsigned long unlink;
};
/* fotg210_hcd->lock guards shared data against other CPUs:
* fotg210_hcd: async, unlink, periodic (and shadow), ...
* usb_host_endpoint: hcpriv
* fotg210_qh: qh_next, qtd_list
* fotg210_qtd: qtd_list
*
* Also, hold this lock when talking to HC registers or
* when updating hw_* fields in shared qh/qtd/... structures.
*/
#define FOTG210_MAX_ROOT_PORTS 1 /* see HCS_N_PORTS */
/*
* fotg210_rh_state values of FOTG210_RH_RUNNING or above mean that the
* controller may be doing DMA. Lower values mean there's no DMA.
*/
enum fotg210_rh_state {
FOTG210_RH_HALTED,
FOTG210_RH_SUSPENDED,
FOTG210_RH_RUNNING,
FOTG210_RH_STOPPING
};
/*
* Timer events, ordered by increasing delay length.
* Always update event_delays_ns[] and event_handlers[] (defined in
* ehci-timer.c) in parallel with this list.
*/
enum fotg210_hrtimer_event {
FOTG210_HRTIMER_POLL_ASS, /* Poll for async schedule off */
FOTG210_HRTIMER_POLL_PSS, /* Poll for periodic schedule off */
FOTG210_HRTIMER_POLL_DEAD, /* Wait for dead controller to stop */
FOTG210_HRTIMER_UNLINK_INTR, /* Wait for interrupt QH unlink */
FOTG210_HRTIMER_FREE_ITDS, /* Wait for unused iTDs and siTDs */
FOTG210_HRTIMER_ASYNC_UNLINKS, /* Unlink empty async QHs */
FOTG210_HRTIMER_IAA_WATCHDOG, /* Handle lost IAA interrupts */
FOTG210_HRTIMER_DISABLE_PERIODIC, /* Wait to disable periodic sched */
FOTG210_HRTIMER_DISABLE_ASYNC, /* Wait to disable async sched */
FOTG210_HRTIMER_IO_WATCHDOG, /* Check for missing IRQs */
FOTG210_HRTIMER_NUM_EVENTS /* Must come last */
};
#define FOTG210_HRTIMER_NO_EVENT 99
struct fotg210_hcd { /* one per controller */
/* timing support */
enum fotg210_hrtimer_event next_hrtimer_event;
unsigned enabled_hrtimer_events;
ktime_t hr_timeouts[FOTG210_HRTIMER_NUM_EVENTS];
struct hrtimer hrtimer;
int PSS_poll_count;
int ASS_poll_count;
int died_poll_count;
/* glue to PCI and HCD framework */
struct fotg210_caps __iomem *caps;
struct fotg210_regs __iomem *regs;
struct ehci_dbg_port __iomem *debug;
__u32 hcs_params; /* cached register copy */
spinlock_t lock;
enum fotg210_rh_state rh_state;
/* general schedule support */
bool scanning:1;
bool need_rescan:1;
bool intr_unlinking:1;
bool async_unlinking:1;
bool shutdown:1;
struct fotg210_qh *qh_scan_next;
/* async schedule support */
struct fotg210_qh *async;
struct fotg210_qh *dummy; /* For AMD quirk use */
struct fotg210_qh *async_unlink;
struct fotg210_qh *async_unlink_last;
struct fotg210_qh *async_iaa;
unsigned async_unlink_cycle;
unsigned async_count; /* async activity count */
/* periodic schedule support */
#define DEFAULT_I_TDPS 1024 /* some HCs can do less */
unsigned periodic_size;
__hc32 *periodic; /* hw periodic table */
dma_addr_t periodic_dma;
struct list_head intr_qh_list;
unsigned i_thresh; /* uframes HC might cache */
union fotg210_shadow *pshadow; /* mirror hw periodic table */
struct fotg210_qh *intr_unlink;
struct fotg210_qh *intr_unlink_last;
unsigned intr_unlink_cycle;
unsigned now_frame; /* frame from HC hardware */
unsigned next_frame; /* scan periodic, start here */
unsigned intr_count; /* intr activity count */
unsigned isoc_count; /* isoc activity count */
unsigned periodic_count; /* periodic activity count */
/* max periodic time per uframe */
unsigned uframe_periodic_max;
/* list of itds completed while now_frame was still active */
struct list_head cached_itd_list;
struct fotg210_itd *last_itd_to_free;
/* per root hub port */
unsigned long reset_done[FOTG210_MAX_ROOT_PORTS];
/* bit vectors (one bit per port)
* which ports were already suspended at the start of a bus suspend
*/
unsigned long bus_suspended;
/* which ports are edicated to the companion controller */
unsigned long companion_ports;
/* which ports are owned by the companion during a bus suspend */
unsigned long owned_ports;
/* which ports have the change-suspend feature turned on */
unsigned long port_c_suspend;
/* which ports are suspended */
unsigned long suspended_ports;
/* which ports have started to resume */
unsigned long resuming_ports;
/* per-HC memory pools (could be per-bus, but ...) */
struct dma_pool *qh_pool; /* qh per active urb */
struct dma_pool *qtd_pool; /* one or more per qh */
struct dma_pool *itd_pool; /* itd per iso urb */
unsigned random_frame;
unsigned long next_statechange;
ktime_t last_periodic_enable;
u32 command;
/* SILICON QUIRKS */
unsigned need_io_watchdog:1;
unsigned fs_i_thresh:1; /* Intel iso scheduling */
u8 sbrn; /* packed release number */
/* irq statistics */
#ifdef FOTG210_STATS
struct fotg210_stats stats;
# define INCR(x) ((x)++)
#else
# define INCR(x) do {} while (0)
#endif
/* silicon clock */
struct clk *pclk;
/* debug files */
struct dentry *debug_dir;
};
/* convert between an HCD pointer and the corresponding FOTG210_HCD */
static inline struct fotg210_hcd *hcd_to_fotg210(struct usb_hcd *hcd)
{
return (struct fotg210_hcd *)(hcd->hcd_priv);
}
static inline struct usb_hcd *fotg210_to_hcd(struct fotg210_hcd *fotg210)
{
return container_of((void *) fotg210, struct usb_hcd, hcd_priv);
}
/*-------------------------------------------------------------------------*/
/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
/* Section 2.2 Host Controller Capability Registers */
struct fotg210_caps {
/* these fields are specified as 8 and 16 bit registers,
* but some hosts can't perform 8 or 16 bit PCI accesses.
* some hosts treat caplength and hciversion as parts of a 32-bit
* register, others treat them as two separate registers, this
* affects the memory map for big endian controllers.
*/
u32 hc_capbase;
#define HC_LENGTH(fotg210, p) (0x00ff&((p) >> /* bits 7:0 / offset 00h */ \
(fotg210_big_endian_capbase(fotg210) ? 24 : 0)))
#define HC_VERSION(fotg210, p) (0xffff&((p) >> /* bits 31:16 / offset 02h */ \
(fotg210_big_endian_capbase(fotg210) ? 0 : 16)))
u32 hcs_params; /* HCSPARAMS - offset 0x4 */
#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
u32 hcc_params; /* HCCPARAMS - offset 0x8 */
#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
u8 portroute[8]; /* nibbles for routing - offset 0xC */
};
/* Section 2.3 Host Controller Operational Registers */
struct fotg210_regs {
/* USBCMD: offset 0x00 */
u32 command;
/* EHCI 1.1 addendum */
/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
#define CMD_PARK (1<<11) /* enable "park" on async qh */
#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
#define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */
#define CMD_ASE (1<<5) /* async schedule enable */
#define CMD_PSE (1<<4) /* periodic schedule enable */
/* 3:2 is periodic frame list size */
#define CMD_RESET (1<<1) /* reset HC not bus */
#define CMD_RUN (1<<0) /* start/stop HC */
/* USBSTS: offset 0x04 */
u32 status;
#define STS_ASS (1<<15) /* Async Schedule Status */
#define STS_PSS (1<<14) /* Periodic Schedule Status */
#define STS_RECL (1<<13) /* Reclamation */
#define STS_HALT (1<<12) /* Not running (any reason) */
/* some bits reserved */
/* these STS_* flags are also intr_enable bits (USBINTR) */
#define STS_IAA (1<<5) /* Interrupted on async advance */
#define STS_FATAL (1<<4) /* such as some PCI access errors */
#define STS_FLR (1<<3) /* frame list rolled over */
#define STS_PCD (1<<2) /* port change detect */
#define STS_ERR (1<<1) /* "error" completion (overflow, ...) */
#define STS_INT (1<<0) /* "normal" completion (short, ...) */
/* USBINTR: offset 0x08 */
u32 intr_enable;
/* FRINDEX: offset 0x0C */
u32 frame_index; /* current microframe number */
/* CTRLDSSEGMENT: offset 0x10 */
u32 segment; /* address bits 63:32 if needed */
/* PERIODICLISTBASE: offset 0x14 */
u32 frame_list; /* points to periodic list */
/* ASYNCLISTADDR: offset 0x18 */
u32 async_next; /* address of next async queue head */
u32 reserved1;
/* PORTSC: offset 0x20 */
u32 port_status;
/* 31:23 reserved */
#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
#define PORT_RESET (1<<8) /* reset port */
#define PORT_SUSPEND (1<<7) /* suspend port */
#define PORT_RESUME (1<<6) /* resume it */
#define PORT_PEC (1<<3) /* port enable change */
#define PORT_PE (1<<2) /* port enable */
#define PORT_CSC (1<<1) /* connect status change */
#define PORT_CONNECT (1<<0) /* device connected */
#define PORT_RWC_BITS (PORT_CSC | PORT_PEC)
u32 reserved2[19];
/* OTGCSR: offet 0x70 */
u32 otgcsr;
#define OTGCSR_HOST_SPD_TYP (3 << 22)
#define OTGCSR_A_BUS_DROP (1 << 5)
#define OTGCSR_A_BUS_REQ (1 << 4)
/* OTGISR: offset 0x74 */
u32 otgisr;
#define OTGISR_OVC (1 << 10)
u32 reserved3[15];
/* GMIR: offset 0xB4 */
u32 gmir;
#define GMIR_INT_POLARITY (1 << 3) /*Active High*/
#define GMIR_MHC_INT (1 << 2)
#define GMIR_MOTG_INT (1 << 1)
#define GMIR_MDEV_INT (1 << 0)
};
/*-------------------------------------------------------------------------*/
#define QTD_NEXT(fotg210, dma) cpu_to_hc32(fotg210, (u32)dma)
/*
* EHCI Specification 0.95 Section 3.5
* QTD: describe data transfer components (buffer, direction, ...)
* See Fig 3-6 "Queue Element Transfer Descriptor Block Diagram".
*
* These are associated only with "QH" (Queue Head) structures,
* used with control, bulk, and interrupt transfers.
*/
struct fotg210_qtd {
/* first part defined by EHCI spec */
__hc32 hw_next; /* see EHCI 3.5.1 */
__hc32 hw_alt_next; /* see EHCI 3.5.2 */
__hc32 hw_token; /* see EHCI 3.5.3 */
#define QTD_TOGGLE (1 << 31) /* data toggle */
#define QTD_LENGTH(tok) (((tok)>>16) & 0x7fff)
#define QTD_IOC (1 << 15) /* interrupt on complete */
#define QTD_CERR(tok) (((tok)>>10) & 0x3)
#define QTD_PID(tok) (((tok)>>8) & 0x3)
#define QTD_STS_ACTIVE (1 << 7) /* HC may execute this */
#define QTD_STS_HALT (1 << 6) /* halted on error */
#define QTD_STS_DBE (1 << 5) /* data buffer error (in HC) */
#define QTD_STS_BABBLE (1 << 4) /* device was babbling (qtd halted) */
#define QTD_STS_XACT (1 << 3) /* device gave illegal response */
#define QTD_STS_MMF (1 << 2) /* incomplete split transaction */
#define QTD_STS_STS (1 << 1) /* split transaction state */
#define QTD_STS_PING (1 << 0) /* issue PING? */
#define ACTIVE_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_ACTIVE)
#define HALT_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_HALT)
#define STATUS_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_STS)
__hc32 hw_buf[5]; /* see EHCI 3.5.4 */
__hc32 hw_buf_hi[5]; /* Appendix B */
/* the rest is HCD-private */
dma_addr_t qtd_dma; /* qtd address */
struct list_head qtd_list; /* sw qtd list */
struct urb *urb; /* qtd's urb */
size_t length; /* length of buffer */
} __aligned(32);
/* mask NakCnt+T in qh->hw_alt_next */
#define QTD_MASK(fotg210) cpu_to_hc32(fotg210, ~0x1f)
#define IS_SHORT_READ(token) (QTD_LENGTH(token) != 0 && QTD_PID(token) == 1)
/*-------------------------------------------------------------------------*/
/* type tag from {qh,itd,fstn}->hw_next */
#define Q_NEXT_TYPE(fotg210, dma) ((dma) & cpu_to_hc32(fotg210, 3 << 1))
/*
* Now the following defines are not converted using the
* cpu_to_le32() macro anymore, since we have to support
* "dynamic" switching between be and le support, so that the driver
* can be used on one system with SoC EHCI controller using big-endian
* descriptors as well as a normal little-endian PCI EHCI controller.
*/
/* values for that type tag */
#define Q_TYPE_ITD (0 << 1)
#define Q_TYPE_QH (1 << 1)
#define Q_TYPE_SITD (2 << 1)
#define Q_TYPE_FSTN (3 << 1)
/* next async queue entry, or pointer to interrupt/periodic QH */
#define QH_NEXT(fotg210, dma) \
(cpu_to_hc32(fotg210, (((u32)dma)&~0x01f)|Q_TYPE_QH))
/* for periodic/async schedules and qtd lists, mark end of list */
#define FOTG210_LIST_END(fotg210) \
cpu_to_hc32(fotg210, 1) /* "null pointer" to hw */
/*
* Entries in periodic shadow table are pointers to one of four kinds
* of data structure. That's dictated by the hardware; a type tag is
* encoded in the low bits of the hardware's periodic schedule. Use
* Q_NEXT_TYPE to get the tag.
*
* For entries in the async schedule, the type tag always says "qh".
*/
union fotg210_shadow {
struct fotg210_qh *qh; /* Q_TYPE_QH */
struct fotg210_itd *itd; /* Q_TYPE_ITD */
struct fotg210_fstn *fstn; /* Q_TYPE_FSTN */
__hc32 *hw_next; /* (all types) */
void *ptr;
};
/*-------------------------------------------------------------------------*/
/*
* EHCI Specification 0.95 Section 3.6
* QH: describes control/bulk/interrupt endpoints
* See Fig 3-7 "Queue Head Structure Layout".
*
* These appear in both the async and (for interrupt) periodic schedules.
*/
/* first part defined by EHCI spec */
struct fotg210_qh_hw {
__hc32 hw_next; /* see EHCI 3.6.1 */
__hc32 hw_info1; /* see EHCI 3.6.2 */
#define QH_CONTROL_EP (1 << 27) /* FS/LS control endpoint */
#define QH_HEAD (1 << 15) /* Head of async reclamation list */
#define QH_TOGGLE_CTL (1 << 14) /* Data toggle control */
#define QH_HIGH_SPEED (2 << 12) /* Endpoint speed */
#define QH_LOW_SPEED (1 << 12)
#define QH_FULL_SPEED (0 << 12)
#define QH_INACTIVATE (1 << 7) /* Inactivate on next transaction */
__hc32 hw_info2; /* see EHCI 3.6.2 */
#define QH_SMASK 0x000000ff
#define QH_CMASK 0x0000ff00
#define QH_HUBADDR 0x007f0000
#define QH_HUBPORT 0x3f800000
#define QH_MULT 0xc0000000
__hc32 hw_current; /* qtd list - see EHCI 3.6.4 */
/* qtd overlay (hardware parts of a struct fotg210_qtd) */
__hc32 hw_qtd_next;
__hc32 hw_alt_next;
__hc32 hw_token;
__hc32 hw_buf[5];
__hc32 hw_buf_hi[5];
} __aligned(32);
struct fotg210_qh {
struct fotg210_qh_hw *hw; /* Must come first */
/* the rest is HCD-private */
dma_addr_t qh_dma; /* address of qh */
union fotg210_shadow qh_next; /* ptr to qh; or periodic */
struct list_head qtd_list; /* sw qtd list */
struct list_head intr_node; /* list of intr QHs */
struct fotg210_qtd *dummy;
struct fotg210_qh *unlink_next; /* next on unlink list */
unsigned unlink_cycle;
u8 needs_rescan; /* Dequeue during giveback */
u8 qh_state;
#define QH_STATE_LINKED 1 /* HC sees this */
#define QH_STATE_UNLINK 2 /* HC may still see this */
#define QH_STATE_IDLE 3 /* HC doesn't see this */
#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on unlink q */
#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */
u8 xacterrs; /* XactErr retry counter */
#define QH_XACTERR_MAX 32 /* XactErr retry limit */
/* periodic schedule info */
u8 usecs; /* intr bandwidth */
u8 gap_uf; /* uframes split/csplit gap */
u8 c_usecs; /* ... split completion bw */
u16 tt_usecs; /* tt downstream bandwidth */
unsigned short period; /* polling interval */
unsigned short start; /* where polling starts */
#define NO_FRAME ((unsigned short)~0) /* pick new start */
struct usb_device *dev; /* access to TT */
unsigned is_out:1; /* bulk or intr OUT */
unsigned clearing_tt:1; /* Clear-TT-Buf in progress */
};
/*-------------------------------------------------------------------------*/
/* description of one iso transaction (up to 3 KB data if highspeed) */
struct fotg210_iso_packet {
/* These will be copied to iTD when scheduling */
u64 bufp; /* itd->hw_bufp{,_hi}[pg] |= */
__hc32 transaction; /* itd->hw_transaction[i] |= */
u8 cross; /* buf crosses pages */
/* for full speed OUT splits */
u32 buf1;
};
/* temporary schedule data for packets from iso urbs (both speeds)
* each packet is one logical usb transaction to the device (not TT),
* beginning at stream->next_uframe
*/
struct fotg210_iso_sched {
struct list_head td_list;
unsigned span;
struct fotg210_iso_packet packet[0];
};
/*
* fotg210_iso_stream - groups all (s)itds for this endpoint.
* acts like a qh would, if EHCI had them for ISO.
*/
struct fotg210_iso_stream {
/* first field matches fotg210_hq, but is NULL */
struct fotg210_qh_hw *hw;
u8 bEndpointAddress;
u8 highspeed;
struct list_head td_list; /* queued itds */
struct list_head free_list; /* list of unused itds */
struct usb_device *udev;
struct usb_host_endpoint *ep;
/* output of (re)scheduling */
int next_uframe;
__hc32 splits;
/* the rest is derived from the endpoint descriptor,
* trusting urb->interval == f(epdesc->bInterval) and
* including the extra info for hw_bufp[0..2]
*/
u8 usecs, c_usecs;
u16 interval;
u16 tt_usecs;
u16 maxp;
u16 raw_mask;
unsigned bandwidth;
/* This is used to initialize iTD's hw_bufp fields */
__hc32 buf0;
__hc32 buf1;
__hc32 buf2;
/* this is used to initialize sITD's tt info */
__hc32 address;
};
/*-------------------------------------------------------------------------*/
/*
* EHCI Specification 0.95 Section 3.3
* Fig 3-4 "Isochronous Transaction Descriptor (iTD)"
*
* Schedule records for high speed iso xfers
*/
struct fotg210_itd {
/* first part defined by EHCI spec */
__hc32 hw_next; /* see EHCI 3.3.1 */
__hc32 hw_transaction[8]; /* see EHCI 3.3.2 */
#define FOTG210_ISOC_ACTIVE (1<<31) /* activate transfer this slot */
#define FOTG210_ISOC_BUF_ERR (1<<30) /* Data buffer error */
#define FOTG210_ISOC_BABBLE (1<<29) /* babble detected */
#define FOTG210_ISOC_XACTERR (1<<28) /* XactErr - transaction error */
#define FOTG210_ITD_LENGTH(tok) (((tok)>>16) & 0x0fff)
#define FOTG210_ITD_IOC (1 << 15) /* interrupt on complete */
#define ITD_ACTIVE(fotg210) cpu_to_hc32(fotg210, FOTG210_ISOC_ACTIVE)
__hc32 hw_bufp[7]; /* see EHCI 3.3.3 */
__hc32 hw_bufp_hi[7]; /* Appendix B */
/* the rest is HCD-private */
dma_addr_t itd_dma; /* for this itd */
union fotg210_shadow itd_next; /* ptr to periodic q entry */
struct urb *urb;
struct fotg210_iso_stream *stream; /* endpoint's queue */
struct list_head itd_list; /* list of stream's itds */
/* any/all hw_transactions here may be used by that urb */
unsigned frame; /* where scheduled */
unsigned pg;
unsigned index[8]; /* in urb->iso_frame_desc */
} __aligned(32);
/*-------------------------------------------------------------------------*/
/*
* EHCI Specification 0.96 Section 3.7
* Periodic Frame Span Traversal Node (FSTN)
*
* Manages split interrupt transactions (using TT) that span frame boundaries
* into uframes 0/1; see 4.12.2.2. In those uframes, a "save place" FSTN
* makes the HC jump (back) to a QH to scan for fs/ls QH completions until
* it hits a "restore" FSTN; then it returns to finish other uframe 0/1 work.
*/
struct fotg210_fstn {
__hc32 hw_next; /* any periodic q entry */
__hc32 hw_prev; /* qh or FOTG210_LIST_END */
/* the rest is HCD-private */
dma_addr_t fstn_dma;
union fotg210_shadow fstn_next; /* ptr to periodic q entry */
} __aligned(32);
/*-------------------------------------------------------------------------*/
/* Prepare the PORTSC wakeup flags during controller suspend/resume */
#define fotg210_prepare_ports_for_controller_suspend(fotg210, do_wakeup) \
fotg210_adjust_port_wakeup_flags(fotg210, true, do_wakeup)
#define fotg210_prepare_ports_for_controller_resume(fotg210) \
fotg210_adjust_port_wakeup_flags(fotg210, false, false)
/*-------------------------------------------------------------------------*/
/*
* Some EHCI controllers have a Transaction Translator built into the
* root hub. This is a non-standard feature. Each controller will need
* to add code to the following inline functions, and call them as
* needed (mostly in root hub code).
*/
static inline unsigned int
fotg210_get_speed(struct fotg210_hcd *fotg210, unsigned int portsc)
{
return (readl(&fotg210->regs->otgcsr)
& OTGCSR_HOST_SPD_TYP) >> 22;
}
/* Returns the speed of a device attached to a port on the root hub. */
static inline unsigned int
fotg210_port_speed(struct fotg210_hcd *fotg210, unsigned int portsc)
{
switch (fotg210_get_speed(fotg210, portsc)) {
case 0:
return 0;
case 1:
return USB_PORT_STAT_LOW_SPEED;
case 2:
default:
return USB_PORT_STAT_HIGH_SPEED;
}
}
/*-------------------------------------------------------------------------*/
#define fotg210_has_fsl_portno_bug(e) (0)
/*
* While most USB host controllers implement their registers in
* little-endian format, a minority (celleb companion chip) implement
* them in big endian format.
*
* This attempts to support either format at compile time without a
* runtime penalty, or both formats with the additional overhead
* of checking a flag bit.
*
*/
#define fotg210_big_endian_mmio(e) 0
#define fotg210_big_endian_capbase(e) 0
static inline unsigned int fotg210_readl(const struct fotg210_hcd *fotg210,
__u32 __iomem *regs)
{
return readl(regs);
}
static inline void fotg210_writel(const struct fotg210_hcd *fotg210,
const unsigned int val, __u32 __iomem *regs)
{
writel(val, regs);
}
/* cpu to fotg210 */
static inline __hc32 cpu_to_hc32(const struct fotg210_hcd *fotg210, const u32 x)
{
return cpu_to_le32(x);
}
/* fotg210 to cpu */
static inline u32 hc32_to_cpu(const struct fotg210_hcd *fotg210, const __hc32 x)
{
return le32_to_cpu(x);
}
static inline u32 hc32_to_cpup(const struct fotg210_hcd *fotg210,
const __hc32 *x)
{
return le32_to_cpup(x);
}
/*-------------------------------------------------------------------------*/
static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210)
{
return fotg210_readl(fotg210, &fotg210->regs->frame_index);
}
#define fotg210_itdlen(urb, desc, t) ({ \
usb_pipein((urb)->pipe) ? \
(desc)->length - FOTG210_ITD_LENGTH(t) : \
FOTG210_ITD_LENGTH(t); \
})
/*-------------------------------------------------------------------------*/
#endif /* __LINUX_FOTG210_H */
| {
"pile_set_name": "Github"
} |
sklearn_classifier.py
=====================
What is this?
-------------
Load trained classifier model and classify with input vector array.
Subscribing Topic
-----------------
* ``~input`` (``jsk_recognition_msgs/VectorArray``)
Input vector array to do classification.
Publishing Topic
----------------
* ``~output`` (``jsk_recognition_msgs/ClassificationResult``)
Classification result.
Parameters
----------
* ``~clf_path`` (type: ``String``, required)
Trained classifier path. Currently we support ``*.pkl.gz`` file.
To train the classifier, use ``jsk_perception/sklearn_classifier_trainer.py``.
Sample
------
See `here <../bof_object_recognition.html>`_.
| {
"pile_set_name": "Github"
} |
///////////////////////////////////////////////////////////////////////////////
//
// AutobahnJava - http://crossbar.io/autobahn
//
// Copyright (c) Crossbar.io Technologies GmbH and contributors
//
// Licensed under the MIT License.
// http://www.opensource.org/licenses/mit-license.php
//
///////////////////////////////////////////////////////////////////////////////
package io.crossbar.autobahn.demogallery.android;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import io.crossbar.autobahn.demogallery.R;
import io.crossbar.autobahn.websocket.WebSocketConnection;
import io.crossbar.autobahn.websocket.WebSocketConnectionHandler;
import io.crossbar.autobahn.websocket.exceptions.WebSocketException;
import io.crossbar.autobahn.websocket.interfaces.IWebSocket;
import io.crossbar.autobahn.websocket.types.WebSocketOptions;
public class EchoClientActivity extends AppCompatActivity {
private static final String TAG = "io.crossbar.autobahn.echo";
private static final String PREFS_NAME = "AutobahnAndroidEcho";
private EditText mHostname;
private EditText mPort;
private TextView mStatusline;
private Button mStart;
private EditText mMessage;
private Button mSendMessage;
private SharedPreferences mSettings;
private void alert(String message) {
Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 0);
toast.show();
}
private void loadPrefs() {
mHostname.setText(mSettings.getString("hostname", "192.168.1.3"));
mPort.setText(mSettings.getString("port", "9000"));
}
private void savePrefs() {
SharedPreferences.Editor editor = mSettings.edit();
editor.putString("hostname", mHostname.getText().toString());
editor.putString("port", mPort.getText().toString());
editor.apply();
}
private void setButtonConnect() {
mHostname.setEnabled(true);
mPort.setEnabled(true);
mStart.setText("Connect");
mStart.setOnClickListener(v -> start());
}
private void setButtonDisconnect() {
mHostname.setEnabled(false);
mPort.setEnabled(false);
mStart.setText("Disconnect");
mStart.setOnClickListener(v -> mConnection.sendClose());
}
private final IWebSocket mConnection = new WebSocketConnection();
private void start() {
String hostname = mHostname.getText().toString();
if (!hostname.startsWith("ws://") && !hostname.startsWith("wss://")) {
hostname = "ws://" + hostname;
}
String port = mPort.getText().toString();
String wsuri;
if (!port.isEmpty()) {
wsuri = hostname + ":" + port;
} else {
wsuri = hostname;
}
mStatusline.setText("Status: Connecting to " + wsuri + " ..");
setButtonDisconnect();
WebSocketOptions connectOptions = new WebSocketOptions();
connectOptions.setReconnectInterval(5000);
try {
mConnection.connect(wsuri, new WebSocketConnectionHandler() {
@Override
public void onOpen() {
mStatusline.setText("Status: Connected to " + wsuri);
savePrefs();
mSendMessage.setEnabled(true);
mMessage.setEnabled(true);
}
@Override
public void onMessage(String payload) {
alert("Got echo: " + payload);
}
@Override
public void onClose(int code, String reason) {
alert("Connection lost.");
mStatusline.setText("Status: Ready.");
setButtonConnect();
mSendMessage.setEnabled(false);
mMessage.setEnabled(false);
}
}, connectOptions);
} catch (WebSocketException e) {
Log.d(TAG, e.toString());
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_websocket_echo_client);
mHostname = findViewById(R.id.hostname);
mPort = findViewById(R.id.port);
mStatusline = findViewById(R.id.statusline);
mStart = findViewById(R.id.start);
mMessage = findViewById(R.id.msg);
mSendMessage = findViewById(R.id.sendMsg);
mSettings = getSharedPreferences(PREFS_NAME, 0);
loadPrefs();
setButtonConnect();
mSendMessage.setEnabled(false);
mMessage.setEnabled(false);
mSendMessage.setOnClickListener(v -> mConnection.sendMessage(mMessage.getText().toString()));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mConnection.isConnected()) {
mConnection.sendClose();
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://my.netscape.com/rdf/simple/0.9/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<dc:title>My Title</dc:title>
</channel>
</rdf:RDF> | {
"pile_set_name": "Github"
} |
#define bullet_width 6
#define bullet_height 6
static unsigned char bullet_bits[] = {
0x00, 0x00, 0x1c, 0x1c, 0x1c, 0x00 };
| {
"pile_set_name": "Github"
} |
Console Tool
| {
"pile_set_name": "Github"
} |
{
"timeZone": "Europe/Moscow",
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
| {
"pile_set_name": "Github"
} |
//
// LoadingViewController.swift
// Milkshakr
//
// Created by Guilherme Rambo on 10/06/18.
// Copyright © 2018 Guilherme Rambo. All rights reserved.
//
import UIKit
class LoadingViewController: UIViewController {
private lazy var activityIndicator: UIActivityIndicatorView = {
let v = UIActivityIndicatorView(style: .gray)
v.translatesAutoresizingMaskIntoConstraints = false
return v
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .background
view.addSubview(activityIndicator)
activityIndicator.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
activityIndicator.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
}
private let animationDuration: Double = 0.3
func show(animated: Bool = true) {
let duration = animated ? animationDuration : 0
activityIndicator.startAnimating()
UIView.animate(withDuration: duration) {
self.view.alpha = 1
}
}
func hide(animated: Bool = true, completion: (() -> Void)? = nil) {
let duration = animated ? animationDuration : 0
UIView.animate(withDuration: duration, animations: {
self.view.alpha = 0
}, completion: { _ in
self.activityIndicator.stopAnimating()
self.view.removeFromSuperview()
self.removeFromParent()
completion?()
})
}
}
| {
"pile_set_name": "Github"
} |
/*
* (C) Copyright 2009-2015
* Marvell Semiconductor <www.marvell.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _CONFIG_MARVELL_PLUG_H
#define _CONFIG_MARVELL_PLUG_H
/*
* High Level Configuration Options (easy to change)
*/
#define CONFIG_KW88F6281 1 /* SOC Name */
#define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
/* Add target to build it automatically upon "make" */
#define CONFIG_BUILD_TARGET "u-boot.kwb"
/*
* Compression configuration
*/
#ifdef CONFIG_SYS_MVFS
#define CONFIG_BZIP2
#endif /* CONFIG_SYS_MVFS */
/*
* Commands configuration
*/
/*
* Extra file system
*/
/*
* mv-common.h should be defined after CMD configs since it used them
* to enable certain macros
*/
#include "mv-common.h"
/*
* RTC driver configuration
*/
#ifdef CONFIG_CMD_DATE
#define CONFIG_RTC_MV
#endif /* CONFIG_CMD_DATE */
#define CONFIG_SYS_ALT_MEMTEST
#endif /* _CONFIG_MARVELL_PLUG_H */
| {
"pile_set_name": "Github"
} |
https://github.com/aymericdamien/TopDeepLearning
https://github.com/hunkim/DeepLearningZeroToAll
https://github.com/nlintz/TensorFlow-Tutorials/
https://github.com/tensorflow/tensorflow
https://github.com/BVLC/caffe
https://github.com/jcjohnson/neural-style
https://github.com/google/deepdream
https://github.com/fchollet/keras
https://github.com/Rochester-NRT/RocAlphaGo
https://github.com/karpathy/char-rnn
https://github.com/hunkim/word-rnn-tensorflow
https://github.com/karpathy/neuraltalk
https://github.com/tflearn/tflearn
https://github.com/tensorflow/playground
https://github.com/pkmital/tensorflow_tutorials
https://github.com/openai/gym
https://github.com/hunkim/DeepLearningStars
https://github.com/ujjwalkarn/Machine-Learning-Tutorials
https://github.com/ritchieng/tensorflow-aws-ami
https://github.com/nivwusquorum/tensorflow-deepq
https://github.com/sjchoi86/Tensorflow-101
https://github.com/donnemartin/data-science-ipython-notebooks
https://github.com/karpathy/convnetjs
https://github.com/taizan/PaintsChainer
https://github.com/pytorch/pytorch
https://github.com/baidu/Paddle
https://github.com/zsdonghao/tensorlayer
https://github.com/Theano/Theano
https://github.com/Microsoft/CNTK
https://github.com/torch/torch7
https://github.com/dmlc/mxnet
https://github.com/awjuliani/DeepRL-Agents
https://github.com/tiny-dnn/tiny-dnn
https://github.com/caffe2/caffe2
https://github.com/NervanaSystems/neon
https://github.com/pfnet/chainer
https://github.com/zer0n/deepframeworks
https://github.com/floydhub/dl-docker
https://github.com/deeplearning4j/deeplearning4j
https://github.com/Swift-AI/Swift-AI
https://github.com/buriburisuri/speech-to-text-wavenet
| {
"pile_set_name": "Github"
} |
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://libtomcrypt.com
*/
/**
@file eax_init.c
EAX implementation, initialized EAX state, by Tom St Denis
*/
#include "tomcrypt.h"
#ifdef EAX_MODE
/**
Initialized an EAX state
@param eax [out] The EAX state to initialize
@param cipher The index of the desired cipher
@param key The secret key
@param keylen The length of the secret key (octets)
@param nonce The use-once nonce for the session
@param noncelen The length of the nonce (octets)
@param header The header for the EAX state
@param headerlen The header length (octets)
@return CRYPT_OK if successful
*/
int eax_init(eax_state *eax, int cipher,
const unsigned char *key, unsigned long keylen,
const unsigned char *nonce, unsigned long noncelen,
const unsigned char *header, unsigned long headerlen)
{
unsigned char *buf;
int err, blklen;
omac_state *omac;
unsigned long len;
LTC_ARGCHK(eax != NULL);
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(nonce != NULL);
if (headerlen > 0) {
LTC_ARGCHK(header != NULL);
}
if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
return err;
}
blklen = cipher_descriptor[cipher].block_length;
/* allocate ram */
buf = XMALLOC(MAXBLOCKSIZE);
omac = XMALLOC(sizeof(*omac));
if (buf == NULL || omac == NULL) {
if (buf != NULL) {
XFREE(buf);
}
if (omac != NULL) {
XFREE(omac);
}
return CRYPT_MEM;
}
/* N = OMAC_0K(nonce) */
zeromem(buf, MAXBLOCKSIZE);
if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) {
goto LBL_ERR;
}
/* omac the [0]_n */
if ((err = omac_process(omac, buf, blklen)) != CRYPT_OK) {
goto LBL_ERR;
}
/* omac the nonce */
if ((err = omac_process(omac, nonce, noncelen)) != CRYPT_OK) {
goto LBL_ERR;
}
/* store result */
len = sizeof(eax->N);
if ((err = omac_done(omac, eax->N, &len)) != CRYPT_OK) {
goto LBL_ERR;
}
/* H = OMAC_1K(header) */
zeromem(buf, MAXBLOCKSIZE);
buf[blklen - 1] = 1;
if ((err = omac_init(&eax->headeromac, cipher, key, keylen)) != CRYPT_OK) {
goto LBL_ERR;
}
/* omac the [1]_n */
if ((err = omac_process(&eax->headeromac, buf, blklen)) != CRYPT_OK) {
goto LBL_ERR;
}
/* omac the header */
if (headerlen != 0) {
if ((err = omac_process(&eax->headeromac, header, headerlen)) != CRYPT_OK) {
goto LBL_ERR;
}
}
/* note we don't finish the headeromac, this allows us to add more header later */
/* setup the CTR mode */
if ((err = ctr_start(cipher, eax->N, key, keylen, 0, CTR_COUNTER_BIG_ENDIAN, &eax->ctr)) != CRYPT_OK) {
goto LBL_ERR;
}
/* setup the OMAC for the ciphertext */
if ((err = omac_init(&eax->ctomac, cipher, key, keylen)) != CRYPT_OK) {
goto LBL_ERR;
}
/* omac [2]_n */
zeromem(buf, MAXBLOCKSIZE);
buf[blklen-1] = 2;
if ((err = omac_process(&eax->ctomac, buf, blklen)) != CRYPT_OK) {
goto LBL_ERR;
}
err = CRYPT_OK;
LBL_ERR:
#ifdef LTC_CLEAN_STACK
zeromem(buf, MAXBLOCKSIZE);
zeromem(omac, sizeof(*omac));
#endif
XFREE(omac);
XFREE(buf);
return err;
}
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_init.c,v $ */
/* $Revision: 1.5 $ */
/* $Date: 2006/03/31 14:15:35 $ */
| {
"pile_set_name": "Github"
} |
import glob
import random
from collections import defaultdict
import torch
from PIL import Image
from torch.utils.data import DataLoader
from torchvision import transforms
from maml.sampler import ClassBalancedSampler
from maml.datasets.metadataset import Task
class AircraftMAMLSplit():
def __init__(self, root, train=True, num_train_classes=70,
transform=None, target_transform=None, **kwargs):
self.transform = transform
self.target_transform = target_transform
self.root = root + '/aircraft'
self._train = train
if self._train:
all_character_dirs = glob.glob(self.root + '/train/**')
self._characters = all_character_dirs
else:
all_character_dirs = glob.glob(self.root + '/test/**')
self._characters = all_character_dirs
self._character_images = []
for i, char_path in enumerate(self._characters):
img_list = [(cp, i) for cp in glob.glob(char_path + '/*')]
self._character_images.append(img_list)
self._flat_character_images = sum(self._character_images, [])
def __getitem__(self, index):
"""
Args:
index (int): Index
Returns:
tuple: (image, target) where target is index of the target
character class.
"""
image_path, character_class = self._flat_character_images[index]
image = Image.open(image_path, mode='r')
if self.transform:
image = self.transform(image)
if self.target_transform:
character_class = self.target_transform(character_class)
return image, character_class
class AircraftMetaDataset(object):
"""
TODO: Check if the data loader is fast enough.
Args:
root: path to aircraft dataset
img_side_len: images are scaled to this size
num_classes_per_batch: number of classes to sample for each batch
num_samples_per_class: number of samples to sample for each class
for each batch. For K shot learning this should be K + number
of validation samples
num_total_batches: total number of tasks to generate
train: whether to create data loader from the test or validation data
"""
def __init__(self, name='aircraft', root='data',
img_side_len=84, img_channel=3,
num_classes_per_batch=5, num_samples_per_class=6,
num_total_batches=200000,
num_val_samples=1, meta_batch_size=40, train=True,
num_train_classes=1100, num_workers=0, device='cpu'):
self.name = name
self._root = root
self._img_side_len = img_side_len
self._img_channel = img_channel
self._num_classes_per_batch = num_classes_per_batch
self._num_samples_per_class = num_samples_per_class
self._num_total_batches = num_total_batches
self._num_val_samples = num_val_samples
self._meta_batch_size = meta_batch_size
self._num_train_classes = num_train_classes
self._train = train
self._num_workers = num_workers
self._device = device
self._total_samples_per_class = (
num_samples_per_class + num_val_samples)
self._dataloader = self._get_aircraft_data_loader()
self.input_size = (img_channel, img_side_len, img_side_len)
self.output_size = self._num_classes_per_batch
def _get_aircraft_data_loader(self):
assert self._img_channel == 1 or self._img_channel == 3
resize = transforms.Resize(
(self._img_side_len, self._img_side_len), Image.LANCZOS)
if self._img_channel == 1:
img_transform = transforms.Compose(
[resize, transforms.Grayscale(num_output_channels=1),
transforms.ToTensor()])
else:
img_transform = transforms.Compose(
[resize, transforms.ToTensor()])
dset = AircraftMAMLSplit(
self._root, transform=img_transform, train=self._train,
download=True, num_train_classes=self._num_train_classes)
_, labels = zip(*dset._flat_character_images)
sampler = ClassBalancedSampler(labels, self._num_classes_per_batch,
self._total_samples_per_class,
self._num_total_batches, self._train)
batch_size = (self._num_classes_per_batch *
self._total_samples_per_class *
self._meta_batch_size)
loader = DataLoader(dset, batch_size=batch_size, sampler=sampler,
num_workers=self._num_workers, pin_memory=True)
return loader
def _make_single_batch(self, imgs, labels):
"""Split imgs and labels into train and validation set.
TODO: check if this might become the bottleneck"""
# relabel classes randomly
new_labels = list(range(self._num_classes_per_batch))
random.shuffle(new_labels)
labels = labels.tolist()
label_set = set(labels)
label_map = {label: new_labels[i] for i, label in enumerate(label_set)}
labels = [label_map[l] for l in labels]
label_indices = defaultdict(list)
for i, label in enumerate(labels):
label_indices[label].append(i)
# assign samples to train and validation sets
val_indices = []
train_indices = []
for label, indices in label_indices.items():
val_indices.extend(indices[:self._num_val_samples])
train_indices.extend(indices[self._num_val_samples:])
label_tensor = torch.tensor(labels, device=self._device)
imgs = imgs.to(self._device)
train_task = Task(imgs[train_indices], label_tensor[train_indices], self.name)
val_task = Task(imgs[val_indices], label_tensor[val_indices], self.name)
return train_task, val_task
def _make_meta_batch(self, imgs, labels):
batches = []
inner_batch_size = (
self._total_samples_per_class * self._num_classes_per_batch)
for i in range(0, len(imgs) - 1, inner_batch_size):
batch_imgs = imgs[i:i+inner_batch_size]
batch_labels = labels[i:i+inner_batch_size]
batch = self._make_single_batch(batch_imgs, batch_labels)
batches.append(batch)
train_tasks, val_tasks = zip(*batches)
return train_tasks, val_tasks
def __iter__(self):
for imgs, labels in iter(self._dataloader):
train_tasks, val_tasks = self._make_meta_batch(imgs, labels)
yield train_tasks, val_tasks
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E0EFAE491C49F99300334D78"
BuildableName = "MenuItemKit.framework"
BlueprintName = "MenuItemKit"
ReferencedContainer = "container:MenuItemKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E0EFAE531C49F99400334D78"
BuildableName = "MenuItemKitTests.xctest"
BlueprintName = "MenuItemKitTests"
ReferencedContainer = "container:MenuItemKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E0EFAE491C49F99300334D78"
BuildableName = "MenuItemKit.framework"
BlueprintName = "MenuItemKit"
ReferencedContainer = "container:MenuItemKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E0EFAE491C49F99300334D78"
BuildableName = "MenuItemKit.framework"
BlueprintName = "MenuItemKit"
ReferencedContainer = "container:MenuItemKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E0EFAE491C49F99300334D78"
BuildableName = "MenuItemKit.framework"
BlueprintName = "MenuItemKit"
ReferencedContainer = "container:MenuItemKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
| {
"pile_set_name": "Github"
} |
/* Resets */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;}
:focus {outline: 0;}
body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #528036 url(img/background.jpg) no-repeat fixed 0 0;}
p {padding-bottom: 20px;}
ol, ul {list-style: none;}
table {border-collapse: separate;border-spacing: 0;}
caption, th, td {text-align: left;font-weight: normal;}
strong {font-weight: bold;}
em {font-style: italic;}
hr {display: none;}
.font1 {color: white;background-color: #528036;}
.right {float: right;}
.left {float: left;}
.hide {display: none;}
.round {-moz-border-radius: 15px;-webkit-border-radius: 15px;-khtml-border-radius: 15px;border-radius: 15px;}
.clear {clear: both;}
.clearfix {display: block;}
.clearfix:after {content: ".";display: block;clear: both;visibility: hidden;line-height: 0;height: 0;}
html[xmlns] .clearfix {display: block;}
* html .clearfix {height: 1%;}
/* Link Styles */
a {color: #528036;}
a:link, a:visited {text-decoration: none;}
a:hover {color: #000;text-decoration: none;}
a:active {text-decoration: none;}
/* Headings */
h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, simsun, sans-serif;padding-bottom: 5px;}
h1 {font-size: 36px;line-height: 44px;}
h2 {font-size: 20px;line-height: 20px;}
h3 {font-size: 14px;line-height: 14px;}
h4 {font-size: 14px;font-weight: normal;line-height: 25px;}
/* Wraps */
.header_wrap {position: relative;min-width: 940px;padding: 100px 30px 0 30px;}
.content_wrap {position: relative;min-width: 940px;padding: 0 30px 50px 30px;}
.footer_wrap {bottom: 0;height: 47px;width: 100%;background-color: #1b1b1b;border-top: 1px solid #749e58;}
/* Header */
.header {position: relative;width: 940px;margin: 0 auto;height: 160px;border: 1px solid white;background: transparent url(img/header-bg.png) repeat-x 0 -50px;}
.header-text {padding: 40px 25px 15px 120px;font-size: 18px;line-height: 24px;color: #747d67;font-family: Helvetica, sans-serif;}
.header-text img {padding-bottom: 5px;}
.shortcuts {white-space: nowrap;text-align: right;position: absolute;top: -45px;right: 5px;}
.shortcuts.language {top: -85px;right:0px;}
.shortcuts li {display: inline;font-size: 18px;line-height: 28px;font-family: Helvetica, Arial, simsun, sans-serif;padding-bottom: 5px;margin-left: 30px;cursor: pointer;}
.shortcuts li button {cursor: pointer;}
.shortcuts li span {border-bottom: 1px dotted white;}
.shortcuts li span.selected {padding: 2px;background-color: #528036;}
.shortcuts li a {color: #fff;}
.ieSuggest {display:none;font-size: 12px;color: silver;position: absolute;left: 10px;top: 2px;}
.google_plus {position: absolute;right: 10px; top:10px;}
.light-bulb {position: absolute;left: -20px;bottom: -35px;width:116px;height:180px;background-image:url(img/lightbulb.png);background-repeat: no-repeat;}
/* Content */
.content {position: relative;width: 940px;margin: 0 auto;}
.nav_section {position: relative;height: 20px;font-family: "Myriad Pro", "Trebuchet MS", sans-serif;font-size: 15px;color: #253;padding: 20px 0;}
.nav_section ul {position: absolute;right: 10px;}
.nav_section ul li {display: inline;line-height: 20px;margin: 0 5px 0 20px;border-bottom: 1px dotted white;}
.nav_section ul li.noline {border-bottom: 0;}
.nav_section ul li a {color: #fff;}
.nav_section ul li a.selected {padding: 2px;background-color: #528036;}
.nav_section ul li.first {border: none;}
.content .title {margin: 50px 30px 20px 70px;}
.content li {margin-bottom: 5px;}
.contentBox {position: relative;overflow: hidden;border: 1px solid white;min-height: 200px;line-height: 25px;background: transparent url(img/contact-bg.png) repeat-x 0 0;}
.zTreeInfo {display:none;width: 940px;position: absolute;}
.zTreeInfo p {padding-bottom: 50px;}
.zTreeInfo-left {float: left;width: 280px;height:300px;padding: 0 50px 60px 75px;background:url(img/zTreeIntroduction.jpg) no-repeat 30px 30px;}
.zTreeInfo-right {position: relative;float: right;width: 475px;padding: 0 50px 60px 0;}
.zTreeInfo-right li {font-size: 12px;list-style-type: disc;}
.license {display:none;width: 940px;position: absolute;}
.donateInfo {display:block;width: 940px;position: absolute;}
.links {display:none;width: 940px;position: absolute;}
.links .content {float: left;width: 160px;height:200px;padding: 0 10px 10px 2px;text-align: center;}
.links .content.first {margin-left: 30px;}
.contact {display:none;width: 940px;position: absolute;}
.contact .myhome { position: absolute; top:10px; left:620px; width:300px; height:266px; background: transparent url(img/myhome.gif) scroll no-repeat 0 0;}
.siteTag {position: absolute;left: -16px;top: 109px;z-index: 10;width: 65px;height: 46px;padding:0;margin:0 10px 0 0;
vertical-align:middle;border:0 none;background: transparent url(img/siteTag.png) scroll no-repeat 0 0;}
.siteTag.tag_zTreeInfo {background-position: 0 0}
.siteTag.tag_license {background-position: 0 -46px}
.siteTag.tag_donate {background-position: 0 -92px}
.siteTag.tag_contact {background-position: 0 -138px}
.apiContent {width: 940px;}
.apiContent .right {float: right;padding-right: 100px;}
.apiContent .left {float: left;padding-right: 20px;border-right: 1px dotted silver;}
.api_setting {position: relative;margin:20px 0 20px 20px;}
.api_function {position: relative;margin:20px 0 20px 30px;padding-right: 10px;}
.api_content_title {text-align: center;font-weight: bold;}
.demoContent {width: 940px;}
.demoContent .right {float: right;padding: 20px;width: 600px;}
.demoContent .left {float: left;padding: 20px;}
.demoContent iframe {width:600px;min-height: 530px;}
.faqContent {width: 940px;}
.faqContent .right {float: right;padding: 20px;width: 600px;}
.faqContent .left {float: left;padding: 20px;}
.faqContent iframe {width:600px;min-height: 300px;}
.baby_overlay_tmp {position: absolute;top:0; left:-5000px;display:block;visibility: hidden;width:640px;font-size:11px;}
.baby_overlay_tmp .details {padding: 20px;}
.baby_overlay {display:none;position:absolute;z-index:99;left:0; top:0;width:640px;color:#fff;font-size:11px;}
.baby_overlay .content {width:100%; height:100px;overflow: hidden;background: transparent url(img/overlay_bg.png) scroll repeat 0 0;}
.baby_overlay .details {padding:0 20px 20px 20px;}
.baby_overlay .close {background-image:url(img/close.png);position:absolute; right:5px; top:5px;cursor:pointer;height:36px;width:36px;}
.baby_overlay_arrow {background-image:url(img/overlay_arrow.png);background-position:0 0;position:absolute;height:40px;width:40px;left: -40px;}
.baby_overlay_arrow.reverse {background-position:0 -40px;}
/* Footer */
.footer {position: relative;min-width: 1000px;font: 14px/24px arial, helvetica, sans-serif;}
.footer ul {position:absolute;left: 0px;border:1px solid #393939;background:#262626;padding:12px 0px;line-height: 18px;display: none;list-style: none;}
.footer ul li a {display:block;padding: 2px 15px;color: #9c9c9c;text-indent: 0;}
.footer ul li a:hover {text-decoration:none;color: #fff;}
.footer-logo {position:absolute;margin: 10px 0 0 30px;width:122px; height:24px;top:0; left:0;background: transparent url(img/footer-logo.png) no-repeat 0 0;}
.footer_mii {position: absolute;right: 558px;top: 8px;z-index: 10;padding: 4px 0;}
.footer_mii a {font-size:10px;color:#649140}
.footer_mii a:hover {color:#B6D76F}
.footer_siteMap {position: absolute;right: 358px;top: 8px;width: 155px;z-index: 10;padding: 4px 0;}
.footer_siteMap .footer_siteMap_header {width:155px;text-indent: -9999px;background: transparent url(img/footer_siteMap.gif) no-repeat 0 0;}
.footer_siteMap ul {top:-202px;width:180px;}
.footer_siteMap:hover ul {left: 0}
.footer_contact {position: absolute;right: 193px;top: 8px;width: 155px;z-index: 10;padding: 4px 0;}
.footer_contact .footer_contact_header {width:155px;text-indent: -9999px;background: transparent url(img/footer_contact.gif) no-repeat 0px 0px;}
.footer_contact ul {top:-113px;width:153px;}
.footer_contact:hover ul {left: 0}
.footer_download {position: absolute;right: 60px;top: 8px;width: 123px;z-index: 10;padding: 4px 0;}
.footer_download .footer_download_header {width:123px;text-indent: -9999px;background: transparent url(img/footer_download.png) no-repeat 0px 0px;}
.footer_download ul {top:-113px;width:140px;}
.footer_download:hover ul {left: 0}
/* button icon */
button {vertical-align:middle;border:0 none;background: transparent no-repeat 0 0 scroll;}
.shortcuts button.ico {width:24px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/menuIcon.png)}
.shortcuts button.home {background-position: 0 0}
.shortcuts button.demo {background-position: 0 -24px}
.shortcuts button.api {background-position: 0 -48px}
.shortcuts button.faq {background-position: 0 -72px}
.shortcuts button.donate {background-position: 0 -144px}
.shortcuts button.download {background-position: 0 -96px}
.shortcuts button.face {background-position: 0 -120px}
.shortcuts button.cn {width:48px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/chinese.png)}
.shortcuts button.en {width:48px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/english.png)}
.content button.ico {width:24px; height:24px;padding:0; margin:0 10px 0 0;}
.content button.ico16 {width:16px; height:16px;padding:0; margin:0 5px 0 0;background-image:url("img/apiMenu.png");}
button.z_core {margin-top: -4px;background-position:0 0;}
button.z_check {margin-top: -4px;background-position:0 -16px;}
button.z_edit {margin-top: -4px;background-position:0 -32px;}
button.z_hide {margin-top: -4px;background-position:0 -64px;}
button.z_search {margin-top: -4px;background-position:0 -48px;}
button.searchPrev {margin-top: -4px;background-position:-16px 0;cursor:pointer}
button.searchNext {margin-top: -4px;background-position:-16px -16px;cursor:pointer}
button.searchPrev.disabled {margin-top: -4px;background-position:-16px -32px;cursor:auto}
button.searchNext.disabled {margin-top: -4px;background-position:-16px -48px;cursor:auto}
input.search {margin:0;padding:2px 0; border:0;}
input.searchKey {width:150px;}
input.searchResult {margin-left:-3px;width:65px;text-align:right;background-color:white;color:#707070}
input.searchResult.noResult {background-color:#ff6666;color:black}
.baby_overlay div.overlaySearch {text-align:right;padding-right:50px;padding-top:12px;}
/* api overlay*/
.apiDetail .topLine {border-top: 1px dashed #376B29;margin-top: 5px;padding-top: 5px;}
.apiDetail .highlight_red {color:#A60000;}
.apiDetail .highlight_green {color:#A7F43D;}
.apiDetail h1, .apiDetail h2, .apiDetail h3, .apiDetail h4, .apiDetail h5, .apiDetail h6 {color: white;padding: 0;}
.apiDetail h2 {color: #A7F43D;margin: 5px auto;padding: 5px;font-size: 20px;}
.apiDetail h2 span {font-size: 14px;float: right;font-weight: normal;margin: 2px 20px 0 0;vertical-align: bottom;}
.apiDetail h2 span.path {float: left;margin: 2px 0 0 0;vertical-align: bottom;}
.apiDetail h3 {margin: 5px auto;padding: 5px;font-size: 14px;font-weight: normal;}
.apiDetail h3 span.h3_info {margin-left: 20px;font-size: 12px;}
.apiDetail h4 {margin: 0 auto;padding: 0 5px;font-size: 12px;font-weight: normal;line-height: 16px;}
.apiDetail .desc h4 {color: black;}
.apiDetail h4 b{width: 150px;display:inline-block;}
.apiDetail h4 span{width: 230px;display:inline-block;}
.apiDetail pre, .apiDetail .desc {background: #E8FCD6;color: black;margin: 10px;padding: 10px;display: block;}
.apiDetail pre {word-wrap: break-word;}
.apiDetail p{margin-left: 5px;padding: 0;}
.apiDetail .longdesc {margin-top: 5px;}
.apiDetail .longdesc p{font-size: 12px;line-height:1.5;margin:3px 0;}
.apiDetail .longdesc b{font-size: 14px;}
.apiDetail table {border-collapse:collapse;}
.apiDetail table td {border:1px solid silver;text-align: center;vertical-align: middle;}
.apiDetail table thead td {font-weight: bold}
.apiDetail button {width:16px; height:16px; vertical-align:middle; border:0 none; cursor: pointer;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-image:url("zTreeStyle/img/zTreeStandard.png");}
.apiDetail button.chk {width:13px; height:13px; margin:0 3px 2px 0; cursor: auto}
.apiDetail button.chk.checkbox_false_full {background-position:0 0}
.apiDetail button.chk.checkbox_false_full_focus {background-position:0 -14px}
.apiDetail button.chk.checkbox_false_part {background-position:0 -28px}
.apiDetail button.chk.checkbox_false_part_focus {background-position:0 -42px}
.apiDetail button.chk.checkbox_true_full {background-position:-14px 0}
.apiDetail button.chk.checkbox_true_full_focus {background-position:-14px -14px}
.apiDetail button.chk.checkbox_true_part {background-position:-14px -28px}
.apiDetail button.chk.checkbox_true_part_focus {background-position:-14px -42px}
.apiDetail button.chk.radio_false_full {background-position:-28px 0}
.apiDetail button.chk.radio_false_full_focus {background-position:-28px -14px}
.apiDetail button.chk.radio_false_part {background-position:-28px -28px}
.apiDetail button.chk.radio_false_part_focus {background-position:-28px -42px}
.apiDetail button.chk.radio_true_full {background-position:-42px 0}
.apiDetail button.chk.radio_true_full_focus {background-position:-42px -14px}
.apiDetail button.chk.radio_true_part {background-position:-42px -28px}
.apiDetail button.chk.radio_true_part_focus {background-position:-42px -42px} | {
"pile_set_name": "Github"
} |
# **网络编程 - 构建服务端和客户端**
之前的章节讨论了关于网络编程的内容; 包括开发 web 客户端,web 服务端和 web 应用; DNS 查询; 和 HTTP 连接超时。
这章将带您更进一步,向您展示怎样编写您自己的 TCP 客户端和服务端,还有 UDP 客户端和服务端。此外,通过俩个例子展示怎样编写一个并发的 TCP 服务端。第一个例子相当简单,并发的 TCP 服务端只返回斐波那契序列数字。而第二个例子将使用[第四章](https://github.com/hantmac/Mastering_Go_ZH_CN/blob/master/eBook/chapter4/04.0.md)(组合类型的使用)的 keyValue.go 应用的代码,在它的基础上,把**key-value 存储**转变为一个并发 TCP 应用,可以在不需要浏览器的情况下操作。
在玩转 Go的这一章中,您将了解到如下内容:
1. net 标准包
2. TCP 客户端和服务端
3. 实现并发 TCP 服务端
4. UDP 客户端和服务端
5. 修改 [第八章](https://github.com/hantmac/Mastering_Go_ZH_CN/blob/master/eBook/chapter8/08.0.md)的 kvSaveLoad.go,告诉一个 *Unix 系统* 做什么,才能通过 TCP 连接提供请求
6. RCP 客户端和服务端 | {
"pile_set_name": "Github"
} |
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_FirebaseHosting_Release extends Google_Model
{
public $message;
public $name;
public $releaseTime;
protected $releaseUserType = 'Google_Service_FirebaseHosting_ActingUser';
protected $releaseUserDataType = '';
public $type;
protected $versionType = 'Google_Service_FirebaseHosting_Version';
protected $versionDataType = '';
public function setMessage($message)
{
$this->message = $message;
}
public function getMessage()
{
return $this->message;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setReleaseTime($releaseTime)
{
$this->releaseTime = $releaseTime;
}
public function getReleaseTime()
{
return $this->releaseTime;
}
/**
* @param Google_Service_FirebaseHosting_ActingUser
*/
public function setReleaseUser(Google_Service_FirebaseHosting_ActingUser $releaseUser)
{
$this->releaseUser = $releaseUser;
}
/**
* @return Google_Service_FirebaseHosting_ActingUser
*/
public function getReleaseUser()
{
return $this->releaseUser;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
/**
* @param Google_Service_FirebaseHosting_Version
*/
public function setVersion(Google_Service_FirebaseHosting_Version $version)
{
$this->version = $version;
}
/**
* @return Google_Service_FirebaseHosting_Version
*/
public function getVersion()
{
return $this->version;
}
}
| {
"pile_set_name": "Github"
} |
'''
Created on Nov 18, 2015
@author: Willie Maddox
Test passing a python sequence directly to aabb trees
and print out some timing info.
Verified with with python lists, tuples, and numpy arrays.
The following results were obtained with
ubuntu 14.04 running on Intel Xeon E5-2620 cpu.
Bindings compiled with CGAL 4.6 gcc 4.8.4
nx = 1000
ny = 1000
gen_vertices_cgal 10.36432
*******************************
gen_triangle_soup 19.83478
gen_triangle_tree 0.45456
Total: 30.65385
*******************************
gen_triangle_soup_Nx9 0.16211
gen_triangle_tree_Nx9 1.94723
Total: 2.10945
*******************************
gen_segment_soup 31.55930
gen_segment_tree 0.63369
Total: 42.55750
*******************************
gen_segment_soup_Nx6 0.50796
gen_segment_tree_Nx6 2.22729
Total: 2.73538
*******************************
'''
from __future__ import print_function
import sys
import time
from CGAL.CGAL_Kernel import Point_3, Segment_3, Triangle_3
from CGAL.CGAL_AABB_tree import AABB_tree_Segment_3_soup, AABB_tree_Triangle_3_soup
import numpy as np
# Helper functions
def gen_vertices(nx, ny):
'''
Create a Regular grid of vertices formatted as an (nx*ny,3) numpy array.
'''
xvals = np.linspace(-nx/2, nx/2, nx)
yvals = np.linspace(-ny/2, ny/2, ny)
xy = np.array([[i, j] for i in xvals for j in yvals])
# add some purturbations to z values.
zvals = (np.random.random((nx*ny))-0.5)*0.5
vertices = np.vstack((xy.T, zvals)).T
return vertices
# end
def gen_faces(nx, ny):
'''
Generate a list of faces from an nx by ny regular grid.
'''
a = np.arange(nx*ny).reshape(ny, nx)[:-1, :-1].flatten()
b = a + 1
c = a + nx
d = c + 1
nfaces = 2*(nx-1)*(ny-1)
faces = np.zeros((nfaces, 3)).astype(int)
faces[::2] = np.vstack([a, c, b]).T
faces[1::2] = np.vstack([b, c, d]).T
assert nfaces == len(faces)
return faces
# end
def gen_edges(faces):
'''
Generate the edges corresponding to the faces.
'''
fs = np.sort(faces, axis=1)
F_EP = [[(f[0], f[1]), (f[0], f[2]), (f[1], f[2])] for f in fs]
edges0 = set([E for EP in F_EP for E in EP])
EP_F = {EP: () for EP in edges0}
for F, EP in enumerate(F_EP):
EP_F[EP[0]] += (F,)
EP_F[EP[1]] += (F,)
EP_F[EP[2]] += (F,)
edges = np.array(list(edges0))
return edges
# end
# Testing functions
def gen_vertices_cgal(vertices):
t0 = time.time()
vertices_cgal = [Point_3(x, y, z) for x, y, z in vertices]
print('{:<21} {:>9.5f}'.format('gen_vertices_cgal', time.time()-t0))
return vertices_cgal
# end
def gen_triangle_soup(vertices_cgal, faces):
t0 = time.time()
soup = [Triangle_3(vertices_cgal[f[0]], vertices_cgal[f[1]], vertices_cgal[f[2]]) for f in faces]
print('{:<21} {:>9.5f}'.format('gen_triangle_soup', time.time()-t0))
return soup
# end
def gen_segment_soup(vertices_cgal, edges):
t0 = time.time()
soup = [Segment_3(vertices_cgal[e[0]], vertices_cgal[e[1]]) for e in edges]
print('{:<21} {:>9.5f}'.format('gen_segment_soup', time.time()-t0))
return soup
# end
def gen_triangle_tree(soup):
t0 = time.time()
tree = AABB_tree_Triangle_3_soup(soup)
print('{:<21} {:>9.5f}'.format('gen_triangle_tree', time.time()-t0))
return tree
# end
def gen_segment_tree(soup):
t0 = time.time()
tree = AABB_tree_Segment_3_soup(soup)
print('{:<21} {:>9.5f}'.format('gen_segment_tree', time.time()-t0))
return tree
# end
def gen_triangle_soup_Nx9(vertices, faces):
t0 = time.time()
soup = vertices[faces].reshape(len(faces), 9)
print('{:<21} {:>9.5f}'.format('gen_triangle_soup_Nx9', time.time()-t0))
return soup
# end
def gen_segment_soup_Nx6(vertices, edges):
t0 = time.time()
soup = vertices[edges].reshape(len(edges), 6)
print('{:<21} {:>9.5f}'.format('gen_segment_soup_Nx6', time.time()-t0))
return soup
# end
def gen_triangle_tree_Nx9(soup):
t0 = time.time()
tree = AABB_tree_Triangle_3_soup()
tree.insert_from_array(soup)
print('{:<21} {:>9.5f}'.format('gen_triangle_tree_Nx9', time.time()-t0))
return tree
# end
def gen_segment_tree_Nx6(soup):
t0 = time.time()
tree = AABB_tree_Segment_3_soup()
tree.insert_from_array(soup)
print('{:<21} {:>9.5f}'.format('gen_segment_tree_Nx6', time.time()-t0))
return tree
# end
# Set sizes.
nx = 100
ny = 100
sepstring = '*'*31
# Set up some testing primitives
p1 = Point_3(-1, -1, -1)
p2 = Point_3(1, 1, 1)
p3 = Point_3(1, 1, -1)
tri0 = Triangle_3(p1, p2, p3)
seg0 = Segment_3(p1, p2)
# Generate an initial set of points, faces, and edges.
verts = gen_vertices(nx, ny)
faces = gen_faces(nx, ny)
edges = gen_edges(faces)
nverts = len(verts)
nfaces = len(faces)
nedges = len(edges)
# Convert points to list of CGAL Point_3 objects.
t0 = time.time()
verts_cgal = gen_vertices_cgal(verts)
tverts = time.time()-t0
assert nverts == len(verts_cgal)
print(sepstring)
# test AABB triangle trees
# Generate CGAL soups on python side and pass to CGAL.
t0 = time.time()
triangle_soup = gen_triangle_soup(verts_cgal, faces)
tfaces = time.time()-t0
assert nfaces == len(triangle_soup)
t0 = time.time()
triangle_tree = gen_triangle_tree(triangle_soup)
ttree = time.time()-t0
assert nfaces == triangle_tree.size()
print('{:<21} {:>9.5f}'.format('Total:', tverts+tfaces+ttree))
print(sepstring)
tsi = []
triangle_tree.all_intersections(seg0, tsi)
tsii = [ip.second for ip in tsi]
# Pass Nx9 list directly to CGAL.
t0 = time.time()
triangle_soup_Nx9 = gen_triangle_soup_Nx9(verts, faces)
tfaces = time.time()-t0
assert nfaces == len(triangle_soup_Nx9)
t0 = time.time()
triangle_tree_Nx9 = gen_triangle_tree_Nx9(triangle_soup_Nx9)
ttree = time.time()-t0
assert nfaces == triangle_tree_Nx9.size()
print('{:<21} {:>9.5f}'.format('Total:', tfaces+ttree))
print(sepstring)
tsi9 = []
triangle_tree_Nx9.all_intersections(seg0, tsi9)
tsi9i = [ip.second for ip in tsi9]
assert tsii == tsi9i
# test AABB segment trees
# Using standard python.
t0 = time.time()
segment_soup = gen_segment_soup(verts_cgal, edges)
tedges = time.time()-t0
assert nedges == len(segment_soup)
t0 = time.time()
segment_tree = gen_segment_tree(segment_soup)
ttree = time.time()-t0
assert nedges == segment_tree.size()
print('{:<21} {:>9.5f}'.format('Total:', tverts+tedges+ttree))
print(sepstring)
sti = []
segment_tree.all_intersections(tri0, sti)
stii = [ip.second for ip in sti]
# Pass Nx6 list directly to CGAL.
t0 = time.time()
segment_soup_Nx6 = gen_segment_soup_Nx6(verts, edges)
tedges = time.time()-t0
assert nedges == len(segment_soup_Nx6)
t0 = time.time()
segment_tree_Nx6 = gen_segment_tree_Nx6(segment_soup_Nx6)
ttree = time.time()-t0
assert nedges == segment_tree_Nx6.size()
print('{:<21} {:>9.5f}'.format('Total:', tedges+ttree))
print(sepstring)
sti6 = []
segment_tree_Nx6.all_intersections(tri0, sti6)
sti6i = [ip.second for ip in sti6]
assert stii == sti6i
print('done')
| {
"pile_set_name": "Github"
} |
// list of exports supported by shoutem can be found here: https://shoutem.github.io/docs/extensions/reference/extension-exports
// Constants `screens`, `actions` and `reducer` are exported via named export
// It is important to use those exact names
import { NotificationsPage, GroupsPage } from './pages';
import { shoutemUrls } from './services';
import './style.scss';
import { reducer } from './redux';
export const pages = {
NotificationsPage,
GroupsPage,
};
let pageReducer = null;
export function pageWillMount(page) {
pageReducer = reducer();
shoutemUrls.init(page);
}
export { pageReducer as reducer };
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>[email protected]</email>
<name>Gentoo Haskell</name>
</maintainer>
<use>
<flag name="binary">enable binary instances</flag>
<flag name="hashable">enable hashable instances</flag>
<flag name="template-haskell">enable template_haskell</flag>
</use>
</pkgmetadata>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring-boot-samples</artifactId>
<groupId>thinking-in-spring-boot</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>thinking-in-spring-boot</groupId>
<artifactId>shared-libraries</artifactId>
<name>《Spring Boot 编程思想》共享库 - 主工程</name>
<packaging>pom</packaging>
<modules>
<module>shared-model</module>
<module>shared-servlet31</module>
</modules>
<dependencies>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
</dependencies>
</project> | {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.platform;
import java.io.Serializable;
import javax.cache.event.CacheEntryEvent;
import javax.cache.event.CacheEntryListenerException;
import org.apache.ignite.Ignite;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.resources.IgniteInstanceResource;
/**
* Test filter factory
*/
public class PlatformCacheEntryEventFilterFactory implements Serializable,
PlatformJavaObjectFactory<CacheEntryEventSerializableFilter> {
/** Property to be set from platform. */
private String startsWith = "-";
/** Injected instance. */
@IgniteInstanceResource
private Ignite ignite;
/** {@inheritDoc} */
@Override public CacheEntryEventSerializableFilter create() {
assert ignite != null;
return new CacheEntryEventSerializableFilter() {
@Override public boolean evaluate(CacheEntryEvent event) throws CacheEntryListenerException {
Object value = event.getValue();
if (value instanceof String)
return ((String)value).startsWith(startsWith);
assert value instanceof BinaryObject;
return ((String)((BinaryObject)value).field("String")).startsWith(startsWith);
}
};
}
}
| {
"pile_set_name": "Github"
} |
/*
* VP9 compatible video decoder
*
* Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
* Copyright (C) 2013 Clément Bœsch <u pkh me>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define BIT_DEPTH 12
#define dctint int64_t
#include "vp9dsp_template.c"
| {
"pile_set_name": "Github"
} |
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via [email protected] or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.session;
import java.util.Properties;
import java.util.logging.Level;
import javax.annotation.PostConstruct;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.CreateException;
import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import org.adempiere.util.ProcessUtil;
import org.compiere.Adempiere;
import org.compiere.acct.Doc;
import org.compiere.interfaces.Server;
import org.compiere.interfaces.ServerLocal;
import org.compiere.interfaces.ServerRemote;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MClient;
import org.compiere.model.MTask;
import org.compiere.model.MUser;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
import org.compiere.util.CacheMgt;
import org.compiere.util.EMail;
import org.compiere.util.Env;
/**
* Adempiere Server Bean.
*
* @author Jorg Janke
* @version $Id: ServerBean.java,v 1.3 2006/07/30 00:53:33 jjanke Exp $
* @author Low Heng Sin
* - Added remote transaction management
* - Added support to run db process remotely on server
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1757523 ]
*/
@Stateless(mappedName=Server.JNDI_NAME, name=Server.EJB_NAME)
@Local({ServerLocal.class})
@Remote({ServerRemote.class})
@DeclareRoles({"adempiereUsers"})
@RolesAllowed({"adempiereUsers"})
public class ServerBean implements ServerRemote, ServerLocal
{
/** Logger */
private static CLogger log = CLogger.getCLogger(ServerBean.class);
//
private static int s_no = 0;
private int m_no = 0;
//
private int m_windowCount = 0;
private int m_postCount = 0;
private int m_processCount = 0;
private int m_workflowCount = 0;
private int m_paymentCount = 0;
private int m_nextSeqCount = 0;
private int m_stmt_rowSetCount = 0;
private int m_stmt_updateCount = 0;
private int m_cacheResetCount = 0;
private int m_updateLOBCount = 0;
/**
* Post Immediate
*
* @param ctx Client Context
* @param AD_Client_ID Client ID of Document
* @param AD_Table_ID Table ID of Document
* @param Record_ID Record ID of this document
* @param force force posting
* @param trxName ignore, retained for backward compatibility
* @return null, if success or error message
*/
public String postImmediate (Properties ctx,
int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force, String trxName)
{
log.info ("[" + m_no + "] Table=" + AD_Table_ID + ", Record=" + Record_ID);
m_postCount++;
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(ctx, AD_Client_ID);
return Doc.postImmediate(ass, AD_Table_ID, Record_ID, force, null);
} // postImmediate
/*************************************************************************
* Process Remote
*
* @param ctx Context
* @param pi Process Info
* @return resulting Process Info
*/
public ProcessInfo process (Properties ctx, ProcessInfo pi)
{
m_processCount++;
// Start Process
ProcessUtil.startJavaProcess(ctx, pi, null);
return pi;
} // process
/*************************************************************************
* Run Workflow (and wait) on Server
*
* @param ctx Context
* @param pi Process Info
* @param AD_Workflow_ID id
* @return process info
*/
public ProcessInfo workflow (Properties ctx, ProcessInfo pi, int AD_Workflow_ID)
{
log.info ("[" + m_no + "] " + AD_Workflow_ID);
m_workflowCount++;
ProcessUtil.startWorkFlow(ctx, pi, AD_Workflow_ID);
return pi;
} // workflow
/**
* Create EMail from Server (Request User)
* @param ctx Context
* @param AD_Client_ID client
* @param to recipient email address
* @param subject subject
* @param message message
* @return EMail
*/
public EMail createEMail (Properties ctx, int AD_Client_ID,
String to, String subject, String message)
{
MClient client = MClient.get(ctx, AD_Client_ID);
boolean html = false;
if (message != null && message.startsWith(EMail.HTML_MAIL_MARKER))
{
html = true;
message = message.substring(EMail.HTML_MAIL_MARKER.length());
}
return client.createEMail(to, subject, message, html);
} // createEMail
/**
* Create EMail from Server (Request User)
* @param ctx Context
* @param AD_Client_ID client
* @param AD_User_ID user to send email from
* @param to recipient email address
* @param subject subject
* @param message message
* @return EMail
*/
public EMail createEMail (Properties ctx, int AD_Client_ID,
int AD_User_ID,
String to, String subject, String message)
{
MClient client = MClient.get(ctx, AD_Client_ID);
MUser from = new MUser (ctx, AD_User_ID, null);
boolean html = false;
if (message != null && message.startsWith(EMail.HTML_MAIL_MARKER))
{
html = true;
message = message.substring(EMail.HTML_MAIL_MARKER.length());
}
return client.createEMail(from, to, subject, message, html);
} // createEMail
/**
* Execute task on server
* @param AD_Task_ID task
* @return execution trace
*/
public String executeTask (int AD_Task_ID)
{
MTask task = new MTask (Env.getCtx(), AD_Task_ID, null); // Server Context
return task.execute();
} // executeTask
/**
* Cash Reset
* @param tableName table name
* @param Record_ID record or 0 for all
* @return number of records reset
*/
public int cacheReset (String tableName, int Record_ID)
{
log.config(tableName + " - " + Record_ID);
m_cacheResetCount++;
return CacheMgt.get().reset(tableName, Record_ID);
} // cacheReset
/**************************************************************************
* Describes the instance and its content for debugging purpose
* @return Debugging information about the instance and its content
*/
@PermitAll
public String getStatus()
{
StringBuffer sb = new StringBuffer("ServerBean[");
sb.append(m_no)
.append("-Window=").append(m_windowCount)
.append(",Post=").append(m_postCount)
.append(",Process=").append(m_processCount)
.append(",NextSeq=").append(m_nextSeqCount)
.append(",Workflow=").append(m_workflowCount)
.append(",Payment=").append(m_paymentCount)
.append(",RowSet=").append(m_stmt_rowSetCount)
.append(",Update=").append(m_stmt_updateCount)
.append(",CacheReset=").append(m_cacheResetCount)
.append(",UpdateLob=").append(m_updateLOBCount)
.append("]");
return sb.toString();
} // getStatus
/**
* Execute db proces on server
* @param processInfo
* @param procedureName
* @return ProcessInfo
*/
public ProcessInfo dbProcess(ProcessInfo processInfo, String procedureName)
{
ProcessUtil.startDatabaseProcedure(processInfo, procedureName, null);
return processInfo;
}
/**
* String Representation
* @return info
*/
public String toString()
{
return getStatus();
} // toString
/**************************************************************************
* Create the Session Bean
*/
@PostConstruct
public void ejbCreate()
{
m_no = ++s_no;
try
{
if (!Adempiere.startup(false))
throw new CreateException("Adempiere could not start");
}
catch (Exception ex)
{
log.log(Level.SEVERE, "ejbCreate", ex);
// throw new CreateException ();
}
log.info ("#" + getStatus());
} // ejbCreate
/**************************************************************************
* Dump SerialVersionUID of class
* @param clazz class
*/
protected static void dumpSVUID (Class<?> clazz)
{
String s = clazz.getName()
+ " ==\nstatic final long serialVersionUID = "
+ java.io.ObjectStreamClass.lookup(clazz).getSerialVersionUID()
+ "L;\n";
System.out.println (s);
} // dumpSVUID
/**
* Print UID of used classes.
* @param args ignored
*/
public static void main (String[] args)
{
dumpSVUID(ProcessInfo.class);
} // main
} // ServerBean
| {
"pile_set_name": "Github"
} |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*
*/
//#ifdef __WITH_DATABINDING
/**
* An element containing all the binding rules for the data
* bound elements referencing this element.
*
* #### Example
*
* ```xml
* <a:model id="mdlList">
* <data>
* <item date="2009-11-12" deleted="0"></item>
* <item date="2009-11-11" deleted="0"></item>
* </data>
* </a:model>
* <a:bindings id="bndFolders" >
* <a:caption match="[@date]" />
* <a:icon match="[@icon]" />
* <a:each match="[item]" sort="[@date]" />
* </a:bindings>
* <a:list
* id = "list"
* width = "200"
* height = "200"
* model = "mdlList"
* bindings = "bndFolders" />
* ```
*
* @see ppc.smartbinding
* @baseclass
*
* @author Ruben Daniels (ruben AT ajax DOT org)
* @version %I%, %G%
* @since 0.8
*
* @default_private
*/
ppc.BindingRule = function(struct, tagName){
this.$init(tagName || true, ppc.NODE_HIDDEN, struct);
};
(function(){
this.$bindingRule = true;
this.compile = function(prop){
return (this["c" + prop] = ppc.lm.compile(this[prop], {
xpathmode : 3,
injectself : true
}));
};
this.$compile = function(prop, options){
return (this["c" + prop + "2"] = ppc.lm.compile(this[prop], options));
};
//1 = force no bind rule, 2 = force bind rule
this.$attrExcludePropBind = ppc.extend({
value : 1,
match : 1
}, this.$attrExcludePropBind);
this.$booleanProperties["hasaml"] = true;
this.$propHandlers["value"] =
this.$propHandlers["match"] = function(value, prop){
delete this["c" + prop];
if (this.$amlLoaded) {
//Find parent that this rule works on
var node = this;
while (node && node.$bindingRule)
node = node.parentNode;
if (!node) return;
//Reload parent to propagate change
ppc.queue.add("reload" + node.$uniqueId, function(){
node.reload();
});
//Recompile ruleset
if (node.$bindings.$isCompiled)
node.$bindings.$compiled = node.$bindings.compile(
this.localName != "each" && this.localName);
}
};
// *** DOM Handlers *** //
/*this.addEventListener("DOMAttrModified", function(e){
});*/
this.addEventListener("DOMNodeInserted", function(e){
//Find parent that this rule works on
var node = this;
while (node.$bindingRule)
node = node.parentNode;
//Reload parent to propagate change
//@todo trigger should be maintained on node itself to prevent dual reload
if ("expanded|collapsed".indexOf(this.localName) == -1)
ppc.queue.add("reload" + node.$uniqueId, function(){
node.reload();
});
//If this node is added, add to set
if (e.currentTarget == this) {
(node.$bindings[this.localName]
|| (node.$bindings[this.localName] = [])).pushUnique(this);
}
//@todo ppc3.0 test if proc instr and cdata needs to be serialized
//Else just update the binding value
else if (!this.attributes.getNamedItem("value"))
this.value = ppc.serializeChildren(this);
//Or do nothing
else return;
//Recompile ruleset
if (node.$bindings.$isCompiled)
node.$bindings.$compiled = node.$bindings.compile(
this.localName != "each" && this.localName);
});
this.addEventListener("DOMNodeRemoved", function(e){
if (this.$amlDestroyed)
return;
//Find parent that this rule works on
var first, node = this;
while (node && node.$bindingRule)
node = node.parentNode;
if (!node)
return;
//If this node is removed, remove to set
if (e.currentTarget == this) {
if (node.$bindings && node.$bindings[this.localName])
node.$bindings[this.localName].remove(this);
else
return;
}
//@todo ppc3.0 test if proc instr and cdata needs to be serialized
//Else just update the binding value
else if (!this.attributes.getNamedItem("value") && (first = this.firstChild)) {
if (first.nodeType == this.NODE_PROCESSING_INSTRUCTION) {
if (first.target == "lm")
this.value = "{" + first.nodeValue + "}";
else
this.value = first.nodeValue;
}
else
this.value = ppc.serializeChildren(this).trim();
}
//Or do nothing
else return;
//Reload parent to propagate change
if ("expanded|collapsed".indexOf(this.localName) == -1)
ppc.queue.add("reload" + node.$uniqueId, function(){
if(!node.$amlDestroyed)
node.reload();
});
//Recompile ruleset
if (node.$bindings.$isCompiled)
node.$bindings.$compiled = node.$bindings.compile(
this.localName != "each" && this.localName);
});
this.addEventListener("DOMNodeInsertedIntoDocument", function(e){
//#ifdef __DEBUG
if (!this.match && (!this.value && !this.childNodes.length && !this.get
|| this.localName == "each") || this.select) {
throw new Error(ppc.formatErrorString(0, this, "Bindingrule",
"Missing attribute 'match'")); //@todo ppc3.0 turn this into a good error
}
//#endif
var first;
if (!this.value && this.localName != "each" && (first = this.$aml
&& this.$aml.firstChild || this.firstChild)) {
if (first.nodeType == this.NODE_PROCESSING_INSTRUCTION) {
if (first.target == "lm")
this.value = "{" + first.nodeValue + "}";
else
this.value = first.nodeValue;
}
else
this.value = ppc.serializeChildren(this.$aml).trim();
}
//Find the parent this rule works on
var pNode = this.parentNode;
while (pNode.$bindingRule)
pNode = pNode.parentNode;
//Add the rule to the set
var bindings = pNode.$bindings || (pNode.$bindings = new ppc.ruleList());
(bindings[this.localName] || (bindings[this.localName] = [])).push(this);
//Compile if necessary
if (pNode.localName != "bindings" && (this.localName != "each" || !this.childNodes.length)) {
var ns = this;
while((ns = ns.nextSibling) && ns.nodeType != 1);
if (!ns || !ns.$bindingRule) {
pNode.$cbindings = pNode.$bindings.compile(
pNode.$bindings.$isCompiled ? this.localName : null);
pNode.dispatchEvent("bindingsload", {
bindings: pNode.$bindings,
compiled: pNode.$cbindings
});
pNode.$checkLoadQueue();
}
}
});
}).call(ppc.BindingRule.prototype = new ppc.AmlElement());
ppc.aml.setElement("icon", ppc.BindingRule);
ppc.aml.setElement("image", ppc.BindingRule);
ppc.aml.setElement("caption", ppc.BindingRule);
ppc.aml.setElement("tooltip", ppc.BindingRule);
ppc.aml.setElement("css", ppc.BindingRule);
ppc.aml.setElement("selectable", ppc.BindingRule);
ppc.aml.setElement("value", ppc.BindingRule);
ppc.aml.setElement("src", ppc.BindingRule);
ppc.aml.setElement("collapsed", ppc.BindingRule);
ppc.aml.setElement("expanded", ppc.BindingRule);
ppc.aml.setElement("empty", ppc.BindingRule);
// #endif
| {
"pile_set_name": "Github"
} |
<?php return array (
'ar' => 'Aarabeere',
'ab' => 'Abkhazian',
'ace' => 'Achinese',
'ach' => 'Acoli',
'ada' => 'Adangme',
'ady' => 'Adyghe',
'aa' => 'Afar',
'afh' => 'Afrihili',
'af' => 'Afrikaans',
'agq' => 'Aghem',
'ain' => 'Ainu',
'ak' => 'Akaan',
'akk' => 'Akkadian',
'bss' => 'Akoose',
'akz' => 'Alabama',
'sq' => 'Albanian',
'ale' => 'Aleut',
'arq' => 'Algerian Arabic',
'am' => 'Amarik',
'en_US' => 'American English',
'ase' => 'American Sign Language',
'egy' => 'Ancient Egyptian',
'grc' => 'Ancient Greek',
'anp' => 'Angika',
'njo' => 'Ao Naga',
'an' => 'Aragonese',
'arc' => 'Aramaic',
'aro' => 'Araona',
'arp' => 'Arapaho',
'arw' => 'Arawak',
'hy' => 'Armenian',
'rup' => 'Aromanian',
'frp' => 'Arpitan',
'as' => 'Assamese',
'ast' => 'Asturian',
'asa' => 'Asu',
'cch' => 'Atsam',
'en_AU' => 'Australian English',
'de_AT' => 'Austrian German',
'av' => 'Avaric',
'ae' => 'Avestan',
'awa' => 'Awadhi',
'ay' => 'Aymara',
'az' => 'Azerbaijani',
'bfq' => 'Badaga',
'ksf' => 'Bafia',
'bfd' => 'Bafut',
'bqi' => 'Bakhtiari',
'ban' => 'Balinese',
'bal' => 'Baluchi',
'bm' => 'Bambara',
'bax' => 'Bamun',
'bjn' => 'Banjar',
'bas' => 'Basaa',
'ba' => 'Bashkir',
'eu' => 'Basque',
'bbc' => 'Batak Toba',
'bar' => 'Bavarian',
'bej' => 'Beja',
'be' => 'Belaruuse',
'bem' => 'Bemba',
'bez' => 'Bena',
'bn' => 'Bengali',
'bew' => 'Betawi',
'bho' => 'Bhojpuri',
'bik' => 'Bikol',
'bin' => 'Bini',
'bpy' => 'Bishnupriya',
'bi' => 'Bislama',
'byn' => 'Blin',
'zbl' => 'Blissymbols',
'brx' => 'Bodo',
'bs' => 'Bosnian',
'brh' => 'Brahui',
'bra' => 'Braj',
'pt_BR' => 'Brazilian Portuguese',
'br' => 'Breton',
'en_GB' => 'British English',
'bug' => 'Buginese',
'bg' => 'Bulgariire',
'bum' => 'Bulu',
'bua' => 'Buriat',
'my' => 'Burmeese',
'cad' => 'Caddo',
'frc' => 'Cajun French',
'en_CA' => 'Canadian English',
'fr_CA' => 'Canadian French',
'yue' => 'Cantonese',
'cps' => 'Capiznon',
'car' => 'Carib',
'ca' => 'Catalan',
'cay' => 'Cayuga',
'ceb' => 'Cebuano',
'cs' => 'Cekkere',
'tzm' => 'Central Atlas Tamazight',
'dtp' => 'Central Dusun',
'ckb' => 'Central Kurdish',
'esu' => 'Central Yupik',
'shu' => 'Chadian Arabic',
'chg' => 'Chagatai',
'ch' => 'Chamorro',
'ce' => 'Chechen',
'chr' => 'Cherokee',
'chy' => 'Cheyenne',
'chb' => 'Chibcha',
'cgg' => 'Chiga',
'qug' => 'Chimborazo Highland Quichua',
'chn' => 'Chinook Jargon',
'chp' => 'Chipewyan',
'cho' => 'Choctaw',
'cu' => 'Church Slavic',
'chk' => 'Chuukese',
'cv' => 'Chuvash',
'nwc' => 'Classical Newari',
'syc' => 'Classical Syriac',
'ksh' => 'Colognian',
'swb' => 'Comorian',
'swc' => 'Congo Swahili',
'cop' => 'Coptic',
'kw' => 'Cornish',
'co' => 'Corsican',
'cr' => 'Cree',
'mus' => 'Creek',
'crh' => 'Crimean Turkish',
'hr' => 'Croatian',
'nl' => 'Dacceere',
'dak' => 'Dakota',
'da' => 'Danish',
'dar' => 'Dargwa',
'dzg' => 'Dazaga',
'del' => 'Delaware',
'din' => 'Dinka',
'dv' => 'Divehi',
'de' => 'Docceere',
'doi' => 'Dogri',
'dgr' => 'Dogrib',
'dua' => 'Duala',
'dyu' => 'Dyula',
'dz' => 'Dzongkha',
'frs' => 'Eastern Frisian',
'efi' => 'Efik',
'arz' => 'Egyptian Arabic',
'eka' => 'Ekajuk',
'elx' => 'Elamite',
'ebu' => 'Embu',
'egl' => 'Emilian',
'id' => 'Endonesiire',
'en' => 'Engeleere',
'myv' => 'Erzya',
'es' => 'Español',
'eo' => 'Esperanto',
'et' => 'Estonian',
'pt_PT' => 'European Portuguese',
'es_ES' => 'European Spanish',
'ee' => 'Ewe',
'ewo' => 'Ewondo',
'ext' => 'Extremaduran',
'fan' => 'Fang',
'fat' => 'Fanti',
'fr' => 'Farayseere',
'fo' => 'Faroese',
'hif' => 'Fiji Hindi',
'fj' => 'Fijian',
'fil' => 'Filipino',
'fi' => 'Finnish',
'nl_BE' => 'Flemish',
'fon' => 'Fon',
'gur' => 'Frafra',
'fur' => 'Friulian',
'gaa' => 'Ga',
'gag' => 'Gagauz',
'gl' => 'Galician',
'gan' => 'Gan Chinese',
'lg' => 'Ganda',
'gay' => 'Gayo',
'gba' => 'Gbaya',
'gez' => 'Geez',
'ka' => 'Georgian',
'el' => 'Gerke',
'aln' => 'Gheg Albanian',
'bbj' => 'Ghomala',
'glk' => 'Gilaki',
'gil' => 'Gilbertese',
'gom' => 'Goan Konkani',
'gon' => 'Gondi',
'gor' => 'Gorontalo',
'got' => 'Gothic',
'grb' => 'Grebo',
'gn' => 'Guarani',
'gu' => 'Gujarati',
'guz' => 'Gusii',
'gwi' => 'Gwichʼin',
'hai' => 'Haida',
'ht' => 'Haitian',
'hak' => 'Hakka Chinese',
'haw' => 'Hawaiian',
'ha' => 'Hawsaŋkoore',
'he' => 'Hebrew',
'hz' => 'Herero',
'hil' => 'Hiligaynon',
'hi' => 'Hinndi',
'ho' => 'Hiri Motu',
'hit' => 'Hittite',
'hmn' => 'Hmong',
'hu' => 'Hongariire',
'hup' => 'Hupa',
'iba' => 'Iban',
'ibb' => 'Ibibio',
'is' => 'Icelandic',
'io' => 'Ido',
'ig' => 'Igiboore',
'ilo' => 'Iloko',
'smn' => 'Inari Sami',
'izh' => 'Ingrian',
'inh' => 'Ingush',
'ia' => 'Interlingua',
'ie' => 'Interlingue',
'iu' => 'Inuktitut',
'ik' => 'Inupiaq',
'ga' => 'Irish',
'it' => 'Italiyeere',
'jam' => 'Jamaican Creole English',
'kaj' => 'Jju',
'dyo' => 'Jola-Fonyi',
'jrb' => 'Judeo-Arabic',
'jpr' => 'Judeo-Persian',
'jut' => 'Jutish',
'kbd' => 'Kabardian',
'kea' => 'Kabuverdianu',
'kab' => 'Kabyle',
'kac' => 'Kachin',
'kgp' => 'Kaingang',
'kkj' => 'Kako',
'kl' => 'Kalaallisut',
'kln' => 'Kalenjin',
'xal' => 'Kalmyk',
'kam' => 'Kamba',
'kbl' => 'Kanembu',
'kn' => 'Kannada',
'kr' => 'Kanuri',
'kaa' => 'Kara-Kalpak',
'krc' => 'Karachay-Balkar',
'krl' => 'Karelian',
'ks' => 'Kashmiri',
'csb' => 'Kashubian',
'kaw' => 'Kawi',
'kk' => 'Kazakh',
'km' => 'Kemeere',
'ken' => 'Kenyang',
'kha' => 'Khasi',
'kho' => 'Khotanese',
'khw' => 'Khowar',
'ki' => 'Kikuyu',
'kmb' => 'Kimbundu',
'krj' => 'Kinaray-a',
'kiu' => 'Kirmanjki',
'tlh' => 'Klingon',
'bkm' => 'Kom',
'kv' => 'Komi',
'koi' => 'Komi-Permyak',
'kg' => 'Kongo',
'kok' => 'Konkani',
'ko' => 'Koreere',
'kfo' => 'Koro',
'kos' => 'Kosraean',
'avk' => 'Kotava',
'khq' => 'Koyra Chiini',
'ses' => 'Koyraboro Senni',
'kpe' => 'Kpelle',
'kri' => 'Krio',
'kj' => 'Kuanyama',
'kum' => 'Kumyk',
'ku' => 'Kurdish',
'kru' => 'Kurukh',
'kut' => 'Kutenai',
'nmg' => 'Kwasio',
'ky' => 'Kyrgyz',
'quc' => 'Kʼicheʼ',
'lad' => 'Ladino',
'lah' => 'Lahnda',
'lkt' => 'Lakota',
'lam' => 'Lamba',
'lag' => 'Langi',
'lo' => 'Lao',
'ltg' => 'Latgalian',
'la' => 'Latin',
'es_419' => 'Latin American Spanish',
'lv' => 'Latvian',
'lzz' => 'Laz',
'lez' => 'Lezghian',
'lij' => 'Ligurian',
'li' => 'Limburgish',
'ln' => 'Lingala',
'lfn' => 'Lingua Franca Nova',
'lzh' => 'Literary Chinese',
'lt' => 'Lithuanian',
'liv' => 'Livonian',
'jbo' => 'Lojban',
'lmo' => 'Lombard',
'nds' => 'Low German',
'sli' => 'Lower Silesian',
'dsb' => 'Lower Sorbian',
'loz' => 'Lozi',
'lu' => 'Luba-Katanga',
'lua' => 'Luba-Lulua',
'lui' => 'Luiseno',
'smj' => 'Lule Sami',
'lun' => 'Lunda',
'luo' => 'Luo',
'lb' => 'Luxembourgish',
'luy' => 'Luyia',
'mde' => 'Maba',
'mk' => 'Macedonian',
'jmc' => 'Machame',
'mad' => 'Madurese',
'maf' => 'Mafa',
'mag' => 'Magahi',
'vmf' => 'Main-Franconian',
'mai' => 'Maithili',
'mak' => 'Makasar',
'mgh' => 'Makhuwa-Meetto',
'kde' => 'Makonde',
'mg' => 'Malagasy',
'ml' => 'Malayalam',
'ms' => 'Malayeere',
'mt' => 'Maltese',
'mnc' => 'Manchu',
'mdr' => 'Mandar',
'man' => 'Mandingo',
'mni' => 'Manipuri',
'gv' => 'Manx',
'mi' => 'Maori',
'arn' => 'Mapuche',
'mr' => 'Marathi',
'chm' => 'Mari',
'mh' => 'Marshallese',
'mwr' => 'Marwari',
'mas' => 'Masai',
'mzn' => 'Mazanderani',
'byv' => 'Medumba',
'men' => 'Mende',
'mwv' => 'Mentawai',
'mer' => 'Meru',
'mgo' => 'Metaʼ',
'es_MX' => 'Mexican Spanish',
'mic' => 'Micmac',
'dum' => 'Middle Dutch',
'enm' => 'Middle English',
'frm' => 'Middle French',
'gmh' => 'Middle High German',
'mga' => 'Middle Irish',
'nan' => 'Min Nan Chinese',
'min' => 'Minangkabau',
'xmf' => 'Mingrelian',
'mwl' => 'Mirandese',
'lus' => 'Mizo',
'ar_001' => 'Modern Standard Arabic',
'moh' => 'Mohawk',
'mdf' => 'Moksha',
'ro_MD' => 'Moldavian',
'lol' => 'Mongo',
'mn' => 'Mongolian',
'mfe' => 'Morisyen',
'ary' => 'Moroccan Arabic',
'mos' => 'Mossi',
'mul' => 'Multiple Languages',
'mua' => 'Mundang',
'ttt' => 'Muslim Tat',
'mye' => 'Myene',
'naq' => 'Nama',
'na' => 'Nauru',
'nv' => 'Navajo',
'ng' => 'Ndonga',
'nap' => 'Neapolitan',
'ne' => 'Nepaaleere',
'new' => 'Newari',
'sba' => 'Ngambay',
'nnh' => 'Ngiemboon',
'jgo' => 'Ngomba',
'yrl' => 'Nheengatu',
'nia' => 'Nias',
'niu' => 'Niuean',
'zxx' => 'No linguistic content',
'nog' => 'Nogai',
'nd' => 'North Ndebele',
'frr' => 'Northern Frisian',
'se' => 'Northern Sami',
'nso' => 'Northern Sotho',
'no' => 'Norwegian',
'nb' => 'Norwegian Bokmål',
'nn' => 'Norwegian Nynorsk',
'nov' => 'Novial',
'nus' => 'Nuer',
'nym' => 'Nyamwezi',
'ny' => 'Nyanja',
'nyn' => 'Nyankole',
'tog' => 'Nyasa Tonga',
'nyo' => 'Nyoro',
'nzi' => 'Nzima',
'nqo' => 'NʼKo',
'oc' => 'Occitan',
'oj' => 'Ojibwa',
'ang' => 'Old English',
'fro' => 'Old French',
'goh' => 'Old High German',
'sga' => 'Old Irish',
'non' => 'Old Norse',
'peo' => 'Old Persian',
'pro' => 'Old Provençal',
'or' => 'Oriya',
'om' => 'Oromo',
'osa' => 'Osage',
'os' => 'Ossetic',
'ota' => 'Ottoman Turkish',
'pal' => 'Pahlavi',
'pfl' => 'Palatine German',
'pau' => 'Palauan',
'pi' => 'Pali',
'pam' => 'Pampanga',
'pag' => 'Pangasinan',
'pap' => 'Papiamento',
'ps' => 'Pashto',
'pdc' => 'Pennsylvania German',
'fa' => 'Perseere',
'phn' => 'Phoenician',
'pcd' => 'Picard',
'pms' => 'Piedmontese',
'pdt' => 'Plautdietsch',
'pon' => 'Pohnpeian',
'pl' => 'Poloneere',
'pnt' => 'Pontic',
'prg' => 'Prussian',
'ff' => 'Pulaar',
'pa' => 'Punjabeere',
'pt' => 'Purtugeere',
'qu' => 'Quechua',
'raj' => 'Rajasthani',
'rap' => 'Rapanui',
'rar' => 'Rarotongan',
'rif' => 'Riffian',
'ru' => 'Riis',
'rgn' => 'Romagnol',
'ro' => 'Romaneere',
'rm' => 'Romansh',
'rom' => 'Romany',
'rof' => 'Rombo',
'root' => 'Root',
'rtm' => 'Rotuman',
'rug' => 'Roviana',
'rn' => 'Rundi',
'rue' => 'Rusyn',
'rw' => 'Ruwaanndeere',
'rwk' => 'Rwa',
'ssy' => 'Saho',
'sah' => 'Sakha',
'sam' => 'Samaritan Aramaic',
'saq' => 'Samburu',
'sm' => 'Samoan',
'sgs' => 'Samogitian',
'sad' => 'Sandawe',
'sg' => 'Sango',
'sbp' => 'Sangu',
'sa' => 'Sanskrit',
'sat' => 'Santali',
'ja' => 'Saponeere',
'sc' => 'Sardinian',
'sas' => 'Sasak',
'sdc' => 'Sassarese Sardinian',
'stq' => 'Saterland Frisian',
'saz' => 'Saurashtra',
'jv' => 'Sawaneere',
'sco' => 'Scots',
'gd' => 'Scottish Gaelic',
'sly' => 'Selayar',
'sel' => 'Selkup',
'seh' => 'Sena',
'see' => 'Seneca',
'sr' => 'Serbian',
'sh' => 'Serbo-Croatian',
'srr' => 'Serer',
'sei' => 'Seri',
'ksb' => 'Shambala',
'shn' => 'Shan',
'sn' => 'Shona',
'ii' => 'Sichuan Yi',
'scn' => 'Sicilian',
'sid' => 'Sidamo',
'bla' => 'Siksika',
'szl' => 'Silesian',
'zh_Hans' => 'Simplified Chinese',
'sd' => 'Sindhi',
'si' => 'Sinhala',
'zh' => 'Sinuwaare',
'sms' => 'Skolt Sami',
'den' => 'Slave',
'sk' => 'Slovak',
'sl' => 'Slovenian',
'xog' => 'Soga',
'sog' => 'Sogdien',
'so' => 'Somalii',
'snk' => 'Soninke',
'azb' => 'South Azerbaijani',
'nr' => 'South Ndebele',
'alt' => 'Southern Altai',
'sma' => 'Southern Sami',
'st' => 'Southern Sotho',
'srn' => 'Sranan Tongo',
'zgh' => 'Standard Moroccan Tamazight',
'suk' => 'Sukuma',
'zu' => 'Suluŋkoore',
'sux' => 'Sumerian',
'su' => 'Sundanese',
'sus' => 'Susu',
'sw' => 'Swahili',
'ss' => 'Swati',
'sv' => 'Sweedeere',
'fr_CH' => 'Swiss French',
'gsw' => 'Swiss German',
'de_CH' => 'Swiss High German',
'syr' => 'Syriac',
'th' => 'Taay',
'shi' => 'Tachelhit',
'tl' => 'Tagalog',
'ty' => 'Tahitian',
'dav' => 'Taita',
'tg' => 'Tajik',
'tly' => 'Talysh',
'tmh' => 'Tamashek',
'ta' => 'Tamil',
'trv' => 'Taroko',
'twq' => 'Tasawaq',
'tt' => 'Tatar',
'te' => 'Telugu',
'ter' => 'Tereno',
'teo' => 'Teso',
'tet' => 'Tetum',
'bo' => 'Tibetan',
'tig' => 'Tigre',
'ti' => 'Tigrinya',
'tem' => 'Timne',
'tiv' => 'Tiv',
'tli' => 'Tlingit',
'tpi' => 'Tok Pisin',
'tkl' => 'Tokelau',
'to' => 'Tongan',
'fit' => 'Tornedalen Finnish',
'zh_Hant' => 'Traditional Chinese',
'tkr' => 'Tsakhur',
'tsd' => 'Tsakonian',
'tsi' => 'Tsimshian',
'ts' => 'Tsonga',
'tn' => 'Tswana',
'tcy' => 'Tulu',
'tum' => 'Tumbuka',
'aeb' => 'Tunisian Arabic',
'tr' => 'Turkeere',
'tk' => 'Turkmen',
'tru' => 'Turoyo',
'tvl' => 'Tuvalu',
'tyv' => 'Tuvinian',
'tw' => 'Twi',
'kcg' => 'Tyap',
'udm' => 'Udmurt',
'uga' => 'Ugaritic',
'uk' => 'Ukereneere',
'umb' => 'Umbundu',
'und' => 'Unknown Language',
'hsb' => 'Upper Sorbian',
'ur' => 'Urdu',
'ug' => 'Uyghur',
'uz' => 'Uzbek',
'vai' => 'Vai',
've' => 'Venda',
'vec' => 'Venetian',
'vep' => 'Veps',
'vo' => 'Volapük',
'vro' => 'Võro',
'vot' => 'Votic',
'vun' => 'Vunjo',
'wa' => 'Walloon',
'wae' => 'Walser',
'war' => 'Waray',
'wbp' => 'Warlpiri',
'was' => 'Washo',
'guc' => 'Wayuu',
'cy' => 'Welsh',
'vls' => 'West Flemish',
'fy' => 'Western Frisian',
'mrj' => 'Western Mari',
'vi' => 'Wiyetnameere',
'wal' => 'Wolaytta',
'wo' => 'Wolof',
'wuu' => 'Wu Chinese',
'xh' => 'Xhosa',
'hsn' => 'Xiang Chinese',
'yav' => 'Yangben',
'yao' => 'Yao',
'yap' => 'Yapese',
'ybb' => 'Yemba',
'yi' => 'Yiddish',
'yo' => 'Yorrubaa',
'zap' => 'Zapotec',
'dje' => 'Zarma',
'zza' => 'Zaza',
'zea' => 'Zeelandic',
'zen' => 'Zenaga',
'za' => 'Zhuang',
'gbz' => 'Zoroastrian Dari',
'zun' => 'Zuni',
);
| {
"pile_set_name": "Github"
} |
local assetHelper = asset.require('util/asset_helper')
local shared = asset.require('util/tle_helper')
local group = {
Title = "Kosmos 2251 Debris",
Url = "http://www.celestrak.com/NORAD/elements/cosmos-2251-debris.txt",
TrailColor = { 0.66, 0.8, 0.5 }
}
local tle = shared.downloadTLEFile(asset, group.Url, group.Title)
local objectNames = {}
shared.registerSatelliteGroupObjects(asset, group, tle, true)
| {
"pile_set_name": "Github"
} |
#ifndef BOOST_SERIALIZATION_BASE_OBJECT_HPP
#define BOOST_SERIALIZATION_BASE_OBJECT_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// base_object.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
// if no archive headers have been included this is a no op
// this is to permit BOOST_EXPORT etc to be included in a
// file declaration header
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/static_assert.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/void_cast_fwd.hpp>
namespace boost {
namespace serialization {
namespace detail
{
// get the base type for a given derived type
// preserving the const-ness
template<class B, class D>
struct base_cast
{
typedef BOOST_DEDUCED_TYPENAME
mpl::if_<
is_const<D>,
const B,
B
>::type type;
BOOST_STATIC_ASSERT(is_const<type>::value == is_const<D>::value);
};
// only register void casts if the types are polymorphic
template<class Base, class Derived>
struct base_register
{
struct polymorphic {
static void const * invoke(){
Base const * const b = 0;
Derived const * const d = 0;
return & void_cast_register(d, b);
}
};
struct non_polymorphic {
static void const * invoke(){
return 0;
}
};
static void const * invoke(){
typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
is_polymorphic<Base>,
mpl::identity<polymorphic>,
mpl::identity<non_polymorphic>
>::type type;
return type::invoke();
}
};
} // namespace detail
#if defined(__BORLANDC__) && __BORLANDC__ < 0x610
template<class Base, class Derived>
const Base &
base_object(const Derived & d)
{
BOOST_STATIC_ASSERT(! is_pointer<Derived>::value);
detail::base_register<Base, Derived>::invoke();
return access::cast_reference<const Base, Derived>(d);
}
#else
template<class Base, class Derived>
BOOST_DEDUCED_TYPENAME detail::base_cast<Base, Derived>::type &
base_object(Derived &d)
{
BOOST_STATIC_ASSERT(( is_base_and_derived<Base,Derived>::value));
BOOST_STATIC_ASSERT(! is_pointer<Derived>::value);
typedef BOOST_DEDUCED_TYPENAME detail::base_cast<Base, Derived>::type type;
detail::base_register<type, Derived>::invoke();
return access::cast_reference<type, Derived>(d);
}
#endif
} // namespace serialization
} // namespace boost
#endif // BOOST_SERIALIZATION_BASE_OBJECT_HPP
| {
"pile_set_name": "Github"
} |
[list.rulemetadata]
command:/usr/local/opnsense/scripts/suricata/listRuleMetadata.py
parameters:
type:script_output
message:request suricata rule metadata
[list.installablerulesets]
command:/usr/local/opnsense/scripts/suricata/listInstallableRulesets.py
parameters:
type:script_output
message:request installable rules
[install.rules]
command:/usr/local/opnsense/scripts/suricata/installRules.py
parameters:
type:script
message:install suricata rules
[list.alertlogs]
command:/usr/local/opnsense/scripts/suricata/listAlertLogs.py
parameters:
type:script_output
message:list available suricata alert logs
[drop.alertlog]
command:/usr/local/opnsense/scripts/suricata/dropAlertLog.py
parameters:%s
type:script_output
message:drop suricata alert log %s
[query.rules]
command:/usr/local/opnsense/scripts/suricata/queryInstalledRules.py
parameters:/limit %s /offset %s /filter %s /sort_by %s
type:script_output
message:request installed suricata rules
[query.alerts]
command:/usr/local/opnsense/scripts/suricata/queryAlertLog.py
parameters:/limit %s /offset %s /filter %s /fileid %s
type:script_output
message:query suricata alerts
[stop]
command:/usr/local/etc/rc.d/suricata stop
parameters:
type:script
message:stop suricata daemon
[start]
command:/usr/local/opnsense/scripts/suricata/setup.sh;/usr/local/etc/rc.d/suricata start
parameters:
type:script
message:start suricata daemon
[restart]
command:/usr/local/etc/rc.d/suricata restart
parameters:
type:script
message:restart suricata daemon
[status]
command:/usr/local/etc/rc.d/suricata status; exit 0
parameters:
type:script_output
message:get suricata daemon status
[update]
command:
/usr/local/opnsense/scripts/suricata/rule-updater.py &&
/usr/local/opnsense/scripts/suricata/installRules.py &&
pkill -USR2 suricata ;
exit 0
parameters:
type:script
message:update and reload intrusion detection rules
description:Update and reload intrusion detection rules
[reload]
command:/usr/local/opnsense/scripts/suricata/installRules.py && pkill -USR2 suricata
parameters:
type:script
message:reload intrusion detection rules
description:Reload intrusion detection rules
| {
"pile_set_name": "Github"
} |
/// @ref gtx_std_based_type
/// @file glm/gtx/std_based_type.hpp
///
/// @see core (dependence)
/// @see gtx_extented_min_max (dependence)
///
/// @defgroup gtx_std_based_type GLM_GTX_std_based_type
/// @ingroup gtx
///
/// Include <glm/gtx/std_based_type.hpp> to use the features of this extension.
///
/// Adds vector types based on STL value types.
#pragma once
// Dependency:
#include "../glm.hpp"
#include <cstdlib>
#ifndef GLM_ENABLE_EXPERIMENTAL
# error "GLM: GLM_GTX_std_based_type is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
#endif
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTX_std_based_type extension included")
#endif
namespace glm
{
/// @addtogroup gtx_std_based_type
/// @{
/// Vector type based of one std::size_t component.
/// @see GLM_GTX_std_based_type
typedef vec<1, std::size_t, defaultp> size1;
/// Vector type based of two std::size_t components.
/// @see GLM_GTX_std_based_type
typedef vec<2, std::size_t, defaultp> size2;
/// Vector type based of three std::size_t components.
/// @see GLM_GTX_std_based_type
typedef vec<3, std::size_t, defaultp> size3;
/// Vector type based of four std::size_t components.
/// @see GLM_GTX_std_based_type
typedef vec<4, std::size_t, defaultp> size4;
/// Vector type based of one std::size_t component.
/// @see GLM_GTX_std_based_type
typedef vec<1, std::size_t, defaultp> size1_t;
/// Vector type based of two std::size_t components.
/// @see GLM_GTX_std_based_type
typedef vec<2, std::size_t, defaultp> size2_t;
/// Vector type based of three std::size_t components.
/// @see GLM_GTX_std_based_type
typedef vec<3, std::size_t, defaultp> size3_t;
/// Vector type based of four std::size_t components.
/// @see GLM_GTX_std_based_type
typedef vec<4, std::size_t, defaultp> size4_t;
/// @}
}//namespace glm
#include "std_based_type.inl"
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <soc/tegra/fuse.h>
#include "soctherm.h"
#define NOMINAL_CALIB_FT 105
#define NOMINAL_CALIB_CP 25
#define FUSE_TSENSOR_CALIB_CP_TS_BASE_MASK 0x1fff
#define FUSE_TSENSOR_CALIB_FT_TS_BASE_MASK (0x1fff << 13)
#define FUSE_TSENSOR_CALIB_FT_TS_BASE_SHIFT 13
#define FUSE_TSENSOR_COMMON 0x180
/*
* Tegra210: Layout of bits in FUSE_TSENSOR_COMMON:
* 3 2 1 0
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | BASE_FT | BASE_CP | SHFT_FT | SHIFT_CP |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* Tegra12x, etc:
* In chips prior to Tegra210, this fuse was incorrectly sized as 26 bits,
* and didn't hold SHIFT_CP in [31:26]. Therefore these missing six bits
* were obtained via the FUSE_SPARE_REALIGNMENT_REG register [5:0].
*
* FUSE_TSENSOR_COMMON:
* 3 2 1 0
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |-----------| SHFT_FT | BASE_FT | BASE_CP |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* FUSE_SPARE_REALIGNMENT_REG:
* 3 2 1 0
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |---------------------------------------------------| SHIFT_CP |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
#define CALIB_COEFFICIENT 1000000LL
/**
* div64_s64_precise() - wrapper for div64_s64()
* @a: the dividend
* @b: the divisor
*
* Implements division with fairly accurate rounding instead of truncation by
* shifting the dividend to the left by 16 so that the quotient has a
* much higher precision.
*
* Return: the quotient of a / b.
*/
static s64 div64_s64_precise(s64 a, s32 b)
{
s64 r, al;
/* Scale up for increased precision division */
al = a << 16;
r = div64_s64(al * 2 + 1, 2 * b);
return r >> 16;
}
int tegra_calc_shared_calib(const struct tegra_soctherm_fuse *tfuse,
struct tsensor_shared_calib *shared)
{
u32 val;
s32 shifted_cp, shifted_ft;
int err;
err = tegra_fuse_readl(FUSE_TSENSOR_COMMON, &val);
if (err)
return err;
shared->base_cp = (val & tfuse->fuse_base_cp_mask) >>
tfuse->fuse_base_cp_shift;
shared->base_ft = (val & tfuse->fuse_base_ft_mask) >>
tfuse->fuse_base_ft_shift;
shifted_ft = (val & tfuse->fuse_shift_ft_mask) >>
tfuse->fuse_shift_ft_shift;
shifted_ft = sign_extend32(shifted_ft, 4);
if (tfuse->fuse_spare_realignment) {
err = tegra_fuse_readl(tfuse->fuse_spare_realignment, &val);
if (err)
return err;
}
shifted_cp = sign_extend32(val, 5);
shared->actual_temp_cp = 2 * NOMINAL_CALIB_CP + shifted_cp;
shared->actual_temp_ft = 2 * NOMINAL_CALIB_FT + shifted_ft;
return 0;
}
int tegra_calc_tsensor_calib(const struct tegra_tsensor *sensor,
const struct tsensor_shared_calib *shared,
u32 *calibration)
{
const struct tegra_tsensor_group *sensor_group;
u32 val, calib;
s32 actual_tsensor_ft, actual_tsensor_cp;
s32 delta_sens, delta_temp;
s32 mult, div;
s16 therma, thermb;
s64 temp;
int err;
sensor_group = sensor->group;
err = tegra_fuse_readl(sensor->calib_fuse_offset, &val);
if (err)
return err;
actual_tsensor_cp = (shared->base_cp * 64) + sign_extend32(val, 12);
val = (val & FUSE_TSENSOR_CALIB_FT_TS_BASE_MASK) >>
FUSE_TSENSOR_CALIB_FT_TS_BASE_SHIFT;
actual_tsensor_ft = (shared->base_ft * 32) + sign_extend32(val, 12);
delta_sens = actual_tsensor_ft - actual_tsensor_cp;
delta_temp = shared->actual_temp_ft - shared->actual_temp_cp;
mult = sensor_group->pdiv * sensor->config->tsample_ate;
div = sensor->config->tsample * sensor_group->pdiv_ate;
temp = (s64)delta_temp * (1LL << 13) * mult;
therma = div64_s64_precise(temp, (s64)delta_sens * div);
temp = ((s64)actual_tsensor_ft * shared->actual_temp_cp) -
((s64)actual_tsensor_cp * shared->actual_temp_ft);
thermb = div64_s64_precise(temp, delta_sens);
temp = (s64)therma * sensor->fuse_corr_alpha;
therma = div64_s64_precise(temp, CALIB_COEFFICIENT);
temp = (s64)thermb * sensor->fuse_corr_alpha + sensor->fuse_corr_beta;
thermb = div64_s64_precise(temp, CALIB_COEFFICIENT);
calib = ((u16)therma << SENSOR_CONFIG2_THERMA_SHIFT) |
((u16)thermb << SENSOR_CONFIG2_THERMB_SHIFT);
*calibration = calib;
return 0;
}
MODULE_AUTHOR("Wei Ni <[email protected]>");
MODULE_DESCRIPTION("Tegra SOCTHERM fuse management");
MODULE_LICENSE("GPL v2");
| {
"pile_set_name": "Github"
} |
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2007-2008 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_UNIT_SYSTEMS_METRIC_ARE_HPP_INCLUDED
#define BOOST_UNIT_SYSTEMS_METRIC_ARE_HPP_INCLUDED
#include <boost/units/conversion.hpp>
#include <boost/units/systems/si/area.hpp>
BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric, are, "are", "a", 1.0e2, si::area, 10);
#endif // BOOST_UNIT_SYSTEMS_METRIC_ARE_HPP_INCLUDED
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/web_dialog_helper.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "gin/dictionary.h"
#include "net/base/directory_lister.h"
#include "net/base/mime_util.h"
#include "shell/browser/electron_browser_context.h"
#include "shell/browser/javascript_environment.h"
#include "shell/browser/native_window.h"
#include "shell/browser/ui/file_dialog.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/file_path_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "ui/shell_dialogs/selected_file_info.h"
using blink::mojom::FileChooserFileInfo;
using blink::mojom::FileChooserFileInfoPtr;
using blink::mojom::FileChooserParams;
namespace {
class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
public content::WebContentsObserver,
public net::DirectoryLister::DirectoryListerDelegate {
public:
REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE();
FileSelectHelper(content::RenderFrameHost* render_frame_host,
scoped_refptr<content::FileSelectListener> listener,
blink::mojom::FileChooserParams::Mode mode)
: render_frame_host_(render_frame_host),
listener_(std::move(listener)),
mode_(mode) {
auto* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
content::WebContentsObserver::Observe(web_contents);
}
void ShowOpenDialog(const file_dialog::DialogSettings& settings) {
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
v8::HandleScope scope(isolate);
gin_helper::Promise<gin_helper::Dictionary> promise(isolate);
auto callback = base::BindOnce(&FileSelectHelper::OnOpenDialogDone, this);
ignore_result(promise.Then(std::move(callback)));
file_dialog::ShowOpenDialog(settings, std::move(promise));
}
void ShowSaveDialog(const file_dialog::DialogSettings& settings) {
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
v8::HandleScope scope(isolate);
gin_helper::Promise<gin_helper::Dictionary> promise(isolate);
auto callback = base::BindOnce(&FileSelectHelper::OnSaveDialogDone, this);
ignore_result(promise.Then(std::move(callback)));
file_dialog::ShowSaveDialog(settings, std::move(promise));
}
private:
friend class base::RefCounted<FileSelectHelper>;
~FileSelectHelper() override = default;
// net::DirectoryLister::DirectoryListerDelegate
void OnListFile(
const net::DirectoryLister::DirectoryListerData& data) override {
// We don't want to return directory paths, only file paths
if (data.info.IsDirectory())
return;
lister_paths_.push_back(data.path);
}
// net::DirectoryLister::DirectoryListerDelegate
void OnListDone(int error) override {
std::vector<FileChooserFileInfoPtr> file_info;
for (const auto& path : lister_paths_)
file_info.push_back(FileChooserFileInfo::NewNativeFile(
blink::mojom::NativeFileInfo::New(path, base::string16())));
OnFilesSelected(std::move(file_info), lister_base_dir_);
Release();
}
void EnumerateDirectory() {
// Ensure that this fn is only called once
DCHECK(!lister_);
DCHECK(!lister_base_dir_.empty());
DCHECK(lister_paths_.empty());
lister_ = std::make_unique<net::DirectoryLister>(
lister_base_dir_, net::DirectoryLister::NO_SORT_RECURSIVE, this);
lister_->Start();
// It is difficult for callers to know how long to keep a reference to
// this instance. We AddRef() here to keep the instance alive after we
// return to the caller. Once the directory lister is complete we
// Release() & at that point we run OnFilesSelected() which will
// deref the last reference held by the listener.
AddRef();
}
void OnOpenDialogDone(gin_helper::Dictionary result) {
std::vector<FileChooserFileInfoPtr> file_info;
bool canceled = true;
result.Get("canceled", &canceled);
// For certain file chooser modes (kUploadFolder) we need to do some async
// work before calling back to the listener. In that particular case the
// listener is called from the directory enumerator.
bool ready_to_call_listener = false;
if (canceled) {
OnSelectionCancelled();
} else {
std::vector<base::FilePath> paths;
if (result.Get("filePaths", &paths)) {
// If we are uploading a folder we need to enumerate its contents
if (mode_ == FileChooserParams::Mode::kUploadFolder &&
paths.size() >= 1) {
lister_base_dir_ = paths[0];
EnumerateDirectory();
} else {
for (auto& path : paths) {
file_info.push_back(FileChooserFileInfo::NewNativeFile(
blink::mojom::NativeFileInfo::New(
path, path.BaseName().AsUTF16Unsafe())));
}
ready_to_call_listener = true;
}
if (render_frame_host_ && !paths.empty()) {
auto* browser_context =
static_cast<electron::ElectronBrowserContext*>(
render_frame_host_->GetProcess()->GetBrowserContext());
browser_context->prefs()->SetFilePath(prefs::kSelectFileLastDirectory,
paths[0].DirName());
}
}
// We should only call this if we have not cancelled the dialog
if (ready_to_call_listener)
OnFilesSelected(std::move(file_info), lister_base_dir_);
}
}
void OnSaveDialogDone(gin_helper::Dictionary result) {
std::vector<FileChooserFileInfoPtr> file_info;
bool canceled = true;
result.Get("canceled", &canceled);
if (canceled) {
OnSelectionCancelled();
} else {
base::FilePath path;
if (result.Get("filePath", &path)) {
file_info.push_back(FileChooserFileInfo::NewNativeFile(
blink::mojom::NativeFileInfo::New(
path, path.BaseName().AsUTF16Unsafe())));
}
// We should only call this if we have not cancelled the dialog
OnFilesSelected(std::move(file_info), base::FilePath());
}
}
void OnFilesSelected(std::vector<FileChooserFileInfoPtr> file_info,
base::FilePath base_dir) {
if (listener_) {
listener_->FileSelected(std::move(file_info), base_dir, mode_);
listener_.reset();
}
render_frame_host_ = nullptr;
}
void OnSelectionCancelled() {
if (listener_) {
listener_->FileSelectionCanceled();
listener_.reset();
}
render_frame_host_ = nullptr;
}
// content::WebContentsObserver:
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override {
if (old_host == render_frame_host_)
render_frame_host_ = nullptr;
}
// content::WebContentsObserver:
void RenderFrameDeleted(content::RenderFrameHost* deleted_host) override {
if (deleted_host == render_frame_host_)
render_frame_host_ = nullptr;
}
// content::WebContentsObserver:
void WebContentsDestroyed() override { render_frame_host_ = nullptr; }
content::RenderFrameHost* render_frame_host_;
scoped_refptr<content::FileSelectListener> listener_;
blink::mojom::FileChooserParams::Mode mode_;
// DirectoryLister-specific members
std::unique_ptr<net::DirectoryLister> lister_;
base::FilePath lister_base_dir_;
std::vector<base::FilePath> lister_paths_;
};
file_dialog::Filters GetFileTypesFromAcceptType(
const std::vector<base::string16>& accept_types) {
file_dialog::Filters filters;
if (accept_types.empty())
return filters;
std::vector<base::FilePath::StringType> extensions;
int valid_type_count = 0;
std::string description;
for (const auto& accept_type : accept_types) {
std::string ascii_type = base::UTF16ToASCII(accept_type);
auto old_extension_size = extensions.size();
if (ascii_type[0] == '.') {
// If the type starts with a period it is assumed to be a file extension,
// like `.txt`, // so we just have to add it to the list.
base::FilePath::StringType extension(ascii_type.begin(),
ascii_type.end());
// Skip the first character.
extensions.push_back(extension.substr(1));
} else {
if (ascii_type == "image/*")
description = "Image Files";
else if (ascii_type == "audio/*")
description = "Audio Files";
else if (ascii_type == "video/*")
description = "Video Files";
// For MIME Type, `audio/*, video/*, image/*
net::GetExtensionsForMimeType(ascii_type, &extensions);
}
if (extensions.size() > old_extension_size)
valid_type_count++;
}
// If no valid extension is added, return empty filters.
if (extensions.empty())
return filters;
filters.push_back(file_dialog::Filter());
if (valid_type_count > 1 || (valid_type_count == 1 && description.empty()))
description = "Custom Files";
DCHECK(!description.empty());
filters[0].first = description;
for (const auto& extension : extensions) {
#if defined(OS_WIN)
filters[0].second.push_back(base::UTF16ToASCII(extension));
#else
filters[0].second.push_back(extension);
#endif
}
// Allow all files when extension is specified.
filters.push_back(file_dialog::Filter());
filters.back().first = "All Files";
filters.back().second.emplace_back("*");
return filters;
}
} // namespace
namespace electron {
WebDialogHelper::WebDialogHelper(NativeWindow* window, bool offscreen)
: window_(window), offscreen_(offscreen), weak_factory_(this) {}
WebDialogHelper::~WebDialogHelper() = default;
void WebDialogHelper::RunFileChooser(
content::RenderFrameHost* render_frame_host,
scoped_refptr<content::FileSelectListener> listener,
const blink::mojom::FileChooserParams& params) {
file_dialog::DialogSettings settings;
settings.force_detached = offscreen_;
settings.filters = GetFileTypesFromAcceptType(params.accept_types);
settings.parent_window = window_;
settings.title = base::UTF16ToUTF8(params.title);
auto file_select_helper = base::MakeRefCounted<FileSelectHelper>(
render_frame_host, std::move(listener), params.mode);
if (params.mode == FileChooserParams::Mode::kSave) {
settings.default_path = params.default_file_name;
file_select_helper->ShowSaveDialog(settings);
} else {
int flags = file_dialog::OPEN_DIALOG_CREATE_DIRECTORY;
switch (params.mode) {
case FileChooserParams::Mode::kOpenMultiple:
flags |= file_dialog::OPEN_DIALOG_MULTI_SELECTIONS;
FALLTHROUGH;
case FileChooserParams::Mode::kOpen:
flags |= file_dialog::OPEN_DIALOG_OPEN_FILE;
flags |= file_dialog::OPEN_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY;
break;
case FileChooserParams::Mode::kUploadFolder:
flags |= file_dialog::OPEN_DIALOG_OPEN_DIRECTORY;
break;
default:
NOTREACHED();
}
auto* browser_context = static_cast<electron::ElectronBrowserContext*>(
render_frame_host->GetProcess()->GetBrowserContext());
settings.default_path = browser_context->prefs()
->GetFilePath(prefs::kSelectFileLastDirectory)
.Append(params.default_file_name);
settings.properties = flags;
file_select_helper->ShowOpenDialog(settings);
}
}
void WebDialogHelper::EnumerateDirectory(
content::WebContents* web_contents,
scoped_refptr<content::FileSelectListener> listener,
const base::FilePath& dir) {
int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES |
base::FileEnumerator::INCLUDE_DOT_DOT;
base::FileEnumerator file_enum(dir, false, types);
base::FilePath path;
std::vector<FileChooserFileInfoPtr> file_info;
while (!(path = file_enum.Next()).empty()) {
file_info.push_back(FileChooserFileInfo::NewNativeFile(
blink::mojom::NativeFileInfo::New(path, base::string16())));
}
listener->FileSelected(std::move(file_info), dir,
FileChooserParams::Mode::kUploadFolder);
}
} // namespace electron
| {
"pile_set_name": "Github"
} |
// -*- swift -*-
//===----------------------------------------------------------------------===//
// Automatically Generated From validation-test/stdlib/Slice/Inputs/Template.swift.gyb
// Do Not Edit Directly!
//===----------------------------------------------------------------------===//
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// FIXME: the test is too slow when the standard library is not optimized.
// REQUIRES: optimized_stdlib
import StdlibUnittest
import StdlibCollectionUnittest
var SliceTests = TestSuite("Collection")
let prefix: [Int] = [-9999, -9998, -9997]
let suffix: [Int] = []
func makeCollection(elements: [OpaqueValue<Int>])
-> MutableRangeReplaceableBidirectionalSlice<DefaultedMutableRangeReplaceableBidirectionalCollection<OpaqueValue<Int>>> {
var baseElements = prefix.map(OpaqueValue.init)
baseElements.append(contentsOf: elements)
baseElements.append(contentsOf: suffix.map(OpaqueValue.init))
let base = DefaultedMutableRangeReplaceableBidirectionalCollection(elements: baseElements)
let startIndex = base.index(
base.startIndex,
offsetBy: numericCast(prefix.count))
let endIndex = base.index(
base.startIndex,
offsetBy: numericCast(prefix.count + elements.count))
return MutableRangeReplaceableBidirectionalSlice(
base: base,
bounds: startIndex..<endIndex)
}
func makeCollectionOfEquatable(elements: [MinimalEquatableValue])
-> MutableRangeReplaceableBidirectionalSlice<DefaultedMutableRangeReplaceableBidirectionalCollection<MinimalEquatableValue>> {
var baseElements = prefix.map(MinimalEquatableValue.init)
baseElements.append(contentsOf: elements)
baseElements.append(contentsOf: suffix.map(MinimalEquatableValue.init))
let base = DefaultedMutableRangeReplaceableBidirectionalCollection(elements: baseElements)
let startIndex = base.index(
base.startIndex,
offsetBy: numericCast(prefix.count))
let endIndex = base.index(
base.startIndex,
offsetBy: numericCast(prefix.count + elements.count))
return MutableRangeReplaceableBidirectionalSlice(
base: base,
bounds: startIndex..<endIndex)
}
func makeCollectionOfComparable(elements: [MinimalComparableValue])
-> MutableRangeReplaceableBidirectionalSlice<DefaultedMutableRangeReplaceableBidirectionalCollection<MinimalComparableValue>> {
var baseElements = prefix.map(MinimalComparableValue.init)
baseElements.append(contentsOf: elements)
baseElements.append(contentsOf: suffix.map(MinimalComparableValue.init))
let base = DefaultedMutableRangeReplaceableBidirectionalCollection(elements: baseElements)
let startIndex = base.index(
base.startIndex,
offsetBy: numericCast(prefix.count))
let endIndex = base.index(
base.startIndex,
offsetBy: numericCast(prefix.count + elements.count))
return MutableRangeReplaceableBidirectionalSlice(
base: base,
bounds: startIndex..<endIndex)
}
var resiliencyChecks = CollectionMisuseResiliencyChecks.all
resiliencyChecks.creatingOutOfBoundsIndicesBehavior = .trap
resiliencyChecks.subscriptOnOutOfBoundsIndicesBehavior = .trap
resiliencyChecks.subscriptRangeOnOutOfBoundsRangesBehavior = .trap
SliceTests.addRangeReplaceableBidirectionalSliceTests(
"MutableRangeReplaceableBidirectionalSlice_Of_DefaultedMutableRangeReplaceableBidirectionalCollection_WithPrefix.swift.",
makeCollection: makeCollection,
wrapValue: identity,
extractValue: identity,
makeCollectionOfEquatable: makeCollectionOfEquatable,
wrapValueIntoEquatable: identityEq,
extractValueFromEquatable: identityEq,
resiliencyChecks: resiliencyChecks,
outOfBoundsIndexOffset: 6
)
SliceTests.addMutableBidirectionalCollectionTests(
"MutableRangeReplaceableBidirectionalSlice_Of_DefaultedMutableRangeReplaceableBidirectionalCollection_WithPrefix.swift.",
makeCollection: makeCollection,
wrapValue: identity,
extractValue: identity,
makeCollectionOfEquatable: makeCollectionOfEquatable,
wrapValueIntoEquatable: identityEq,
extractValueFromEquatable: identityEq,
makeCollectionOfComparable: makeCollectionOfComparable,
wrapValueIntoComparable: identityComp,
extractValueFromComparable: identityComp,
resiliencyChecks: resiliencyChecks,
outOfBoundsIndexOffset: 6
, withUnsafeMutableBufferPointerIsSupported: false,
isFixedLengthCollection: true
)
runAllTests()
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8152.3" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8124.4"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
| {
"pile_set_name": "Github"
} |
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Contact:
// Moonlight Team ([email protected])
//
using System.Windows.Automation;
namespace System.Windows.Automation.Provider {
public interface IMultipleViewProvider {
string GetViewName (int viewId);
void SetCurrentView (int viewId);
int[] GetSupportedViews ();
int CurrentView { get; }
}
}
| {
"pile_set_name": "Github"
} |
(function catchExternalLinks() {
document.body.addEventListener('click', function externalLinkslistener(e) {
if (e.target && e.target.matches('a')) {
if (e.target.href) {
nw.Shell.openExternal(e.target.href);
e.stopPropagation();
}
e.preventDefault();
}
});
})();
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jagrosh.jdautilities.menu;
import java.awt.Color;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import com.jagrosh.jdautilities.commons.waiter.EventWaiter;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.entities.Emote;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.entities.MessageReaction.ReactionEmote;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
import net.dv8tion.jda.api.requests.RestAction;
import net.dv8tion.jda.internal.utils.Checks;
/**
* A {@link com.jagrosh.jdautilities.menu.Menu Menu} implementation that creates
* a organized display of emotes/emojis as buttons paired with options, and below
* the menu reactions corresponding to each button.
*
* @author John Grosh
*/
public class ButtonMenu extends Menu
{
private final Color color;
private final String text;
private final String description;
private final List<String> choices;
private final Consumer<ReactionEmote> action;
private final Consumer<Message> finalAction;
ButtonMenu(EventWaiter waiter, Set<User> users, Set<Role> roles, long timeout, TimeUnit unit,
Color color, String text, String description, List<String> choices, Consumer<ReactionEmote> action, Consumer<Message> finalAction)
{
super(waiter, users, roles, timeout, unit);
this.color = color;
this.text = text;
this.description = description;
this.choices = choices;
this.action = action;
this.finalAction = finalAction;
}
/**
* Shows the ButtonMenu as a new {@link net.dv8tion.jda.api.entities.Message Message}
* in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}.
*
* @param channel
* The MessageChannel to send the new Message to
*/
@Override
public void display(MessageChannel channel)
{
initialize(channel.sendMessage(getMessage()));
}
/**
* Displays this ButtonMenu by editing the provided {@link net.dv8tion.jda.api.entities.Message Message}.
*
* @param message
* The Message to display the Menu in
*/
@Override
public void display(Message message)
{
initialize(message.editMessage(getMessage()));
}
// Initializes the ButtonMenu using a Message RestAction
// This is either through editing a previously existing Message
// OR through sending a new one to a TextChannel.
private void initialize(RestAction<Message> ra)
{
ra.queue(m -> {
for(int i=0; i<choices.size(); i++)
{
// Get the emote to display.
Emote emote;
try {
emote = m.getJDA().getEmoteById(choices.get(i));
} catch(Exception e) {
emote = null;
}
// If the emote is null that means that it might be an emoji.
// If it's neither, that's on the developer and we'll let it
// throw an error when we queue a rest action.
RestAction<Void> r = emote==null ? m.addReaction(choices.get(i)) : m.addReaction(emote);
if(i+1<choices.size())
r.queue(); // If there is still more reactions to add we delay using the EventWaiter
else
{
// This is the last reaction added.
r.queue(v -> {
waiter.waitForEvent(MessageReactionAddEvent.class, event -> {
// If the message is not the same as the ButtonMenu
// currently being displayed.
if(!event.getMessageId().equals(m.getId()))
return false;
// If the reaction is an Emote we get the Snowflake,
// otherwise we get the unicode value.
String re = event.getReaction().getReactionEmote().isEmote()
? event.getReaction().getReactionEmote().getId()
: event.getReaction().getReactionEmote().getName();
// If the value we got is not registered as a button to
// the ButtonMenu being displayed we return false.
if(!choices.contains(re))
return false;
// Last check is that the person who added the reaction
// is a valid user.
return isValidUser(event.getUser(), event.isFromGuild() ? event.getGuild() : null);
}, (MessageReactionAddEvent event) -> {
// What happens next is after a valid event
// is fired and processed above.
// Preform the specified action with the ReactionEmote
action.accept(event.getReaction().getReactionEmote());
finalAction.accept(m);
}, timeout, unit, () -> finalAction.accept(m));
});
}
}
});
}
// Generates a ButtonMenu message
private Message getMessage()
{
MessageBuilder mbuilder = new MessageBuilder();
if(text!=null)
mbuilder.append(text);
if(description!=null)
mbuilder.setEmbed(new EmbedBuilder().setColor(color).setDescription(description).build());
return mbuilder.build();
}
/**
* The {@link com.jagrosh.jdautilities.menu.Menu.Builder Menu.Builder} for
* a {@link com.jagrosh.jdautilities.menu.ButtonMenu ButtonMenu}.
*
* @author John Grosh
*/
public static class Builder extends Menu.Builder<Builder, ButtonMenu>
{
private Color color;
private String text;
private String description;
private final List<String> choices = new LinkedList<>();
private Consumer<ReactionEmote> action;
private Consumer<Message> finalAction = (m) -> {};
/**
* Builds the {@link com.jagrosh.jdautilities.menu.ButtonMenu ButtonMenu}
* with this Builder.
*
* @return The OrderedMenu built from this Builder.
*
* @throws java.lang.IllegalArgumentException
* If one of the following is violated:
* <ul>
* <li>No {@link com.jagrosh.jdautilities.commons.waiter.EventWaiter EventWaiter} was set.</li>
* <li>No choices were set.</li>
* <li>No action {@link java.util.function.Consumer Consumer} was set.</li>
* <li>Neither text nor description were set.</li>
* </ul>
*/
@Override
public ButtonMenu build()
{
Checks.check(waiter != null, "Must set an EventWaiter");
Checks.check(!choices.isEmpty(), "Must have at least one choice");
Checks.check(action != null, "Must provide an action consumer");
Checks.check(text != null || description != null, "Either text or description must be set");
return new ButtonMenu(waiter, users, roles, timeout, unit, color, text, description, choices, action, finalAction);
}
/**
* Sets the {@link java.awt.Color Color} of the {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed}.
*
* @param color
* The Color of the MessageEmbed
*
* @return This builder
*/
public Builder setColor(Color color)
{
this.color = color;
return this;
}
/**
* Sets the text of the {@link net.dv8tion.jda.api.entities.Message Message} to be displayed
* when the {@link com.jagrosh.jdautilities.menu.ButtonMenu ButtonMenu} is built.
*
* <p>This is displayed directly above the embed.
*
* @param text
* The Message content to be displayed above the embed when the ButtonMenu is built
*
* @return This builder
*/
public Builder setText(String text)
{
this.text = text;
return this;
}
/**
* Sets the description to be placed in an {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed}.
* <br>If this is {@code null}, no MessageEmbed will be displayed
*
* @param description
* The content of the MessageEmbed's description
*
* @return This builder
*/
public Builder setDescription(String description)
{
this.description = description;
return this;
}
/**
* Sets the {@link java.util.function.Consumer Consumer} action to perform upon selecting a button.
*
* @param action
* The Consumer action to perform upon selecting a button
*
* @return This builder
*/
public Builder setAction(Consumer<ReactionEmote> action)
{
this.action = action;
return this;
}
/**
* Sets the {@link java.util.function.Consumer Consumer} to perform if the
* {@link com.jagrosh.jdautilities.menu.ButtonMenu ButtonMenu} is done,
* either via cancellation, a timeout, or a selection being made.<p>
*
* This accepts the message used to display the menu when called.
*
* @param finalAction
* The Runnable action to perform if the ButtonMenu is done
*
* @return This builder
*/
public Builder setFinalAction(Consumer<Message> finalAction)
{
this.finalAction = finalAction;
return this;
}
/**
* Adds a single String unicode emoji as a button choice.
*
* <p>Any non-unicode {@link net.dv8tion.jda.api.entities.Emote Emote} should be
* added using {@link ButtonMenu.Builder#addChoice(Emote)
* ButtonMenu.Builder#addChoice(Emote)}.
*
* @param emoji
* The String unicode emoji to add
*
* @return This builder
*/
public Builder addChoice(String emoji)
{
this.choices.add(emoji);
return this;
}
/**
* Adds a single custom {@link net.dv8tion.jda.api.entities.Emote Emote} as button choices.
*
* <p>Any regular unicode emojis should be added using {@link
* ButtonMenu.Builder#addChoice(String)
* ButtonMenu.Builder#addChoice(String)}.
*
* @param emote
* The Emote object to add
*
* @return This builder
*/
public Builder addChoice(Emote emote)
{
return addChoice(emote.getId());
}
/**
* Adds String unicode emojis as button choices.
*
* <p>Any non-unicode {@link net.dv8tion.jda.api.entities.Emote Emote}s should be
* added using {@link ButtonMenu.Builder#addChoices(Emote...)
* ButtonMenu.Builder#addChoices(Emote...)}.
*
* @param emojis
* The String unicode emojis to add
*
* @return This builder
*/
public Builder addChoices(String... emojis)
{
for(String emoji : emojis)
addChoice(emoji);
return this;
}
/**
* Adds custom {@link net.dv8tion.jda.api.entities.Emote Emote}s as button choices.
*
* <p>Any regular unicode emojis should be added using {@link
* ButtonMenu.Builder#addChoices(String...)
* ButtonMenu.Builder#addChoices(String...)}.
*
* @param emotes
* The Emote objects to add
*
* @return This builder
*/
public Builder addChoices(Emote... emotes)
{
for(Emote emote : emotes)
addChoice(emote);
return this;
}
/**
* Sets the String unicode emojis as button choices.
*
* <p>Any non-unicode {@link net.dv8tion.jda.api.entities.Emote Emote}s should be
* set using {@link ButtonMenu.Builder#setChoices(Emote...)
* ButtonMenu.Builder#setChoices(Emote...)}.
*
* @param emojis
* The String unicode emojis to set
*
* @return This builder
*/
public Builder setChoices(String... emojis)
{
this.choices.clear();
return addChoices(emojis);
}
/**
* Sets the {@link net.dv8tion.jda.api.entities.Emote Emote}s as button choices.
*
* <p>Any regular unicode emojis should be set using {@link
* ButtonMenu.Builder#setChoices(String...)
* ButtonMenu.Builder#setChoices(String...)}.
*
* @param emotes
* The Emote objects to set
*
* @return This builder
*/
public Builder setChoices(Emote... emotes)
{
this.choices.clear();
return addChoices(emotes);
}
}
}
| {
"pile_set_name": "Github"
} |
<?php
namespace Omeka\Api\Adapter;
use Doctrine\ORM\QueryBuilder;
use Omeka\Api\Request;
use Omeka\Entity\EntityInterface;
use Omeka\Stdlib\ErrorStore;
class JobAdapter extends AbstractEntityAdapter
{
protected $sortFields = [
'id' => 'id',
'status' => 'status',
'class' => 'class',
'started' => 'started',
'ended' => 'ended',
];
public function getResourceName()
{
return 'jobs';
}
public function getRepresentationClass()
{
return \Omeka\Api\Representation\JobRepresentation::class;
}
public function getEntityClass()
{
return \Omeka\Entity\Job::class;
}
public function hydrate(Request $request, EntityInterface $entity,
ErrorStore $errorStore
) {
}
public function sortQuery(QueryBuilder $qb, array $query)
{
if (is_string($query['sort_by'])) {
if ('owner_email' == $query['sort_by']) {
$ownerAlias = $this->createAlias();
$qb->leftJoin('omeka_root.owner', $ownerAlias)
->addOrderBy("$ownerAlias.email", $query['sort_order']);
} else {
parent::sortQuery($qb, $query);
}
}
}
public function buildQuery(QueryBuilder $qb, array $query)
{
if (isset($query['class'])) {
$qb->andWhere($qb->expr()->eq(
'omeka_root.class',
$this->createNamedParameter($qb, $query['class']))
);
}
if (isset($query['status'])) {
$qb->andWhere($qb->expr()->eq(
'omeka_root.status',
$this->createNamedParameter($qb, $query['status']))
);
}
}
}
| {
"pile_set_name": "Github"
} |
/* *********************************************************************** *
* project: org.matsim.*
* *
* *********************************************************************** *
* *
* copyright : (C) 2014 by the members listed in the COPYING, *
* LICENSE and WARRANTY file. *
* email : info at matsim dot org *
* *
* *********************************************************************** *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* See also COPYING, LICENSE and WARRANTY file *
* *
* *********************************************************************** */
package org.matsim.contrib.dvrp.tracker;
import org.matsim.api.core.v01.network.Link;
import org.matsim.contrib.dvrp.path.VrpPath;
import org.matsim.contrib.dvrp.path.VrpPathWithTravelData;
import org.matsim.contrib.dvrp.util.LinkTimePair;
/**
* @author michalm
*/
public interface OnlineDriveTaskTracker extends TaskTracker {
VrpPath getPath();
int getCurrentLinkIdx();
double getCurrentLinkEnterTime();
LinkTimePair getDiversionPoint();
void divertPath(VrpPathWithTravelData newSubPath);
void movedOverNode(Link nextLink);
}
| {
"pile_set_name": "Github"
} |
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018
process = cms.Process('SIM',Run2_2018)
# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2018Plan36Reco_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.Generator_cff')
process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic25ns13TeVEarly2018Collision_cfi')
process.load('GeneratorInterface.Core.genFilterSummary_cff')
process.load('Configuration.StandardSequences.EndOfProcess_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.load('Calibration.IsolatedParticles.studyCaloGen_cfi')
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(10),
output = cms.optional.untracked.allowed(cms.int32,cms.PSet)
)
# Input source
process.source = cms.Source("EmptySource")
process.options = cms.untracked.PSet(
FailPath = cms.untracked.vstring(),
IgnoreCompletely = cms.untracked.vstring(),
Rethrow = cms.untracked.vstring(),
SkipEvent = cms.untracked.vstring(),
allowUnscheduled = cms.obsolete.untracked.bool,
canDeleteEarly = cms.untracked.vstring(),
emptyRunLumiMode = cms.obsolete.untracked.string,
eventSetup = cms.untracked.PSet(
forceNumberOfConcurrentIOVs = cms.untracked.PSet(
),
numberOfConcurrentIOVs = cms.untracked.uint32(1)
),
fileMode = cms.untracked.string('FULLMERGE'),
forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False),
makeTriggerResults = cms.obsolete.untracked.bool,
numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1),
numberOfConcurrentRuns = cms.untracked.uint32(1),
numberOfStreams = cms.untracked.uint32(0),
numberOfThreads = cms.untracked.uint32(1),
printDependencies = cms.untracked.bool(False),
sizeOfStackForThreadsInKB = cms.optional.untracked.uint32,
throwIfIllegalParameter = cms.untracked.bool(True),
wantSummary = cms.untracked.bool(False)
)
# Production Info
process.configurationMetadata = cms.untracked.PSet(
annotation = cms.untracked.string('MinBias_13TeV_TuneCUETP8M1_cfi nevts:10'),
name = cms.untracked.string('Applications'),
version = cms.untracked.string('$Revision: 1.19 $')
)
# Other statements
process.genstepfilter.triggerConditions=cms.vstring("generation_step")
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '')
process.load("IOMC.RandomEngine.IOMC_cff")
process.RandomNumberGeneratorService.generator.initialSeed = 456789
process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876
process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789
process.rndmStore = cms.EDProducer("RandomEngineStateProducer")
from Configuration.Generator.PythiaUESettings_cfi import *
process.generator = cms.EDFilter("Pythia6GeneratorFilter",
pythiaHepMCVerbosity = cms.untracked.bool(False),
maxEventsToPrint = cms.untracked.int32(0),
pythiaPylistVerbosity = cms.untracked.int32(0),
filterEfficiency = cms.untracked.double(1.0),
comEnergy = cms.double(13000.0),
PythiaParameters = cms.PSet(
pythiaUESettingsBlock,
processParameters = cms.vstring('MSEL=0 ! User defined processes',
'MSUB(11)=1 ! Min bias process',
'MSUB(12)=1 ! Min bias process',
'MSUB(13)=1 ! Min bias process',
'MSUB(28)=1 ! Min bias process',
'MSUB(53)=1 ! Min bias process',
'MSUB(68)=1 ! Min bias process',
'MSUB(92)=1 ! Min bias process, single diffractive',
'MSUB(93)=1 ! Min bias process, single diffractive',
'MSUB(94)=1 ! Min bias process, double diffractive',
'MSUB(95)=1 ! Min bias process'),
# This is a vector of ParameterSet names to be read, in this order
parameterSets = cms.vstring('pythiaUESettings',
'processParameters')
)
)
process.TFileService = cms.Service("TFileService",
fileName = cms.string('studyCaloGen.root')
)
# Event output
process.FEVTDEBUGoutput = cms.OutputModule("PoolOutputModule",
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('generation_step')
),
dataset = cms.untracked.PSet(
dataTier = cms.untracked.string('GEN-SIM'),
filterName = cms.untracked.string('')
),
fileName = cms.untracked.string('file:simevent_minbias.root'),
outputCommands = process.FEVTDEBUGEventContent.outputCommands,
splitLevel = cms.untracked.int32(0)
)
process.ProductionFilterSequence = cms.Sequence(process.generator)
# Path and EndPath definitions
process.generation_step = cms.Path(process.pgen)
process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
process.endjob_step = cms.EndPath(process.endOfProcess)
process.analysis_step = cms.EndPath(process.studyCaloGen)
process.FEVTDEBUGoutput_step = cms.EndPath(process.FEVTDEBUGoutput)
# Schedule definition
process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.endjob_step,process.analysis_step,process.FEVTDEBUGoutput_step)
from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
associatePatAlgosToolsTask(process)
# filter all path with the production filter sequence
for path in process.paths:
getattr(process,path).insert(0, process.ProductionFilterSequence)
# Customisation from command line
# Add early deletion of temporary data products to reduce peak memory need
from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
process = customiseEarlyDelete(process)
# End adding early deletion
| {
"pile_set_name": "Github"
} |
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
| {
"pile_set_name": "Github"
} |
From 962c46bf7f43df730e2d3698930e77958cc6b191 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <[email protected]>
Date: Wed, 27 Jul 2016 11:35:45 +0200
Subject: [PATCH 04/16] Documentation: add BCM6348 pincontroller binding
documentation
Add binding documentation for the pincontrol core found in BCM6348 SoCs.
Signed-off-by: Jonas Gorski <[email protected]>
---
.../bindings/pinctrl/brcm,bcm6348-pinctrl.txt | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6348-pinctrl.txt
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6348-pinctrl.txt
@@ -0,0 +1,32 @@
+* Broadcom BCM6348 pin controller
+
+Required properties:
+- compatible: Must be "brcm,bcm6348-pinctrl".
+- reg: register Specifiers of dirout, dat, mode registers.
+- reg-names: Must be "dirout", "dat", "mode".
+- gpio-controller: Identifies this node as a GPIO controller.
+- #gpio-cells: Must be <2>.
+
+Example:
+
+pinctrl: pin-controller@fffe0080 {
+ compatible = "brcm,bcm6348-pinctrl";
+ reg = <0xfffe0080 0x8>,
+ <0xfffe0088 0x8>,
+ <0xfffe0098 0x4>;
+ reg-names = "dirout", "dat", "mode";
+
+ gpio-controller;
+ #gpio-cells = <2>;
+};
+
+Available pins/groups and functions:
+
+name pins functions
+-----------------------------------------------------------
+group0 32-36 ext_mii, utopia, diag
+group1 22-31 ext_ephy, mii_snoop, mii_pccard,
+ spi_master_uart, utopia, diag
+group2 16-21 pci, diag
+group3 8-15 ext_mii, utopia
+group4 0-7 ext_ephy, mii_snoop, legacy_led, diag
| {
"pile_set_name": "Github"
} |
---
lang: en
title: 'API docs: rest.resthttperrors.invalidparamlocation'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/rest
permalink: /doc/en/lb4/apidocs.rest.resthttperrors.invalidparamlocation.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/rest](./rest.md) > [RestHttpErrors](./rest.resthttperrors.md) > [invalidParamLocation](./rest.resthttperrors.invalidparamlocation.md)
## RestHttpErrors.invalidParamLocation() function
<b>Signature:</b>
```typescript
function invalidParamLocation(location: string): HttpErrors.HttpError;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| location | string | |
<b>Returns:</b>
HttpErrors.HttpError
| {
"pile_set_name": "Github"
} |
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-gc --allow-natives-syntax --verify-heap
var o = { f : 0 };
var shouldDeopt = true;
// This tests a scenario where a function has an embedded object reference,
// the function is lazy-deoptimized, the object is then collected, but the
// code object keeps the dangling pointer.
function deopt() {
if (shouldDeopt) {
// Change the global object. This deoptimizes function f because
// it optimistically embedded the reference to o as a constant.
o = { f : 2 };
// Collect the original object o; at this point, f should invalidate
// its invalid reference to the original object.
gc();
}
}
// Forwarding function to make sure that function f is not the topomost
// optimized frame (GC treats reference from topmost optimized code strongly).
function dummy_opt() { deopt(); }
function dummy() { dummy_opt(); }
%NeverOptimizeFunction(deopt);
%NeverOptimizeFunction(dummy);
// When optimized, the function f embeds the constant reference
// to the original object o.
function f() {
dummy();
return o.f;
}
shouldDeopt = false;
%PrepareFunctionForOptimization(dummy_opt);
f();
f();
%OptimizeFunctionOnNextCall(dummy_opt);
f();
%PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);
shouldDeopt = true;
assertEquals(2, f());
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 1990 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <errno.h>
#ifdef NEED_DECLARATION_ERRNO
extern int errno;
#endif
#if 0
#include <stdlib.h>
#endif
#include "ansidecl.h"
#include "safe-ctype.h"
#ifndef ULONG_MAX
#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
#endif
/*
* Convert a string to an unsigned long integer.
*
* Ignores `locale' stuff. Assumes that the upper and lower case
* alphabets and digits are each contiguous.
*/
unsigned long
strtoul(const char *nptr, char **endptr, register int base)
{
register const char *s = nptr;
register unsigned long acc;
register int c;
register unsigned long cutoff;
register int neg = 0, any, cutlim;
/*
* See strtol for comments as to the logic used.
*/
do {
c = *s++;
} while (ISSPACE(c));
if (c == '-') {
neg = 1;
c = *s++;
} else if (c == '+')
c = *s++;
if ((base == 0 || base == 16) &&
c == '0' && (*s == 'x' || *s == 'X')) {
c = s[1];
s += 2;
base = 16;
}
if (base == 0)
base = c == '0' ? 8 : 10;
cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
for (acc = 0, any = 0;; c = *s++) {
if (ISDIGIT(c))
c -= '0';
else if (ISALPHA(c))
c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
acc *= base;
acc += c;
}
}
if (any < 0) {
acc = ULONG_MAX;
errno = ERANGE;
} else if (neg)
acc = -acc;
if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr);
return (acc);
}
| {
"pile_set_name": "Github"
} |
var convert = require('./convert');
module.exports = convert('times', require('../times'));
| {
"pile_set_name": "Github"
} |
import boto3
from moto import mock_s3
from Output.export_final import lambda_handler
@mock_s3
def test_export_final():
manifest_content = b'{"source": "tech now mindy kaling at sxsw", "category": 1, "category-metadata": {"confidence": 1.0, "human-annotated": "yes", "type": "groundtruth/text-classification"}}'
s3r = boto3.resource('s3', region_name='us-east-1')
s3r.create_bucket(Bucket='source_bucket')
s3r.Object('source_bucket', 'input.manifest').put(Body=manifest_content)
s3r.create_bucket(Bucket='output_bucket')
event = {
'ManifestS3Uri': 's3://source_bucket/input.manifest',
'FinalOutputS3Uri': 's3://output_bucket/'
}
output = lambda_handler(event, {})
intermediate_body = s3r.Object('output_bucket', 'final_output.manifest').get()['Body'].read()
assert intermediate_body == manifest_content
assert output == "s3://output_bucket/final_output.manifest"
| {
"pile_set_name": "Github"
} |
//
// Copyright (c) 2020 Related Code - http://relatedcode.com
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
//-------------------------------------------------------------------------------------------------------------------------------------------------
class Walkthrough3View: UIViewController {
@IBOutlet var collectionView: UICollectionView!
@IBOutlet var pageControl: UIPageControl!
private var collections: [[String: String]] = []
//---------------------------------------------------------------------------------------------------------------------------------------------
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: pageControl)
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Skip", style: .done, target: self, action: #selector(actionSkip))
collectionView.register(UINib(nibName: "Walkthrough3Cell", bundle: nil), forCellWithReuseIdentifier: "Walkthrough3Cell")
pageControl.pageIndicatorTintColor = UIColor.lightGray
pageControl.currentPageIndicatorTintColor = AppColor.Theme
loadCollections()
}
// MARK: - Collections methods
//---------------------------------------------------------------------------------------------------------------------------------------------
func loadCollections() {
collections.removeAll()
var dict1: [String: String] = [:]
dict1["description"] = "It is those feelings that drive our love of astronomy and our desire to learn more and more about it. "
collections.append(dict1)
collections.append(dict1)
collections.append(dict1)
collections.append(dict1)
refreshCollectionView()
}
// MARK: - User actions
//---------------------------------------------------------------------------------------------------------------------------------------------
@objc func actionSkip() {
dismiss(animated: true)
}
// MARK: - Refresh methods
//---------------------------------------------------------------------------------------------------------------------------------------------
func refreshCollectionView() {
collectionView.reloadData()
}
}
// MARK:- UICollectionViewDataSource
//-------------------------------------------------------------------------------------------------------------------------------------------------
extension Walkthrough3View: UICollectionViewDataSource {
//---------------------------------------------------------------------------------------------------------------------------------------------
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return collections.count
}
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Walkthrough3Cell", for: indexPath) as! Walkthrough3Cell
cell.bindData(data: collections[indexPath.row])
return cell
}
}
// MARK:- UICollectionViewDelegate
//-------------------------------------------------------------------------------------------------------------------------------------------------
extension Walkthrough3View: UICollectionViewDelegate {
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("didSelectItemAt \(indexPath.row)")
}
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
pageControl.currentPage = indexPath.row
}
}
// MARK:- UICollectionViewDelegateFlowLayout
//-------------------------------------------------------------------------------------------------------------------------------------------------
extension Walkthrough3View: UICollectionViewDelegateFlowLayout {
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let height = collectionView.frame.size.height
let width = collectionView.frame.size.width
return CGSize(width: width, height: height)
}
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
//---------------------------------------------------------------------------------------------------------------------------------------------
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package capnslog
import (
"log"
)
func initHijack() {
pkg := NewPackageLogger("log", "")
w := packageWriter{pkg}
log.SetFlags(0)
log.SetPrefix("")
log.SetOutput(w)
}
type packageWriter struct {
pl *PackageLogger
}
func (p packageWriter) Write(b []byte) (int, error) {
if p.pl.level < INFO {
return 0, nil
}
p.pl.internalLog(calldepth+2, INFO, string(b))
return len(b), nil
}
| {
"pile_set_name": "Github"
} |
// Boost.Geometry
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_UTIL_SELECT_SEQUENCE_ELEMENT
#define BOOST_GEOMETRY_UTIL_SELECT_SEQUENCE_ELEMENT
#include <boost/mpl/if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/size.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/util/select_most_precise.hpp>
namespace boost { namespace geometry
{
namespace util
{
template <typename Curr, typename Next>
struct pred_more_precise_coordinate_type
{
typedef typename geometry::coordinate_type<Curr>::type curr_coord_t;
typedef typename geometry::coordinate_type<Next>::type next_coord_t;
typedef typename boost::mpl::if_c
<
boost::is_same
<
curr_coord_t,
typename select_most_precise
<
curr_coord_t,
next_coord_t
>::type
>::value,
Curr,
Next
>::type type;
};
template
<
typename Seq,
template<typename, typename> class Pred = pred_more_precise_coordinate_type,
int I = 0,
int N = boost::mpl::size<Seq>::value
>
struct select_sequence_element
{
typedef typename boost::mpl::at<Seq, boost::mpl::int_<I> >::type curr_t;
typedef typename select_sequence_element<Seq, Pred, I+1, N>::type next_t;
typedef typename Pred<curr_t, next_t>::type type;
};
template <typename Seq, template<typename, typename> class Pred, int N>
struct select_sequence_element<Seq, Pred, N, N>
{
typedef typename boost::mpl::at<Seq, boost::mpl::int_<N-1> >::type type;
};
} // namespace util
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_UTIL_SELECT_SEQUENCE_ELEMENT
| {
"pile_set_name": "Github"
} |
#cloud-config
<%= cloud_config_yaml %>
hostname: <%= hostname %> | {
"pile_set_name": "Github"
} |
var searchData=
[
['write_5fhandler',['write_handler',['../structguac__audio__encoder.html#a1b74c3dd402b0a6afa5f5b9000d02c74',1,'guac_audio_encoder::write_handler()'],['../structguac__socket.html#a0f5f24200b0dad4ef1443b863d1bfc7d',1,'guac_socket::write_handler()']]]
];
| {
"pile_set_name": "Github"
} |
if the current trends of hollywood filmmaking continue , we are probably five or six years away from the moment when the 1980s would become the next golden age of movie nostalgia .
although some hollywood products already use the last decade as a background for their stories ( mostly in ironic way , like grosse pointe blank and romy & michelle's high school reunion ) , some time should pass before the good memories of that era overcome the bad ones .
until that happens , 1980s would be remembered as the decade of greed , when the revolutionary ideals of 1960s turned into its cruel , materialistic opposite and the money became the only thing that matters .
contemporary movies are good in illustrating what was bad for the people who had to live in those times .
one of such movies , one that probably brings the essence of 1980s to the screen , is william friedkin's to live and die in l . a .
the money isn't just the symbolic motive in the film , it is the major elements of the plot .
rick masters ( willem dafoe ) is an ex-convict who used his artistic abilities in order to become one of the best counterfeiters in l . a . being too intelligent to fall into police traps , and ruthless enough to eliminate anybody or anything that could jeopardise his career , masters managed to elude law for years and became well- connected .
richard chance ( william l . petersen ) is a secret service agent , adrenaline junkie whose life gets new meaning after his partner got killed by masters .
however , his plans of bringing the counterfeiter down meet one obstacle after another .
finally he sets up a final sting , but his superiors deny him the necessary money .
being frustrated , and against the reluctance of his new partner john vukovich ( bill pankow ) , he decides to get the money by robbing underworld courier .
their plan backfires with almost tragic consequences when their target turns out to be undercover fbi agent , but chance decides to carry out his scheme anyway .
like french connection , one of his previous masterpieces , this friedkin's movie was inspired by real life .
gerrald petievich , author of the novel that later served as basis for his screenplay , spent many years working as a secret service agent .
that turned to be useful for the portrayal of that law enforcement agency , not much utilised by hollywood .
secret service millieu was also cleverly used in order to bring the viewer into the decade of greed ; the beginning scene where the movie's hero works as a part of presidential security detail is a nice opportunity to hear reagan's speech that could illustrate the political and economical notions of those times .
ultramaterialistic and egotistical view of the world is shared by almost any character in the movie .
willem dafoe brilliantly portrays dangerous and intelligent psychopath , whose ruthlessness and lack of any moral fibber doesn't seem like affliction in the reagan years ; on the contrary , those qualities actually makes masters socially acceptable .
compared with him , and all the other side characters that want their " piece of the action " , two heroes on the side of law seem like losers .
instead of being a classical good guy , secret service agent richard chance ( portrayed by william petersen in his most impressive role so far ) is nothing more than a lunatic whose adrenaline addiction and madness work against his better judgement ; his sidekick , who should serve as those " better judgement " is a weakling and sentimental fool that gets suckered in the end .
in such surroundings of moral decay , the not so happy , yet surprising ending doesn't seem out of line ( although the very last shot leaves too much questions unanswered ) .
the dark atmosphere of l . a . - city of glamour and moral decay - is nicely captured by william friedkin's directing skills .
the tight and realistic scripts with memorable characters ( portrayed by such capable actors like john turturro , dean stockwell , debra feuer , darlanne fleugel and steve james ) gave opportunity for friedkin to use another gimmick that made him famous in his 1971 masterpiece - great car chase .
that scene alone , with lot of realism , thrills and surprise twists , is worth seeing the rest of the film .
the soundtrack , provided by now almost forgotten band " wang chung " , is also one of the more memorable of that decade .
in every case , to live and die in l . a . is one of the rare movies in which hollywood actually tries to tell some unflattering truths about the world and succeeds in it .
| {
"pile_set_name": "Github"
} |
import * as path from 'path';
import { EOL } from 'os';
import { listFiles } from './../utils';
import type { RuleDefinitions, ConfigRules } from './../types';
import { defaultRules } from '../default-rules';
import { getPluginRuleDefinitions } from './get-plugin-rule-definitions';
export const RULE_SUFFIX = '.rule.js';
const stripOutSuffix = (str: string): string => {
return str.substring(0, str.length - RULE_SUFFIX.length);
};
export const getRuleDefinitions = (
rules: ConfigRules,
rulesDir?: string | string[] | undefined,
pluginNames?: string[] | undefined,
): RuleDefinitions => {
const rulesToResolve = Object.keys(rules);
let allRulesResolved: RuleDefinitions = {};
if (rulesDir) {
const rulesDirArr = Array.isArray(rulesDir) ? rulesDir : [rulesDir];
const customRuleFiles = rulesDirArr.reduce(
(acc, dir) => [...acc, ...listFiles(dir).filter((i) => i.endsWith(RULE_SUFFIX))],
[] as string[],
);
allRulesResolved = customRuleFiles.reduce((acc, filePath: string) => {
const ruleName = stripOutSuffix(path.basename(filePath));
if (!rulesToResolve.includes(ruleName)) {
return acc;
}
// eslint-disable-next-line @typescript-eslint/no-var-requires
const rule = require(filePath);
if (!rule.onProject) {
throw new Error(`Rule ${ruleName} should have onProject.`);
}
acc[ruleName] = rule;
return acc;
}, {} as RuleDefinitions);
}
const pluginRules = pluginNames ? getPluginRuleDefinitions(pluginNames) : {};
const externalRules = { ...defaultRules, ...pluginRules };
allRulesResolved = Object.entries(externalRules).reduce((acc, [ruleName, rule]) => {
if (!rulesToResolve.includes(ruleName)) {
return acc;
}
acc[ruleName] = rule;
return acc;
}, allRulesResolved);
const foundRules = Object.keys(allRulesResolved);
const notExistingRules = rulesToResolve.filter((ruleName) => !foundRules.includes(ruleName));
if (notExistingRules.length) {
throw new Error(
`Unable to find definitions for following rules:${EOL}${notExistingRules.join(EOL)}`,
);
}
return allRulesResolved;
};
| {
"pile_set_name": "Github"
} |
using System.Threading.Tasks;
using AppKit;
using PointF = CoreGraphics.CGPoint;
namespace Xamarin.Forms.Platform.MacOS
{
internal static class NSScrollViewExtensions
{
public static Task ScrollToPositionAsync(this NSScrollView scrollView, PointF point, bool animate,
double duration = 0.5)
{
if (!animate)
{
var nsView = scrollView.DocumentView as NSView;
nsView?.ScrollPoint(point);
return Task.FromResult(true);
}
TaskCompletionSource<bool> source = new TaskCompletionSource<bool>();
NSAnimationContext.BeginGrouping();
NSAnimationContext.CurrentContext.CompletionHandler += () => { source.TrySetResult(true); };
NSAnimationContext.CurrentContext.Duration = duration;
var animator = scrollView.ContentView.Animator as NSView;
animator?.SetBoundsOrigin(point);
NSAnimationContext.EndGrouping();
return source.Task;
}
}
} | {
"pile_set_name": "Github"
} |
/*
* Copyright 2013-2020 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package brave.propagation;
import brave.Span;
import brave.Tracer;
import brave.Tracer.SpanInScope;
import brave.Tracing;
import brave.internal.Nullable;
import java.util.ArrayDeque;
/**
* This type allows you to place a span in scope in one method and access it in another without
* using an explicit request parameter.
*
* <p>Many libraries expose a callback model as opposed to an interceptor one. When creating new
* instrumentation, you may find places where you need to place a span in scope in one callback
* (like `onStart()`) and end the scope in another callback (like `onFinish()`).
*
* <p>Provided the library guarantees these run on the same thread, you can simply propagate the
* result of {@link Tracer#startScopedSpan(String)} or {@link Tracer#withSpanInScope(Span)} from the
* starting callback to the closing one. This is typically done with a request-scoped attribute.
*
* Here's an example:
* <pre>{@code
* class MyFilter extends Filter {
* public void onStart(Request request, Attributes attributes) {
* // Assume you have code to start the span and add relevant tags...
*
* // We now set the span in scope so that any code between here and
* // the end of the request can see it with Tracer.currentSpan()
* SpanInScope spanInScope = tracer.withSpanInScope(span);
*
* // We don't want to leak the scope, so we place it somewhere we can
* // lookup later
* attributes.put(SpanInScope.class, spanInScope);
* }
*
* public void onFinish(Response response, Attributes attributes) {
* // as long as we are on the same thread, we can read the span started above
* Span span = tracer.currentSpan();
*
* // Assume you have code to complete the span
*
* // We now remove the scope (which implicitly detaches it from the span)
* attributes.remove(SpanInScope.class).close();
* }
* }
* }</pre>
*
* <p>Sometimes you have to instrument a library where There's no attribute namespace shared across
* request and response. For this scenario, you can use {@link ThreadLocalSpan} to temporarily store
* the span between callbacks.
*
* Here's an example:
* <pre>{@code
* class MyFilter extends Filter {
* final ThreadLocalSpan threadLocalSpan;
*
* public void onStart(Request request) {
* // Allocates a span and places it in scope so that code between here and onFinish can see it
* Span span = threadLocalSpan.next();
* if (span == null || span.isNoop()) return; // skip below logic on noop
*
* // Assume you have code to start the span and add relevant tags...
* }
*
* public void onFinish(Response response, Attributes attributes) {
* // as long as we are on the same thread, we can read the span started above
* Span span = threadLocalSpan.remove();
* if (span == null || span.isNoop()) return; // skip below logic on noop
*
* // Assume you have code to complete the span
* }
* }
* }</pre>
*/
public class ThreadLocalSpan {
/**
* This uses the {@link Tracing#currentTracer()}, which means calls to {@link #next()} may return
* null. Use this when you have no other means to get a reference to the tracer. For example, JDBC
* connections, as they often initialize prior to the tracing component.
*/
public static final ThreadLocalSpan CURRENT_TRACER = new ThreadLocalSpan(null);
public static ThreadLocalSpan create(Tracer tracer) {
if (tracer == null) throw new NullPointerException("tracer == null");
return new ThreadLocalSpan(tracer);
}
@Nullable final Tracer tracer;
ThreadLocalSpan(Tracer tracer) {
this.tracer = tracer;
}
Tracer tracer() {
return tracer != null ? tracer : Tracing.currentTracer();
}
/**
* Returns the {@link Tracer#nextSpan(TraceContextOrSamplingFlags)} or null if {@link
* #CURRENT_TRACER} and tracing isn't available.
*/
@Nullable public Span next(TraceContextOrSamplingFlags extracted) {
Tracer tracer = tracer();
if (tracer == null) return null;
Span next = tracer.nextSpan(extracted);
SpanAndScope spanAndScope = new SpanAndScope(next, tracer.withSpanInScope(next));
getCurrentSpanInScopeStack().addFirst(spanAndScope);
return next;
}
/**
* Returns the {@link Tracer#nextSpan()} or null if {@link #CURRENT_TRACER} and tracing isn't
* available.
*/
@Nullable public Span next() {
Tracer tracer = tracer();
if (tracer == null) return null;
Span next = tracer.nextSpan();
SpanAndScope spanAndScope = new SpanAndScope(next, tracer.withSpanInScope(next));
getCurrentSpanInScopeStack().addFirst(spanAndScope);
return next;
}
static final class SpanAndScope {
final Span span;
final SpanInScope spanInScope;
SpanAndScope(Span span, SpanInScope spanInScope) {
this.span = span;
this.spanInScope = spanInScope;
}
}
/**
* Returns the span set in scope via {@link #next()} or null if there was none.
*
* <p>When assertions are on, this will throw an assertion error if the span returned was not the
* one currently in context. This could happen if someone called {@link
* Tracer#withSpanInScope(Span)} or {@link CurrentTraceContext#newScope(TraceContext)} outside a
* try/finally block.
*/
@Nullable public Span remove() {
Tracer tracer = tracer();
Span currentSpan = tracer != null ? tracer.currentSpan() : null;
SpanAndScope spanAndScope = getCurrentSpanInScopeStack().pollFirst();
if (spanAndScope == null) return currentSpan;
Span span = spanAndScope.span;
spanAndScope.spanInScope.close();
assert span.equals(currentSpan) :
"Misalignment: scoped span " + span + " != current span " + currentSpan;
return currentSpan;
}
/**
* This keeps track of a stack with a normal array dequeue. Redundant stacking of the same span is
* not possible because there is no api to place an arbitrary span in scope using this api.
*/
@SuppressWarnings("ThreadLocalUsage") // intentional: to support multiple Tracer instances
final ThreadLocal<ArrayDeque<SpanAndScope>> currentSpanInScopeStack = new ThreadLocal<>();
ArrayDeque<SpanAndScope> getCurrentSpanInScopeStack() {
ArrayDeque<SpanAndScope> stack = currentSpanInScopeStack.get();
if (stack == null) {
stack = new ArrayDeque<>();
currentSpanInScopeStack.set(stack);
}
return stack;
}
}
| {
"pile_set_name": "Github"
} |
module ansible-service-broker 1.0;
require {
type unreserved_port_t;
type http_port_t;
type init_t;
class tcp_socket name_connect;
#These should go away when need for .kube.config goes away
type user_home_t;
class file { execute execute_no_trans };
}
#============= init_t ==============
allow init_t http_port_t:tcp_socket name_connect;
allow init_t unreserved_port_t:tcp_socket name_connect;
#This should go away when need for .kube.config goes away
allow init_t user_home_t:file { execute execute_no_trans };
| {
"pile_set_name": "Github"
} |
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright 2017 Accton Technology Corporation.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#include <unistd.h>
#include <fcntl.h>
#include <onlplib/file.h>
#include <onlp/platformi/sysi.h>
#include <onlp/platformi/ledi.h>
#include <onlp/platformi/thermali.h>
#include <onlp/platformi/fani.h>
#include <onlp/platformi/psui.h>
#include "platform_lib.h"
#include "x86_64_accton_as7316_26xb_int.h"
#include "x86_64_accton_as7316_26xb_log.h"
const char*
onlp_sysi_platform_get(void)
{
return "x86-64-accton-as7316-26xb-r0";
}
int
onlp_sysi_onie_data_get(uint8_t** data, int* size)
{
uint8_t* rdata = aim_zmalloc(256);
if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) {
if(*size == 256) {
*data = rdata;
return ONLP_STATUS_OK;
}
}
aim_free(rdata);
*size = 0;
return ONLP_STATUS_E_INTERNAL;
}
int
onlp_sysi_oids_get(onlp_oid_t* table, int max)
{
int i;
onlp_oid_t* e = table;
memset(table, 0, max*sizeof(onlp_oid_t));
/* 5 Thermal sensors on the chassis */
for (i = 1; i <= CHASSIS_THERMAL_COUNT; i++) {
*e++ = ONLP_THERMAL_ID_CREATE(i);
}
/* 5 LEDs on the chassis */
for (i = 1; i <= CHASSIS_LED_COUNT; i++) {
*e++ = ONLP_LED_ID_CREATE(i);
}
/* 2 PSUs on the chassis */
for (i = 1; i <= CHASSIS_PSU_COUNT; i++) {
*e++ = ONLP_PSU_ID_CREATE(i);
}
/* 6 Fans on the chassis */
for (i = 1; i <= CHASSIS_FAN_COUNT; i++) {
*e++ = ONLP_FAN_ID_CREATE(i);
}
return 0;
}
int
onlp_sysi_platform_info_get(onlp_platform_info_t* pi)
{
return ONLP_STATUS_OK;
}
void
onlp_sysi_platform_info_free(onlp_platform_info_t* pi)
{
aim_free(pi->cpld_versions);
}
| {
"pile_set_name": "Github"
} |
#include <fc/exception/exception.hpp>
#include <fc/io/fstream.hpp>
#include <fc/log/file_appender.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/thread/scoped_lock.hpp>
#include <fc/thread/thread.hpp>
#include <fc/variant.hpp>
#include <boost/thread/mutex.hpp>
#include <iomanip>
#include <queue>
#include <sstream>
namespace fc {
class file_appender::impl {
public:
config cfg;
ofstream out;
boost::mutex slock;
private:
future<void> _rotation_task;
time_point_sec _current_file_start_time;
time_point_sec get_file_start_time(const time_point_sec& timestamp, const microseconds& interval) {
int64_t interval_seconds = interval.to_seconds();
int64_t file_number = timestamp.sec_since_epoch() / interval_seconds;
return time_point_sec((uint32_t)(file_number * interval_seconds));
}
public:
impl(const config& c)
: cfg(c) {
if(cfg.rotate) {
FC_ASSERT(cfg.rotation_interval >= seconds(1));
FC_ASSERT(cfg.rotation_limit >= cfg.rotation_interval);
_rotation_task = async([this]() { rotate_files(true); }, "rotate_files(1)");
}
}
~impl() {
try {
_rotation_task.cancel_and_wait("file_appender is destructing");
}
catch(...) {
}
}
void rotate_files(bool initializing = false) {
FC_ASSERT(cfg.rotate);
fc::time_point now = time_point::now();
fc::time_point_sec start_time = get_file_start_time(now, cfg.rotation_interval);
string timestamp_string = start_time.to_non_delimited_iso_string();
fc::path link_filename = cfg.filename;
fc::path log_filename = link_filename.parent_path() / (link_filename.filename().string() + "." + timestamp_string);
{
fc::scoped_lock<boost::mutex> lock(slock);
if(!initializing) {
if(start_time <= _current_file_start_time) {
_rotation_task = schedule([this]() { rotate_files(); },
_current_file_start_time + cfg.rotation_interval.to_seconds(),
"rotate_files(2)");
return;
}
out.flush();
out.close();
}
remove_all(link_filename); // on windows, you can't delete the link while the underlying file is opened for writing
if(fc::exists(log_filename))
out.open(log_filename, std::ios_base::out | std::ios_base::app);
else
out.open(log_filename, std::ios_base::out | std::ios_base::app);
create_hard_link(log_filename, link_filename);
}
/* Delete old log files */
fc::time_point limit_time = now - cfg.rotation_limit;
string link_filename_string = link_filename.filename().string();
directory_iterator itr(link_filename.parent_path());
for(; itr != directory_iterator(); itr++) {
try {
string current_filename = itr->filename().string();
if(current_filename.compare(0, link_filename_string.size(), link_filename_string) != 0 || current_filename.size() <= link_filename_string.size() + 1)
continue;
string current_timestamp_str = current_filename.substr(link_filename_string.size() + 1,
timestamp_string.size());
fc::time_point_sec current_timestamp = fc::time_point_sec::from_iso_string(current_timestamp_str);
if(current_timestamp < start_time) {
if(current_timestamp < limit_time || file_size(current_filename) <= 0) {
remove_all(*itr);
continue;
}
}
}
catch(const fc::canceled_exception&) {
throw;
}
catch(...) {
}
}
_current_file_start_time = start_time;
_rotation_task = schedule([this]() { rotate_files(); },
_current_file_start_time + cfg.rotation_interval.to_seconds(),
"rotate_files(3)");
}
};
file_appender::config::config(const fc::path& p)
: format("${timestamp} ${thread_name} ${context} ${file}:${line} ${method} ${level}] ${message}")
, filename(p)
, flush(true)
, rotate(false) {}
file_appender::file_appender(const variant& args)
: my(new impl(args.as<config>())) {
try {
fc::create_directories(my->cfg.filename.parent_path());
if(!my->cfg.rotate)
my->out.open(my->cfg.filename, std::ios_base::out | std::ios_base::app);
}
catch(...) {
std::cerr << "error opening log file: " << my->cfg.filename.preferred_string() << "\n";
}
}
file_appender::~file_appender() {}
// MS THREAD METHOD MESSAGE \t\t\t File:Line
void
file_appender::log(const log_message& m) {
std::stringstream line;
//line << (m.get_context().get_timestamp().time_since_epoch().count() % (1000ll*1000ll*60ll*60))/1000 <<"ms ";
line << string(m.get_context().get_timestamp()) << " ";
line << std::setw(21) << (m.get_context().get_thread_name().substr(0, 9) + string(":") + m.get_context().get_task_name()).c_str() << " ";
string method_name = m.get_context().get_method();
// strip all leading scopes...
if(method_name.size()) {
uint32_t p = 0;
for(uint32_t i = 0; i < method_name.size(); ++i) {
if(method_name[i] == ':')
p = i;
}
if(method_name[p] == ':')
++p;
line << std::setw(20) << m.get_context().get_method().substr(p, 20).c_str() << " ";
}
line << "] ";
fc::string message = fc::format_string(m.get_format(), m.get_data());
line << message.c_str();
//fc::variant lmsg(m);
// fc::string fmt_str = fc::format_string( my->cfg.format, mutable_variant_object(m.get_context())( "message", message) );
{
fc::scoped_lock<boost::mutex> lock(my->slock);
my->out << line.str() << "\t\t\t" << m.get_context().get_file() << ":" << m.get_context().get_line_number() << "\n";
if(my->cfg.flush)
my->out.flush();
}
}
} // namespace fc
| {
"pile_set_name": "Github"
} |
===========
Tuning tips
===========
Okay, so you've got everything all set up, data is flowing through, and...what?
You can't consume everything on time? Allow me to help:
1. Try increasing :mod:`settings.CHUNK_SIZE` - this increases the size of a chunk of
metrics that gets added onto the queue. Bigger chunks == smaller network traffic.
2. Try increasing :mod:`settings.WORKER_PROCESSES` - this will add more workers to
consume metrics off the queue and insert them into Redis.
3. Try decreasing :mod:`settings.ANALYZER_PROCESSES` - this all runs on one box (for
now), so share the resources!
4. Still can't fix the performance? Try reducing your `settings.FULL_DURATION`.
If this is set to be too long, Redis will buckle under the pressure.
5. Is your analyzer taking too long? Maybe you need to make your algorithms
faster, or use fewer algorithms in your ensemble.
6. Reduce your metrics! If you're using StatsD, it will spit out lots of
variations for each metric (sum, median, lower, upper, etc). These are largely
identical, so it might be worth it to put them in `settings.SKIP_LIST`.
7. Disable Oculus - if you set :mod:`settings.OCULUS_HOST` to '', Skyline will not
write metrics into the `mini.` namespace - this should result in dramatic speed
improvements. At Etsy, they had a flow of about 5k metrics coming in every
second on average (with 250k distinct metrics). They used a 32 core Sandy Bridge
box, with 64 gb of memory. We experience bursts of up to 70k TPS on Redis. Here
are their relevant settings:
```
CHUNK_SIZE: 7000
WORKER_PROCESSES: 2
ANALYZER_PROCESSES: 25
FULL_DURATION: 86400
```
Smaller deployments
-------------------
Skyline runs OK on much less. It can handle ~45000 metrics per minute on a 4
vCore, 4GB RAM cloud SSD server where the metric resolution is 1 datapoint per
60 seconds, it will run loaded, but OK.
Do take note of the notes in settings.py related to the :mod:`settings.ANALYZER_PROCESSES`
and :mod:`settings.ANALYZER_OPTIMUM_RUN_DURATION` if you are only processing a few
1000 metrics with a datapoint every minute then the optimum settings will most
likely be something similar to:
```
ANALYZER_PROCESSES = 1
ANALYZER_OPTIMUM_RUN_DURATION = 60
```
Reliability
-----------
Skyline has been verified running in production against 6.5 million request per
minute peak internet advertising infrastructure, since 20131016.
However it should be noted that something should monitor the Skyline processes.
Over a long enough timeline Python or Redis or some I/O issue is going to lock
up and the Python process is just going to hang. This means that it is not
really sufficient to just monitor the process with something like monit.
Skyline has made some progress in monitoring its own process threads and keeping
itself running sanely, however not every possible issue can be mitigated against,
therefore some another external to Python monitoring can help.
See `Monitoring Skyline <monitoring-skyline.html>`__
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.