code
stringlengths 4
1.01M
| language
stringclasses 2
values |
|---|---|
'use strict';var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var collection_1 = require('angular2/src/facade/collection');
var lang_1 = require('angular2/src/facade/lang');
var exceptions_1 = require('angular2/src/facade/exceptions');
var DefaultKeyValueDifferFactory = (function () {
function DefaultKeyValueDifferFactory() {
}
DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || lang_1.isJsObject(obj); };
DefaultKeyValueDifferFactory.prototype.create = function (cdRef) { return new DefaultKeyValueDiffer(); };
DefaultKeyValueDifferFactory = __decorate([
lang_1.CONST(),
__metadata('design:paramtypes', [])
], DefaultKeyValueDifferFactory);
return DefaultKeyValueDifferFactory;
})();
exports.DefaultKeyValueDifferFactory = DefaultKeyValueDifferFactory;
var DefaultKeyValueDiffer = (function () {
function DefaultKeyValueDiffer() {
this._records = new Map();
this._mapHead = null;
this._previousMapHead = null;
this._changesHead = null;
this._changesTail = null;
this._additionsHead = null;
this._additionsTail = null;
this._removalsHead = null;
this._removalsTail = null;
}
Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
get: function () {
return this._additionsHead !== null || this._changesHead !== null ||
this._removalsHead !== null;
},
enumerable: true,
configurable: true
});
DefaultKeyValueDiffer.prototype.forEachItem = function (fn) {
var record;
for (record = this._mapHead; record !== null; record = record._next) {
fn(record);
}
};
DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) {
var record;
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
fn(record);
}
};
DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) {
var record;
for (record = this._changesHead; record !== null; record = record._nextChanged) {
fn(record);
}
};
DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) {
var record;
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
fn(record);
}
};
DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) {
var record;
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
fn(record);
}
};
DefaultKeyValueDiffer.prototype.diff = function (map) {
if (lang_1.isBlank(map))
map = collection_1.MapWrapper.createFromPairs([]);
if (!(map instanceof Map || lang_1.isJsObject(map))) {
throw new exceptions_1.BaseException("Error trying to diff '" + map + "'");
}
if (this.check(map)) {
return this;
}
else {
return null;
}
};
DefaultKeyValueDiffer.prototype.onDestroy = function () { };
DefaultKeyValueDiffer.prototype.check = function (map) {
var _this = this;
this._reset();
var records = this._records;
var oldSeqRecord = this._mapHead;
var lastOldSeqRecord = null;
var lastNewSeqRecord = null;
var seqChanged = false;
this._forEach(map, function (value, key) {
var newSeqRecord;
if (oldSeqRecord !== null && key === oldSeqRecord.key) {
newSeqRecord = oldSeqRecord;
if (!lang_1.looseIdentical(value, oldSeqRecord.currentValue)) {
oldSeqRecord.previousValue = oldSeqRecord.currentValue;
oldSeqRecord.currentValue = value;
_this._addToChanges(oldSeqRecord);
}
}
else {
seqChanged = true;
if (oldSeqRecord !== null) {
oldSeqRecord._next = null;
_this._removeFromSeq(lastOldSeqRecord, oldSeqRecord);
_this._addToRemovals(oldSeqRecord);
}
if (records.has(key)) {
newSeqRecord = records.get(key);
}
else {
newSeqRecord = new KVChangeRecord(key);
records.set(key, newSeqRecord);
newSeqRecord.currentValue = value;
_this._addToAdditions(newSeqRecord);
}
}
if (seqChanged) {
if (_this._isInRemovals(newSeqRecord)) {
_this._removeFromRemovals(newSeqRecord);
}
if (lastNewSeqRecord == null) {
_this._mapHead = newSeqRecord;
}
else {
lastNewSeqRecord._next = newSeqRecord;
}
}
lastOldSeqRecord = oldSeqRecord;
lastNewSeqRecord = newSeqRecord;
oldSeqRecord = oldSeqRecord === null ? null : oldSeqRecord._next;
});
this._truncate(lastOldSeqRecord, oldSeqRecord);
return this.isDirty;
};
/** @internal */
DefaultKeyValueDiffer.prototype._reset = function () {
if (this.isDirty) {
var record;
// Record the state of the mapping
for (record = this._previousMapHead = this._mapHead; record !== null; record = record._next) {
record._nextPrevious = record._next;
}
for (record = this._changesHead; record !== null; record = record._nextChanged) {
record.previousValue = record.currentValue;
}
for (record = this._additionsHead; record != null; record = record._nextAdded) {
record.previousValue = record.currentValue;
}
// todo(vicb) once assert is supported
// assert(() {
// var r = _changesHead;
// while (r != null) {
// var nextRecord = r._nextChanged;
// r._nextChanged = null;
// r = nextRecord;
// }
//
// r = _additionsHead;
// while (r != null) {
// var nextRecord = r._nextAdded;
// r._nextAdded = null;
// r = nextRecord;
// }
//
// r = _removalsHead;
// while (r != null) {
// var nextRecord = r._nextRemoved;
// r._nextRemoved = null;
// r = nextRecord;
// }
//
// return true;
//});
this._changesHead = this._changesTail = null;
this._additionsHead = this._additionsTail = null;
this._removalsHead = this._removalsTail = null;
}
};
/** @internal */
DefaultKeyValueDiffer.prototype._truncate = function (lastRecord, record) {
while (record !== null) {
if (lastRecord === null) {
this._mapHead = null;
}
else {
lastRecord._next = null;
}
var nextRecord = record._next;
// todo(vicb) assert
// assert((() {
// record._next = null;
// return true;
//}));
this._addToRemovals(record);
lastRecord = record;
record = nextRecord;
}
for (var rec = this._removalsHead; rec !== null; rec = rec._nextRemoved) {
rec.previousValue = rec.currentValue;
rec.currentValue = null;
this._records.delete(rec.key);
}
};
/** @internal */
DefaultKeyValueDiffer.prototype._isInRemovals = function (record) {
return record === this._removalsHead || record._nextRemoved !== null ||
record._prevRemoved !== null;
};
/** @internal */
DefaultKeyValueDiffer.prototype._addToRemovals = function (record) {
// todo(vicb) assert
// assert(record._next == null);
// assert(record._nextAdded == null);
// assert(record._nextChanged == null);
// assert(record._nextRemoved == null);
// assert(record._prevRemoved == null);
if (this._removalsHead === null) {
this._removalsHead = this._removalsTail = record;
}
else {
this._removalsTail._nextRemoved = record;
record._prevRemoved = this._removalsTail;
this._removalsTail = record;
}
};
/** @internal */
DefaultKeyValueDiffer.prototype._removeFromSeq = function (prev, record) {
var next = record._next;
if (prev === null) {
this._mapHead = next;
}
else {
prev._next = next;
}
// todo(vicb) assert
// assert((() {
// record._next = null;
// return true;
//})());
};
/** @internal */
DefaultKeyValueDiffer.prototype._removeFromRemovals = function (record) {
// todo(vicb) assert
// assert(record._next == null);
// assert(record._nextAdded == null);
// assert(record._nextChanged == null);
var prev = record._prevRemoved;
var next = record._nextRemoved;
if (prev === null) {
this._removalsHead = next;
}
else {
prev._nextRemoved = next;
}
if (next === null) {
this._removalsTail = prev;
}
else {
next._prevRemoved = prev;
}
record._prevRemoved = record._nextRemoved = null;
};
/** @internal */
DefaultKeyValueDiffer.prototype._addToAdditions = function (record) {
// todo(vicb): assert
// assert(record._next == null);
// assert(record._nextAdded == null);
// assert(record._nextChanged == null);
// assert(record._nextRemoved == null);
// assert(record._prevRemoved == null);
if (this._additionsHead === null) {
this._additionsHead = this._additionsTail = record;
}
else {
this._additionsTail._nextAdded = record;
this._additionsTail = record;
}
};
/** @internal */
DefaultKeyValueDiffer.prototype._addToChanges = function (record) {
// todo(vicb) assert
// assert(record._nextAdded == null);
// assert(record._nextChanged == null);
// assert(record._nextRemoved == null);
// assert(record._prevRemoved == null);
if (this._changesHead === null) {
this._changesHead = this._changesTail = record;
}
else {
this._changesTail._nextChanged = record;
this._changesTail = record;
}
};
DefaultKeyValueDiffer.prototype.toString = function () {
var items = [];
var previous = [];
var changes = [];
var additions = [];
var removals = [];
var record;
for (record = this._mapHead; record !== null; record = record._next) {
items.push(lang_1.stringify(record));
}
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
previous.push(lang_1.stringify(record));
}
for (record = this._changesHead; record !== null; record = record._nextChanged) {
changes.push(lang_1.stringify(record));
}
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
additions.push(lang_1.stringify(record));
}
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
removals.push(lang_1.stringify(record));
}
return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
"additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" +
"removals: " + removals.join(', ') + "\n";
};
/** @internal */
DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) {
if (obj instanceof Map) {
obj.forEach(fn);
}
else {
collection_1.StringMapWrapper.forEach(obj, fn);
}
};
return DefaultKeyValueDiffer;
})();
exports.DefaultKeyValueDiffer = DefaultKeyValueDiffer;
var KVChangeRecord = (function () {
function KVChangeRecord(key) {
this.key = key;
this.previousValue = null;
this.currentValue = null;
/** @internal */
this._nextPrevious = null;
/** @internal */
this._next = null;
/** @internal */
this._nextAdded = null;
/** @internal */
this._nextRemoved = null;
/** @internal */
this._prevRemoved = null;
/** @internal */
this._nextChanged = null;
}
KVChangeRecord.prototype.toString = function () {
return lang_1.looseIdentical(this.previousValue, this.currentValue) ?
lang_1.stringify(this.key) :
(lang_1.stringify(this.key) + '[' + lang_1.stringify(this.previousValue) + '->' +
lang_1.stringify(this.currentValue) + ']');
};
return KVChangeRecord;
})();
exports.KVChangeRecord = KVChangeRecord;
//# sourceMappingURL=default_keyvalue_differ.js.map
|
Java
|
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/DjulaHTMLtemplatingsystem.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DjulaHTMLtemplatingsystem.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/DjulaHTMLtemplatingsystem"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DjulaHTMLtemplatingsystem"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
Java
|
#!/bin/bash
fusermount -u ${MNT}/xiaomi
|
Java
|
window.hideAlert = function () {
$('#alertMessage').addClass("hidden");
$('#alertMessage').text("");
};
window.showAlert = function (msg) {
$('#alertMessage').text(msg);
$('#alertMessage').addClass("alert-danger");
$('#alertMessage').removeClass("hidden");
$('#alertMessage').fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
};
window.showInfo = function (msg) {
$('#alertMessage').text(msg);
$('#alertMessage').removeClass("alert-danger");
$('#alertMessage').removeClass("hidden");
$('#alertMessage').fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
};
window.dataErrorAlert = function (data) {
switch (data.idError) {
case "InvalidFile":
showAlert(Resources["InvalidFile"]);
break;
case "InvalidReg":
showAlert(Resources["WrongRegExpMessage"]);
break;
case "NotFound":
showAlert(Resources["NoSearchResultsMessage"]);
break;
case "InvalidPassword":
showAlert(Resources["UnlockInvalidPassword"]);
break;
default:
showAlert(data.idError);
break;
}
};
window.handleError = function (xhr, exception) {
hideLoader();
$('#workButton').removeClass("hidden");
var msg = '';
if (xhr.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (xhr.status == 404) {
msg = 'Requested page not found. [404]';
} else if (xhr.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + xhr.responseText;
}
showAlert(msg);
};
|
Java
|
-- #######################################
-- ## Project: HUD iLife ##
-- ## For MTA: San Andreas ##
-- ## Name: HudComponent_Weapons.lua ##
-- ## Author: Noneatme ##
-- ## Version: 1.0 ##
-- ## License: See top Folder ##
-- #######################################
-- FUNCTIONS / METHODS --
local cFunc = {}; -- Local Functions
local cSetting = {}; -- Local Settings
HudComponent_Weapons = {};
HudComponent_Weapons.__index = HudComponent_Weapons;
--[[
]]
-- ///////////////////////////////
-- ///// New //////
-- ///// Returns: Object //////
-- ///////////////////////////////
function HudComponent_Weapons:New(...)
local obj = setmetatable({}, {__index = self});
if obj.Constructor then
obj:Constructor(...);
end
return obj;
end
-- ///////////////////////////////
-- ///// Toggle //////
-- ///// Returns: void //////
-- ///////////////////////////////
function HudComponent_Weapons:Toggle(bBool)
local component_name = "weapons"
if (bBool == nil) then
hud.components[component_name].enabled = not (hud.components[component_name].enabled);
else
hud.components[component_name].enabled = bBool;
end
end
-- ///////////////////////////////
-- ///// Render //////
-- ///// Returns: void //////
-- ///////////////////////////////
function HudComponent_Weapons:Render()
local component_name = "weapons"
local x, y = hud.components[component_name].sx, hud.components[component_name].sy;
local w, h = hud.components[component_name].width*hud.components[component_name].zoom, hud.components[component_name].height*hud.components[component_name].zoom;
local alpha = hud.components[component_name].alpha
-- Hintergrund
dxDrawImage(x, y, w, h, hud.pfade.images.."component_weapons/background.png", 0, 0, 0, tocolor(0, 134, 134, alpha/1.5))
dxDrawRectangle(x, y, w, h, tocolor(0, 0, 0, alpha/4));
local ammo = getPedAmmoInClip(localPlayer)
local weapon = getPedWeapon(localPlayer)
local totalammo = getPedTotalAmmo(localPlayer)-ammo;
-- Image
if(fileExists(hud.pfade.images.."component_weapons/weapons/"..weapon..".png")) then
dxDrawImage(x+(5*hud.components[component_name].zoom), y+(5*hud.components[component_name].zoom), (64*1.5)*hud.components[component_name].zoom, (64*1.5)*hud.components[component_name].zoom, hud.pfade.images.."component_weapons/weapons/"..weapon..".png", 0, 0, 0, tocolor(255, 255, 255, alpha));
end
dxDrawText(getWeaponNameFromID(weapon), x+5*hud.components[component_name].zoom, y+100*hud.components[component_name].zoom, x+(64*1.5)*hud.components[component_name].zoom, y+(64*1.5)*hud.components[component_name].zoom, tocolor(255, 255, 255, alpha/3), 0.2*hud.components[component_name].zoom, hud.fonts.audirmg, "center", "top", false, true)
-- Munition
-- Seite 1
--[[
local dingerProSeite = math.round(totalammo/2);
local offsetX = 0;
local addOffsetX = 50;
local offsetY = 20;
local maxOffsetY = h-10;
local addOffsetY = totalammo/
for i = 1, 2, 1 do
offsetY = 0;
for i = 1, dingerProSeite, 1 do
offsetY = offsetY+addOffsetY;
end
offsetX = offsetX+addOffsetX
end]]
local addx = (94*1.5)*hud.components[component_name].zoom
local addy = 50*hud.components[component_name].zoom
dxDrawText(ammo.."\n"..getPedTotalAmmo(localPlayer)-ammo, x+addx, y+addy, x+addx, y+addy, tocolor(255, 255, 255, alpha/3), 0.35*hud.components[component_name].zoom, hud.fonts.audirmg, "center", "top", false, true)
-- MaxMuninGraph
addx = addx+60*hud.components[component_name].zoom
addy = addy-30*hud.components[component_name].zoom
local max = 110
-- Hintergrund
dxDrawRectangle(x+addx, y+h-32*hud.components[component_name].zoom, 40*hud.components[component_name].zoom, -max*hud.components[component_name].zoom, tocolor(0, 0, 0, alpha/3))
-- Was Vorhanden ist
local vorhanden = max/(tonumber(getWeaponProperty(getWeaponNameFromID(weapon), "pro", "maximum_clip_ammo")) or 0)*ammo
dxDrawRectangle(x+addx, y+h-32*hud.components[component_name].zoom, 40*hud.components[component_name].zoom, -vorhanden*hud.components[component_name].zoom, tocolor(74, 255, 101, alpha/3))
local prozent = math.round(100/(tonumber(getWeaponProperty(getWeaponNameFromID(weapon), "pro", "maximum_clip_ammo")) or 0)*ammo)
if(prozent < 0) then
prozent = 0
end
dxDrawText(prozent.."%", x+170*hud.components[component_name].zoom, y+135*hud.components[component_name].zoom, x+(64*1.5)*hud.components[component_name].zoom+170*hud.components[component_name].zoom, y+(64*1.5)*hud.components[component_name].zoom+135*hud.components[component_name].zoom, tocolor(255, 255, 255, alpha/3), 0.2*hud.components[component_name].zoom, hud.fonts.audirmg, "center", "top")
--[[
local ammo = getPedAmmoInClip(localPlayer)
local weapon = getPedWeapon(localPlayer)
local totalammo = getPedTotalAmmo(localPlayer)-ammo;
if(ammo < 10) then
ammo = "0"..ammo
end
if(self.enabled or hud.hudModifier.state == true) then
-- Schrift
local ammostring = ammo.."/#00B052"..totalammo;
dxDrawText(string.rep("0", #string.gsub(ammostring, '#%x%x%x%x%x%x', '')), x, y+20*hud.components[component_name].zoom, x+w, y+h, tocolor(255, 255, 255, alpha/5), 0.5*hud.components[component_name].zoom, hud.fonts.audirmg, "center", "top")
dxDrawText(ammostring, x, y+20*hud.components[component_name].zoom, x+w, y+h, tocolor(255, 255, 255, alpha), 0.5*hud.components[component_name].zoom, hud.fonts.audirmg, "center", "top", false, false, false, true)
-- Image
if(fileExists(hud.pfade.images.."component_weapons/weapons/"..weapon..".png")) then
dxDrawImage(x+55*hud.components[component_name].zoom, y+70*hud.components[component_name].zoom, (286/2)*hud.components[component_name].zoom, (106/2)*hud.components[component_name].zoom, hud.pfade.images.."component_weapons/weapons/"..weapon..".png", 0, 0, 0, tocolor(255, 255, 255, 200));
end
end]]
end
-- ///////////////////////////////
-- ///// GetTime //////
-- ///// Returns: String //////
-- ///////////////////////////////
function HudComponent_Weapons:GetTime()
local time = getRealTime()
local day = time.monthday
local month = time.month+1
local year = time.year+1900
local hour = time.hour
local minute = time.minute
local second = time.second;
if(hour < 10) then
hour = "0"..hour;
end
if(minute < 10) then
minute = "0"..minute;
end
if(second < 10) then
second = "0"..second;
end
return day.."-"..month.."-"..year.." "..hour.."-"..minute.."-"..second;
end
-- ///////////////////////////////
-- ///// ShowComponent //////
-- ///// Returns: String //////
-- ///////////////////////////////
function HudComponent_Weapons:ShowComponent(bBool, prevSlot, newSlot)
if(isTimer(self.showtimer)) then
killTimer(self.showtimer);
end
self.forceRender = true;
self.showtimer = setTimer(function()
self.forceRender = false;
end, 3000, 1)
if(bBool == true) then
if(getPedWeapon(getLocalPlayer(),newSlot) == 43) then
if(hud) and (hud.enabled) then
-- hud:Toggle(false);
-- self.showHudAgain = true;
-- showChat(false);
end
elseif(getPedWeapon(getLocalPlayer(),prevSlot) == 43) then
if(self.showHudAgain) then
if(hud) then
-- showChat(true);
-- hud:Toggle(true);
end
end
end
elseif(bBool == 43) then
local x, y = guiGetScreenSize();
local tex = dxCreateScreenSource(x, y);
dxUpdateScreenSource(tex);
-- Screenshots --
local pixels = dxGetTexturePixels(tex);
if(pixels) then
cancelEvent();
local image = dxConvertPixels(pixels, "png");
local date = "ilife-"..self:GetTime();
local file = fileCreate("screenshots/"..date..".png");
fileWrite(file, image);
fileFlush(file);
fileClose(file);
else
showInfoBox("error", "Da du deinen Screenshot Upload deaktiviert hast, wird keine Screenshot in deinem iLife ordner gespeichert!")
end
destroyElement(tex);
end
end
-- ///////////////////////////////
-- ///// Constructor //////
-- ///// Returns: void //////
-- ///////////////////////////////
function HudComponent_Weapons:Constructor(...)
self.enabled = true;
self.forceRender = false;
self.showtimer = nil;
self.showComponentFunc = function(...) self:ShowComponent(...) end;
self.showComponentFunc2 = function(...) self:ShowComponent(true, ...) end;
self.showHudAgain = false;
-- Events --
addEventHandler("onClientPlayerWeaponSwitch", getLocalPlayer(),self.showComponentFunc)
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(),self.showComponentFunc)
addEventHandler("onClientPlayerWeaponSwitch", getLocalPlayer(),self.showComponentFunc2)
-- outputDebugString("[CALLING] HudComponent_Weapons: Constructor");
end
-- EVENT HANDLER --
|
Java
|
#### Scripts
##### HashIncidentsFields
- Fixed an issue where custom fields were returned by default as part of the incident object.
|
Java
|
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Satrabel.Starter.EntityFramework;
using Abp.Authorization;
using Abp.BackgroundJobs;
using Abp.Notifications;
namespace Satrabel.OpenApp.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20170621153937_Added_Description_And_IsActive_To_Role")]
partial class Added_Description_And_IsActive_To_Role
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Abp.Application.Editions.Edition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("AbpEditions");
});
modelBuilder.Entity("Abp.Application.Features.FeatureSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.ToTable("AbpFeatures");
b.HasDiscriminator<string>("Discriminator").HasValue("FeatureSetting");
});
modelBuilder.Entity("Abp.Auditing.AuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BrowserInfo")
.HasMaxLength(256);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<string>("CustomData")
.HasMaxLength(2000);
b.Property<string>("Exception")
.HasMaxLength(2000);
b.Property<int>("ExecutionDuration");
b.Property<DateTime>("ExecutionTime");
b.Property<int?>("ImpersonatorTenantId");
b.Property<long?>("ImpersonatorUserId");
b.Property<string>("MethodName")
.HasMaxLength(256);
b.Property<string>("Parameters")
.HasMaxLength(1024);
b.Property<string>("ServiceName")
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "ExecutionDuration");
b.HasIndex("TenantId", "ExecutionTime");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpAuditLogs");
});
modelBuilder.Entity("Abp.Authorization.PermissionSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<bool>("IsGranted");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpPermissions");
b.HasDiscriminator<string>("Discriminator").HasValue("PermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserAccount", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastLoginTime");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<long?>("UserLinkId");
b.Property<string>("UserName");
b.HasKey("Id");
b.HasIndex("EmailAddress");
b.HasIndex("UserName");
b.HasIndex("TenantId", "EmailAddress");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "UserName");
b.ToTable("AbpUserAccounts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLoginAttempt", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BrowserInfo")
.HasMaxLength(256);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<byte>("Result");
b.Property<string>("TenancyName")
.HasMaxLength(64);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("UserNameOrEmailAddress")
.HasMaxLength(255);
b.HasKey("Id");
b.HasIndex("UserId", "TenantId");
b.HasIndex("TenancyName", "UserNameOrEmailAddress", "Result");
b.ToTable("AbpUserLoginAttempts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserOrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long>("OrganizationUnitId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "OrganizationUnitId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserOrganizationUnits");
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "RoleId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<string>("Value");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Abp.BackgroundJobs.BackgroundJobInfo", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsAbandoned");
b.Property<string>("JobArgs")
.IsRequired()
.HasMaxLength(1048576);
b.Property<string>("JobType")
.IsRequired()
.HasMaxLength(512);
b.Property<DateTime?>("LastTryTime");
b.Property<DateTime>("NextTryTime");
b.Property<byte>("Priority");
b.Property<short>("TryCount");
b.HasKey("Id");
b.HasIndex("IsAbandoned", "NextTryTime");
b.ToTable("AbpBackgroundJobs");
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("Value")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("Icon")
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<bool>("IsDisabled");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(10);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpLanguages");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguageText", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("LanguageName")
.IsRequired()
.HasMaxLength(10);
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Source")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(67108864);
b.HasKey("Id");
b.HasIndex("TenantId", "Source", "LanguageName", "Key");
b.ToTable("AbpLanguageTexts");
});
modelBuilder.Entity("Abp.Notifications.NotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("ExcludedUserIds")
.HasMaxLength(131072);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<string>("TenantIds")
.HasMaxLength(131072);
b.Property<string>("UserIds")
.HasMaxLength(131072);
b.HasKey("Id");
b.ToTable("AbpNotifications");
});
modelBuilder.Entity("Abp.Notifications.NotificationSubscriptionInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.HasMaxLength(96);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("NotificationName", "EntityTypeName", "EntityId", "UserId");
b.HasIndex("TenantId", "NotificationName", "EntityTypeName", "EntityId", "UserId");
b.ToTable("AbpNotificationSubscriptions");
});
modelBuilder.Entity("Abp.Notifications.TenantNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("AbpTenantNotifications");
});
modelBuilder.Entity("Abp.Notifications.UserNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<int>("State");
b.Property<int?>("TenantId");
b.Property<Guid>("TenantNotificationId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId", "State", "CreationTime");
b.ToTable("AbpUserNotifications");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(95);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<long?>("ParentId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("TenantId", "Code");
b.ToTable("AbpOrganizationUnits");
});
modelBuilder.Entity("Satrabel.JobManager.Authorization.Roles.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(5000);
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsActive");
b.Property<bool>("IsDefault");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsStatic");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(32);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("Satrabel.JobManager.Authorization.Users.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("AuthenticationSource")
.HasMaxLength(64);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("EmailConfirmationCode")
.HasMaxLength(328);
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsEmailConfirmed");
b.Property<bool>("IsLockoutEnabled");
b.Property<bool>("IsPhoneNumberConfirmed");
b.Property<bool>("IsTwoFactorEnabled");
b.Property<DateTime?>("LastLoginTime");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<DateTime?>("LockoutEndDateUtc");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("NormalizedEmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("PasswordResetCode")
.HasMaxLength(328);
b.Property<string>("PhoneNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("Surname")
.IsRequired()
.HasMaxLength(32);
b.Property<int?>("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(32);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedEmailAddress");
b.HasIndex("TenantId", "NormalizedUserName");
b.ToTable("AbpUsers");
});
modelBuilder.Entity("Satrabel.JobManager.MultiTenancy.Tenant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConnectionString")
.HasMaxLength(1024);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<int?>("EditionId");
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("TenancyName")
.IsRequired()
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("EditionId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenancyName");
b.ToTable("AbpTenants");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.Property<int>("EditionId");
b.HasIndex("EditionId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("EditionFeatureSetting");
});
modelBuilder.Entity("Abp.MultiTenancy.TenantFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.Property<int>("TenantId");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("TenantFeatureSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<int>("RoleId");
b.HasIndex("RoleId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("RolePermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<long>("UserId");
b.HasIndex("UserId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("UserPermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Roles.Role")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User")
.WithMany("Settings")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.HasOne("Abp.Organizations.OrganizationUnit", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
});
modelBuilder.Entity("Satrabel.JobManager.Authorization.Roles.Role", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("Satrabel.JobManager.Authorization.Users.User", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("Satrabel.JobManager.MultiTenancy.Tenant", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId");
b.HasOne("Satrabel.JobManager.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Roles.Role")
.WithMany("Permissions")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasOne("Satrabel.JobManager.Authorization.Users.User")
.WithMany("Permissions")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
}
}
}
|
Java
|
---
weekly_roundup: true
title: "Roundup: Agile subway, retrospectives and appreciation, instant GraphQL API,
fun counterfeits, less workdays"
date: '2018-07-20 13:00:00 BST'
authors:
- 'Elena Tanasoiu'
tags: # (Delete as appropriate)
- Culture
---
## Agile Subway Map - [Richard S](/people#richard-stobart)
https://www.agilealliance.org/agile101/subway-map-to-agile-practices/
Who knew that there was a Subway (Tube) map of the various Agile practices. _Lobs grenade and ducks for cover_
## Retrospectives and Appreciation- [Richard S](/people#richard-Stobart)
https://www.growingagile.co.za/2018/07/full-time-scrum-master-experiment-part-4-retrospectives/
We didn't want another minute to go by without giving you a chance to top up your retro-mojo.
## Hasura - An instant GraphQL API on Postgres - [Elena T](/people#elena-tanasoiu)
https://github.com/hasura/graphql-engine
I love me a well documented tool that you can play around with right away. Docs here: https://docs.hasura.io/1.0/graphql/manual/index.html
Main page here: https://hasura.io/
## A fun teardown of an iPhone X counterfeit - [Elena T](/people#elena-tanasoiu)
https://motherboard.vice.com/en_us/article/qvmkdd/counterfeit-iphone-x-review-and-teardown
I love the attention to detail put into this. It's even got its own (real!) IMEI number and face recognition (ish!).
The notch at the top is re-created by software.
Disclaimer: like any good counterfeit, it has backdoors and malicious code.
Even so, I would still definitely like to try one for myself.
## Work less, get more: New Zealand firm's four-day week an 'unmitigated success' - [Elena T](/people#elena-tanasoiu)
https://www.theguardian.com/world/2018/jul/19/work-less-get-more-new-zealand-firms-four-day-week-an-unmitigated-success
Work-life balance makes more progress, this time in New Zealand.
## Track of the Week - [Dawn T](/people#dawn-turner)
We're going back in time this week as a result of my recent Netflix Mad Men binge in the coolness of my dark living room (I don't like hot weather). They wrote some good tunes back then, including this one.. enjoy!
<iframe width="560" height="315" src="https://www.youtube.com/embed/HT2ao0rcxoA" frameborder="0" allowfullscreen></iframe>
[Patti Page - Old Cape Cod](https://www.youtube.com/watch?reload=9&=&v=HT2ao0rcxoA)
|
Java
|
# iTerm2 Puppet Module for Boxen
## Usage
```puppet
# Stable release
include iterm2::stable
# Dev release
include iterm2::dev
```
## Required Puppet Modules
* boxen
* stdlib
|
Java
|
@font-face {
font-family: 'Voltaire';
src: url("assets/Voltaire.eot");
src: url("Voltaire.eot?#iefix") format("embedded-opentype"), url("assets/Voltaire.woff") format("woff"), url("assets/Voltaire.ttf") format("truetype"), url("assets/Voltaire.svg#webfont") format("svg"); }
|
Java
|
local pubsub = require "util.pubsub";
local st = require "util.stanza";
local jid_bare = require "util.jid".bare;
local usermanager = require "core.usermanager";
local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event";
local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner";
local autocreate_on_publish = module:get_option_boolean("autocreate_on_publish", false);
local autocreate_on_subscribe = module:get_option_boolean("autocreate_on_subscribe", false);
local pubsub_disco_name = module:get_option("name");
if type(pubsub_disco_name) ~= "string" then pubsub_disco_name = "Prosody PubSub Service"; end
local expose_publisher = module:get_option_boolean("expose_publisher", false)
local service;
local lib_pubsub = module:require "pubsub";
local handlers = lib_pubsub.handlers;
local pubsub_error_reply = lib_pubsub.pubsub_error_reply;
module:depends("disco");
module:add_identity("pubsub", "service", pubsub_disco_name);
module:add_feature("http://jabber.org/protocol/pubsub");
function handle_pubsub_iq(event)
local origin, stanza = event.origin, event.stanza;
local pubsub = stanza.tags[1];
local action = pubsub.tags[1];
if not action then
return origin.send(st.error_reply(stanza, "cancel", "bad-request"));
end
local handler = handlers[stanza.attr.type.."_"..action.name];
if handler then
handler(origin, stanza, action, service);
return true;
end
end
function simple_broadcast(kind, node, jids, item, actor)
if item then
item = st.clone(item);
item.attr.xmlns = nil; -- Clear the pubsub namespace
if expose_publisher and actor then
item.attr.publisher = actor
end
end
local message = st.message({ from = module.host, type = "headline" })
:tag("event", { xmlns = xmlns_pubsub_event })
:tag(kind, { node = node })
:add_child(item);
for jid in pairs(jids) do
module:log("debug", "Sending notification to %s", jid);
message.attr.to = jid;
module:send(message);
end
end
module:hook("iq/host/"..xmlns_pubsub..":pubsub", handle_pubsub_iq);
module:hook("iq/host/"..xmlns_pubsub_owner..":pubsub", handle_pubsub_iq);
local feature_map = {
create = { "create-nodes", "instant-nodes", "item-ids" };
retract = { "delete-items", "retract-items" };
purge = { "purge-nodes" };
publish = { "publish", autocreate_on_publish and "auto-create" };
delete = { "delete-nodes" };
get_items = { "retrieve-items" };
add_subscription = { "subscribe" };
get_subscriptions = { "retrieve-subscriptions" };
set_configure = { "config-node" };
get_default = { "retrieve-default" };
};
local function add_disco_features_from_service(service)
for method, features in pairs(feature_map) do
if service[method] then
for _, feature in ipairs(features) do
if feature then
module:add_feature(xmlns_pubsub.."#"..feature);
end
end
end
end
for affiliation in pairs(service.config.capabilities) do
if affiliation ~= "none" and affiliation ~= "owner" then
module:add_feature(xmlns_pubsub.."#"..affiliation.."-affiliation");
end
end
end
module:hook("host-disco-info-node", function (event)
local stanza, origin, reply, node = event.stanza, event.origin, event.reply, event.node;
local ok, ret = service:get_nodes(stanza.attr.from);
if not ok or not ret[node] then
return;
end
event.exists = true;
reply:tag("identity", { category = "pubsub", type = "leaf" });
end);
module:hook("host-disco-items-node", function (event)
local stanza, origin, reply, node = event.stanza, event.origin, event.reply, event.node;
local ok, ret = service:get_items(node, stanza.attr.from);
if not ok then
return;
end
for _, id in ipairs(ret) do
reply:tag("item", { jid = module.host, name = id }):up();
end
event.exists = true;
end);
module:hook("host-disco-items", function (event)
local stanza, origin, reply = event.stanza, event.origin, event.reply;
local ok, ret = service:get_nodes(event.stanza.attr.from);
if not ok then
return;
end
for node, node_obj in pairs(ret) do
reply:tag("item", { jid = module.host, node = node, name = node_obj.config.name }):up();
end
end);
local admin_aff = module:get_option_string("default_admin_affiliation", "owner");
local unowned_aff = module:get_option_string("default_unowned_affiliation");
local function get_affiliation(jid, node)
local bare_jid = jid_bare(jid);
if bare_jid == module.host or usermanager.is_admin(bare_jid, module.host) then
return admin_aff;
end
if not node then
return unowned_aff;
end
end
function set_service(new_service)
service = new_service;
module.environment.service = service;
add_disco_features_from_service(service);
end
function module.save()
return { service = service };
end
function module.restore(data)
set_service(data.service);
end
function module.load()
if module.reloading then return; end
set_service(pubsub.new({
capabilities = {
none = {
create = false;
publish = false;
retract = false;
get_nodes = true;
subscribe = true;
unsubscribe = true;
get_subscription = true;
get_subscriptions = true;
get_items = true;
subscribe_other = false;
unsubscribe_other = false;
get_subscription_other = false;
get_subscriptions_other = false;
be_subscribed = true;
be_unsubscribed = true;
set_affiliation = false;
};
publisher = {
create = false;
publish = true;
retract = true;
get_nodes = true;
subscribe = true;
unsubscribe = true;
get_subscription = true;
get_subscriptions = true;
get_items = true;
subscribe_other = false;
unsubscribe_other = false;
get_subscription_other = false;
get_subscriptions_other = false;
be_subscribed = true;
be_unsubscribed = true;
set_affiliation = false;
};
owner = {
create = true;
publish = true;
retract = true;
delete = true;
get_nodes = true;
configure = true;
subscribe = true;
unsubscribe = true;
get_subscription = true;
get_subscriptions = true;
get_items = true;
subscribe_other = true;
unsubscribe_other = true;
get_subscription_other = true;
get_subscriptions_other = true;
be_subscribed = true;
be_unsubscribed = true;
set_affiliation = true;
};
};
autocreate_on_publish = autocreate_on_publish;
autocreate_on_subscribe = autocreate_on_subscribe;
broadcaster = simple_broadcast;
get_affiliation = get_affiliation;
normalize_jid = jid_bare;
}));
end
|
Java
|
#include <rpc/rpc.h>
|
Java
|
/*
* sha1.h
*
* Copyright (C) 1998, 2009
* Paul E. Jones <paulej@packetizer.com>
* All Rights Reserved
*
*****************************************************************************
* $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $
*****************************************************************************
*
* Description:
* This class implements the Secure Hashing Standard as defined
* in FIPS PUB 180-1 published April 17, 1995.
*
* Many of the variable names in the SHA1Context, especially the
* single character names, were used because those were the names
* used in the publication.
*
* Please read the file sha1.c for more information.
*
*/
#ifndef _SHA1_H_
#define _SHA1_H_
typedef unsigned int uint32;
typedef unsigned char byte;
/*
* This structure will hold context information for the hashing
* operation
*/
typedef struct SHA1Context {
uint32 Message_Digest[5]; /* Message Digest (output) */
unsigned Length_Low; /* Message length in bits */
unsigned Length_High; /* Message length in bits */
unsigned char Buffer[64]; /* 512-bit message blocks */
int Pos; /* Index into message block array */
} SHA1Context;
/*
* Function Prototypes
*/
void SHA1Reset(SHA1Context *);
void SHA1Input(SHA1Context *, const unsigned char *, unsigned);
void SHA1Finish(SHA1Context *, byte digest[20]);
void ShaHash(const byte *data, int data_size, byte digest[20]);
typedef struct SHA1HmacContext {
SHA1Context sha1, sha2;
} SHA1HmacContext;
void SHA1HmacReset(SHA1HmacContext *, const unsigned char *, unsigned);
void SHA1HmacInput(SHA1HmacContext *, const unsigned char *, unsigned);
void SHA1HmacFinish(SHA1HmacContext *, byte digest[20]);
#endif
|
Java
|
---
title: Det nya förbundets präst
date: 03/06/2021
---
Hebreerbrevet betonar starkt Jesus som vår överstepräst i den himmelska helgedomen. Där finns faktiskt Nya testamentets tydligaste utläggning om det nya förbundet med dess betoning på Kristus som överstepräst. Detta är inget sammanträffande. Kristus himmelska prästtjänst är nära sammanbunden med det nya förbundets löften.
Gamla testamentets helgedomstjänst var medlet som undervisade om det gamla förbundets sanningar. Det kretsade kring offer och medling. Djur slaktades och deras blod förmedlades av präster. Alla dessa ritualer var naturligtvis symboler på frälsning enbart i Jesus. I dem själva fanns ingen frälsning.
`Läs Heb. 10:4. Varför fanns det ingen frälsning i dessa djurs död? Varför är inte ett djurs död tillräcklig för att ge frälsning?`
Alla dessa offer och den prästerliga förmedling som följde dem mötte sin uppfyllelse i Kristus. Jesus blev det offer som det nya förbundet är grundat på. Hans blod bekräftade det nya förbundet och gjorde Sinaiförbundet och dess offer ”gamla” och föråldrade. Det sanna offret har getts ”en gång för alla” (Heb. 9:26). När Kristus en gång dog fanns det inte mer något behov av att slakta djur. Den jordiska helgedomen hade fullföljt sin funktion.
`Läs Matt. 27:51, som talar om hur förhänget i den jordiska helgedomen brast när Jesus dog. Hur hjälper det oss att förstå varför den jordiska helgedomen hade blivit ersatt?`
Till dessa djuroffer var prästtjänsten naturligtvis bunden, de leviter som offrade och medlade i den jordiska helgedomen för folket. När offren upphörde fanns det inte längre något behov av deras tjänst. Allting hade uppfyllts i Jesus som nu tjänstgör genom sitt eget blod i helgedomen i himlen (se Heb. 8:1–5). Hebreerbrevet betonar Kristus som överstepräst i himlen dit han trädde in genom att utgjuta sitt eget blod (Heb. 9:12) och nu är vår medlare. Detta är grunden för det hopp och de löften vi har i det nya förbundet.
`Hur känns det för dig när du förstår att Jesus redan nu tjänstgör genom sitt eget blod i himlen för oss? Hur mycket tillit och trygghet ger det dig när det gäller frälsning?`
|
Java
|
<?php
/*
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
* This file is part of Pydio.
*
* Pydio is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pydio 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
*
* The latest code can be found at <http://pyd.io/>.
*/
$mess=array(
"Source Viewer" => "Afficheur de sources",
"Syntax Highlighter for all major code source files" => "Coloration syntaxique pour la plupart des fichiers de code source",
);
|
Java
|
//
// KRActivityIndicatorView.h
// KRActivityIndicatorView
//
// Created by Krimpedance on 2017/05/10.
// Copyright © 2017年 Krimpedance. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for KRActivityIndicatorView.
FOUNDATION_EXPORT double KRActivityIndicatorViewVersionNumber;
//! Project version string for KRActivityIndicatorView.
FOUNDATION_EXPORT const unsigned char KRActivityIndicatorViewVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <KRActivityIndicatorView/PublicHeader.h>
|
Java
|
//
// UIDevice+YYAdd.h
// YYCategories <https://github.com/ibireme/YYCategories>
//
// Created by ibireme on 13/4/3.
// Copyright (c) 2015 ibireme.
//
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import <UIKit/UIKit.h>
/**
Provides extensions for `UIDevice`.
*/
@interface UIDevice (YYAdd)
#pragma mark - Device Information
///=============================================================================
/// @name Device Information
///=============================================================================
/// Device system version (e.g. 8.1)
+ (float)systemVersion;
/// Whether the device is iPad/iPad mini.
@property (nonatomic, readonly) BOOL isPad;
/// Whether the device is a simulator.
@property (nonatomic, readonly) BOOL isSimulator;
/// Whether the device is jailbroken.
@property (nonatomic, readonly) BOOL isJailbroken;
/// Wherher the device can make phone calls.
@property (nonatomic, readonly) BOOL canMakePhoneCalls NS_EXTENSION_UNAVAILABLE_IOS("");
/// The device's machine model. e.g. "iPhone6,1" "iPad4,6"
/// @see http://theiphonewiki.com/wiki/Models
@property (nonatomic, readonly) NSString *machineModel;
/// The device's machine model name. e.g. "iPhone 5s" "iPad mini 2"
/// @see http://theiphonewiki.com/wiki/Models
@property (nonatomic, readonly) NSString *machineModelName;
/// The System's startup time.
@property (nonatomic, readonly) NSDate *systemUptime;
#pragma mark - Network Information
///=============================================================================
/// @name Network Information
///=============================================================================
/// WIFI IP address of this device (can be nil). e.g. @"192.168.1.111"
@property (nonatomic, readonly) NSString *ipAddressWIFI;
/// Cell IP address of this device (can be nil). e.g. @"10.2.2.222"
@property (nonatomic, readonly) NSString *ipAddressCell;
#pragma mark - Disk Space
///=============================================================================
/// @name Disk Space
///=============================================================================
/// Total disk space in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t diskSpace;
/// Free disk space in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t diskSpaceFree;
/// Used disk space in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t diskSpaceUsed;
#pragma mark - Memory Information
///=============================================================================
/// @name Memory Information
///=============================================================================
/// Total physical memory in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t memoryTotal;
/// Used (active + inactive + wired) memory in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t memoryUsed;
/// Free memory in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t memoryFree;
/// Acvite memory in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t memoryActive;
/// Inactive memory in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t memoryInactive;
/// Wired memory in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t memoryWired;
/// Purgable memory in byte. (-1 when error occurs)
@property (nonatomic, readonly) int64_t memoryPurgable;
#pragma mark - CPU Information
///=============================================================================
/// @name CPU Information
///=============================================================================
/// Avaliable CPU processor count.
@property (nonatomic, readonly) NSUInteger cpuCount;
/// Current CPU usage, 1.0 means 100%. (-1 when error occurs)
@property (nonatomic, readonly) float cpuUsage;
/// Current CPU usage per processor (array of NSNumber), 1.0 means 100%. (nil when error occurs)
@property (nonatomic, readonly) NSArray *cpuUsagePerProcessor;
@end
#ifndef kSystemVersion
#define kSystemVersion [UIDevice systemVersion]
#endif
#ifndef kiOS6Later
#define kiOS6Later (kSystemVersion >= 6)
#endif
#ifndef kiOS7Later
#define kiOS7Later (kSystemVersion >= 7)
#endif
#ifndef kiOS8Later
#define kiOS8Later (kSystemVersion >= 8)
#endif
#ifndef kiOS9Later
#define kiOS9Later (kSystemVersion >= 9)
#endif
|
Java
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_101) on Wed Sep 21 04:14:05 CEST 2016 -->
<title>com.snakybo.torch.graphics.shader (Torch Engine 1.0 API)</title>
<meta name="date" content="2016-09-21">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="com.snakybo.torch.graphics.shader (Torch Engine 1.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/snakybo/torch/graphics/renderer/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../com/snakybo/torch/graphics/texture/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/snakybo/torch/graphics/shader/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package com.snakybo.torch.graphics.shader</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../com/snakybo/torch/graphics/shader/Shader.html" title="class in com.snakybo.torch.graphics.shader">Shader</a></td>
<td class="colLast">
<div class="block">
The shader class is a direct link to the low-level GLSL shaders.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../com/snakybo/torch/graphics/shader/ShaderInternal.html" title="class in com.snakybo.torch.graphics.shader">ShaderInternal</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/snakybo/torch/graphics/renderer/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../com/snakybo/torch/graphics/texture/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/snakybo/torch/graphics/shader/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
Java
|
define('controllers/panel',['require','jquery','backbone','utils/metrics','utils/browser','utils/video-player','utils/pubsub','controllers/panel-display'],function(require) {
var $ = require('jquery'),
Backbone = require('backbone'),
Metrics = require('utils/metrics'),
Browser = require('utils/browser'),
VideoPlayer = require('utils/video-player'),
PubSub = require('utils/pubsub'),
PanelDisplay = require('controllers/panel-display')
;
var PanelView = Backbone.View.extend({
events: {
},
panelOn: false,
minWidth: 320,
minHeight: 180,
leftLimit: 100,
topLimit: 100,
offset: 10,
border: 5,
initialize: function() {
Browser.checkMobileTabletDevice();
this.logger = new eventsCore.util.Logger('PanelView');
this.panel1 = new PanelDisplay({el: '#panel1'}).render();
this.panel2 = new PanelDisplay({el: '#panel2'}).render();
//this.logger.info('initialize - panel1:%o panel2:%o', this.panel1, this.panel2);
this.on('route:change', this.checkPage);
this.listenTo(PubSub, 'video:playPanel', this.onPlayPanel);
this.listenTo(PubSub, 'video:exitPanel', this.onExitPanel);
this.listenTo(PubSub, 'video:resetHero', this.onResetHero);
this.listenTo(PubSub, 'video:resetVod', this.onResetVod);
this.listenTo(VideoPlayer, 'player:play', this.onPlayEvent);
this.listenTo(VideoPlayer, 'player:panelOpen', this.onPanelOpenEvent);
this.listenTo(VideoPlayer, 'player:panelClosed', this.onPanelClosedEvent);
},
render: function() {
return this;
},
/**
* checks state/position of each panel and updates initial mute status
* executes on play and route change
*/
checkVolume: function() {
this.logger.info('checkVolume - panel1:%o panel2:%o', this.panel1.state(), this.panel2.state());
if (this.panel1.state() != '' && this.panel2.state() == '') {
this.panel1.mute(false);
this.panel2.mute(true);
}
else if (this.panel2.state() != '' && this.panel1.state() == '') {
this.panel2.mute(false);
this.panel1.mute(true);
}
else if (this.panel1.state() == 'floatVideo' && this.panel2.state() == 'heroVideo') {
this.panel2.mute(false);
this.panel1.mute(true);
}
else if (this.panel1.state() == 'heroVideo' && this.panel2.state() == 'floatVideo') {
this.panel1.mute(false);
this.panel2.mute(true);
}
},
/**
* close any open hero panel
* - used for mobile internal ref to a different watch live channel
*/
onResetHero: function() {
if(this.panel1.state() === 'heroVideo') {
this.panel1.onPanelExit();
} else if(this.panel2.state() === 'heroVideo') {
this.panel2.onPanelExit();
}
},
/**
* close any open vod floated panel
*/
onResetVod: function() {
if(this.panel1.state() === 'floatVideo') {
this.panel1.onPanelExit();
} else if(this.panel2.state() === 'floatVideo') {
this.panel2.onPanelExit();
}
},
/**
* play video in a panel, check for channel existing in panel first and use existing if playing
* @param data - panel video data
* @param channel - this live video data
* @param options - options to be passed to video player, consisting of:
* floated - optional boolean indicating if should start in float mode
* vod - indicates if playing a vod
*/
onPlayPanel: function(data, channel, options) {
options = _.extend({ floated: false, vod: false }, options);
this.logger.info('onPlayPanel - panel1:%o chan1:%o panel2:%o chan2:%o data:%o', this.panel1.state(), this.panel1.channelId(), this.panel2.state(), this.panel2.channelId(), data);
//if panel1 floating and opening the same channel, close to hero (to force back to hero when return to live channel page)
// do not close if float is true, call is trying to open same channel in already open float panel
if (this.panel1.channelId() == data[0].id) {
// if panel has no state, reset it to play channel
if(this.panel1.state() === '') {
this.panel1.playPanel(data, channel, options);
} else if (this.panel1.state() == 'floatVideo' && !options.floated)
this.panel1.panelClose(data, false);
else
this.logger.warn('onPlayPanel - ignoring call, attempted to open same channel already active');
}
//if panel2 floating and opening the same channel, close to hero (to force back to hero when return to live channel page)
// do not close if float is true, call i trying to open same channel in already open float panel
else if (this.panel2.channelId() == data[0].id){
// if panel has no state, reset it to play channel
if(this.panel2.state() === '') {
this.panel2.playPanel(data, channel, options);
} else if (this.panel2.state() == 'floatVideo' && !options.floated)
this.panel2.panelClose(data, false);
else
this.logger.warn('onPlayPanel - ignoring call, attempted to open same channel to floating panel');
}
//if panel1 in hero use it, (if not playing this channel)
else if ((this.panel1.state() == 'heroVideo' || this.panel1.state() == '') && this.panel1.channelId() != data[0].id) {
this.panel1.playPanel(data, channel, options);
}
//else use panel2 (if not playing this channel)
else if (this.panel2.channelId() != data[0].id){
this.panel2.playPanel(data, channel, options);
}
},
/**
* exit video playing in panel, whichever panel is open
*/
onExitPanel: function() {
this.logger.info('onExitPanel - panel1:%o chan1:%o panel2:%o chan2:%o', this.panel1.state(), this.panel1.channelId(), this.panel2.state(), this.panel2.channelId());
// close whichever one is floated
if(this.panel1.state() === 'floatVideo') {
this.panel1.onPanelExit();
} else if(this.panel2.state() === 'floatVideo') {
this.panel2.onPanelExit();
}
},
/**
* on play, initiates check for setting initial mute
* @param data - event data with panel id
*/
onPlayEvent: function(data) {
//this.logger.info('onPlayEvent - data:%o', data.id);
if (data.id == 'panel1' || data.id == 'panel2')
this.checkVolume();
},
/**
* handle panel open event from video player
* triggers panel to transition to float state
* @param data - event data with panel id
*/
onPanelOpenEvent: function(data) {
this.logger.info('onPanelOpenEvent - panel1:%o panel2:%o id:%o', this.panel1.state(), this.panel2.state(), data.id);
if(data.id == 'panel1') {
if (this.panel2.state() == 'floatVideo') {
this.panel2.panelClose(null, false);
}
this.panel1.panelOpen();
}
else if(data.id == 'panel2') {
if (this.panel1.state() == 'floatVideo') {
this.panel1.panelClose(null, false);
}
this.panel2.panelOpen();
}
},
/**
* handle panel close event from video player
* triggers panel to return to hero state
* @param data - event data with panel id
*/
onPanelClosedEvent: function(data) {
this.logger.info('onPanelClosedEvent - panel1:%o panel2:%o id:%o', this.panel1.state(), this.panel2.state(), data.id);
if(data.id == 'panel1') {
this.panel1.panelClose(data, true);
if (this.panel2.state() == 'heroVideo') {
this.panel2.panelClose(data, false);
this.checkVolume();
}
}
else if(data.id == 'panel2') {
this.panel2.panelClose(data, true);
if (this.panel1.state() == 'heroVideo') {
this.panel1.panelClose(data, false);
this.checkVolume();
}
}
},
/**
* initiate page check for closing hero on route change
* also check volume on route change
*/
checkPage: function(){
var route = Backbone.history.getFragment();
this.panel1.checkPage(route);
this.panel2.checkPage(route);
this.checkVolume();
}
});
return PanelView;
})
;
|
Java
|
// Design Basic Game Solo Challenge
// This is a solo challenge
// Your mission description:To complete a line of the same figure, horizontal, diagonal or vertical
// Overall mission: To win all the time :)
// Goals: make a line of the same kind before computer does
// Characters:You and the computer
// Objects:tic tac toe
// Functions:clear_board, refresh_board, turn
// Pseudocode
// Make a Tictactoe class
// Initialize the instance
// Paint the board
// Take a turn UNTIL someones win
// Check if some one won
// Clear the board
//
//
//
//
// Initial Code
turns = 0
board_state = [[" "," "," "],
[" "," "," "],
[" "," "," "]];
var Tictactoe = {
take_turn : function(user){
mark = prompt("It is your turn, where do you want to mark?");
horizontal = mark[1];
vertical = mark[0].toUpperCase();
if (vertical == "A"){
vertical = 0
} else if (vertical == "B"){
vertical = 1
} else {
vertical = 2
}
board_state[horizontal-1][vertical] = user
console.log(board_state)
},
print_board : function(){
line = ""
console.log(" A B C")
for (i in board_state){
new_line = "\n ═══╬═══╬═══\n"
for (x in board_state[i]){
ln = parseInt(i);
if (x == 0){line = (ln+1)+" "}
if (x == 2) {
if (i == 2){new_line = "\n"}
line += " "+board_state[i][x]+new_line;
} else {
line += " "+board_state[i][x]+" ║"
}
}
console.log(line);
}
}
}
alert ("Welcome to @cyberpolin's Tic Tac Toe\n So it is the turn of User 1, please select where you want to mark...")
Tictactoe.print_board()
while (turns < 9){
if (turns%2 == 0){
Tictactoe.take_turn("o");
} else {
Tictactoe.take_turn("x");
}
Tictactoe.print_board();
turns++;
}
// RELECTION
// What was the most difficult part of this challenge?
// Order my toughts to make the code works as i wannted, also as javascript is not a language thinked for terminal it was difficult to figure out how it was going to work.
// What did you learn about creating objects and functions that interact with one another?
// Is like in ruby, i think of them as just methods
// Did you learn about any new built-in methods you could use in your refactored solution? If so, what were they and how do they work?
// The only one i used was toUpperCase, ad they are like Ruby methods even tough Javascript have a different syntax.
// How can you access and manipulate properties of objects?
// like in Ruby object[property] = new_value, or the JS way object.property = new_value
// TODO'S
// Check if a place is marked already
// Check if you have winned
// Make it playable with computer
// MAKE IT GRAPHICAL!!!!
|
Java
|
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.core.urlresolvers import NoReverseMatch, reverse, resolve, Resolver404
from django.db.models.sql.constants import QUERY_TERMS, LOOKUP_SEP
from django.http import HttpResponse
from django.utils.cache import patch_cache_control
from tastypie.authentication import Authentication
from tastypie.authorization import ReadOnlyAuthorization
from tastypie.bundle import Bundle
from tastypie.cache import NoCache
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from tastypie.exceptions import NotFound, BadRequest, InvalidFilterError, HydrationError, InvalidSortError, ImmediateHttpResponse
from tastypie.fields import *
from tastypie.http import *
from tastypie.paginator import Paginator
from tastypie.serializers import Serializer
from tastypie.throttle import BaseThrottle
from tastypie.utils import is_valid_jsonp_callback_value, dict_strip_unicode_keys, trailing_slash
from tastypie.utils.mime import determine_format, build_content_type
from tastypie.validation import Validation
try:
set
except NameError:
from sets import Set as set
# The ``copy`` module was added in Python 2.5 and ``copycompat`` was added in
# post 1.1.1 Django (r11901)
try:
from django.utils.copycompat import deepcopy
from django.views.decorators.csrf import csrf_exempt
except ImportError:
from copy import deepcopy
def csrf_exempt(func):
return func
class ResourceOptions(object):
"""
A configuration class for ``Resource``.
Provides sane defaults and the logic needed to augment these settings with
the internal ``class Meta`` used on ``Resource`` subclasses.
"""
serializer = Serializer()
authentication = Authentication()
authorization = ReadOnlyAuthorization()
cache = NoCache()
throttle = BaseThrottle()
validation = Validation()
allowed_methods = ['get', 'post', 'put', 'delete']
list_allowed_methods = None
detail_allowed_methods = None
limit = getattr(settings, 'API_LIMIT_PER_PAGE', 20)
api_name = None
resource_name = None
urlconf_namespace = None
default_format = 'application/json'
filtering = {}
ordering = []
object_class = None
queryset = None
fields = []
excludes = []
include_resource_uri = True
include_absolute_url = False
def __new__(cls, meta=None):
overrides = {}
# Handle overrides.
if meta:
for override_name in dir(meta):
# No internals please.
if not override_name.startswith('_'):
overrides[override_name] = getattr(meta, override_name)
allowed_methods = overrides.get('allowed_methods', ['get', 'post', 'put', 'delete'])
if overrides.get('list_allowed_methods', None) is None:
overrides['list_allowed_methods'] = allowed_methods
if overrides.get('detail_allowed_methods', None) is None:
overrides['detail_allowed_methods'] = allowed_methods
if not overrides.get('queryset', None) is None:
overrides['object_class'] = overrides['queryset'].model
return object.__new__(type('ResourceOptions', (cls,), overrides))
class DeclarativeMetaclass(type):
def __new__(cls, name, bases, attrs):
attrs['base_fields'] = {}
declared_fields = {}
# Inherit any fields from parent(s).
try:
parents = [b for b in bases if issubclass(b, Resource)]
for p in parents:
fields = getattr(p, 'base_fields', {})
for field_name, field_object in fields.items():
attrs['base_fields'][field_name] = deepcopy(field_object)
except NameError:
pass
for field_name, obj in attrs.items():
if isinstance(obj, ApiField):
field = attrs.pop(field_name)
declared_fields[field_name] = field
attrs['base_fields'].update(declared_fields)
attrs['declared_fields'] = declared_fields
new_class = super(DeclarativeMetaclass, cls).__new__(cls, name, bases, attrs)
opts = getattr(new_class, 'Meta', None)
new_class._meta = ResourceOptions(opts)
if not getattr(new_class._meta, 'resource_name', None):
# No ``resource_name`` provided. Attempt to auto-name the resource.
class_name = new_class.__name__
name_bits = [bit for bit in class_name.split('Resource') if bit]
resource_name = ''.join(name_bits).lower()
new_class._meta.resource_name = resource_name
if getattr(new_class._meta, 'include_resource_uri', True):
if not 'resource_uri' in new_class.base_fields:
new_class.base_fields['resource_uri'] = CharField(readonly=True)
elif 'resource_uri' in new_class.base_fields and not 'resource_uri' in attrs:
del(new_class.base_fields['resource_uri'])
for field_name, field_object in new_class.base_fields.items():
if hasattr(field_object, 'contribute_to_class'):
field_object.contribute_to_class(new_class, field_name)
return new_class
class Resource(object):
"""
Handles the data, request dispatch and responding to requests.
Serialization/deserialization is handled "at the edges" (i.e. at the
beginning/end of the request/response cycle) so that everything internally
is Python data structures.
This class tries to be non-model specific, so it can be hooked up to other
data sources, such as search results, files, other data, etc.
"""
__metaclass__ = DeclarativeMetaclass
def __init__(self, api_name=None):
self.fields = deepcopy(self.base_fields)
if not api_name is None:
self._meta.api_name = api_name
def __getattr__(self, name):
if name in self.fields:
return self.fields[name]
def wrap_view(self, view):
"""
Wraps methods so they can be called in a more functional way as well
as handling exceptions better.
Note that if ``BadRequest`` or an exception with a ``response`` attr
are seen, there is special handling to either present a message back
to the user or return the response traveling with the exception.
"""
@csrf_exempt
def wrapper(request, *args, **kwargs):
try:
callback = getattr(self, view)
response = callback(request, *args, **kwargs)
if request.is_ajax():
# IE excessively caches XMLHttpRequests, so we're disabling
# the browser cache here.
# See http://www.enhanceie.com/ie/bugs.asp for details.
patch_cache_control(response, no_cache=True)
return response
except (BadRequest, ApiFieldError), e:
return HttpBadRequest(e.args[0])
except Exception, e:
if hasattr(e, 'response'):
return e.response
# A real, non-expected exception.
# Handle the case where the full traceback is more helpful
# than the serialized error.
if settings.DEBUG and getattr(settings, 'TASTYPIE_FULL_DEBUG', False):
raise
# Rather than re-raising, we're going to things similar to
# what Django does. The difference is returning a serialized
# error message.
return self._handle_500(request, e)
return wrapper
def _handle_500(self, request, exception):
import traceback
import sys
the_trace = '\n'.join(traceback.format_exception(*(sys.exc_info())))
if settings.DEBUG:
data = {
"error_message": exception.message,
"traceback": the_trace,
}
desired_format = self.determine_format(request)
serialized = self.serialize(request, data, desired_format)
return HttpApplicationError(content=serialized, content_type=build_content_type(desired_format))
# When DEBUG is False, send an error message to the admins.
from django.core.mail import mail_admins
subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path)
try:
request_repr = repr(request)
except:
request_repr = "Request repr() unavailable"
message = "%s\n\n%s" % (the_trace, request_repr)
mail_admins(subject, message, fail_silently=True)
# Prep the data going out.
data = {
"error_message": getattr(settings, 'TASTYPIE_CANNED_ERROR', "Sorry, this request could not be processed. Please try again later."),
}
desired_format = self.determine_format(request)
serialized = self.serialize(request, data, desired_format)
return HttpApplicationError(content=serialized, content_type=build_content_type(desired_format))
def _build_reverse_url(self, name, args=None, kwargs=None):
"""
A convenience hook for overriding how URLs are built.
See ``NamespacedModelResource._build_reverse_url`` for an example.
"""
return reverse(name, args=args, kwargs=kwargs)
def base_urls(self):
"""
The standard URLs this ``Resource`` should respond to.
"""
# Due to the way Django parses URLs, ``get_multiple`` won't work without
# a trailing slash.
return [
url(r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
url(r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
url(r"^(?P<resource_name>%s)/set/(?P<pk_list>\w[\w/;-]*)/$" % self._meta.resource_name, self.wrap_view('get_multiple'), name="api_get_multiple"),
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
def override_urls(self):
"""
A hook for adding your own URLs or overriding the default URLs.
"""
return []
@property
def urls(self):
"""
The endpoints this ``Resource`` responds to.
Mostly a standard URLconf, this is suitable for either automatic use
when registered with an ``Api`` class or for including directly in
a URLconf should you choose to.
"""
urls = self.override_urls() + self.base_urls()
urlpatterns = patterns('',
*urls
)
return urlpatterns
def determine_format(self, request):
"""
Used to determine the desired format.
Largely relies on ``tastypie.utils.mime.determine_format`` but here
as a point of extension.
"""
return determine_format(request, self._meta.serializer, default_format=self._meta.default_format)
def serialize(self, request, data, format, options=None):
"""
Given a request, data and a desired format, produces a serialized
version suitable for transfer over the wire.
Mostly a hook, this uses the ``Serializer`` from ``Resource._meta``.
"""
options = options or {}
if 'text/javascript' in format:
# get JSONP callback name. default to "callback"
callback = request.GET.get('callback', 'callback')
if not is_valid_jsonp_callback_value(callback):
raise BadRequest('JSONP callback name is invalid.')
options['callback'] = callback
return self._meta.serializer.serialize(data, format, options)
def deserialize(self, request, data, format='application/json'):
"""
Given a request, data and a format, deserializes the given data.
It relies on the request properly sending a ``CONTENT_TYPE`` header,
falling back to ``application/json`` if not provided.
Mostly a hook, this uses the ``Serializer`` from ``Resource._meta``.
"""
return self._meta.serializer.deserialize(data, format=request.META.get('CONTENT_TYPE', 'application/json'))
def dispatch_list(self, request, **kwargs):
"""
A view for handling the various HTTP methods (GET/POST/PUT/DELETE) over
the entire list of resources.
Relies on ``Resource.dispatch`` for the heavy-lifting.
"""
return self.dispatch('list', request, **kwargs)
def dispatch_detail(self, request, **kwargs):
"""
A view for handling the various HTTP methods (GET/POST/PUT/DELETE) on
a single resource.
Relies on ``Resource.dispatch`` for the heavy-lifting.
"""
return self.dispatch('detail', request, **kwargs)
def dispatch(self, request_type, request, **kwargs):
"""
Handles the common operations (allowed HTTP method, authentication,
throttling, method lookup) surrounding most CRUD interactions.
"""
allowed_methods = getattr(self._meta, "%s_allowed_methods" % request_type, None)
request_method = self.method_check(request, allowed=allowed_methods)
method = getattr(self, "%s_%s" % (request_method, request_type), None)
if method is None:
raise ImmediateHttpResponse(response=HttpNotImplemented())
self.is_authenticated(request)
self.is_authorized(request)
self.throttle_check(request)
# All clear. Process the request.
request = convert_post_to_put(request)
response = method(request, **kwargs)
# Add the throttled request.
self.log_throttled_access(request)
# If what comes back isn't a ``HttpResponse``, assume that the
# request was accepted and that some action occurred. This also
# prevents Django from freaking out.
if not isinstance(response, HttpResponse):
return HttpAccepted()
return response
def remove_api_resource_names(self, url_dict):
"""
Given a dictionary of regex matches from a URLconf, removes
``api_name`` and/or ``resource_name`` if found.
This is useful for converting URLconf matches into something suitable
for data lookup. For example::
Model.objects.filter(**self.remove_api_resource_names(matches))
"""
kwargs_subset = url_dict.copy()
for key in ['api_name', 'resource_name']:
try:
del(kwargs_subset[key])
except KeyError:
pass
return kwargs_subset
def method_check(self, request, allowed=None):
"""
Ensures that the HTTP method used on the request is allowed to be
handled by the resource.
Takes an ``allowed`` parameter, which should be a list of lowercase
HTTP methods to check against. Usually, this looks like::
# The most generic lookup.
self.method_check(request, self._meta.allowed_methods)
# A lookup against what's allowed for list-type methods.
self.method_check(request, self._meta.list_allowed_methods)
# A useful check when creating a new endpoint that only handles
# GET.
self.method_check(request, ['get'])
"""
if allowed is None:
allowed = []
request_method = request.method.lower()
if not request_method in allowed:
raise ImmediateHttpResponse(response=HttpMethodNotAllowed())
return request_method
def is_authorized(self, request, object=None):
"""
Handles checking of permissions to see if the user has authorization
to GET, POST, PUT, or DELETE this resource. If ``object`` is provided,
the authorization backend can apply additional row-level permissions
checking.
"""
auth_result = self._meta.authorization.is_authorized(request, object)
if isinstance(auth_result, HttpResponse):
raise ImmediateHttpResponse(response=auth_result)
if not auth_result is True:
raise ImmediateHttpResponse(response=HttpUnauthorized())
def is_authenticated(self, request):
"""
Handles checking if the user is authenticated and dealing with
unauthenticated users.
Mostly a hook, this uses class assigned to ``authentication`` from
``Resource._meta``.
"""
# Authenticate the request as needed.
auth_result = self._meta.authentication.is_authenticated(request)
if isinstance(auth_result, HttpResponse):
raise ImmediateHttpResponse(response=auth_result)
if not auth_result is True:
raise ImmediateHttpResponse(response=HttpUnauthorized())
def throttle_check(self, request):
"""
Handles checking if the user should be throttled.
Mostly a hook, this uses class assigned to ``throttle`` from
``Resource._meta``.
"""
identifier = self._meta.authentication.get_identifier(request)
# Check to see if they should be throttled.
if self._meta.throttle.should_be_throttled(identifier):
# Throttle limit exceeded.
raise ImmediateHttpResponse(response=HttpForbidden())
def log_throttled_access(self, request):
"""
Handles the recording of the user's access for throttling purposes.
Mostly a hook, this uses class assigned to ``throttle`` from
``Resource._meta``.
"""
request_method = request.method.lower()
self._meta.throttle.accessed(self._meta.authentication.get_identifier(request), url=request.get_full_path(), request_method=request_method)
def build_bundle(self, obj=None, data=None):
"""
Given either an object, a data dictionary or both, builds a ``Bundle``
for use throughout the ``dehydrate/hydrate`` cycle.
If no object is provided, an empty object from
``Resource._meta.object_class`` is created so that attempts to access
``bundle.obj`` do not fail.
"""
if obj is None:
obj = self._meta.object_class()
return Bundle(obj, data)
def build_filters(self, filters=None):
"""
Allows for the filtering of applicable objects.
This needs to be implemented at the user level.'
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
return filters
def apply_sorting(self, obj_list, options=None):
"""
Allows for the sorting of objects being returned.
This needs to be implemented at the user level.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
return obj_list
# URL-related methods.
def get_resource_uri(self, bundle_or_obj):
"""
This needs to be implemented at the user level.
A ``return reverse("api_dispatch_detail", kwargs={'resource_name':
self.resource_name, 'pk': object.id})`` should be all that would
be needed.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def get_resource_list_uri(self):
"""
Returns a URL specific to this resource's list endpoint.
"""
kwargs = {
'resource_name': self._meta.resource_name,
}
if self._meta.api_name is not None:
kwargs['api_name'] = self._meta.api_name
try:
return self._build_reverse_url("api_dispatch_list", kwargs=kwargs)
except NoReverseMatch:
return None
def get_via_uri(self, uri):
"""
This pulls apart the salient bits of the URI and populates the
resource via a ``obj_get``.
If you need custom behavior based on other portions of the URI,
simply override this method.
"""
try:
view, args, kwargs = resolve(uri)
except Resolver404:
raise NotFound("The URL provided '%s' was not a link to a valid resource." % uri)
return self.obj_get(**self.remove_api_resource_names(kwargs))
# Data preparation.
def full_dehydrate(self, obj):
"""
Given an object instance, extract the information from it to populate
the resource.
"""
bundle = Bundle(obj=obj)
# Dehydrate each field.
for field_name, field_object in self.fields.items():
# A touch leaky but it makes URI resolution work.
if isinstance(field_object, RelatedField):
field_object.api_name = self._meta.api_name
field_object.resource_name = self._meta.resource_name
bundle.data[field_name] = field_object.dehydrate(bundle)
# Check for an optional method to do further dehydration.
method = getattr(self, "dehydrate_%s" % field_name, None)
if method:
bundle.data[field_name] = method(bundle)
bundle = self.dehydrate(bundle)
return bundle
def dehydrate(self, bundle):
"""
A hook to allow a final manipulation of data once all fields/methods
have built out the dehydrated data.
Useful if you need to access more than one dehydrated field or want
to annotate on additional data.
Must return the modified bundle.
"""
return bundle
def full_hydrate(self, bundle):
"""
Given a populated bundle, distill it and turn it back into
a full-fledged object instance.
"""
if bundle.obj is None:
bundle.obj = self._meta.object_class()
for field_name, field_object in self.fields.items():
if field_object.attribute:
value = field_object.hydrate(bundle)
if value is not None:
# We need to avoid populating M2M data here as that will
# cause things to blow up.
if not getattr(field_object, 'is_related', False):
setattr(bundle.obj, field_object.attribute, value)
elif not getattr(field_object, 'is_m2m', False):
setattr(bundle.obj, field_object.attribute, value.obj)
# Check for an optional method to do further hydration.
method = getattr(self, "hydrate_%s" % field_name, None)
if method:
bundle = method(bundle)
bundle = self.hydrate(bundle)
return bundle
def hydrate(self, bundle):
"""
A hook to allow a final manipulation of data once all fields/methods
have built out the hydrated data.
Useful if you need to access more than one hydrated field or want
to annotate on additional data.
Must return the modified bundle.
"""
return bundle
def hydrate_m2m(self, bundle):
"""
Populate the ManyToMany data on the instance.
"""
if bundle.obj is None:
raise HydrationError("You must call 'full_hydrate' before attempting to run 'hydrate_m2m' on %r." % self)
for field_name, field_object in self.fields.items():
if not getattr(field_object, 'is_m2m', False):
continue
if field_object.attribute:
# Note that we only hydrate the data, leaving the instance
# unmodified. It's up to the user's code to handle this.
# The ``ModelResource`` provides a working baseline
# in this regard.
bundle.data[field_name] = field_object.hydrate_m2m(bundle)
for field_name, field_object in self.fields.items():
if not getattr(field_object, 'is_m2m', False):
continue
method = getattr(self, "hydrate_%s" % field_name, None)
if method:
method(bundle)
return bundle
def build_schema(self):
"""
Returns a dictionary of all the fields on the resource and some
properties about those fields.
Used by the ``schema/`` endpoint to describe what will be available.
"""
data = {
'fields': {},
'default_format': self._meta.default_format,
}
if self._meta.ordering:
data['ordering'] = self._meta.ordering
if self._meta.filtering:
data['filtering'] = self._meta.filtering
for field_name, field_object in self.fields.items():
data['fields'][field_name] = {
'type': field_object.dehydrated_type,
'nullable': field_object.null,
'readonly': field_object.readonly,
'help_text': field_object.help_text,
}
return data
def dehydrate_resource_uri(self, bundle):
"""
For the automatically included ``resource_uri`` field, dehydrate
the URI for the given bundle.
Returns empty string if no URI can be generated.
"""
try:
return self.get_resource_uri(bundle)
except NotImplementedError:
return ''
except NoReverseMatch:
return ''
def generate_cache_key(self, *args, **kwargs):
"""
Creates a unique-enough cache key.
This is based off the current api_name/resource_name/args/kwargs.
"""
smooshed = []
for key, value in kwargs.items():
smooshed.append("%s=%s" % (key, value))
# Use a list plus a ``.join()`` because it's faster than concatenation.
return "%s:%s:%s:%s" % (self._meta.api_name, self._meta.resource_name, ':'.join(args), ':'.join(smooshed))
# Data access methods.
def get_object_list(self, request):
"""
A hook to allow making returning the list of available objects.
This needs to be implemented at the user level.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def apply_authorization_limits(self, request, object_list):
"""
Allows the ``Authorization`` class to further limit the object list.
Also a hook to customize per ``Resource``.
"""
if hasattr(self._meta.authorization, 'apply_limits'):
object_list = self._meta.authorization.apply_limits(request, object_list)
return object_list
def obj_get_list(self, request=None, **kwargs):
"""
Fetches the list of objects available on the resource.
This needs to be implemented at the user level.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def cached_obj_get_list(self, request=None, **kwargs):
"""
A version of ``obj_get_list`` that uses the cache as a means to get
commonly-accessed data faster.
"""
cache_key = self.generate_cache_key('list', **kwargs)
obj_list = self._meta.cache.get(cache_key)
if obj_list is None:
obj_list = self.obj_get_list(request=request, **kwargs)
self._meta.cache.set(cache_key, obj_list)
return obj_list
def obj_get(self, request=None, **kwargs):
"""
Fetches an individual object on the resource.
This needs to be implemented at the user level. If the object can not
be found, this should raise a ``NotFound`` exception.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def cached_obj_get(self, request=None, **kwargs):
"""
A version of ``obj_get`` that uses the cache as a means to get
commonly-accessed data faster.
"""
cache_key = self.generate_cache_key('detail', **kwargs)
bundle = self._meta.cache.get(cache_key)
if bundle is None:
bundle = self.obj_get(request=request, **kwargs)
self._meta.cache.set(cache_key, bundle)
return bundle
def obj_create(self, bundle, request=None, **kwargs):
"""
Creates a new object based on the provided data.
This needs to be implemented at the user level.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def obj_update(self, bundle, request=None, **kwargs):
"""
Updates an existing object (or creates a new object) based on the
provided data.
This needs to be implemented at the user level.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def obj_delete_list(self, request=None, **kwargs):
"""
Deletes an entire list of objects.
This needs to be implemented at the user level.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def obj_delete(self, request=None, **kwargs):
"""
Deletes a single object.
This needs to be implemented at the user level.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
def create_response(self, request, data):
"""
Extracts the common "which-format/serialize/return-response" cycle.
Mostly a useful shortcut/hook.
"""
desired_format = self.determine_format(request)
serialized = self.serialize(request, data, desired_format)
return HttpResponse(content=serialized, content_type=build_content_type(desired_format))
def is_valid(self, bundle, request=None):
"""
Handles checking if the data provided by the user is valid.
Mostly a hook, this uses class assigned to ``validation`` from
``Resource._meta``.
If validation fails, an error is raised with the error messages
serialized inside it.
"""
errors = self._meta.validation.is_valid(bundle, request)
if len(errors):
if request:
desired_format = self.determine_format(request)
else:
desired_format = self._meta.default_format
serialized = self.serialize(request, errors, desired_format)
response = HttpBadRequest(content=serialized, content_type=build_content_type(desired_format))
raise ImmediateHttpResponse(response=response)
def rollback(self, bundles):
"""
Given the list of bundles, delete all objects pertaining to those
bundles.
This needs to be implemented at the user level. No exceptions should
be raised if possible.
``ModelResource`` includes a full working version specific to Django's
``Models``.
"""
raise NotImplementedError()
# Views.
def get_list(self, request, **kwargs):
"""
Returns a serialized list of resources.
Calls ``obj_get_list`` to provide the data, then handles that result
set and serializes it.
Should return a HttpResponse (200 OK).
"""
# TODO: Uncached for now. Invalidation that works for everyone may be
# impossible.
objects = self.obj_get_list(request=request, **self.remove_api_resource_names(kwargs))
sorted_objects = self.apply_sorting(objects, options=request.GET)
paginator = Paginator(request.GET, sorted_objects, resource_uri=self.get_resource_list_uri(),
limit=self._meta.limit)
to_be_serialized = paginator.page()
# Dehydrate the bundles in preparation for serialization.
to_be_serialized['objects'] = [self.full_dehydrate(obj=obj) for obj in to_be_serialized['objects']]
return self.create_response(request, to_be_serialized)
def get_detail(self, request, **kwargs):
"""
Returns a single serialized resource.
Calls ``cached_obj_get/obj_get`` to provide the data, then handles that result
set and serializes it.
Should return a HttpResponse (200 OK).
"""
try:
obj = self.cached_obj_get(request=request, **self.remove_api_resource_names(kwargs))
except ObjectDoesNotExist:
return HttpGone()
except MultipleObjectsReturned:
return HttpMultipleChoices("More than one resource is found at this URI.")
bundle = self.full_dehydrate(obj)
return self.create_response(request, bundle)
def put_list(self, request, **kwargs):
"""
Replaces a collection of resources with another collection.
Calls ``delete_list`` to clear out the collection then ``obj_create``
with the provided the data to create the new collection.
Return ``HttpAccepted`` (204 No Content).
"""
deserialized = self.deserialize(request, request.raw_post_data, format=request.META.get('CONTENT_TYPE', 'application/json'))
if not 'objects' in deserialized:
raise BadRequest("Invalid data sent.")
self.obj_delete_list(request=request, **self.remove_api_resource_names(kwargs))
bundles_seen = []
for object_data in deserialized['objects']:
bundle = self.build_bundle(data=dict_strip_unicode_keys(object_data))
# Attempt to be transactional, deleting any previously created
# objects if validation fails.
try:
self.is_valid(bundle, request)
except ImmediateHttpResponse:
self.rollback(bundles_seen)
raise
self.obj_create(bundle, request=request)
bundles_seen.append(bundle)
return HttpAccepted()
def put_detail(self, request, **kwargs):
"""
Either updates an existing resource or creates a new one with the
provided data.
Calls ``obj_update`` with the provided data first, but falls back to
``obj_create`` if the object does not already exist.
If a new resource is created, return ``HttpCreated`` (201 Created).
If an existing resource is modified, return ``HttpAccepted`` (204 No Content).
"""
deserialized = self.deserialize(request, request.raw_post_data, format=request.META.get('CONTENT_TYPE', 'application/json'))
bundle = self.build_bundle(data=dict_strip_unicode_keys(deserialized))
self.is_valid(bundle, request)
try:
updated_bundle = self.obj_update(bundle, request=request, pk=kwargs.get('pk'))
return HttpAccepted()
except:
updated_bundle = self.obj_create(bundle, request=request, pk=kwargs.get('pk'))
return HttpCreated(location=self.get_resource_uri(updated_bundle))
def post_list(self, request, **kwargs):
"""
Creates a new resource/object with the provided data.
Calls ``obj_create`` with the provided data and returns a response
with the new resource's location.
If a new resource is created, return ``HttpCreated`` (201 Created).
"""
deserialized = self.deserialize(request, request.raw_post_data, format=request.META.get('CONTENT_TYPE', 'application/json'))
bundle = self.build_bundle(data=dict_strip_unicode_keys(deserialized))
self.is_valid(bundle, request)
updated_bundle = self.obj_create(bundle, request=request)
return HttpCreated(location=self.get_resource_uri(updated_bundle))
def post_detail(self, request, **kwargs):
"""
Creates a new subcollection of the resource under a resource.
This is not implemented by default because most people's data models
aren't self-referential.
If a new resource is created, return ``HttpCreated`` (201 Created).
"""
return HttpNotImplemented()
def delete_list(self, request, **kwargs):
"""
Destroys a collection of resources/objects.
Calls ``obj_delete_list``.
If the resources are deleted, return ``HttpAccepted`` (204 No Content).
"""
self.obj_delete_list(request=request, **self.remove_api_resource_names(kwargs))
return HttpAccepted()
def delete_detail(self, request, **kwargs):
"""
Destroys a single resource/object.
Calls ``obj_delete``.
If the resource is deleted, return ``HttpAccepted`` (204 No Content).
If the resource did not exist, return ``HttpGone`` (410 Gone).
"""
try:
self.obj_delete(request=request, **self.remove_api_resource_names(kwargs))
return HttpAccepted()
except NotFound:
return HttpGone()
def get_schema(self, request, **kwargs):
"""
Returns a serialized form of the schema of the resource.
Calls ``build_schema`` to generate the data. This method only responds
to HTTP GET.
Should return a HttpResponse (200 OK).
"""
self.method_check(request, allowed=['get'])
self.is_authenticated(request)
self.throttle_check(request)
self.log_throttled_access(request)
return self.create_response(request, self.build_schema())
def get_multiple(self, request, **kwargs):
"""
Returns a serialized list of resources based on the identifiers
from the URL.
Calls ``obj_get`` to fetch only the objects requested. This method
only responds to HTTP GET.
Should return a HttpResponse (200 OK).
"""
self.method_check(request, allowed=['get'])
self.is_authenticated(request)
self.throttle_check(request)
# Rip apart the list then iterate.
obj_pks = kwargs.get('pk_list', '').split(';')
objects = []
not_found = []
for pk in obj_pks:
try:
obj = self.obj_get(request, pk=pk)
bundle = self.full_dehydrate(obj)
objects.append(bundle)
except ObjectDoesNotExist:
not_found.append(pk)
object_list = {
'objects': objects,
}
if len(not_found):
object_list['not_found'] = not_found
self.log_throttled_access(request)
return self.create_response(request, object_list)
class ModelDeclarativeMetaclass(DeclarativeMetaclass):
def __new__(cls, name, bases, attrs):
new_class = super(ModelDeclarativeMetaclass, cls).__new__(cls, name, bases, attrs)
fields = getattr(new_class._meta, 'fields', [])
excludes = getattr(new_class._meta, 'excludes', [])
field_names = new_class.base_fields.keys()
for field_name in field_names:
if field_name == 'resource_uri':
continue
if field_name in new_class.declared_fields:
continue
if len(fields) and not field_name in fields:
del(new_class.base_fields[field_name])
if len(excludes) and field_name in excludes:
del(new_class.base_fields[field_name])
# Add in the new fields.
new_class.base_fields.update(new_class.get_fields(fields, excludes))
if getattr(new_class._meta, 'include_absolute_url', True):
if not 'absolute_url' in new_class.base_fields:
new_class.base_fields['absolute_url'] = CharField(attribute='get_absolute_url', readonly=True)
elif 'absolute_url' in new_class.base_fields and not 'absolute_url' in attrs:
del(new_class.base_fields['absolute_url'])
return new_class
class ModelResource(Resource):
"""
A subclass of ``Resource`` designed to work with Django's ``Models``.
This class will introspect a given ``Model`` and build a field list based
on the fields found on the model (excluding relational fields).
Given that it is aware of Django's ORM, it also handles the CRUD data
operations of the resource.
"""
__metaclass__ = ModelDeclarativeMetaclass
@classmethod
def should_skip_field(cls, field):
"""
Given a Django model field, return if it should be included in the
contributed ApiFields.
"""
# Ignore certain fields (related fields).
if getattr(field, 'rel'):
return True
return False
@classmethod
def api_field_from_django_field(cls, f, default=CharField):
"""
Returns the field type that would likely be associated with each
Django type.
"""
result = default
if f.get_internal_type() in ('DateField', 'DateTimeField'):
result = DateTimeField
elif f.get_internal_type() in ('BooleanField', 'NullBooleanField'):
result = BooleanField
elif f.get_internal_type() in ('DecimalField', 'FloatField'):
result = FloatField
elif f.get_internal_type() in ('IntegerField', 'PositiveIntegerField', 'PositiveSmallIntegerField', 'SmallIntegerField'):
result = IntegerField
elif f.get_internal_type() in ('FileField', 'ImageField'):
result = FileField
# TODO: Perhaps enable these via introspection. The reason they're not enabled
# by default is the very different ``__init__`` they have over
# the other fields.
# elif f.get_internal_type() == 'ForeignKey':
# result = ForeignKey
# elif f.get_internal_type() == 'ManyToManyField':
# result = ManyToManyField
return result
@classmethod
def get_fields(cls, fields=None, excludes=None):
"""
Given any explicit fields to include and fields to exclude, add
additional fields based on the associated model.
"""
final_fields = {}
fields = fields or []
excludes = excludes or []
if not cls._meta.object_class:
return final_fields
for f in cls._meta.object_class._meta.fields:
# If the field name is already present, skip
if f.name in cls.base_fields:
continue
# If field is not present in explicit field listing, skip
if fields and f.name not in fields:
continue
# If field is in exclude list, skip
if excludes and f.name in excludes:
continue
if cls.should_skip_field(f):
continue
api_field_class = cls.api_field_from_django_field(f)
kwargs = {
'attribute': f.name,
}
if f.null is True:
kwargs['null'] = True
kwargs['unique'] = f.unique
if not f.null and f.blank is True:
kwargs['default'] = ''
if f.get_internal_type() == 'TextField':
kwargs['default'] = ''
if f.has_default():
kwargs['default'] = f.default
final_fields[f.name] = api_field_class(**kwargs)
final_fields[f.name].instance_name = f.name
return final_fields
def build_filters(self, filters=None):
"""
Given a dictionary of filters, create the necessary ORM-level filters.
Keys should be resource fields, **NOT** model fields.
Valid values are either a list of Django filter types (i.e.
``['startswith', 'exact', 'lte']``), the ``ALL`` constant or the
``ALL_WITH_RELATIONS`` constant.
"""
# At the declarative level:
# filtering = {
# 'resource_field_name': ['exact', 'startswith', 'endswith', 'contains'],
# 'resource_field_name_2': ['exact', 'gt', 'gte', 'lt', 'lte', 'range'],
# 'resource_field_name_3': ALL,
# 'resource_field_name_4': ALL_WITH_RELATIONS,
# ...
# }
# Accepts the filters as a dict. None by default, meaning no filters.
if filters is None:
filters = {}
qs_filters = {}
for filter_expr, value in filters.items():
filter_bits = filter_expr.split(LOOKUP_SEP)
if not filter_bits[0] in self.fields:
# It's not a field we know about. Move along citizen.
continue
if not filter_bits[0] in self._meta.filtering:
raise InvalidFilterError("The '%s' field does not allow filtering." % filter_bits[0])
if filter_bits[-1] in QUERY_TERMS.keys():
filter_type = filter_bits.pop()
else:
filter_type = 'exact'
# Check to see if it's allowed lookup type.
if not self._meta.filtering[filter_bits[0]] in (ALL, ALL_WITH_RELATIONS):
# Must be an explicit whitelist.
if not filter_type in self._meta.filtering[filter_bits[0]]:
raise InvalidFilterError("'%s' is not an allowed filter on the '%s' field." % (filter_expr, filter_bits[0]))
# Check to see if it's a relational lookup and if that's allowed.
if len(filter_bits) > 1:
if not self._meta.filtering[filter_bits[0]] == ALL_WITH_RELATIONS:
raise InvalidFilterError("Lookups are not allowed more than one level deep on the '%s' field." % filter_bits[0])
if self.fields[filter_bits[0]].attribute is None:
raise InvalidFilterError("The '%s' field has no 'attribute' for searching with." % filter_bits[0])
if value in ['true', 'True', True]:
value = True
elif value in ['false', 'False', False]:
value = False
elif value in ('nil', 'none', 'None', None):
value = None
db_field_name = LOOKUP_SEP.join([self.fields[filter_bits[0]].attribute] + filter_bits[1:])
qs_filter = "%s%s%s" % (db_field_name, LOOKUP_SEP, filter_type)
qs_filters[qs_filter] = value
return dict_strip_unicode_keys(qs_filters)
def apply_sorting(self, obj_list, options=None):
"""
Given a dictionary of options, apply some ORM-level sorting to the
provided ``QuerySet``.
Looks for the ``sort_by`` key and handles either ascending (just the
field name) or descending (the field name with a ``-`` in front).
The field name should be the resource field, **NOT** model field.
"""
if options is None:
options = {}
if not 'sort_by' in options:
# Nothing to alter the sort order. Return what we've got.
return obj_list
order_by_args = []
if hasattr(options, 'getlist'):
sort_bits = options.getlist('sort_by')
else:
sort_bits = options.get('sort_by')
if not isinstance(sort_bits, (list, tuple)):
sort_bits = [sort_bits]
for sort_by in sort_bits:
sort_by_bits = sort_by.split(LOOKUP_SEP)
field_name = sort_by_bits[0]
order = ''
if sort_by_bits[0].startswith('-'):
field_name = sort_by_bits[0][1:]
order = '-'
if not field_name in self.fields:
# It's not a field we know about. Move along citizen.
raise InvalidSortError("No matching '%s' field for ordering on." % field_name)
if not field_name in self._meta.ordering:
raise InvalidSortError("The '%s' field does not allow ordering." % field_name)
if self.fields[field_name].attribute is None:
raise InvalidSortError("The '%s' field has no 'attribute' for ordering with." % field_name)
order_by_args.append("%s%s" % (order, LOOKUP_SEP.join([self.fields[field_name].attribute] + sort_by_bits[1:])))
return obj_list.order_by(*order_by_args)
def get_object_list(self, request):
"""
An ORM-specific implementation of ``get_object_list``.
Returns a queryset that may have been limited by authorization or other
overrides.
"""
base_object_list = self._meta.queryset
# Limit it as needed.
authed_object_list = self.apply_authorization_limits(request, base_object_list)
return authed_object_list
def obj_get_list(self, request=None, **kwargs):
"""
A ORM-specific implementation of ``obj_get_list``.
Takes an optional ``request`` object, whose ``GET`` dictionary can be
used to narrow the query.
"""
filters = None
if hasattr(request, 'GET'):
filters = request.GET
applicable_filters = self.build_filters(filters=filters)
try:
return self.get_object_list(request).filter(**applicable_filters)
except ValueError, e:
raise NotFound("Invalid resource lookup data provided (mismatched type).")
def obj_get(self, request=None, **kwargs):
"""
A ORM-specific implementation of ``obj_get``.
Takes optional ``kwargs``, which are used to narrow the query to find
the instance.
"""
try:
return self.get_object_list(request).get(**kwargs)
except ValueError, e:
raise NotFound("Invalid resource lookup data provided (mismatched type).")
def obj_create(self, bundle, request=None, **kwargs):
"""
A ORM-specific implementation of ``obj_create``.
"""
bundle.obj = self._meta.object_class()
for key, value in kwargs.items():
setattr(bundle.obj, key, value)
bundle = self.full_hydrate(bundle)
bundle.obj.save()
# Now pick up the M2M bits.
m2m_bundle = self.hydrate_m2m(bundle)
self.save_m2m(m2m_bundle)
return bundle
def obj_update(self, bundle, request=None, **kwargs):
"""
A ORM-specific implementation of ``obj_update``.
"""
if not bundle.obj or not bundle.obj.pk:
# Attempt to hydrate data from kwargs before doing a lookup for the object.
# This step is needed so certain values (like datetime) will pass model validation.
try:
bundle.obj = self.get_object_list(request).model()
bundle.data.update(kwargs)
bundle = self.full_hydrate(bundle)
lookup_kwargs = kwargs.copy()
lookup_kwargs.update(dict(
(k, getattr(bundle.obj, k))
for k in kwargs.keys()
if getattr(bundle.obj, k) is not None))
except:
# if there is trouble hydrating the data, fall back to just
# using kwargs by itself (usually it only contains a "pk" key
# and this will work fine.
lookup_kwargs = kwargs
try:
bundle.obj = self.get_object_list(request).get(**lookup_kwargs)
except ObjectDoesNotExist:
raise NotFound("A model instance matching the provided arguments could not be found.")
bundle = self.full_hydrate(bundle)
bundle.obj.save()
# Now pick up the M2M bits.
m2m_bundle = self.hydrate_m2m(bundle)
self.save_m2m(m2m_bundle)
return bundle
def obj_delete_list(self, request=None, **kwargs):
"""
A ORM-specific implementation of ``obj_delete_list``.
Takes optional ``kwargs``, which can be used to narrow the query.
"""
self.get_object_list(request).filter(**kwargs).delete()
def obj_delete(self, request=None, **kwargs):
"""
A ORM-specific implementation of ``obj_delete``.
Takes optional ``kwargs``, which are used to narrow the query to find
the instance.
"""
try:
obj = self.get_object_list(request).get(**kwargs)
except ObjectDoesNotExist:
raise NotFound("A model instance matching the provided arguments could not be found.")
obj.delete()
def rollback(self, bundles):
"""
A ORM-specific implementation of ``rollback``.
Given the list of bundles, delete all models pertaining to those
bundles.
"""
for bundle in bundles:
if bundle.obj and getattr(bundle.obj, 'pk', None):
bundle.obj.delete()
def save_m2m(self, bundle):
"""
Handles the saving of related M2M data.
Due to the way Django works, the M2M data must be handled after the
main instance, which is why this isn't a part of the main ``save`` bits.
Currently slightly inefficient in that it will clear out the whole
relation and recreate the related data as needed.
"""
for field_name, field_object in self.fields.items():
if not getattr(field_object, 'is_m2m', False):
continue
if not field_object.attribute:
continue
# Get the manager.
related_mngr = getattr(bundle.obj, field_object.attribute)
if hasattr(related_mngr, 'clear'):
# Clear it out, just to be safe.
related_mngr.clear()
related_objs = []
for related_bundle in bundle.data[field_name]:
related_bundle.obj.save()
related_objs.append(related_bundle.obj)
related_mngr.add(*related_objs)
def get_resource_uri(self, bundle_or_obj):
"""
Handles generating a resource URI for a single resource.
Uses the model's ``pk`` in order to create the URI.
"""
kwargs = {
'resource_name': self._meta.resource_name,
}
if isinstance(bundle_or_obj, Bundle):
kwargs['pk'] = bundle_or_obj.obj.pk
else:
kwargs['pk'] = bundle_or_obj.id
if self._meta.api_name is not None:
kwargs['api_name'] = self._meta.api_name
return self._build_reverse_url("api_dispatch_detail", kwargs=kwargs)
class NamespacedModelResource(ModelResource):
"""
A ModelResource subclass that respects Django namespaces.
"""
def _build_reverse_url(self, name, args=None, kwargs=None):
namespaced = "%s:%s" % (self._meta.urlconf_namespace, name)
return reverse(namespaced, args=args, kwargs=kwargs)
# Based off of ``piston.utils.coerce_put_post``. Similarly BSD-licensed.
# And no, the irony is not lost on me.
def convert_post_to_put(request):
"""
Force Django to process the PUT.
"""
if request.method == "PUT":
if hasattr(request, '_post'):
del request._post
del request._files
try:
request.method = "POST"
request._load_post_and_files()
request.method = "PUT"
except AttributeError:
request.META['REQUEST_METHOD'] = 'POST'
request._load_post_and_files()
request.META['REQUEST_METHOD'] = 'PUT'
request.PUT = request.POST
return request
|
Java
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Company
{
public partial class Site : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
|
Java
|
/* Copyright (C) 1986-2001 by Digital Mars. */
#if __SC__ || __RCC__
#pragma once
#endif
#ifndef RC_INVOKED
#pragma pack(__DEFALIGN)
#endif
#include <win32\scdefs.h>
#include <win32\LMCONFIG.H>
#ifndef RC_INVOKED
#pragma pack()
#endif
|
Java
|
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Dataflow
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Convert container abstract
*
* @category Mage
* @package Mage_Dataflow
* @author Magento Core Team <core@magentocommerce.com>
*/
abstract class Mage_Dataflow_Model_Convert_Container_Abstract
implements Mage_Dataflow_Model_Convert_Container_Interface
{
protected $_batchParams = array();
protected $_vars;
protected $_profile;
protected $_action;
protected $_data;
protected $_position;
public function getVar($key, $default=null)
{
if (!isset($this->_vars[$key]) || (!is_array($this->_vars[$key]) && strlen($this->_vars[$key]) == 0)) {
return $default;
}
return $this->_vars[$key];
}
public function getVars()
{
return $this->_vars;
}
public function setVar($key, $value=null)
{
if (is_array($key) && is_null($value)) {
$this->_vars = $key;
} else {
$this->_vars[$key] = $value;
}
return $this;
}
public function getAction()
{
return $this->_action;
}
public function setAction(Mage_Dataflow_Model_Convert_Action_Interface $action)
{
$this->_action = $action;
return $this;
}
public function getProfile()
{
return $this->_profile;
}
public function setProfile(Mage_Dataflow_Model_Convert_Profile_Interface $profile)
{
$this->_profile = $profile;
return $this;
}
public function getData()
{
if (is_null($this->_data) && $this->getProfile()) {
$this->_data = $this->getProfile()->getContainer()->getData();
}
return $this->_data;
}
public function setData($data)
{
if ($this->getProfile()) {
$this->getProfile()->getContainer()->setData($data);
}
$this->_data = $data;
return $this;
}
public function validateDataString($data=null)
{
if (is_null($data)) {
$data = $this->getData();
}
if (!is_string($data)) {
$this->addException("Invalid data type, expecting string.", Mage_Dataflow_Model_Convert_Exception::FATAL);
}
return true;
}
public function validateDataArray($data=null)
{
if (is_null($data)) {
$data = $this->getData();
}
if (!is_array($data)) {
$this->addException("Invalid data type, expecting array.", Mage_Dataflow_Model_Convert_Exception::FATAL);
}
return true;
}
public function validateDataGrid($data=null)
{
if (is_null($data)) {
$data = $this->getData();
}
if (!is_array($data) || !is_array(current($data))) {
if (count($data)==0) {
return true;
}
$this->addException("Invalid data type, expecting 2D grid array.", Mage_Dataflow_Model_Convert_Exception::FATAL);
}
return true;
}
public function getGridFields($grid)
{
$fields = array();
foreach ($grid as $i=>$row) {
foreach ($row as $fieldName=>$data) {
if (!in_array($fieldName, $fields)) {
$fields[] = $fieldName;
}
}
}
return $fields;
}
public function addException($error, $level=null)
{
$e = new Mage_Dataflow_Model_Convert_Exception($error);
$e->setLevel(!is_null($level) ? $level : Mage_Dataflow_Model_Convert_Exception::NOTICE);
$e->setContainer($this);
$e->setPosition($this->getPosition());
if ($this->getProfile()) {
$this->getProfile()->addException($e);
}
return $e;
}
public function getPosition()
{
return $this->_position;
}
public function setPosition($position)
{
$this->_position = $position;
return $this;
}
public function setBatchParams($data)
{
if (is_array($data)) {
$this->_batchParams = $data;
}
return $this;
}
public function getBatchParams($key = null)
{
if (!empty($key)) {
return isset($this->_batchParams[$key]) ? $this->_batchParams[$key] : null;
}
return $this->_batchParams;
}
}
|
Java
|
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.monitor;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Part of MultiTenantDiagnosticSettings. Specifies the settings for a
* particular log.
*/
public class LogSettings {
/**
* Name of a Diagnostic Log category for a resource type this setting is
* applied to. To obtain the list of Diagnostic Log categories for a
* resource, first perform a GET diagnostic settings operation.
*/
@JsonProperty(value = "category")
private String category;
/**
* a value indicating whether this log is enabled.
*/
@JsonProperty(value = "enabled", required = true)
private boolean enabled;
/**
* the retention policy for this log.
*/
@JsonProperty(value = "retentionPolicy")
private RetentionPolicy retentionPolicy;
/**
* Get the category value.
*
* @return the category value
*/
public String category() {
return this.category;
}
/**
* Set the category value.
*
* @param category the category value to set
* @return the LogSettings object itself.
*/
public LogSettings withCategory(String category) {
this.category = category;
return this;
}
/**
* Get the enabled value.
*
* @return the enabled value
*/
public boolean enabled() {
return this.enabled;
}
/**
* Set the enabled value.
*
* @param enabled the enabled value to set
* @return the LogSettings object itself.
*/
public LogSettings withEnabled(boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* Get the retentionPolicy value.
*
* @return the retentionPolicy value
*/
public RetentionPolicy retentionPolicy() {
return this.retentionPolicy;
}
/**
* Set the retentionPolicy value.
*
* @param retentionPolicy the retentionPolicy value to set
* @return the LogSettings object itself.
*/
public LogSettings withRetentionPolicy(RetentionPolicy retentionPolicy) {
this.retentionPolicy = retentionPolicy;
return this;
}
}
|
Java
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ConsoleApplication1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConsoleApplication1")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f058ff68-8743-49cb-bea4-2d80be2d568d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Java
|
// GridFS
// Copyright(c) 2013 Siddharth Mahendraker <siddharth_mahen@me.com>
// MIT Licensed
exports.GridFS = require('./lib/GridFS');
exports.GridStream = require('./lib/GridStream');
|
Java
|
// @flow
class A {
x = [1, 2, 3];
y = 4;
foo() {
this.x = this.x.map(function (z) {
this.y; // error, function has wrong this
});
}
}
class B {
x = [1, 2, 3];
y = 4;
foo() {
this.x = this.x.map(function (z) {
this.y; // ok, function gets passed correct this
}, this);
}
}
class C {
x = [1, 2, 3];
y = 4;
foo() {
this.x = this.x.map(z => {
this.y; // ok, arrow binds surrounding context this
});
}
}
|
Java
|
import collectionClass from "./collections.class";
import collectionColor from "./collections.color";
function collectionBackgroundStyles(contentItem) {
return `
.${collectionClass(contentItem)} {
background-color: #${collectionColor(contentItem)};
}
`;
}
export default collectionBackgroundStyles;
|
Java
|
<?php
/**
* @Created By ECMall PhpCacheServer
* @Time:2015-01-17 18:28:59
*/
if(filemtime(__FILE__) + 600 < time())return false;
return array (
'inbox' => '0',
'outbox' => '0',
'total' => 0,
);
?>
|
Java
|
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* 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.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
OWNER 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.
----------------------------------------------------------------------
*/
#include <assimp/Subdivision.h>
#include <assimp/SceneCombiner.h>
#include <assimp/SpatialSort.h>
#include "ProcessHelper.h"
#include <assimp/Vertex.h>
#include <assimp/ai_assert.h>
#include <stdio.h>
using namespace Assimp;
void mydummy() {}
// ------------------------------------------------------------------------------------------------
/** Subdivider stub class to implement the Catmull-Clarke subdivision algorithm. The
* implementation is basing on recursive refinement. Directly evaluating the result is also
* possible and much quicker, but it depends on lengthy matrix lookup tables. */
// ------------------------------------------------------------------------------------------------
class CatmullClarkSubdivider : public Subdivider
{
public:
void Subdivide (aiMesh* mesh, aiMesh*& out, unsigned int num, bool discard_input);
void Subdivide (aiMesh** smesh, size_t nmesh,
aiMesh** out, unsigned int num, bool discard_input);
// ---------------------------------------------------------------------------
/** Intermediate description of an edge between two corners of a polygon*/
// ---------------------------------------------------------------------------
struct Edge
{
Edge()
: ref(0)
{}
Vertex edge_point, midpoint;
unsigned int ref;
};
typedef std::vector<unsigned int> UIntVector;
typedef std::map<uint64_t,Edge> EdgeMap;
// ---------------------------------------------------------------------------
// Hashing function to derive an index into an #EdgeMap from two given
// 'unsigned int' vertex coordinates (!!distinct coordinates - same
// vertex position == same index!!).
// NOTE - this leads to rare hash collisions if a) sizeof(unsigned int)>4
// and (id[0]>2^32-1 or id[0]>2^32-1).
// MAKE_EDGE_HASH() uses temporaries, so INIT_EDGE_HASH() needs to be put
// at the head of every function which is about to use MAKE_EDGE_HASH().
// Reason is that the hash is that hash construction needs to hold the
// invariant id0<id1 to identify an edge - else two hashes would refer
// to the same edge.
// ---------------------------------------------------------------------------
#define MAKE_EDGE_HASH(id0,id1) (eh_tmp0__=id0,eh_tmp1__=id1,\
(eh_tmp0__<eh_tmp1__?std::swap(eh_tmp0__,eh_tmp1__):mydummy()),(uint64_t)eh_tmp0__^((uint64_t)eh_tmp1__<<32u))
#define INIT_EDGE_HASH_TEMPORARIES()\
unsigned int eh_tmp0__, eh_tmp1__;
private:
void InternSubdivide (const aiMesh* const * smesh,
size_t nmesh,aiMesh** out, unsigned int num);
};
// ------------------------------------------------------------------------------------------------
// Construct a subdivider of a specific type
Subdivider* Subdivider::Create (Algorithm algo)
{
switch (algo)
{
case CATMULL_CLARKE:
return new CatmullClarkSubdivider();
};
ai_assert(false);
return NULL; // shouldn't happen
}
// ------------------------------------------------------------------------------------------------
// Call the Catmull Clark subdivision algorithm for one mesh
void CatmullClarkSubdivider::Subdivide (
aiMesh* mesh,
aiMesh*& out,
unsigned int num,
bool discard_input
)
{
ai_assert(mesh != out);
Subdivide(&mesh,1,&out,num,discard_input);
}
// ------------------------------------------------------------------------------------------------
// Call the Catmull Clark subdivision algorithm for multiple meshes
void CatmullClarkSubdivider::Subdivide (
aiMesh** smesh,
size_t nmesh,
aiMesh** out,
unsigned int num,
bool discard_input
)
{
ai_assert( NULL != smesh );
ai_assert( NULL != out );
// course, both regions may not overlap
ai_assert(smesh<out || smesh+nmesh>out+nmesh);
if (!num) {
// No subdivision at all. Need to copy all the meshes .. argh.
if (discard_input) {
for (size_t s = 0; s < nmesh; ++s) {
out[s] = smesh[s];
smesh[s] = NULL;
}
}
else {
for (size_t s = 0; s < nmesh; ++s) {
SceneCombiner::Copy(out+s,smesh[s]);
}
}
return;
}
std::vector<aiMesh*> inmeshes;
std::vector<aiMesh*> outmeshes;
std::vector<unsigned int> maptbl;
inmeshes.reserve(nmesh);
outmeshes.reserve(nmesh);
maptbl.reserve(nmesh);
// Remove pure line and point meshes from the working set to reduce the
// number of edge cases the subdivider is forced to deal with. Line and
// point meshes are simply passed through.
for (size_t s = 0; s < nmesh; ++s) {
aiMesh* i = smesh[s];
// FIX - mPrimitiveTypes might not yet be initialized
if (i->mPrimitiveTypes && (i->mPrimitiveTypes & (aiPrimitiveType_LINE|aiPrimitiveType_POINT))==i->mPrimitiveTypes) {
ASSIMP_LOG_DEBUG("Catmull-Clark Subdivider: Skipping pure line/point mesh");
if (discard_input) {
out[s] = i;
smesh[s] = NULL;
}
else {
SceneCombiner::Copy(out+s,i);
}
continue;
}
outmeshes.push_back(NULL);inmeshes.push_back(i);
maptbl.push_back(static_cast<unsigned int>(s));
}
// Do the actual subdivision on the preallocated storage. InternSubdivide
// *always* assumes that enough storage is available, it does not bother
// checking any ranges.
ai_assert(inmeshes.size()==outmeshes.size()&&inmeshes.size()==maptbl.size());
if (inmeshes.empty()) {
ASSIMP_LOG_WARN("Catmull-Clark Subdivider: Pure point/line scene, I can't do anything");
return;
}
InternSubdivide(&inmeshes.front(),inmeshes.size(),&outmeshes.front(),num);
for (unsigned int i = 0; i < maptbl.size(); ++i) {
ai_assert(nullptr != outmeshes[i]);
out[maptbl[i]] = outmeshes[i];
}
if (discard_input) {
for (size_t s = 0; s < nmesh; ++s) {
delete smesh[s];
}
}
}
// ------------------------------------------------------------------------------------------------
// Note - this is an implementation of the standard (recursive) Cm-Cl algorithm without further
// optimizations (except we're using some nice LUTs). A description of the algorithm can be found
// here: http://en.wikipedia.org/wiki/Catmull-Clark_subdivision_surface
//
// The code is mostly O(n), however parts are O(nlogn) which is therefore the algorithm's
// expected total runtime complexity. The implementation is able to work in-place on the same
// mesh arrays. Calling #InternSubdivide() directly is not encouraged. The code can operate
// in-place unless 'smesh' and 'out' are equal (no strange overlaps or reorderings).
// Previous data is replaced/deleted then.
// ------------------------------------------------------------------------------------------------
void CatmullClarkSubdivider::InternSubdivide (
const aiMesh* const * smesh,
size_t nmesh,
aiMesh** out,
unsigned int num
)
{
ai_assert(NULL != smesh && NULL != out);
INIT_EDGE_HASH_TEMPORARIES();
// no subdivision requested or end of recursive refinement
if (!num) {
return;
}
UIntVector maptbl;
SpatialSort spatial;
// ---------------------------------------------------------------------
// 0. Offset table to index all meshes continuously, generate a spatially
// sorted representation of all vertices in all meshes.
// ---------------------------------------------------------------------
typedef std::pair<unsigned int,unsigned int> IntPair;
std::vector<IntPair> moffsets(nmesh);
unsigned int totfaces = 0, totvert = 0;
for (size_t t = 0; t < nmesh; ++t) {
const aiMesh* mesh = smesh[t];
spatial.Append(mesh->mVertices,mesh->mNumVertices,sizeof(aiVector3D),false);
moffsets[t] = IntPair(totfaces,totvert);
totfaces += mesh->mNumFaces;
totvert += mesh->mNumVertices;
}
spatial.Finalize();
const unsigned int num_unique = spatial.GenerateMappingTable(maptbl,ComputePositionEpsilon(smesh,nmesh));
#define FLATTEN_VERTEX_IDX(mesh_idx, vert_idx) (moffsets[mesh_idx].second+vert_idx)
#define FLATTEN_FACE_IDX(mesh_idx, face_idx) (moffsets[mesh_idx].first+face_idx)
// ---------------------------------------------------------------------
// 1. Compute the centroid point for all faces
// ---------------------------------------------------------------------
std::vector<Vertex> centroids(totfaces);
unsigned int nfacesout = 0;
for (size_t t = 0, n = 0; t < nmesh; ++t) {
const aiMesh* mesh = smesh[t];
for (unsigned int i = 0; i < mesh->mNumFaces;++i,++n)
{
const aiFace& face = mesh->mFaces[i];
Vertex& c = centroids[n];
for (unsigned int a = 0; a < face.mNumIndices;++a) {
c += Vertex(mesh,face.mIndices[a]);
}
c /= static_cast<float>(face.mNumIndices);
nfacesout += face.mNumIndices;
}
}
{
// we want edges to go away before the recursive calls so begin a new scope
EdgeMap edges;
// ---------------------------------------------------------------------
// 2. Set each edge point to be the average of all neighbouring
// face points and original points. Every edge exists twice
// if there is a neighboring face.
// ---------------------------------------------------------------------
for (size_t t = 0; t < nmesh; ++t) {
const aiMesh* mesh = smesh[t];
for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
const aiFace& face = mesh->mFaces[i];
for (unsigned int p =0; p< face.mNumIndices; ++p) {
const unsigned int id[] = {
face.mIndices[p],
face.mIndices[p==face.mNumIndices-1?0:p+1]
};
const unsigned int mp[] = {
maptbl[FLATTEN_VERTEX_IDX(t,id[0])],
maptbl[FLATTEN_VERTEX_IDX(t,id[1])]
};
Edge& e = edges[MAKE_EDGE_HASH(mp[0],mp[1])];
e.ref++;
if (e.ref<=2) {
if (e.ref==1) { // original points (end points) - add only once
e.edge_point = e.midpoint = Vertex(mesh,id[0])+Vertex(mesh,id[1]);
e.midpoint *= 0.5f;
}
e.edge_point += centroids[FLATTEN_FACE_IDX(t,i)];
}
}
}
}
// ---------------------------------------------------------------------
// 3. Normalize edge points
// ---------------------------------------------------------------------
{unsigned int bad_cnt = 0;
for (EdgeMap::iterator it = edges.begin(); it != edges.end(); ++it) {
if ((*it).second.ref < 2) {
ai_assert((*it).second.ref);
++bad_cnt;
}
(*it).second.edge_point *= 1.f/((*it).second.ref+2.f);
}
if (bad_cnt) {
// Report the number of bad edges. bad edges are referenced by less than two
// faces in the mesh. They occur at outer model boundaries in non-closed
// shapes.
ASSIMP_LOG_DEBUG_F("Catmull-Clark Subdivider: got ", bad_cnt, " bad edges touching only one face (totally ",
static_cast<unsigned int>(edges.size()), " edges). ");
}}
// ---------------------------------------------------------------------
// 4. Compute a vertex-face adjacency table. We can't reuse the code
// from VertexTriangleAdjacency because we need the table for multiple
// meshes and out vertex indices need to be mapped to distinct values
// first.
// ---------------------------------------------------------------------
UIntVector faceadjac(nfacesout), cntadjfac(maptbl.size(),0), ofsadjvec(maptbl.size()+1,0); {
for (size_t t = 0; t < nmesh; ++t) {
const aiMesh* const minp = smesh[t];
for (unsigned int i = 0; i < minp->mNumFaces; ++i) {
const aiFace& f = minp->mFaces[i];
for (unsigned int n = 0; n < f.mNumIndices; ++n) {
++cntadjfac[maptbl[FLATTEN_VERTEX_IDX(t,f.mIndices[n])]];
}
}
}
unsigned int cur = 0;
for (size_t i = 0; i < cntadjfac.size(); ++i) {
ofsadjvec[i+1] = cur;
cur += cntadjfac[i];
}
for (size_t t = 0; t < nmesh; ++t) {
const aiMesh* const minp = smesh[t];
for (unsigned int i = 0; i < minp->mNumFaces; ++i) {
const aiFace& f = minp->mFaces[i];
for (unsigned int n = 0; n < f.mNumIndices; ++n) {
faceadjac[ofsadjvec[1+maptbl[FLATTEN_VERTEX_IDX(t,f.mIndices[n])]]++] = FLATTEN_FACE_IDX(t,i);
}
}
}
// check the other way round for consistency
#ifdef ASSIMP_BUILD_DEBUG
for (size_t t = 0; t < ofsadjvec.size()-1; ++t) {
for (unsigned int m = 0; m < cntadjfac[t]; ++m) {
const unsigned int fidx = faceadjac[ofsadjvec[t]+m];
ai_assert(fidx < totfaces);
for (size_t n = 1; n < nmesh; ++n) {
if (moffsets[n].first > fidx) {
const aiMesh* msh = smesh[--n];
const aiFace& f = msh->mFaces[fidx-moffsets[n].first];
bool haveit = false;
for (unsigned int i = 0; i < f.mNumIndices; ++i) {
if (maptbl[FLATTEN_VERTEX_IDX(n,f.mIndices[i])]==(unsigned int)t) {
haveit = true;
break;
}
}
ai_assert(haveit);
if (!haveit) {
ASSIMP_LOG_DEBUG("Catmull-Clark Subdivider: Index not used");
}
break;
}
}
}
}
#endif
}
#define GET_ADJACENT_FACES_AND_CNT(vidx,fstartout,numout) \
fstartout = &faceadjac[ofsadjvec[vidx]], numout = cntadjfac[vidx]
typedef std::pair<bool,Vertex> TouchedOVertex;
std::vector<TouchedOVertex > new_points(num_unique,TouchedOVertex(false,Vertex()));
// ---------------------------------------------------------------------
// 5. Spawn a quad from each face point to the corresponding edge points
// the original points being the fourth quad points.
// ---------------------------------------------------------------------
for (size_t t = 0; t < nmesh; ++t) {
const aiMesh* const minp = smesh[t];
aiMesh* const mout = out[t] = new aiMesh();
for (unsigned int a = 0; a < minp->mNumFaces; ++a) {
mout->mNumFaces += minp->mFaces[a].mNumIndices;
}
// We need random access to the old face buffer, so reuse is not possible.
mout->mFaces = new aiFace[mout->mNumFaces];
mout->mNumVertices = mout->mNumFaces*4;
mout->mVertices = new aiVector3D[mout->mNumVertices];
// quads only, keep material index
mout->mPrimitiveTypes = aiPrimitiveType_POLYGON;
mout->mMaterialIndex = minp->mMaterialIndex;
if (minp->HasNormals()) {
mout->mNormals = new aiVector3D[mout->mNumVertices];
}
if (minp->HasTangentsAndBitangents()) {
mout->mTangents = new aiVector3D[mout->mNumVertices];
mout->mBitangents = new aiVector3D[mout->mNumVertices];
}
for(unsigned int i = 0; minp->HasTextureCoords(i); ++i) {
mout->mTextureCoords[i] = new aiVector3D[mout->mNumVertices];
mout->mNumUVComponents[i] = minp->mNumUVComponents[i];
}
for(unsigned int i = 0; minp->HasVertexColors(i); ++i) {
mout->mColors[i] = new aiColor4D[mout->mNumVertices];
}
mout->mNumVertices = mout->mNumFaces<<2u;
for (unsigned int i = 0, v = 0, n = 0; i < minp->mNumFaces;++i) {
const aiFace& face = minp->mFaces[i];
for (unsigned int a = 0; a < face.mNumIndices;++a) {
// Get a clean new face.
aiFace& faceOut = mout->mFaces[n++];
faceOut.mIndices = new unsigned int [faceOut.mNumIndices = 4];
// Spawn a new quadrilateral (ccw winding) for this original point between:
// a) face centroid
centroids[FLATTEN_FACE_IDX(t,i)].SortBack(mout,faceOut.mIndices[0]=v++);
// b) adjacent edge on the left, seen from the centroid
const Edge& e0 = edges[MAKE_EDGE_HASH(maptbl[FLATTEN_VERTEX_IDX(t,face.mIndices[a])],
maptbl[FLATTEN_VERTEX_IDX(t,face.mIndices[a==face.mNumIndices-1?0:a+1])
])]; // fixme: replace with mod face.mNumIndices?
// c) adjacent edge on the right, seen from the centroid
const Edge& e1 = edges[MAKE_EDGE_HASH(maptbl[FLATTEN_VERTEX_IDX(t,face.mIndices[a])],
maptbl[FLATTEN_VERTEX_IDX(t,face.mIndices[!a?face.mNumIndices-1:a-1])
])]; // fixme: replace with mod face.mNumIndices?
e0.edge_point.SortBack(mout,faceOut.mIndices[3]=v++);
e1.edge_point.SortBack(mout,faceOut.mIndices[1]=v++);
// d= original point P with distinct index i
// F := 0
// R := 0
// n := 0
// for each face f containing i
// F := F+ centroid of f
// R := R+ midpoint of edge of f from i to i+1
// n := n+1
//
// (F+2R+(n-3)P)/n
const unsigned int org = maptbl[FLATTEN_VERTEX_IDX(t,face.mIndices[a])];
TouchedOVertex& ov = new_points[org];
if (!ov.first) {
ov.first = true;
const unsigned int* adj; unsigned int cnt;
GET_ADJACENT_FACES_AND_CNT(org,adj,cnt);
if (cnt < 3) {
ov.second = Vertex(minp,face.mIndices[a]);
}
else {
Vertex F,R;
for (unsigned int o = 0; o < cnt; ++o) {
ai_assert(adj[o] < totfaces);
F += centroids[adj[o]];
// adj[0] is a global face index - search the face in the mesh list
const aiMesh* mp = NULL;
size_t nidx;
if (adj[o] < moffsets[0].first) {
mp = smesh[nidx=0];
}
else {
for (nidx = 1; nidx<= nmesh; ++nidx) {
if (nidx == nmesh ||moffsets[nidx].first > adj[o]) {
mp = smesh[--nidx];
break;
}
}
}
ai_assert(adj[o]-moffsets[nidx].first < mp->mNumFaces);
const aiFace& f = mp->mFaces[adj[o]-moffsets[nidx].first];
bool haveit = false;
// find our original point in the face
for (unsigned int m = 0; m < f.mNumIndices; ++m) {
if (maptbl[FLATTEN_VERTEX_IDX(nidx,f.mIndices[m])] == org) {
// add *both* edges. this way, we can be sure that we add
// *all* adjacent edges to R. In a closed shape, every
// edge is added twice - so we simply leave out the
// factor 2.f in the amove formula and get the right
// result.
const Edge& c0 = edges[MAKE_EDGE_HASH(org,maptbl[FLATTEN_VERTEX_IDX(
nidx,f.mIndices[!m?f.mNumIndices-1:m-1])])];
// fixme: replace with mod face.mNumIndices?
const Edge& c1 = edges[MAKE_EDGE_HASH(org,maptbl[FLATTEN_VERTEX_IDX(
nidx,f.mIndices[m==f.mNumIndices-1?0:m+1])])];
// fixme: replace with mod face.mNumIndices?
R += c0.midpoint+c1.midpoint;
haveit = true;
break;
}
}
// this invariant *must* hold if the vertex-to-face adjacency table is valid
ai_assert(haveit);
if ( !haveit ) {
ASSIMP_LOG_WARN( "OBJ: no name for material library specified." );
}
}
const float div = static_cast<float>(cnt), divsq = 1.f/(div*div);
ov.second = Vertex(minp,face.mIndices[a])*((div-3.f) / div) + R*divsq + F*divsq;
}
}
ov.second.SortBack(mout,faceOut.mIndices[2]=v++);
}
}
}
} // end of scope for edges, freeing its memory
// ---------------------------------------------------------------------
// 7. Apply the next subdivision step.
// ---------------------------------------------------------------------
if (num != 1) {
std::vector<aiMesh*> tmp(nmesh);
InternSubdivide (out,nmesh,&tmp.front(),num-1);
for (size_t i = 0; i < nmesh; ++i) {
delete out[i];
out[i] = tmp[i];
}
}
}
|
Java
|
--[[
Copyright (c) 2016 Calvin Rose
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.
]]
-- A filesystem abstraction on top of luv. Uses non-blocking coroutines
-- when available, otherwise uses blocking calls.
--
-- Modified from https://github.com/luvit/lit/blob/master/deps/coro-fs.lua
--- Abstractions around the libuv filesystem.
-- @module moonmint.fs
-- @author Calvin Rose
-- @copyright 2016
-- @license MIT
local uv = require 'luv'
local pathJoin = require('moonmint.deps.pathjoin').pathJoin
local fs = {}
local corunning = coroutine.running
local coresume = coroutine.resume
local coyield = coroutine.yield
local function noop() end
local function makeCallback(sync)
local thread = corunning()
if thread and not sync then -- Non Blocking callback (coroutines)
return function (err, value, ...)
if err then
assert(coresume(thread, nil, err))
else
assert(coresume(thread, value == nil and true or value, ...))
end
end
else -- Blocking callback
local context = {}
return function (err, first, ...)
context.done = true
context.err = err
context.first = first
context.values = {...}
end, context
end
end
local unpack = unpack or table.unpack
local function tryYield(context)
if context then -- Blocking
while not context.done do
uv.run('once') -- Should we use the default event loop?
end
local err = context.err
local first = context.first
if err then
return nil, err
else
return first == nil and true or first, unpack(context.values)
end
else -- Non blocking
return coyield()
end
end
--- Wrapper around uv.fs_mkdir
function fs.mkdir(sync, path, mode)
local cb, context = makeCallback(sync)
uv.fs_mkdir(path, mode or 511, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_open
function fs.open(sync, path, flags, mode)
local cb, context = makeCallback(sync)
uv.fs_open(path, flags or "r", mode or 428, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_unlink
function fs.unlink(sync, path)
local cb, context = makeCallback(sync)
uv.fs_unlink(path, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_stat
function fs.stat(sync, path)
local cb, context = makeCallback(sync)
uv.fs_stat(path, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_lstat
function fs.lstat(sync, path)
local cb, context = makeCallback(sync)
uv.fs_lstat(path, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_fstat
function fs.fstat(sync, fd)
local cb, context = makeCallback(sync)
uv.fs_fstat(fd, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_chmod
function fs.chmod(sync, path)
local cb, context = makeCallback(sync)
uv.fs_chmod(path, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_fchmod
function fs.fchmod(sync, path)
local cb, context = makeCallback(sync)
uv.fs_fchmod(path, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_read
function fs.read(sync, fd, length, offset)
local cb, context = makeCallback(sync)
uv.fs_read(fd, length or 1024 * 48, offset or -1, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_write
function fs.write(sync, fd, data, offset)
local cb, context = makeCallback(sync)
uv.fs_write(fd, data, offset or -1, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_close
function fs.close(sync, fd)
local cb, context = makeCallback(sync)
uv.fs_close(fd, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_symlink
function fs.symlink(sync, target, path)
local cb, context = makeCallback(sync)
uv.fs_symlink(target, path, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_readlink
function fs.readlink(sync, path)
local cb, context = makeCallback(sync)
uv.fs_readlink(path, cb)
return tryYield(context)
end
--- Wrapper around uv.fs_access
function fs.access(sync, path, flags)
local cb, context = makeCallback(sync)
uv.fs_access(path, flags or '', cb)
return tryYield(context)
end
--- Wrapper around uv.fs_rmdir
function fs.rmdir(sync, path)
local cb, context = makeCallback(sync)
uv.fs_rmdir(path, cb)
return tryYield(context)
end
--- Remove directories recursively like the UNIX command `rm -rf`.
function fs.rmrf(sync, path)
local success, err = fs.rmdir(sync, path)
if success then
return success, err
end
if err:match('^ENOTDIR:') then return fs.unlink(sync, path) end
if not err:match('^ENOTEMPTY:') then return success, err end
for entry in assert(fs.scandir(sync, path)) do
local subPath = pathJoin(path, entry.name)
if entry.type == 'directory' then
success, err = fs.rmrf(sync, pathJoin(path, entry.name))
else
success, err = fs.unlink(sync, subPath)
end
if not success then return success, err end
end
return fs.rmdir(sync, path)
end
--- Smart wrapper around uv.fs_scandir.
-- @treturn function an iterator over file objects
-- in a directory. Each file table has a `name` property
-- and a `type` property.
function fs.scandir(sync, path)
local cb, context = makeCallback(sync)
uv.fs_scandir(path, cb)
local req, err = tryYield(context)
if not req then return nil, err end
return function ()
local name, typ = uv.fs_scandir_next(req)
if not name then return name, typ end
if type(name) == "table" then return name end
return {
name = name,
type = typ
}
end
end
--- Reads a file into a string
function fs.readFile(sync, path)
local fd, stat, data, err
fd, err = fs.open(sync, path)
if err then return nil, err end
stat, err = fs.fstat(sync, fd)
if stat then
data, err = fs.read(sync, fd, stat.size)
end
uv.fs_close(fd, noop)
return data, err
end
--- Writes a string to a file. Overwrites the file
-- if it already exists.
function fs.writeFile(sync, path, data, mkdir)
local fd, success, err
fd, err = fs.open(sync, path, "w")
if err then
if mkdir and err:match("^ENOENT:") then
success, err = fs.mkdirp(sync, pathJoin(path, ".."))
if success then return fs.writeFile(sync, path, data) end
end
return nil, err
end
success, err = fs.write(sync, fd, data)
uv.fs_close(fd, noop)
return success, err
end
--- Append a string to a file.
function fs.appendFile(sync, path, data, mkdir)
local fd, success, err
fd, err = fs.open(sync, path, "w+")
if err then
if mkdir and err:match("^ENOENT:") then
success, err = fs.mkdirp(sync, pathJoin(path, ".."))
if success then return fs.appendFile(sync, path, data) end
end
return nil, err
end
success, err = fs.write(sync, fd, data)
uv.fs_close(fd, noop)
return success, err
end
--- Make directories recursively. Similar to the UNIX `mkdir -p`.
function fs.mkdirp(sync, path, mode)
local success, err = fs.mkdir(sync, path, mode)
if success or err:match("^EEXIST") then
return true
end
if err:match("^ENOENT:") then
success, err = fs.mkdirp(sync, pathJoin(path, ".."), mode)
if not success then return nil, err end
return fs.mkdir(sync, path, mode)
end
return nil, err
end
-- Make sync and async versions
local function makeAliases(module)
local ret = {}
local ext = {}
local sync = {}
for k, v in pairs(module) do
if type(v) == 'function' then
if k == 'chroot' then
sync[k], ext[k], ret[k] = v, v, v
else
sync[k] = function(...)
return v(true, ...)
end
ext[k] = v
ret[k] = function(...)
return v(false, ...)
end
end
end
end
ret.s = sync
ret.sync = sync
ret.ext = ext
return ret
end
--- Creates a clone of fs, but with a different base directory.
function fs.chroot(base)
local chroot = {
base = base,
fstat = fs.fstat,
fchmod = fs.fchmod,
read = fs.read,
write = fs.write,
close = fs.close,
}
local function resolve(path)
assert(path, "path missing")
return pathJoin(base, pathJoin(path))
end
function chroot.mkdir(sync, path, mode)
return fs.mkdir(sync, resolve(path), mode)
end
function chroot.mkdirp(sync, path, mode)
return fs.mkdirp(sync, resolve(path), mode)
end
function chroot.open(sync, path, flags, mode)
return fs.open(sync, resolve(path), flags, mode)
end
function chroot.unlink(sync, path)
return fs.unlink(sync, resolve(path))
end
function chroot.stat(sync, path)
return fs.stat(sync, resolve(path))
end
function chroot.lstat(sync, path)
return fs.lstat(sync, resolve(path))
end
function chroot.symlink(sync, target, path)
-- TODO: should we resolve absolute target paths or treat it as opaque data?
return fs.symlink(sync, target, resolve(path))
end
function chroot.readlink(sync, path)
return fs.readlink(sync, resolve(path))
end
function chroot.chmod(sync, path, mode)
return fs.chmod(sync, resolve(path), mode)
end
function chroot.access(sync, path, flags)
return fs.access(sync, resolve(path), flags)
end
function chroot.rename(sync, path, newPath)
return fs.rename(sync, resolve(path), resolve(newPath))
end
function chroot.rmdir(sync, path)
return fs.rmdir(sync, resolve(path))
end
function chroot.rmrf(sync, path)
return fs.rmrf(sync, resolve(path))
end
function chroot.scandir(sync, path)
return fs.scandir(sync, resolve(path))
end
function chroot.readFile(sync, path)
return fs.readFile(sync, resolve(path))
end
function chroot.writeFile(sync, path, data, mkdir)
return fs.writeFile(sync, resolve(path), data, mkdir)
end
function chroot.appendFile(sync, path, data, mkdir)
return fs.appendFile(sync, resolve(path), data, mkdir)
end
function chroot.chroot(sync, newBase)
return fs.chroot(sync, resolve(newBase))
end
return makeAliases(chroot)
end
return makeAliases(fs)
|
Java
|
namespace SIM.Tool.Windows.MainWindowComponents
{
using System.Windows;
using SIM.Instances;
using SIM.Tool.Base;
using SIM.Tool.Base.Plugins;
using SIM.Tool.Windows.Dialogs;
using JetBrains.Annotations;
[UsedImplicitly]
public class DatabaseManagerButton : IMainWindowButton
{
#region Public methods
public bool IsEnabled(Window mainWindow, Instance instance)
{
return true;
}
public void OnClick(Window mainWindow, Instance instance)
{
if (EnvironmentHelper.CheckSqlServer())
{
WindowHelper.ShowDialog(new DatabasesDialog(), mainWindow);
}
}
#endregion
}
}
|
Java
|
package com.xeiam.xchange.lakebtc.marketdata;
import static org.fest.assertions.api.Assertions.assertThat;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import org.junit.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xeiam.xchange.lakebtc.dto.marketdata.LakeBTCOrderBook;
import com.xeiam.xchange.lakebtc.dto.marketdata.LakeBTCTicker;
import com.xeiam.xchange.lakebtc.dto.marketdata.LakeBTCTickers;
public class LakeBTCMarketDataJsonTest {
@Test
public void testDeserializeTicker() throws IOException {
// Read in the JSON from the example resources
InputStream is = LakeBTCMarketDataJsonTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");
// Use Jackson to parse it
ObjectMapper mapper = new ObjectMapper();
LakeBTCTickers tickers = mapper.readValue(is, LakeBTCTickers.class);
LakeBTCTicker cnyTicker = tickers.getCny();
assertThat(cnyTicker.getAsk()).isEqualTo("3524.07");
assertThat(cnyTicker.getBid()).isEqualTo("3517.13");
assertThat(cnyTicker.getLast()).isEqualTo("3524.07");
assertThat(cnyTicker.getHigh()).isEqualTo("3584.97");
assertThat(cnyTicker.getLow()).isEqualTo("3480.07");
assertThat(cnyTicker.getVolume()).isEqualTo("5964.7677");
LakeBTCTicker usdTicker = tickers.getUsd();
assertThat(usdTicker.getAsk()).isEqualTo("564.63");
assertThat(usdTicker.getBid()).isEqualTo("564.63");
assertThat(usdTicker.getLast()).isEqualTo("564.4");
assertThat(usdTicker.getHigh()).isEqualTo("573.83");
assertThat(usdTicker.getLow()).isEqualTo("557.7");
assertThat(usdTicker.getVolume()).isEqualTo("3521.2782");
}
@Test
public void testDeserializeOrderBook() throws IOException {
// Read in the JSON from the example resources
InputStream is = LakeBTCMarketDataJsonTest.class.getResourceAsStream("/marketdata/example-orderbook-data.json");
// Use Jackson to parse it
ObjectMapper mapper = new ObjectMapper();
LakeBTCOrderBook orderBook = mapper.readValue(is, LakeBTCOrderBook.class);
BigDecimal[][] asks = orderBook.getAsks();
assertThat(asks).hasSize(3);
assertThat(asks[0][0]).isEqualTo("564.87");
assertThat(asks[0][1]).isEqualTo("22.371");
BigDecimal[][] bids = orderBook.getBids();
assertThat(bids).hasSize(3);
assertThat(bids[2][0]).isEqualTo("558.08");
assertThat(bids[2][1]).isEqualTo("0.9878");
}
}
|
Java
|
using System;
using BEPUutilities.DataStructures;
namespace BEPUutilities.ResourceManagement
{
/// <summary>
/// Uses a spinlock to safely access resources.
/// </summary>
/// <typeparam name="T">Type of object to store in the pool.</typeparam>
public class LockingResourcePool<T> : ResourcePool<T> where T : class, new()
{
private readonly ConcurrentDeque<T> stack;
/// <summary>
/// Constructs a new thread-unsafe resource pool.
/// </summary>
/// <param name="initialResourceCount">Number of resources to include in the pool by default.</param>
/// <param name="initializer">Function to initialize new instances in the resource pool with.</param>
public LockingResourcePool(int initialResourceCount, Action<T> initializer)
{
InstanceInitializer = initializer;
stack = new ConcurrentDeque<T>(initialResourceCount);
Initialize(initialResourceCount);
}
/// <summary>
/// Constructs a new thread-unsafe resource pool.
/// </summary>
/// <param name="initialResourceCount">Number of resources to include in the pool by default.</param>
public LockingResourcePool(int initialResourceCount)
: this(initialResourceCount, null)
{
}
/// <summary>
/// Constructs a new thread-unsafe resource pool.
/// </summary>
public LockingResourcePool()
: this(10)
{
}
/// <summary>
/// Gets the number of resources in the pool.
/// Even if the resource count hits 0, resources
/// can still be requested; they will be allocated
/// dynamically.
/// </summary>
public override int Count
{
get { return stack.Count; }
}
/// <summary>
/// Gives an item back to the resource pool.
/// </summary>
/// <param name="item">Item to return.</param>
public override void GiveBack(T item)
{
stack.Enqueue(item);
}
/// <summary>
/// Initializes the pool with some resources.
/// Throws away excess resources.
/// </summary>
/// <param name="initialResourceCount">Number of resources to include.</param>
public override void Initialize(int initialResourceCount)
{
while (stack.Count > initialResourceCount)
{
T toRemove;
stack.TryUnsafeDequeueFirst(out toRemove);
}
int length = stack.lastIndex - stack.firstIndex + 1; //lastIndex is inclusive, so add 1.
if (InstanceInitializer != null)
for (int i = 0; i < length; i++)
{
InstanceInitializer(stack.array[(stack.firstIndex + i) % stack.array.Length]);
}
while (stack.Count < initialResourceCount)
{
stack.UnsafeEnqueue(CreateNewResource());
}
}
/// <summary>
/// Takes an item from the resource pool.
/// </summary>
/// <returns>Item to take.</returns>
public override T Take()
{
T toTake;
if (stack.TryDequeueFirst(out toTake))
{
return toTake;
}
return CreateNewResource();
}
/// <summary>
/// Clears out the resource pool.
/// </summary>
public override void Clear()
{
while (stack.Count > 0)
{
T item;
stack.TryDequeueFirst(out item);
}
}
}
}
|
Java
|
version https://git-lfs.github.com/spec/v1
oid sha256:71736be070607c3c30f4c139b063edf1b1ffa587cf725a0acc1e06c6d3af0e48
size 53235
|
Java
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
CurrentModel = mongoose.model('Attendance'),
Schedule = mongoose.model('Schedule'),
Group = mongoose.model('Group'),
_ = require('lodash');
exports.attendance = function(req, res, next, id) {
CurrentModel.load(id, function(err, item) {
if (err) return next(err);
if (!item) return next(new Error('Failed to load item ' + id));
req.attendance = item;
next();
});
};
exports.schedule = function(req, res, next, id) {
Schedule.load(id, function(err, item) {
if (err) return next(err);
if (!item) return next(new Error('Failed to load item ' + id));
req.schedule = item;
next();
});
};
exports.group = function(req, res, next, id) {
Group.load(id, function(err, item) {
if (err) return next(err);
if (!item) return next(new Error('Failed to load item ' + id));
req.group = item;
next();
});
};
exports.create = function(req, res) {
var value = new CurrentModel(req.body);
value.group = req.group;
value.schedule = req.schedule;
value.save(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
object: value
});
} else {
res.jsonp(value);
}
});
};
exports.update = function(req, res) {
var item = req.attendance;
item = _.extend(item, req.body);
item.save(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
object: item
});
} else {
res.jsonp(item);
}
});
};
exports.destroy = function(req, res) {
var item = req.attendance;
item.remove(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
object: item
});
} else {
res.jsonp(item);
}
});
};
exports.show = function(req, res) {
res.jsonp(req.attendance);
};
exports.all = function(req, res) {
CurrentModel.find({ group: req.group, schedule: req.schedule }).populate('participant', 'name email').exec(function(err, items) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(items);
}
});
};
|
Java
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Plugin</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
body {
margin: 5px 5px 5px 5px;
background-color: #ffffff;
}
/* ========== Text Styles ========== */
hr { color: #000000}
body, table /* Normal text */
{
font-size: 10pt;
font-family: 'Arial', 'Helvetica', sans-serif;
font-style: normal;
font-weight: normal;
color: #000000;
text-decoration: none;
}
span.rvts1 /* Heading */
{
font-weight: bold;
color: #0000ff;
}
span.rvts2 /* Subheading */
{
font-weight: bold;
color: #000080;
}
span.rvts3 /* Keywords */
{
font-style: italic;
color: #800000;
}
a.rvts4, span.rvts4 /* Jump 1 */
{
color: #008000;
text-decoration: underline;
}
a.rvts5, span.rvts5 /* Jump 2 */
{
color: #008000;
text-decoration: underline;
}
span.rvts6 /* Font Hint */
{
color: #808080;
}
span.rvts7 /* Font Hint Title */
{
font-size: 15pt;
font-family: 'Tahoma', 'Geneva', sans-serif;
font-weight: bold;
color: #404040;
}
span.rvts8 /* Font Hint Bold */
{
font-weight: bold;
color: #808080;
}
span.rvts9 /* Font Hint Italic */
{
font-style: italic;
color: #808080;
}
span.rvts10 /* Font Style */
{
font-size: 16pt;
font-family: 'Tahoma', 'Geneva', sans-serif;
color: #ffffff;
}
span.rvts11 /* Font Style */
{
font-family: 'MS Sans Serif', 'Geneva', sans-serif;
color: #808080;
}
span.rvts12 /* Font Style */
{
font-family: 'Verdana', 'Geneva', sans-serif;
font-style: italic;
color: #c0c0c0;
}
a.rvts13, span.rvts13 /* Font Style */
{
font-family: 'Verdana', 'Geneva', sans-serif;
font-style: italic;
color: #6666ff;
text-decoration: underline;
}
/* ========== Para Styles ========== */
p,ul,ol /* Paragraph Style */
{
text-align: left;
text-indent: 0px;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
.rvps1 /* Centered */
{
text-align: center;
}
.rvps2 /* Paragraph Style */
{
background: #c0c0c0;
margin: 0px 0px 20px 0px;
}
.rvps3 /* Paragraph Style */
{
text-align: center;
background: #c0c0c0;
margin: 20px 0px 0px 0px;
}
.rvps4 /* Paragraph Style */
{
border-color: #c0c0c0;
border-style: solid;
border-width: 1px;
border-right: none;
border-bottom: none;
border-left: none;
background: #ffffff;
padding: 3px 0px 0px 0px;
margin: 27px 0px 0px 0px;
}
--></style>
<script type="text/javascript">if(top.frames.length == 0) { top.location.href="../thewebmind.htm?Plugin.html"; }</script>
<meta name="generator" content="HelpNDoc Free"></head>
<body>
<p class=rvps2><span class=rvts10>Plugin</span></p>
<p><br></p>
<p class=rvps3><span class=rvts11>Copyright © 2009, theWebMind.org</span></p>
<p class=rvps4><span class=rvts12>This help file has been generated by the freeware version of </span><a class=rvts13 href="http://www.ibe-software.com/products/software/helpndoc/" target="_blank">HelpNDoc</a></p>
</body></html>
|
Java
|
#ifndef OSCTOOLS_HPP_INCLUDED
#define OSCTOOLS_HPP_INCLUDED
class OscOptionalUnpacker
{
ofxOscMessage & msg;
int n;
public:
OscOptionalUnpacker(ofxOscMessage & m):msg(m),n(0){}
OscOptionalUnpacker & operator >> (int & i)
{
if(n < msg.getNumArgs())
{
i = msg.getArgAsInt32( n++ );
}
return *this;
}
OscOptionalUnpacker & operator >> (float & i)
{
if(n < msg.getNumArgs())
{
i = msg.getArgAsFloat( n++ );
}
return *this;
}
OscOptionalUnpacker & operator >> (double & i)
{
if(n < msg.getNumArgs())
{
i = msg.getArgAsFloat( n++ );
}
return *this;
}
OscOptionalUnpacker & operator >> (std::string & i)
{
if(n < msg.getNumArgs())
{
i = msg.getArgAsString( n++ );
}
return *this;
}
bool Eos()
{
return n >= msg.getNumArgs();
}
};
class OscPacker
{
ofxOscMessage & msg;
public:
OscPacker(ofxOscMessage & m):msg(m){}
OscPacker & operator << (int i)
{
msg.addIntArg(i);
return *this;
}
OscPacker & operator << (unsigned int i)
{
msg.addIntArg(i);
return *this;
}
OscPacker & operator << (float i)
{
msg.addFloatArg(i);
return *this;
}
OscPacker & operator << (const std::string & i)
{
msg.addStringArg(i);
return *this;
}
};
#endif // OSCTOOLS_HPP_INCLUDED
|
Java
|
package org.magcruise.gaming.executor.api.message;
import org.magcruise.gaming.lang.Message;
import org.magcruise.gaming.lang.SConstructor;
public interface RequestToGameExecutor extends Message {
@Override
public SConstructor<? extends RequestToGameExecutor> toConstructor(ToExpressionStyle style);
@Override
public default SConstructor<? extends RequestToGameExecutor> toConstructor() {
return toConstructor(ToExpressionStyle.DEFAULT);
}
}
|
Java
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace UnitTests
{
[TestFixture]
public class ProjectTests
{
[TestFixtureSetUp]
public void Initialize()
{
}
[Test]
public void TestCsvRename()
{
}
}
}
|
Java
|
import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger.debug('getDmidecode: start')
res = {}
# Maybe we are in linux and we can directly read the
linux_dmi_path = '/sys/class/dmi/id/'
if os.path.exists(linux_dmi_path):
file_names = os.listdir(linux_dmi_path)
for fname in file_names:
p = os.path.join(linux_dmi_path, fname)
# There can be a link there, skip them
if os.path.isfile(p):
f = open(p, 'r')
buf = f.read()
f.close()
res[fname] = buf.strip()
logger.debug('getdmidecode: completed, returning')
return res
elif os.name == 'nt':
self.set_not_eligible('Windows is currently not managed for DMI informations')
return False
# Ok not direct access, try to launch with
else: # try dmidecode way, if exists
res = self.execute_shell('LANG=C dmidecode -s')
if res is False:
self.set_not_eligible('Cannot read dmi information')
return False
for p in res.split('\n'):
if re.search('^ ', p):
buf = self.execute_shell('LANG=C dmidecode -s %s' % p).strip()
if 'No such file or directory' in buf:
logger.warning('Cannot access to dmi information with dmidecode command, exiting this collector.')
self.set_not_eligible('Cannot get DMI informations because the dmidecode command is missing.')
return res
res[p.replace('-', '_').strip()] = buf
logger.debug('getdmidecode: completed, returning')
return res
|
Java
|
# Websocket Module
| Since | Origin / Contributor | Maintainer | Source |
| :----- | :-------------------- | :---------- | :------ |
| 2016-08-02 | [Luís Fonseca](https://github.com/luismfonseca) | [Luís Fonseca](https://github.com/luismfonseca) | [websocket.c](../../../app/modules/websocket.c)|
A websocket *client* module that implements [RFC6455](https://tools.ietf.org/html/rfc6455) (version 13) and provides a simple interface to send and receive messages.
The implementation supports fragmented messages, automatically respondes to ping requests and periodically pings if the server isn't communicating.
**SSL/TLS support**
Take note of constraints documented in the [net module](net.md).
## websocket.createClient()
Creates a new websocket client. This client should be stored in a variable and will provide all the functions to handle a connection.
When the connection becomes closed, the same client can still be reused - the callback functions are kept - and you can connect again to any server.
Before disposing the client, make sure to call `ws:close()`.
#### Syntax
`websocket.createClient()`
#### Parameters
none
#### Returns
`websocketclient`
#### Example
```lua
local ws = websocket.createClient()
-- ...
ws:close()
ws = nil
```
## websocket.client:close()
Closes a websocket connection. The client issues a close frame and attemtps to gracefully close the websocket.
If server doesn't reply, the connection is terminated after a small timeout.
This function can be called even if the websocket isn't connected.
This function must *always* be called before disposing the reference to the websocket client.
#### Syntax
`websocket:close()`
#### Parameters
none
#### Returns
`nil`
#### Example
```lua
ws = websocket.createClient()
ws:close()
ws:close() -- nothing will happen
ws = nil -- fully dispose the client as Lua will now gc it
```
## websocket.client:config(params)
Configures websocket client instance.
#### Syntax
`websocket:config(params)`
#### Parameters
- `params` table with configuration parameters. Following keys are recognized:
- `headers` table of extra request headers affecting every request
#### Returns
`nil`
#### Example
```lua
ws = websocket.createClient()
ws:config({headers={['User-Agent']='NodeMCU'}})
```
## websocket.client:connect()
Attempts to estabilish a websocket connection to the given URL.
#### Syntax
`websocket:connect(url)`
#### Parameters
- `url` the URL for the websocket.
#### Returns
`nil`
#### Example
```lua
ws = websocket.createClient()
ws:connect('ws://echo.websocket.org')
```
If it fails, an error will be delivered via `websocket:on("close", handler)`.
## websocket.client:on()
Registers the callback function to handle websockets events (there can be only one handler function registered per event type).
#### Syntax
`websocket:on(eventName, function(ws, ...))`
#### Parameters
- `eventName` the type of websocket event to register the callback function. Those events are: `connection`, `receive` and `close`.
- `function(ws, ...)` callback function.
The function first parameter is always the websocketclient.
Other arguments are required depending on the event type. See example for more details.
If `nil`, any previously configured callback is unregistered.
#### Returns
`nil`
#### Example
```lua
local ws = websocket.createClient()
ws:on("connection", function(ws)
print('got ws connection')
end)
ws:on("receive", function(_, msg, opcode)
print('got message:', msg, opcode) -- opcode is 1 for text message, 2 for binary
end)
ws:on("close", function(_, status)
print('connection closed', status)
ws = nil -- required to Lua gc the websocket client
end)
ws:connect('ws://echo.websocket.org')
```
Note that the close callback is also triggered if any error occurs.
The status code for the close, if not 0 then it represents an error, as described in the following table.
| Status Code | Explanation |
| :----------- | :----------- |
| 0 | User requested close or the connection was terminated gracefully |
| -1 | Failed to extract protocol from URL |
| -2 | Hostname is too large (>256 chars) |
| -3 | Invalid port number (must be >0 and <= 65535) |
| -4 | Failed to extract hostname |
| -5 | DNS failed to lookup hostname |
| -6 | Server requested termination |
| -7 | Server sent invalid handshake HTTP response (i.e. server sent a bad key) |
| -8 to -14 | Failed to allocate memory to receive message |
| -15 | Server not following FIN bit protocol correctly |
| -16 | Failed to allocate memory to send message |
| -17 | Server is not switching protocols |
| -18 | Connect timeout |
| -19 | Server is not responding to health checks nor communicating |
| -99 to -999 | Well, something bad has happenned |
## websocket.client:send()
Sends a message through the websocket connection.
#### Syntax
`websocket:send(message, opcode)`
#### Parameters
- `message` the data to send.
- `opcode` optionally set the opcode (default: 1, text message)
#### Returns
`nil` or an error if socket is not connected
#### Example
```lua
ws = websocket.createClient()
ws:on("connection", function()
ws:send('hello!')
end)
ws:connect('ws://echo.websocket.org')
```
|
Java
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace It.Uniba.Di.Cdg.SocialTfs.ProxyServer.AdminPanel {
public partial class EditService {
/// <summary>
/// ErrorPA control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl ErrorPA;
/// <summary>
/// Id control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputHidden Id;
/// <summary>
/// DataTable control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable DataTable;
/// <summary>
/// ServiceRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ServiceRW;
/// <summary>
/// ServiceTB control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText ServiceTB;
/// <summary>
/// NameRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow NameRW;
/// <summary>
/// NameTB control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText NameTB;
/// <summary>
/// ErrNameRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ErrNameRW;
/// <summary>
/// HostRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow HostRW;
/// <summary>
/// HostTB control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText HostTB;
/// <summary>
/// ErrHostRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ErrHostRW;
/// <summary>
/// ConsumerKeyRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ConsumerKeyRW;
/// <summary>
/// ConsumerKeyTB control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText ConsumerKeyTB;
/// <summary>
/// ErrConsumerKeyRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ErrConsumerKeyRW;
/// <summary>
/// ConsumerSecretRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ConsumerSecretRW;
/// <summary>
/// ConsumerSecretTB control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText ConsumerSecretTB;
/// <summary>
/// ErrConsumerSecretRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ErrConsumerSecretRW;
/// <summary>
/// GitHubLabelRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow GitHubLabelRW;
/// <summary>
/// GitHubLabelTB control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText GitHubLabelTB;
/// <summary>
/// ErrGitHubLabelRW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow ErrGitHubLabelRW;
/// <summary>
/// Submit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputButton Submit;
/// <summary>
/// Reset control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputReset Reset;
}
}
|
Java
|
//
// VOKManagedObjectMapper.h
// Vokoder
//
// Copyright © 2015 Vokal.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "VOKCoreDataCollectionTypes.h"
#import "VOKNullabilityFeatures.h"
#import "VOKManagedObjectMap.h"
NS_ASSUME_NONNULL_BEGIN
/// An completion block to run after importing each foreign dictionary.
typedef void(^VOKPostImportBlock)(VOKStringToObjectDictionary *inputDict, VOKManagedObjectSubclass *outputObject);
/// A completion block to run after exporting a managed object to a dictionary.
typedef void(^VOKPostExportBlock)(VOKStringToObjectMutableDictionary *outputDict, VOKManagedObjectSubclass *inputObject);
@interface VOKManagedObjectMapper : NSObject
/// Used to identify and update NSManagedObjects. Like a "primary key" in databases.
@property (nonatomic, copy) NSString * __nullable uniqueComparisonKey;
/// Used internally to filter input data. Updates automatically to match the uniqueComparisonKey.
@property (nonatomic, copy) NSString * __nullable foreignUniqueComparisonKey;
/// If set to NO changes are discarded if a local object exists with the same unique comparison key. Defaults to YES.
@property (nonatomic, assign) BOOL overwriteObjectsWithServerChanges;
/// If set to YES remote null/nil values are ignored when updating. Defaults to NO.
@property (nonatomic, assign) BOOL ignoreNullValueOverwrites;
/**
If set to YES, will not warn about incorrect class types when receiving null/nil values for optional properties.
Defaults to NO. Note: regardless of the setting of this property, log messages are only output in DEBUG situations.
*/
@property (nonatomic, assign) BOOL ignoreOptionalNullValues;
/// An optional completion block to run after importing each foreign dictionary. Defaults to nil.
@property (nonatomic, copy) VOKPostImportBlock __nullable importCompletionBlock;
/// An optional completion block to run after exporting a managed object to a dictionary. Defaults to nil.
@property (nonatomic, copy) VOKPostExportBlock __nullable exportCompletionBlock;
/**
Creates a new mapper.
@param comparisonKey An NSString to uniquely identify local entities. Can be nil to enable duplicates.
@param mapsArray An NSArray of VOKManagedObjectMaps to corrdinate input data and the Core Data model.
@return A new mapper with the given unique key and maps.
*/
+ (instancetype)mapperWithUniqueKey:(nullable NSString *)comparisonKey
andMaps:(VOKArrayOfManagedObjectMaps *)mapsArray;
/**
Convenience constructor for default mapper.
@return A default mapper wherein the local keys and foreign keys are identical.
*/
+ (instancetype)defaultMapper;
/**
This override of objectForKeyedSubscript returns the foreign key for a local Core Data key.
@param key The Core Data key.
@return The foreign keypath as a string.
*/
- (id)objectForKeyedSubscript:(id)key;
@end
NS_ASSUME_NONNULL_END
|
Java
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "m22 6.92-1.41-1.41-2.85 3.21C15.68 6.4 12.83 5 9.61 5 6.72 5 4.07 6.16 2 8l1.42 1.42C5.12 7.93 7.27 7 9.61 7c2.74 0 5.09 1.26 6.77 3.24l-2.88 3.24-4-4L2 16.99l1.5 1.5 6-6.01 4 4 4.05-4.55c.75 1.35 1.25 2.9 1.44 4.55H21c-.22-2.3-.95-4.39-2.04-6.14L22 6.92z"
}), 'MultilineChartOutlined');
exports.default = _default;
|
Java
|
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_ctgov_session'
|
Java
|
import dateformat from 'dateformat';
import { map } from "underscore";
import { getAccountById } from 'routes/root/routes/Banking/routes/Accounts/modules/accounts';
import { getCreditCardById, getPrepaidCardById } from 'routes/root/routes/Banking/routes/Cards/modules/cards';
import { getLoanById } from 'routes/root/routes/Banking/routes/Loans/modules/loans';
export const getDebitAccount = (debitAccountType, debitAccountId) => {
switch (debitAccountType) {
case "isAccount":
getAccountById(debitAccountId)
break;
case "isLoan":
getLoanById(debitAccountId)
break;
case "isCreditCard":
getCreditCardById(debitAccountId)
break;
case "isPrepaidCard":
getPrepaidCardById(debitAccountId)
break;
}
}
const findDebitAccount = (debitAccountType, debitAccountId, state) => {
let debitAccount = {};
switch (debitAccountType) {
case "isAccount":
debitAccount = state.accounts.accounts.filter((account) => account.id == debitAccountId)[0]
break;
case "isLoan":
debitAccount = state.loans.loans.filter((loan) => loan.id == debitAccountId)[0]
break;
case "isCreditCard":
debitAccount = state.cards.creditCards.filter((creditCard) => creditCard.id == debitAccountId)[0]
break;
case "isPrepaidCard":
debitAccount = state.cards.prepaidCards.filter((prepaidCard) => prepaidCard.id == debitAccountId)[0]
break;
}
return debitAccount;
}
export const getDebitAccountAvailableBalance = (debitAccountType, debitAccountId, state) => {
const debitAccount = findDebitAccount(debitAccountType, debitAccountId, state);
return getProductAvailableBalance(debitAccount, debitAccountType);
}
export const getProductAvailableBalance = (debitAccount, debitAccountType) => {
let availableBalance = 0;
switch (debitAccountType) {
case "isAccount":
availableBalance = debitAccount.ledgerBalance;
break;
case "isLoan":
case "isCreditCard":
case "isPrepaidCard":
availableBalance = debitAccount.availableBalance;
break;
}
return availableBalance;
}
export const getDebitAccountCurrency = (debitAccountType, debitAccountId, state) => {
return findDebitAccount(debitAccountType, debitAccountId, state).currency;
}
export const isValidDate = (date) => {
return new Date(date).setHours(0,0,0,0) >= new Date(dateformat()).setHours(0,0,0,0)
}
export const isValidInstallmentPaymentAmount = (product, amount, availableBalance) => {
return amount > 0 &&
(parseFloat(amount) <= product.nextInstallmentAmount ||
parseFloat(amount) <= product.debt) &&
parseFloat(amount) <= availableBalance
}
export const isValidInstallmentPaymentForm = (transactionForm) => {
return transactionForm.debitAccount.correct &&
transactionForm.amount.correct &&
transactionForm.date.correct
}
export const getPaymentType = (paymentMethod) => {
let paymentType = '';
switch (paymentMethod) {
case 'ΚΑΡΤΑ AGILE BANK':
paymentType = 'isCreditCardAgile';
break;
case 'ΚΑΡΤΑ ΑΛΛΗΣ ΤΡΑΠΕΖΗΣ':
paymentType = 'isCreditCardThirdParty';
break;
case 'ΔΑΝΕΙΟ AGILE BANK':
paymentType = 'isLoan';
break;
default:
paymentType = 'thirdPartyPayment';
}
return paymentType;
}
export const getCustomerName = (fullCustomerName) => {
return (fullCustomerName.firstName + ' ' + fullCustomerName.lastName)
.replace('ά', 'α')
.replace('έ', 'ε')
.replace('ί', 'ι')
.replace('ή', 'η')
.replace('ό', 'ο')
.replace('ύ', 'υ')
.replace('ώ', 'ω');
}
export const getActualFullName = (fullName, currentFullName) => {
const correctPattern = new RegExp("^[A-Za-zΑ-Ωα-ω ]+$");
return fullName = (correctPattern.test(fullName) || fullName == '' ? fullName : currentFullName).toUpperCase();
}
export const isValidFullName = (fullName) => fullName.split(' ').length == 2
export const isValidDebitAmount = (amount, availableBalance) => {
return amount > 0 && (parseFloat(amount)) <= availableBalance
}
export const isValidChargesBeneficiary = (beneficiary) => {
return beneficiary == 'both' || beneficiary == 'sender' || beneficiary == 'beneficiary'
}
export const findPaymentCharges = (paymentMethods, paymentName) => {
return map(paymentMethods, (paymentMethod) => paymentMethod.map(method => method))
.flatMap(paymentMethod => paymentMethod)
.filter(payment => payment.name == paymentName)[0].charges
}
export const findTransferCharges = (beneficiary) => {
let charges = 0;
switch (beneficiary) {
case 'both':
charges = 3;
break;
case 'sender':
charges = 6;
break;
case 'beneficiary':
charges = 0;
break;
}
return charges;
}
export const getImmediateText = (language) => {
let immediateText = '';
switch (language) {
case 'greek':
immediateText = 'ΑΜΕΣΑ';
break;
case 'english':
immediateText = 'IMMEDIATE';
break;
}
return immediateText;
}
export const formatCardNumber = (cardNumber) => {
return [...cardNumber].map(((num, key) => key % 4 == 0 && key != 0 ? ' ' + num : num ))
}
|
Java
|
#include <iostream>
#include <map>
#include <stdexcept>
using namespace std;
int main(int argc, char* argv[]){
map<string, int> m;
m["bob"] = 56;
m["alice"] = 89;
m["billy"] = 3;
// print it out
map<string,int>::iterator i;
for(i = m.begin(); i != m.end(); i++){
cout << i->first << ": " << i->second << endl;
}
cout << "size: " << m.size() << endl << endl;
i = m.find("billy");
if(i == m.end()){
cout << "No billy!\n";
}else{
cout << i->first << ": " << i->second << endl;
}
return 0;
}
|
Java
|
This directory contains samples for VMC organization APIs:
Running the samples
$ python organization_operations.py -r <refresh_token>
* Testbed Requirement:
- At least one org associated with the calling user.
|
Java
|
var assert = require('assert');
var num = require('../');
test('sub', function() {
assert.equal(num.sub(0, 0), '0');
assert.equal(num.sub('0', '-0'), '0');
assert.equal(num.sub('1.0', '-1.0'), '2.0');
assert.equal(num('987654321987654321.12345678901').sub(100.012), '987654321987654221.11145678901');
assert.equal(num(100.012).sub(num('987654321987654321.12345678901')), '-987654321987654221.11145678901');
});
test('sub#constness', function() {
var one = num(1.2);
var two = num(-1.2);
assert.equal(one, '1.2');
assert.equal(two, '-1.2');
one.sub(two);
assert.equal(one, '1.2');
assert.equal(two, '-1.2');
two.sub(one);
assert.equal(one, '1.2');
assert.equal(two, '-1.2');
});
|
Java
|
require File.join(File.dirname(__FILE__), "/../spec_helper")
describe "Firefox" do
before(:each) do
@browser = Firefox.new
@url = "http://localhost"
end
describe "Cross OS Firefox", :shared => true do
it "should be supported" do
@browser.should be_supported
end
end
describe "Mac OS X" do
it_should_behave_like "Cross OS Firefox"
it "should have a path" do
expected = File.expand_path("/Applications/#{@browser.escaped_name}.app")
@browser.path.should == expected
end
it "return name" do
@browser.name.should == "Firefox"
end
it "should visit a given url" do
Kernel.expects(:system).with("open -a #{@browser.name} '#{@url}'")
@browser.visit(@url)
end
end if macos?
describe "Windows" do
it_should_behave_like "Cross OS Firefox"
it "should have a path" do
@browser.path.should == File.join(ENV['ProgramFiles'] || 'c:\Program Files', '\Mozilla Firefox\firefox.exe')
end
it "return name" do
@browser.name.should == "Firefox"
end
it "should visit a given url" do
Kernel.expects(:system).with("#{@browser.path} #{@url}")
@browser.visit(@url)
end
end if windows?
describe "Linux" do
it_should_behave_like "Cross OS Firefox"
it "should have a path" do
path = "/usr/bin/#{@browser.name}"
Firefox.new(path).path.should == path
end
it "should visit a given url" do
Kernel.expects(:system).with("#{@browser.name} #{@url}")
@browser.visit(@url)
end
it "return name" do
@browser.name.should == "firefox"
end
end if linux?
end
|
Java
|
<?php
if (!$loader = @require_once __DIR__ . '/../vendor/autoload.php') {
die("You must set up the project dependencies, run the following commands:
wget http://getcomposer.org/composer.phar
php composer.phar install --dev --prefer-source
");
}
/* @var $loader \Composer\Autoload\ClassLoader */
$loader->add('Doctrine\Tests', __DIR__.'/../vendor/doctrine/orm/tests');
|
Java
|
using System.ComponentModel;
namespace EncompassRest.Loans.Enums
{
/// <summary>
/// PropertyValuationMethodType
/// </summary>
public enum PropertyValuationMethodType
{
/// <summary>
/// Automated Valuation Model
/// </summary>
[Description("Automated Valuation Model")]
AutomatedValuationModel = 0,
/// <summary>
/// Desktop Appraisal
/// </summary>
[Description("Desktop Appraisal")]
DesktopAppraisal = 1,
/// <summary>
/// Drive By
/// </summary>
[Description("Drive By")]
DriveBy = 2,
/// <summary>
/// Estimation
/// </summary>
Estimation = 3,
/// <summary>
/// Full Appraisal
/// </summary>
[Description("Full Appraisal")]
FullAppraisal = 5,
/// <summary>
/// None
/// </summary>
None = 6,
/// <summary>
/// Other
/// </summary>
Other = 7,
/// <summary>
/// Prior Appraisal Used
/// </summary>
[Description("Prior Appraisal Used")]
PriorAppraisalUsed = 8
}
}
|
Java
|
/*!
* vue-resource v1.5.3
* https://github.com/pagekit/vue-resource
* Released under the MIT License.
*/
'use strict';
/**
* Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
*/
var RESOLVED = 0;
var REJECTED = 1;
var PENDING = 2;
function Promise$1(executor) {
this.state = PENDING;
this.value = undefined;
this.deferred = [];
var promise = this;
try {
executor(function (x) {
promise.resolve(x);
}, function (r) {
promise.reject(r);
});
} catch (e) {
promise.reject(e);
}
}
Promise$1.reject = function (r) {
return new Promise$1(function (resolve, reject) {
reject(r);
});
};
Promise$1.resolve = function (x) {
return new Promise$1(function (resolve, reject) {
resolve(x);
});
};
Promise$1.all = function all(iterable) {
return new Promise$1(function (resolve, reject) {
var count = 0,
result = [];
if (iterable.length === 0) {
resolve(result);
}
function resolver(i) {
return function (x) {
result[i] = x;
count += 1;
if (count === iterable.length) {
resolve(result);
}
};
}
for (var i = 0; i < iterable.length; i += 1) {
Promise$1.resolve(iterable[i]).then(resolver(i), reject);
}
});
};
Promise$1.race = function race(iterable) {
return new Promise$1(function (resolve, reject) {
for (var i = 0; i < iterable.length; i += 1) {
Promise$1.resolve(iterable[i]).then(resolve, reject);
}
});
};
var p = Promise$1.prototype;
p.resolve = function resolve(x) {
var promise = this;
if (promise.state === PENDING) {
if (x === promise) {
throw new TypeError('Promise settled with itself.');
}
var called = false;
try {
var then = x && x['then'];
if (x !== null && typeof x === 'object' && typeof then === 'function') {
then.call(x, function (x) {
if (!called) {
promise.resolve(x);
}
called = true;
}, function (r) {
if (!called) {
promise.reject(r);
}
called = true;
});
return;
}
} catch (e) {
if (!called) {
promise.reject(e);
}
return;
}
promise.state = RESOLVED;
promise.value = x;
promise.notify();
}
};
p.reject = function reject(reason) {
var promise = this;
if (promise.state === PENDING) {
if (reason === promise) {
throw new TypeError('Promise settled with itself.');
}
promise.state = REJECTED;
promise.value = reason;
promise.notify();
}
};
p.notify = function notify() {
var promise = this;
nextTick(function () {
if (promise.state !== PENDING) {
while (promise.deferred.length) {
var deferred = promise.deferred.shift(),
onResolved = deferred[0],
onRejected = deferred[1],
resolve = deferred[2],
reject = deferred[3];
try {
if (promise.state === RESOLVED) {
if (typeof onResolved === 'function') {
resolve(onResolved.call(undefined, promise.value));
} else {
resolve(promise.value);
}
} else if (promise.state === REJECTED) {
if (typeof onRejected === 'function') {
resolve(onRejected.call(undefined, promise.value));
} else {
reject(promise.value);
}
}
} catch (e) {
reject(e);
}
}
}
});
};
p.then = function then(onResolved, onRejected) {
var promise = this;
return new Promise$1(function (resolve, reject) {
promise.deferred.push([onResolved, onRejected, resolve, reject]);
promise.notify();
});
};
p["catch"] = function (onRejected) {
return this.then(undefined, onRejected);
};
/**
* Promise adapter.
*/
if (typeof Promise === 'undefined') {
window.Promise = Promise$1;
}
function PromiseObj(executor, context) {
if (executor instanceof Promise) {
this.promise = executor;
} else {
this.promise = new Promise(executor.bind(context));
}
this.context = context;
}
PromiseObj.all = function (iterable, context) {
return new PromiseObj(Promise.all(iterable), context);
};
PromiseObj.resolve = function (value, context) {
return new PromiseObj(Promise.resolve(value), context);
};
PromiseObj.reject = function (reason, context) {
return new PromiseObj(Promise.reject(reason), context);
};
PromiseObj.race = function (iterable, context) {
return new PromiseObj(Promise.race(iterable), context);
};
var p$1 = PromiseObj.prototype;
p$1.bind = function (context) {
this.context = context;
return this;
};
p$1.then = function (fulfilled, rejected) {
if (fulfilled && fulfilled.bind && this.context) {
fulfilled = fulfilled.bind(this.context);
}
if (rejected && rejected.bind && this.context) {
rejected = rejected.bind(this.context);
}
return new PromiseObj(this.promise.then(fulfilled, rejected), this.context);
};
p$1["catch"] = function (rejected) {
if (rejected && rejected.bind && this.context) {
rejected = rejected.bind(this.context);
}
return new PromiseObj(this.promise["catch"](rejected), this.context);
};
p$1["finally"] = function (callback) {
return this.then(function (value) {
callback.call(this);
return value;
}, function (reason) {
callback.call(this);
return Promise.reject(reason);
});
};
/**
* Utility functions.
*/
var _ref = {},
hasOwnProperty = _ref.hasOwnProperty,
slice = [].slice,
debug = false,
ntick;
var inBrowser = typeof window !== 'undefined';
function Util (_ref2) {
var config = _ref2.config,
nextTick = _ref2.nextTick;
ntick = nextTick;
debug = config.debug || !config.silent;
}
function warn(msg) {
if (typeof console !== 'undefined' && debug) {
console.warn('[VueResource warn]: ' + msg);
}
}
function error(msg) {
if (typeof console !== 'undefined') {
console.error(msg);
}
}
function nextTick(cb, ctx) {
return ntick(cb, ctx);
}
function trim(str) {
return str ? str.replace(/^\s*|\s*$/g, '') : '';
}
function trimEnd(str, chars) {
if (str && chars === undefined) {
return str.replace(/\s+$/, '');
}
if (!str || !chars) {
return str;
}
return str.replace(new RegExp("[" + chars + "]+$"), '');
}
function toLower(str) {
return str ? str.toLowerCase() : '';
}
function toUpper(str) {
return str ? str.toUpperCase() : '';
}
var isArray = Array.isArray;
function isString(val) {
return typeof val === 'string';
}
function isFunction(val) {
return typeof val === 'function';
}
function isObject(obj) {
return obj !== null && typeof obj === 'object';
}
function isPlainObject(obj) {
return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
}
function isBlob(obj) {
return typeof Blob !== 'undefined' && obj instanceof Blob;
}
function isFormData(obj) {
return typeof FormData !== 'undefined' && obj instanceof FormData;
}
function when(value, fulfilled, rejected) {
var promise = PromiseObj.resolve(value);
if (arguments.length < 2) {
return promise;
}
return promise.then(fulfilled, rejected);
}
function options(fn, obj, opts) {
opts = opts || {};
if (isFunction(opts)) {
opts = opts.call(obj);
}
return merge(fn.bind({
$vm: obj,
$options: opts
}), fn, {
$options: opts
});
}
function each(obj, iterator) {
var i, key;
if (isArray(obj)) {
for (i = 0; i < obj.length; i++) {
iterator.call(obj[i], obj[i], i);
}
} else if (isObject(obj)) {
for (key in obj) {
if (hasOwnProperty.call(obj, key)) {
iterator.call(obj[key], obj[key], key);
}
}
}
return obj;
}
var assign = Object.assign || _assign;
function merge(target) {
var args = slice.call(arguments, 1);
args.forEach(function (source) {
_merge(target, source, true);
});
return target;
}
function defaults(target) {
var args = slice.call(arguments, 1);
args.forEach(function (source) {
for (var key in source) {
if (target[key] === undefined) {
target[key] = source[key];
}
}
});
return target;
}
function _assign(target) {
var args = slice.call(arguments, 1);
args.forEach(function (source) {
_merge(target, source);
});
return target;
}
function _merge(target, source, deep) {
for (var key in source) {
if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
target[key] = {};
}
if (isArray(source[key]) && !isArray(target[key])) {
target[key] = [];
}
_merge(target[key], source[key], deep);
} else if (source[key] !== undefined) {
target[key] = source[key];
}
}
}
/**
* Root Prefix Transform.
*/
function root (options$$1, next) {
var url = next(options$$1);
if (isString(options$$1.root) && !/^(https?:)?\//.test(url)) {
url = trimEnd(options$$1.root, '/') + '/' + url;
}
return url;
}
/**
* Query Parameter Transform.
*/
function query (options$$1, next) {
var urlParams = Object.keys(Url.options.params),
query = {},
url = next(options$$1);
each(options$$1.params, function (value, key) {
if (urlParams.indexOf(key) === -1) {
query[key] = value;
}
});
query = Url.params(query);
if (query) {
url += (url.indexOf('?') == -1 ? '?' : '&') + query;
}
return url;
}
/**
* URL Template v2.0.6 (https://github.com/bramstein/url-template)
*/
function expand(url, params, variables) {
var tmpl = parse(url),
expanded = tmpl.expand(params);
if (variables) {
variables.push.apply(variables, tmpl.vars);
}
return expanded;
}
function parse(template) {
var operators = ['+', '#', '.', '/', ';', '?', '&'],
variables = [];
return {
vars: variables,
expand: function expand(context) {
return template.replace(/\{([^{}]+)\}|([^{}]+)/g, function (_, expression, literal) {
if (expression) {
var operator = null,
values = [];
if (operators.indexOf(expression.charAt(0)) !== -1) {
operator = expression.charAt(0);
expression = expression.substr(1);
}
expression.split(/,/g).forEach(function (variable) {
var tmp = /([^:*]*)(?::(\d+)|(\*))?/.exec(variable);
values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
variables.push(tmp[1]);
});
if (operator && operator !== '+') {
var separator = ',';
if (operator === '?') {
separator = '&';
} else if (operator !== '#') {
separator = operator;
}
return (values.length !== 0 ? operator : '') + values.join(separator);
} else {
return values.join(',');
}
} else {
return encodeReserved(literal);
}
});
}
};
}
function getValues(context, operator, key, modifier) {
var value = context[key],
result = [];
if (isDefined(value) && value !== '') {
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
value = value.toString();
if (modifier && modifier !== '*') {
value = value.substring(0, parseInt(modifier, 10));
}
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
} else {
if (modifier === '*') {
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
});
} else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
result.push(encodeValue(operator, value[k], k));
}
});
}
} else {
var tmp = [];
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
tmp.push(encodeValue(operator, value));
});
} else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
tmp.push(encodeURIComponent(k));
tmp.push(encodeValue(operator, value[k].toString()));
}
});
}
if (isKeyOperator(operator)) {
result.push(encodeURIComponent(key) + '=' + tmp.join(','));
} else if (tmp.length !== 0) {
result.push(tmp.join(','));
}
}
}
} else {
if (operator === ';') {
result.push(encodeURIComponent(key));
} else if (value === '' && (operator === '&' || operator === '?')) {
result.push(encodeURIComponent(key) + '=');
} else if (value === '') {
result.push('');
}
}
return result;
}
function isDefined(value) {
return value !== undefined && value !== null;
}
function isKeyOperator(operator) {
return operator === ';' || operator === '&' || operator === '?';
}
function encodeValue(operator, value, key) {
value = operator === '+' || operator === '#' ? encodeReserved(value) : encodeURIComponent(value);
if (key) {
return encodeURIComponent(key) + '=' + value;
} else {
return value;
}
}
function encodeReserved(str) {
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
if (!/%[0-9A-Fa-f]/.test(part)) {
part = encodeURI(part);
}
return part;
}).join('');
}
/**
* URL Template (RFC 6570) Transform.
*/
function template (options) {
var variables = [],
url = expand(options.url, options.params, variables);
variables.forEach(function (key) {
delete options.params[key];
});
return url;
}
/**
* Service for URL templating.
*/
function Url(url, params) {
var self = this || {},
options$$1 = url,
transform;
if (isString(url)) {
options$$1 = {
url: url,
params: params
};
}
options$$1 = merge({}, Url.options, self.$options, options$$1);
Url.transforms.forEach(function (handler) {
if (isString(handler)) {
handler = Url.transform[handler];
}
if (isFunction(handler)) {
transform = factory(handler, transform, self.$vm);
}
});
return transform(options$$1);
}
/**
* Url options.
*/
Url.options = {
url: '',
root: null,
params: {}
};
/**
* Url transforms.
*/
Url.transform = {
template: template,
query: query,
root: root
};
Url.transforms = ['template', 'query', 'root'];
/**
* Encodes a Url parameter string.
*
* @param {Object} obj
*/
Url.params = function (obj) {
var params = [],
escape = encodeURIComponent;
params.add = function (key, value) {
if (isFunction(value)) {
value = value();
}
if (value === null) {
value = '';
}
this.push(escape(key) + '=' + escape(value));
};
serialize(params, obj);
return params.join('&').replace(/%20/g, '+');
};
/**
* Parse a URL and return its components.
*
* @param {String} url
*/
Url.parse = function (url) {
var el = document.createElement('a');
if (document.documentMode) {
el.href = url;
url = el.href;
}
el.href = url;
return {
href: el.href,
protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
port: el.port,
host: el.host,
hostname: el.hostname,
pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
search: el.search ? el.search.replace(/^\?/, '') : '',
hash: el.hash ? el.hash.replace(/^#/, '') : ''
};
};
function factory(handler, next, vm) {
return function (options$$1) {
return handler.call(vm, options$$1, next);
};
}
function serialize(params, obj, scope) {
var array = isArray(obj),
plain = isPlainObject(obj),
hash;
each(obj, function (value, key) {
hash = isObject(value) || isArray(value);
if (scope) {
key = scope + '[' + (plain || hash ? key : '') + ']';
}
if (!scope && array) {
params.add(value.name, value.value);
} else if (hash) {
serialize(params, value, key);
} else {
params.add(key, value);
}
});
}
/**
* XDomain client (Internet Explorer).
*/
function xdrClient (request) {
return new PromiseObj(function (resolve) {
var xdr = new XDomainRequest(),
handler = function handler(_ref) {
var type = _ref.type;
var status = 0;
if (type === 'load') {
status = 200;
} else if (type === 'error') {
status = 500;
}
resolve(request.respondWith(xdr.responseText, {
status: status
}));
};
request.abort = function () {
return xdr.abort();
};
xdr.open(request.method, request.getUrl());
if (request.timeout) {
xdr.timeout = request.timeout;
}
xdr.onload = handler;
xdr.onabort = handler;
xdr.onerror = handler;
xdr.ontimeout = handler;
xdr.onprogress = function () {};
xdr.send(request.getBody());
});
}
/**
* CORS Interceptor.
*/
var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
function cors (request) {
if (inBrowser) {
var orgUrl = Url.parse(location.href);
var reqUrl = Url.parse(request.getUrl());
if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
request.crossOrigin = true;
request.emulateHTTP = false;
if (!SUPPORTS_CORS) {
request.client = xdrClient;
}
}
}
}
/**
* Form data Interceptor.
*/
function form (request) {
if (isFormData(request.body)) {
request.headers["delete"]('Content-Type');
} else if (isObject(request.body) && request.emulateJSON) {
request.body = Url.params(request.body);
request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
}
}
/**
* JSON Interceptor.
*/
function json (request) {
var type = request.headers.get('Content-Type') || '';
if (isObject(request.body) && type.indexOf('application/json') === 0) {
request.body = JSON.stringify(request.body);
}
return function (response) {
return response.bodyText ? when(response.text(), function (text) {
var type = response.headers.get('Content-Type') || '';
if (type.indexOf('application/json') === 0 || isJson(text)) {
try {
response.body = JSON.parse(text);
} catch (e) {
response.body = null;
}
} else {
response.body = text;
}
return response;
}) : response;
};
}
function isJson(str) {
var start = str.match(/^\s*(\[|\{)/);
var end = {
'[': /]\s*$/,
'{': /}\s*$/
};
return start && end[start[1]].test(str);
}
/**
* JSONP client (Browser).
*/
function jsonpClient (request) {
return new PromiseObj(function (resolve) {
var name = request.jsonp || 'callback',
callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2),
body = null,
handler,
script;
handler = function handler(_ref) {
var type = _ref.type;
var status = 0;
if (type === 'load' && body !== null) {
status = 200;
} else if (type === 'error') {
status = 500;
}
if (status && window[callback]) {
delete window[callback];
document.body.removeChild(script);
}
resolve(request.respondWith(body, {
status: status
}));
};
window[callback] = function (result) {
body = JSON.stringify(result);
};
request.abort = function () {
handler({
type: 'abort'
});
};
request.params[name] = callback;
if (request.timeout) {
setTimeout(request.abort, request.timeout);
}
script = document.createElement('script');
script.src = request.getUrl();
script.type = 'text/javascript';
script.async = true;
script.onload = handler;
script.onerror = handler;
document.body.appendChild(script);
});
}
/**
* JSONP Interceptor.
*/
function jsonp (request) {
if (request.method == 'JSONP') {
request.client = jsonpClient;
}
}
/**
* Before Interceptor.
*/
function before (request) {
if (isFunction(request.before)) {
request.before.call(this, request);
}
}
/**
* HTTP method override Interceptor.
*/
function method (request) {
if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
request.headers.set('X-HTTP-Method-Override', request.method);
request.method = 'POST';
}
}
/**
* Header Interceptor.
*/
function header (request) {
var headers = assign({}, Http.headers.common, !request.crossOrigin ? Http.headers.custom : {}, Http.headers[toLower(request.method)]);
each(headers, function (value, name) {
if (!request.headers.has(name)) {
request.headers.set(name, value);
}
});
}
/**
* XMLHttp client (Browser).
*/
function xhrClient (request) {
return new PromiseObj(function (resolve) {
var xhr = new XMLHttpRequest(),
handler = function handler(event) {
var response = request.respondWith('response' in xhr ? xhr.response : xhr.responseText, {
status: xhr.status === 1223 ? 204 : xhr.status,
// IE9 status bug
statusText: xhr.status === 1223 ? 'No Content' : trim(xhr.statusText)
});
each(trim(xhr.getAllResponseHeaders()).split('\n'), function (row) {
response.headers.append(row.slice(0, row.indexOf(':')), row.slice(row.indexOf(':') + 1));
});
resolve(response);
};
request.abort = function () {
return xhr.abort();
};
xhr.open(request.method, request.getUrl(), true);
if (request.timeout) {
xhr.timeout = request.timeout;
}
if (request.responseType && 'responseType' in xhr) {
xhr.responseType = request.responseType;
}
if (request.withCredentials || request.credentials) {
xhr.withCredentials = true;
}
if (!request.crossOrigin) {
request.headers.set('X-Requested-With', 'XMLHttpRequest');
} // deprecated use downloadProgress
if (isFunction(request.progress) && request.method === 'GET') {
xhr.addEventListener('progress', request.progress);
}
if (isFunction(request.downloadProgress)) {
xhr.addEventListener('progress', request.downloadProgress);
} // deprecated use uploadProgress
if (isFunction(request.progress) && /^(POST|PUT)$/i.test(request.method)) {
xhr.upload.addEventListener('progress', request.progress);
}
if (isFunction(request.uploadProgress) && xhr.upload) {
xhr.upload.addEventListener('progress', request.uploadProgress);
}
request.headers.forEach(function (value, name) {
xhr.setRequestHeader(name, value);
});
xhr.onload = handler;
xhr.onabort = handler;
xhr.onerror = handler;
xhr.ontimeout = handler;
xhr.send(request.getBody());
});
}
/**
* Http client (Node).
*/
function nodeClient (request) {
var client = require('got');
return new PromiseObj(function (resolve) {
var url = request.getUrl();
var body = request.getBody();
var method = request.method;
var headers = {},
handler;
request.headers.forEach(function (value, name) {
headers[name] = value;
});
client(url, {
body: body,
method: method,
headers: headers
}).then(handler = function handler(resp) {
var response = request.respondWith(resp.body, {
status: resp.statusCode,
statusText: trim(resp.statusMessage)
});
each(resp.headers, function (value, name) {
response.headers.set(name, value);
});
resolve(response);
}, function (error$$1) {
return handler(error$$1.response);
});
});
}
/**
* Base client.
*/
function Client (context) {
var reqHandlers = [sendRequest],
resHandlers = [];
if (!isObject(context)) {
context = null;
}
function Client(request) {
while (reqHandlers.length) {
var handler = reqHandlers.pop();
if (isFunction(handler)) {
var _ret = function () {
var response = void 0,
next = void 0;
response = handler.call(context, request, function (val) {
return next = val;
}) || next;
if (isObject(response)) {
return {
v: new PromiseObj(function (resolve, reject) {
resHandlers.forEach(function (handler) {
response = when(response, function (response) {
return handler.call(context, response) || response;
}, reject);
});
when(response, resolve, reject);
}, context)
};
}
if (isFunction(response)) {
resHandlers.unshift(response);
}
}();
if (typeof _ret === "object") return _ret.v;
} else {
warn("Invalid interceptor of type " + typeof handler + ", must be a function");
}
}
}
Client.use = function (handler) {
reqHandlers.push(handler);
};
return Client;
}
function sendRequest(request) {
var client = request.client || (inBrowser ? xhrClient : nodeClient);
return client(request);
}
/**
* HTTP Headers.
*/
var Headers = /*#__PURE__*/function () {
function Headers(headers) {
var _this = this;
this.map = {};
each(headers, function (value, name) {
return _this.append(name, value);
});
}
var _proto = Headers.prototype;
_proto.has = function has(name) {
return getName(this.map, name) !== null;
};
_proto.get = function get(name) {
var list = this.map[getName(this.map, name)];
return list ? list.join() : null;
};
_proto.getAll = function getAll(name) {
return this.map[getName(this.map, name)] || [];
};
_proto.set = function set(name, value) {
this.map[normalizeName(getName(this.map, name) || name)] = [trim(value)];
};
_proto.append = function append(name, value) {
var list = this.map[getName(this.map, name)];
if (list) {
list.push(trim(value));
} else {
this.set(name, value);
}
};
_proto["delete"] = function _delete(name) {
delete this.map[getName(this.map, name)];
};
_proto.deleteAll = function deleteAll() {
this.map = {};
};
_proto.forEach = function forEach(callback, thisArg) {
var _this2 = this;
each(this.map, function (list, name) {
each(list, function (value) {
return callback.call(thisArg, value, name, _this2);
});
});
};
return Headers;
}();
function getName(map, name) {
return Object.keys(map).reduce(function (prev, curr) {
return toLower(name) === toLower(curr) ? curr : prev;
}, null);
}
function normalizeName(name) {
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
throw new TypeError('Invalid character in header field name');
}
return trim(name);
}
/**
* HTTP Response.
*/
var Response = /*#__PURE__*/function () {
function Response(body, _ref) {
var url = _ref.url,
headers = _ref.headers,
status = _ref.status,
statusText = _ref.statusText;
this.url = url;
this.ok = status >= 200 && status < 300;
this.status = status || 0;
this.statusText = statusText || '';
this.headers = new Headers(headers);
this.body = body;
if (isString(body)) {
this.bodyText = body;
} else if (isBlob(body)) {
this.bodyBlob = body;
if (isBlobText(body)) {
this.bodyText = blobText(body);
}
}
}
var _proto = Response.prototype;
_proto.blob = function blob() {
return when(this.bodyBlob);
};
_proto.text = function text() {
return when(this.bodyText);
};
_proto.json = function json() {
return when(this.text(), function (text) {
return JSON.parse(text);
});
};
return Response;
}();
Object.defineProperty(Response.prototype, 'data', {
get: function get() {
return this.body;
},
set: function set(body) {
this.body = body;
}
});
function blobText(body) {
return new PromiseObj(function (resolve) {
var reader = new FileReader();
reader.readAsText(body);
reader.onload = function () {
resolve(reader.result);
};
});
}
function isBlobText(body) {
return body.type.indexOf('text') === 0 || body.type.indexOf('json') !== -1;
}
/**
* HTTP Request.
*/
var Request = /*#__PURE__*/function () {
function Request(options$$1) {
this.body = null;
this.params = {};
assign(this, options$$1, {
method: toUpper(options$$1.method || 'GET')
});
if (!(this.headers instanceof Headers)) {
this.headers = new Headers(this.headers);
}
}
var _proto = Request.prototype;
_proto.getUrl = function getUrl() {
return Url(this);
};
_proto.getBody = function getBody() {
return this.body;
};
_proto.respondWith = function respondWith(body, options$$1) {
return new Response(body, assign(options$$1 || {}, {
url: this.getUrl()
}));
};
return Request;
}();
/**
* Service for sending network requests.
*/
var COMMON_HEADERS = {
'Accept': 'application/json, text/plain, */*'
};
var JSON_CONTENT_TYPE = {
'Content-Type': 'application/json;charset=utf-8'
};
function Http(options$$1) {
var self = this || {},
client = Client(self.$vm);
defaults(options$$1 || {}, self.$options, Http.options);
Http.interceptors.forEach(function (handler) {
if (isString(handler)) {
handler = Http.interceptor[handler];
}
if (isFunction(handler)) {
client.use(handler);
}
});
return client(new Request(options$$1)).then(function (response) {
return response.ok ? response : PromiseObj.reject(response);
}, function (response) {
if (response instanceof Error) {
error(response);
}
return PromiseObj.reject(response);
});
}
Http.options = {};
Http.headers = {
put: JSON_CONTENT_TYPE,
post: JSON_CONTENT_TYPE,
patch: JSON_CONTENT_TYPE,
"delete": JSON_CONTENT_TYPE,
common: COMMON_HEADERS,
custom: {}
};
Http.interceptor = {
before: before,
method: method,
jsonp: jsonp,
json: json,
form: form,
header: header,
cors: cors
};
Http.interceptors = ['before', 'method', 'jsonp', 'json', 'form', 'header', 'cors'];
['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
Http[method$$1] = function (url, options$$1) {
return this(assign(options$$1 || {}, {
url: url,
method: method$$1
}));
};
});
['post', 'put', 'patch'].forEach(function (method$$1) {
Http[method$$1] = function (url, body, options$$1) {
return this(assign(options$$1 || {}, {
url: url,
method: method$$1,
body: body
}));
};
});
/**
* Service for interacting with RESTful services.
*/
function Resource(url, params, actions, options$$1) {
var self = this || {},
resource = {};
actions = assign({}, Resource.actions, actions);
each(actions, function (action, name) {
action = merge({
url: url,
params: assign({}, params)
}, options$$1, action);
resource[name] = function () {
return (self.$http || Http)(opts(action, arguments));
};
});
return resource;
}
function opts(action, args) {
var options$$1 = assign({}, action),
params = {},
body;
switch (args.length) {
case 2:
params = args[0];
body = args[1];
break;
case 1:
if (/^(POST|PUT|PATCH)$/i.test(options$$1.method)) {
body = args[0];
} else {
params = args[0];
}
break;
case 0:
break;
default:
throw 'Expected up to 2 arguments [params, body], got ' + args.length + ' arguments';
}
options$$1.body = body;
options$$1.params = assign({}, options$$1.params, params);
return options$$1;
}
Resource.actions = {
get: {
method: 'GET'
},
save: {
method: 'POST'
},
query: {
method: 'GET'
},
update: {
method: 'PUT'
},
remove: {
method: 'DELETE'
},
"delete": {
method: 'DELETE'
}
};
/**
* Install plugin.
*/
function plugin(Vue) {
if (plugin.installed) {
return;
}
Util(Vue);
Vue.url = Url;
Vue.http = Http;
Vue.resource = Resource;
Vue.Promise = PromiseObj;
Object.defineProperties(Vue.prototype, {
$url: {
get: function get() {
return options(Vue.url, this, this.$options.url);
}
},
$http: {
get: function get() {
return options(Vue.http, this, this.$options.http);
}
},
$resource: {
get: function get() {
return Vue.resource.bind(this);
}
},
$promise: {
get: function get() {
var _this = this;
return function (executor) {
return new Vue.Promise(executor, _this);
};
}
}
});
}
if (typeof window !== 'undefined' && window.Vue && !window.Vue.resource) {
window.Vue.use(plugin);
}
module.exports = plugin;
|
Java
|
console.log('argv[0]: '+process.argv[0]);
console.log('argv[1]: '+process.argv[1]);
|
Java
|
//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:2.0.50727.8806
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
// </auto-generated>
//------------------------------------------------------------------------------
namespace HtmlButton_ {
/// <summary>
/// _Default クラス。
/// </summary>
/// <remarks>
/// 自動生成されたクラス。
/// </remarks>
public partial class _Default {
/// <summary>
/// form1 コントロール。
/// </summary>
/// <remarks>
/// 自動生成されたフィールド。
/// 変更するには、フィールドの宣言をデザイナ ファイルから分離コード ファイルに移動します。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// button1 コントロール。
/// </summary>
/// <remarks>
/// 自動生成されたフィールド。
/// 変更するには、フィールドの宣言をデザイナ ファイルから分離コード ファイルに移動します。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlButton button1;
}
}
|
Java
|
# Copyright (C) 2009 Pascal Rettig.
require 'rss/2.0'
class Feed::RssRenderer < ParagraphRenderer
paragraph :feed
paragraph :view_rss
paragraph :rss_auto_discovery, :cache => true
def feed
paragraph_data = (paragraph.data || {}).symbolize_keys
@handler_info = get_handler_info(:feed,:rss,paragraph_data[:feed_type])
if ! @handler_info
data_paragraph :text => 'Reconfigure RSS Feed'.t
return
end
handler_options_class = nil
begin
handler_options_class = "#{@handler_info[:class_name]}::Options".constantize
rescue
end
if handler_options_class.nil?
data_paragraph :text => 'Reconfigure RSS Feed'.t
return
end
@options = handler_options_class.new(paragraph_data)
@handler = @handler_info[:class].new(@options)
@cache_id = site_node.id.to_s
if @handler.respond_to?(:set_path)
@handler.set_path(params[:path])
@cache_id += DomainModel.hexdigest(params[:path].join("/"))
end
results = renderer_cache(nil,@cache_id, :skip => @options.timeout <= 0, :expires => @options.timeout*60) do |cache|
data = @handler.get_feed
data[:self_link] = Configuration.domain_link site_node.node_path
if @handler_info[:custom]
cache[:output] = render_to_string(:partial => @handler_info[:custom],:locals => { :data => data})
else
cache[:output] = render_to_string(:partial => '/feed/rss/feed',:locals => { :data => data })
end
end
headers['Content-Type'] = 'text/xml'
data_paragraph :text => results.output
end
feature :rss_feed_view, :default_feature => <<-FEATURE
<div class='rss_feed'>
<cms:feed>
<h2><cms:link><cms:title/></cms:link></h2>
<cms:description/>
<cms:items>
<cms:item>
<div class='rss_feed_item'>
<h3><cms:link><cms:title/></cms:link></h3>
<cms:content/>
</div>
</cms:item>
</cms:items>
</cms:feed>
<cms:no_feed>
No Feed
</cms:no_feed>
</div>
FEATURE
include ActionView::Helpers::DateHelper
def rss_feed_view_feature(data)
webiva_feature(:rss_feed_view,data) do |c|
c.define_tag('feed') { |tag| data[:feed].blank? ? nil : tag.expand }
c.define_tag('no_feed') { |tag| data[:feed].blank? ? tag.expand : nil }
c.define_link_tag('feed:') { |t| data[:feed].channel.link }
c.define_value_tag('feed:title') { |tag| data[:feed].channel.title }
c.define_value_tag('feed:description') { |tag|
data[:feed].channel.description
}
c.define_tag('feed:no_items') { |tag| data[:feed].items.length == 0 ? tag.expand : nil }
c.define_tag('feed:items') { |tag| data[:feed].items.length > 0 ? tag.expand : nil }
c.define_tag('feed:items:item') do |tag|
result = ''
items = data[:feed].items
unless data[:category].blank?
items = items.find_all { |item| item.categories.detect { |cat| cat.content == data[:category] } }
end
items = items[0..(data[:items]-1)] if data[:items] > 0
items.each_with_index do |item,idx|
tag.locals.item = item
tag.locals.index = idx + 1
tag.locals.first = idx == 0
tag.locals.last = idx == data[:feed].items.length
result << tag.expand
end
result
end
c.define_value_tag('feed:items:item:content') { |tag|
if data[:read_more].blank?
txt = tag.locals.item.description
else
txt = tag.locals.item.description.to_s.sub(data[:read_more],"[<a href='#{tag.locals.item.link}'>Read More..</a>]")
end
}
c.define_link_tag('feed:items:item:') { |t| t.locals.item.link }
c.define_value_tag('feed:items:item:title') { |tag| tag.locals.item.title }
c.define_value_tag('feed:items:item:author') { |tag| tag.locals.item.author }
c.define_value_tag('feed:items:item:categories') { |tag| tag.locals.item.categories.map { |cat| cat.content }.join(", ") }
c.define_value_tag('feed:items:item:description') { |tag| tag.locals.item.description }
c.date_tag('feed:items:item:date') { |t| t.locals.item.date }
c.value_tag('feed:items:item:ago') { |t|
distance_of_time_in_words_to_now(t.locals.item.date).gsub('about','').strip if t.locals.item.date }
end
end
def view_rss
options = Feed::RssController::ViewRssOptions.new(paragraph.data || {})
return render_paragraph :text => 'Configure Paragraph' if options.rss_url.blank?
result = renderer_cache(nil,options.rss_url, :expires => options.cache_minutes.to_i.minutes) do |cache|
rss_feed = delayed_cache_fetch(FeedParser,:delayed_feed_parser,{ :rss_url => options.rss_url },options.rss_url, :expires => options.cache_minutes.to_i.minutes)
return render_paragraph :text => '' if !rss_feed
data = { :feed => rss_feed[:feed], :items => options.items, :category => options.category, :read_more => options.read_more }
cache[:output] = rss_feed_view_feature(data)
logger.warn('In Renderer Cache')
end
render_paragraph :text => result.output
end
def rss_auto_discovery
@options = paragraph.data || {}
if !@options[:module_node_id].blank? && @options[:module_node_id].to_i > 0
@nodes = [ SiteNode.find_by_id(@options[:module_node_id]) ].compact
else
@nodes = SiteNode.find(:all,:conditions => ['node_type = "M" AND module_name = "/feed/rss"' ],:include => :page_modifier)
end
output = @nodes.collect do |nd|
if nd.page_modifier
nd.page_modifier.modifier_data ||= {}
"<link rel='alternate' type='application/rss+xml' title='#{vh nd.page_modifier.modifier_data[:feed_title]}' href='#{vh nd.node_path}' />"
else
nil
end
end.compact.join("\n")
include_in_head(output)
render_paragraph :nothing => true
end
end
|
Java
|
'use strict';
var Crawler = require('../lib/crawler');
var expect = require('chai').expect;
var jsdom = require('jsdom');
var httpbinHost = 'localhost:8000';
describe('Errors', function() {
describe('timeout', function() {
var c = new Crawler({
timeout : 1500,
retryTimeout : 1000,
retries : 2,
jquery : false
});
it('should return a timeout error after ~5sec', function(done) {
// override default mocha test timeout of 2000ms
this.timeout(10000);
c.queue({
uri : 'http://'+httpbinHost+'/delay/15',
callback : function(error, response) //noinspection BadExpressionStatementJS,BadExpressionStatementJS
{
expect(error).not.to.be.null;
expect(error.code).to.equal("ETIMEDOUT");
//expect(response).to.be.undefined;
done();
}
});
});
it('should retry after a first timeout', function(done) {
// override default mocha test timeout of 2000ms
this.timeout(15000);
c.queue({
uri : 'http://'+httpbinHost+'/delay/1',
callback : function(error, response) {
expect(error).to.be.null;
expect(response.body).to.be.ok;
done();
}
});
});
});
describe('error status code', function() {
var c = new Crawler({
jQuery : false
});
it('should not return an error on status code 400 (Bad Request)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/400',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(400);
done();
}
});
});
it('should not return an error on status code 401 (Unauthorized)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/401',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(401);
done();
}
});
});
it('should not return an error on status code 403 (Forbidden)', function(done) {
c.queue({
uri: 'http://' + httpbinHost + '/status/403',
callback: function(error, response, $){
expect(error).to.be.null;
expect(response.statusCode).to.equal(403);
done();
}
});
});
it('should not return an error on a 404', function(done) {
c.queue({
uri : 'http://'+httpbinHost+'/status/404',
callback : function(error, response) {
expect(error).to.be.null;
expect(response.statusCode).to.equal(404);
done();
}
});
});
it('should not return an error on a 500', function(done) {
c.queue({
uri : 'http://'+httpbinHost+'/status/500',
callback : function(error, response) {
expect(error).to.be.null;
expect(response.statusCode).to.equal(500);
done();
}
});
});
it('should not failed on empty response', function(done) {
c.queue({
uri : 'http://'+httpbinHost+'/status/204',
callback : function(error) {
expect(error).to.be.null;
done();
}
});
});
it('should not failed on a malformed html if jquery is false', function(done) {
c.queue({
html : '<html><p>hello <div>dude</p></html>',
callback : function(error, response) {
expect(error).to.be.null;
expect(response).not.to.be.null;
done();
}
});
});
it('should not return an error on a malformed html if jQuery is jsdom', function(done) {
c.queue({
html : '<html><p>hello <div>dude</p></html>',
jQuery : jsdom,
callback : function(error, response) {
expect(error).to.be.null;
expect(response).not.to.be.undefined;
done();
}
});
});
});
});
|
Java
|
using System;
using Xamarin.Forms;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Linq;
namespace MyShop
{
public class StoresViewModel : BaseViewModel
{
readonly IDataStore dataStore;
public ObservableCollection<Store> Stores { get; set;}
public ObservableCollection<Grouping<string, Store>> StoresGrouped { get; set; }
public bool ForceSync { get; set; }
public StoresViewModel (Page page) : base (page)
{
Title = "Locations";
dataStore = DependencyService.Get<IDataStore> ();
Stores = new ObservableCollection<Store> ();
StoresGrouped = new ObservableCollection<Grouping<string, Store>> ();
}
public async Task DeleteStore(Store store)
{
if (IsBusy)
return;
IsBusy = true;
try {
await dataStore.RemoveStoreAsync(store);
Stores.Remove(store);
Sort();
} catch(Exception ex) {
page.DisplayAlert ("Uh Oh :(", "Unable to remove store, please try again", "OK");
Xamarin.Insights.Report (ex);
}
finally {
IsBusy = false;
}
}
private Command getStoresCommand;
public Command GetStoresCommand
{
get {
return getStoresCommand ??
(getStoresCommand = new Command (async () => await ExecuteGetStoresCommand (), () => {return !IsBusy;}));
}
}
private async Task ExecuteGetStoresCommand()
{
if (IsBusy)
return;
if (ForceSync)
Settings.LastSync = DateTime.Now.AddDays (-30);
IsBusy = true;
GetStoresCommand.ChangeCanExecute ();
try{
Stores.Clear();
var stores = await dataStore.GetStoresAsync ();
foreach(var store in stores)
{
if(string.IsNullOrWhiteSpace(store.Image))
store.Image = "http://refractored.com/images/wc_small.jpg";
Stores.Add(store);
}
Sort();
}
catch(Exception ex) {
page.DisplayAlert ("Uh Oh :(", "Unable to gather stores.", "OK");
Xamarin.Insights.Report (ex);
}
finally {
IsBusy = false;
GetStoresCommand.ChangeCanExecute ();
}
}
private void Sort()
{
StoresGrouped.Clear();
var sorted = from store in Stores
orderby store.Country, store.City
group store by store.Country into storeGroup
select new Grouping<string, Store>(storeGroup.Key, storeGroup);
foreach(var sort in sorted)
StoresGrouped.Add(sort);
}
}
}
|
Java
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M21 3H3C2 3 1 4 1 5v14c0 1.1.9 2 2 2h18c1 0 2-1 2-2V5c0-1-1-2-2-2zM5 17l3.5-4.5 2.5 3.01L14.5 11l4.5 6H5z"
}), 'PhotoSizeSelectActual');
exports.default = _default;
|
Java
|
{% extends "layout.html" %}
{% block page_title %}
Personal details
{% endblock %}
{% block content %}
<main id="content" role="main">
{% include "../includes/phase_banner_alpha.html" %}
<form action="contact-details" method="#" class="form">
<div class="grid-row">
<div class="column-two-thirds">
<header>
<h1 class="form-title heading-large">
<!-- <span class="heading-secondary">Section 2 of 23</span> -->
Personal details
</h1>
</header>
<div class="form-group">
<label class="form-label-bold" for="title">Title</label>
<input type="text" class="form-control form-control-1-4" id="title" name="title">
</div>
<div class="form-group">
<label class="form-label-bold" for="full-name">First name</label>
<input type="text" class="form-control" id="full-name" name="full-name">
</div>
<div class="form-group">
<label class="form-label-bold" for="other-name">Middle names</label>
<input type="text" class="form-control" id="other-name" name="other-name">
</div>
<div class="form-group">
<label class="form-label-bold" for="surname">Surname</label>
<input type="text" class="form-control" id="surname" name="surname">
</div>
<div class="form-group">
<fieldset>
<legend><span class="form-label-bold">Date of birth</span></legend>
<div class="form-date">
<div class="form-group form-group-day">
<label for="dob-day">Day</label>
<input type="text" class="form-control" id="dob-day" maxlength="2" name="dob-day">
</div>
<div class="form-group form-group-month">
<label for="dob-month">Month</label>
<input type="text" class="form-control" id="dob-month" maxlength="2" name="dob-month">
</div>
<div class="form-group form-group-year">
<label for="dob-year">Year</label>
<input type="text" class="form-control" id="dob-year" maxlength="4" name="dob-year">
</div>
</div>
</fieldset>
</div>
<div class="panel panel-border-narrow js-hidden" id="state-age">
<fieldset class="inline form-group">
<legend class="form-label-bold">
What sex are you?
</legend>
<label for="radio-part-4" data-target="yesHeal" class="block-label">
<input id="radio-part-4" type="radio" name="esaHeal" value="Male">
Male
</label>
<label for="radio-part-5" data-target="noHeal" class="block-label">
<input id="radio-part-5" type="radio" name="esaHeal" value="Female">
Female
</label>
</fieldset>
</div>
<div class="form-group">
<label class="form-label-bold" for="nino">
National Insurance number
</label>
<input type="text" class="form-control" id="nino" name="nino">
</div>
<!-- Primary buttons, secondary links -->
<div class="form-group">
<input type="submit" class="button" value="Continue"> <!--a href="overview">I do not agree - leave now</a-->
</div>
</div>
<div class="column-one-third">
<p> </p>
</div>
</div>
</form>
</main>
{% endblock %}
{% block body_end %}
{% include "includes/scripts.html" %}
<script src="/public/javascripts/moment.js"></script>
<script>
$("#dob-year").change(function(e) {
var $this = $(this);
var maxAge = 60;
var dob = $("#dob-day").val();
dob += $("#dob-month").val();
dob += $("#dob-year").val();
var years = moment(dob, 'DDMMYYYY').fromNow();
years = years.split(' ');
years = parseInt(years[0]);
if(years >= maxAge) {
$("#state-age").removeClass('js-hidden').addClass('js-show');
}
});
</script>
{% endblock %}
|
Java
|
#!/usr/bin/python
# convert LLVM GenAsmWriter.inc for Capstone disassembler.
# by Nguyen Anh Quynh, 2019
import sys
if len(sys.argv) == 1:
print("Syntax: %s <GenAsmWriter.inc> <Output-GenAsmWriter.inc> <Output-GenRegisterName.inc> <arch>" %sys.argv[0])
sys.exit(1)
arch = sys.argv[4]
f = open(sys.argv[1])
lines = f.readlines()
f.close()
f1 = open(sys.argv[2], 'w+')
f2 = open(sys.argv[3], 'w+')
f1.write("/* Capstone Disassembly Engine, http://www.capstone-engine.org */\n")
f1.write("/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */\n")
f1.write("\n")
f2.write("/* Capstone Disassembly Engine, http://www.capstone-engine.org */\n")
f2.write("/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */\n")
f2.write("\n")
need_endif = False
in_getRegisterName = False
in_printAliasInstr = False
fragment_no = None
skip_printing = False
skip_line = 0
skip_count = 0
def replace_getOp(line):
line2 = line
if 'MI->getOperand(0)' in line:
line2 = line.replace('MI->getOperand(0)', 'MCInst_getOperand(MI, 0)')
elif 'MI->getOperand(1)' in line:
line2 = line.replace('MI->getOperand(1)', 'MCInst_getOperand(MI, 1)')
elif 'MI->getOperand(2)' in line:
line2 = line.replace('MI->getOperand(2)', 'MCInst_getOperand(MI, 2)')
elif 'MI->getOperand(3)' in line:
line2 = line.replace('MI->getOperand(3)', 'MCInst_getOperand(MI, 3)')
elif 'MI->getOperand(4)' in line:
line2 = line.replace('MI->getOperand(4)', 'MCInst_getOperand(MI, 4)')
elif 'MI->getOperand(5)' in line:
line2 = line.replace('MI->getOperand(5)', 'MCInst_getOperand(MI, 5)')
elif 'MI->getOperand(6)' in line:
line2 = line.replace('MI->getOperand(6)', 'MCInst_getOperand(MI, 6)')
elif 'MI->getOperand(7)' in line:
line2 = line.replace('MI->getOperand(7)', 'MCInst_getOperand(MI, 7)')
elif 'MI->getOperand(8)' in line:
line2 = line.replace('MI->getOperand(8)', 'MCInst_getOperand(MI, 8)')
return line2
def replace_getReg(line):
line2 = line
if 'MI->getOperand(0).getReg()' in line:
line2 = line.replace('MI->getOperand(0).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 0))')
elif 'MI->getOperand(1).getReg()' in line:
line2 = line.replace('MI->getOperand(1).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 1))')
elif 'MI->getOperand(2).getReg()' in line:
line2 = line.replace('MI->getOperand(2).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 2))')
elif 'MI->getOperand(3).getReg()' in line:
line2 = line.replace('MI->getOperand(3).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 3))')
elif 'MI->getOperand(4).getReg()' in line:
line2 = line.replace('MI->getOperand(4).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 4))')
elif 'MI->getOperand(5).getReg()' in line:
line2 = line.replace('MI->getOperand(5).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 5))')
elif 'MI->getOperand(6).getReg()' in line:
line2 = line.replace('MI->getOperand(6).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 6))')
elif 'MI->getOperand(7).getReg()' in line:
line2 = line.replace('MI->getOperand(7).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 7))')
elif 'MI->getOperand(8).getReg()' in line:
line2 = line.replace('MI->getOperand(8).getReg()', 'MCOperand_getReg(MCInst_getOperand(MI, 8))')
return line2
# extract param between text()
# MRI.getRegClass(AArch64::GPR32spRegClassID).contains(MI->getOperand(1).getReg()))
def extract_paren(line, text):
i = line.index(text)
return line[line.index('(', i)+1 : line.index(')', i)]
# extract text between <>
# printSVERegOp<'q'>
def extract_brackets(line):
if '<' in line:
return line[line.index('<')+1 : line.index('>')]
else:
return ''
# delete text between <>, including <>
# printSVERegOp<'q'>
def del_brackets(line):
if '<' in line:
return line[:line.index('<')] + line[line.index('>') + 1:]
else:
return line
def print_line(line):
line = line.replace('::', '_')
line = line.replace('nullptr', 'NULL')
if not skip_printing:
if in_getRegisterName:
f2.write(line + "\n")
else:
f1.write(line + "\n")
for line in lines:
line = line.rstrip()
#print("@", line)
# skip Alias
if arch.upper() == 'X86':
if 'PRINT_ALIAS_INSTR' in line:
# done
break
if skip_line:
skip_count += 1
if skip_count <= skip_line:
# skip this line
continue
else:
# skip enough number of lines, reset counters
skip_line = 0
skip_count = 0
if "::printInstruction" in line:
if arch.upper() in ('AARCH64', 'ARM64'):
#print_line("static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)\n{")
print_line("static void printInstruction(MCInst *MI, SStream *O)\n{")
else:
print_line("static void printInstruction(MCInst *MI, SStream *O)\n{")
elif 'const char *AArch64InstPrinter::' in line:
continue
elif 'getRegisterName(' in line:
if 'unsigned AltIdx' in line:
print_line("static const char *getRegisterName(unsigned RegNo, unsigned AltIdx)\n{")
else:
print_line("static const char *getRegisterName(unsigned RegNo)\n{")
elif 'getRegisterName' in line:
in_getRegisterName = True
print_line(line)
elif '::printAliasInstr' in line:
if arch.upper() in ('AARCH64', 'PPC'):
print_line("static char *printAliasInstr(MCInst *MI, SStream *OS, MCRegisterInfo *MRI)\n{")
print_line(' #define GETREGCLASS_CONTAIN(_class, _reg) MCRegisterClass_contains(MCRegisterInfo_getRegClass(MRI, _class), MCOperand_getReg(MCInst_getOperand(MI, _reg)))')
else:
print_line("static bool printAliasInstr(MCInst *MI, SStream *OS)\n{")
print_line(" unsigned int I = 0, OpIdx, PrintMethodIdx;")
print_line(" char *tmpString;")
in_printAliasInstr = True
elif 'STI.getFeatureBits()[' in line:
if arch.upper() == 'ARM':
line2 = line.replace('STI.getFeatureBits()[', 'ARM_getFeatureBits(MI->csh->mode, ')
elif arch.upper() == 'AARCH64':
line2 = line.replace('STI.getFeatureBits()[', 'AArch64_getFeatureBits(')
line2 = line2.replace(']', ')')
print_line(line2)
elif ', STI, ' in line:
line2 = line.replace(', STI, ', ', ')
if 'printSVELogicalImm<' in line:
if 'int16' in line:
line2 = line2.replace('printSVELogicalImm', 'printSVELogicalImm16')
line2 = line2.replace('<int16_t>', '')
elif 'int32' in line:
line2 = line2.replace('printSVELogicalImm', 'printSVELogicalImm32')
line2 = line2.replace('<int32_t>', '')
else:
line2 = line2.replace('printSVELogicalImm', 'printSVELogicalImm64')
line2 = line2.replace('<int64_t>', '')
if 'MI->getOperand(' in line:
line2 = replace_getOp(line2)
# C++ template
if 'printPrefetchOp' in line2:
param = extract_brackets(line2)
if param == '':
param = 'false'
line2 = del_brackets(line2)
line2 = line2.replace(', O);', ', O, %s);' %param)
line2 = line2.replace(', OS);', ', OS, %s);' %param)
elif '<false>' in line2:
line2 = line2.replace('<false>', '')
line2 = line2.replace(', O);', ', O, false);')
line2 = line2.replace('STI, ', '')
elif '<true>' in line:
line2 = line2.replace('<true>', '')
line2 = line2.replace(', O);', ', O, true);')
line2 = line2.replace('STI, ', '')
elif 'printAdrLabelOperand' in line:
# C++ template
if '<0>' in line:
line2 = line2.replace('<0>', '')
line2 = line2.replace(', O);', ', O, 0);')
elif '<1>' in line:
line2 = line2.replace('<1>', '')
line2 = line2.replace(', O);', ', O, 1);')
elif '<2>' in line:
line2 = line2.replace('<2>', '')
line2 = line2.replace(', O);', ', O, 2);')
elif 'printImm8OptLsl' in line2:
param = extract_brackets(line2)
line2 = del_brackets(line2)
if '8' in param or '16' in param or '32' in param:
line2 = line2.replace('printImm8OptLsl', 'printImm8OptLsl32')
elif '64' in param:
line2 = line2.replace('printImm8OptLsl', 'printImm8OptLsl64')
elif 'printLogicalImm' in line2:
param = extract_brackets(line2)
line2 = del_brackets(line2)
if '8' in param or '16' in param or '32' in param:
line2 = line2.replace('printLogicalImm', 'printLogicalImm32')
elif '64' in param:
line2 = line2.replace('printLogicalImm', 'printLogicalImm64')
elif 'printSVERegOp' in line2 or 'printGPRSeqPairsClassOperand' in line2 or 'printTypedVectorList' in line2 or 'printPostIncOperand' in line2 or 'printImmScale' in line2 or 'printRegWithShiftExtend' in line2 or 'printUImm12Offset' in line2 or 'printExactFPImm' in line2 or 'printMemExtend' in line2 or 'printZPRasFPR' in line2:
param = extract_brackets(line2)
if param == '':
param = '0'
line2 = del_brackets(line2)
line2 = line2.replace(', O);', ', O, %s);' %param)
line2 = line2.replace(', OS);', ', OS, %s);' %param)
elif 'printComplexRotationOp' in line:
# printComplexRotationOp<90, 0>(MI, 5, STI, O);
bracket_content = line2[line2.index('<') + 1 : line2.index('>')]
line2 = line2.replace('<' + bracket_content + '>', '')
line2 = line2.replace(' O);', ' O, %s);' %bracket_content)
print_line(line2)
elif "static const char AsmStrs[]" in line:
print_line("#ifndef CAPSTONE_DIET")
print_line(" static const char AsmStrs[] = {")
need_endif = True
elif "static const char AsmStrsNoRegAltName[]" in line:
print_line("#ifndef CAPSTONE_DIET")
print_line(" static const char AsmStrsNoRegAltName[] = {")
need_endif = True
elif line == ' O << "\\t";':
print_line(" unsigned int opcode = MCInst_getOpcode(MI);")
print_line(' // printf("opcode = %u\\n", opcode);');
elif 'MI->getOpcode()' in line:
if 'switch' in line:
line2 = line.replace('MI->getOpcode()', 'MCInst_getOpcode(MI)')
else:
line2 = line.replace('MI->getOpcode()', 'opcode')
print_line(line2)
elif 'O << ' in line:
if '"' in line:
line2 = line.lower()
line2 = line2.replace('o << ', 'SStream_concat0(O, ');
else:
line2 = line.replace('O << ', 'SStream_concat0(O, ');
line2 = line2.replace("'", '"')
line2 = line2.replace(';', ');')
if '" : "' in line2: # "segment : offset" in X86
line2 = line2.replace('" : "', '":"')
# ARM
print_line(line2)
if '", #0"' in line2:
print_line(' op_addImm(MI, 0);')
if '", #1"' in line2:
print_line(' op_addImm(MI, 1);')
# PowerPC
if '", 268"' in line2:
print_line(' op_addImm(MI, 268);')
elif '", 256"' in line2:
print_line(' op_addImm(MI, 256);')
elif '", 0, "' in line2 or '", 0"' in line2:
print_line(' op_addImm(MI, 0);')
elif '", -1"' in line2:
print_line(' op_addImm(MI, -1);')
if '[' in line2:
if not '[]' in line2:
print_line(' set_mem_access(MI, true);')
if ']' in line2:
if not '[]' in line2:
print_line(' set_mem_access(MI, false);')
if '".f64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F64);')
elif '".f32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F32);')
elif '".f16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F16);')
elif '".s64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S64);')
elif '".s32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S32);')
elif '".s16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S16);')
elif '".s8\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S8);')
elif '".u64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U64);')
elif '".u32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U32);')
elif '".u16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U16);')
elif '".u8\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U8);')
elif '".i64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_I64);')
elif '".i32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_I32);')
elif '".i16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_I16);')
elif '".i8\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_I8);')
elif '".f16.f64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F16F64);')
elif '".f64.f16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F64F16);')
elif '".f16.f32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F16F32);')
elif '".f32.f16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F32F16);')
elif '".f64.f32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F64F32);')
elif '".f32.f64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F32F64);')
elif '".s32.f32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S32F32);')
elif '".f32.s32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F32S32);')
elif '".u32.f32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U32F32);')
elif '".f32.u32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F32U32);')
elif '".p8\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_P8);')
elif '".f64.s16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F64S16);')
elif '".s16.f64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S16F64);')
elif '".f32.s16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F32S16);')
elif '".s16.f32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S16F32);')
elif '".f64.s32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F64S32);')
elif '".s32.f64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_S32F64);')
elif '".f64.u16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F64U16);')
elif '".u16.f64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U16F64);')
elif '".f32.u16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F32U16);')
elif '".u16.f32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U16F32);')
elif '".f64.u32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F64U32);')
elif '".u32.f64\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U32F64);')
elif '".f16.u32\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F16U32);')
elif '".u32.f16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U32F16);')
elif '".f16.u16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_F16U16);')
elif '".u16.f16\\t"' in line2:
print_line(' ARM_addVectorDataType(MI, ARM_VECTORDATA_U16F16);')
elif '"\\tlr"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_LR);')
elif '"\\tapsr_nzcv, fpscr"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_APSR_NZCV);')
print_line(' ARM_addReg(MI, ARM_REG_FPSCR);')
elif '"\\tpc, lr"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_PC);')
print_line(' ARM_addReg(MI, ARM_REG_LR);')
elif '"\\tfpscr, "' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPSCR);')
elif '"\\tfpexc, "' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPEXC);')
elif '"\\tfpinst, "' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPINST);')
elif '"\\tfpinst2, "' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPINST2);')
elif '"\\tfpsid, "' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPSID);')
elif '"\\tsp, "' in line2:
print_line(' ARM_addReg(MI, ARM_REG_SP);')
elif '"\\tsp!, "' in line2:
print_line(' ARM_addReg(MI, ARM_REG_SP);')
elif '", apsr"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_APSR);')
elif '", spsr"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_SPSR);')
elif '", fpscr"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPSCR);')
elif '", fpscr"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPSCR);')
elif '", fpexc"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPEXC);')
elif '", fpinst"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPINST);')
elif '", fpinst2"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPINST2);')
elif '", fpsid"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_FPSID);')
elif '", mvfr0"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_MVFR0);')
elif '", mvfr1"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_MVFR1);')
elif '", mvfr2"' in line2:
print_line(' ARM_addReg(MI, ARM_REG_MVFR2);')
elif '.8\\t' in line2:
print_line(' ARM_addVectorDataSize(MI, 8);')
elif '.16\\t' in line2:
print_line(' ARM_addVectorDataSize(MI, 16);')
elif '.32\\t' in line2:
print_line(' ARM_addVectorDataSize(MI, 32);')
elif '.64\\t' in line2:
print_line(' ARM_addVectorDataSize(MI, 64);')
elif '" ^"' in line2:
print_line(' ARM_addUserMode(MI);')
if '.16b' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_16B);')
elif '.8b' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_8B);')
elif '.4b' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_4B);')
elif '.b' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1B);')
elif '.8h' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_8H);')
elif '.4h' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_4H);')
elif '.2h' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_2H);')
elif '.h' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1H);')
elif '.4s' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_4S);')
elif '.2s' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_2S);')
elif '.s' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1S);')
elif '.2d' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_2D);')
elif '.1d' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1D);')
elif '.1q' in line2:
print_line(' arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1Q);')
if '#0.0' in line2:
print_line(' arm64_op_addFP(MI, 0);')
elif '#0' in line2:
print_line(' arm64_op_addImm(MI, 0);')
elif '#8' in line2:
print_line(' arm64_op_addImm(MI, 8);')
elif '#16' in line2:
print_line(' arm64_op_addImm(MI, 16);')
elif '#32' in line2:
print_line(' arm64_op_addImm(MI, 32);')
# X86
if '", %rax"' in line2 or '", rax"' in line2:
print_line(' op_addReg(MI, X86_REG_RAX);')
elif '", %eax"' in line2 or '", eax"' in line2:
print_line(' op_addReg(MI, X86_REG_EAX);')
elif '", %ax"' in line2 or '", ax"' in line2:
print_line(' op_addReg(MI, X86_REG_AX);')
elif '", %al"' in line2 or '", al"' in line2:
print_line(' op_addReg(MI, X86_REG_AL);')
elif '", %dx"' in line2 or '", dx"' in line2:
print_line(' op_addReg(MI, X86_REG_DX);')
elif '", %st(0)"' in line2 or '", st(0)"' in line2:
print_line(' op_addReg(MI, X86_REG_ST0);')
elif '", 1"' in line2:
print_line(' op_addImm(MI, 1);')
elif '", cl"' in line2:
print_line(' op_addReg(MI, X86_REG_CL);')
elif '"{1to2}, "' in line2:
print_line(' op_addAvxBroadcast(MI, X86_AVX_BCAST_2);')
elif '"{1to4}, "' in line2:
print_line(' op_addAvxBroadcast(MI, X86_AVX_BCAST_4);')
elif '"{1to8}, "' in line2:
print_line(' op_addAvxBroadcast(MI, X86_AVX_BCAST_8);')
elif '"{1to16}, "' in line2:
print_line(' op_addAvxBroadcast(MI, X86_AVX_BCAST_16);')
elif '{z}{sae}' in line2:
print_line(' op_addAvxSae(MI);')
print_line(' op_addAvxZeroOpmask(MI);')
elif ('{z}' in line2):
print_line(' op_addAvxZeroOpmask(MI);')
elif '{sae}' in line2:
print_line(' op_addAvxSae(MI);')
elif 'llvm_unreachable("Invalid command number.");' in line:
line2 = line.replace('llvm_unreachable("Invalid command number.");', '// unreachable')
print_line(line2)
elif ('assert(' in line) or ('assert (' in line):
pass
elif 'Invalid alt name index' in line:
pass
elif '::' in line and 'case ' in line:
#print_line(line2)
print_line(line)
elif 'MI->getNumOperands()' in line:
line2 = line.replace('MI->getNumOperands()', 'MCInst_getNumOperands(MI)')
print_line(line2)
elif 'const MCOperand &MCOp' in line:
line2 = line.replace('const MCOperand &MCOp', 'MCOperand *MCOp')
print_line(line2)
elif 'MI->getOperand(0).isImm()' in line:
line2 = line.replace('MI->getOperand(0).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 0))')
print_line(line2)
elif 'MI->getOperand(1).isImm()' in line:
line2 = line.replace('MI->getOperand(1).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 1))')
print_line(line2)
elif 'MI->getOperand(2).isImm()' in line:
line2 = line.replace('MI->getOperand(2).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 2))')
print_line(line2)
elif 'MI->getOperand(3).isImm()' in line:
line2 = line.replace('MI->getOperand(3).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 3))')
print_line(line2)
elif 'MI->getOperand(4).isImm()' in line:
line2 = line.replace('MI->getOperand(4).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 4))')
print_line(line2)
elif 'MI->getOperand(5).isImm()' in line:
line2 = line.replace('MI->getOperand(5).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 5))')
print_line(line2)
elif 'MI->getOperand(6).isImm()' in line:
line2 = line.replace('MI->getOperand(6).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 6))')
print_line(line2)
elif 'MI->getOperand(7).isImm()' in line:
line2 = line.replace('MI->getOperand(7).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 7))')
print_line(line2)
elif 'MI->getOperand(8).isImm()' in line:
line2 = line.replace('MI->getOperand(8).isImm()', 'MCOperand_isImm(MCInst_getOperand(MI, 8))')
print_line(line2)
elif 'MI->getOperand(0).getImm()' in line:
line2 = line.replace('MI->getOperand(0).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 0))')
print_line(line2)
elif 'MI->getOperand(1).getImm()' in line:
line2 = line.replace('MI->getOperand(1).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 1))')
print_line(line2)
elif 'MI->getOperand(2).getImm()' in line:
line2 = line.replace('MI->getOperand(2).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 2))')
print_line(line2)
elif 'MI->getOperand(3).getImm()' in line:
line2 = line.replace('MI->getOperand(3).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 3))')
print_line(line2)
elif 'MI->getOperand(4).getImm()' in line:
line2 = line.replace('MI->getOperand(4).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 4))')
print_line(line2)
elif 'MI->getOperand(5).getImm()' in line:
line2 = line.replace('MI->getOperand(5).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 5))')
print_line(line2)
elif 'MI->getOperand(6).getImm()' in line:
line2 = line.replace('MI->getOperand(6).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 6))')
print_line(line2)
elif 'MI->getOperand(7).getImm()' in line:
line2 = line.replace('MI->getOperand(7).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 7))')
print_line(line2)
elif 'MI->getOperand(8).getImm()' in line:
line2 = line.replace('MI->getOperand(8).getImm()', 'MCOperand_getImm(MCInst_getOperand(MI, 8))')
print_line(line2)
elif 'MRI.getRegClass(' in line:
classid = extract_paren(line, 'getRegClass(')
operand = extract_paren(line, 'getOperand')
line2 = line.replace('MI->getNumOperands()', 'MCInst_getNumOperands(MI)')
line2 = ' GETREGCLASS_CONTAIN(%s, %s)' %(classid, operand)
if line.endswith('())) {'):
line2 += ') {'
elif line.endswith(' {'):
line2 += ' {'
elif line.endswith(' &&'):
line2 += ' &&'
print_line(line2)
elif 'MI->getOperand(' in line and 'isReg' in line:
operand = extract_paren(line, 'getOperand')
line2 = ' MCOperand_isReg(MCInst_getOperand(MI, %s))' %(operand)
# MI->getOperand(1).isReg() &&
if line.endswith(' {'):
line2 += ' {'
elif line.endswith(' &&'):
line2 += ' &&'
print_line(line2)
elif 'MI->getOperand(' in line and 'getReg' in line:
line2 = replace_getReg(line)
# one more time
line2 = replace_getReg(line2)
print_line(line2)
elif ' return false;' in line and in_printAliasInstr:
print_line(' return NULL;')
elif 'MCOp.isImm()' in line:
line2 = line.replace('MCOp.isImm()', 'MCOperand_isImm(MCOp)')
print_line(line2)
elif 'MCOp.getImm()' in line:
line2 = line.replace('MCOp.getImm()', 'MCOperand_getImm(MCOp)')
if 'int64_t Val =' in line:
line2 = line2.replace('int64_t Val =', 'Val =')
print_line(line2)
elif 'isSVEMaskOfIdenticalElements<' in line:
if 'int8' in line:
line2 = line.replace('isSVEMaskOfIdenticalElements', 'isSVEMaskOfIdenticalElements8')
line2 = line2.replace('<int8_t>', '')
elif 'int16' in line:
line2 = line.replace('isSVEMaskOfIdenticalElements', 'isSVEMaskOfIdenticalElements16')
line2 = line2.replace('<int16_t>', '')
elif 'int32' in line:
line2 = line.replace('isSVEMaskOfIdenticalElements', 'isSVEMaskOfIdenticalElements32')
line2 = line2.replace('<int32_t>', '')
else:
line2 = line.replace('isSVEMaskOfIdenticalElements', 'isSVEMaskOfIdenticalElements64')
line2 = line2.replace('<int64_t>', '')
print_line(line2)
elif 'switch (PredicateIndex) {' in line:
print_line(' int64_t Val;')
print_line(line)
elif 'unsigned I = 0;' in line and in_printAliasInstr:
print_line("""
tmpString = cs_strdup(AsmString);
while (AsmString[I] != ' ' && AsmString[I] != '\\t' &&
AsmString[I] != '$' && AsmString[I] != '\\0')
++I;
tmpString[I] = 0;
SStream_concat0(OS, tmpString);
if (AsmString[I] != '\\0') {
if (AsmString[I] == ' ' || AsmString[I] == '\\t') {
SStream_concat0(OS, " ");
++I;
}
do {
if (AsmString[I] == '$') {
++I;
if (AsmString[I] == (char)0xff) {
++I;
OpIdx = AsmString[I++] - 1;
PrintMethodIdx = AsmString[I++] - 1;
printCustomAliasOperand(MI, OpIdx, PrintMethodIdx, OS);
} else
printOperand(MI, (unsigned)(AsmString[I++]) - 1, OS);
} else {
SStream_concat1(OS, AsmString[I++]);
}
} while (AsmString[I] != '\\0');
}
return tmpString;
}
""")
in_printAliasInstr = False
# skip next few lines
skip_printing = True
elif '::printCustomAliasOperand' in line:
# print again
skip_printing = False
print_line('static void printCustomAliasOperand(')
elif 'const MCSubtargetInfo &STI' in line:
pass
elif 'const MCInst *MI' in line:
line2 = line.replace('const MCInst *MI', 'MCInst *MI')
print_line(line2)
elif 'llvm_unreachable("' in line:
if 'default: ' in line:
print_line(' default:')
elif 'llvm_unreachable("Unknown MCOperandPredicate kind")' in line:
print_line(' return false; // never reach')
else:
pass
elif 'raw_ostream &' in line:
line2 = line.replace('raw_ostream &', 'SStream *')
if line2.endswith(' {'):
line2 = line2.replace(' {', '\n{')
print_line(line2)
elif 'printPredicateOperand(' in line and 'STI, ' in line:
line2 = line.replace('STI, ', '')
print_line(line2)
elif '// Fragment ' in line:
# // Fragment 0 encoded into 6 bits for 51 unique commands.
tmp = line.strip().split(' ')
fragment_no = tmp[2]
print_line(line)
elif ('switch ((' in line or 'if ((' in line) and 'Bits' in line:
# switch ((Bits >> 14) & 63) {
bits = line.strip()
bits = bits.replace('switch ', '')
bits = bits.replace('if ', '')
bits = bits.replace('{', '')
bits = bits.strip()
print_line(' // printf("Fragment %s: %%"PRIu64"\\n", %s);' %(fragment_no, bits))
print_line(line)
elif not skip_printing:
print_line(line)
if line == ' };':
if need_endif and not in_getRegisterName:
# endif only for AsmStrs when we are not inside getRegisterName()
print_line("#endif")
need_endif = False
elif 'return AsmStrs+RegAsmOffset[RegNo-1];' in line:
if in_getRegisterName:
# return NULL for register name on Diet mode
print_line("#else")
print_line(" return NULL;")
print_line("#endif")
print_line("}")
need_endif = False
in_getRegisterName = False
# skip 1 line
skip_line = 1
elif line == ' }':
# ARM64
if in_getRegisterName:
# return NULL for register name on Diet mode
print_line("#else")
print_line(" return NULL;")
print_line("#endif")
print_line("}")
need_endif = False
in_getRegisterName = False
# skip 1 line
skip_line = 1
elif 'default:' in line:
# ARM64
if in_getRegisterName:
# get the size of RegAsmOffsetvreg[]
print_line(" return (const char *)(sizeof(RegAsmOffsetvreg)/sizeof(RegAsmOffsetvreg[0]));")
f1.close()
f2.close()
|
Java
|
#!/usr/bin/env perl
use strict;
use warnings;
# Author: lh3
#
# This script is literally translated from the C version. It has two funtionalities:
#
# a) compute the length of the reference sequence contained in an alignment;
# b) collapse backward overlaps and generate consensus sequence and quality
#
# During the consensus construction, if two bases from two overlapping segments agree,
# the base quality is taken as the higher one of the two; if the two bases disagree,
# the base is set to the one of higher quality and the quality set to the difference
# between the two qualities.
#
# There are several special cases or errors:
#
# a) If a backward operation goes beyond the beginning of SEQ, the read is regarded to
# be unmapped.
# b) If the CIGARs of two segments in an overlap are inconsistent (e.g. 10M3B1M1I8M)
# the consensus CIGAR is taken as the one from the latter.
# c) If three or more segments overlap, the consensus SEQ/QUAL will be computed firstly
# for the first two overlapping segments, and then between the two-segment consensus
# and the 3rd segment and so on. The consensus CIGAR is always taken from the last one.
die("Usage: removeB.pl <in.sam>\n") if (@ARGV == 0 && -t STDIN);
while (<>) {
if (/^\@/) { # do not process the header lines
print;
next;
}
my $failed = 0; # set to '1' in case of inconsistent CIGAR
my @t = split;
$t[5] =~ s/\d+B$//; # trim trailing 'B'
my @cigar; # this is the old CIGAR array
my $no_qual = ($t[10] eq '*'); # whether QUAL equals '*'
####################################################
# Compute the length of reference in the alignment #
####################################################
my $alen = 0; # length of reference in the alignment
while ($t[5] =~ m/(\d+)([A-Z])/g) { # loop through the CIGAR string
my ($op, $len) = ($2, $1);
if ($op eq 'B') { # a backward operation
my ($u, $v) = (0, 0); # $u: query length during backward lookup; $v: reference length
my $l;
for ($l = $#cigar; $l >= 0; --$l) { # look back
my ($op1, $len1) = @{$cigar[$l]};
if ($op1 =~ m/[MIS]/) { # consume the query sequence
if ($u + $len1 >= $len) { # we have moved back enough; stop
$v += $len - $u if ($op1 =~ m/[MDN]/);
last;
} else { $u += $len1; }
}
$v += $len1 if ($op1 =~ m/[MDN]/);
}
$alen = $l < 0? 0 : $alen - $v;
} elsif ($op =~ m/[MDN]/) { # consume the reference sequence
$alen += $len;
}
push(@cigar, [$op, $len]); # keep it in the @cigar array
}
push(@t, "XL:i:$alen"); # write $alen in a tag
goto endloop if ($t[5] !~ /B/); # do nothing if the CIGAR does not contain 'B'
##############################
# Collapse backward overlaps #
##############################
$t[10] = '!' x length($t[9]) if $t[10] eq '*'; # when no QUAL; set all qualities to zero
# $i: length of query that has been read; $j: length of query that has been written
# $end_j: the right-most query position; $j may be less than $end_j after a backward operation
my ($k, $i, $j, $end_j) = (0, 0, 0, -1);
my @cigar2; # the new CIGAR array will be kept here; the new SEQ/QUAL will be generated in place
for ($k = 0; $k < @cigar; ++$k) {
my ($op, $len) = @{$cigar[$k]}; # the CIGAR operation and the operation length
if ($op eq 'B') { # a backward operation
my ($t, $u); # $u: query length during backward loopup
goto endloop if $len > $j; # an excessively long backward operation
for ($t = $#cigar2, $u = 0; $t >= 0; --$t) { # look back along the new cigar
my ($op1, $len1) = @{$cigar2[$t]};
if ($op1 =~ m/[MIS]/) { # consume the query sequence
if ($u + $len1 >= $len) { # we have looked back enough; stop
$cigar2[$t][1] -= $len - $u;
last;
} else { $u += $len1; }
}
}
--$t if $cigar2[$t][1] == 0; # get rid of the zero-length operation
$#cigar2 = $t; # truncate the new CIGAR array
$end_j = $j;
$j -= $len;
} else {
push(@cigar2, $cigar[$k]); # copy the old CIGAR to the new one
if ($op =~ m/[MIS]/) { # consume the query sequence
my ($u, $c);
# note that SEQ and QUAL is generated in place (i.e. overwriting the old SEQ/QUAL)
for ($u = 0; $u < $len; ++$u) {
$c = substr($t[9], $i + $u, 1); # the base on latter segment
if ($j + $u < $end_j) { # we are in an backward overlap
# for non-Perl programmers: ord() takes the ASCII of a character; chr() gets the character of an ASCII
if ($c ne substr($t[9], $j + $u, 1)) { # a mismatch in the overlaps
if (ord(substr($t[10], $j + $u, 1)) < ord(substr($t[10], $i + $u, 1))) { # QUAL of the 2nd segment is better
substr($t[9], $j + $u, 1) = $c; # the consensus base is taken from the 2nd segment
substr($t[10],$j + $u, 1) = chr(ord(substr($t[10], $i + $u, 1)) - ord(substr($t[10], $j + $u, 1)) + 33);
} else { # then do not change the base, but reduce the quality
substr($t[10],$j + $u, 1) = chr(ord(substr($t[10], $j + $u, 1)) - ord(substr($t[10], $i + $u, 1)) + 33);
}
} else { # same base; then set the quality as the higher one
substr($t[10],$j + $u, 1) = ord(substr($t[10], $j + $u, 1)) > ord(substr($t[10], $i + $u, 1))?
substr($t[10], $j + $u, 1) : substr($t[10], $i + $u, 1);
}
} else { # not in an overlap; then copy the base and quality over
substr($t[9], $j + $u, 1) = $c;
substr($t[10],$j + $u, 1) = substr($t[10], $i + $u, 1);
}
}
$i += $len; $j += $len;
}
}
}
# merge adjacent CIGAR operations of the same type
for ($k = 1; $k < @cigar2; ++$k) {
if ($cigar2[$k][0] eq $cigar2[$k-1][0]) {
$cigar2[$k][1] += $cigar2[$k-1][1];
$cigar2[$k-1][1] = 0; # set the operation length to zero
}
}
# update SEQ, QUAL and CIGAR
$t[9] = substr($t[9], 0, $j); # SEQ
$t[10]= substr($t[10],0, $j); # QUAL
$t[5] = ''; # CIGAR
for my $p (@cigar2) {
$t[5] .= "$p->[1]$p->[0]" if ($p->[1]); # skip zero-length operations
}
#########
# Print #
#########
endloop:
$t[1] |= 4 if $failed; # mark the read as "UNMAPPED" if something bad happens
$t[10] = '*' if $no_qual;
print join("\t", @t), "\n";
}
|
Java
|
const PlotCard = require('../../plotcard.js');
class RiseOfTheKraken extends PlotCard {
setupCardAbilities() {
this.interrupt({
when: {
onUnopposedWin: event => event.challenge.winner === this.controller
},
handler: () => {
this.game.addMessage('{0} uses {1} to gain an additional power from winning an unopposed challenge', this.controller, this);
this.game.addPower(this.controller, 1);
}
});
}
}
RiseOfTheKraken.code = '02012';
module.exports = RiseOfTheKraken;
|
Java
|
using System.Drawing;
using System.Drawing.Drawing2D;
static class DrawHelper
{
public static GraphicsPath CreateRoundRect(float x, float y, float width, float height, float radius)
{
GraphicsPath gp = new GraphicsPath();
gp.AddLine(x + radius, y, x + width - (radius * 2), y);
gp.AddArc(x + width - (radius * 2), y, radius * 2, radius * 2, 270, 90);
gp.AddLine(x + width, y + radius, x + width, y + height - (radius * 2));
gp.AddArc(x + width - (radius * 2), y + height - (radius * 2), radius * 2, radius * 2, 0, 90);
gp.AddLine(x + width - (radius * 2), y + height, x + radius, y + height);
gp.AddArc(x, y + height - (radius * 2), radius * 2, radius * 2, 90, 90);
gp.AddLine(x, y + height - (radius * 2), x, y + radius);
gp.AddArc(x, y, radius * 2, radius * 2, 180, 90);
gp.CloseFigure();
return gp;
}
public static GraphicsPath CreateUpRoundRect(float x, float y, float width, float height, float radius)
{
GraphicsPath gp = new GraphicsPath();
gp.AddLine(x + radius, y, x + width - (radius * 2), y);
gp.AddArc(x + width - (radius * 2), y, radius * 2, radius * 2, 270, 90);
gp.AddLine(x + width, y + radius, x + width, y + height - (radius * 2) + 1);
gp.AddArc(x + width - (radius * 2), y + height - (radius * 2), radius * 2, 2, 0, 90);
gp.AddLine(x + width, y + height, x + radius, y + height);
gp.AddArc(x, y + height - (radius * 2) + 1, radius * 2, 1, 90, 90);
gp.AddLine(x, y + height, x, y + radius);
gp.AddArc(x, y, radius * 2, radius * 2, 180, 90);
gp.CloseFigure();
return gp;
}
public static GraphicsPath CreateLeftRoundRect(float x, float y, float width, float height, float radius)
{
GraphicsPath gp = new GraphicsPath();
gp.AddLine(x + radius, y, x + width - (radius * 2), y);
gp.AddArc(x + width - (radius * 2), y, radius * 2, radius * 2, 270, 90);
gp.AddLine(x + width, y + 0, x + width, y + height);
gp.AddArc(x + width - (radius * 2), y + height - (1), radius * 2, 1, 0, 90);
gp.AddLine(x + width - (radius * 2), y + height, x + radius, y + height);
gp.AddArc(x, y + height - (radius * 2), radius * 2, radius * 2, 90, 90);
gp.AddLine(x, y + height - (radius * 2), x, y + radius);
gp.AddArc(x, y, radius * 2, radius * 2, 180, 90);
gp.CloseFigure();
return gp;
}
public static Color BlendColor(Color backgroundColor, Color frontColor)
{
double ratio = 0 / 255d;
double invRatio = 1d - ratio;
int r = (int)((backgroundColor.R * invRatio) + (frontColor.R * ratio));
int g = (int)((backgroundColor.G * invRatio) + (frontColor.G * ratio));
int b = (int)((backgroundColor.B * invRatio) + (frontColor.B * ratio));
return Color.FromArgb(r, g, b);
}
}
|
Java
|
namespace Perspex.Controls
{
using Layout;
public class RightDocker : Docker
{
public RightDocker(Size availableSize) : base(availableSize)
{
}
public Rect GetDockingRect(Size sizeToDock, Margins margins, Alignments alignments)
{
var marginsCutout = margins.AsThickness();
var withoutMargins = OriginalRect.Deflate(marginsCutout);
var finalRect = withoutMargins.AlignChild(sizeToDock, Alignment.End, alignments.Vertical);
AccumulatedOffset += sizeToDock.Width;
margins.HorizontalMargin = margins.HorizontalMargin.Offset(0, sizeToDock.Width);
return finalRect;
}
}
}
|
Java
|
class CreateCollectSalaries < ActiveRecord::Migration
def change
create_table :collect_salaries do |t|
t.belongs_to :user
t.decimal :money, :precision => 10, :scale => 2
t.date :collect_date
t.string :notes
t.timestamps null: false
end
end
end
|
Java
|
<?php
/**
* Amon: Integrate FuelPHP with Amon Exception & Logging
*
* @package Amon
* @version v0.1
* @author Matthew McConnell
* @license MIT License
* @link http://github.com/maca134/fuelphp-amon
*/
Autoloader::add_core_namespace('Amon');
Autoloader::add_classes(array(
'Amon\\Error' => __DIR__ . '/classes/error.php',
'Amon\\Log' => __DIR__ . '/classes/log.php',
'Amon\\Amon_Data' => __DIR__ . '/classes/amon/data.php',
'Amon\\Amon_Request' => __DIR__ . '/classes/amon/request.php',
'Amon\\Amon_Request_Http' => __DIR__ . '/classes/amon/request/http.php',
'Amon\\Amon_Request_Zeromq' => __DIR__ . '/classes/amon/request/zeromq.php',
));
|
Java
|
#! /usr/bin/env ruby
#
# <script name>
#
# DESCRIPTION:
# Get time series values from Graphite and create events based on values
#
# OUTPUT:
# plain text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: array_stats
#
# USAGE:
# #YELLOW
#
# NOTES:
#
# LICENSE:
# Copyright 2012 Ulf Mansson @ Recorded Future
# Modifications by Chris Jansen to support wildcard targets
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
#
require 'sensu-plugin/check/cli'
require 'json'
require 'net/http'
require 'net/https'
require 'socket'
require 'array_stats'
class Graphite < Sensu::Plugin::Check::CLI
option :host,
short: '-h HOST',
long: '--host HOST',
description: 'Graphite host to connect to, include port',
required: true
option :target,
description: 'The graphite metric name. Could be a comma separated list of metric names.',
short: '-t TARGET',
long: '--target TARGET',
required: true
option :complex_target,
description: 'Allows complex targets which contain functions. Disables splitting on comma.',
short: '-x',
long: '--complex_target',
default: false
option :period,
description: 'The period back in time to extract from Graphite and compare with. Use 24hours,2days etc, same format as in Graphite',
short: '-p PERIOD',
long: '--period PERIOD',
default: '2hours'
option :updated_since,
description: 'The graphite value should have been updated within UPDATED_SINCE seconds, default to 600 seconds',
short: '-u UPDATED_SINCE',
long: '--updated_since UPDATED_SINCE',
default: 600
option :acceptable_diff_percentage,
description: 'The acceptable diff from max values in percentage, used in check_function_increasing',
short: '-D ACCEPTABLE_DIFF_PERCENTAGE',
long: '--acceptable_diff_percentage ACCEPTABLE_DIFF_PERCENTAGE',
default: 0
option :check_function_increasing,
description: 'Check that value is increasing or equal over time (use acceptable_diff_percentage if it should allow to be lower)',
short: '-i',
long: '--check_function_increasing',
default: false,
boolean: true
option :greater_than,
description: 'Change whether value is greater than or less than check',
short: '-g',
long: '--greater_than',
default: false
option :check_last,
description: 'Check that the last value in GRAPHITE is greater/less than VALUE',
short: '-l VALUE',
long: '--last VALUE',
default: nil
option :ignore_nulls,
description: 'Do not error on null values, used in check_function_increasing',
short: '-n',
long: '--ignore_nulls',
default: false,
boolean: true
option :concat_output,
description: 'Include warning messages in output even if overall status is critical',
short: '-c',
long: '--concat_output',
default: false,
boolean: true
option :short_output,
description: 'Report only the highest status per series in output',
short: '-s',
long: '--short_output',
default: false,
boolean: true
option :check_average,
description: 'MAX_VALUE should be greater than the average of Graphite values from PERIOD',
short: '-a MAX_VALUE',
long: '--average_value MAX_VALUE'
option :data_points,
description: 'Number of data points to include in average check (smooths out spikes)',
short: '-d VALUE',
long: '--data_points VALUE',
default: 1
option :check_average_percent,
description: 'MAX_VALUE% should be greater than the average of Graphite values from PERIOD',
short: '-b MAX_VALUE',
long: '--average_percent_value MAX_VALUE'
option :percentile,
description: 'Percentile value, should be used in conjunction with percentile_value, defaults to 90',
long: '--percentile PERCENTILE',
default: 90
option :check_percentile,
description: 'Values should not be greater than the VALUE of Graphite values from PERIOD',
long: '--percentile_value VALUE'
option :http_user,
description: 'Basic HTTP authentication user',
short: '-U USER',
long: '--http-user USER',
default: nil
option :http_password,
description: 'Basic HTTP authentication password',
short: '-P PASSWORD',
long: '--http-password USER',
default: nil
def initialize
super
@graphite_cache = {}
end
def graphite_cache(target = nil)
# #YELLOW
if @graphite_cache.key?(target)
graphite_value = @graphite_cache[target].select { |value| value[:period] == @period }
graphite_value if graphite_value.size > 0
end
end
# Create a graphite url from params
#
#
def graphite_url(target = nil)
url = "#{config[:host]}/render/"
url = 'http://' + url unless url[0..3] == 'http'
# #YELLOW
url = url + "?target=#{target}" if target # rubocop:disable Style/SelfAssignment
URI.parse(url)
end
def get_levels(config_param)
values = config_param.split(',')
i = 0
levels = {}
%w(warning error fatal).each do |type|
levels[type] = values[i] if values[i]
i += 1
end
levels
end
def get_graphite_values(target)
cache_value = graphite_cache target
return cache_value if cache_value
params = {
target: target,
from: "-#{@period}",
format: 'json'
}
req = Net::HTTP::Post.new(graphite_url.path)
# If the basic http authentication credentials have been provided, then use them
if !config[:http_user].nil? && !config[:http_password].nil?
req.basic_auth(config[:http_user], config[:http_password])
end
req.set_form_data(params)
nethttp = Net::HTTP.new(graphite_url.host, graphite_url.port)
if graphite_url.scheme == 'https'
nethttp.use_ssl = true
end
resp = nethttp.start { |http| http.request(req) }
data = JSON.parse(resp.body)
@graphite_cache[target] = []
if data.size > 0
data.each { |d| @graphite_cache[target] << { target: d['target'], period: @period, datapoints: d['datapoints'] } }
graphite_cache target
end
end
# Will give max values for [0..-2]
def max_graphite_value(target)
max_values = {}
values = get_graphite_values target
if values
values.each do |val|
max = get_max_value(val[:datapoints])
max_values[val[:target]] = max
end
end
max_values
end
def get_max_value(values)
if values
values.map { |i| i[0] ? i[0] : 0 }[0..-2].max
end
end
def last_graphite_metric(target, count = 1)
last_values = {}
values = get_graphite_values target
if values
values.each do |val|
last = get_last_metric(val[:datapoints], count)
last_values[val[:target]] = last
end
end
last_values
end
def get_last_metric(values, count = 1)
if values
ret = []
values_size = values.size
count = values_size if count > values_size
while count > 0
values_size -= 1
break if values[values_size].nil?
count -= 1 if values[values_size][0]
ret.push(values[values_size]) if values[values_size][0]
end
ret
end
end
def last_graphite_value(target, count = 1)
last_metrics = last_graphite_metric(target, count)
last_values = {}
if last_metrics
last_metrics.each do |target_name, metrics|
last_values[target_name] = metrics.map { |metric| metric[0] }.mean
end
end
last_values
end
def been_updated_since(target, time, updated_since)
last_time_stamp = last_graphite_metric target
warnings = []
if last_time_stamp
last_time_stamp.each do |target_name, value|
last_time_stamp_bool = value[1] > time.to_i ? true : false
warnings << "The metric #{target_name} has not been updated in #{updated_since} seconds" unless last_time_stamp_bool
end
end
warnings
end
def greater_less
return 'greater' if config[:greater_than]
return 'less' unless config[:greater_than]
end
def check_increasing(target)
updated_since = config[:updated_since].to_i
time_to_be_updated_since = Time.now - updated_since
critical_errors = []
warnings = []
max_gv = max_graphite_value target
last_gv = last_graphite_value target
if last_gv.is_a?(Hash) && max_gv.is_a?(Hash)
# #YELLOW
last_gv.each do |target_name, value|
if value && max_gv[target_name]
last = value
max = max_gv[target_name]
if max > last * (1 + config[:acceptable_diff_percentage].to_f / 100)
msg = "The metric #{target} with last value #{last} is less than max value #{max} during #{config[:period]} period"
critical_errors << msg
end
end
end
else
warnings << "Could not found any value in Graphite for metric #{target}, see #{graphite_url(target)}"
end
unless config[:ignore_nulls]
warnings.concat(been_updated_since(target, time_to_be_updated_since, updated_since))
end
[warnings, critical_errors, []]
end
def check_average_percent(target, max_values, data_points = 1)
values = get_graphite_values target
last_values = last_graphite_value(target, data_points)
return [[], [], []] unless values
warnings = []
criticals = []
fatal = []
values.each do |data|
target = data[:target]
values_pair = data[:datapoints]
values_array = values_pair.select(&:first).map { |v| v.first unless v.first.nil? }
# #YELLOW
avg_value = values_array.reduce { |sum, el| sum + el if el }.to_f / values_array.size # rubocop:disable SingleLineBlockParams
last_value = last_values[target]
percent = last_value / avg_value unless last_value.nil? || avg_value.nil?
# #YELLOW
%w(fatal error warning).each do |type|
next unless max_values.key?(type)
max_value = max_values[type]
var1 = config[:greater_than] ? percent : max_value.to_f
var2 = config[:greater_than] ? max_value.to_f : percent
if !percent.nil? && var1 > var2 && (values_array.size > 0 || !config[:ignore_nulls])
text = "The last value of metric #{target} is #{percent}% #{greater_less} than allowed #{max_value}% of the average value #{avg_value}"
case type
when 'warning'
warnings << text
when 'error'
criticals << text
when 'fatal'
fatal << text
else
raise "Unknown type #{type}"
end
break if config[:short_output]
end
end
end
[warnings, criticals, fatal]
end
def check_average(target, max_values)
values = get_graphite_values target
return [[], [], []] unless values
warnings = []
criticals = []
fatal = []
values.each do |data|
target = data[:target]
values_pair = data[:datapoints]
values_array = values_pair.select(&:first).map { |v| v.first unless v.first.nil? }
# #YELLOW
avg_value = values_array.reduce { |sum, el| sum + el if el }.to_f / values_array.size # rubocop:disable SingleLineBlockParams
# YELLOW
%w(fatal error warning).each do |type|
next unless max_values.key?(type)
max_value = max_values[type]
var1 = config[:greater_than] ? avg_value : max_value.to_f
var2 = config[:greater_than] ? max_value.to_f : avg_value
if var1 > var2 && (values_array.size > 0 || !config[:ignore_nulls])
text = "The average value of metric #{target} is #{avg_value} that is #{greater_less} than allowed average of #{max_value}"
case type
when 'warning'
warnings << text
when 'error'
criticals << text
when 'fatal'
fatal << text
else
raise "Unknown type #{type}"
end
break if config[:short_output]
end
end
end
[warnings, criticals, fatal]
end
def check_percentile(target, max_values, percentile, data_points = 1)
values = get_graphite_values target
last_values = last_graphite_value(target, data_points)
return [[], [], []] unless values
warnings = []
criticals = []
fatal = []
values.each do |data|
target = data[:target]
values_pair = data[:datapoints]
values_array = values_pair.select(&:first).map { |v| v.first unless v.first.nil? }
percentile_value = values_array.percentile(percentile)
last_value = last_values[target]
percent = last_value / percentile_value unless last_value.nil? || percentile_value.nil?
# #YELLOW
%w(fatal error warning).each do |type|
next unless max_values.key?(type)
max_value = max_values[type]
var1 = config[:greater_than] ? percent : max_value.to_f
var2 = config[:greater_than] ? max_value.to_f : percent
if !percentile_value.nil? && var1 > var2
text = "The percentile value of metric #{target} (#{last_value}) is #{greater_less} than the
#{percentile}th percentile (#{percentile_value}) by more than #{max_value}%"
case type
when 'warning'
warnings << text
when 'error'
criticals << text
when 'fatal'
fatal << text
else
raise "Unknown type #{type}"
end
break if config[:short_output]
end
end
end
[warnings, criticals, fatal]
end
def check_last(target, max_values)
last_targets = last_graphite_value target
return [[], [], []] unless last_targets
warnings = []
criticals = []
fatal = []
# #YELLOW
last_targets.each do |target_name, last_value|
unless last_value.nil?
# #YELLOW
%w(fatal error warning).each do |type|
next unless max_values.key?(type)
max_value = max_values[type]
var1 = config[:greater_than] ? last_value : max_value.to_f
var2 = config[:greater_than] ? max_value.to_f : last_value
if var1 > var2
text = "The metric #{target_name} is #{last_value} that is #{greater_less} than last allowed #{max_value}"
case type
when 'warning'
warnings << text
when 'error'
criticals << text
when 'fatal'
fatal << text
else
raise "Unknown type #{type}"
end
break if config[:short_output]
end
end
end
end
[warnings, criticals, fatal]
end
def run # rubocop:disable AbcSize
targets = config[:complex_target] ? [config[:target]] : config[:target].split(',')
@period = config[:period]
critical_errors = []
warnings = []
fatals = []
# #YELLOW
targets.each do |target|
if config[:check_function_increasing]
inc_warnings, inc_critical, inc_fatal = check_increasing target
warnings += inc_warnings
critical_errors += inc_critical
fatals += inc_fatal
end
if config[:check_last]
max_values = get_levels config[:check_last]
lt_warnings, lt_critical, lt_fatal = check_last(target, max_values)
warnings += lt_warnings
critical_errors += lt_critical
fatals += lt_fatal
end
if config[:check_average]
max_values = get_levels config[:check_average]
avg_warnings, avg_critical, avg_fatal = check_average(target, max_values)
warnings += avg_warnings
critical_errors += avg_critical
fatals += avg_fatal
end
if config[:check_average_percent]
max_values = get_levels config[:check_average_percent]
avg_warnings, avg_critical, avg_fatal = check_average_percent(target, max_values, config[:data_points].to_i)
warnings += avg_warnings
critical_errors += avg_critical
fatals += avg_fatal
end
if config[:check_percentile]
max_values = get_levels config[:check_percentile]
pct_warnings, pct_critical, pct_fatal = check_percentile(target, max_values, config[:percentile].to_i, config[:data_points].to_i)
warnings += pct_warnings
critical_errors += pct_critical
fatals += pct_fatal
end
end
fatals_string = fatals.size > 0 ? fatals.join("\n") : ''
criticals_string = critical_errors.size > 0 ? critical_errors.join("\n") : ''
warnings_string = warnings.size > 0 ? warnings.join("\n") : ''
if config[:concat_output]
fatals_string = fatals_string + "\n" + criticals_string if critical_errors.size > 0
fatals_string = fatals_string + "\nGraphite WARNING: " + warnings_string if warnings.size > 0
criticals_string = criticals_string + "\nGraphite WARNING: " + warnings_string if warnings.size > 0
critical fatals_string if fatals.size > 0
critical criticals_string if critical_errors.size > 0
warning warnings_string if warnings.size > 0 # rubocop:disable Style/IdenticalConditionalBranches
else
critical fatals_string if fatals.size > 0
critical criticals_string if critical_errors.size > 0
warning warnings_string if warnings.size > 0 # rubocop:disable Style/IdenticalConditionalBranches
end
ok
end
end
|
Java
|
#include "machineoperand.h"
#include "basicblock.h"
#include <cassert>
#include <iostream>
#include <new>
using namespace TosLang::BackEnd;
MachineOperand::MachineOperand() : mKind{ OperandKind::UNKNOWN } { }
MachineOperand::MachineOperand(const unsigned op, const OperandKind kind)
{
assert((kind == OperandKind::IMMEDIATE)
|| (kind == OperandKind::STACK_SLOT)
|| (kind == OperandKind::REGISTER));
mKind = kind;
switch (kind)
{
case OperandKind::IMMEDIATE:
imm = op;
break;
case OperandKind::STACK_SLOT:
stackslot = op;
break;
case OperandKind::REGISTER:
reg = op;
break;
default:
assert(false && "Unexpected error while building a virtual instruction");
break;
}
}
std::ostream& TosLang::BackEnd::operator<<(std::ostream& stream, const MachineOperand& op)
{
switch (op.mKind)
{
case MachineOperand::OperandKind::IMMEDIATE:
return stream << op.imm;
case MachineOperand::OperandKind::STACK_SLOT:
return stream << "S" << op.stackslot;
case MachineOperand::OperandKind::REGISTER:
return stream << "R" << op.reg;
default:
return stream;
}
}
|
Java
|
/*
This file contains the sigma-delta driver implementation.
*/
#include "platform.h"
#include "hw_timer.h"
#include "task/task.h"
#include "c_stdlib.h"
#include "pcm.h"
static const os_param_t drv_sd_hw_timer_owner = 0x70636D; // "pcm"
static void ICACHE_RAM_ATTR drv_sd_timer_isr( os_param_t arg )
{
cfg_t *cfg = (cfg_t *)arg;
pcm_buf_t *buf = &(cfg->bufs[cfg->rbuf_idx]);
if (cfg->isr_throttled) {
return;
}
if (!buf->empty) {
uint16_t tmp;
// buffer is not empty, continue reading
tmp = abs((int16_t)(buf->data[buf->rpos]) - 128);
if (tmp > cfg->vu_peak_tmp) {
cfg->vu_peak_tmp = tmp;
}
cfg->vu_samples_tmp++;
if (cfg->vu_samples_tmp >= cfg->vu_req_samples) {
cfg->vu_peak = cfg->vu_peak_tmp;
task_post_low( pcm_data_vu_task, (os_param_t)cfg );
cfg->vu_samples_tmp = 0;
cfg->vu_peak_tmp = 0;
}
platform_sigma_delta_set_target( buf->data[buf->rpos++] );
if (buf->rpos >= buf->len) {
// buffer data consumed, request to re-fill it
buf->empty = TRUE;
cfg->fbuf_idx = cfg->rbuf_idx;
task_post_high( pcm_data_play_task, (os_param_t)cfg );
// switch to next buffer
cfg->rbuf_idx ^= 1;
dbg_platform_gpio_write( PLATFORM_GPIO_LOW );
}
} else {
// flag ISR throttled
cfg->isr_throttled = 1;
dbg_platform_gpio_write( PLATFORM_GPIO_LOW );
cfg->fbuf_idx = cfg->rbuf_idx;
task_post_high( pcm_data_play_task, (os_param_t)cfg );
}
}
static uint8_t drv_sd_stop( cfg_t *cfg )
{
platform_hw_timer_close( drv_sd_hw_timer_owner );
return TRUE;
}
static uint8_t drv_sd_close( cfg_t *cfg )
{
drv_sd_stop( cfg );
platform_sigma_delta_close( cfg->pin );
dbg_platform_gpio_mode( PLATFORM_GPIO_INPUT, PLATFORM_GPIO_PULLUP );
return TRUE;
}
static uint8_t drv_sd_play( cfg_t *cfg )
{
// VU control: derive callback frequency
cfg->vu_req_samples = (uint16_t)((1000000L / (uint32_t)cfg->vu_freq) / (uint32_t)pcm_rate_def[cfg->rate]);
cfg->vu_samples_tmp = 0;
cfg->vu_peak_tmp = 0;
// (re)start hardware timer ISR to feed the sigma-delta
if (platform_hw_timer_init( drv_sd_hw_timer_owner, FRC1_SOURCE, TRUE )) {
platform_hw_timer_set_func( drv_sd_hw_timer_owner, drv_sd_timer_isr, (os_param_t)cfg );
platform_hw_timer_arm_us( drv_sd_hw_timer_owner, pcm_rate_def[cfg->rate] );
return TRUE;
} else {
return FALSE;
}
}
static uint8_t drv_sd_init( cfg_t *cfg )
{
dbg_platform_gpio_write( PLATFORM_GPIO_HIGH );
dbg_platform_gpio_mode( PLATFORM_GPIO_OUTPUT, PLATFORM_GPIO_PULLUP );
platform_sigma_delta_setup( cfg->pin );
platform_sigma_delta_set_prescale( 9 );
return TRUE;
}
static uint8_t drv_sd_fail( cfg_t *cfg )
{
return FALSE;
}
const drv_t pcm_drv_sd = {
.init = drv_sd_init,
.close = drv_sd_close,
.play = drv_sd_play,
.record = drv_sd_fail,
.stop = drv_sd_stop
};
|
Java
|
module Packet
class Reactor
include Core
#set_thread_pool_size(20)
attr_accessor :fd_writers, :msg_writers,:msg_reader
attr_accessor :result_hash
attr_accessor :live_workers
#after_connection :provide_workers
def self.server_logger= (log_file_name)
@@server_logger = log_file_name
end
def self.run
master_reactor_instance = new
master_reactor_instance.result_hash = {}
master_reactor_instance.live_workers = DoubleKeyedHash.new
yield(master_reactor_instance)
master_reactor_instance.load_workers
master_reactor_instance.start_reactor
end # end of run method
def set_result_hash(hash)
@result_hash = hash
end
def update_result(worker_key,result)
@result_hash ||= {}
@result_hash[worker_key.to_sym] = result
end
def handle_internal_messages(t_sock)
sock_fd = t_sock.fileno
worker_instance = @live_workers[sock_fd]
begin
raw_data = read_data(t_sock)
worker_instance.receive_data(raw_data) if worker_instance.respond_to?(:receive_data)
rescue DisconnectError => sock_error
worker_instance.receive_data(sock_error.data) if worker_instance.respond_to?(:receive_data)
remove_worker(t_sock)
end
end
def remove_worker(t_sock)
@live_workers.delete(t_sock.fileno)
read_ios.delete(t_sock)
end
def delete_worker(worker_options = {})
worker_name = worker_options[:worker]
worker_name_key = gen_worker_key(worker_name,worker_options[:worker_key])
worker_options[:method] = :exit
@live_workers[worker_name_key].send_request(worker_options)
end
def load_workers
worker_root = defined?(WORKER_ROOT) ? WORKER_ROOT : "#{PACKET_APP}/worker"
t_workers = Dir["#{worker_root}/**/*.rb"]
return if t_workers.empty?
t_workers.each do |b_worker|
worker_name = File.basename(b_worker,".rb")
require worker_name
worker_klass = Object.const_get(packet_classify(worker_name))
next if worker_klass.no_auto_load
fork_and_load(worker_klass)
end
end
def start_worker(worker_options = { })
worker_name = worker_options[:worker].to_s
worker_name_key = gen_worker_key(worker_name,worker_options[:worker_key])
return if @live_workers[worker_name_key]
worker_options.delete(:worker)
begin
require worker_name
worker_klass = Object.const_get(packet_classify(worker_name))
fork_and_load(worker_klass,worker_options)
rescue LoadError
puts "no such worker #{worker_name}"
return
end
end
def enable_nonblock io
f = io.fcntl(Fcntl::F_GETFL,0)
io.fcntl(Fcntl::F_SETFL,Fcntl::O_NONBLOCK | f)
end
# method should use worker_key if provided in options hash.
def fork_and_load(worker_klass,worker_options = { })
t_worker_name = worker_klass.worker_name
worker_pimp = worker_klass.worker_proxy.to_s
# socket from which master process is going to read
master_read_end,worker_write_end = UNIXSocket.pair(Socket::SOCK_STREAM)
# socket to which master process is going to write
worker_read_end,master_write_end = UNIXSocket.pair(Socket::SOCK_STREAM)
option_dump = Marshal.dump(worker_options)
option_dump_length = option_dump.length
master_write_end.write(option_dump)
worker_name_key = gen_worker_key(t_worker_name,worker_options[:worker_key])
if(!(pid = fork))
[master_write_end,master_read_end].each { |x| x.close }
[worker_read_end,worker_write_end].each { |x| enable_nonblock(x) }
begin
if(ARGV[0] == 'start' && Object.const_defined?(:SERVER_LOGGER))
redirect_io(SERVER_LOGGER)
end
rescue
puts $!.backtrace
end
exec form_cmd_line(worker_read_end.fileno,worker_write_end.fileno,t_worker_name,option_dump_length)
end
Process.detach(pid)
[master_read_end,master_write_end].each { |x| enable_nonblock(x) }
if worker_pimp && !worker_pimp.empty?
require worker_pimp
pimp_klass = Object.const_get(packet_classify(worker_pimp))
@live_workers[worker_name_key,master_read_end.fileno] = pimp_klass.new(master_write_end,pid,self)
else
t_pimp = Packet::MetaPimp.new(master_write_end,pid,self)
t_pimp.worker_key = worker_name_key
t_pimp.worker_name = t_worker_name
t_pimp.invokable_worker_methods = worker_klass.instance_methods
@live_workers[worker_name_key,master_read_end.fileno] = t_pimp
end
worker_read_end.close
worker_write_end.close
read_ios << master_read_end
end # end of fork_and_load method
# Free file descriptors and
# point them somewhere sensible
# STDOUT/STDERR should go to a logfile
def redirect_io(logfile_name)
begin; STDIN.reopen "/dev/null"; rescue ::Exception; end
if logfile_name
begin
STDOUT.reopen logfile_name, "a"
STDOUT.sync = true
rescue ::Exception
begin; STDOUT.reopen "/dev/null"; rescue ::Exception; end
end
else
begin; STDOUT.reopen "/dev/null"; rescue ::Exception; end
end
begin; STDERR.reopen STDOUT; rescue ::Exception; end
STDERR.sync = true
end
def form_cmd_line *args
min_string = "packet_worker_runner #{args[0]}:#{args[1]}:#{args[2]}:#{args[3]}"
min_string << ":#{WORKER_ROOT}" if defined? WORKER_ROOT
min_string << ":#{WORKER_LOAD_ENV}" if defined? WORKER_LOAD_ENV
min_string
end
end # end of Reactor class
end # end of Packet module
|
Java
|
<h3 class="title">How to Use</h3>
<h5 class="htu-content">
<ul class="list-blank text-center">
<li class="list-item-header first"><h3>1</h3></li>
<li>Add the AngularJS <a href="https://code.angularjs.org/1.2.16/angular-animate.min.js" target="_blank">ngAnimate</a> script to your project</li>
<li class="list-item-header first"><h3>2</h3></li>
<li>Reference the 'ngAnimate' module as a dependency in your app</li>
<li class="list-item-header"><h3>3</h3></li>
<li>
Add one of the following files to your app:
<div class="row row-spaced">
<div class="col-sm-4 col-sm-offset-1">
<a class="btn btn-primary col-btn" target="_blank" href="https://raw.githubusercontent.com/theoinglis/ngAnimate.css/master/build/nga.min.css">
<b>nga.css</b> <br />
(leaner - simple)
</a>
</div>
<div class="col-sm-2 col-text htu-or">
<b>or</b>
</div>
<div class="col-sm-4">
<a class="btn btn-primary col-btn" target="_blank" href="https://raw.githubusercontent.com/theoinglis/ngAnimate.css/master/build/nga.all.min.css">
<b>nga.all.css</b> <br />
(more customisable - advanced)
</a>
</div>
</div>
</li>
<li class="list-item-header"><h3>4</h3></li>
<li>Add the classes in the 'Classes Applied' section to the element you want to animate</li>
<li class="list-item-header"><h3>Done</h3></li>
</ul>
</h5>
|
Java
|
#!/bin/sh
tar -xf $INPUT_CODE && mv ping /ping
cd /ping && npm install
|
Java
|
/*
* Copyright (c) 2017 Nathan Osman
*
* 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.
*/
#ifndef QHTTPENGINE_SOCKET_H
#define QHTTPENGINE_SOCKET_H
#include <QHostAddress>
#include <QIODevice>
#include <QMultiMap>
#include <qhttpengine/ibytearray.h>
#include "qhttpengine_export.h"
class QJsonDocument;
class QTcpSocket;
namespace QHttpEngine
{
class QHTTPENGINE_EXPORT SocketPrivate;
/**
* @brief Implementation of the HTTP protocol
*
* This class provides a class derived from QIODevice that can be used to read
* data from and write data to an HTTP client through a QTcpSocket provided in
* the constructor. The socket will assume ownership of the QTcpSocket and
* ensure it is properly deleted. Consequently, the QTcpSocket must have been
* allocated on the heap:
*
* @code
* QTcpSocket *tcpSock = new QTcpSocket;
* tcpSock->connectToHost(...);
* tcpSock->waitForConnected();
*
* QHttpEngine::Socket *httpSock = new QHttpEngine::Socket(tcpSock);
* @endcode
*
* Once the headersParsed() signal is emitted, information about the request
* can be retrieved using the appropriate methods. As data is received, the
* readyRead() signal is emitted and any available data can be read using
* QIODevice::read():
*
* @code
* QByteArray data;
* connect(httpSock, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
*
* void MyClass::onReadyRead()
* {
* data.append(httpSock->readAll());
* }
* @endcode
*
* If the client sets the `Content-Length` header, the readChannelFinished()
* signal will be emitted when the specified amount of data is read from the
* client. Otherwise the readChannelFinished() signal will be emitted
* immediately after the headers are read.
*
* The status code and headers may be set as long as no data has been written
* to the device and the writeHeaders() method has not been called. The
* headers are written either when the writeHeaders() method is called or when
* data is first written to the device:
*
* @code
* httpSock->setStatusCode(QHttpSocket::OK);
* httpSock->setHeader("Content-Length", 13);
* httpSock->write("Hello, world!");
* @endcode
*
* This class also provides methods that simplify writing a redirect or an
* HTTP error to the socket. To write a redirect, simply pass a path to the
* writeRedirect() method. To write an error, simply pass the desired HTTP
* status code to the writeError() method. Both methods will close the socket
* once the response is written.
*/
class QHTTPENGINE_EXPORT Socket : public QIODevice
{
Q_OBJECT
public:
/**
* @brief Map consisting of query string values
*/
typedef QMultiMap<QString, QString> QueryStringMap;
/**
* @brief Map consisting of HTTP headers
*
* The key used for the map is the
* [IByteArray](@ref QHttpEngine::IByteArray) class, which allows for
* case-insensitive comparison.
*/
typedef QMultiMap<IByteArray, QByteArray> HeaderMap;
/**
* HTTP methods
*
* An integer constant is provided for each of the methods described in
* RFC 2616 (HTTP/1.1).
*/
enum Method {
/// Request for communications options
OPTIONS = 1,
/// Request resource
GET = 1 << 1,
/// Request resource without body
HEAD = 1 << 2,
/// Store subordinate resource
POST = 1 << 3,
/// Store resource
PUT = 1 << 4,
/// Delete resource
DELETE = 1 << 5,
/// Diagnostic trace
TRACE = 1 << 6,
/// Proxy connection
CONNECT = 1 << 7
};
/**
* Predefined constants for HTTP status codes
*/
enum {
/// Request was successful
OK = 200,
/// Request was successful and a resource was created
Created = 201,
/// Request was accepted for processing, not completed yet.
Accepted = 202,
/// %Range request was successful
PartialContent = 206,
/// Resource has moved permanently
MovedPermanently = 301,
/// Resource is available at an alternate URI
Found = 302,
/// Bad client request
BadRequest = 400,
/// Client is unauthorized to access the resource
Unauthorized = 401,
/// Access to the resource is forbidden
Forbidden = 403,
/// Resource was not found
NotFound = 404,
/// Method is not valid for the resource
MethodNotAllowed = 405,
/// The request could not be completed due to a conflict with the current state of the resource
Conflict = 409,
/// An internal server error occurred
InternalServerError = 500,
/// Invalid response from server while acting as a gateway
BadGateway = 502,
/// %Server unable to handle request due to overload
ServiceUnavailable = 503,
/// %Server does not supports the HTTP version in the request
HttpVersionNotSupported = 505
};
/**
* @brief Create a new socket from a QTcpSocket
*
* This instance will assume ownership of the QTcpSocket. That is, it will
* make itself the parent of the socket.
*/
Socket(QTcpSocket *socket, QObject *parent = 0);
/**
* @brief Retrieve the number of bytes available for reading
*
* This method indicates the number of bytes that could immediately be
* read by a call to QIODevice::readAll().
*/
virtual qint64 bytesAvailable() const;
/**
* @brief Determine if the device is sequential
*
* This method will always return true.
*/
virtual bool isSequential() const;
/**
* @brief Close the device and underlying socket
*
* Invoking this method signifies that no more data will be written to the
* device. It will also close the underlying QTcpSocket and destroy this
* object.
*/
virtual void close();
/**
* @brief Retrive the address of the remote peer
*/
QHostAddress peerAddress() const;
/**
* @brief Determine if the request headers have been parsed yet
*/
bool isHeadersParsed() const;
/**
* @brief Retrieve the request method
*
* This method may only be called after the request headers have been
* parsed.
*/
Method method() const;
/**
* @brief Retrieve the raw request path
*
* This method may only be called after the request headers have been
* parsed.
*/
QByteArray rawPath() const;
/**
* @brief Retrieve the decoded path with the query string removed
*
* This method may only be called after the request headers have been
* parsed.
*/
QString path() const;
/**
* @brief Retrieve the query string
*
* This method may only be called after the request headers have been
* parsed.
*/
QueryStringMap queryString() const;
/**
* @brief Retrieve a map of request headers
*
* This method may only be called after the request headers have been
* parsed. The original case of the headers is preserved but comparisons
* are performed in a case-insensitive manner.
*/
HeaderMap headers() const;
/**
* @brief Retrieve the length of the content
*
* This value is provided by the `Content-Length` HTTP header (if present)
* and returns -1 if the value is not available.
*/
qint64 contentLength() const;
/**
* @brief Parse the request body as a JSON document
*
* This method may only be called after the request headers **and** the
* request body have been received. The most effective way to confirm that
* this is the case is by using:
*
* @code
* socket->bytesAvailable() >= socket->contentLength()
* @endcode
*
* If the JSON received is invalid, an error will be immediately written
* to the socket. The return value indicates whether the JSON was valid.
*/
bool readJson(QJsonDocument &document);
/**
* @brief Set the response code
*
* This method may only be called before the response headers are written.
*
* The statusReason parameter may be omitted if one of the predefined
* status code constants is used. If no response status code is explicitly
* set, it will assume a default value of "200 OK".
*/
void setStatusCode(int statusCode, const QByteArray &statusReason = QByteArray());
/**
* @brief Set a response header to a specific value
*
* This method may only be called before the response headers are written.
* Duplicate values will be either appended to the header or used to
* replace the original value, depending on the third parameter.
*/
void setHeader(const QByteArray &name, const QByteArray &value, bool replace = true);
/**
* @brief Set the response headers
*
* This method may only be called before the response headers are written.
* All existing headers will be overwritten.
*/
void setHeaders(const HeaderMap &headers);
/**
* @brief Write response headers to the socket
*
* This method should not be invoked after the response headers have been
* written.
*/
void writeHeaders();
/**
* @brief Write an HTTP 3xx redirect to the socket and close it
*/
void writeRedirect(const QByteArray &path, bool permanent = false);
/**
* @brief Write an HTTP error to the socket and close it
*/
void writeError(int statusCode, const QByteArray &statusReason = QByteArray());
/**
* @brief Write the specified JSON document to the socket and close it
*/
void writeJson(const QJsonDocument &document, int statusCode = OK);
Q_SIGNALS:
/**
* @brief Indicate that request headers have been parsed
*
* This signal is emitted when the request headers have been received from
* the client and parsing is complete. It is then safe to begin reading
* request data. The readyRead() signal will be emitted as request data is
* received.
*/
void headersParsed();
/**
* @brief Indicate that the client has disconnected
*/
void disconnected();
protected:
/**
* @brief Implementation of QIODevice::readData()
*/
virtual qint64 readData(char *data, qint64 maxlen);
/**
* @brief Implementation of QIODevice::writeData()
*/
virtual qint64 writeData(const char *data, qint64 len);
private:
SocketPrivate *const d;
friend class SocketPrivate;
};
}
#endif // QHTTPENGINE_SOCKET_H
|
Java
|
//
// Reflect.cs: Creates Element classes from an instance
//
// Author:
// Miguel de Icaza (miguel@gnome.org)
//
// Copyright 2010, Novell, Inc.
//
// Code licensed under the MIT X11 license
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
namespace MonoTouch.Dialog
{
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class EntryAttribute : Attribute {
public EntryAttribute () : this (null) { }
public EntryAttribute (string placeholder)
{
Placeholder = placeholder;
}
public string Placeholder;
public UIKeyboardType KeyboardType;
public UITextAutocorrectionType AutocorrectionType;
public UITextAutocapitalizationType AutocapitalizationType;
public UITextFieldViewMode ClearButtonMode;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class DateAttribute : Attribute { }
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class TimeAttribute : Attribute { }
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class CheckboxAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class MultilineAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class HtmlAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class SkipAttribute : Attribute {}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class PasswordAttribute : EntryAttribute {
public PasswordAttribute (string placeholder) : base (placeholder) {}
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class AlignmentAttribute : Attribute {
public AlignmentAttribute (UITextAlignment alignment) {
Alignment = alignment;
}
public UITextAlignment Alignment;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class RadioSelectionAttribute : Attribute {
public string Target;
public RadioSelectionAttribute (string target)
{
Target = target;
}
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class OnTapAttribute : Attribute {
public OnTapAttribute (string method)
{
Method = method;
}
public string Method;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class CaptionAttribute : Attribute {
public CaptionAttribute (string caption)
{
Caption = caption;
}
public string Caption;
}
[AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited=false)]
public class SectionAttribute : Attribute {
public SectionAttribute () {}
public SectionAttribute (string caption)
{
Caption = caption;
}
public SectionAttribute (string caption, string footer)
{
Caption = caption;
Footer = footer;
}
public string Caption, Footer;
}
public class RangeAttribute : Attribute {
public RangeAttribute (float low, float high)
{
Low = low;
High = high;
}
public float Low, High;
public bool ShowCaption;
}
public class BindingContext : IDisposable {
public RootElement Root;
Dictionary<Element,MemberAndInstance> mappings;
class MemberAndInstance {
public MemberAndInstance (MemberInfo mi, object o)
{
Member = mi;
Obj = o;
}
public MemberInfo Member;
public object Obj;
}
static object GetValue (MemberInfo mi, object o)
{
var fi = mi as FieldInfo;
if (fi != null)
return fi.GetValue (o);
var pi = mi as PropertyInfo;
var getMethod = pi.GetGetMethod ();
return getMethod.Invoke (o, new object [0]);
}
static void SetValue (MemberInfo mi, object o, object val)
{
var fi = mi as FieldInfo;
if (fi != null){
fi.SetValue (o, val);
return;
}
var pi = mi as PropertyInfo;
var setMethod = pi.GetSetMethod ();
setMethod.Invoke (o, new object [] { val });
}
static string MakeCaption (string name)
{
var sb = new StringBuilder (name.Length);
bool nextUp = true;
foreach (char c in name){
if (nextUp){
sb.Append (Char.ToUpper (c));
nextUp = false;
} else {
if (c == '_'){
sb.Append (' ');
continue;
}
if (Char.IsUpper (c))
sb.Append (' ');
sb.Append (c);
}
}
return sb.ToString ();
}
// Returns the type for fields and properties and null for everything else
static Type GetTypeForMember (MemberInfo mi)
{
if (mi is FieldInfo)
return ((FieldInfo) mi).FieldType;
else if (mi is PropertyInfo)
return ((PropertyInfo) mi).PropertyType;
return null;
}
public BindingContext (object callbacks, object o, string title)
{
if (o == null)
throw new ArgumentNullException ("o");
mappings = new Dictionary<Element,MemberAndInstance> ();
Root = new RootElement (title);
Populate (callbacks, o, Root);
}
void Populate (object callbacks, object o, RootElement root)
{
MemberInfo last_radio_index = null;
var members = o.GetType ().GetMembers (BindingFlags.DeclaredOnly | BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance);
Section section = null;
foreach (var mi in members){
Type mType = GetTypeForMember (mi);
if (mType == null)
continue;
string caption = null;
object [] attrs = mi.GetCustomAttributes (false);
bool skip = false;
foreach (var attr in attrs){
if (attr is SkipAttribute || attr is System.Runtime.CompilerServices.CompilerGeneratedAttribute)
skip = true;
else if (attr is CaptionAttribute)
caption = ((CaptionAttribute) attr).Caption;
else if (attr is SectionAttribute){
if (section != null)
root.Add (section);
var sa = attr as SectionAttribute;
section = new Section (sa.Caption, sa.Footer);
}
}
if (skip)
continue;
if (caption == null)
caption = MakeCaption (mi.Name);
if (section == null)
section = new Section ();
Element element = null;
if (mType == typeof (string)){
PasswordAttribute pa = null;
AlignmentAttribute align = null;
EntryAttribute ea = null;
object html = null;
NSAction invoke = null;
bool multi = false;
foreach (object attr in attrs){
if (attr is PasswordAttribute)
pa = attr as PasswordAttribute;
else if (attr is EntryAttribute)
ea = attr as EntryAttribute;
else if (attr is MultilineAttribute)
multi = true;
else if (attr is HtmlAttribute)
html = attr;
else if (attr is AlignmentAttribute)
align = attr as AlignmentAttribute;
if (attr is OnTapAttribute){
string mname = ((OnTapAttribute) attr).Method;
if (callbacks == null){
throw new Exception ("Your class contains [OnTap] attributes, but you passed a null object for `context' in the constructor");
}
var method = callbacks.GetType ().GetMethod (mname);
if (method == null)
throw new Exception ("Did not find method " + mname);
invoke = delegate {
method.Invoke (method.IsStatic ? null : callbacks, new object [0]);
};
}
}
string value = (string) GetValue (mi, o);
if (pa != null)
element = new EntryElement (caption, pa.Placeholder, value, true);
else if (ea != null)
element = new EntryElement (caption, ea.Placeholder, value) { KeyboardType = ea.KeyboardType, AutocapitalizationType = ea.AutocapitalizationType, AutocorrectionType = ea.AutocorrectionType, ClearButtonMode = ea.ClearButtonMode };
else if (multi)
element = new MultilineElement (caption, value);
else if (html != null)
element = new HtmlElement (caption, value);
else {
var selement = new StringElement (caption, value);
element = selement;
if (align != null)
selement.Alignment = align.Alignment;
}
if (invoke != null)
((StringElement) element).Tapped += invoke;
} else if (mType == typeof (float)){
var floatElement = new FloatElement (null, null, (float) GetValue (mi, o));
floatElement.Caption = caption;
element = floatElement;
foreach (object attr in attrs){
if (attr is RangeAttribute){
var ra = attr as RangeAttribute;
floatElement.MinValue = ra.Low;
floatElement.MaxValue = ra.High;
floatElement.ShowCaption = ra.ShowCaption;
}
}
} else if (mType == typeof (bool)){
bool checkbox = false;
foreach (object attr in attrs){
if (attr is CheckboxAttribute)
checkbox = true;
}
if (checkbox)
element = new CheckboxElement (caption, (bool) GetValue (mi, o));
else
element = new BooleanElement (caption, (bool) GetValue (mi, o));
} else if (mType == typeof (DateTime)){
var dateTime = (DateTime) GetValue (mi, o);
bool asDate = false, asTime = false;
foreach (object attr in attrs){
if (attr is DateAttribute)
asDate = true;
else if (attr is TimeAttribute)
asTime = true;
}
if (asDate)
element = new DateElement (caption, dateTime);
else if (asTime)
element = new TimeElement (caption, dateTime);
else
element = new DateTimeElement (caption, dateTime);
} else if (mType.IsEnum){
var csection = new Section ();
ulong evalue = Convert.ToUInt64 (GetValue (mi, o), null);
int idx = 0;
int selected = 0;
foreach (var fi in mType.GetFields (BindingFlags.Public | BindingFlags.Static)){
ulong v = Convert.ToUInt64 (GetValue (fi, null));
if (v == evalue)
selected = idx;
CaptionAttribute ca = Attribute.GetCustomAttribute(fi, typeof(CaptionAttribute)) as CaptionAttribute;
csection.Add (new RadioElement (ca != null ? ca.Caption : MakeCaption (fi.Name)));
idx++;
}
element = new RootElement (caption, new RadioGroup (null, selected)) { csection };
} else if (mType == typeof (UIImage)){
element = new ImageElement ((UIImage) GetValue (mi, o));
} else if (typeof (System.Collections.IEnumerable).IsAssignableFrom (mType)){
var csection = new Section ();
int count = 0;
if (last_radio_index == null)
throw new Exception ("IEnumerable found, but no previous int found");
foreach (var e in (IEnumerable) GetValue (mi, o)){
csection.Add (new RadioElement (e.ToString ()));
count++;
}
int selected = (int) GetValue (last_radio_index, o);
if (selected >= count || selected < 0)
selected = 0;
element = new RootElement (caption, new MemberRadioGroup (null, selected, last_radio_index)) { csection };
last_radio_index = null;
} else if (typeof (int) == mType){
foreach (object attr in attrs){
if (attr is RadioSelectionAttribute){
last_radio_index = mi;
break;
}
}
} else {
var nested = GetValue (mi, o);
if (nested != null){
var newRoot = new RootElement (caption);
Populate (callbacks, nested, newRoot);
element = newRoot;
}
}
if (element == null)
continue;
section.Add (element);
mappings [element] = new MemberAndInstance (mi, o);
}
root.Add (section);
}
class MemberRadioGroup : RadioGroup {
public MemberInfo mi;
public MemberRadioGroup (string key, int selected, MemberInfo mi) : base (key, selected)
{
this.mi = mi;
}
}
public void Dispose ()
{
Dispose (true);
}
protected virtual void Dispose (bool disposing)
{
if (disposing){
foreach (var element in mappings.Keys){
element.Dispose ();
}
mappings = null;
}
}
public void Fetch ()
{
foreach (var dk in mappings){
Element element = dk.Key;
MemberInfo mi = dk.Value.Member;
object obj = dk.Value.Obj;
if (element is DateTimeElement)
SetValue (mi, obj, ((DateTimeElement) element).DateValue);
else if (element is FloatElement)
SetValue (mi, obj, ((FloatElement) element).Value);
else if (element is BooleanElement)
SetValue (mi, obj, ((BooleanElement) element).Value);
else if (element is CheckboxElement)
SetValue (mi, obj, ((CheckboxElement) element).Value);
else if (element is EntryElement){
var entry = (EntryElement) element;
entry.FetchValue ();
SetValue (mi, obj, entry.Value);
} else if (element is ImageElement)
SetValue (mi, obj, ((ImageElement) element).Value);
else if (element is RootElement){
var re = element as RootElement;
if (re.group as MemberRadioGroup != null){
var group = re.group as MemberRadioGroup;
SetValue (group.mi, obj, re.RadioSelected);
} else if (re.group as RadioGroup != null){
var mType = GetTypeForMember (mi);
var fi = mType.GetFields (BindingFlags.Public | BindingFlags.Static) [re.RadioSelected];
SetValue (mi, obj, fi.GetValue (null));
}
}
}
}
}
}
|
Java
|
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
namespace Blog.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
[Required]
public string FullName { get; set; }
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
}
|
Java
|
<!DOCTYPE HTML>
<html lang="en-US" >
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=11; IE=10; IE=9; IE=8; IE=7; IE=EDGE" />
<title>名词解释 | EMP用户手册</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="generator" content="GitBook 1.3.4">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="../overview/EMPIntroduce.html" />
<link rel="prev" href="../overview/Introduction.html" />
</head>
<body>
<link rel="stylesheet" href="../gitbook/style.css">
<div class="book" data-level="1.1" data-basepath=".." data-revision="1463048404363">
<div class="book-summary">
<div class="book-search">
<input type="text" placeholder="Type to search" class="form-control" />
</div>
<ul class="summary">
<li class="chapter " data-level="0" data-path="index.html">
<a href="../index.html">
<i class="fa fa-check"></i>
Introduction
</a>
</li>
<li class="chapter " data-level="1" data-path="overview/Introduction.html">
<a href="../overview/Introduction.html">
<i class="fa fa-check"></i>
<b>1.</b>
什么是EMP
</a>
<ul class="articles">
<li class="chapter active" data-level="1.1" data-path="overview/TermIntroduction.html">
<a href="../overview/TermIntroduction.html">
<i class="fa fa-check"></i>
<b>1.1.</b>
名词解释
</a>
</li>
<li class="chapter " data-level="1.2" data-path="overview/EMPIntroduce.html">
<a href="../overview/EMPIntroduce.html">
<i class="fa fa-check"></i>
<b>1.2.</b>
EMP 概述
</a>
</li>
<li class="chapter " data-level="1.3" data-path="overview/Components.html">
<a href="../overview/Components.html">
<i class="fa fa-check"></i>
<b>1.3.</b>
EMP 组件
</a>
</li>
<li class="chapter " data-level="1.4" data-path="overview/Client.html">
<a href="../overview/Client.html">
<i class="fa fa-check"></i>
<b>1.4.</b>
EMP 客户端
</a>
</li>
<li class="chapter " data-level="1.5" data-path="overview/EWP.html">
<a href="../overview/EWP.html">
<i class="fa fa-check"></i>
<b>1.5.</b>
EMP EWP服务
</a>
</li>
<li class="chapter " data-level="1.6" data-path="overview/Console.html">
<a href="../overview/Console.html">
<i class="fa fa-check"></i>
<b>1.6.</b>
EMP 管理平台
</a>
</li>
<li class="chapter " data-level="1.7" data-path="overview/IDE.html">
<a href="../overview/IDE.html">
<i class="fa fa-check"></i>
<b>1.7.</b>
EMP IDE
</a>
</li>
<li class="chapter " data-level="1.8" data-path="overview/EMPRun.html">
<a href="../overview/EMPRun.html">
<i class="fa fa-check"></i>
<b>1.8.</b>
EMP 如何运转
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="2" data-path="prerequisites/Introduction.html">
<a href="../prerequisites/Introduction.html">
<i class="fa fa-check"></i>
<b>2.</b>
储备知识
</a>
<ul class="articles">
<li class="chapter " data-level="2.1" data-path="prerequisites/Erlang.html">
<a href="../prerequisites/Erlang.html">
<i class="fa fa-check"></i>
<b>2.1.</b>
Erlang
</a>
</li>
<li class="chapter " data-level="2.2" data-path="prerequisites/Lua.html">
<a href="../prerequisites/Lua.html">
<i class="fa fa-check"></i>
<b>2.2.</b>
Lua
</a>
</li>
<li class="chapter " data-level="2.3" data-path="prerequisites/XHTML.html">
<a href="../prerequisites/XHTML.html">
<i class="fa fa-check"></i>
<b>2.3.</b>
XHTML
</a>
</li>
<li class="chapter " data-level="2.4" data-path="prerequisites/CSS.html">
<a href="../prerequisites/CSS.html">
<i class="fa fa-check"></i>
<b>2.4.</b>
CSS
</a>
</li>
<li class="chapter " data-level="2.5" data-path="prerequisites/ClearSilver.html">
<a href="../prerequisites/ClearSilver.html">
<i class="fa fa-check"></i>
<b>2.5.</b>
CLEARSILVER
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="3" data-path="setup_develop_env/Introduction.html">
<a href="../setup_develop_env/Introduction.html">
<i class="fa fa-check"></i>
<b>3.</b>
开发环境安装
</a>
<ul class="articles">
<li class="chapter " data-level="3.1" data-path="setup_develop_env/server/Introduction.html">
<a href="../setup_develop_env/server/Introduction.html">
<i class="fa fa-check"></i>
<b>3.1.</b>
EMP Server 开发环境
</a>
<ul class="articles">
<li class="chapter " data-level="3.1.1" data-path="setup_develop_env/server/Windows/Introduction.html">
<a href="../setup_develop_env/server/Windows/Introduction.html">
<i class="fa fa-check"></i>
<b>3.1.1.</b>
Windows系统中环境安装
</a>
<ul class="articles">
<li class="chapter " data-level="3.1.1.1" data-path="setup_develop_env/server/Windows/VMInstall.html">
<a href="../setup_develop_env/server/Windows/VMInstall.html">
<i class="fa fa-check"></i>
<b>3.1.1.1.</b>
虚拟机安装
</a>
</li>
<li class="chapter " data-level="3.1.1.2" data-path="setup_develop_env/server/Windows/ErlangInstall.html">
<a href="../setup_develop_env/server/Windows/ErlangInstall.html">
<i class="fa fa-check"></i>
<b>3.1.1.2.</b>
Erlang安装
</a>
</li>
<li class="chapter " data-level="3.1.1.3" data-path="setup_develop_env/server/Windows/AndroidSimInstall.html">
<a href="../setup_develop_env/server/Windows/AndroidSimInstall.html">
<i class="fa fa-check"></i>
<b>3.1.1.3.</b>
Android模拟器安装
</a>
</li>
<li class="chapter " data-level="3.1.1.4" data-path="setup_develop_env/server/Windows/EclipseIDEInstall.html">
<a href="../setup_develop_env/server/Windows/EclipseIDEInstall.html">
<i class="fa fa-check"></i>
<b>3.1.1.4.</b>
Eclipse IDE安装
</a>
</li>
<li class="chapter " data-level="3.1.1.5" data-path="dev_book/develop_env/atom.html">
<a href="../dev_book/develop_env/atom.html">
<i class="fa fa-check"></i>
<b>3.1.1.5.</b>
开发工具
</a>
</li>
<li class="chapter " data-level="3.1.1.6" data-path="dev_book/develop_env/env.html">
<a href="../dev_book/develop_env/env.html">
<i class="fa fa-check"></i>
<b>3.1.1.6.</b>
开发环境
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="3.1.2" data-path="setup_develop_env/server/Linux/Introduction.html">
<a href="../setup_develop_env/server/Linux/Introduction.html">
<i class="fa fa-check"></i>
<b>3.1.2.</b>
Linux系统中环境安装
</a>
<ul class="articles">
<li class="chapter " data-level="3.1.2.1" data-path="setup_develop_env/server/Linux/EMPInstall.html">
<a href="../setup_develop_env/server/Linux/EMPInstall.html">
<i class="fa fa-check"></i>
<b>3.1.2.1.</b>
ubuntu系统EMP开发环境安装
</a>
</li>
<li class="chapter " data-level="3.1.2.2" data-path="setup_develop_env/server/Linux/AndroidSimInstall.html">
<a href="../setup_develop_env/server/Linux/AndroidSimInstall.html">
<i class="fa fa-check"></i>
<b>3.1.2.2.</b>
Android 模拟器安装
</a>
</li>
<li class="chapter " data-level="3.1.2.3" data-path="setup_develop_env/server/Linux/ECTSInstall.html">
<a href="../setup_develop_env/server/Linux/ECTSInstall.html">
<i class="fa fa-check"></i>
<b>3.1.2.3.</b>
ECTS环境安装
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="4" data-path="hello_emp/Introduction.html">
<a href="../hello_emp/Introduction.html">
<i class="fa fa-check"></i>
<b>4.</b>
Hello EMP
</a>
<ul class="articles">
<li class="chapter " data-level="4.1" data-path="dev_book/create_project/create_project.html">
<a href="../dev_book/create_project/create_project.html">
<i class="fa fa-check"></i>
<b>4.1.</b>
创建Project
</a>
</li>
<li class="chapter " data-level="4.2" data-path="dev_book/create_project/start_project.html">
<a href="../dev_book/create_project/start_project.html">
<i class="fa fa-check"></i>
<b>4.2.</b>
启动Project
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="5" data-path="app_dev/Introduction.html">
<a href="../app_dev/Introduction.html">
<i class="fa fa-check"></i>
<b>5.</b>
前端界面开发入门
</a>
<ul class="articles">
<li class="chapter " data-level="5.1" data-path="app_dev/xhtml/XHTMLDev.html">
<a href="../app_dev/xhtml/XHTMLDev.html">
<i class="fa fa-check"></i>
<b>5.1.</b>
XHTML界面开发
</a>
<ul class="articles">
<li class="chapter " data-level="5.1.1" data-path="app_dev/xhtml/xhtmlCompost/XHTMLCompost.html">
<a href="../app_dev/xhtml/xhtmlCompost/XHTMLCompost.html">
<i class="fa fa-check"></i>
<b>5.1.1.</b>
界面基本构成
</a>
<ul class="articles">
<li class="chapter " data-level="5.1.1.1" data-path="app_dev/xhtml/xhtmlCompost/xhtml_baseTag.html">
<a href="../app_dev/xhtml/xhtmlCompost/xhtml_baseTag.html">
<i class="fa fa-check"></i>
<b>5.1.1.1.</b>
标准控件
</a>
</li>
<li class="chapter " data-level="5.1.1.2" data-path="app_dev/xhtml/xhtmlCompost/xhtml_css.html">
<a href="../app_dev/xhtml/xhtmlCompost/xhtml_css.html">
<i class="fa fa-check"></i>
<b>5.1.1.2.</b>
CSS样式
</a>
</li>
<li class="chapter " data-level="5.1.1.3" data-path="app_dev/xhtml/xhtmlCompost/xhtml_cusTag.html">
<a href="../app_dev/xhtml/xhtmlCompost/xhtml_cusTag.html">
<i class="fa fa-check"></i>
<b>5.1.1.3.</b>
定制控件
</a>
</li>
<li class="chapter " data-level="5.1.1.4" data-path="app_dev/xhtml/xhtmlCompost/xhtml_LuaScript.html">
<a href="../app_dev/xhtml/xhtmlCompost/xhtml_LuaScript.html">
<i class="fa fa-check"></i>
<b>5.1.1.4.</b>
Lua脚本
</a>
</li>
<li class="chapter " data-level="5.1.1.5" data-path="app_dev/xhtml/xhtmlCompost/xhtml_mul_example.html">
<a href="../app_dev/xhtml/xhtmlCompost/xhtml_mul_example.html">
<i class="fa fa-check"></i>
<b>5.1.1.5.</b>
综合实例
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="5.1.2" data-path="app_dev/xhtml/xhtmlDyn/xhtml_dyn.html">
<a href="../app_dev/xhtml/xhtmlDyn/xhtml_dyn.html">
<i class="fa fa-check"></i>
<b>5.1.2.</b>
动态界面
</a>
<ul class="articles">
<li class="chapter " data-level="5.1.2.1" data-path="app_dev/xhtml/xhtmlDyn/xhtml_init.html">
<a href="../app_dev/xhtml/xhtmlDyn/xhtml_init.html">
<i class="fa fa-check"></i>
<b>5.1.2.1.</b>
界面初始化
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="5.2" data-path="app_dev/module/module_dev.html">
<a href="../app_dev/module/module_dev.html">
<i class="fa fa-check"></i>
<b>5.2.</b>
EWP MODULE开发
</a>
<ul class="articles">
<li class="chapter " data-level="5.2.1" data-path="app_dev/module/module_function.html">
<a href="../app_dev/module/module_function.html">
<i class="fa fa-check"></i>
<b>5.2.1.</b>
Module实现功能
</a>
</li>
<li class="chapter " data-level="5.2.2" data-path="app_dev/module/module_compose.html">
<a href="../app_dev/module/module_compose.html">
<i class="fa fa-check"></i>
<b>5.2.2.</b>
Module创建以及编写
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="5.3" data-path="app_dev/ewpData/module_data.html">
<a href="../app_dev/ewpData/module_data.html">
<i class="fa fa-check"></i>
<b>5.3.</b>
MODULE数据获取
</a>
<ul class="articles">
<li class="chapter " data-level="5.3.1" data-path="app_dev/ewpData/simple_session.html">
<a href="../app_dev/ewpData/simple_session.html">
<i class="fa fa-check"></i>
<b>5.3.1.</b>
Session简单操作
</a>
</li>
<li class="chapter " data-level="5.3.2" data-path="app_dev/ewpData/database.html">
<a href="../app_dev/ewpData/database.html">
<i class="fa fa-check"></i>
<b>5.3.2.</b>
数据库获取
</a>
</li>
<li class="chapter " data-level="5.3.3" data-path="app_dev/ewpData/other_service.html">
<a href="../app_dev/ewpData/other_service.html">
<i class="fa fa-check"></i>
<b>5.3.3.</b>
第三方Service获取
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="5.4" data-path="app_dev/pageData/page_data.html">
<a href="../app_dev/pageData/page_data.html">
<i class="fa fa-check"></i>
<b>5.4.</b>
界面数据获取
</a>
<ul class="articles">
<li class="chapter " data-level="5.4.1" data-path="app_dev/pageData/from_module.html">
<a href="../app_dev/pageData/from_module.html">
<i class="fa fa-check"></i>
<b>5.4.1.</b>
获取MODULE数据
</a>
</li>
<li class="chapter " data-level="5.4.2" data-path="app_dev/pageData/page_to_page.html">
<a href="../app_dev/pageData/page_to_page.html">
<i class="fa fa-check"></i>
<b>5.4.2.</b>
界面间传值
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="5.5" data-path="app_dev/mul_example/Introduction.html">
<a href="../app_dev/mul_example/Introduction.html">
<i class="fa fa-check"></i>
<b>5.5.</b>
综合实例
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="6" data-path="deepin_app_dev/Introduction.html">
<a href="../deepin_app_dev/Introduction.html">
<i class="fa fa-check"></i>
<b>6.</b>
前端深入APP开发
</a>
<ul class="articles">
<li class="chapter " data-level="6.1" data-path="deepin_app_dev/channel_and_collection/Introduction.html">
<a href="../deepin_app_dev/channel_and_collection/Introduction.html">
<i class="fa fa-check"></i>
<b>6.1.</b>
菜单和业务频道
</a>
<ul class="articles">
<li class="chapter " data-level="6.1.1" data-path="deepin_app_dev/channel_and_collection/channel_and_collection.html">
<a href="../deepin_app_dev/channel_and_collection/channel_and_collection.html">
<i class="fa fa-check"></i>
<b>6.1.1.</b>
菜单和业务频道介绍
</a>
</li>
<li class="chapter " data-level="6.1.2" >
<span><b>6.1.2.</b> 使用管理后台</span>
<ul class="articles">
<li class="chapter " data-level="6.1.2.1" data-path="deepin_app_dev/channel_and_collection/create_channel_and_collection.html">
<a href="../deepin_app_dev/channel_and_collection/create_channel_and_collection.html">
<i class="fa fa-check"></i>
<b>6.1.2.1.</b>
创建菜单和业务频道
</a>
</li>
<li class="chapter " data-level="6.1.2.2" data-path="deepin_app_dev/channel_and_collection/create_collection_page.html">
<a href="../deepin_app_dev/channel_and_collection/create_collection_page.html">
<i class="fa fa-check"></i>
<b>6.1.2.2.</b>
开发菜单界面
</a>
</li>
<li class="chapter " data-level="6.1.2.3" data-path="deepin_app_dev/channel_and_collection/create_channel_entrance_page.html">
<a href="../deepin_app_dev/channel_and_collection/create_channel_entrance_page.html">
<i class="fa fa-check"></i>
<b>6.1.2.3.</b>
开发频道入口界面
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="6.1.3" >
<span><b>6.1.3.</b> 使用atom工具</span>
<ul class="articles">
<li class="chapter " data-level="6.1.3.1" data-path="dev_book/create_channel/create_channel.html">
<a href="../dev_book/create_channel/create_channel.html">
<i class="fa fa-check"></i>
<b>6.1.3.1.</b>
创建channel
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="6.1.4" data-path="deepin_app_dev/channel_page/Introduction.html">
<a href="../deepin_app_dev/channel_page/Introduction.html">
<i class="fa fa-check"></i>
<b>6.1.4.</b>
业务界面
</a>
<ul class="articles">
<li class="chapter " data-level="6.1.4.1" data-path="dev_book/lua_fun/jump.html">
<a href="../dev_book/lua_fun/jump.html">
<i class="fa fa-check"></i>
<b>6.1.4.1.</b>
跳转界面
</a>
</li>
<li class="chapter " data-level="6.1.4.2" data-path="dev_book/lua_fun/public_fun.html">
<a href="../dev_book/lua_fun/public_fun.html">
<i class="fa fa-check"></i>
<b>6.1.4.2.</b>
公共方法
</a>
</li>
<li class="chapter " data-level="6.1.4.3" data-path="dev_book/page_dev/add_basic_common.html">
<a href="../dev_book/page_dev/add_basic_common.html">
<i class="fa fa-check"></i>
<b>6.1.4.3.</b>
使用基础控件和公共控件
</a>
</li>
<li class="chapter " data-level="6.1.4.4" data-path="deepin_app_dev/channel_page/channel_page_develop.html">
<a href="../deepin_app_dev/channel_page/channel_page_develop.html">
<i class="fa fa-check"></i>
<b>6.1.4.4.</b>
开发业务界面
</a>
</li>
<li class="chapter " data-level="6.1.4.5" data-path="deepin_app_dev/channel_page/channel_lua_develop.html">
<a href="../deepin_app_dev/channel_page/channel_lua_develop.html">
<i class="fa fa-check"></i>
<b>6.1.4.5.</b>
使用公共方法编写脚本逻辑
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="6.1.5" data-path="dev_book/debug/Introduction.html">
<a href="../dev_book/debug/Introduction.html">
<i class="fa fa-check"></i>
<b>6.1.5.</b>
调试
</a>
<ul class="articles">
<li class="chapter " data-level="6.1.5.1" data-path="dev_book/debug/debug.html">
<a href="../dev_book/debug/debug.html">
<i class="fa fa-check"></i>
<b>6.1.5.1.</b>
如何调试
</a>
</li>
<li class="chapter " data-level="6.1.5.2" data-path="dev_book/debug/log.html">
<a href="../dev_book/debug/log.html">
<i class="fa fa-check"></i>
<b>6.1.5.2.</b>
查看日志
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="7" data-path="deepin_app_dev/complete_transaction_dev/Introduction.html">
<a href="../deepin_app_dev/complete_transaction_dev/Introduction.html">
<i class="fa fa-check"></i>
<b>7.</b>
完整交易开发
</a>
<ul class="articles">
<li class="chapter " data-level="7.1" data-path="deepin_app_dev/complete_transaction_dev/folder_introduction.html">
<a href="../deepin_app_dev/complete_transaction_dev/folder_introduction.html">
<i class="fa fa-check"></i>
<b>7.1.</b>
文件夹目录介绍
</a>
</li>
<li class="chapter " data-level="7.2" data-path="deepin_app_dev/complete_transaction_dev/page_dev.html">
<a href="../deepin_app_dev/complete_transaction_dev/page_dev.html">
<i class="fa fa-check"></i>
<b>7.2.</b>
界面开发
</a>
</li>
<li class="chapter " data-level="7.3" data-path="deepin_app_dev/complete_transaction_dev/pack.html">
<a href="../deepin_app_dev/complete_transaction_dev/pack.html">
<i class="fa fa-check"></i>
<b>7.3.</b>
离线资源打包
</a>
</li>
<li class="chapter " data-level="7.4" data-path="deepin_app_dev/complete_transaction_dev/upload.html">
<a href="../deepin_app_dev/complete_transaction_dev/upload.html">
<i class="fa fa-check"></i>
<b>7.4.</b>
离线资源上传
</a>
</li>
<li class="chapter " data-level="7.5" data-path="deepin_app_dev/complete_transaction_dev/run_and_verify.html">
<a href="../deepin_app_dev/complete_transaction_dev/run_and_verify.html">
<i class="fa fa-check"></i>
<b>7.5.</b>
运行和验证
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="8" >
<span><b>8.</b> 后端Module开发入门</span>
<ul class="articles">
<li class="chapter " data-level="8.1" data-path="app_dev/module/module_dev.html">
<a href="../app_dev/module/module_dev.html">
<i class="fa fa-check"></i>
<b>8.1.</b>
EWP MODULE开发
</a>
<ul class="articles">
<li class="chapter " data-level="8.1.1" data-path="app_dev/module/module_function.html">
<a href="../app_dev/module/module_function.html">
<i class="fa fa-check"></i>
<b>8.1.1.</b>
Module实现功能
</a>
</li>
<li class="chapter " data-level="8.1.2" data-path="app_dev/module/module_compose.html">
<a href="../app_dev/module/module_compose.html">
<i class="fa fa-check"></i>
<b>8.1.2.</b>
Module创建以及编写
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="8.2" data-path="app_dev/ewpData/module_data.html">
<a href="../app_dev/ewpData/module_data.html">
<i class="fa fa-check"></i>
<b>8.2.</b>
MODULE数据获取
</a>
<ul class="articles">
<li class="chapter " data-level="8.2.1" data-path="app_dev/ewpData/simple_session.html">
<a href="../app_dev/ewpData/simple_session.html">
<i class="fa fa-check"></i>
<b>8.2.1.</b>
Session简单操作
</a>
</li>
<li class="chapter " data-level="8.2.2" data-path="app_dev/ewpData/database.html">
<a href="../app_dev/ewpData/database.html">
<i class="fa fa-check"></i>
<b>8.2.2.</b>
数据库获取
</a>
</li>
<li class="chapter " data-level="8.2.3" data-path="app_dev/ewpData/other_service.html">
<a href="../app_dev/ewpData/other_service.html">
<i class="fa fa-check"></i>
<b>8.2.3.</b>
第三方Service获取
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="9" data-path="deepin_app_dev/Introduction.html">
<a href="../deepin_app_dev/Introduction.html">
<i class="fa fa-check"></i>
<b>9.</b>
后端深入开发
</a>
<ul class="articles">
<li class="chapter " data-level="9.1" data-path="deepin_app_dev/adapter/Introduction.html">
<a href="../deepin_app_dev/adapter/Introduction.html">
<i class="fa fa-check"></i>
<b>9.1.</b>
适配器
</a>
<ul class="articles">
<li class="chapter " data-level="9.1.1" data-path="deepin_app_dev/adapter/adapter.html">
<a href="../deepin_app_dev/adapter/adapter.html">
<i class="fa fa-check"></i>
<b>9.1.1.</b>
适配器介绍
</a>
</li>
<li class="chapter " data-level="9.1.2" data-path="deepin_app_dev/adapter/deploy_adapter.html">
<a href="../deepin_app_dev/adapter/deploy_adapter.html">
<i class="fa fa-check"></i>
<b>9.1.2.</b>
配置适配器
</a>
</li>
<li class="chapter " data-level="9.1.3" data-path="deepin_app_dev/adapter/channel_module_develop.html">
<a href="../deepin_app_dev/adapter/channel_module_develop.html">
<i class="fa fa-check"></i>
<b>9.1.3.</b>
开发业务流程
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="10" data-path="deepin_app_dev/interface/Introduction.html">
<a href="../deepin_app_dev/interface/Introduction.html">
<i class="fa fa-check"></i>
<b>10.</b>
接口介绍
</a>
<ul class="articles">
<li class="chapter " data-level="10.1" data-path="deepin_app_dev/interface/WebInterfaceIntroduction.html">
<a href="../deepin_app_dev/interface/WebInterfaceIntroduction.html">
<i class="fa fa-check"></i>
<b>10.1.</b>
扩展Web接口
</a>
<ul class="articles">
<li class="chapter " data-level="10.1.1" data-path="deepin_app_dev/interface/webInterface_regAndImplement.html">
<a href="../deepin_app_dev/interface/webInterface_regAndImplement.html">
<i class="fa fa-check"></i>
<b>10.1.1.</b>
Web接口注册与实现
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="10.2" data-path="deepin_app_dev/interface/callback_plugin_introduction.html">
<a href="../deepin_app_dev/interface/callback_plugin_introduction.html">
<i class="fa fa-check"></i>
<b>10.2.</b>
Callback 插件开发
</a>
<ul class="articles">
<li class="chapter " data-level="10.2.1" data-path="deepin_app_dev/interface/callback_plugin_dev_guide.html">
<a href="../deepin_app_dev/interface/callback_plugin_dev_guide.html">
<i class="fa fa-check"></i>
<b>10.2.1.</b>
Callback插件开发入门
</a>
</li>
<li class="chapter " data-level="10.2.2" data-path="deepin_app_dev/interface/ewp_callback_plugin_introduction.html">
<a href="../deepin_app_dev/interface/ewp_callback_plugin_introduction.html">
<i class="fa fa-check"></i>
<b>10.2.2.</b>
EWP Callback详细介绍
</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="chapter " data-level="11" data-path="code_standard/code_standard.html">
<a href="../code_standard/code_standard.html">
<i class="fa fa-check"></i>
<b>11.</b>
编码规范
</a>
<ul class="articles">
<li class="chapter " data-level="11.1" data-path="code_standard/erlang_standard.html">
<a href="../code_standard/erlang_standard.html">
<i class="fa fa-check"></i>
<b>11.1.</b>
Erlang 编码规范
</a>
</li>
<li class="chapter " data-level="11.2" data-path="code_standard/xhtml_standard.html">
<a href="../code_standard/xhtml_standard.html">
<i class="fa fa-check"></i>
<b>11.2.</b>
Xhtml 编码规范
</a>
</li>
<li class="chapter " data-level="11.3" data-path="code_standard/css_standard.html">
<a href="../code_standard/css_standard.html">
<i class="fa fa-check"></i>
<b>11.3.</b>
CSS 编码规范
</a>
</li>
<li class="chapter " data-level="11.4" data-path="code_standard/lua_standard.html">
<a href="../code_standard/lua_standard.html">
<i class="fa fa-check"></i>
<b>11.4.</b>
Lua 编码规范
</a>
</li>
<li class="chapter " data-level="11.5" data-path="code_standard/lua_include.html">
<a href="../code_standard/lua_include.html">
<i class="fa fa-check"></i>
<b>11.5.</b>
界面编写部分规范
</a>
</li>
<li class="chapter " data-level="11.6" data-path="code_standard/basic_tag_standard.html">
<a href="../code_standard/basic_tag_standard.html">
<i class="fa fa-check"></i>
<b>11.6.</b>
基础控件命名规范
</a>
</li>
<li class="chapter " data-level="11.7" data-path="code_standard/public_tag_standard.html">
<a href="../code_standard/public_tag_standard.html">
<i class="fa fa-check"></i>
<b>11.7.</b>
公共控件命名规范
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="12" data-path="dev_book/add_tag/Introduction.html">
<a href="../dev_book/add_tag/Introduction.html">
<i class="fa fa-check"></i>
<b>12.</b>
控件入库流程
</a>
<ul class="articles">
<li class="chapter " data-level="12.1" data-path="dev_book/add_tag/basic_ui.html">
<a href="../dev_book/add_tag/basic_ui.html">
<i class="fa fa-check"></i>
<b>12.1.</b>
基础控件入库流程
</a>
</li>
<li class="chapter " data-level="12.2" data-path="dev_book/add_tag/public_ui.html">
<a href="../dev_book/add_tag/public_ui.html">
<i class="fa fa-check"></i>
<b>12.2.</b>
公共控件入库流程
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="13" data-path="common_problem/FAQ.html">
<a href="../common_problem/FAQ.html">
<i class="fa fa-check"></i>
<b>13.</b>
常见问题
</a>
</li>
<li class="chapter " data-level="14" data-path="senior_topical/Introduction.html">
<a href="../senior_topical/Introduction.html">
<i class="fa fa-check"></i>
<b>14.</b>
EWP 高级主题
</a>
<ul class="articles">
<li class="chapter " data-level="14.1" data-path="senior_topical/Session.html">
<a href="../senior_topical/Session.html">
<i class="fa fa-check"></i>
<b>14.1.</b>
SESSION操作
</a>
</li>
<li class="chapter " data-level="14.2" data-path="senior_topical/SessionShared.html">
<a href="../senior_topical/SessionShared.html">
<i class="fa fa-check"></i>
<b>14.2.</b>
SESSION共享操作
</a>
</li>
<li class="chapter " data-level="14.3" data-path="senior_topical/Push.html">
<a href="../senior_topical/Push.html">
<i class="fa fa-check"></i>
<b>14.3.</b>
消息推送
</a>
</li>
<li class="chapter " data-level="14.4" data-path="senior_topical/error_code_service.html">
<a href="../senior_topical/error_code_service.html">
<i class="fa fa-check"></i>
<b>14.4.</b>
错误服务
</a>
</li>
<li class="chapter " data-level="14.5" data-path="senior_topical/data_store.html">
<a href="../senior_topical/data_store.html">
<i class="fa fa-check"></i>
<b>14.5.</b>
数据采集
</a>
</li>
<li class="chapter " data-level="14.6" data-path="senior_topical/OfflineStore.html">
<a href="../senior_topical/OfflineStore.html">
<i class="fa fa-check"></i>
<b>14.6.</b>
离线存储
</a>
</li>
<li class="chapter " data-level="14.7" data-path="senior_topical/client_package_verify.html">
<a href="../senior_topical/client_package_verify.html">
<i class="fa fa-check"></i>
<b>14.7.</b>
防篡改
</a>
</li>
<li class="chapter " data-level="14.8" data-path="senior_topical/py_resource_up_down.html">
<a href="../senior_topical/py_resource_up_down.html">
<i class="fa fa-check"></i>
<b>14.8.</b>
命令行方式上传下载离线资源
</a>
</li>
<li class="chapter " data-level="14.9" data-path="senior_topical/offline_resource.html">
<a href="../senior_topical/offline_resource.html">
<i class="fa fa-check"></i>
<b>14.9.</b>
离线资源的使用
</a>
</li>
<li class="chapter " data-level="14.10" data-path="senior_topical/preset_resource.html">
<a href="../senior_topical/preset_resource.html">
<i class="fa fa-check"></i>
<b>14.10.</b>
服务器如何正确导出预置资源
</a>
</li>
<li class="chapter " data-level="14.11" data-path="senior_topical/Database.html">
<a href="../senior_topical/Database.html">
<i class="fa fa-check"></i>
<b>14.11.</b>
数据库
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="http://www.gitbook.io/" target="blank" class="gitbook-link">Published using GitBook</a>
</li>
</ul>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header">
<!-- Actions Left -->
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
<div id="font-settings-wrapper" class="dropdown pull-left">
<a href="#" class="btn toggle-dropdown" aria-label="Toggle font settings"><i class="fa fa-font"></i>
</a>
<div class="dropdown-menu font-settings">
<div class="dropdown-caret">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</div>
<div class="buttons">
<button type="button" id="reduce-font-size" class="button size-2">A</button>
<button type="button" id="enlarge-font-size" class="button size-2">A</button>
</div>
<div class="buttons font-family-list">
<button type="button" data-font="0" class="button">Serif</button>
<button type="button" data-font="1" class="button">Sans</button>
</div>
<div class="buttons color-theme-list">
<button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">White</button>
<button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">Sepia</button>
<button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">Night</button>
</div>
</div>
</div>
<!-- Actions Right -->
<div class="dropdown pull-right">
<a href="#" class="btn toggle-dropdown" aria-label="Toggle share dropdown">下载</a>
<div class="dropdown-menu font-settings dropdown-left">
<div class="dropdown-caret">
<span class="caret-outer"></span>
<span class="caret-inner"></span>
</div>
<div class="buttons">
<a href="/emp/get_started/get_started.zip" class="button">html</a>
<a href="/emp/get_started/book.pdf" class="button">pdf</a>
<a href="" class="button">epub</a>
</div>
</div>
</div>
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="../" >EMP用户手册</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1">
<div class="page-inner">
<section class="normal" id="section-gitbook_81">
<h1 id="名词解释">名词解释</h1>
<!-- toc -->
<!-- toc stop -->
<ul>
<li><p>EMP (Enterpries Mobile Platform) 企业移动应用平台</p>
<p> EMP是北京融易通信息技术公司自主研发的一个高延展性、高可靠性、兼容多种业务系统和中间件系统、支持多种手机应用平台的企业移动应用平台,可以为现有和未来的移动应用构建一个通用的运行环境。</p>
</li>
<li><p>Yaws (Yet another web server) 网页服务器</p>
<p> Yaws是基于Erlang所开发的网页服务器,并提供两种执行模式,分别为独立式和嵌入式。前者执行起来像一般网页服务器程式,通常默认为此模式;后者则是将网页服务器嵌在其他Erlang应用程式里。</p>
</li>
<li><p>EWP (Erlang Web Service Platform) 信息聚合服务器</p>
<p> EWP是基于yaws开发的web服务器,是一个信息发布、浏览、交互的平台。它允许用户通过手机客户端来访问发行商所提供的各种类型和格式的信息资源,它提供了项目APP所依托的代码框架以及基础功能组件。</p>
</li>
<li><p>ERT (EMP Client Runtime) 跨平台客户端组件</p>
<p> ERT涵盖了对iOS、Android、Windows Phone、PC(基于QT技术)平台的支持,做到一套代码不同平台展现一致。</p>
</li>
</ul>
</section>
</div>
</div>
</div>
<a href="../overview/Introduction.html" class="navigation navigation-prev " aria-label="Previous page: 什么是EMP"><i class="fa fa-angle-left"></i></a>
<a href="../overview/EMPIntroduce.html" class="navigation navigation-next " aria-label="Next page: EMP 概述"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="../gitbook/app.js"></script>
<script>
require(["gitbook"], function(gitbook) {
var config = {"fontSettings":{"theme":null,"family":"sans","size":2}};
gitbook.start(config);
});
</script>
</body>
</html>
|
Java
|
#!/usr/bin/env ruby
require './lib/metalbird/authenticators/twitter.rb'
url = 'https://api.twitter.com'
authenticator = Metalbird::Authenticator::Twitter.new(url)
authenticator.authenticate
|
Java
|
Retrieves the original email in a thread, including headers and attachments, when the reporting user forwarded the original email not as an attachment.
You must have the necessary permissions in your email service to execute global search.
- EWS: eDiscovery
- Gmail: Google Apps Domain-Wide Delegation of Authority
## Dependencies
This playbook uses the following sub-playbooks, integrations, and scripts.
### Sub-playbooks
* Get Original Message - Gmail
* Get Original Email - EWS
### Integrations
This playbook does not use any integrations.
### Scripts
This playbook does not use any scripts.
### Commands
This playbook does not use any commands.
## Playbook Inputs
---
There are no inputs for this playbook.
## Playbook Outputs
---
| **Path** | **Description** | **Type** |
| --- | --- | --- |
| Email | The email object. | unknown |
| File | The original attachments. | unknown |
| Email.To | The recipient of the email. | string |
| Email.From | The sender of the email. | string |
| Email.CC | The CC address of the email. | string |
| Email.BCC | The BCC address of the email. | string |
| Email.HTML | The email HTML. | string |
| Email.Body | The email text body. | string |
| Email.Headers | The email headers. | unknown |
| Email.Subject | The email subject. | string |
## Playbook Image
---

|
Java
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM8 17c-.55 0-1-.45-1-1v-5c0-.55.45-1 1-1s1 .45 1 1v5c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1z"
}), 'AssessmentRounded');
|
Java
|
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
}
a:active,
a:hover {
outline: 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
h1 {
margin: .67em 0;
font-size: 2em;
}
mark {
color: #000;
background: #ff0;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sup {
top: -.5em;
}
sub {
bottom: -.25em;
}
img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 1em 40px;
}
hr {
height: 0;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
pre {
overflow: auto;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
button,
input,
optgroup,
select,
textarea {
margin: 0;
font: inherit;
color: inherit;
}
button {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],
html input[disabled] {
cursor: default;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
padding: 0;
border: 0;
}
input {
line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
-webkit-appearance: textfield;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
padding: .35em .625em .75em;
margin: 0 2px;
border: 1px solid #c0c0c0;
}
legend {
padding: 0;
border: 0;
}
textarea {
overflow: auto;
}
optgroup {
font-weight: bold;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
td,
th {
padding: 0;
}
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */
@media print {
*,
*:before,
*:after {
color: #000 !important;
text-shadow: none !important;
background: transparent !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
.navbar {
display: none;
}
.btn > .caret,
.dropup > .btn > .caret {
border-top-color: #000 !important;
}
.label {
border: 1px solid #000;
}
.table {
border-collapse: collapse !important;
}
.table td,
.table th {
background-color: #fff !important;
}
.table-bordered th,
.table-bordered td {
border: 1px solid #ddd !important;
}
}
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.glyphicon-asterisk:before {
content: "\2a";
}
.glyphicon-plus:before {
content: "\2b";
}
.glyphicon-euro:before,
.glyphicon-eur:before {
content: "\20ac";
}
.glyphicon-minus:before {
content: "\2212";
}
.glyphicon-cloud:before {
content: "\2601";
}
.glyphicon-envelope:before {
content: "\2709";
}
.glyphicon-pencil:before {
content: "\270f";
}
.glyphicon-glass:before {
content: "\e001";
}
.glyphicon-music:before {
content: "\e002";
}
.glyphicon-search:before {
content: "\e003";
}
.glyphicon-heart:before {
content: "\e005";
}
.glyphicon-star:before {
content: "\e006";
}
.glyphicon-star-empty:before {
content: "\e007";
}
.glyphicon-user:before {
content: "\e008";
}
.glyphicon-film:before {
content: "\e009";
}
.glyphicon-th-large:before {
content: "\e010";
}
.glyphicon-th:before {
content: "\e011";
}
.glyphicon-th-list:before {
content: "\e012";
}
.glyphicon-ok:before {
content: "\e013";
}
.glyphicon-remove:before {
content: "\e014";
}
.glyphicon-zoom-in:before {
content: "\e015";
}
.glyphicon-zoom-out:before {
content: "\e016";
}
.glyphicon-off:before {
content: "\e017";
}
.glyphicon-signal:before {
content: "\e018";
}
.glyphicon-cog:before {
content: "\e019";
}
.glyphicon-trash:before {
content: "\e020";
}
.glyphicon-home:before {
content: "\e021";
}
.glyphicon-file:before {
content: "\e022";
}
.glyphicon-time:before {
content: "\e023";
}
.glyphicon-road:before {
content: "\e024";
}
.glyphicon-download-alt:before {
content: "\e025";
}
.glyphicon-download:before {
content: "\e026";
}
.glyphicon-upload:before {
content: "\e027";
}
.glyphicon-inbox:before {
content: "\e028";
}
.glyphicon-play-circle:before {
content: "\e029";
}
.glyphicon-repeat:before {
content: "\e030";
}
.glyphicon-refresh:before {
content: "\e031";
}
.glyphicon-list-alt:before {
content: "\e032";
}
.glyphicon-lock:before {
content: "\e033";
}
.glyphicon-flag:before {
content: "\e034";
}
.glyphicon-headphones:before {
content: "\e035";
}
.glyphicon-volume-off:before {
content: "\e036";
}
.glyphicon-volume-down:before {
content: "\e037";
}
.glyphicon-volume-up:before {
content: "\e038";
}
.glyphicon-qrcode:before {
content: "\e039";
}
.glyphicon-barcode:before {
content: "\e040";
}
.glyphicon-tag:before {
content: "\e041";
}
.glyphicon-tags:before {
content: "\e042";
}
.glyphicon-book:before {
content: "\e043";
}
.glyphicon-bookmark:before {
content: "\e044";
}
.glyphicon-print:before {
content: "\e045";
}
.glyphicon-camera:before {
content: "\e046";
}
.glyphicon-font:before {
content: "\e047";
}
.glyphicon-bold:before {
content: "\e048";
}
.glyphicon-italic:before {
content: "\e049";
}
.glyphicon-text-height:before {
content: "\e050";
}
.glyphicon-text-width:before {
content: "\e051";
}
.glyphicon-align-left:before {
content: "\e052";
}
.glyphicon-align-center:before {
content: "\e053";
}
.glyphicon-align-right:before {
content: "\e054";
}
.glyphicon-align-justify:before {
content: "\e055";
}
.glyphicon-list:before {
content: "\e056";
}
.glyphicon-indent-left:before {
content: "\e057";
}
.glyphicon-indent-right:before {
content: "\e058";
}
.glyphicon-facetime-video:before {
content: "\e059";
}
.glyphicon-picture:before {
content: "\e060";
}
.glyphicon-map-marker:before {
content: "\e062";
}
.glyphicon-adjust:before {
content: "\e063";
}
.glyphicon-tint:before {
content: "\e064";
}
.glyphicon-edit:before {
content: "\e065";
}
.glyphicon-share:before {
content: "\e066";
}
.glyphicon-check:before {
content: "\e067";
}
.glyphicon-move:before {
content: "\e068";
}
.glyphicon-step-backward:before {
content: "\e069";
}
.glyphicon-fast-backward:before {
content: "\e070";
}
.glyphicon-backward:before {
content: "\e071";
}
.glyphicon-play:before {
content: "\e072";
}
.glyphicon-pause:before {
content: "\e073";
}
.glyphicon-stop:before {
content: "\e074";
}
.glyphicon-forward:before {
content: "\e075";
}
.glyphicon-fast-forward:before {
content: "\e076";
}
.glyphicon-step-forward:before {
content: "\e077";
}
.glyphicon-eject:before {
content: "\e078";
}
.glyphicon-chevron-left:before {
content: "\e079";
}
.glyphicon-chevron-right:before {
content: "\e080";
}
.glyphicon-plus-sign:before {
content: "\e081";
}
.glyphicon-minus-sign:before {
content: "\e082";
}
.glyphicon-remove-sign:before {
content: "\e083";
}
.glyphicon-ok-sign:before {
content: "\e084";
}
.glyphicon-question-sign:before {
content: "\e085";
}
.glyphicon-info-sign:before {
content: "\e086";
}
.glyphicon-screenshot:before {
content: "\e087";
}
.glyphicon-remove-circle:before {
content: "\e088";
}
.glyphicon-ok-circle:before {
content: "\e089";
}
.glyphicon-ban-circle:before {
content: "\e090";
}
.glyphicon-arrow-left:before {
content: "\e091";
}
.glyphicon-arrow-right:before {
content: "\e092";
}
.glyphicon-arrow-up:before {
content: "\e093";
}
.glyphicon-arrow-down:before {
content: "\e094";
}
.glyphicon-share-alt:before {
content: "\e095";
}
.glyphicon-resize-full:before {
content: "\e096";
}
.glyphicon-resize-small:before {
content: "\e097";
}
.glyphicon-exclamation-sign:before {
content: "\e101";
}
.glyphicon-gift:before {
content: "\e102";
}
.glyphicon-leaf:before {
content: "\e103";
}
.glyphicon-fire:before {
content: "\e104";
}
.glyphicon-eye-open:before {
content: "\e105";
}
.glyphicon-eye-close:before {
content: "\e106";
}
.glyphicon-warning-sign:before {
content: "\e107";
}
.glyphicon-plane:before {
content: "\e108";
}
.glyphicon-calendar:before {
content: "\e109";
}
.glyphicon-random:before {
content: "\e110";
}
.glyphicon-comment:before {
content: "\e111";
}
.glyphicon-magnet:before {
content: "\e112";
}
.glyphicon-chevron-up:before {
content: "\e113";
}
.glyphicon-chevron-down:before {
content: "\e114";
}
.glyphicon-retweet:before {
content: "\e115";
}
.glyphicon-shopping-cart:before {
content: "\e116";
}
.glyphicon-folder-close:before {
content: "\e117";
}
.glyphicon-folder-open:before {
content: "\e118";
}
.glyphicon-resize-vertical:before {
content: "\e119";
}
.glyphicon-resize-horizontal:before {
content: "\e120";
}
.glyphicon-hdd:before {
content: "\e121";
}
.glyphicon-bullhorn:before {
content: "\e122";
}
.glyphicon-bell:before {
content: "\e123";
}
.glyphicon-certificate:before {
content: "\e124";
}
.glyphicon-thumbs-up:before {
content: "\e125";
}
.glyphicon-thumbs-down:before {
content: "\e126";
}
.glyphicon-hand-right:before {
content: "\e127";
}
.glyphicon-hand-left:before {
content: "\e128";
}
.glyphicon-hand-up:before {
content: "\e129";
}
.glyphicon-hand-down:before {
content: "\e130";
}
.glyphicon-circle-arrow-right:before {
content: "\e131";
}
.glyphicon-circle-arrow-left:before {
content: "\e132";
}
.glyphicon-circle-arrow-up:before {
content: "\e133";
}
.glyphicon-circle-arrow-down:before {
content: "\e134";
}
.glyphicon-globe:before {
content: "\e135";
}
.glyphicon-wrench:before {
content: "\e136";
}
.glyphicon-tasks:before {
content: "\e137";
}
.glyphicon-filter:before {
content: "\e138";
}
.glyphicon-briefcase:before {
content: "\e139";
}
.glyphicon-fullscreen:before {
content: "\e140";
}
.glyphicon-dashboard:before {
content: "\e141";
}
.glyphicon-paperclip:before {
content: "\e142";
}
.glyphicon-heart-empty:before {
content: "\e143";
}
.glyphicon-link:before {
content: "\e144";
}
.glyphicon-phone:before {
content: "\e145";
}
.glyphicon-pushpin:before {
content: "\e146";
}
.glyphicon-usd:before {
content: "\e148";
}
.glyphicon-gbp:before {
content: "\e149";
}
.glyphicon-sort:before {
content: "\e150";
}
.glyphicon-sort-by-alphabet:before {
content: "\e151";
}
.glyphicon-sort-by-alphabet-alt:before {
content: "\e152";
}
.glyphicon-sort-by-order:before {
content: "\e153";
}
.glyphicon-sort-by-order-alt:before {
content: "\e154";
}
.glyphicon-sort-by-attributes:before {
content: "\e155";
}
.glyphicon-sort-by-attributes-alt:before {
content: "\e156";
}
.glyphicon-unchecked:before {
content: "\e157";
}
.glyphicon-expand:before {
content: "\e158";
}
.glyphicon-collapse-down:before {
content: "\e159";
}
.glyphicon-collapse-up:before {
content: "\e160";
}
.glyphicon-log-in:before {
content: "\e161";
}
.glyphicon-flash:before {
content: "\e162";
}
.glyphicon-log-out:before {
content: "\e163";
}
.glyphicon-new-window:before {
content: "\e164";
}
.glyphicon-record:before {
content: "\e165";
}
.glyphicon-save:before {
content: "\e166";
}
.glyphicon-open:before {
content: "\e167";
}
.glyphicon-saved:before {
content: "\e168";
}
.glyphicon-import:before {
content: "\e169";
}
.glyphicon-export:before {
content: "\e170";
}
.glyphicon-send:before {
content: "\e171";
}
.glyphicon-floppy-disk:before {
content: "\e172";
}
.glyphicon-floppy-saved:before {
content: "\e173";
}
.glyphicon-floppy-remove:before {
content: "\e174";
}
.glyphicon-floppy-save:before {
content: "\e175";
}
.glyphicon-floppy-open:before {
content: "\e176";
}
.glyphicon-credit-card:before {
content: "\e177";
}
.glyphicon-transfer:before {
content: "\e178";
}
.glyphicon-cutlery:before {
content: "\e179";
}
.glyphicon-header:before {
content: "\e180";
}
.glyphicon-compressed:before {
content: "\e181";
}
.glyphicon-earphone:before {
content: "\e182";
}
.glyphicon-phone-alt:before {
content: "\e183";
}
.glyphicon-tower:before {
content: "\e184";
}
.glyphicon-stats:before {
content: "\e185";
}
.glyphicon-sd-video:before {
content: "\e186";
}
.glyphicon-hd-video:before {
content: "\e187";
}
.glyphicon-subtitles:before {
content: "\e188";
}
.glyphicon-sound-stereo:before {
content: "\e189";
}
.glyphicon-sound-dolby:before {
content: "\e190";
}
.glyphicon-sound-5-1:before {
content: "\e191";
}
.glyphicon-sound-6-1:before {
content: "\e192";
}
.glyphicon-sound-7-1:before {
content: "\e193";
}
.glyphicon-copyright-mark:before {
content: "\e194";
}
.glyphicon-registration-mark:before {
content: "\e195";
}
.glyphicon-cloud-download:before {
content: "\e197";
}
.glyphicon-cloud-upload:before {
content: "\e198";
}
.glyphicon-tree-conifer:before {
content: "\e199";
}
.glyphicon-tree-deciduous:before {
content: "\e200";
}
.glyphicon-cd:before {
content: "\e201";
}
.glyphicon-save-file:before {
content: "\e202";
}
.glyphicon-open-file:before {
content: "\e203";
}
.glyphicon-level-up:before {
content: "\e204";
}
.glyphicon-copy:before {
content: "\e205";
}
.glyphicon-paste:before {
content: "\e206";
}
.glyphicon-alert:before {
content: "\e209";
}
.glyphicon-equalizer:before {
content: "\e210";
}
.glyphicon-king:before {
content: "\e211";
}
.glyphicon-queen:before {
content: "\e212";
}
.glyphicon-pawn:before {
content: "\e213";
}
.glyphicon-bishop:before {
content: "\e214";
}
.glyphicon-knight:before {
content: "\e215";
}
.glyphicon-baby-formula:before {
content: "\e216";
}
.glyphicon-tent:before {
content: "\26fa";
}
.glyphicon-blackboard:before {
content: "\e218";
}
.glyphicon-bed:before {
content: "\e219";
}
.glyphicon-apple:before {
content: "\f8ff";
}
.glyphicon-erase:before {
content: "\e221";
}
.glyphicon-hourglass:before {
content: "\231b";
}
.glyphicon-lamp:before {
content: "\e223";
}
.glyphicon-duplicate:before {
content: "\e224";
}
.glyphicon-piggy-bank:before {
content: "\e225";
}
.glyphicon-scissors:before {
content: "\e226";
}
.glyphicon-bitcoin:before {
content: "\e227";
}
.glyphicon-btc:before {
content: "\e227";
}
.glyphicon-xbt:before {
content: "\e227";
}
.glyphicon-yen:before {
content: "\00a5";
}
.glyphicon-jpy:before {
content: "\00a5";
}
.glyphicon-ruble:before {
content: "\20bd";
}
.glyphicon-rub:before {
content: "\20bd";
}
.glyphicon-scale:before {
content: "\e230";
}
.glyphicon-ice-lolly:before {
content: "\e231";
}
.glyphicon-ice-lolly-tasted:before {
content: "\e232";
}
.glyphicon-education:before {
content: "\e233";
}
.glyphicon-option-horizontal:before {
content: "\e234";
}
.glyphicon-option-vertical:before {
content: "\e235";
}
.glyphicon-menu-hamburger:before {
content: "\e236";
}
.glyphicon-modal-window:before {
content: "\e237";
}
.glyphicon-oil:before {
content: "\e238";
}
.glyphicon-grain:before {
content: "\e239";
}
.glyphicon-sunglasses:before {
content: "\e240";
}
.glyphicon-text-size:before {
content: "\e241";
}
.glyphicon-text-color:before {
content: "\e242";
}
.glyphicon-text-background:before {
content: "\e243";
}
.glyphicon-object-align-top:before {
content: "\e244";
}
.glyphicon-object-align-bottom:before {
content: "\e245";
}
.glyphicon-object-align-horizontal:before {
content: "\e246";
}
.glyphicon-object-align-left:before {
content: "\e247";
}
.glyphicon-object-align-vertical:before {
content: "\e248";
}
.glyphicon-object-align-right:before {
content: "\e249";
}
.glyphicon-triangle-right:before {
content: "\e250";
}
.glyphicon-triangle-left:before {
content: "\e251";
}
.glyphicon-triangle-bottom:before {
content: "\e252";
}
.glyphicon-triangle-top:before {
content: "\e253";
}
.glyphicon-console:before {
content: "\e254";
}
.glyphicon-superscript:before {
content: "\e255";
}
.glyphicon-subscript:before {
content: "\e256";
}
.glyphicon-menu-left:before {
content: "\e257";
}
.glyphicon-menu-right:before {
content: "\e258";
}
.glyphicon-menu-down:before {
content: "\e259";
}
.glyphicon-menu-up:before {
content: "\e260";
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
background-color: #fff;
}
input,
button,
select,
textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
a {
color: #337ab7;
text-decoration: none;
}
a:hover,
a:focus {
color: #23527c;
text-decoration: underline;
}
a:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
figure {
margin: 0;
}
img {
vertical-align: middle;
}
.img-responsive,
.thumbnail > img,
.thumbnail a > img,
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
display: block;
max-width: 100%;
height: auto;
}
.img-rounded {
border-radius: 6px;
}
.img-thumbnail {
display: inline-block;
max-width: 100%;
height: auto;
padding: 4px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.img-circle {
border-radius: 50%;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eee;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
[role="button"] {
cursor: pointer;
}
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
font-family: inherit;
font-weight: 500;
line-height: 1.1;
color: inherit;
}
h1 small,
h2 small,
h3 small,
h4 small,
h5 small,
h6 small,
.h1 small,
.h2 small,
.h3 small,
.h4 small,
.h5 small,
.h6 small,
h1 .small,
h2 .small,
h3 .small,
h4 .small,
h5 .small,
h6 .small,
.h1 .small,
.h2 .small,
.h3 .small,
.h4 .small,
.h5 .small,
.h6 .small {
font-weight: normal;
line-height: 1;
color: #777;
}
h1,
.h1,
h2,
.h2,
h3,
.h3 {
margin-top: 20px;
margin-bottom: 10px;
}
h1 small,
.h1 small,
h2 small,
.h2 small,
h3 small,
.h3 small,
h1 .small,
.h1 .small,
h2 .small,
.h2 .small,
h3 .small,
.h3 .small {
font-size: 65%;
}
h4,
.h4,
h5,
.h5,
h6,
.h6 {
margin-top: 10px;
margin-bottom: 10px;
}
h4 small,
.h4 small,
h5 small,
.h5 small,
h6 small,
.h6 small,
h4 .small,
.h4 .small,
h5 .small,
.h5 .small,
h6 .small,
.h6 .small {
font-size: 75%;
}
h1,
.h1 {
font-size: 36px;
}
h2,
.h2 {
font-size: 30px;
}
h3,
.h3 {
font-size: 24px;
}
h4,
.h4 {
font-size: 18px;
}
h5,
.h5 {
font-size: 14px;
}
h6,
.h6 {
font-size: 12px;
}
p {
margin: 0 0 10px;
}
.lead {
margin-bottom: 20px;
font-size: 16px;
font-weight: 300;
line-height: 1.4;
}
@media (min-width: 768px) {
.lead {
font-size: 21px;
}
}
small,
.small {
font-size: 85%;
}
mark,
.mark {
padding: .2em;
background-color: #fcf8e3;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.text-justify {
text-align: justify;
}
.text-nowrap {
white-space: nowrap;
}
.text-lowercase {
text-transform: lowercase;
}
.text-uppercase {
text-transform: uppercase;
}
.text-capitalize {
text-transform: capitalize;
}
.text-muted {
color: #777;
}
.text-primary {
color: #337ab7;
}
a.text-primary:hover,
a.text-primary:focus {
color: #286090;
}
.text-success {
color: #3c763d;
}
a.text-success:hover,
a.text-success:focus {
color: #2b542c;
}
.text-info {
color: #31708f;
}
a.text-info:hover,
a.text-info:focus {
color: #245269;
}
.text-warning {
color: #8a6d3b;
}
a.text-warning:hover,
a.text-warning:focus {
color: #66512c;
}
.text-danger {
color: #a94442;
}
a.text-danger:hover,
a.text-danger:focus {
color: #843534;
}
.bg-primary {
color: #fff;
background-color: #337ab7;
}
a.bg-primary:hover,
a.bg-primary:focus {
background-color: #286090;
}
.bg-success {
background-color: #dff0d8;
}
a.bg-success:hover,
a.bg-success:focus {
background-color: #c1e2b3;
}
.bg-info {
background-color: #d9edf7;
}
a.bg-info:hover,
a.bg-info:focus {
background-color: #afd9ee;
}
.bg-warning {
background-color: #fcf8e3;
}
a.bg-warning:hover,
a.bg-warning:focus {
background-color: #f7ecb5;
}
.bg-danger {
background-color: #f2dede;
}
a.bg-danger:hover,
a.bg-danger:focus {
background-color: #e4b9b9;
}
.page-header {
padding-bottom: 9px;
margin: 40px 0 20px;
border-bottom: 1px solid #eee;
}
ul,
ol {
margin-top: 0;
margin-bottom: 10px;
}
ul ul,
ol ul,
ul ol,
ol ol {
margin-bottom: 0;
}
.list-unstyled {
padding-left: 0;
list-style: none;
}
.list-inline {
padding-left: 0;
margin-left: -5px;
list-style: none;
}
.list-inline > li {
display: inline-block;
padding-right: 5px;
padding-left: 5px;
}
dl {
margin-top: 0;
margin-bottom: 20px;
}
dt,
dd {
line-height: 1.42857143;
}
dt {
font-weight: bold;
}
dd {
margin-left: 0;
}
@media (min-width: 768px) {
.dl-horizontal dt {
float: left;
width: 160px;
overflow: hidden;
clear: left;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
}
.dl-horizontal dd {
margin-left: 180px;
}
}
abbr[title],
abbr[data-original-title] {
cursor: help;
border-bottom: 1px dotted #777;
}
.initialism {
font-size: 90%;
text-transform: uppercase;
}
blockquote {
padding: 10px 20px;
margin: 0 0 20px;
font-size: 17.5px;
border-left: 5px solid #eee;
}
blockquote p:last-child,
blockquote ul:last-child,
blockquote ol:last-child {
margin-bottom: 0;
}
blockquote footer,
blockquote small,
blockquote .small {
display: block;
font-size: 80%;
line-height: 1.42857143;
color: #777;
}
blockquote footer:before,
blockquote small:before,
blockquote .small:before {
content: '\2014 \00A0';
}
.blockquote-reverse,
blockquote.pull-right {
padding-right: 15px;
padding-left: 0;
text-align: right;
border-right: 5px solid #eee;
border-left: 0;
}
.blockquote-reverse footer:before,
blockquote.pull-right footer:before,
.blockquote-reverse small:before,
blockquote.pull-right small:before,
.blockquote-reverse .small:before,
blockquote.pull-right .small:before {
content: '';
}
.blockquote-reverse footer:after,
blockquote.pull-right footer:after,
.blockquote-reverse small:after,
blockquote.pull-right small:after,
.blockquote-reverse .small:after,
blockquote.pull-right .small:after {
content: '\00A0 \2014';
}
address {
margin-bottom: 20px;
font-style: normal;
line-height: 1.42857143;
}
code,
kbd,
pre,
samp {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
code {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
background-color: #f9f2f4;
border-radius: 4px;
}
kbd {
padding: 2px 4px;
font-size: 90%;
color: #fff;
background-color: #333;
border-radius: 3px;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);
}
kbd kbd {
padding: 0;
font-size: 100%;
font-weight: bold;
-webkit-box-shadow: none;
box-shadow: none;
}
pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
pre code {
padding: 0;
font-size: inherit;
color: inherit;
white-space: pre-wrap;
background-color: transparent;
border-radius: 0;
}
.pre-scrollable {
max-height: 340px;
overflow-y: scroll;
}
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 768px) {
.container {
width: 750px;
}
}
@media (min-width: 992px) {
.container {
width: 970px;
}
}
@media (min-width: 1200px) {
.container {
width: 1170px;
}
}
.container-fluid {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.row {
margin-right: -15px;
margin-left: -15px;
}
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
}
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
float: left;
}
.col-xs-12 {
width: 100%;
}
.col-xs-11 {
width: 91.66666667%;
}
.col-xs-10 {
width: 83.33333333%;
}
.col-xs-9 {
width: 75%;
}
.col-xs-8 {
width: 66.66666667%;
}
.col-xs-7 {
width: 58.33333333%;
}
.col-xs-6 {
width: 50%;
}
.col-xs-5 {
width: 41.66666667%;
}
.col-xs-4 {
width: 33.33333333%;
}
.col-xs-3 {
width: 25%;
}
.col-xs-2 {
width: 16.66666667%;
}
.col-xs-1 {
width: 8.33333333%;
}
.col-xs-pull-12 {
right: 100%;
}
.col-xs-pull-11 {
right: 91.66666667%;
}
.col-xs-pull-10 {
right: 83.33333333%;
}
.col-xs-pull-9 {
right: 75%;
}
.col-xs-pull-8 {
right: 66.66666667%;
}
.col-xs-pull-7 {
right: 58.33333333%;
}
.col-xs-pull-6 {
right: 50%;
}
.col-xs-pull-5 {
right: 41.66666667%;
}
.col-xs-pull-4 {
right: 33.33333333%;
}
.col-xs-pull-3 {
right: 25%;
}
.col-xs-pull-2 {
right: 16.66666667%;
}
.col-xs-pull-1 {
right: 8.33333333%;
}
.col-xs-pull-0 {
right: auto;
}
.col-xs-push-12 {
left: 100%;
}
.col-xs-push-11 {
left: 91.66666667%;
}
.col-xs-push-10 {
left: 83.33333333%;
}
.col-xs-push-9 {
left: 75%;
}
.col-xs-push-8 {
left: 66.66666667%;
}
.col-xs-push-7 {
left: 58.33333333%;
}
.col-xs-push-6 {
left: 50%;
}
.col-xs-push-5 {
left: 41.66666667%;
}
.col-xs-push-4 {
left: 33.33333333%;
}
.col-xs-push-3 {
left: 25%;
}
.col-xs-push-2 {
left: 16.66666667%;
}
.col-xs-push-1 {
left: 8.33333333%;
}
.col-xs-push-0 {
left: auto;
}
.col-xs-offset-12 {
margin-left: 100%;
}
.col-xs-offset-11 {
margin-left: 91.66666667%;
}
.col-xs-offset-10 {
margin-left: 83.33333333%;
}
.col-xs-offset-9 {
margin-left: 75%;
}
.col-xs-offset-8 {
margin-left: 66.66666667%;
}
.col-xs-offset-7 {
margin-left: 58.33333333%;
}
.col-xs-offset-6 {
margin-left: 50%;
}
.col-xs-offset-5 {
margin-left: 41.66666667%;
}
.col-xs-offset-4 {
margin-left: 33.33333333%;
}
.col-xs-offset-3 {
margin-left: 25%;
}
.col-xs-offset-2 {
margin-left: 16.66666667%;
}
.col-xs-offset-1 {
margin-left: 8.33333333%;
}
.col-xs-offset-0 {
margin-left: 0;
}
@media (min-width: 768px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left;
}
.col-sm-12 {
width: 100%;
}
.col-sm-11 {
width: 91.66666667%;
}
.col-sm-10 {
width: 83.33333333%;
}
.col-sm-9 {
width: 75%;
}
.col-sm-8 {
width: 66.66666667%;
}
.col-sm-7 {
width: 58.33333333%;
}
.col-sm-6 {
width: 50%;
}
.col-sm-5 {
width: 41.66666667%;
}
.col-sm-4 {
width: 33.33333333%;
}
.col-sm-3 {
width: 25%;
}
.col-sm-2 {
width: 16.66666667%;
}
.col-sm-1 {
width: 8.33333333%;
}
.col-sm-pull-12 {
right: 100%;
}
.col-sm-pull-11 {
right: 91.66666667%;
}
.col-sm-pull-10 {
right: 83.33333333%;
}
.col-sm-pull-9 {
right: 75%;
}
.col-sm-pull-8 {
right: 66.66666667%;
}
.col-sm-pull-7 {
right: 58.33333333%;
}
.col-sm-pull-6 {
right: 50%;
}
.col-sm-pull-5 {
right: 41.66666667%;
}
.col-sm-pull-4 {
right: 33.33333333%;
}
.col-sm-pull-3 {
right: 25%;
}
.col-sm-pull-2 {
right: 16.66666667%;
}
.col-sm-pull-1 {
right: 8.33333333%;
}
.col-sm-pull-0 {
right: auto;
}
.col-sm-push-12 {
left: 100%;
}
.col-sm-push-11 {
left: 91.66666667%;
}
.col-sm-push-10 {
left: 83.33333333%;
}
.col-sm-push-9 {
left: 75%;
}
.col-sm-push-8 {
left: 66.66666667%;
}
.col-sm-push-7 {
left: 58.33333333%;
}
.col-sm-push-6 {
left: 50%;
}
.col-sm-push-5 {
left: 41.66666667%;
}
.col-sm-push-4 {
left: 33.33333333%;
}
.col-sm-push-3 {
left: 25%;
}
.col-sm-push-2 {
left: 16.66666667%;
}
.col-sm-push-1 {
left: 8.33333333%;
}
.col-sm-push-0 {
left: auto;
}
.col-sm-offset-12 {
margin-left: 100%;
}
.col-sm-offset-11 {
margin-left: 91.66666667%;
}
.col-sm-offset-10 {
margin-left: 83.33333333%;
}
.col-sm-offset-9 {
margin-left: 75%;
}
.col-sm-offset-8 {
margin-left: 66.66666667%;
}
.col-sm-offset-7 {
margin-left: 58.33333333%;
}
.col-sm-offset-6 {
margin-left: 50%;
}
.col-sm-offset-5 {
margin-left: 41.66666667%;
}
.col-sm-offset-4 {
margin-left: 33.33333333%;
}
.col-sm-offset-3 {
margin-left: 25%;
}
.col-sm-offset-2 {
margin-left: 16.66666667%;
}
.col-sm-offset-1 {
margin-left: 8.33333333%;
}
.col-sm-offset-0 {
margin-left: 0;
}
}
@media (min-width: 992px) {
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left;
}
.col-md-12 {
width: 100%;
}
.col-md-11 {
width: 91.66666667%;
}
.col-md-10 {
width: 83.33333333%;
}
.col-md-9 {
width: 75%;
}
.col-md-8 {
width: 66.66666667%;
}
.col-md-7 {
width: 58.33333333%;
}
.col-md-6 {
width: 50%;
}
.col-md-5 {
width: 41.66666667%;
}
.col-md-4 {
width: 33.33333333%;
}
.col-md-3 {
width: 25%;
}
.col-md-2 {
width: 16.66666667%;
}
.col-md-1 {
width: 8.33333333%;
}
.col-md-pull-12 {
right: 100%;
}
.col-md-pull-11 {
right: 91.66666667%;
}
.col-md-pull-10 {
right: 83.33333333%;
}
.col-md-pull-9 {
right: 75%;
}
.col-md-pull-8 {
right: 66.66666667%;
}
.col-md-pull-7 {
right: 58.33333333%;
}
.col-md-pull-6 {
right: 50%;
}
.col-md-pull-5 {
right: 41.66666667%;
}
.col-md-pull-4 {
right: 33.33333333%;
}
.col-md-pull-3 {
right: 25%;
}
.col-md-pull-2 {
right: 16.66666667%;
}
.col-md-pull-1 {
right: 8.33333333%;
}
.col-md-pull-0 {
right: auto;
}
.col-md-push-12 {
left: 100%;
}
.col-md-push-11 {
left: 91.66666667%;
}
.col-md-push-10 {
left: 83.33333333%;
}
.col-md-push-9 {
left: 75%;
}
.col-md-push-8 {
left: 66.66666667%;
}
.col-md-push-7 {
left: 58.33333333%;
}
.col-md-push-6 {
left: 50%;
}
.col-md-push-5 {
left: 41.66666667%;
}
.col-md-push-4 {
left: 33.33333333%;
}
.col-md-push-3 {
left: 25%;
}
.col-md-push-2 {
left: 16.66666667%;
}
.col-md-push-1 {
left: 8.33333333%;
}
.col-md-push-0 {
left: auto;
}
.col-md-offset-12 {
margin-left: 100%;
}
.col-md-offset-11 {
margin-left: 91.66666667%;
}
.col-md-offset-10 {
margin-left: 83.33333333%;
}
.col-md-offset-9 {
margin-left: 75%;
}
.col-md-offset-8 {
margin-left: 66.66666667%;
}
.col-md-offset-7 {
margin-left: 58.33333333%;
}
.col-md-offset-6 {
margin-left: 50%;
}
.col-md-offset-5 {
margin-left: 41.66666667%;
}
.col-md-offset-4 {
margin-left: 33.33333333%;
}
.col-md-offset-3 {
margin-left: 25%;
}
.col-md-offset-2 {
margin-left: 16.66666667%;
}
.col-md-offset-1 {
margin-left: 8.33333333%;
}
.col-md-offset-0 {
margin-left: 0;
}
}
@media (min-width: 1200px) {
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
float: left;
}
.col-lg-12 {
width: 100%;
}
.col-lg-11 {
width: 91.66666667%;
}
.col-lg-10 {
width: 83.33333333%;
}
.col-lg-9 {
width: 75%;
}
.col-lg-8 {
width: 66.66666667%;
}
.col-lg-7 {
width: 58.33333333%;
}
.col-lg-6 {
width: 50%;
}
.col-lg-5 {
width: 41.66666667%;
}
.col-lg-4 {
width: 33.33333333%;
}
.col-lg-3 {
width: 25%;
}
.col-lg-2 {
width: 16.66666667%;
}
.col-lg-1 {
width: 8.33333333%;
}
.col-lg-pull-12 {
right: 100%;
}
.col-lg-pull-11 {
right: 91.66666667%;
}
.col-lg-pull-10 {
right: 83.33333333%;
}
.col-lg-pull-9 {
right: 75%;
}
.col-lg-pull-8 {
right: 66.66666667%;
}
.col-lg-pull-7 {
right: 58.33333333%;
}
.col-lg-pull-6 {
right: 50%;
}
.col-lg-pull-5 {
right: 41.66666667%;
}
.col-lg-pull-4 {
right: 33.33333333%;
}
.col-lg-pull-3 {
right: 25%;
}
.col-lg-pull-2 {
right: 16.66666667%;
}
.col-lg-pull-1 {
right: 8.33333333%;
}
.col-lg-pull-0 {
right: auto;
}
.col-lg-push-12 {
left: 100%;
}
.col-lg-push-11 {
left: 91.66666667%;
}
.col-lg-push-10 {
left: 83.33333333%;
}
.col-lg-push-9 {
left: 75%;
}
.col-lg-push-8 {
left: 66.66666667%;
}
.col-lg-push-7 {
left: 58.33333333%;
}
.col-lg-push-6 {
left: 50%;
}
.col-lg-push-5 {
left: 41.66666667%;
}
.col-lg-push-4 {
left: 33.33333333%;
}
.col-lg-push-3 {
left: 25%;
}
.col-lg-push-2 {
left: 16.66666667%;
}
.col-lg-push-1 {
left: 8.33333333%;
}
.col-lg-push-0 {
left: auto;
}
.col-lg-offset-12 {
margin-left: 100%;
}
.col-lg-offset-11 {
margin-left: 91.66666667%;
}
.col-lg-offset-10 {
margin-left: 83.33333333%;
}
.col-lg-offset-9 {
margin-left: 75%;
}
.col-lg-offset-8 {
margin-left: 66.66666667%;
}
.col-lg-offset-7 {
margin-left: 58.33333333%;
}
.col-lg-offset-6 {
margin-left: 50%;
}
.col-lg-offset-5 {
margin-left: 41.66666667%;
}
.col-lg-offset-4 {
margin-left: 33.33333333%;
}
.col-lg-offset-3 {
margin-left: 25%;
}
.col-lg-offset-2 {
margin-left: 16.66666667%;
}
.col-lg-offset-1 {
margin-left: 8.33333333%;
}
.col-lg-offset-0 {
margin-left: 0;
}
}
table {
background-color: transparent;
}
caption {
padding-top: 8px;
padding-bottom: 8px;
color: #777;
text-align: left;
}
th {
text-align: left;
}
.table {
width: 100%;
max-width: 100%;
margin-bottom: 20px;
}
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 8px;
line-height: 1.42857143;
vertical-align: top;
border-top: 1px solid #ddd;
}
.table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #ddd;
}
.table > caption + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > th,
.table > thead:first-child > tr:first-child > th,
.table > caption + thead > tr:first-child > td,
.table > colgroup + thead > tr:first-child > td,
.table > thead:first-child > tr:first-child > td {
border-top: 0;
}
.table > tbody + tbody {
border-top: 2px solid #ddd;
}
.table .table {
background-color: #fff;
}
.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
padding: 5px;
}
.table-bordered {
border: 1px solid #ddd;
}
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td {
border: 1px solid #ddd;
}
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td {
border-bottom-width: 2px;
}
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: #f9f9f9;
}
.table-hover > tbody > tr:hover {
background-color: #f5f5f5;
}
table col[class*="col-"] {
position: static;
display: table-column;
float: none;
}
table td[class*="col-"],
table th[class*="col-"] {
position: static;
display: table-cell;
float: none;
}
.table > thead > tr > td.active,
.table > tbody > tr > td.active,
.table > tfoot > tr > td.active,
.table > thead > tr > th.active,
.table > tbody > tr > th.active,
.table > tfoot > tr > th.active,
.table > thead > tr.active > td,
.table > tbody > tr.active > td,
.table > tfoot > tr.active > td,
.table > thead > tr.active > th,
.table > tbody > tr.active > th,
.table > tfoot > tr.active > th {
background-color: #f5f5f5;
}
.table-hover > tbody > tr > td.active:hover,
.table-hover > tbody > tr > th.active:hover,
.table-hover > tbody > tr.active:hover > td,
.table-hover > tbody > tr:hover > .active,
.table-hover > tbody > tr.active:hover > th {
background-color: #e8e8e8;
}
.table > thead > tr > td.success,
.table > tbody > tr > td.success,
.table > tfoot > tr > td.success,
.table > thead > tr > th.success,
.table > tbody > tr > th.success,
.table > tfoot > tr > th.success,
.table > thead > tr.success > td,
.table > tbody > tr.success > td,
.table > tfoot > tr.success > td,
.table > thead > tr.success > th,
.table > tbody > tr.success > th,
.table > tfoot > tr.success > th {
background-color: #dff0d8;
}
.table-hover > tbody > tr > td.success:hover,
.table-hover > tbody > tr > th.success:hover,
.table-hover > tbody > tr.success:hover > td,
.table-hover > tbody > tr:hover > .success,
.table-hover > tbody > tr.success:hover > th {
background-color: #d0e9c6;
}
.table > thead > tr > td.info,
.table > tbody > tr > td.info,
.table > tfoot > tr > td.info,
.table > thead > tr > th.info,
.table > tbody > tr > th.info,
.table > tfoot > tr > th.info,
.table > thead > tr.info > td,
.table > tbody > tr.info > td,
.table > tfoot > tr.info > td,
.table > thead > tr.info > th,
.table > tbody > tr.info > th,
.table > tfoot > tr.info > th {
background-color: #d9edf7;
}
.table-hover > tbody > tr > td.info:hover,
.table-hover > tbody > tr > th.info:hover,
.table-hover > tbody > tr.info:hover > td,
.table-hover > tbody > tr:hover > .info,
.table-hover > tbody > tr.info:hover > th {
background-color: #c4e3f3;
}
.table > thead > tr > td.warning,
.table > tbody > tr > td.warning,
.table > tfoot > tr > td.warning,
.table > thead > tr > th.warning,
.table > tbody > tr > th.warning,
.table > tfoot > tr > th.warning,
.table > thead > tr.warning > td,
.table > tbody > tr.warning > td,
.table > tfoot > tr.warning > td,
.table > thead > tr.warning > th,
.table > tbody > tr.warning > th,
.table > tfoot > tr.warning > th {
background-color: #fcf8e3;
}
.table-hover > tbody > tr > td.warning:hover,
.table-hover > tbody > tr > th.warning:hover,
.table-hover > tbody > tr.warning:hover > td,
.table-hover > tbody > tr:hover > .warning,
.table-hover > tbody > tr.warning:hover > th {
background-color: #faf2cc;
}
.table > thead > tr > td.danger,
.table > tbody > tr > td.danger,
.table > tfoot > tr > td.danger,
.table > thead > tr > th.danger,
.table > tbody > tr > th.danger,
.table > tfoot > tr > th.danger,
.table > thead > tr.danger > td,
.table > tbody > tr.danger > td,
.table > tfoot > tr.danger > td,
.table > thead > tr.danger > th,
.table > tbody > tr.danger > th,
.table > tfoot > tr.danger > th {
background-color: #f2dede;
}
.table-hover > tbody > tr > td.danger:hover,
.table-hover > tbody > tr > th.danger:hover,
.table-hover > tbody > tr.danger:hover > td,
.table-hover > tbody > tr:hover > .danger,
.table-hover > tbody > tr.danger:hover > th {
background-color: #ebcccc;
}
.table-responsive {
min-height: .01%;
overflow-x: auto;
}
@media screen and (max-width: 767px) {
.table-responsive {
width: 100%;
margin-bottom: 15px;
overflow-y: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #ddd;
}
.table-responsive > .table {
margin-bottom: 0;
}
.table-responsive > .table > thead > tr > th,
.table-responsive > .table > tbody > tr > th,
.table-responsive > .table > tfoot > tr > th,
.table-responsive > .table > thead > tr > td,
.table-responsive > .table > tbody > tr > td,
.table-responsive > .table > tfoot > tr > td {
white-space: nowrap;
}
.table-responsive > .table-bordered {
border: 0;
}
.table-responsive > .table-bordered > thead > tr > th:first-child,
.table-responsive > .table-bordered > tbody > tr > th:first-child,
.table-responsive > .table-bordered > tfoot > tr > th:first-child,
.table-responsive > .table-bordered > thead > tr > td:first-child,
.table-responsive > .table-bordered > tbody > tr > td:first-child,
.table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.table-responsive > .table-bordered > thead > tr > th:last-child,
.table-responsive > .table-bordered > tbody > tr > th:last-child,
.table-responsive > .table-bordered > tfoot > tr > th:last-child,
.table-responsive > .table-bordered > thead > tr > td:last-child,
.table-responsive > .table-bordered > tbody > tr > td:last-child,
.table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.table-responsive > .table-bordered > tbody > tr:last-child > th,
.table-responsive > .table-bordered > tfoot > tr:last-child > th,
.table-responsive > .table-bordered > tbody > tr:last-child > td,
.table-responsive > .table-bordered > tfoot > tr:last-child > td {
border-bottom: 0;
}
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: 20px;
font-size: 21px;
line-height: inherit;
color: #333;
border: 0;
border-bottom: 1px solid #e5e5e5;
}
label {
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
font-weight: bold;
}
input[type="search"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
input[type="radio"],
input[type="checkbox"] {
margin: 4px 0 0;
margin-top: 1px \9;
line-height: normal;
}
input[type="file"] {
display: block;
}
input[type="range"] {
display: block;
width: 100%;
}
select[multiple],
select[size] {
height: auto;
}
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
output {
display: block;
padding-top: 7px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
}
.form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
}
.form-control::-moz-placeholder {
color: #999;
opacity: 1;
}
.form-control:-ms-input-placeholder {
color: #999;
}
.form-control::-webkit-input-placeholder {
color: #999;
}
.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
background-color: #eee;
opacity: 1;
}
.form-control[disabled],
fieldset[disabled] .form-control {
cursor: not-allowed;
}
textarea.form-control {
height: auto;
}
input[type="search"] {
-webkit-appearance: none;
}
@media screen and (-webkit-min-device-pixel-ratio: 0) {
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control,
input[type="month"].form-control {
line-height: 34px;
}
input[type="date"].input-sm,
input[type="time"].input-sm,
input[type="datetime-local"].input-sm,
input[type="month"].input-sm,
.input-group-sm input[type="date"],
.input-group-sm input[type="time"],
.input-group-sm input[type="datetime-local"],
.input-group-sm input[type="month"] {
line-height: 30px;
}
input[type="date"].input-lg,
input[type="time"].input-lg,
input[type="datetime-local"].input-lg,
input[type="month"].input-lg,
.input-group-lg input[type="date"],
.input-group-lg input[type="time"],
.input-group-lg input[type="datetime-local"],
.input-group-lg input[type="month"] {
line-height: 46px;
}
}
.form-group {
margin-bottom: 15px;
}
.radio,
.checkbox {
position: relative;
display: block;
margin-top: 10px;
margin-bottom: 10px;
}
.radio label,
.checkbox label {
min-height: 20px;
padding-left: 20px;
margin-bottom: 0;
font-weight: normal;
cursor: pointer;
}
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
position: absolute;
margin-top: 4px \9;
margin-left: -20px;
}
.radio + .radio,
.checkbox + .checkbox {
margin-top: -5px;
}
.radio-inline,
.checkbox-inline {
position: relative;
display: inline-block;
padding-left: 20px;
margin-bottom: 0;
font-weight: normal;
vertical-align: middle;
cursor: pointer;
}
.radio-inline + .radio-inline,
.checkbox-inline + .checkbox-inline {
margin-top: 0;
margin-left: 10px;
}
input[type="radio"][disabled],
input[type="checkbox"][disabled],
input[type="radio"].disabled,
input[type="checkbox"].disabled,
fieldset[disabled] input[type="radio"],
fieldset[disabled] input[type="checkbox"] {
cursor: not-allowed;
}
.radio-inline.disabled,
.checkbox-inline.disabled,
fieldset[disabled] .radio-inline,
fieldset[disabled] .checkbox-inline {
cursor: not-allowed;
}
.radio.disabled label,
.checkbox.disabled label,
fieldset[disabled] .radio label,
fieldset[disabled] .checkbox label {
cursor: not-allowed;
}
.form-control-static {
min-height: 34px;
padding-top: 7px;
padding-bottom: 7px;
margin-bottom: 0;
}
.form-control-static.input-lg,
.form-control-static.input-sm {
padding-right: 0;
padding-left: 0;
}
.input-sm {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
select.input-sm {
height: 30px;
line-height: 30px;
}
textarea.input-sm,
select[multiple].input-sm {
height: auto;
}
.form-group-sm .form-control {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.form-group-sm select.form-control {
height: 30px;
line-height: 30px;
}
.form-group-sm textarea.form-control,
.form-group-sm select[multiple].form-control {
height: auto;
}
.form-group-sm .form-control-static {
height: 30px;
min-height: 32px;
padding: 6px 10px;
font-size: 12px;
line-height: 1.5;
}
.input-lg {
height: 46px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
select.input-lg {
height: 46px;
line-height: 46px;
}
textarea.input-lg,
select[multiple].input-lg {
height: auto;
}
.form-group-lg .form-control {
height: 46px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
.form-group-lg select.form-control {
height: 46px;
line-height: 46px;
}
.form-group-lg textarea.form-control,
.form-group-lg select[multiple].form-control {
height: auto;
}
.form-group-lg .form-control-static {
height: 46px;
min-height: 38px;
padding: 11px 16px;
font-size: 18px;
line-height: 1.3333333;
}
.has-feedback {
position: relative;
}
.has-feedback .form-control {
padding-right: 42.5px;
}
.form-control-feedback {
position: absolute;
top: 0;
right: 0;
z-index: 2;
display: block;
width: 34px;
height: 34px;
line-height: 34px;
text-align: center;
pointer-events: none;
}
.input-lg + .form-control-feedback,
.input-group-lg + .form-control-feedback,
.form-group-lg .form-control + .form-control-feedback {
width: 46px;
height: 46px;
line-height: 46px;
}
.input-sm + .form-control-feedback,
.input-group-sm + .form-control-feedback,
.form-group-sm .form-control + .form-control-feedback {
width: 30px;
height: 30px;
line-height: 30px;
}
.has-success .help-block,
.has-success .control-label,
.has-success .radio,
.has-success .checkbox,
.has-success .radio-inline,
.has-success .checkbox-inline,
.has-success.radio label,
.has-success.checkbox label,
.has-success.radio-inline label,
.has-success.checkbox-inline label {
color: #3c763d;
}
.has-success .form-control {
border-color: #3c763d;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}
.has-success .form-control:focus {
border-color: #2b542c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;
}
.has-success .input-group-addon {
color: #3c763d;
background-color: #dff0d8;
border-color: #3c763d;
}
.has-success .form-control-feedback {
color: #3c763d;
}
.has-warning .help-block,
.has-warning .control-label,
.has-warning .radio,
.has-warning .checkbox,
.has-warning .radio-inline,
.has-warning .checkbox-inline,
.has-warning.radio label,
.has-warning.checkbox label,
.has-warning.radio-inline label,
.has-warning.checkbox-inline label {
color: #8a6d3b;
}
.has-warning .form-control {
border-color: #8a6d3b;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}
.has-warning .form-control:focus {
border-color: #66512c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;
}
.has-warning .input-group-addon {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #8a6d3b;
}
.has-warning .form-control-feedback {
color: #8a6d3b;
}
.has-error .help-block,
.has-error .control-label,
.has-error .radio,
.has-error .checkbox,
.has-error .radio-inline,
.has-error .checkbox-inline,
.has-error.radio label,
.has-error.checkbox label,
.has-error.radio-inline label,
.has-error.checkbox-inline label {
color: #a94442;
}
.has-error .form-control {
border-color: #a94442;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}
.has-error .form-control:focus {
border-color: #843534;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;
}
.has-error .input-group-addon {
color: #a94442;
background-color: #f2dede;
border-color: #a94442;
}
.has-error .form-control-feedback {
color: #a94442;
}
.has-feedback label ~ .form-control-feedback {
top: 25px;
}
.has-feedback label.sr-only ~ .form-control-feedback {
top: 0;
}
.help-block {
display: block;
margin-top: 5px;
margin-bottom: 10px;
color: #737373;
}
@media (min-width: 768px) {
.form-inline .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .form-control {
display: inline-block;
width: auto;
vertical-align: middle;
}
.form-inline .form-control-static {
display: inline-block;
}
.form-inline .input-group {
display: inline-table;
vertical-align: middle;
}
.form-inline .input-group .input-group-addon,
.form-inline .input-group .input-group-btn,
.form-inline .input-group .form-control {
width: auto;
}
.form-inline .input-group > .form-control {
width: 100%;
}
.form-inline .control-label {
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .radio,
.form-inline .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .radio label,
.form-inline .checkbox label {
padding-left: 0;
}
.form-inline .radio input[type="radio"],
.form-inline .checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
.form-inline .has-feedback .form-control-feedback {
top: 0;
}
}
.form-horizontal .radio,
.form-horizontal .checkbox,
.form-horizontal .radio-inline,
.form-horizontal .checkbox-inline {
padding-top: 7px;
margin-top: 0;
margin-bottom: 0;
}
.form-horizontal .radio,
.form-horizontal .checkbox {
min-height: 27px;
}
.form-horizontal .form-group {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
.form-horizontal .control-label {
padding-top: 7px;
margin-bottom: 0;
text-align: right;
}
}
.form-horizontal .has-feedback .form-control-feedback {
right: 15px;
}
@media (min-width: 768px) {
.form-horizontal .form-group-lg .control-label {
padding-top: 14.333333px;
font-size: 18px;
}
}
@media (min-width: 768px) {
.form-horizontal .form-group-sm .control-label {
padding-top: 6px;
font-size: 12px;
}
}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.btn:hover,
.btn:focus,
.btn.focus {
color: #333;
text-decoration: none;
}
.btn:active,
.btn.active {
background-image: none;
outline: 0;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn {
cursor: not-allowed;
filter: alpha(opacity=65);
-webkit-box-shadow: none;
box-shadow: none;
opacity: .65;
}
a.btn.disabled,
fieldset[disabled] a.btn {
pointer-events: none;
}
.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc;
}
.btn-default:focus,
.btn-default.focus {
color: #333;
background-color: #e6e6e6;
border-color: #8c8c8c;
}
.btn-default:hover {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.btn-default:active:hover,
.btn-default.active:hover,
.open > .dropdown-toggle.btn-default:hover,
.btn-default:active:focus,
.btn-default.active:focus,
.open > .dropdown-toggle.btn-default:focus,
.btn-default:active.focus,
.btn-default.active.focus,
.open > .dropdown-toggle.btn-default.focus {
color: #333;
background-color: #d4d4d4;
border-color: #8c8c8c;
}
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
background-image: none;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
background-color: #fff;
border-color: #ccc;
}
.btn-default .badge {
color: #fff;
background-color: #333;
}
.btn-primary {
color: #fff;
background-color: #337ab7;
border-color: #2e6da4;
}
.btn-primary:focus,
.btn-primary.focus {
color: #fff;
background-color: #286090;
border-color: #122b40;
}
.btn-primary:hover {
color: #fff;
background-color: #286090;
border-color: #204d74;
}
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
color: #fff;
background-color: #286090;
border-color: #204d74;
}
.btn-primary:active:hover,
.btn-primary.active:hover,
.open > .dropdown-toggle.btn-primary:hover,
.btn-primary:active:focus,
.btn-primary.active:focus,
.open > .dropdown-toggle.btn-primary:focus,
.btn-primary:active.focus,
.btn-primary.active.focus,
.open > .dropdown-toggle.btn-primary.focus {
color: #fff;
background-color: #204d74;
border-color: #122b40;
}
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
background-image: none;
}
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
background-color: #337ab7;
border-color: #2e6da4;
}
.btn-primary .badge {
color: #337ab7;
background-color: #fff;
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
.btn-success:focus,
.btn-success.focus {
color: #fff;
background-color: #449d44;
border-color: #255625;
}
.btn-success:hover {
color: #fff;
background-color: #449d44;
border-color: #398439;
}
.btn-success:active,
.btn-success.active,
.open > .dropdown-toggle.btn-success {
color: #fff;
background-color: #449d44;
border-color: #398439;
}
.btn-success:active:hover,
.btn-success.active:hover,
.open > .dropdown-toggle.btn-success:hover,
.btn-success:active:focus,
.btn-success.active:focus,
.open > .dropdown-toggle.btn-success:focus,
.btn-success:active.focus,
.btn-success.active.focus,
.open > .dropdown-toggle.btn-success.focus {
color: #fff;
background-color: #398439;
border-color: #255625;
}
.btn-success:active,
.btn-success.active,
.open > .dropdown-toggle.btn-success {
background-image: none;
}
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled.focus,
.btn-success[disabled].focus,
fieldset[disabled] .btn-success.focus,
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
background-color: #5cb85c;
border-color: #4cae4c;
}
.btn-success .badge {
color: #5cb85c;
background-color: #fff;
}
.btn-info {
color: #fff;
background-color: #5bc0de;
border-color: #46b8da;
}
.btn-info:focus,
.btn-info.focus {
color: #fff;
background-color: #31b0d5;
border-color: #1b6d85;
}
.btn-info:hover {
color: #fff;
background-color: #31b0d5;
border-color: #269abc;
}
.btn-info:active,
.btn-info.active,
.open > .dropdown-toggle.btn-info {
color: #fff;
background-color: #31b0d5;
border-color: #269abc;
}
.btn-info:active:hover,
.btn-info.active:hover,
.open > .dropdown-toggle.btn-info:hover,
.btn-info:active:focus,
.btn-info.active:focus,
.open > .dropdown-toggle.btn-info:focus,
.btn-info:active.focus,
.btn-info.active.focus,
.open > .dropdown-toggle.btn-info.focus {
color: #fff;
background-color: #269abc;
border-color: #1b6d85;
}
.btn-info:active,
.btn-info.active,
.open > .dropdown-toggle.btn-info {
background-image: none;
}
.btn-info.disabled,
.btn-info[disabled],
fieldset[disabled] .btn-info,
.btn-info.disabled:hover,
.btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover,
.btn-info.disabled:focus,
.btn-info[disabled]:focus,
fieldset[disabled] .btn-info:focus,
.btn-info.disabled.focus,
.btn-info[disabled].focus,
fieldset[disabled] .btn-info.focus,
.btn-info.disabled:active,
.btn-info[disabled]:active,
fieldset[disabled] .btn-info:active,
.btn-info.disabled.active,
.btn-info[disabled].active,
fieldset[disabled] .btn-info.active {
background-color: #5bc0de;
border-color: #46b8da;
}
.btn-info .badge {
color: #5bc0de;
background-color: #fff;
}
.btn-warning {
color: #fff;
background-color: #f0ad4e;
border-color: #eea236;
}
.btn-warning:focus,
.btn-warning.focus {
color: #fff;
background-color: #ec971f;
border-color: #985f0d;
}
.btn-warning:hover {
color: #fff;
background-color: #ec971f;
border-color: #d58512;
}
.btn-warning:active,
.btn-warning.active,
.open > .dropdown-toggle.btn-warning {
color: #fff;
background-color: #ec971f;
border-color: #d58512;
}
.btn-warning:active:hover,
.btn-warning.active:hover,
.open > .dropdown-toggle.btn-warning:hover,
.btn-warning:active:focus,
.btn-warning.active:focus,
.open > .dropdown-toggle.btn-warning:focus,
.btn-warning:active.focus,
.btn-warning.active.focus,
.open > .dropdown-toggle.btn-warning.focus {
color: #fff;
background-color: #d58512;
border-color: #985f0d;
}
.btn-warning:active,
.btn-warning.active,
.open > .dropdown-toggle.btn-warning {
background-image: none;
}
.btn-warning.disabled,
.btn-warning[disabled],
fieldset[disabled] .btn-warning,
.btn-warning.disabled:hover,
.btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover,
.btn-warning.disabled:focus,
.btn-warning[disabled]:focus,
fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled.focus,
.btn-warning[disabled].focus,
fieldset[disabled] .btn-warning.focus,
.btn-warning.disabled:active,
.btn-warning[disabled]:active,
fieldset[disabled] .btn-warning:active,
.btn-warning.disabled.active,
.btn-warning[disabled].active,
fieldset[disabled] .btn-warning.active {
background-color: #f0ad4e;
border-color: #eea236;
}
.btn-warning .badge {
color: #f0ad4e;
background-color: #fff;
}
.btn-danger {
color: #fff;
background-color: #d9534f;
border-color: #d43f3a;
}
.btn-danger:focus,
.btn-danger.focus {
color: #fff;
background-color: #c9302c;
border-color: #761c19;
}
.btn-danger:hover {
color: #fff;
background-color: #c9302c;
border-color: #ac2925;
}
.btn-danger:active,
.btn-danger.active,
.open > .dropdown-toggle.btn-danger {
color: #fff;
background-color: #c9302c;
border-color: #ac2925;
}
.btn-danger:active:hover,
.btn-danger.active:hover,
.open > .dropdown-toggle.btn-danger:hover,
.btn-danger:active:focus,
.btn-danger.active:focus,
.open > .dropdown-toggle.btn-danger:focus,
.btn-danger:active.focus,
.btn-danger.active.focus,
.open > .dropdown-toggle.btn-danger.focus {
color: #fff;
background-color: #ac2925;
border-color: #761c19;
}
.btn-danger:active,
.btn-danger.active,
.open > .dropdown-toggle.btn-danger {
background-image: none;
}
.btn-danger.disabled,
.btn-danger[disabled],
fieldset[disabled] .btn-danger,
.btn-danger.disabled:hover,
.btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover,
.btn-danger.disabled:focus,
.btn-danger[disabled]:focus,
fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled.focus,
.btn-danger[disabled].focus,
fieldset[disabled] .btn-danger.focus,
.btn-danger.disabled:active,
.btn-danger[disabled]:active,
fieldset[disabled] .btn-danger:active,
.btn-danger.disabled.active,
.btn-danger[disabled].active,
fieldset[disabled] .btn-danger.active {
background-color: #d9534f;
border-color: #d43f3a;
}
.btn-danger .badge {
color: #d9534f;
background-color: #fff;
}
.btn-link {
font-weight: normal;
color: #337ab7;
border-radius: 0;
}
.btn-link,
.btn-link:active,
.btn-link.active,
.btn-link[disabled],
fieldset[disabled] .btn-link {
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-link,
.btn-link:hover,
.btn-link:focus,
.btn-link:active {
border-color: transparent;
}
.btn-link:hover,
.btn-link:focus {
color: #23527c;
text-decoration: underline;
background-color: transparent;
}
.btn-link[disabled]:hover,
fieldset[disabled] .btn-link:hover,
.btn-link[disabled]:focus,
fieldset[disabled] .btn-link:focus {
color: #777;
text-decoration: none;
}
.btn-lg,
.btn-group-lg > .btn {
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
.btn-sm,
.btn-group-sm > .btn {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-xs,
.btn-group-xs > .btn {
padding: 1px 5px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-block {
display: block;
width: 100%;
}
.btn-block + .btn-block {
margin-top: 5px;
}
input[type="submit"].btn-block,
input[type="reset"].btn-block,
input[type="button"].btn-block {
width: 100%;
}
.fade {
opacity: 0;
-webkit-transition: opacity .15s linear;
-o-transition: opacity .15s linear;
transition: opacity .15s linear;
}
.fade.in {
opacity: 1;
}
.collapse {
display: none;
}
.collapse.in {
display: block;
}
tr.collapse.in {
display: table-row;
}
tbody.collapse.in {
display: table-row-group;
}
.collapsing {
position: relative;
height: 0;
overflow: hidden;
-webkit-transition-timing-function: ease;
-o-transition-timing-function: ease;
transition-timing-function: ease;
-webkit-transition-duration: .35s;
-o-transition-duration: .35s;
transition-duration: .35s;
-webkit-transition-property: height, visibility;
-o-transition-property: height, visibility;
transition-property: height, visibility;
}
.caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px dashed;
border-top: 4px solid \9;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
}
.dropup,
.dropdown {
position: relative;
}
.dropdown-toggle:focus {
outline: 0;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
}
.dropdown-menu.pull-right {
right: 0;
left: auto;
}
.dropdown-menu .divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
color: #fff;
text-decoration: none;
background-color: #337ab7;
outline: 0;
}
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
color: #777;
}
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
}
.open > .dropdown-menu {
display: block;
}
.open > a {
outline: 0;
}
.dropdown-menu-right {
right: 0;
left: auto;
}
.dropdown-menu-left {
right: auto;
left: 0;
}
.dropdown-header {
display: block;
padding: 3px 20px;
font-size: 12px;
line-height: 1.42857143;
color: #777;
white-space: nowrap;
}
.dropdown-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 990;
}
.pull-right > .dropdown-menu {
right: 0;
left: auto;
}
.dropup .caret,
.navbar-fixed-bottom .dropdown .caret {
content: "";
border-top: 0;
border-bottom: 4px dashed;
border-bottom: 4px solid \9;
}
.dropup .dropdown-menu,
.navbar-fixed-bottom .dropdown .dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 2px;
}
@media (min-width: 768px) {
.navbar-right .dropdown-menu {
right: 0;
left: auto;
}
.navbar-right .dropdown-menu-left {
right: auto;
left: 0;
}
}
.btn-group,
.btn-group-vertical {
position: relative;
display: inline-block;
vertical-align: middle;
}
.btn-group > .btn,
.btn-group-vertical > .btn {
position: relative;
float: left;
}
.btn-group > .btn:hover,
.btn-group-vertical > .btn:hover,
.btn-group > .btn:focus,
.btn-group-vertical > .btn:focus,
.btn-group > .btn:active,
.btn-group-vertical > .btn:active,
.btn-group > .btn.active,
.btn-group-vertical > .btn.active {
z-index: 2;
}
.btn-group .btn + .btn,
.btn-group .btn + .btn-group,
.btn-group .btn-group + .btn,
.btn-group .btn-group + .btn-group {
margin-left: -1px;
}
.btn-toolbar {
margin-left: -5px;
}
.btn-toolbar .btn,
.btn-toolbar .btn-group,
.btn-toolbar .input-group {
float: left;
}
.btn-toolbar > .btn,
.btn-toolbar > .btn-group,
.btn-toolbar > .input-group {
margin-left: 5px;
}
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0;
}
.btn-group > .btn:first-child {
margin-left: 0;
}
.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group > .btn-group {
float: left;
}
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child,
.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle {
outline: 0;
}
.btn-group > .btn + .dropdown-toggle {
padding-right: 8px;
padding-left: 8px;
}
.btn-group > .btn-lg + .dropdown-toggle {
padding-right: 12px;
padding-left: 12px;
}
.btn-group.open .dropdown-toggle {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn-group.open .dropdown-toggle.btn-link {
-webkit-box-shadow: none;
box-shadow: none;
}
.btn .caret {
margin-left: 0;
}
.btn-lg .caret {
border-width: 5px 5px 0;
border-bottom-width: 0;
}
.dropup .btn-lg .caret {
border-width: 0 5px 5px;
}
.btn-group-vertical > .btn,
.btn-group-vertical > .btn-group,
.btn-group-vertical > .btn-group > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%;
}
.btn-group-vertical > .btn-group > .btn {
float: none;
}
.btn-group-vertical > .btn + .btn,
.btn-group-vertical > .btn + .btn-group,
.btn-group-vertical > .btn-group + .btn,
.btn-group-vertical > .btn-group + .btn-group {
margin-top: -1px;
margin-left: 0;
}
.btn-group-vertical > .btn:not(:first-child):not(:last-child) {
border-radius: 0;
}
.btn-group-vertical > .btn:first-child:not(:last-child) {
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group-vertical > .btn:last-child:not(:first-child) {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 4px;
}
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child,
.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.btn-group-justified {
display: table;
width: 100%;
table-layout: fixed;
border-collapse: separate;
}
.btn-group-justified > .btn,
.btn-group-justified > .btn-group {
display: table-cell;
float: none;
width: 1%;
}
.btn-group-justified > .btn-group .btn {
width: 100%;
}
.btn-group-justified > .btn-group .dropdown-menu {
left: auto;
}
[data-toggle="buttons"] > .btn input[type="radio"],
[data-toggle="buttons"] > .btn-group > .btn input[type="radio"],
[data-toggle="buttons"] > .btn input[type="checkbox"],
[data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] {
position: absolute;
clip: rect(0, 0, 0, 0);
pointer-events: none;
}
.input-group {
position: relative;
display: table;
border-collapse: separate;
}
.input-group[class*="col-"] {
float: none;
padding-right: 0;
padding-left: 0;
}
.input-group .form-control {
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0;
}
.input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
height: 46px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
select.input-group-lg > .form-control,
select.input-group-lg > .input-group-addon,
select.input-group-lg > .input-group-btn > .btn {
height: 46px;
line-height: 46px;
}
textarea.input-group-lg > .form-control,
textarea.input-group-lg > .input-group-addon,
textarea.input-group-lg > .input-group-btn > .btn,
select[multiple].input-group-lg > .form-control,
select[multiple].input-group-lg > .input-group-addon,
select[multiple].input-group-lg > .input-group-btn > .btn {
height: auto;
}
.input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
select.input-group-sm > .form-control,
select.input-group-sm > .input-group-addon,
select.input-group-sm > .input-group-btn > .btn {
height: 30px;
line-height: 30px;
}
textarea.input-group-sm > .form-control,
textarea.input-group-sm > .input-group-addon,
textarea.input-group-sm > .input-group-btn > .btn,
select[multiple].input-group-sm > .form-control,
select[multiple].input-group-sm > .input-group-addon,
select[multiple].input-group-sm > .input-group-btn > .btn {
height: auto;
}
.input-group-addon,
.input-group-btn,
.input-group .form-control {
display: table-cell;
}
.input-group-addon:not(:first-child):not(:last-child),
.input-group-btn:not(:first-child):not(:last-child),
.input-group .form-control:not(:first-child):not(:last-child) {
border-radius: 0;
}
.input-group-addon,
.input-group-btn {
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
.input-group-addon {
padding: 6px 12px;
font-size: 14px;
font-weight: normal;
line-height: 1;
color: #555;
text-align: center;
background-color: #eee;
border: 1px solid #ccc;
border-radius: 4px;
}
.input-group-addon.input-sm {
padding: 5px 10px;
font-size: 12px;
border-radius: 3px;
}
.input-group-addon.input-lg {
padding: 10px 16px;
font-size: 18px;
border-radius: 6px;
}
.input-group-addon input[type="radio"],
.input-group-addon input[type="checkbox"] {
margin-top: 0;
}
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group-addon:first-child {
border-right: 0;
}
.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child),
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.input-group-addon:last-child {
border-left: 0;
}
.input-group-btn {
position: relative;
font-size: 0;
white-space: nowrap;
}
.input-group-btn > .btn {
position: relative;
}
.input-group-btn > .btn + .btn {
margin-left: -1px;
}
.input-group-btn > .btn:hover,
.input-group-btn > .btn:focus,
.input-group-btn > .btn:active {
z-index: 2;
}
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group {
margin-right: -1px;
}
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group {
z-index: 2;
margin-left: -1px;
}
.nav {
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.nav > li {
position: relative;
display: block;
}
.nav > li > a {
position: relative;
display: block;
padding: 10px 15px;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #eee;
}
.nav > li.disabled > a {
color: #777;
}
.nav > li.disabled > a:hover,
.nav > li.disabled > a:focus {
color: #777;
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
}
.nav .open > a,
.nav .open > a:hover,
.nav .open > a:focus {
background-color: #eee;
border-color: #337ab7;
}
.nav .nav-divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.nav > li > a > img {
max-width: none;
}
.nav-tabs {
border-bottom: 1px solid #ddd;
}
.nav-tabs > li {
float: left;
margin-bottom: -1px;
}
.nav-tabs > li > a {
margin-right: 2px;
line-height: 1.42857143;
border: 1px solid transparent;
border-radius: 4px 4px 0 0;
}
.nav-tabs > li > a:hover {
border-color: #eee #eee #ddd;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
color: #555;
cursor: default;
background-color: #fff;
border: 1px solid #ddd;
border-bottom-color: transparent;
}
.nav-tabs.nav-justified {
width: 100%;
border-bottom: 0;
}
.nav-tabs.nav-justified > li {
float: none;
}
.nav-tabs.nav-justified > li > a {
margin-bottom: 5px;
text-align: center;
}
.nav-tabs.nav-justified > .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: 768px) {
.nav-tabs.nav-justified > li {
display: table-cell;
width: 1%;
}
.nav-tabs.nav-justified > li > a {
margin-bottom: 0;
}
}
.nav-tabs.nav-justified > li > a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs.nav-justified > .active > a,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:focus {
border: 1px solid #ddd;
}
@media (min-width: 768px) {
.nav-tabs.nav-justified > li > a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs.nav-justified > .active > a,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:focus {
border-bottom-color: #fff;
}
}
.nav-pills > li {
float: left;
}
.nav-pills > li > a {
border-radius: 4px;
}
.nav-pills > li + li {
margin-left: 2px;
}
.nav-pills > li.active > a,
.nav-pills > li.active > a:hover,
.nav-pills > li.active > a:focus {
color: #fff;
background-color: #337ab7;
}
.nav-stacked > li {
float: none;
}
.nav-stacked > li + li {
margin-top: 2px;
margin-left: 0;
}
.nav-justified {
width: 100%;
}
.nav-justified > li {
float: none;
}
.nav-justified > li > a {
margin-bottom: 5px;
text-align: center;
}
.nav-justified > .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: 768px) {
.nav-justified > li {
display: table-cell;
width: 1%;
}
.nav-justified > li > a {
margin-bottom: 0;
}
}
.nav-tabs-justified {
border-bottom: 0;
}
.nav-tabs-justified > li > a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus {
border: 1px solid #ddd;
}
@media (min-width: 768px) {
.nav-tabs-justified > li > a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus {
border-bottom-color: #fff;
}
}
.tab-content > .tab-pane {
display: none;
}
.tab-content > .active {
display: block;
}
.nav-tabs .dropdown-menu {
margin-top: -1px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent;
}
@media (min-width: 768px) {
.navbar {
border-radius: 4px;
}
}
@media (min-width: 768px) {
.navbar-header {
float: left;
}
}
.navbar-collapse {
padding-right: 15px;
padding-left: 15px;
overflow-x: visible;
-webkit-overflow-scrolling: touch;
border-top: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.navbar-collapse.in {
overflow-y: auto;
}
@media (min-width: 768px) {
.navbar-collapse {
width: auto;
border-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-collapse.collapse {
display: block !important;
height: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-y: visible;
}
.navbar-fixed-top .navbar-collapse,
.navbar-static-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
padding-right: 0;
padding-left: 0;
}
}
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 340px;
}
@media (max-device-width: 480px) and (orientation: landscape) {
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 200px;
}
}
.container > .navbar-header,
.container-fluid > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-collapse {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
.container > .navbar-header,
.container-fluid > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-collapse {
margin-right: 0;
margin-left: 0;
}
}
.navbar-static-top {
z-index: 1000;
border-width: 0 0 1px;
}
@media (min-width: 768px) {
.navbar-static-top {
border-radius: 0;
}
}
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
}
@media (min-width: 768px) {
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
border-width: 1px 0 0;
}
.navbar-brand {
float: left;
height: 50px;
padding: 15px 15px;
font-size: 18px;
line-height: 20px;
}
.navbar-brand:hover,
.navbar-brand:focus {
text-decoration: none;
}
.navbar-brand > img {
display: block;
}
@media (min-width: 768px) {
.navbar > .container .navbar-brand,
.navbar > .container-fluid .navbar-brand {
margin-left: -15px;
}
}
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-top: 8px;
margin-right: 15px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.navbar-toggle:focus {
outline: 0;
}
.navbar-toggle .icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
}
.navbar-toggle .icon-bar + .icon-bar {
margin-top: 4px;
}
@media (min-width: 768px) {
.navbar-toggle {
display: none;
}
}
.navbar-nav {
margin: 7.5px -15px;
}
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px;
}
@media (max-width: 767px) {
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-nav .open .dropdown-menu > li > a,
.navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px;
}
.navbar-nav .open .dropdown-menu > li > a {
line-height: 20px;
}
.navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-nav .open .dropdown-menu > li > a:focus {
background-image: none;
}
}
@media (min-width: 768px) {
.navbar-nav {
float: left;
margin: 0;
}
.navbar-nav > li {
float: left;
}
.navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px;
}
}
.navbar-form {
padding: 10px 15px;
margin-top: 8px;
margin-right: -15px;
margin-bottom: 8px;
margin-left: -15px;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
}
@media (min-width: 768px) {
.navbar-form .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .form-control {
display: inline-block;
width: auto;
vertical-align: middle;
}
.navbar-form .form-control-static {
display: inline-block;
}
.navbar-form .input-group {
display: inline-table;
vertical-align: middle;
}
.navbar-form .input-group .input-group-addon,
.navbar-form .input-group .input-group-btn,
.navbar-form .input-group .form-control {
width: auto;
}
.navbar-form .input-group > .form-control {
width: 100%;
}
.navbar-form .control-label {
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio,
.navbar-form .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio label,
.navbar-form .checkbox label {
padding-left: 0;
}
.navbar-form .radio input[type="radio"],
.navbar-form .checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
.navbar-form .has-feedback .form-control-feedback {
top: 0;
}
}
@media (max-width: 767px) {
.navbar-form .form-group {
margin-bottom: 5px;
}
.navbar-form .form-group:last-child {
margin-bottom: 0;
}
}
@media (min-width: 768px) {
.navbar-form {
width: auto;
padding-top: 0;
padding-bottom: 0;
margin-right: 0;
margin-left: 0;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
}
.navbar-nav > li > .dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
margin-bottom: 0;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.navbar-btn {
margin-top: 8px;
margin-bottom: 8px;
}
.navbar-btn.btn-sm {
margin-top: 10px;
margin-bottom: 10px;
}
.navbar-btn.btn-xs {
margin-top: 14px;
margin-bottom: 14px;
}
.navbar-text {
margin-top: 15px;
margin-bottom: 15px;
}
@media (min-width: 768px) {
.navbar-text {
float: left;
margin-right: 15px;
margin-left: 15px;
}
}
@media (min-width: 768px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
margin-right: -15px;
}
.navbar-right ~ .navbar-right {
margin-right: 0;
}
}
.navbar-default {
background-color: #f8f8f8;
border-color: #e7e7e7;
}
.navbar-default .navbar-brand {
color: #777;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #5e5e5e;
background-color: transparent;
}
.navbar-default .navbar-text {
color: #777;
}
.navbar-default .navbar-nav > li > a {
color: #777;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav > .disabled > a,
.navbar-default .navbar-nav > .disabled > a:hover,
.navbar-default .navbar-nav > .disabled > a:focus {
color: #ccc;
background-color: transparent;
}
.navbar-default .navbar-toggle {
border-color: #ddd;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #ddd;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #888;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #e7e7e7;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #555;
background-color: #e7e7e7;
}
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #777;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #ccc;
background-color: transparent;
}
}
.navbar-default .navbar-link {
color: #777;
}
.navbar-default .navbar-link:hover {
color: #333;
}
.navbar-default .btn-link {
color: #777;
}
.navbar-default .btn-link:hover,
.navbar-default .btn-link:focus {
color: #333;
}
.navbar-default .btn-link[disabled]:hover,
fieldset[disabled] .navbar-default .btn-link:hover,
.navbar-default .btn-link[disabled]:focus,
fieldset[disabled] .navbar-default .btn-link:focus {
color: #ccc;
}
.navbar-inverse {
background-color: #222;
border-color: #080808;
height: 60px;
}
.navbar-inverse .navbar-brand {
color: #9d9d9d;
}
.navbar-inverse .navbar-brand:hover,
.navbar-inverse .navbar-brand:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-text {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav > li > a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus {
color: #fff;
background-color: #080808;
}
.navbar-inverse .navbar-nav > .disabled > a,
.navbar-inverse .navbar-nav > .disabled > a:hover,
.navbar-inverse .navbar-nav > .disabled > a:focus {
color: #444;
background-color: transparent;
}
.navbar-inverse .navbar-toggle {
border-color: #333;
}
.navbar-inverse .navbar-toggle:hover,
.navbar-inverse .navbar-toggle:focus {
background-color: #333;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
border-color: #101010;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .open > a:hover,
.navbar-inverse .navbar-nav > .open > a:focus {
color: #fff;
background-color: #080808;
}
@media (max-width: 767px) {
.navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {
border-color: #080808;
}
.navbar-inverse .navbar-nav .open .dropdown-menu .divider {
background-color: #080808;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-color: #080808;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #444;
background-color: transparent;
}
}
.navbar-inverse .navbar-link {
color: #9d9d9d;
}
.navbar-inverse .navbar-link:hover {
color: #fff;
}
.navbar-inverse .btn-link {
color: #9d9d9d;
}
.navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link:focus {
color: #fff;
}
.navbar-inverse .btn-link[disabled]:hover,
fieldset[disabled] .navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link[disabled]:focus,
fieldset[disabled] .navbar-inverse .btn-link:focus {
color: #444;
}
.breadcrumb {
padding: 8px 15px;
margin-bottom: 20px;
list-style: none;
background-color: #f5f5f5;
border-radius: 4px;
}
.breadcrumb > li {
display: inline-block;
}
.breadcrumb > li + li:before {
padding: 0 5px;
color: #ccc;
content: "/\00a0";
}
.breadcrumb > .active {
color: #777;
}
.pagination {
display: inline-block;
padding-left: 0;
margin: 20px 0;
border-radius: 4px;
}
.pagination > li {
display: inline;
}
.pagination > li > a,
.pagination > li > span {
position: relative;
float: left;
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #337ab7;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
.pagination > li:first-child > a,
.pagination > li:first-child > span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.pagination > li:last-child > a,
.pagination > li:last-child > span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.pagination > li > a:hover,
.pagination > li > span:hover,
.pagination > li > a:focus,
.pagination > li > span:focus {
z-index: 3;
color: #23527c;
background-color: #eee;
border-color: #ddd;
}
.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
z-index: 2;
color: #fff;
cursor: default;
background-color: #337ab7;
border-color: #337ab7;
}
.pagination > .disabled > span,
.pagination > .disabled > span:hover,
.pagination > .disabled > span:focus,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
.pagination-lg > li > a,
.pagination-lg > li > span {
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
}
.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
.pagination-sm > li > a,
.pagination-sm > li > span {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
}
.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.pager {
padding-left: 0;
margin: 20px 0;
text-align: center;
list-style: none;
}
.pager li {
display: inline;
}
.pager li > a,
.pager li > span {
display: inline-block;
padding: 5px 14px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 15px;
}
.pager li > a:hover,
.pager li > a:focus {
text-decoration: none;
background-color: #eee;
}
.pager .next > a,
.pager .next > span {
float: right;
}
.pager .previous > a,
.pager .previous > span {
float: left;
}
.pager .disabled > a,
.pager .disabled > a:hover,
.pager .disabled > a:focus,
.pager .disabled > span {
color: #777;
cursor: not-allowed;
background-color: #fff;
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: bold;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
}
a.label:hover,
a.label:focus {
color: #fff;
text-decoration: none;
cursor: pointer;
}
.label:empty {
display: none;
}
.btn .label {
position: relative;
top: -1px;
}
.label-default {
background-color: #777;
}
.label-default[href]:hover,
.label-default[href]:focus {
background-color: #5e5e5e;
}
.label-primary {
background-color: #337ab7;
}
.label-primary[href]:hover,
.label-primary[href]:focus {
background-color: #286090;
}
.label-success {
background-color: #5cb85c;
}
.label-success[href]:hover,
.label-success[href]:focus {
background-color: #449d44;
}
.label-info {
background-color: #5bc0de;
}
.label-info[href]:hover,
.label-info[href]:focus {
background-color: #31b0d5;
}
.label-warning {
background-color: #f0ad4e;
}
.label-warning[href]:hover,
.label-warning[href]:focus {
background-color: #ec971f;
}
.label-danger {
background-color: #d9534f;
}
.label-danger[href]:hover,
.label-danger[href]:focus {
background-color: #c9302c;
}
.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: middle;
background-color: #777;
border-radius: 10px;
}
.badge:empty {
display: none;
}
.btn .badge {
position: relative;
top: -1px;
}
.btn-xs .badge,
.btn-group-xs > .btn .badge {
top: 0;
padding: 1px 5px;
}
a.badge:hover,
a.badge:focus {
color: #fff;
text-decoration: none;
cursor: pointer;
}
.list-group-item.active > .badge,
.nav-pills > .active > a > .badge {
color: #337ab7;
background-color: #fff;
}
.list-group-item > .badge {
float: right;
}
.list-group-item > .badge + .badge {
margin-right: 5px;
}
.nav-pills > li > a > .badge {
margin-left: 3px;
}
.jumbotron {
padding-top: 30px;
padding-bottom: 30px;
margin-bottom: 30px;
color: inherit;
background-color: #eee;
}
.jumbotron h1,
.jumbotron .h1 {
color: inherit;
}
.jumbotron p {
margin-bottom: 15px;
font-size: 21px;
font-weight: 200;
}
.jumbotron > hr {
border-top-color: #d5d5d5;
}
.container .jumbotron,
.container-fluid .jumbotron {
border-radius: 6px;
}
.jumbotron .container {
max-width: 100%;
}
@media screen and (min-width: 768px) {
.jumbotron {
padding-top: 48px;
padding-bottom: 48px;
}
.container .jumbotron,
.container-fluid .jumbotron {
padding-right: 60px;
padding-left: 60px;
}
.jumbotron h1,
.jumbotron .h1 {
font-size: 63px;
}
}
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: border .2s ease-in-out;
-o-transition: border .2s ease-in-out;
transition: border .2s ease-in-out;
}
.thumbnail > img,
.thumbnail a > img {
margin-right: auto;
margin-left: auto;
}
a.thumbnail:hover,
a.thumbnail:focus,
a.thumbnail.active {
border-color: #337ab7;
}
.thumbnail .caption {
padding: 9px;
color: #333;
}
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert h4 {
margin-top: 0;
color: inherit;
}
.alert .alert-link {
font-weight: bold;
}
.alert > p,
.alert > ul {
margin-bottom: 0;
}
.alert > p + p {
margin-top: 5px;
}
.alert-dismissable,
.alert-dismissible {
padding-right: 35px;
}
.alert-dismissable .close,
.alert-dismissible .close {
position: relative;
top: -2px;
right: -21px;
color: inherit;
}
.alert-success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.alert-success hr {
border-top-color: #c9e2b3;
}
.alert-success .alert-link {
color: #2b542c;
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-info hr {
border-top-color: #a6e1ec;
}
.alert-info .alert-link {
color: #245269;
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.alert-warning hr {
border-top-color: #f7e1b5;
}
.alert-warning .alert-link {
color: #66512c;
}
.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.alert-danger hr {
border-top-color: #e4b9c0;
}
.alert-danger .alert-link {
color: #843534;
}
@-webkit-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@-o-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
.progress {
height: 20px;
margin-bottom: 20px;
overflow: hidden;
background-color: #f5f5f5;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
}
.progress-bar {
float: left;
width: 0;
height: 100%;
font-size: 12px;
line-height: 20px;
color: #fff;
text-align: center;
background-color: #337ab7;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
-webkit-transition: width .6s ease;
-o-transition: width .6s ease;
transition: width .6s ease;
}
.progress-striped .progress-bar,
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
-webkit-background-size: 40px 40px;
background-size: 40px 40px;
}
.progress.active .progress-bar,
.progress-bar.active {
-webkit-animation: progress-bar-stripes 2s linear infinite;
-o-animation: progress-bar-stripes 2s linear infinite;
animation: progress-bar-stripes 2s linear infinite;
}
.progress-bar-success {
background-color: #5cb85c;
}
.progress-striped .progress-bar-success {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.progress-bar-info {
background-color: #5bc0de;
}
.progress-striped .progress-bar-info {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.progress-bar-warning {
background-color: #f0ad4e;
}
.progress-striped .progress-bar-warning {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.progress-bar-danger {
background-color: #d9534f;
}
.progress-striped .progress-bar-danger {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.media {
margin-top: 15px;
}
.media:first-child {
margin-top: 0;
}
.media,
.media-body {
overflow: hidden;
zoom: 1;
}
.media-body {
width: 10000px;
}
.media-object {
display: block;
}
.media-object.img-thumbnail {
max-width: none;
}
.media-right,
.media > .pull-right {
padding-left: 10px;
}
.media-left,
.media > .pull-left {
padding-right: 10px;
}
.media-left,
.media-right,
.media-body {
display: table-cell;
vertical-align: top;
}
.media-middle {
vertical-align: middle;
}
.media-bottom {
vertical-align: bottom;
}
.media-heading {
margin-top: 0;
margin-bottom: 5px;
}
.media-list {
padding-left: 0;
list-style: none;
}
.list-group {
padding-left: 0;
margin-bottom: 20px;
}
.list-group-item {
position: relative;
display: block;
padding: 10px 15px;
margin-bottom: -1px;
background-color: #fff;
border: 1px solid #ddd;
}
.list-group-item:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.list-group-item:last-child {
margin-bottom: 0;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
a.list-group-item,
button.list-group-item {
color: #555;
}
a.list-group-item .list-group-item-heading,
button.list-group-item .list-group-item-heading {
color: #333;
}
a.list-group-item:hover,
button.list-group-item:hover,
a.list-group-item:focus,
button.list-group-item:focus {
color: #555;
text-decoration: none;
background-color: #f5f5f5;
}
button.list-group-item {
width: 100%;
text-align: left;
}
.list-group-item.disabled,
.list-group-item.disabled:hover,
.list-group-item.disabled:focus {
color: #777;
cursor: not-allowed;
background-color: #eee;
}
.list-group-item.disabled .list-group-item-heading,
.list-group-item.disabled:hover .list-group-item-heading,
.list-group-item.disabled:focus .list-group-item-heading {
color: inherit;
}
.list-group-item.disabled .list-group-item-text,
.list-group-item.disabled:hover .list-group-item-text,
.list-group-item.disabled:focus .list-group-item-text {
color: #777;
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
z-index: 2;
color: #fff;
background-color: #337ab7;
border-color: #337ab7;
}
.list-group-item.active .list-group-item-heading,
.list-group-item.active:hover .list-group-item-heading,
.list-group-item.active:focus .list-group-item-heading,
.list-group-item.active .list-group-item-heading > small,
.list-group-item.active:hover .list-group-item-heading > small,
.list-group-item.active:focus .list-group-item-heading > small,
.list-group-item.active .list-group-item-heading > .small,
.list-group-item.active:hover .list-group-item-heading > .small,
.list-group-item.active:focus .list-group-item-heading > .small {
color: inherit;
}
.list-group-item.active .list-group-item-text,
.list-group-item.active:hover .list-group-item-text,
.list-group-item.active:focus .list-group-item-text {
color: #c7ddef;
}
.list-group-item-success {
color: #3c763d;
background-color: #dff0d8;
}
a.list-group-item-success,
button.list-group-item-success {
color: #3c763d;
}
a.list-group-item-success .list-group-item-heading,
button.list-group-item-success .list-group-item-heading {
color: inherit;
}
a.list-group-item-success:hover,
button.list-group-item-success:hover,
a.list-group-item-success:focus,
button.list-group-item-success:focus {
color: #3c763d;
background-color: #d0e9c6;
}
a.list-group-item-success.active,
button.list-group-item-success.active,
a.list-group-item-success.active:hover,
button.list-group-item-success.active:hover,
a.list-group-item-success.active:focus,
button.list-group-item-success.active:focus {
color: #fff;
background-color: #3c763d;
border-color: #3c763d;
}
.list-group-item-info {
color: #31708f;
background-color: #d9edf7;
}
a.list-group-item-info,
button.list-group-item-info {
color: #31708f;
}
a.list-group-item-info .list-group-item-heading,
button.list-group-item-info .list-group-item-heading {
color: inherit;
}
a.list-group-item-info:hover,
button.list-group-item-info:hover,
a.list-group-item-info:focus,
button.list-group-item-info:focus {
color: #31708f;
background-color: #c4e3f3;
}
a.list-group-item-info.active,
button.list-group-item-info.active,
a.list-group-item-info.active:hover,
button.list-group-item-info.active:hover,
a.list-group-item-info.active:focus,
button.list-group-item-info.active:focus {
color: #fff;
background-color: #31708f;
border-color: #31708f;
}
.list-group-item-warning {
color: #8a6d3b;
background-color: #fcf8e3;
}
a.list-group-item-warning,
button.list-group-item-warning {
color: #8a6d3b;
}
a.list-group-item-warning .list-group-item-heading,
button.list-group-item-warning .list-group-item-heading {
color: inherit;
}
a.list-group-item-warning:hover,
button.list-group-item-warning:hover,
a.list-group-item-warning:focus,
button.list-group-item-warning:focus {
color: #8a6d3b;
background-color: #faf2cc;
}
a.list-group-item-warning.active,
button.list-group-item-warning.active,
a.list-group-item-warning.active:hover,
button.list-group-item-warning.active:hover,
a.list-group-item-warning.active:focus,
button.list-group-item-warning.active:focus {
color: #fff;
background-color: #8a6d3b;
border-color: #8a6d3b;
}
.list-group-item-danger {
color: #a94442;
background-color: #f2dede;
}
a.list-group-item-danger,
button.list-group-item-danger {
color: #a94442;
}
a.list-group-item-danger .list-group-item-heading,
button.list-group-item-danger .list-group-item-heading {
color: inherit;
}
a.list-group-item-danger:hover,
button.list-group-item-danger:hover,
a.list-group-item-danger:focus,
button.list-group-item-danger:focus {
color: #a94442;
background-color: #ebcccc;
}
a.list-group-item-danger.active,
button.list-group-item-danger.active,
a.list-group-item-danger.active:hover,
button.list-group-item-danger.active:hover,
a.list-group-item-danger.active:focus,
button.list-group-item-danger.active:focus {
color: #fff;
background-color: #a94442;
border-color: #a94442;
}
.list-group-item-heading {
margin-top: 0;
margin-bottom: 5px;
}
.list-group-item-text {
margin-bottom: 0;
line-height: 1.3;
}
.panel {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
}
.panel-body {
padding: 15px;
}
.panel-heading {
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel-heading > .dropdown .dropdown-toggle {
color: inherit;
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit;
}
.panel-title > a,
.panel-title > small,
.panel-title > .small,
.panel-title > small > a,
.panel-title > .small > a {
color: inherit;
}
.panel-footer {
padding: 10px 15px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .list-group,
.panel > .panel-collapse > .list-group {
margin-bottom: 0;
}
.panel > .list-group .list-group-item,
.panel > .panel-collapse > .list-group .list-group-item {
border-width: 1px 0;
border-radius: 0;
}
.panel > .list-group:first-child .list-group-item:first-child,
.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child {
border-top: 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel > .list-group:last-child .list-group-item:last-child,
.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child {
border-bottom: 0;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.panel-heading + .list-group .list-group-item:first-child {
border-top-width: 0;
}
.list-group + .panel-footer {
border-top-width: 0;
}
.panel > .table,
.panel > .table-responsive > .table,
.panel > .panel-collapse > .table {
margin-bottom: 0;
}
.panel > .table caption,
.panel > .table-responsive > .table caption,
.panel > .panel-collapse > .table caption {
padding-right: 15px;
padding-left: 15px;
}
.panel > .table:first-child,
.panel > .table-responsive:first-child > .table:first-child {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel > .table:first-child > thead:first-child > tr:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {
border-top-left-radius: 3px;
}
.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {
border-top-right-radius: 3px;
}
.panel > .table:last-child,
.panel > .table-responsive:last-child > .table:last-child {
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .table:last-child > tbody:last-child > tr:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child {
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {
border-bottom-left-radius: 3px;
}
.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {
border-bottom-right-radius: 3px;
}
.panel > .panel-body + .table,
.panel > .panel-body + .table-responsive,
.panel > .table + .panel-body,
.panel > .table-responsive + .panel-body {
border-top: 1px solid #ddd;
}
.panel > .table > tbody:first-child > tr:first-child th,
.panel > .table > tbody:first-child > tr:first-child td {
border-top: 0;
}
.panel > .table-bordered,
.panel > .table-responsive > .table-bordered {
border: 0;
}
.panel > .table-bordered > thead > tr > th:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,
.panel > .table-bordered > tbody > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,
.panel > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-bordered > thead > tr > td:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,
.panel > .table-bordered > tbody > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,
.panel > .table-bordered > tfoot > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.panel > .table-bordered > thead > tr > th:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,
.panel > .table-bordered > tbody > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,
.panel > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-bordered > thead > tr > td:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,
.panel > .table-bordered > tbody > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,
.panel > .table-bordered > tfoot > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.panel > .table-bordered > thead > tr:first-child > td,
.panel > .table-responsive > .table-bordered > thead > tr:first-child > td,
.panel > .table-bordered > tbody > tr:first-child > td,
.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,
.panel > .table-bordered > thead > tr:first-child > th,
.panel > .table-responsive > .table-bordered > thead > tr:first-child > th,
.panel > .table-bordered > tbody > tr:first-child > th,
.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th {
border-bottom: 0;
}
.panel > .table-bordered > tbody > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,
.panel > .table-bordered > tfoot > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,
.panel > .table-bordered > tbody > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,
.panel > .table-bordered > tfoot > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th {
border-bottom: 0;
}
.panel > .table-responsive {
margin-bottom: 0;
border: 0;
}
.panel-group {
margin-bottom: 20px;
}
.panel-group .panel {
margin-bottom: 0;
border-radius: 4px;
}
.panel-group .panel + .panel {
margin-top: 5px;
}
.panel-group .panel-heading {
border-bottom: 0;
}
.panel-group .panel-heading + .panel-collapse > .panel-body,
.panel-group .panel-heading + .panel-collapse > .list-group {
border-top: 1px solid #ddd;
}
.panel-group .panel-footer {
border-top: 0;
}
.panel-group .panel-footer + .panel-collapse .panel-body {
border-bottom: 1px solid #ddd;
}
.panel-default {
border-color: #ddd;
}
.panel-default > .panel-heading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-default > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #ddd;
}
.panel-default > .panel-heading .badge {
color: #f5f5f5;
background-color: #333;
}
.panel-default > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #ddd;
}
.panel-primary {
border-color: #337ab7;
}
.panel-primary > .panel-heading {
color: #fff;
background-color: #337ab7;
border-color: #337ab7;
}
.panel-primary > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #337ab7;
}
.panel-primary > .panel-heading .badge {
color: #337ab7;
background-color: #fff;
}
.panel-primary > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #337ab7;
}
.panel-success {
border-color: #d6e9c6;
}
.panel-success > .panel-heading {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.panel-success > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #d6e9c6;
}
.panel-success > .panel-heading .badge {
color: #dff0d8;
background-color: #3c763d;
}
.panel-success > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #d6e9c6;
}
.panel-info {
border-color: #bce8f1;
}
.panel-info > .panel-heading {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.panel-info > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #bce8f1;
}
.panel-info > .panel-heading .badge {
color: #d9edf7;
background-color: #31708f;
}
.panel-info > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #bce8f1;
}
.panel-warning {
border-color: #faebcc;
}
.panel-warning > .panel-heading {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.panel-warning > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #faebcc;
}
.panel-warning > .panel-heading .badge {
color: #fcf8e3;
background-color: #8a6d3b;
}
.panel-warning > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #faebcc;
}
.panel-danger {
border-color: #ebccd1;
}
.panel-danger > .panel-heading {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.panel-danger > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #ebccd1;
}
.panel-danger > .panel-heading .badge {
color: #f2dede;
background-color: #a94442;
}
.panel-danger > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #ebccd1;
}
.embed-responsive {
position: relative;
display: block;
height: 0;
padding: 0;
overflow: hidden;
}
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
.embed-responsive-16by9 {
padding-bottom: 56.25%;
}
.embed-responsive-4by3 {
padding-bottom: 75%;
}
.well {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
}
.well blockquote {
border-color: #ddd;
border-color: rgba(0, 0, 0, .15);
}
.well-lg {
padding: 24px;
border-radius: 6px;
}
.well-sm {
padding: 9px;
border-radius: 3px;
}
.close {
float: right;
font-size: 21px;
font-weight: bold;
line-height: 1;
color: #000;
text-shadow: 0 1px 0 #fff;
filter: alpha(opacity=20);
opacity: .2;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
filter: alpha(opacity=50);
opacity: .5;
}
button.close {
-webkit-appearance: none;
padding: 0;
cursor: pointer;
background: transparent;
border: 0;
}
.modal-open {
overflow: hidden;
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
display: none;
overflow: hidden;
-webkit-overflow-scrolling: touch;
outline: 0;
}
.modal.fade .modal-dialog {
-webkit-transition: -webkit-transform .3s ease-out;
-o-transition: -o-transform .3s ease-out;
transition: transform .3s ease-out;
-webkit-transform: translate(0, -25%);
-ms-transform: translate(0, -25%);
-o-transform: translate(0, -25%);
transform: translate(0, -25%);
}
.modal.in .modal-dialog {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
-o-transform: translate(0, 0);
transform: translate(0, 0);
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal-dialog {
position: relative;
width: auto;
margin: 10px;
}
.modal-content {
position: relative;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, .2);
border-radius: 6px;
outline: 0;
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
}
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000;
}
.modal-backdrop.fade {
filter: alpha(opacity=0);
opacity: 0;
}
.modal-backdrop.in {
filter: alpha(opacity=50);
opacity: .5;
}
.modal-header {
min-height: 16.42857143px;
padding: 15px;
border-bottom: 1px solid #e5e5e5;
}
.modal-header .close {
margin-top: -2px;
}
.modal-title {
margin: 0;
line-height: 1.42857143;
}
.modal-body {
position: relative;
padding: 15px;
}
.modal-footer {
padding: 15px;
text-align: right;
border-top: 1px solid #e5e5e5;
}
.modal-footer .btn + .btn {
margin-bottom: 0;
margin-left: 5px;
}
.modal-footer .btn-group .btn + .btn {
margin-left: -1px;
}
.modal-footer .btn-block + .btn-block {
margin-left: 0;
}
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 768px) {
.modal-dialog {
width: 600px;
margin: 30px auto;
}
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
}
.modal-sm {
width: 300px;
}
}
@media (min-width: 992px) {
.modal-lg {
width: 900px;
}
}
.tooltip {
position: absolute;
z-index: 1070;
display: block;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
line-height: 1.42857143;
text-align: left;
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-break: normal;
word-spacing: normal;
word-wrap: normal;
white-space: normal;
filter: alpha(opacity=0);
opacity: 0;
line-break: auto;
}
.tooltip.in {
filter: alpha(opacity=90);
opacity: .9;
}
.tooltip.top {
padding: 5px 0;
margin-top: -3px;
}
.tooltip.right {
padding: 0 5px;
margin-left: 3px;
}
.tooltip.bottom {
padding: 5px 0;
margin-top: 3px;
}
.tooltip.left {
padding: 0 5px;
margin-left: -3px;
}
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: #fff;
text-align: center;
background-color: #000;
border-radius: 4px;
}
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.top-left .tooltip-arrow {
right: 5px;
bottom: 0;
margin-bottom: -5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.top-right .tooltip-arrow {
bottom: 0;
left: 5px;
margin-bottom: -5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-width: 5px 5px 5px 0;
border-right-color: #000;
}
.tooltip.left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-width: 5px 0 5px 5px;
border-left-color: #000;
}
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.tooltip.bottom-left .tooltip-arrow {
top: 0;
right: 5px;
margin-top: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.tooltip.bottom-right .tooltip-arrow {
top: 0;
left: 5px;
margin-top: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.popover {
position: absolute;
top: 0;
left: 0;
z-index: 1060;
display: none;
max-width: 276px;
padding: 1px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
font-style: normal;
font-weight: normal;
line-height: 1.42857143;
text-align: left;
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-break: normal;
word-spacing: normal;
word-wrap: normal;
white-space: normal;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, .2);
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
line-break: auto;
}
.popover.top {
margin-top: -10px;
}
.popover.right {
margin-left: 10px;
}
.popover.bottom {
margin-top: 10px;
}
.popover.left {
margin-left: -10px;
}
.popover-title {
padding: 8px 14px;
margin: 0;
font-size: 14px;
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
border-radius: 5px 5px 0 0;
}
.popover-content {
padding: 9px 14px;
}
.popover > .arrow,
.popover > .arrow:after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.popover > .arrow {
border-width: 11px;
}
.popover > .arrow:after {
content: "";
border-width: 10px;
}
.popover.top > .arrow {
bottom: -11px;
left: 50%;
margin-left: -11px;
border-top-color: #999;
border-top-color: rgba(0, 0, 0, .25);
border-bottom-width: 0;
}
.popover.top > .arrow:after {
bottom: 1px;
margin-left: -10px;
content: " ";
border-top-color: #fff;
border-bottom-width: 0;
}
.popover.right > .arrow {
top: 50%;
left: -11px;
margin-top: -11px;
border-right-color: #999;
border-right-color: rgba(0, 0, 0, .25);
border-left-width: 0;
}
.popover.right > .arrow:after {
bottom: -10px;
left: 1px;
content: " ";
border-right-color: #fff;
border-left-width: 0;
}
.popover.bottom > .arrow {
top: -11px;
left: 50%;
margin-left: -11px;
border-top-width: 0;
border-bottom-color: #999;
border-bottom-color: rgba(0, 0, 0, .25);
}
.popover.bottom > .arrow:after {
top: 1px;
margin-left: -10px;
content: " ";
border-top-width: 0;
border-bottom-color: #fff;
}
.popover.left > .arrow {
top: 50%;
right: -11px;
margin-top: -11px;
border-right-width: 0;
border-left-color: #999;
border-left-color: rgba(0, 0, 0, .25);
}
.popover.left > .arrow:after {
right: 1px;
bottom: -10px;
content: " ";
border-right-width: 0;
border-left-color: #fff;
}
.carousel {
position: relative;
}
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden;
}
.carousel-inner > .item {
position: relative;
display: none;
-webkit-transition: .6s ease-in-out left;
-o-transition: .6s ease-in-out left;
transition: .6s ease-in-out left;
}
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
line-height: 1;
}
@media all and (transform-3d), (-webkit-transform-3d) {
.carousel-inner > .item {
-webkit-transition: -webkit-transform .6s ease-in-out;
-o-transition: -o-transform .6s ease-in-out;
transition: transform .6s ease-in-out;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000px;
perspective: 1000px;
}
.carousel-inner > .item.next,
.carousel-inner > .item.active.right {
left: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
.carousel-inner > .item.prev,
.carousel-inner > .item.active.left {
left: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
.carousel-inner > .item.next.left,
.carousel-inner > .item.prev.right,
.carousel-inner > .item.active {
left: 0;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.carousel-inner > .active,
.carousel-inner > .next,
.carousel-inner > .prev {
display: block;
}
.carousel-inner > .active {
left: 0;
}
.carousel-inner > .next,
.carousel-inner > .prev {
position: absolute;
top: 0;
width: 100%;
}
.carousel-inner > .next {
left: 100%;
}
.carousel-inner > .prev {
left: -100%;
}
.carousel-inner > .next.left,
.carousel-inner > .prev.right {
left: 0;
}
.carousel-inner > .active.left {
left: -100%;
}
.carousel-inner > .active.right {
left: 100%;
}
.carousel-control {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 15%;
font-size: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
filter: alpha(opacity=50);
opacity: .5;
}
.carousel-control.left {
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001)));
background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
background-repeat: repeat-x;
}
.carousel-control.right {
right: 0;
left: auto;
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5)));
background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
background-repeat: repeat-x;
}
.carousel-control:hover,
.carousel-control:focus {
color: #fff;
text-decoration: none;
filter: alpha(opacity=90);
outline: 0;
opacity: .9;
}
.carousel-control .icon-prev,
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
margin-top: -10px;
}
.carousel-control .icon-prev,
.carousel-control .glyphicon-chevron-left {
left: 50%;
margin-left: -10px;
}
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-right {
right: 50%;
margin-right: -10px;
}
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 20px;
height: 20px;
font-family: serif;
line-height: 1;
}
.carousel-control .icon-prev:before {
content: '\2039';
}
.carousel-control .icon-next:before {
content: '\203a';
}
.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
z-index: 15;
width: 60%;
padding-left: 0;
margin-left: -30%;
text-align: center;
list-style: none;
}
.carousel-indicators li {
display: inline-block;
width: 10px;
height: 10px;
margin: 1px;
text-indent: -999px;
cursor: pointer;
background-color: #000 \9;
background-color: rgba(0, 0, 0, 0);
border: 1px solid #fff;
border-radius: 10px;
}
.carousel-indicators .active {
width: 12px;
height: 12px;
margin: 0;
background-color: #fff;
}
.carousel-caption {
position: absolute;
right: 15%;
bottom: 20px;
left: 15%;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.carousel-caption .btn {
text-shadow: none;
}
@media screen and (min-width: 768px) {
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right,
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 30px;
height: 30px;
margin-top: -15px;
font-size: 30px;
}
.carousel-control .glyphicon-chevron-left,
.carousel-control .icon-prev {
margin-left: -15px;
}
.carousel-control .glyphicon-chevron-right,
.carousel-control .icon-next {
margin-right: -15px;
}
.carousel-caption {
right: 20%;
left: 20%;
padding-bottom: 30px;
}
.carousel-indicators {
bottom: 20px;
}
}
.clearfix:before,
.clearfix:after,
.dl-horizontal dd:before,
.dl-horizontal dd:after,
.container:before,
.container:after,
.container-fluid:before,
.container-fluid:after,
.row:before,
.row:after,
.form-horizontal .form-group:before,
.form-horizontal .form-group:after,
.btn-toolbar:before,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after,
.nav:before,
.nav:after,
.navbar:before,
.navbar:after,
.navbar-header:before,
.navbar-header:after,
.navbar-collapse:before,
.navbar-collapse:after,
.pager:before,
.pager:after,
.panel-body:before,
.panel-body:after,
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.clearfix:after,
.dl-horizontal dd:after,
.container:after,
.container-fluid:after,
.row:after,
.form-horizontal .form-group:after,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:after,
.nav:after,
.navbar:after,
.navbar-header:after,
.navbar-collapse:after,
.pager:after,
.panel-body:after,
.modal-footer:after {
clear: both;
}
.center-block {
display: block;
margin-right: auto;
margin-left: auto;
}
.pull-right {
float: right !important;
}
.pull-left {
float: left !important;
}
.hide {
display: none !important;
}
.show {
display: block !important;
}
.invisible {
visibility: hidden;
}
.text-hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.hidden {
display: none !important;
}
.affix {
position: fixed;
}
@-ms-viewport {
width: device-width;
}
.visible-xs,
.visible-sm,
.visible-md,
.visible-lg {
display: none !important;
}
.visible-xs-block,
.visible-xs-inline,
.visible-xs-inline-block,
.visible-sm-block,
.visible-sm-inline,
.visible-sm-inline-block,
.visible-md-block,
.visible-md-inline,
.visible-md-inline-block,
.visible-lg-block,
.visible-lg-inline,
.visible-lg-inline-block {
display: none !important;
}
@media (max-width: 767px) {
.visible-xs {
display: block !important;
}
table.visible-xs {
display: table !important;
}
tr.visible-xs {
display: table-row !important;
}
th.visible-xs,
td.visible-xs {
display: table-cell !important;
}
}
@media (max-width: 767px) {
.visible-xs-block {
display: block !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline {
display: inline !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline-block {
display: inline-block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm {
display: block !important;
}
table.visible-sm {
display: table !important;
}
tr.visible-sm {
display: table-row !important;
}
th.visible-sm,
td.visible-sm {
display: table-cell !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-block {
display: block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline {
display: inline !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline-block {
display: inline-block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md {
display: block !important;
}
table.visible-md {
display: table !important;
}
tr.visible-md {
display: table-row !important;
}
th.visible-md,
td.visible-md {
display: table-cell !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-block {
display: block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline {
display: inline !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline-block {
display: inline-block !important;
}
}
@media (min-width: 1200px) {
.visible-lg {
display: block !important;
}
table.visible-lg {
display: table !important;
}
tr.visible-lg {
display: table-row !important;
}
th.visible-lg,
td.visible-lg {
display: table-cell !important;
}
}
@media (min-width: 1200px) {
.visible-lg-block {
display: block !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline {
display: inline !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline-block {
display: inline-block !important;
}
}
@media (max-width: 767px) {
.hidden-xs {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.hidden-sm {
display: none !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-md {
display: none !important;
}
}
@media (min-width: 1200px) {
.hidden-lg {
display: none !important;
}
}
.visible-print {
display: none !important;
}
@media print {
.visible-print {
display: block !important;
}
table.visible-print {
display: table !important;
}
tr.visible-print {
display: table-row !important;
}
th.visible-print,
td.visible-print {
display: table-cell !important;
}
}
.visible-print-block {
display: none !important;
}
@media print {
.visible-print-block {
display: block !important;
}
}
.visible-print-inline {
display: none !important;
}
@media print {
.visible-print-inline {
display: inline !important;
}
}
.visible-print-inline-block {
display: none !important;
}
@media print {
.visible-print-inline-block {
display: inline-block !important;
}
}
@media print {
.hidden-print {
display: none !important;
}
}
/*# sourceMappingURL=bootstrap.css.map */
|
Java
|
---
title: 'Cine este Robul suferind (Isaia 50:4-10)'
date: 28/02/2021
---
Dacă ar fi intenţionat să transmită doar informaţii, Isaia ar fi expus toate detaliile cu privire la Mesia dintr-odată. Dar, ca să înveţe, să convingă şi să îşi ajute audienţa să se întâlnească cu Robul Domnului, el creează o ţesătură bogată de teme care se repetă ca într-o simfonie. Isaia dezvăluie solia lui Dumnezeu în etape pentru ca fiecare aspect să fie înţeles în relaţie cu restul tabloului. Isaia este un artist a cărui pânză este sufletul ascultătorului său.
`1. Fă un rezumat al versetelor de mai jos. Cum Îl vezi pe Isus în acest pasaj? Isaia 50:4-10`
În Isaia 49:7 aflăm că Robul lui Dumnezeu este dispreţuit, urât de popor şi „Robul celor puternici”, dar că „împăraţii vor vedea lucrul acesta şi se vor scula, şi voievozii se vor arunca la pământ şi se vor închina”. În Isaia 50 aflăm că valea este adâncă pentru Învăţătorul cel blând, ale cărui cuvinte îl înviorează pe cel doborât de întristare. Calea spre reabilitare trece prin suferinţe fizice. Felul în care a fost maltratat pare foarte urât pentru noi, cei de azi. Dar, în Orientul Apropiat Antic, onoarea era o chestiune de viaţă şi de moarte pentru un om şi pentru familia sa. Dacă ai fi insultat sau maltratat pe cineva în felul acesta, ai fi făcut bine să te protejezi cât mai serios. Dacă ar fi avut chiar şi cea mai mică posibilitate, victima şi ai săi s-ar fi răzbunat cu siguranţă.
Împăratul David a atacat şi a împresurat ţara lui Amon, pentru că împăratul ei îi dezonorase pe solii trimişi de el (2 Samuel 10:1-12). Dar Isaia spune că Robul este lovit, oamenii Îi smulg barba, cauzându-I o mare durere, şi Îl scuipă. Dar victima este trimisul Împăratului împăraţilor. Comparând Isaia 9:6,7 şi Isaia 11:1-16 cu alte pasaje care vorbesc despre Rob, aflăm că El este Împăratul, Izbăvitorul cel tare! Şi totuşi, cu toată puterea şi onoarea pe care le deţine, din motive greu de imaginat, El nu Se salvează pe Sine! Acest lucru este greu de crezut. Când Isus a fost pe cruce, fruntaşii poporului L-au luat în râs (vezi Luca 23:35; Matei 27:42).
`Ce ar trebui să învăţăm din Isaia 50:4-10 şi să aplicăm în viaţa noastră? În ce domenii am avea nevoie de îmbunătăţiri?`
|
Java
|
/**
* \file
*
* \brief Autogenerated API include file for the Atmel Software Framework (ASF)
*
* Copyright (c) 2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
#ifndef ASF_H
#define ASF_H
/*
* This file includes all API header files for the selected drivers from ASF.
* Note: There might be duplicate includes required by more than one driver.
*
* The file is automatically generated and will be re-written when
* running the ASF driver selector tool. Any changes will be discarded.
*/
// From module: Common SAM compiler driver
#include <compiler.h>
#include <status_codes.h>
// From module: EEFC - Enhanced Embedded Flash Controller
#include <efc.h>
// From module: Flash - SAM Flash Service API
#include <flash_efc.h>
// From module: GPIO - General purpose Input/Output
#include <gpio.h>
// From module: Generic board support
#include <board.h>
// From module: Generic components of unit test framework
#include <unit_test/suite.h>
// From module: IOPORT - General purpose I/O service
#include <ioport.h>
// From module: Interrupt management - SAM implementation
#include <interrupt.h>
// From module: PIO - Parallel Input/Output Controller
#include <pio.h>
// From module: PMC - Power Management Controller
#include <pmc.h>
#include <sleep.h>
// From module: Part identification macros
#include <parts.h>
// From module: SAM3S EK2 LED support enabled
#include <led.h>
// From module: SAM3SD8 startup code
#include <exceptions.h>
// From module: Standard serial I/O (stdio) - SAM implementation
#include <stdio_serial.h>
// From module: System Clock Control - SAM3SD implementation
#include <sysclk.h>
// From module: UART - Univ. Async Rec/Trans
#include <uart.h>
// From module: USART - Serial interface - SAM implementation for devices with both UART and USART
#include <serial.h>
// From module: USART - Univ. Syn Async Rec/Trans
#include <usart.h>
// From module: pio_handler support enabled
#include <pio_handler.h>
#endif // ASF_H
|
Java
|
#pragma once
#include "net/uri.hpp"
namespace http
{
using uri = net::uri;
}
|
Java
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon([/*#__PURE__*/_jsx("path", {
d: "M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m.06 9.34v2.14c-.92.02-1.84-.31-2.54-1.01-1.12-1.12-1.3-2.8-.59-4.13l-1.1-1.1c-1.28 1.94-1.07 4.59.64 6.29.97.98 2.25 1.47 3.53 1.47h.06v2l2.83-2.83-2.83-2.83zm3.48-4.88c-.99-.99-2.3-1.46-3.6-1.45V5L9.11 7.83l2.83 2.83V8.51H12c.9 0 1.79.34 2.48 1.02 1.12 1.12 1.3 2.8.59 4.13l1.1 1.1c1.28-1.94 1.07-4.59-.63-6.3z",
opacity: ".3"
}, "0"), /*#__PURE__*/_jsx("path", {
d: "M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm.06 11.34v2.14c-.92.02-1.84-.31-2.54-1.01-1.12-1.12-1.3-2.8-.59-4.13l-1.1-1.1c-1.28 1.94-1.07 4.59.64 6.29.97.98 2.25 1.47 3.53 1.47h.06v2l2.83-2.83-2.83-2.83zm3.48-4.88c-.99-.99-2.3-1.46-3.6-1.45V5L9.11 7.83l2.83 2.83V8.51H12c.9 0 1.79.34 2.48 1.02 1.12 1.12 1.3 2.8.59 4.13l1.1 1.1c1.28-1.94 1.07-4.59-.63-6.3z"
}, "1")], 'ChangeCircleTwoTone');
|
Java
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging, os
logging.basicConfig(level=logging.INFO)
from deepy.networks import RecursiveAutoEncoder
from deepy.trainers import SGDTrainer, LearningRateAnnealer
from util import get_data, VECTOR_SIZE
model_path = os.path.join(os.path.dirname(__file__), "models", "rae1.gz")
if __name__ == '__main__':
model = RecursiveAutoEncoder(input_dim=VECTOR_SIZE, rep_dim=10)
trainer = SGDTrainer(model)
annealer = LearningRateAnnealer()
trainer.run(get_data(), epoch_controllers=[annealer])
model.save_params(model_path)
|
Java
|
namespace StringExtensions
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
/// <summary>
/// Static class providing various string extension methods:
/// <list type="bullet">
/// <item>
/// <description>ToMd5Hash,</description>
/// </item>
/// <item>
/// <description>ToBoolean,</description>
/// </item>
/// <item>
/// <description>ToShort,</description>
/// </item>
/// <item>
/// <description>ToInteger,</description>
/// </item>
/// <item>
/// <description>ToLong,</description>
/// </item>
/// <item>
/// <description>ToDateTime,</description>
/// </item>
/// <item>
/// <description>CapitalizeFirstLetter,</description>
/// </item>
/// <item>
/// <description>ConvertCyrillicToLatinLetters,</description>
/// </item>
/// <item>
/// <description>ConvertLatinToCyrillicKeyboard,</description>
/// </item>
/// <item>
/// <description>ToValidUsername,</description>
/// </item>
/// <item>
/// <description>ToValidLatinFileName,</description>
/// </item>
/// <item>
/// <description>GetFirstCharacters,</description>
/// </item>
/// <item>
/// <description>GetFileExtension,</description>
/// </item>
/// <item>
/// <description>ToContentType,</description>
/// </item>
/// <item>
/// <description>ToByteArray,</description>
/// </item>
/// </list>
/// </summary>
public static class StringExtensions
{
/// <summary>
/// A string extension method that converts the target string to a byte array, and
/// computes the hashes for each element.
/// Then bytes are formatted as a hexadecimal strings and appended to the resulting
/// string that is finally returned.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>A hexadecimal string</returns>
/// <exception cref="TargetInvocationException">The algorithm was used with Federal Information Processing Standards (FIPS)
/// mode enabled, but is not FIPS compatible.</exception>
public static string ToMd5Hash(this string input)
{
var md5Hash = MD5.Create();
// Convert the input string to a byte array and compute the hash.
var data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
// Create a new StringBuilder to collect the bytes
// and create a string.
var builder = new StringBuilder();
// Loop through each byte of the hashed data
// and format each one as a hexadecimal string.
for (int i = 0; i < data.Length; i++)
{
builder.Append(data[i].ToString("x2"));
}
// Return the hexadecimal string.
return builder.ToString();
}
/// <summary>
/// A string extension method that checks whether the target string is contained within a
/// predefined collection of true-like values.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>Whether the input is among the given true values (True/False)</returns>
public static bool ToBoolean(this string input)
{
var stringTrueValues = new[] { "true", "ok", "yes", "1", "да" };
return stringTrueValues.Contains(input.ToLower());
}
/// <summary>
/// Converts the target string to a short value and returns it.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The short value obtained from parsing the input string</returns>
public static short ToShort(this string input)
{
short shortValue;
short.TryParse(input, out shortValue);
return shortValue;
}
/// <summary>
/// Converts the target string to an integer value and returns it.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The integer value obtained from parsing the input string</returns>
public static int ToInteger(this string input)
{
int integerValue;
int.TryParse(input, out integerValue);
return integerValue;
}
/// <summary>
/// Converts the target string to a long value and returns it.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The long value obtained from parsing the input string</returns>
public static long ToLong(this string input)
{
long longValue;
long.TryParse(input, out longValue);
return longValue;
}
/// <summary>
/// Converts the target string to a DateTime value and returns it.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The DateTime value obtained from parsing the input string</returns>
public static DateTime ToDateTime(this string input)
{
DateTime dateTimeValue;
DateTime.TryParse(input, out dateTimeValue);
return dateTimeValue;
}
/// <summary>
/// Capitalizes the first letter of the target string.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The string with capital first letter.</returns>
public static string CapitalizeFirstLetter(this string input)
{
if (string.IsNullOrEmpty(input))
{
return input;
}
return input.Substring(0, 1).ToUpper(CultureInfo.CurrentCulture) + input.Substring(1, input.Length - 1);
}
/// <summary>
/// Returns the substring between two given substrings.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <param name="startString">The start of the substring</param>
/// <param name="endString">The end of the substring</param>
/// <param name="startFrom">The index to start the search from</param>
/// <returns>The found substring or an empty one</returns>
public static string GetStringBetween(this string input, string startString, string endString, int startFrom = 0)
{
input = input.Substring(startFrom);
startFrom = 0;
if (!input.Contains(startString) || !input.Contains(endString))
{
return string.Empty;
}
var startPosition = input.IndexOf(startString, startFrom, StringComparison.Ordinal) + startString.Length;
if (startPosition == -1)
{
return string.Empty;
}
var endPosition = input.IndexOf(endString, startPosition, StringComparison.Ordinal);
if (endPosition == -1)
{
return string.Empty;
}
return input.Substring(startPosition, endPosition - startPosition);
}
/// <summary>
/// Replaces cyrillic letters in a string with their latin representation.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The new string with latin letters.</returns>
public static string ConvertCyrillicToLatinLetters(this string input)
{
var bulgarianLetters = new[]
{
"а", "б", "в", "г", "д", "е", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п",
"р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ь", "ю", "я"
};
var latinRepresentationsOfBulgarianLetters = new[]
{
"a", "b", "v", "g", "d", "e", "j", "z", "i", "y", "k",
"l", "m", "n", "o", "p", "r", "s", "t", "u", "f", "h",
"c", "ch", "sh", "sht", "u", "i", "yu", "ya"
};
for (var i = 0; i < bulgarianLetters.Length; i++)
{
input = input.Replace(bulgarianLetters[i], latinRepresentationsOfBulgarianLetters[i]);
input = input.Replace(bulgarianLetters[i].ToUpper(), latinRepresentationsOfBulgarianLetters[i].CapitalizeFirstLetter());
}
return input;
}
/// <summary>
/// Replaces latin letters in a string with their cyrillic representation.
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The new string with cyrillic letters.</returns>
public static string ConvertLatinToCyrillicKeyboard(this string input)
{
var latinLetters = new[]
{
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
};
var bulgarianRepresentationOfLatinKeyboard = new[]
{
"а", "б", "ц", "д", "е", "ф", "г", "х", "и", "й", "к",
"л", "м", "н", "о", "п", "я", "р", "с", "т", "у", "ж",
"в", "ь", "ъ", "з"
};
for (int i = 0; i < latinLetters.Length; i++)
{
input = input.Replace(latinLetters[i], bulgarianRepresentationOfLatinKeyboard[i]);
input = input.Replace(latinLetters[i].ToUpper(), bulgarianRepresentationOfLatinKeyboard[i].ToUpper());
}
return input;
}
/// <summary>
/// Converts a string into a valid username
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The string after the cyrllic letters are converted to latin and all characters
/// that are not alpha-numeric, ".", or "_", are removed.</returns>
/// <exception cref="RegexMatchTimeoutException">A time-out occurred. For more information about time-outs, see the Remarks section.</exception>
public static string ToValidUsername(this string input)
{
input = input.ConvertCyrillicToLatinLetters();
return Regex.Replace(input, @"[^a-zA-z0-9_\.]+", string.Empty);
}
/// <summary>
/// Converts a string into a valid latin filename
/// </summary>
/// <param name="input">The string the method is called upon.</param>
/// <returns>The string after the cyrllic letters are converted to latin, spaces are replaced with "-",
/// and all characters that are not alpha-numeric, ".", "-", or "_", are removed.</returns>
/// <exception cref="RegexMatchTimeoutException">A time-out occurred. For more information about time-outs, see the Remarks section.</exception>
public static string ToValidLatinFileName(this string input)
{
input = input.Replace(" ", "-").ConvertCyrillicToLatinLetters();
return Regex.Replace(input, @"[^a-zA-z0-9_\.\-]+", string.Empty);
}
/// <summary>
/// Returns the first n characters from the string, where n is the second parameter.
/// </summary>
/// <param name="input">The string the method is called upon</param>
/// <param name="charsCount">The number of characters to be returned</param>
/// <returns>The first n characters from the string (or the whole string if charsCount
/// is larger than the length of the string).</returns>
public static string GetFirstCharacters(this string input, int charsCount)
{
return input.Substring(0, Math.Min(input.Length, charsCount));
}
/// <summary>
/// Returns the file extension of the given filename.
/// </summary>
/// <param name="fileName">The string (filename) the method is called upon.</param>
/// <returns>The file extension of the filename</returns>
public static string GetFileExtension(this string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
{
return string.Empty;
}
string[] fileParts = fileName.Split(new[] { "." }, StringSplitOptions.None);
if (fileParts.Count() == 1 || string.IsNullOrEmpty(fileParts.Last()))
{
return string.Empty;
}
return fileParts.Last().Trim().ToLower();
}
/// <summary>
/// Returns the content type of a file depending on its extension.
/// </summary>
/// <param name="fileExtension">The file extension</param>
/// <returns>The content type associated with the given file extension</returns>
public static string ToContentType(this string fileExtension)
{
var fileExtensionToContentType = new Dictionary<string, string>
{
{ "jpg", "image/jpeg" },
{ "jpeg", "image/jpeg" },
{ "png", "image/x-png" },
{
"docx",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
{ "doc", "application/msword" },
{ "pdf", "application/pdf" },
{ "txt", "text/plain" },
{ "rtf", "application/rtf" }
};
if (fileExtensionToContentType.ContainsKey(fileExtension.Trim()))
{
return fileExtensionToContentType[fileExtension.Trim()];
}
return "application/octet-stream";
}
/// <summary>
/// Converts a string into an array of bytes
/// </summary>
/// <param name="input">The string the method is called upon</param>
/// <returns>An array of bytes derived from converting every character
/// in the given string to its byte representation</returns>
/// <exception cref="OverflowException">The array is multidimensional and contains more than <see cref="F:System.Int32.MaxValue" /> elements.</exception>
public static byte[] ToByteArray(this string input)
{
var bytesArray = new byte[input.Length * sizeof(char)];
Buffer.BlockCopy(input.ToCharArray(), 0, bytesArray, 0, bytesArray.Length);
return bytesArray;
}
}
}
|
Java
|
<?php declare(strict_types=1);
namespace WyriMaps\Tests\BattleNet\Resource\Async\WorldOfWarcraft;
use ApiClients\Tools\ResourceTestUtilities\AbstractEmptyResourceTest;
use WyriMaps\BattleNet\Resource\Async\WorldOfWarcraft\EmptyQuest;
final class EmptyQuestTest extends AbstractEmptyResourceTest
{
public function getSyncAsync(): string
{
return 'Async';
}
public function getClass(): string
{
return EmptyQuest::class;
}
}
|
Java
|
# Gsp
[](http://travis-ci.org/viclm/gsp)
[](https://david-dm.org/viclm/gsp)
## Intro
Gsp encourages to use multiple git repositories for development and one subversion repository for production to make code clean, it will be in charge of the synchronous work.
Use multiple repositories is very suitable for frontend development, it encourages a independent workflow and can be easly integrated with other tools like JIRA and Phabraicator.
Especially, gsp allow static resource files(like javascript and css) combining across repositories which has great significance to the performance of webpage.
Gsp uses git hooks(pre-commit) to integrate lint and unit tests, besides it support coffee and less autocompiling.
## Installation
Install the application with: `npm install -g gsp`.
## The simulator
Gsp has simulator running for generating temple files based on resource requst, in additon, it can accomplish some tasks like lint and unit tests before commiting changes.
1. Run `gsp pull` in a new directory(path/to/workspace, for example) to clone all the development repositories.
2. Run `gsp start` on directory above to start a simulator for resource requst
3. Config a webserver(nginx/apache/lighttpd) and start
## Config nginx
```text
server {
listen 80;
server_name static.resource.com;
charset utf-8;
location ~* \.(?:ttf|eot|woff)$ {
add_header "Access-Control-Allow-Origin" "*";
expires 1M;
access_log off;
add_header Cache-Control "public";
proxy_set_header x-request-filename $request_filename;
proxy_pass http://127.0.0.1:7070;
}
location ~* /.+\.[a-z]+$ {
proxy_pass http://127.0.0.1:7070;
}
}
```
## Configs for communication
Gsp use a special domain "gsp.com" for interacting with server, this domain must link to the machine where the gsp server runs.
You can bind it in your DNS provider, or just edit the hosts file.
```text
192.168.1.110 gsp.com
```
## Repository configuration
Every development repository should contain a `.gspconfig` file.
```
{
"publish_dir" : "dist",
"mapping_dir" : "app/home",
"lint": {
"js": {
"engine": "eslint",
"config": "eslint.json"
},
"css": {
"engine": "csslint",
"config": "csslint.json"
}
},
"test": {
"engine": "jasmine",
"src_files": "src/**/*.js",
"spec_files": "test/spec/**/*.js",
"helper_files": "test/helper/**/*.js"
},
"compress": {
"png": true
},
"modular": {
"type": "amd",
"idprefix": "home",
"ignore": "+(lib|src|test)/**"
},
"preprocessors": {
"coffee": ["coffee", "modular"],
"less": ["less"],
"js": ["modular"]
}
}
```
## Commands
1. gsp auth update authentication infomation for interacting with subversion repository
2. gsp lint run linter on files changed
3. gsp publish [options] publish git changesets to subversion
4. gsp push git push origin master and publish
5. gsp pull clone/update all the git repositories
6. gsp scaffold [options] generate project scaffolding
7. gsp start [options] start a local proxy server
8. gsp test run test specs against chaned files
9. gsp watch [options] run tasks whenever watched files are added, changed or deleted
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
## Release History
_(Nothing yet)_
## License
Copyright (c) 2014 viclm
Licensed under the MIT license.
|
Java
|
module.exports={A:{A:{"2":"K C G E B A WB"},B:{"2":"D u Y I M H"},C:{"1":"6 7","2":"0 1 2 3 UB z F J K C G E B A D u Y I M H N O P Q R S T U V W X w Z a b c d e f L h i j k l m n o p q r s t y SB RB","132":"v","578":"5 g"},D:{"1":"0 1 2 3 5 6 7 t y v g GB BB DB VB EB","2":"F J K C G E B A D u Y I M H N O P Q R S T U V W X w Z a b c d e f L h i j k l m n o p q r s"},E:{"1":"MB","2":"F J K C G E B FB AB HB IB JB KB LB","322":"A"},F:{"1":"L h i j k l m n o p q r s t","2":"8 9 E A D I M H N O P Q R S T U V W X w Z a b c d e f NB OB PB QB TB x"},G:{"2":"4 G AB CB XB YB ZB aB bB cB dB eB","322":"A"},H:{"2":"fB"},I:{"1":"v","2":"4 z F gB hB iB jB kB lB"},J:{"2":"C B"},K:{"1":"L","2":"8 9 B A D x"},L:{"1":"BB"},M:{"132":"g"},N:{"2":"B A"},O:{"2":"mB"},P:{"1":"J","2":"F"},Q:{"2":"nB"},R:{"2":"oB"}},B:5,C:"Resource Hints: preload"};
|
Java
|
SVG.G = SVG.invent({
// Initialize node
create: 'g'
// Inherit from
, inherit: SVG.Container
// Add class methods
, extend: {
// Move over x-axis
x: function(x) {
return x == null ? this.transform('x') : this.transform({ x: x - this.x() }, true)
}
// Move over y-axis
, y: function(y) {
return y == null ? this.transform('y') : this.transform({ y: y - this.y() }, true)
}
// Move by center over x-axis
, cx: function(x) {
return x == null ? this.gbox().cx : this.x(x - this.gbox().width / 2)
}
// Move by center over y-axis
, cy: function(y) {
return y == null ? this.gbox().cy : this.y(y - this.gbox().height / 2)
}
, gbox: function() {
var bbox = this.bbox()
, trans = this.transform()
bbox.x += trans.x
bbox.x2 += trans.x
bbox.cx += trans.x
bbox.y += trans.y
bbox.y2 += trans.y
bbox.cy += trans.y
return bbox
}
}
// Add parent method
, construct: {
// Create a group element
group: function() {
return this.put(new SVG.G)
}
}
})
|
Java
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Runtime.InteropServices;
namespace Wox
{
public class ImagePathConverter : IMultiValueConverter
{
private static Dictionary<string, object> imageCache = new Dictionary<string, object>();
private static ImageSource GetIcon(string fileName)
{
Icon icon = GetFileIcon(fileName);
if (icon == null) icon = Icon.ExtractAssociatedIcon(fileName);
if (icon != null)
{
return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(icon.Handle, new Int32Rect(0, 0, icon.Width, icon.Height), BitmapSizeOptions.FromEmptyOptions());
}
return null;
}
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
object img = null;
if (values[0] == null) return null;
string path = values[0].ToString();
string pluginDirectory = values[1].ToString();
string fullPath = Path.Combine(pluginDirectory, path);
if (imageCache.ContainsKey(fullPath))
{
return imageCache[fullPath];
}
string resolvedPath = string.Empty;
if (!string.IsNullOrEmpty(path) && path.Contains(":\\") && File.Exists(path))
{
resolvedPath = path;
}
else if (!string.IsNullOrEmpty(path) && File.Exists(fullPath))
{
resolvedPath = fullPath;
}
if (resolvedPath.ToLower().EndsWith(".exe") || resolvedPath.ToLower().EndsWith(".lnk"))
{
img = GetIcon(resolvedPath);
}
else if (!string.IsNullOrEmpty(resolvedPath) && File.Exists(resolvedPath))
{
img = new BitmapImage(new Uri(resolvedPath));
}
if (img != null)
{
imageCache.Add(fullPath, img);
}
return img;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
// http://blogs.msdn.com/b/oldnewthing/archive/2011/01/27/10120844.aspx
public static System.Drawing.Icon GetFileIcon(string name)
{
SHFILEINFO shfi = new SHFILEINFO();
uint flags = SHGFI_SYSICONINDEX;
IntPtr himl = SHGetFileInfo(name,
FILE_ATTRIBUTE_NORMAL,
ref shfi,
(uint)System.Runtime.InteropServices.Marshal.SizeOf(shfi),
flags);
if (himl != IntPtr.Zero)
{
IntPtr hIcon = ImageList_GetIcon(himl, shfi.iIcon, ILD_NORMAL);
System.Drawing.Icon icon = (System.Drawing.Icon)System.Drawing.Icon.FromHandle(hIcon).Clone();
DestroyIcon(hIcon);
return icon;
}
return null;
}
[DllImport("comctl32.dll", SetLastError = true)]
private static extern IntPtr ImageList_GetIcon(IntPtr himl, int i, uint flags);
private const int MAX_PATH = 256;
[StructLayout(LayoutKind.Sequential)]
private struct SHITEMID
{
public ushort cb;
[MarshalAs(UnmanagedType.LPArray)]
public byte[] abID;
}
[StructLayout(LayoutKind.Sequential)]
private struct ITEMIDLIST
{
public SHITEMID mkid;
}
[StructLayout(LayoutKind.Sequential)]
private struct BROWSEINFO
{
public IntPtr hwndOwner;
public IntPtr pidlRoot;
public IntPtr pszDisplayName;
[MarshalAs(UnmanagedType.LPTStr)]
public string lpszTitle;
public uint ulFlags;
public IntPtr lpfn;
public int lParam;
public IntPtr iImage;
}
// Browsing for directory.
private const uint BIF_RETURNONLYFSDIRS = 0x0001;
private const uint BIF_DONTGOBELOWDOMAIN = 0x0002;
private const uint BIF_STATUSTEXT = 0x0004;
private const uint BIF_RETURNFSANCESTORS = 0x0008;
private const uint BIF_EDITBOX = 0x0010;
private const uint BIF_VALIDATE = 0x0020;
private const uint BIF_NEWDIALOGSTYLE = 0x0040;
private const uint BIF_USENEWUI = (BIF_NEWDIALOGSTYLE | BIF_EDITBOX);
private const uint BIF_BROWSEINCLUDEURLS = 0x0080;
private const uint BIF_BROWSEFORCOMPUTER = 0x1000;
private const uint BIF_BROWSEFORPRINTER = 0x2000;
private const uint BIF_BROWSEINCLUDEFILES = 0x4000;
private const uint BIF_SHAREABLE = 0x8000;
[StructLayout(LayoutKind.Sequential)]
private struct SHFILEINFO
{
public const int NAMESIZE = 80;
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)]
public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NAMESIZE)]
public string szTypeName;
};
private const uint SHGFI_ICON = 0x000000100; // get icon
private const uint SHGFI_DISPLAYNAME = 0x000000200; // get display name
private const uint SHGFI_TYPENAME = 0x000000400; // get type name
private const uint SHGFI_ATTRIBUTES = 0x000000800; // get attributes
private const uint SHGFI_ICONLOCATION = 0x000001000; // get icon location
private const uint SHGFI_EXETYPE = 0x000002000; // return exe type
private const uint SHGFI_SYSICONINDEX = 0x000004000; // get system icon index
private const uint SHGFI_LINKOVERLAY = 0x000008000; // put a link overlay on icon
private const uint SHGFI_SELECTED = 0x000010000; // show icon in selected state
private const uint SHGFI_ATTR_SPECIFIED = 0x000020000; // get only specified attributes
private const uint SHGFI_LARGEICON = 0x000000000; // get large icon
private const uint SHGFI_SMALLICON = 0x000000001; // get small icon
private const uint SHGFI_OPENICON = 0x000000002; // get open icon
private const uint SHGFI_SHELLICONSIZE = 0x000000004; // get shell size icon
private const uint SHGFI_PIDL = 0x000000008; // pszPath is a pidl
private const uint SHGFI_USEFILEATTRIBUTES = 0x000000010; // use passed dwFileAttribute
private const uint SHGFI_ADDOVERLAYS = 0x000000020; // apply the appropriate overlays
private const uint SHGFI_OVERLAYINDEX = 0x000000040; // Get the index of the overlay
private const uint FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
private const uint FILE_ATTRIBUTE_NORMAL = 0x00000080;
private const uint ILD_NORMAL = 0x00000000;
[DllImport("Shell32.dll")]
private static extern IntPtr SHGetFileInfo(
string pszPath,
uint dwFileAttributes,
ref SHFILEINFO psfi,
uint cbFileInfo,
uint uFlags
);
[DllImport("User32.dll")]
private static extern int DestroyIcon(IntPtr hIcon);
}
}
|
Java
|
--TEST--
/** test \n*/
--SKIPIF--
<?php
if (!@include_once('PhpDocumentor/phpDocumentor/DocBlock/Lexer.inc')) {
echo 'skip needs PhpDocumentor_DocBlock_Lexer class';
}
?>
--FILE--
<?php
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
$result = $lexer->lex("/** test \n*/");
$phpt->assertEquals(array(
array(PHPDOC_DOCBLOCK_TOKEN_DESC, ' test'),
array(PHPDOC_DOCBLOCK_TOKEN_NEWLINE, "\n")
), $result, 'result 1');
$result = $lexer->lex("/** test \r\n*/");
$phpt->assertEquals(array(
array(PHPDOC_DOCBLOCK_TOKEN_DESC, ' test'),
array(PHPDOC_DOCBLOCK_TOKEN_NEWLINE, "\n")
), $result, 'result');
$result = $lexer->lex("/** test \r*/");
$phpt->assertEquals(array(
array(PHPDOC_DOCBLOCK_TOKEN_DESC, ' test'),
array(PHPDOC_DOCBLOCK_TOKEN_NEWLINE, "\n")
), $result, 'result');
echo 'test done';
?>
--EXPECT--
test done
|
Java
|
using System.Data.Entity.Migrations;
namespace Cake.EntityFramework.TestProject.Postgres.Migrations
{
public partial class V7 : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}
|
Java
|
---
layout: post
title: Objetos Validadores
date: 2017-07-03
permalink: /:title
description:
Veja como fazer validações utilizando Objetos ao invés de utilizar programação procedural.
image: /images/2017/photo-scott-webb-59043.jpg
categories:
- OO
tags:
- validação
keywords:
- freepascal
- fpc
- delphi
- lazarus
- pascal
- object-pascal
- object-oriented
- oop
- mdbs99
- validation
- validação
- teste
- testing
- validando
---
Veja como fazer validações utilizando Objetos ao invés de utilizar programação procedural.
<!--more-->

## Introdução {#introducao}
Na Orientação a Objetos a codificação deve ser declarativa. Isso quer dizer que, num mundo ideal, iríamos criar os Objetos agrupando-os entre si e, com uma única [mensagem]({% post_url 2016-11-14-diga-me-algo-sobre-voce %}#mensagens), o trabalho a ser realizado seria iniciado e cada Objeto iria realizar parte desse trabalho. Tudo em perfeita harmonia.
No entanto, não vivemos num mundo ideal e problemas podem ocorrer.
Se pudermos validar o *input* dos dados no nosso sistema antes de iniciar um processo mais elaborado, isso tornaria o processamento menos custoso, menos demorado e menos propenso a erros.
No entanto, se devemos codificar de forma declarativa, ou seja, sem condicionais que validem passo-a-passo o que está sendo processado — o *modus operandis* da programação procedural — como seria possível fazer isso utilizando Objetos para deixar o código mais seguro e fazer um tratamento mais adequado para cada problema ou decisão, antes que uma exceção possa ocorrer?
## Validações {#validacoes}
Imagine um Formulário onde há diversos campos para o usuário preencher antes de clicar em algum botão que irá fazer algo com os dados preenchidos nos *widgets*.
Sempre temos que validar o *input* antes de processá-lo, certo?
Tenho trabalhado com desenvolvimento de *software* a muitos anos. Grande parte desse tempo eu codifiquei a validação de campos utilizando o mesmo "padrão" que até hoje é utilizado, independentemente da linguagem utilizada.
Vejamos como é esse padrão:
<script src="https://gist.github.com/mdbs99/1d990d474d0a15a7543c54c5c02b370a.js"></script>
O exemplo acima é sobre um Formulário que contém alguns campos, dentre esses campos temos `Name` e `Birthday`. O primeiro é *string* e não pode estar em branco. Já o segundo deveria ser uma data válida, então o código utiliza a função padrão `SysUtils.TryStrToDate` que verifica se é uma data válida e retorna o valor na variável `MyDate`.
Quem nunca fez isso?
Pois é.
Há problemas demais com essa abordagem:
1. Não podemos reutilizar as validações. Em cada Formulário haverá uma possível cópia do mesmo código;
2. As variáveis locais podem aumentar consideravelmente caso haja mais testes que necessitem de variáveis;
3. O código é totalmente procedural;
4. Não posso utilizar as informações de aviso ao usuário em outra aplicação Web, por exemplo, visto que as *strings* estão codificadas dentro de funções `ShowMessage` (ou qualquer outra função de mensagem para Desktop);
5. O Formulário ficou complexo, visto que há muito código num único evento — e não adianta apenas criar vários métodos privados para cada teste, pois o Formulário irá continuar fazendo coisas demais.
Há variantes dessa abordagem acima, porém acredito que todos nós já vimos algo assim ou mesmo estamos codificando dessa maneira ainda hoje.
O que podemos fazer para simplificar o código, obter a reutilização das validações e ainda codificar utilizando Orientação a Objetos?
## Constraints {#constraints}
*Constraints* são Objetos que tem por função a validação de algum dado ou mesmo a validação de outro Objeto.
Cada *constraint* valida apenas 1 artefato. Assim podemos reutilizar a validação em muitos outros lugares.
Vamos definir algumas [Interfaces]({% post_url 2016-01-18-interfaces-em-todo-lugar %}):
<script src="https://gist.github.com/mdbs99/c668747123d651298e9f40d0e10af5b4.js"></script>
Vamos entender cada Interface:
1. `[guids]`: São necessários para *casting* de Interfaces.
2. `IDataInformation`: Representa uma infomação.
3. `IDataInformations`: Representa uma lista de informações.
4. `IDataResult`: Representa um resultado de uma restrição.
5. `IDataConstraint`: Representa uma restrição.
6. `IDataConstraints`: Representa uma lista de restrições.
Não estou utilizando *Generics*. Apenas Classes que podem ser reescritas em praticamente qualquer versão do Lazarus ou Delphi.
Bem simples.
Agora veremos a implementação das Interfaces — por questões de breviedade, vou apresentar somente as assinaturas das Classes:
<script src="https://gist.github.com/mdbs99/b254ff882ce27ce9fa4e8219c63e3e96.js"></script>
Essas são Classes utilizadas em projetos reais. <del>Em breve</del> todo o código <del>estará</del> já está disponível no [Projeto James](https://github.com/mdbs99/james). Você poderá obter esse código acompanhando a [Issue #17](https://github.com/mdbs99/james/issues/17) do mesmo projeto.
Na implementação acima não tem nenhuma Classe que implemente a Interface `IDataConstraint`. O motivo disso é que você, programador, irá criar suas próprias *constraints*.
Vejamos um exemplo de como reescrever o código procedural do primeiro exemplo.
Precisamos criar duas Classes que implementam `IDataConstraint`.
Como só há apenas 1 método nessa Interface, e para não deixar esse artigo ainda maior, vou mostrar o código de apenas uma implementação:
<script src="https://gist.github.com/mdbs99/62040307d41fbc45c0f15605acc541b5.js"></script>
O código acima mostra como seria a implementação para a *constraint* `TNameConstraint`.
O código está *procedural* e ainda pode *melhorar* muito. As variáveis locais poderiam ser retiradas, bastando adicionar mais um *overload* do método `New` na Classe `TDataResult` — você consegue ver essa possibilidade? Conseguiria implementá-la?
Abaixo o código de como utilizar todos esses Objetos em conjunto:
<script src="https://gist.github.com/mdbs99/5dc64c57916d86d01de561077d831aaf.js"></script>
Se nas validações acima o nome estivesse *em branco* mas a data de aniverário tivesse sido digitada *corretamente* — o resultado do método `OK` será verdadeiro se apenas todas as validações passarem no teste — o resultado do `ShowMessage` poderia ser:
- Name: Name is empty
- Birthday: OK
Essa seria apenas uma versão da implementação de como mostrar as informações. Poderia haver muitos outros *decoradores* para mostrar a informação em outros formatos como, por exemplo, HTML numa aplicação Web.
## Conclusão {#conclusao}
O código não está completo, mas acredito que posso ter aberto sua mente a novas possibilidades quando se trata de validações.
O resultado final de `SaveButtonClick`, mesmo utilizando a Classe `TDataConstraints`, também não foi implementada complemente seguindo o paradigma da Orientação a Objetos — para deixar o código mais sucinto — pois tem um `IF` lá que não deixa o código tão elegante quanto deveria, mas eu acho que dá para você visualizar as possibilidades de uso.
A instância de `TDataConstraints` e seus itens poderia ser utilizada em muitos outros lugares do código.
A combinação de tais Objetos é virtualmente infinita e seu será o mesmo em *todo* código.
O código é *reutilizável* em qualquer tipo de aplicação.
Nenhuma informação ou mensagem ao usuário seria duplicada no código. Haverá apenas um *único* lugar, uma única Classe, para fazer a manutenção de cada validação.
E a exibição da mensagem poderia ser em qualquer formato, bastando utilizar outros Objetos *decoradores* para ler as *informations*, formatando como quiser.
Até logo.
|
Java
|
// This file is distributed under the BSD License.
// See "license.txt" for details.
// Copyright 2009-2012, Jonathan Turner (jonathan@emptycrate.com)
// Copyright 2009-2015, Jason Turner (jason@emptycrate.com)
// http://www.chaiscript.com
#ifndef CHAISCRIPT_BOXED_VALUE_HPP_
#define CHAISCRIPT_BOXED_VALUE_HPP_
#include <functional>
#include <map>
#include <memory>
#include <type_traits>
#include "../chaiscript_threading.hpp"
#include "../chaiscript_defines.hpp"
#include "any.hpp"
#include "type_info.hpp"
namespace chaiscript
{
/// \brief A wrapper for holding any valid C++ type. All types in ChaiScript are Boxed_Value objects
/// \sa chaiscript::boxed_cast
class Boxed_Value
{
public:
/// used for explicitly creating a "void" object
struct Void_Type
{
};
private:
/// structure which holds the internal state of a Boxed_Value
/// \todo Get rid of Any and merge it with this, reducing an allocation in the process
struct Data
{
Data(const Type_Info &ti,
chaiscript::detail::Any to,
bool tr,
const void *t_void_ptr)
: m_type_info(ti), m_obj(std::move(to)), m_data_ptr(ti.is_const()?nullptr:const_cast<void *>(t_void_ptr)), m_const_data_ptr(t_void_ptr),
m_is_ref(tr)
{
}
Data &operator=(const Data &rhs)
{
m_type_info = rhs.m_type_info;
m_obj = rhs.m_obj;
m_is_ref = rhs.m_is_ref;
m_data_ptr = rhs.m_data_ptr;
m_const_data_ptr = rhs.m_const_data_ptr;
if (rhs.m_attrs)
{
m_attrs = std::unique_ptr<std::map<std::string, Boxed_Value>>(new std::map<std::string, Boxed_Value>(*rhs.m_attrs));
}
return *this;
}
Data(const Data &) = delete;
#if !defined(__APPLE__) && (!defined(_MSC_VER) || _MSC_VER != 1800)
Data(Data &&) = default;
Data &operator=(Data &&rhs) = default;
#endif
Type_Info m_type_info;
chaiscript::detail::Any m_obj;
void *m_data_ptr;
const void *m_const_data_ptr;
std::unique_ptr<std::map<std::string, Boxed_Value>> m_attrs;
bool m_is_ref;
};
struct Object_Data
{
static std::shared_ptr<Data> get(Boxed_Value::Void_Type)
{
return std::make_shared<Data>(
detail::Get_Type_Info<void>::get(),
chaiscript::detail::Any(),
false,
nullptr)
;
}
template<typename T>
static std::shared_ptr<Data> get(const std::shared_ptr<T> *obj)
{
return get(*obj);
}
template<typename T>
static std::shared_ptr<Data> get(const std::shared_ptr<T> &obj)
{
return std::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
chaiscript::detail::Any(obj),
false,
obj.get()
);
}
template<typename T>
static std::shared_ptr<Data> get(std::shared_ptr<T> &&obj)
{
auto ptr = obj.get();
return std::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
chaiscript::detail::Any(std::move(obj)),
false,
ptr
);
}
template<typename T>
static std::shared_ptr<Data> get(T *t)
{
return get(std::ref(*t));
}
template<typename T>
static std::shared_ptr<Data> get(const T *t)
{
return get(std::cref(*t));
}
template<typename T>
static std::shared_ptr<Data> get(std::reference_wrapper<T> obj)
{
auto p = &obj.get();
return std::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
chaiscript::detail::Any(std::move(obj)),
true,
p
);
}
template<typename T>
static std::shared_ptr<Data> get(T t)
{
auto p = std::make_shared<T>(std::move(t));
auto ptr = p.get();
return std::make_shared<Data>(
detail::Get_Type_Info<T>::get(),
chaiscript::detail::Any(std::move(p)),
false,
ptr
);
}
static std::shared_ptr<Data> get()
{
return std::make_shared<Data>(
Type_Info(),
chaiscript::detail::Any(),
false,
nullptr
);
}
};
public:
/// Basic Boxed_Value constructor
template<typename T,
typename = typename std::enable_if<!std::is_same<Boxed_Value, typename std::decay<T>::type>::value>::type>
explicit Boxed_Value(T &&t)
: m_data(Object_Data::get(std::forward<T>(t)))
{
}
/// Unknown-type constructor
Boxed_Value()
: m_data(Object_Data::get())
{
}
#if !defined(_MSC_VER) || _MSC_VER != 1800
Boxed_Value(Boxed_Value&&) = default;
Boxed_Value& operator=(Boxed_Value&&) = default;
#endif
Boxed_Value(const Boxed_Value&) = default;
Boxed_Value& operator=(const Boxed_Value&) = default;
void swap(Boxed_Value &rhs)
{
std::swap(m_data, rhs.m_data);
}
/// Copy the values stored in rhs.m_data to m_data.
/// m_data pointers are not shared in this case
Boxed_Value assign(const Boxed_Value &rhs)
{
(*m_data) = (*rhs.m_data);
return *this;
}
const Type_Info &get_type_info() const CHAISCRIPT_NOEXCEPT
{
return m_data->m_type_info;
}
/// return true if the object is uninitialized
bool is_undef() const CHAISCRIPT_NOEXCEPT
{
return m_data->m_type_info.is_undef();
}
bool is_const() const CHAISCRIPT_NOEXCEPT
{
return m_data->m_type_info.is_const();
}
bool is_type(const Type_Info &ti) const CHAISCRIPT_NOEXCEPT
{
return m_data->m_type_info.bare_equal(ti);
}
bool is_null() const CHAISCRIPT_NOEXCEPT
{
return (m_data->m_data_ptr == nullptr && m_data->m_const_data_ptr == nullptr);
}
const chaiscript::detail::Any & get() const CHAISCRIPT_NOEXCEPT
{
return m_data->m_obj;
}
bool is_ref() const CHAISCRIPT_NOEXCEPT
{
return m_data->m_is_ref;
}
bool is_pointer() const CHAISCRIPT_NOEXCEPT
{
return !is_ref();
}
void *get_ptr() const CHAISCRIPT_NOEXCEPT
{
return m_data->m_data_ptr;
}
const void *get_const_ptr() const CHAISCRIPT_NOEXCEPT
{
return m_data->m_const_data_ptr;
}
Boxed_Value get_attr(const std::string &t_name)
{
if (!m_data->m_attrs)
{
m_data->m_attrs = std::unique_ptr<std::map<std::string, Boxed_Value>>(new std::map<std::string, Boxed_Value>());
}
return (*m_data->m_attrs)[t_name];
}
Boxed_Value ©_attrs(const Boxed_Value &t_obj)
{
if (t_obj.m_data->m_attrs)
{
m_data->m_attrs = std::unique_ptr<std::map<std::string, Boxed_Value>>(new std::map<std::string, Boxed_Value>(*t_obj.m_data->m_attrs));
}
return *this;
}
/// \returns true if the two Boxed_Values share the same internal type
static bool type_match(const Boxed_Value &l, const Boxed_Value &r) CHAISCRIPT_NOEXCEPT
{
return l.get_type_info() == r.get_type_info();
}
private:
std::shared_ptr<Data> m_data;
};
/// @brief Creates a Boxed_Value. If the object passed in is a value type, it is copied. If it is a pointer, std::shared_ptr, or std::reference_type
/// a copy is not made.
/// @param t The value to box
///
/// Example:
///
/// ~~~{.cpp}
/// int i;
/// chaiscript::ChaiScript chai;
/// chai.add(chaiscript::var(i), "i");
/// chai.add(chaiscript::var(&i), "ip");
/// ~~~
///
/// @sa @ref adding_objects
template<typename T>
Boxed_Value var(T t)
{
return Boxed_Value(t);
}
namespace detail {
/// \brief Takes a value, copies it and returns a Boxed_Value object that is immutable
/// \param[in] t Value to copy and make const
/// \returns Immutable Boxed_Value
/// \sa Boxed_Value::is_const
template<typename T>
Boxed_Value const_var_impl(const T &t)
{
return Boxed_Value(std::make_shared<typename std::add_const<T>::type >(t));
}
/// \brief Takes a pointer to a value, adds const to the pointed to type and returns an immutable Boxed_Value.
/// Does not copy the pointed to value.
/// \param[in] t Pointer to make immutable
/// \returns Immutable Boxed_Value
/// \sa Boxed_Value::is_const
template<typename T>
Boxed_Value const_var_impl(T *t)
{
return Boxed_Value( const_cast<typename std::add_const<T>::type *>(t) );
}
/// \brief Takes a std::shared_ptr to a value, adds const to the pointed to type and returns an immutable Boxed_Value.
/// Does not copy the pointed to value.
/// \param[in] t Pointer to make immutable
/// \returns Immutable Boxed_Value
/// \sa Boxed_Value::is_const
template<typename T>
Boxed_Value const_var_impl(const std::shared_ptr<T> &t)
{
return Boxed_Value( std::const_pointer_cast<typename std::add_const<T>::type>(t) );
}
/// \brief Takes a std::reference_wrapper value, adds const to the referenced type and returns an immutable Boxed_Value.
/// Does not copy the referenced value.
/// \param[in] t Reference object to make immutable
/// \returns Immutable Boxed_Value
/// \sa Boxed_Value::is_const
template<typename T>
Boxed_Value const_var_impl(const std::reference_wrapper<T> &t)
{
return Boxed_Value( std::cref(t.get()) );
}
}
/// \brief Takes an object and returns an immutable Boxed_Value. If the object is a std::reference or pointer type
/// the value is not copied. If it is an object type, it is copied.
/// \param[in] t Object to make immutable
/// \returns Immutable Boxed_Value
/// \sa chaiscript::Boxed_Value::is_const
/// \sa chaiscript::var
///
/// Example:
/// \code
/// enum Colors
/// {
/// Blue,
/// Green,
/// Red
/// };
/// chaiscript::ChaiScript chai
/// chai.add(chaiscript::const_var(Blue), "Blue"); // add immutable constant
/// chai.add(chaiscript::const_var(Red), "Red");
/// chai.add(chaiscript::const_var(Green), "Green");
/// \endcode
///
/// \todo support C++11 strongly typed enums
/// \sa \ref adding_objects
template<typename T>
Boxed_Value const_var(const T &t)
{
return detail::const_var_impl(t);
}
}
#endif
|
Java
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.auth;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Simple implementation AWSCredentials that reads in AWS access keys from a
* properties file. The AWS access key is expected to be in the "accessKey"
* property and the AWS secret key id is expected to be in the "secretKey"
* property.
*/
public class PropertiesCredentials implements AWSCredentials {
private final String accessKey;
private final String secretAccessKey;
/**
* Reads the specified file as a Java properties file and extracts the
* AWS access key from the "accessKey" property and AWS secret access
* key from the "secretKey" property. If the specified file doesn't
* contain the AWS access keys an IOException will be thrown.
*
* @param file
* The file from which to read the AWS credentials
* properties.
*
* @throws FileNotFoundException
* If the specified file isn't found.
* @throws IOException
* If any problems are encountered reading the AWS access
* keys from the specified file.
* @throws IllegalArgumentException
* If the specified properties file does not contain the
* required keys.
*/
public PropertiesCredentials(File file) throws FileNotFoundException, IOException, IllegalArgumentException {
if (!file.exists()) {
throw new FileNotFoundException("File doesn't exist: "
+ file.getAbsolutePath());
}
FileInputStream stream = new FileInputStream(file);
try {
Properties accountProperties = new Properties();
accountProperties.load(stream);
if (accountProperties.getProperty("accessKey") == null ||
accountProperties.getProperty("secretKey") == null) {
throw new IllegalArgumentException(
"The specified file (" + file.getAbsolutePath()
+ ") doesn't contain the expected properties 'accessKey' "
+ "and 'secretKey'."
);
}
accessKey = accountProperties.getProperty("accessKey");
secretAccessKey = accountProperties.getProperty("secretKey");
} finally {
try {
stream.close();
} catch (IOException e) {
}
}
}
/**
* Reads the specified input stream as a stream of Java properties file
* content and extracts the AWS access key ID and secret access key from the
* properties.
*
* @param inputStream
* The input stream containing the AWS credential properties.
*
* @throws IOException
* If any problems occur while reading from the input stream.
*/
public PropertiesCredentials(InputStream inputStream) throws IOException {
Properties accountProperties = new Properties();
try {
accountProperties.load(inputStream);
} finally {
try {inputStream.close();} catch (Exception e) {}
}
if (accountProperties.getProperty("accessKey") == null ||
accountProperties.getProperty("secretKey") == null) {
throw new IllegalArgumentException("The specified properties data " +
"doesn't contain the expected properties 'accessKey' and 'secretKey'.");
}
accessKey = accountProperties.getProperty("accessKey");
secretAccessKey = accountProperties.getProperty("secretKey");
}
/* (non-Javadoc)
* @see com.amazonaws.auth.AWSCredentials#getAWSAccessKeyId()
*/
public String getAWSAccessKeyId() {
return accessKey;
}
/* (non-Javadoc)
* @see com.amazonaws.auth.AWSCredentials#getAWSSecretKey()
*/
public String getAWSSecretKey() {
return secretAccessKey;
}
}
|
Java
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.s3.transfer;
import java.io.File;
import com.amazonaws.services.s3.model.ObjectMetadata;
/**
* This is the callback interface which is used by TransferManager.uploadDirectory and
* TransferManager.uploadFileList. The callback is invoked for each file that is uploaded by
* <code>TransferManager</code> and given an opportunity to specify the metadata for each file.
*/
public interface ObjectMetadataProvider {
/*
* This method is called for every file that is uploaded by <code>TransferManager</code>
* and gives an opportunity to specify the metadata for the file.
*
* @param file
* The file being uploaded.
*
* @param metadata
* The default metadata for the file. You can modify this object to specify
* your own metadata.
*/
public void provideObjectMetadata(final File file, final ObjectMetadata metadata);
}
|
Java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.