answer
stringlengths
15
1.25M
define(['knockout', 'grammar', 'productionrule', 'utils'], function(ko, Grammar, ProductionRule, utils) { 'use strict'; function <API key>(grammar) { var unreachable = [], nt = grammar.nonTerminalSymbols(), s = grammar.<API key>(); for (var i = 0, l = nt.length; i < l; ++i) { if (nt[i] === s) { continue; } var found = false; for (var j = 0, k = nt.length; j < k && !found; ++j) { if (i === j) { continue; } var prods = grammar.getProductions(nt[j]); for (var x = 0, y = prods.length; x < y; ++x) { if (prods[x].indexOf(nt[i]) !== -1) { found = true; break; } } } if (!found) { unreachable.push(nt[i]); } } return unreachable; } function findSterileSymbols(grammar) { var steriles = [], rules = grammar.productionRules(); for (var i = 0, l = rules.length; i < l; ++i) { var found = false, left = rules[i].leftSide(), right = rules[i].rightSide(); for (var j = 0, k = right.length; j < k && !found; ++j) { if (right[j].indexOf(left) === -1) { found = true; break; } } if (!found) { steriles.push(left); } } return steriles; } function <API key>(grammar) { var rules = grammar.productionRules(); var nt = grammar.nonTerminalSymbols(); var s = grammar.<API key>(); for (var i = 0, l = rules.length; i < l; ++i) { var left = rules[i].leftSide(); if (left === s) { continue; } var prods = rules[i].rightSide(); for (var j = 0; j < prods.length; ++j) { if ( (prods[j][0] === left) || (nt.indexOf(prods[j][0]) === -1) ) { continue; } var otherProds = grammar.getProductions(prods[j][0]); var rest = prods[j].substr(1); for (var k = 0, m = otherProds.length; k < m; ++k) { otherProds[k] = otherProds[k] + rest; } prods.splice.apply(prods, [j--, 1].concat(otherProds)); } } return rules; } return { <API key>: function(grammar) { var newGrammar = new Grammar(ko.toJS(grammar)); var sterile = findSterileSymbols(newGrammar), unreachable = <API key>(newGrammar), useless = utils.arrayUnion(sterile, unreachable), nt = newGrammar.nonTerminalSymbols(); newGrammar.nonTerminalSymbols(utils.arrayRemove(nt, utils.arrayUnion(sterile, unreachable))); newGrammar.removeSymbolRules(useless); var rules = newGrammar.productionRules(); for (var i = 0, l = rules.length; i < l; ++i) { var right = rules[i].rightSide(); for (var j = 0, m = useless.length; j < m; ++j) { for (var k = 0; k < right.length; ++k) { if (right[k].indexOf(useless[j]) !== -1) { right.splice(k } } } rules[i].rightSide(utils.arrayUnique(right)); } newGrammar.productionRules(rules); return newGrammar; }, <API key>: function(grammar) { var newGrammar = new Grammar(ko.toJS(grammar)); var newStart; var rules = newGrammar.productionRules(); for (var i = 0, l = rules.length; i < l; ++i) { var left = rules[i].leftSide(); var right = rules[i].rightSide(); var emptyIndex = right.indexOf(ProductionRule.EPSILON); if (emptyIndex === -1) { continue; } if (left === newGrammar.<API key>()) { newStart = new ProductionRule(newGrammar, { leftSide: left + "'", rightSide: [left, ProductionRule.EPSILON] }); } for (var j = 0; j < l; ++j) { var rightOther = rules[j].rightSide(); for (var k = 0, m = rightOther.length; k < m; ++k) { if (rightOther[k].indexOf(left) !== -1) { rightOther.push(rightOther[k].replace(new RegExp(left, 'g'), '')); } } rules[j].rightSide(utils.arrayUnique(rightOther)); } right.splice(emptyIndex, 1); rules[i].rightSide(utils.arrayUnique(right)); } if (newStart) { rules.unshift(newStart); newGrammar.<API key>(newStart.leftSide()); newGrammar.nonTerminalSymbols([newStart.leftSide()].concat(newGrammar.nonTerminalSymbols())); } newGrammar.productionRules(rules); return newGrammar; }, factor: function(grammar) { var newGrammar = new Grammar(ko.toJS(grammar)); var rules = <API key>(newGrammar); var newRules = []; for (var i = 0; i < rules.length; ++i) { var left = rules[i].leftSide(); var right = rules[i].rightSide(); var newRight = []; var firstSymbolGrouped = {}; for (var j = 0, l = right.length; j < l; ++j) { if (right[j].length === 1) { newRight.push(right[j]); } else { var firstSymbol = right[j][0]; if (!firstSymbolGrouped[firstSymbol]) { firstSymbolGrouped[firstSymbol] = []; } firstSymbolGrouped[firstSymbol].push(right[j].substr(1)); } } newRules.push(rules[i]); for (var j in firstSymbolGrouped) { if (firstSymbolGrouped[j].length > 1) { var newSymbol = newGrammar.<API key>(left); newRight.push(j + newSymbol); newRules.push(new ProductionRule(newGrammar, { leftSide: newSymbol, rightSide: firstSymbolGrouped[j] })); } else { newRight.push(j + firstSymbolGrouped[j][0]); } } rules[i].rightSide(utils.arrayUnique(newRight)); } newGrammar.productionRules(newRules); return newGrammar; }, removeLeftRecursion: function(grammar) { var newGrammar = new Grammar(ko.toJS(grammar)); var rules = newGrammar.productionRules(); var newRules = []; for (var i = 0, l = rules.length; i < l; ++i) { var left = rules[i].leftSide(); var prods = rules[i].rightSide(); var recursives = []; newRules.push(rules[i]); for (var j = 0; j < prods.length; ++j) { if (prods[j][0] === left && prods[j].length > 1) { var newSymbol = newGrammar.<API key>(left); recursives.push(newSymbol); newRules.push(new ProductionRule(newGrammar, { leftSide: newSymbol, rightSide: [prods[j].substr(1) + newSymbol, ProductionRule.EPSILON] })); prods.splice(j } } var newProds = []; if (recursives.length === 0) { newProds = prods.slice(); } else { for (var j = 0; j < prods.length; ++j) { for (var k = 0; k < recursives.length; ++k) { newProds.push(prods[j] + recursives[k]); } } } rules[i].rightSide(newProds); } newGrammar.productionRules(newRules); return newGrammar; } }; });
/** * Uploader implementation - with the Connection object in ExtJS 4 * */ Ext.define('MyApp.ux.panel.upload.uploader.ExtJsUploader', { extend : 'MyApp.ux.panel.upload.uploader.AbstractXhrUploader', requires : [ 'MyApp.ux.panel.upload.data.Connection' ], config : { /** * @cfg {String} [method='PUT'] * * The HTTP method to be used. */ method : 'PUT', /** * @cfg {Ext.data.Connection} * * If set, this connection object will be used when uploading files. */ connection : null }, /** * @property * @private * * The connection object. */ conn : null, /** * @private * * Initializes and returns the connection object. * * @return {MyApp.ux.panel.upload.data.Connection} */ initConnection : function() { var conn, url = this.url; console.log('[ExtJsUploader initConnection params', this.params); if (this.connection instanceof Ext.data.Connection) { console.log('[ExtJsUploader] instanceof Connection'); conn = this.connection; } else { console.log('[ExtJsUploader] !! instanceof Connection'); if (this.params) { url = Ext.urlAppend(url, Ext.urlEncode(this.params)); } conn = Ext.create('MyApp.ux.panel.upload.data.Connection', { disableCaching : true, method : this.method, url : url, timeout : this.timeout, defaultHeaders : { 'Content-Type' : this.contentType, 'X-Requested-With' : 'XMLHttpRequest' } }); } return conn; }, /** * @protected */ initHeaders : function(item) { console.log('[ExtJsUploader] initHeaders', item); var headers = this.callParent(arguments); headers['Content-Type'] = item.getType(); return headers; }, /** * Implements {@link MyApp.ux.panel.upload.uploader.AbstractUploader#uploadItem} * * @param {MyApp.ux.panel.upload.Item} * item */ uploadItem : function(item) { console.log('ExtJsUploader uploadItem', item); var file = item.getFileApiObject(); if (!file) { return; } item.setUploading(); // tony this.params = { folder : item.getRemoteFolder() }; this.conn = this.initConnection(); console.log('ExtJsUploader conn', this.conn); this.conn.request({ scope : this, headers : this.initHeaders(item), rawData : file, timeout : MyApp.Const.<API key>, // tony success : Ext.Function.bind(this.onUploadSuccess, this, [ item ], true), failure : Ext.Function.bind(this.onUploadFailure, this, [ item ], true), progress : Ext.Function.bind(this.onUploadProgress, this, [ item ], true) }); }, /** * Implements {@link MyApp.ux.panel.upload.uploader.AbstractUploader#abortUpload} */ abortUpload : function() { if (this.conn) { /* * If we don't suspend the events, the connection abortion will cause a failure event. */ this.suspendEvents(); console.log('abort conn', conn); this.conn.abort(); this.resumeEvents(); } } });
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using NSubstitute; using Nancy; using Nancy.Routing; using PactNet.Logging; using PactNet.Mocks.MockHttpService; using PactNet.Mocks.MockHttpService.Nancy; using Xunit; namespace PactNet.Tests.Mocks.MockHttpService.Nancy { public class <API key> { private <API key> _mockRequestHandler; private <API key> <API key>; private ILog _log; private IRequestDispatcher GetSubject() { _mockRequestHandler = Substitute.For<<API key>>(); <API key> = Substitute.For<<API key>>(); _log = Substitute.For<ILog>(); return new <API key>(_mockRequestHandler, <API key>, _log, new PactConfig()); } [Fact] public void <API key>() { var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var requestDispatcher = GetSubject(); _mockRequestHandler.Handle(nancyContext).Returns(new Response()); requestDispatcher.Dispatch(nancyContext, CancellationToken.None); _mockRequestHandler.Received(1).Handle(nancyContext); } [Fact] public void Dispatch_WithNancyContextThatContainsAdminHeader_CallsAdminRequestHandlerWithContext() { var headers = new Dictionary<string, IEnumerable<string>> { { Constants.<API key>, new List<string> { "true" } } }; var nancyContext = new NancyContext { Request = new Request("GET", new Url { Path = "/Test", Scheme = "HTTP" }, null, headers) }; var requestDispatcher = GetSubject(); <API key>.Handle(nancyContext).Returns(new Response()); requestDispatcher.Dispatch(nancyContext, CancellationToken.None); <API key>.Received(1).Handle(nancyContext); } [Fact] public void <API key>() { var requestDispatcher = GetSubject(); var response = requestDispatcher.Dispatch(null, CancellationToken.None); Assert.Equal(typeof(ArgumentException), response.Exception.InnerExceptions.First().GetType()); } [Fact] public void <API key>() { var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var nancyResponse = new Response { StatusCode = HttpStatusCode.OK }; var requestDispatcher = GetSubject(); _mockRequestHandler.Handle(nancyContext).Returns(nancyResponse); requestDispatcher.Dispatch(nancyContext, CancellationToken.None); Assert.Equal(nancyResponse, nancyContext.Response); } [Fact] public void <API key>() { var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var nancyResponse = new Response { StatusCode = HttpStatusCode.OK }; var requestDispatcher = GetSubject(); _mockRequestHandler.Handle(nancyContext).Returns(nancyResponse); var response = requestDispatcher.Dispatch(nancyContext, CancellationToken.None); Assert.Equal(nancyResponse, response.Result); } [Fact] public void <API key>() { var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var nancyResponse = new Response { StatusCode = HttpStatusCode.OK }; var requestDispatcher = GetSubject(); _mockRequestHandler.Handle(nancyContext).Returns(nancyResponse); var response = requestDispatcher.Dispatch(nancyContext, CancellationToken.None); Assert.Null(response.Exception); } [Fact] public void <API key><API key>() { var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var nancyResponse = new Response { StatusCode = HttpStatusCode.OK }; var cancellationToken = new CancellationToken(true); var requestDispatcher = GetSubject(); _mockRequestHandler.Handle(nancyContext).Returns(nancyResponse); var response = requestDispatcher.Dispatch(nancyContext, cancellationToken); Assert.Equal(typeof(<API key>), response.Exception.InnerExceptions.First().GetType()); } [Fact] public void <API key>() { var exception = new <API key>("Something failed."); const string expectedMessage = "Something failed. See logs for details."; var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var requestDispatcher = GetSubject(); _mockRequestHandler .When(x => x.Handle(Arg.Any<NancyContext>())) .Do(x => { throw exception; }); var response = requestDispatcher.Dispatch(nancyContext, CancellationToken.None).Result; Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); Assert.Equal(expectedMessage, response.ReasonPhrase); Assert.Equal(expectedMessage, ReadResponseContent(response)); } [Fact] public void Dispatch_WhenRequestHandlerThrowsWithMessageThatContainsSlashes_ResponseContentAndReasonPhrasesIsReturnedWithoutSlashes() { var exception = new <API key>("Something\r\n \t \\ failed."); const string expectedMessage = @"Something\r\n \t \\ failed. See logs for details."; var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var requestDispatcher = GetSubject(); _mockRequestHandler .When(x => x.Handle(Arg.Any<NancyContext>())) .Do(x => { throw exception; }); var response = requestDispatcher.Dispatch(nancyContext, CancellationToken.None).Result; Assert.Equal(expectedMessage, response.ReasonPhrase); Assert.Equal(expectedMessage, ReadResponseContent(response)); } [Fact] public void <API key>() { var exception = new <API key>("Something failed."); var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var requestDispatcher = GetSubject(); _mockRequestHandler .When(x => x.Handle(Arg.Any<NancyContext>())) .Do(x => { throw exception; }); var response = requestDispatcher.Dispatch(nancyContext, CancellationToken.None).Result; _log.Received(1).ErrorException(Arg.Any<string>(), exception); } [Fact] public void <API key>() { var exception = new <API key>("Something failed"); var nancyContext = new NancyContext { Request = new Request("GET", "/Test", "HTTP") }; var requestDispatcher = GetSubject(); _mockRequestHandler .When(x => x.Handle(Arg.Any<NancyContext>())) .Do(x => { throw exception; }); var response = requestDispatcher.Dispatch(nancyContext, CancellationToken.None).Result; _log.DidNotReceive().ErrorException(Arg.Any<string>(), Arg.Any<Exception>()); } private string ReadResponseContent(Response response) { string content; using (var stream = new MemoryStream()) { response.Contents(stream); stream.Position = 0; using (var reader = new StreamReader(stream)) { content = reader.ReadToEnd(); } } return content; } } }
"use strict"; var <API key> = require("@babel/runtime/helpers/<API key>"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = <API key>(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M9 10v4c0 .55.45 1 1 1s1-.45 1-1V4h2v10c0 .55.45 1 1 1s1-.45 1-1V4h1c.55 0 1-.45 1-1s-.45-1-1-1H9.17C7.08 2 5.22 3.53 5.02 5.61 4.79 7.99 6.66 10 9 10zm11.65 7.65-2.79-2.79c-.32-.32-.86-.1-.86.35V17H6c-.55 0-1 .45-1 1s.45 1 1 1h11v1.79c0 .45.54.67.85.35l2.79-2.79c.2-.19.2-.51.01-.7z" }), '<API key>'); exports.default = _default;
var jazz = require("../lib/jazz"); var fs = require("fs"); var data = fs.readFileSync(__dirname + "/foreach_object.jazz", "utf8"); var template = jazz.compile(data); template.eval({"doc": { "title": "First", "content": "Some content" }}, function(data) { console.log(data); });
/** * @fileoverview This is the interface to the Google maps API v2 * * @author Guenter Richter guenter.richter@maptune.com * @version 0.9 */ /* ...................................................................* * global vars * * ...................................................................*/ /* ...................................................................* * Google directions * * ...................................................................*/ function <API key>(){ var result = $("#directions-result")[0]; if (gdir.getStatus().code == <API key>) result.innerHTML = ("Indirizzo sconosciuto. Forse è troppo nuovo o sbagliato.\n Codice errore: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_SERVER_ERROR) result.innerHTML = ("Richiesta non riuscita.\n Codice errore: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_MISSING_QUERY) result.innerHTML = ("Inserire indirizzi! \n Codice errore: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_BAD_KEY) result.innerHTML = ("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_BAD_REQUEST) result.innerHTML = ("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code); else result.innerHTML = ("Errore sconosciuto!"); } function _map_setDirections(map,fromAddress, toAddress, toHidden, locale) { var result = $("#directions-result")[0]; result.innerHTML = ""; gdir.loadFromWaypoints([fromAddress,toHidden], { "locale": locale, "preserveViewport":true }); } function <API key>(marker){ if ( marker ){ var form = $("#directionsform")[0]; if ( form ){ form.to.value = marker.data.name; if ( marker.getLatLng ){ form.toHidden.value = marker.getLatLng(); } else if( marker.getVertex ){ form.toHidden.value = marker.getVertex(0); } } } } /** * Is called 'onload' to start creating the map */ function _map_loadMap(target){ var __map = null; // if google maps API v2 is loaded if ( GMap2 ){ // check if browser can handle Google Maps if ( !<API key>()) { alert("sorry - your browser cannot handle Google Maps !"); return null; } __map = new GMap2(target); if ( __map ){ // configure user map interface __map.addControl(new GMapTypeControl()); // map.addControl(new GMenuMapTypeControl()); __map.addControl(new GLargeMapControl3D()); __map.addControl(new GScaleControl()); __map.addMapType(G_PHYSICAL_MAP); __map.addMapType(G_SATELLITE_3D_MAP); __map.<API key>(); __map.<API key>(); } } return __map; } /** * Is called to set up directions query */ function _map_addDirections(map,target){ if (map){ gdir = new GDirections(map,target); GEvent.addListener(gdir, "error", <API key>); } } /** * Is called to set up traffic information layer */ function <API key>(map,target){ /* tbd */ } /** * Is called to set event handler */ function <API key>(map,szEvent,callback,mapUp){ if (map){ GEvent.addListener(map, szEvent, GEvent.callback(map,callback,mapUp) ); } } /** * Is called 'onunload' to clear objects */ function _map_unloadMap(map){ if (map){ GUnload(); } } // set map center and zoom function <API key>(map,bBox){ if (map){ var mapCenter = { lon: (bBox[0] + (bBox[1]-bBox[0])/2) , lat: (bBox[2] + (bBox[3]-bBox[2])/2) }; var mapZoom = map.getBoundsZoomLevel(new GLatLngBounds( new GLatLng(bBox[2],bBox[0]), new GLatLng(bBox[3],bBox[1]) ) ); map.setCenter(new GLatLng(mapCenter.lat, mapCenter.lon), mapZoom); } } // get map zoom function _map_getZoom(map){ if (map){ return map.getZoom(); } return 0; } // get map center function _map_getCenter(map){ if (map){ return map.getCenter(); } return null; } // set map zoom function _map_setZoom(map,nZoom){ if (map){ map.setZoom(nZoom); } } // set map center function _map_setCenter(map,center){ if (map){ map.setCenter(center); } } // set map center and zoom function <API key>(map,center,nZoom){ if (map){ map.setCenter(center,nZoom); } } // create custom tooltip function <API key>(marker, text, padding){ var tooltip = new Tooltip(marker, text, padding); marker.tooltip = tooltip; map.addOverlay(tooltip); } function <API key>(element, tooltip){ GEvent.addDomListener(element,'mouseover',GEvent.callback(tooltip, Tooltip.prototype.show)); GEvent.addDomListener(element,'mouseout',GEvent.callback(tooltip, Tooltip.prototype.hide)); } // EOF
import InputValidator from "../../common/js/InputValidator.js"; import ObjectUtilities from "../../common/js/ObjectUtilities.js"; import Action from "./Action.js"; import DefaultFilters from "./DefaultFilters.js"; import InitialState from "./InitialState.js"; var Reducer = {}; Reducer.root = function(state, action) { LOGGER.debug("root() type = " + action.type); if (typeof state === 'undefined') { return new InitialState(); } var newFilters, newFilteredTableRow; switch (action.type) { case Action.REMOVE_FILTERS: newFilteredTableRow = []; newFilteredTableRow = newFilteredTableRow.concat(state.tableRows); return Object.assign( {}, state, { filteredTableRows: newFilteredTableRow, }); case Action.SET_DEFAULT_FILTERS: newFilters = DefaultFilters.create(); return Object.assign( {}, state, { filters: newFilters, }); case Action.SET_FILTERS: LOGGER.debug("Reducer filters = "); Object.getOwnPropertyNames(action.filters).forEach(function(propertyName) { LOGGER.debug(propertyName + ": " + action.filters[propertyName]); }); newFilters = Object.assign( {}, state.filters); newFilters = ObjectUtilities.merge(newFilters, action.filters); newFilteredTableRow = Reducer.filterTableRow(state.tableRows, newFilters); Reducer.saveToLocalStorage(newFilters); return Object.assign( {}, state, { filters: newFilters, filteredTableRows: newFilteredTableRow, }); case Action.TOGGLE_FILTER_SHOWN: return Object.assign( {}, state, { isFilterShown: !state.isFilterShown, }); default: LOGGER.warn("Reducer.root: Unhandled action type: " + action.type); return state; } }; Reducer.filterTableRow = function(tableRows, filters) { InputValidator.validateNotNull("tableRows", tableRows); InputValidator.validateNotNull("filters", filters); var answer = []; tableRows.forEach(function(data) { if (Reducer.passes(data, filters)) { answer.push(data); } }); return answer; }; Reducer.passes = function(data, filters) { InputValidator.validateNotNull("data", data); InputValidator.validateNotNull("filters", filters); var answer = true; var propertyNames = Object.getOwnPropertyNames(filters); for (var i = 0; i < propertyNames.length; i++) { var propertyName = propertyNames[i]; var filter = filters[propertyName]; if (!filter.passes(data)) { answer = false; break; } } return answer; }; Reducer.saveToLocalStorage = function(filters) { InputValidator.validateNotNull("filters", filters); var filterObjects = []; Object.getOwnPropertyNames(filters).forEach(function(columnKey) { var filter = filters[columnKey]; filterObjects.push(filter.toObject()); }); localStorage.filters = JSON.stringify(filterObjects); }; export default Reducer;
{% extends 'layout.html' %} {% block heading %}Coming soon{% endblock %} {% block body %} {{ message }} {% endblock %} {% block footer_nav %} <li> <a href="{{ root }}">Back home</a> </li> {% endblock %}
package com.github.mlk.queue.codex; import com.github.mlk.queue.Queuify; import com.github.mlk.queue.implementation.Module; public class Utf8StringModule implements Module { public static Utf8StringModule utfStrings() { return new Utf8StringModule(); } @Override public void bind(Queuify.Builder builder) { builder.encoder(new StringEncoder()) .decoder(new StringDecoder()); } }
ig.module( 'plusplus.config-user' ) .defines(function() { ig.CONFIG_USER = { // no need to do force entity extended checks, we won't mess it up // because we know to have our entities extend ig.EntityExtended <API key>: false, // auto sort AUTO_SORT_LAYERS: true, // fullscreen! GAME_WIDTH_PCT: 1, GAME_HEIGHT_PCT: 1, // dynamic scaling based on dimensions in view (resolution independence) GAME_WIDTH_VIEW: 352, GAME_HEIGHT_VIEW: 208, // clamped scaling is still dynamic, but within a range // so we can't get too big or too small SCALE_MIN: 1, SCALE_MAX: 4, // camera flexibility and smoothness CAMERA: { // keep the camera within the level // (whenever possible) //KEEP_INSIDE_LEVEL: true, KEEP_CENTERED: false, LERP: 0.025, // trap helps with motion sickness BOUNDS_TRAP_AS_PCT: true, <API key>: -0.2, <API key>: -0.3, <API key>: 0.2, <API key>: 0.3 }, // font and text settings FONT: { MAIN_NAME: "<API key>.png", ALT_NAME: "<API key>.png", CHAT_NAME: "<API key>.png", // we can have the font be scaled relative to system <API key>: 0.5, // and force a min / max SCALE_MIN: 1, SCALE_MAX: 2 }, // text bubble settings TEXT_BUBBLE: { // match the visual style PIXEL_PERFECT: true }, UI: { // sometimes, we want to keep things at a static scale // for example, UI is a possible target SCALE: 3, IGNORE_SYSTEM_SCALE: true }, /* // to try dynamic clamped UI scaling // uncomment below and delete the UI settings above UI: { SCALE_MIN: 2, SCALE_MAX: 4 } */ // UI should persist across all levels <API key>: false, CHARACTER: { // add some depth using offset SIZE_OFFSET_X: 8, SIZE_OFFSET_Y: 4 } }; });
package hudson.triggers; import antlr.ANTLRException; import com.google.common.base.Preconditions; import hudson.Extension; import hudson.Util; import hudson.console.AnnotatedLargeText; import hudson.model.AbstractBuild; import hudson.model.AbstractProject; import hudson.model.Action; import hudson.model.<API key>; import hudson.model.Cause; import hudson.model.CauseAction; import hudson.model.Item; import hudson.model.Run; import hudson.scm.SCM; import hudson.scm.SCMDescriptor; import hudson.util.<API key>; import hudson.util.FormValidation; import hudson.util.IOUtils; import hudson.util.NamingThreadFactory; import hudson.util.<API key>; import hudson.util.StreamTaskListener; import hudson.util.TimeUnit2; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.nio.charset.Charset; import java.text.DateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.logging.Level; import java.util.logging.Logger; import jenkins.model.Jenkins; import jenkins.model.RunAction2; import jenkins.scm.SCMDecisionHandler; import jenkins.triggers.SCMTriggerItem; import jenkins.util.SystemProperties; import net.sf.json.JSONObject; import org.apache.commons.io.FileUtils; import org.apache.commons.jelly.XMLOutput; import org.jenkinsci.Symbol; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.DoNotUse; import org.kohsuke.accmod.restrictions.NoExternalUse; import org.kohsuke.stapler.<API key>; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; import static java.util.logging.Level.WARNING; /** * {@link Trigger} that checks for SCM updates periodically. * * You can add UI elements under the SCM section by creating a * config.jelly or config.groovy in the resources area for * your class that inherits from SCMTrigger and has the * @{@link hudson.model.Extension} annotation. The UI should * be wrapped in an f:section element to denote it. * * @author Kohsuke Kawaguchi */ public class SCMTrigger extends Trigger<Item> { private boolean <API key>; public SCMTrigger(String scmpoll_spec) throws ANTLRException { this(scmpoll_spec, false); } @<API key> public SCMTrigger(String scmpoll_spec, boolean <API key>) throws ANTLRException { super(scmpoll_spec); this.<API key> = <API key>; } /** * This trigger wants to ignore post-commit hooks. * <p> * SCM plugins must respect this and not run this trigger for post-commit notifications. * * @since 1.493 */ public boolean <API key>() { return this.<API key>; } @Override public void run() { if (job == null) { return; } run(null); } /** * Run the SCM trigger with additional build actions. Used by <API key> * to trigger a build at a specific revisionn number. * * @param additionalActions * @since 1.375 */ public void run(Action[] additionalActions) { if (job == null) { return; } DescriptorImpl d = getDescriptor(); LOGGER.fine("Scheduling a polling for "+job); if (d.synchronousPolling) { LOGGER.fine("Running the trigger directly without threading, " + "as it's already taken care of by Trigger.Cron"); new Runner(additionalActions).run(); } else { // schedule the polling. // even if we end up submitting this too many times, that's OK. // the real exclusion control happens inside Runner. LOGGER.fine("scheduling the trigger to (asynchronously) run"); d.queue.execute(new Runner(additionalActions)); d.clogCheck(); } } @Override public DescriptorImpl getDescriptor() { return (DescriptorImpl)super.getDescriptor(); } @Override public Collection<? extends Action> getProjectActions() { if (job == null) { return Collections.emptyList(); } return Collections.singleton(new SCMAction()); } /** * Returns the file that records the last/current polling activity. */ public File getLogFile() { return new File(job.getRootDir(),"scm-polling.log"); } @Extension @Symbol("scm") public static class DescriptorImpl extends TriggerDescriptor { private static ThreadFactory threadFactory() { return new NamingThreadFactory(Executors.<API key>(), "SCMTrigger"); } private transient final <API key> queue = new <API key>(Executors.<API key>(threadFactory())); /** * Whether the projects should be polled all in one go in the order of dependencies. The default behavior is * that each project polls for changes independently. */ public boolean synchronousPolling = false; /** * Max number of threads for SCM polling. * 0 for unbounded. */ private int maximumThreads; public DescriptorImpl() { load(); resizeThreadPool(); } public boolean isApplicable(Item item) { return SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(item) != null; } public ExecutorService getExecutor() { return queue.getExecutors(); } /** * Returns true if the SCM polling thread queue has too many jobs * than it can handle. */ public boolean isClogged() { return queue.isStarving(<API key>); } /** * Checks if the queue is clogged, and if so, * activate {@link <API key>}. */ public void clogCheck() { <API key>.all().get(<API key>.class).on = isClogged(); } /** * Gets the snapshot of {@link Runner}s that are performing polling. */ public List<Runner> getRunners() { return Util.filter(queue.getInProgress(),Runner.class); } // originally List<SCMedItem> but known to be used only for logging, in which case the instances are not actually cast to SCMedItem anyway public List<SCMTriggerItem> getItemsBeingPolled() { List<SCMTriggerItem> r = new ArrayList<SCMTriggerItem>(); for (Runner i : getRunners()) r.add(i.getTarget()); return r; } public String getDisplayName() { return Messages.<API key>(); } /** * Gets the number of concurrent threads used for polling. * * @return * 0 if unlimited. */ public int <API key>() { return maximumThreads; } /** * Sets the number of concurrent threads used for SCM polling and resizes the thread pool accordingly * @param n number of concurrent threads, zero or less means unlimited, maximum is 100 */ public void <API key>(int n) { // fool proof if(n<0) n=0; if(n>100) n=100; maximumThreads = n; resizeThreadPool(); } @Restricted(NoExternalUse.class) public boolean <API key>() { // unless you have a fair number of projects, this option is likely pointless. // so let's hide this option for new users to avoid confusing them // unless it was already changed // TODO switch to check for SCMTriggerItem return Jenkins.getInstance().getAllItems(AbstractProject.class).size() > 10 || <API key>() != 0; } /** * Update the {@link ExecutorService} instance. */ /*package*/ synchronized void resizeThreadPool() { queue.setExecutors( (maximumThreads==0 ? Executors.newCachedThreadPool(threadFactory()) : Executors.newFixedThreadPool(maximumThreads, threadFactory()))); } @Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { String t = json.optString("pollingThreadCount",null); if(t==null || t.length()==0) <API key>(0); else <API key>(Integer.parseInt(t)); // Save configuration save(); return true; } public FormValidation <API key>(@QueryParameter String value) { if (value != null && "".equals(value.trim())) return FormValidation.ok(); return FormValidation.<API key>(value); } } @Extension public static final class <API key> extends <API key> { private boolean on; public boolean isActivated() { return on; } } /** * Associated with {@link Run} to show the polling log * that triggered that build. * * @since 1.376 */ public static class BuildAction implements RunAction2 { private transient /*final*/ Run<?,?> run; @Deprecated public transient /*final*/ AbstractBuild build; /** * @since 1.568 */ public BuildAction(Run<?,?> run) { this.run = run; build = run instanceof AbstractBuild ? (AbstractBuild) run : null; } @Deprecated public BuildAction(AbstractBuild build) { this((Run) build); } /** * @since 1.568 */ public Run<?,?> getRun() { return run; } /** * Polling log that triggered the build. */ public File getPollingLogFile() { return new File(run.getRootDir(),"polling.log"); } public String getIconFileName() { return "clipboard.png"; } public String getDisplayName() { return Messages.<API key>(); } public String getUrlName() { return "pollingLog"; } /** * Sends out the raw polling log output. */ public void doPollingLog(StaplerRequest req, StaplerResponse rsp) throws IOException { rsp.setContentType("text/plain;charset=UTF-8"); // Prevent jelly from flushing stream so Content-Length header can be added afterwards <API key> out = new <API key>(rsp.<API key>(req)); try { getPollingLogText().writeLogTo(0, out); } finally { IOUtils.closeQuietly(out); } } public AnnotatedLargeText getPollingLogText() { return new AnnotatedLargeText<BuildAction>(getPollingLogFile(), Charset.defaultCharset(), true, this); } /** * Used from <tt>polling.jelly</tt> to write annotated polling log to the given output. */ public void writePollingLogTo(long offset, XMLOutput out) throws IOException { // TODO: resurrect compressed log file support getPollingLogText().writeHtmlTo(offset, out.asWriter()); } @Override public void onAttached(Run<?, ?> r) { // unnecessary, existing constructor does this } @Override public void onLoad(Run<?, ?> r) { run = r; build = run instanceof AbstractBuild ? (AbstractBuild) run : null; } } /** * Action object for job. Used to display the last polling log. */ public final class SCMAction implements Action { public AbstractProject<?,?> getOwner() { Item item = getItem(); return item instanceof AbstractProject ? ((AbstractProject) item) : null; } /** * @since 1.568 */ public Item getItem() { return job().asItem(); } public String getIconFileName() { return "clipboard.png"; } public String getDisplayName() { Set<SCMDescriptor<?>> descriptors = new HashSet<SCMDescriptor<?>>(); for (SCM scm : job().getSCMs()) { descriptors.add(scm.getDescriptor()); } return descriptors.size() == 1 ? Messages.<API key>(descriptors.iterator().next().getDisplayName()) : Messages.<API key>(); } public String getUrlName() { return "scmPollLog"; } public String getLog() throws IOException { return Util.loadFile(getLogFile()); } /** * Writes the annotated log to the given output. * @since 1.350 */ public void writeLogTo(XMLOutput out) throws IOException { new AnnotatedLargeText<SCMAction>(getLogFile(),Charset.defaultCharset(),true,this).writeHtmlTo(0,out.asWriter()); } } private static final Logger LOGGER = Logger.getLogger(SCMTrigger.class.getName()); /** * {@link Runnable} that actually performs polling. */ public class Runner implements Runnable { /** * When did the polling start? */ private volatile long startTime; private Action[] additionalActions; public Runner() { this(null); } public Runner(Action[] actions) { Preconditions.checkNotNull(job, "Runner can't be instantiated when job is null"); if (actions == null) { additionalActions = new Action[0]; } else { additionalActions = actions; } } /** * Where the log file is written. */ public File getLogFile() { return SCMTrigger.this.getLogFile(); } /** * For which {@link Item} are we polling? * @since 1.568 */ public SCMTriggerItem getTarget() { return job(); } /** * When was this polling started? */ public long getStartTime() { return startTime; } /** * Human readable string of when this polling is started. */ public String getDuration() { return Util.getTimeSpanString(System.currentTimeMillis()-startTime); } private boolean runPolling() { try { // to make sure that the log file contains up-to-date text, // don't do buffering. StreamTaskListener listener = new StreamTaskListener(getLogFile()); try { PrintStream logger = listener.getLogger(); long start = System.currentTimeMillis(); logger.println("Started on "+ DateFormat.getDateTimeInstance().format(new Date())); boolean result = job().poll(listener).hasChanges(); logger.println("Done. Took "+ Util.getTimeSpanString(System.currentTimeMillis()-start)); if(result) logger.println("Changes found"); else logger.println("No changes"); return result; } catch (Error | RuntimeException e) { e.printStackTrace(listener.error("Failed to record SCM polling for "+job)); LOGGER.log(Level.SEVERE,"Failed to record SCM polling for "+job,e); throw e; } finally { listener.close(); } } catch (IOException e) { LOGGER.log(Level.SEVERE,"Failed to record SCM polling for "+job,e); return false; } } public void run() { if (job == null) { return; } // we can pre-emtively check the SCMDecisionHandler instances here // note that job().poll(listener) should also check this SCMDecisionHandler veto = SCMDecisionHandler.firstShouldPollVeto(job); if (veto != null) { try (StreamTaskListener listener = new StreamTaskListener(getLogFile())) { listener.getLogger().println( "Skipping polling on " + DateFormat.getDateTimeInstance().format(new Date()) + " due to veto from " + veto); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to record SCM polling for " + job, e); } LOGGER.log(Level.FINE, "Skipping polling for {0} due to veto from {1}", new Object[]{job.getFullDisplayName(), veto} ); return; } String threadName = Thread.currentThread().getName(); Thread.currentThread().setName("SCM polling for "+job); try { startTime = System.currentTimeMillis(); if(runPolling()) { SCMTriggerItem p = job(); String name = " #"+p.getNextBuildNumber(); SCMTriggerCause cause; try { cause = new SCMTriggerCause(getLogFile()); } catch (IOException e) { LOGGER.log(WARNING, "Failed to parse the polling log",e); cause = new SCMTriggerCause(); } Action[] queueActions = new Action[additionalActions.length + 1]; queueActions[0] = new CauseAction(cause); System.arraycopy(additionalActions, 0, queueActions, 1, additionalActions.length); if (p.scheduleBuild2(p.getQuietPeriod(), queueActions) != null) { LOGGER.info("SCM changes detected in "+ job.getFullDisplayName()+". Triggering "+name); } else { LOGGER.info("SCM changes detected in "+ job.getFullDisplayName()+". Job is already in the queue"); } } } finally { Thread.currentThread().setName(threadName); } } // as per the requirement of <API key>, value equality is necessary @Override public boolean equals(Object that) { return that instanceof Runner && job == ((Runner) that)._job(); } private Item _job() {return job;} @Override public int hashCode() { return job.hashCode(); } } @SuppressWarnings("deprecation") private SCMTriggerItem job() { return SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job); } public static class SCMTriggerCause extends Cause { /** * Only used while ths cause is in the queue. * Once attached to the build, we'll move this into a file to reduce the memory footprint. */ private String pollingLog; private transient Run run; public SCMTriggerCause(File logFile) throws IOException { // TODO: charset of this log file? this(FileUtils.readFileToString(logFile)); } public SCMTriggerCause(String pollingLog) { this.pollingLog = pollingLog; } /** * @deprecated * Use {@link SCMTrigger.SCMTriggerCause#SCMTriggerCause(String)}. */ @Deprecated public SCMTriggerCause() { this(""); } @Override public void onLoad(Run run) { this.run = run; } @Override public void onAddedTo(Run build) { this.run = build; try { BuildAction a = new BuildAction(build); FileUtils.writeStringToFile(a.getPollingLogFile(),pollingLog); build.replaceAction(a); } catch (IOException e) { LOGGER.log(WARNING,"Failed to persist the polling log",e); } pollingLog = null; } @Override public String getShortDescription() { return Messages.<API key>(); } @Restricted(DoNotUse.class) public Run getRun() { return this.run; } @Override public boolean equals(Object o) { return o instanceof SCMTriggerCause; } @Override public int hashCode() { return 3; } } /** * How long is too long for a polling activity to be in the queue? */ public static long <API key> = SystemProperties.getLong(SCMTrigger.class.getName()+".starvationThreshold", TimeUnit2.HOURS.toMillis(1)); }
package com.karuslabs.commons.command.synchronization; import java.util.List; import org.bukkit.entity.Player; import org.bukkit.event.player.<API key>; import org.bukkit.scheduler.BukkitScheduler; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class SynchronizationTest { Synchronizer synchronizer = mock(Synchronizer.class); BukkitScheduler scheduler = mock(BukkitScheduler.class); Synchronization synchronization = new Synchronization(synchronizer, scheduler, null); <API key> event = mock(<API key>.class); @Test void add() { synchronization.add(event); assertTrue(synchronization.events.contains(event)); assertTrue(synchronization.running); verify(scheduler).<API key>(null, synchronization); } @Test void add_duplicate() { synchronization.events.add(event); synchronization.add(event); assertTrue(synchronization.events.contains(event)); assertFalse(synchronization.running); verify(scheduler, times(0)).<API key>(null, synchronization); } @Test void add_running() { synchronization.running = true; synchronization.add(event); assertTrue(synchronization.events.contains(event)); assertTrue(synchronization.running); verify(scheduler, times(0)).<API key>(null, synchronization); } @Test void run() { when(event.getPlayer()).thenReturn(mock(Player.class)); when(event.getCommands()).thenReturn(List.of("a")); synchronization.add(event); synchronization.run(); verify(synchronizer).synchronize(any(Player.class), any(List.class)); assertTrue(synchronization.events.isEmpty()); assertFalse(synchronization.running); } }
<html dir="LTR"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" /> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" /> <title>DebugAppender Constructor ()</title> <xml> </xml> <link rel="stylesheet" type="text/css" href="MSDN.css" /> </head> <body id="bodyID" class="dtBODY"> <div id="nsbanner"> <div id="bannerrow1"> <table class="bannerparthead" cellspacing="0"> <tr id="hdr"> <td class="runninghead">Apache log4net™ SDK Documentation - Microsoft .NET Framework 4.0</td> <td class="product"> </td> </tr> </table> </div> <div id="TitleRow"> <h1 class="dtH1">DebugAppender Constructor ()</h1> </div> </div> <div id="nstext"> <p> Initializes a new instance of the <a href="log4net.Appender.DebugAppender.html">DebugAppender</a>. </p> <div class="syntax"> <span class="lang">[Visual Basic]</span> <br />Overloads Public Sub New()</div> <div class="syntax"> <span class="lang">[C#]</span> <br />public DebugAppender();</div> <h4 class="dtH4">Remarks</h4> <p> Default constructor. </p> <h4 class="dtH4">See Also</h4><p><a href="log4net.Appender.DebugAppender.html">DebugAppender Class</a> | <a href="log4net.Appender.html">log4net.Appender Namespace</a> | <a href="log4net.Appender.<API key>.html">DebugAppender Constructor Overload List</a></p><hr /><div id="footer"><a href='http: </body> </html>
<?php namespace Omnipay\Common\Message; use Mockery as m; use Omnipay\TestCase; class <API key> extends TestCase { public function testDefaultMethods() { $response = m::mock('\Omnipay\Common\Message\AbstractResponse[isSuccessful]'); $this->assertFalse($response->isRedirect()); $this->assertNull($response->getData()); $this->assertNull($response-><API key>()); $this->assertNull($response->getMessage()); } }
# encoding: utf-8 require 'spec_helper' describe Github::Authorization do let(:client_id) { '234jl23j4l23j4l' } let(:client_secret) { '<API key>' } let(:code) { 'c9798sdf97df98ds'} let(:site) { 'http://github-ent.example.com/' } let(:options) { {:site => site} } subject(:github) { Github.new(options) } after do <API key>(github) end context '.client' do it { is_expected.to respond_to :client } it "should return OAuth2::Client instance" do expect(github.client).to be_a OAuth2::Client end it "should assign site from the options hash" do expect(github.client.site).to eq site end it "should assign 'authorize_url" do expect(github.client.authorize_url).to eq "#{site}login/oauth/authorize" end it "should assign 'token_url" do expect(github.client.token_url).to eq "#{site}login/oauth/access_token" end end context '.auth_code' do let(:oauth) { OAuth2::Client.new(client_id, client_secret) } it "should throw an error if no client_id" do expect { github.auth_code }.to raise_error(ArgumentError) end it "should throw an error if no client_secret" do expect { github.auth_code }.to raise_error(ArgumentError) end it "should return authentication token code" do github.client_id = client_id github.client_secret = client_secret allow(github.client).to receive(:auth_code).and_return code expect(github.auth_code).to eq code end end context "authorize_url" do let(:options) { {:client_id => client_id, :client_secret => client_secret} } it { is_expected.to respond_to(:authorize_url) } it "should return address containing client_id" do expect(github.authorize_url).to match /client_id=#{client_id}/ end it "should return address containing scopes" do expect(github.authorize_url(:scope => 'user')).to match /scope=user/ end it "should return address containing redirect_uri" do expect(github.authorize_url(:redirect_uri => 'http://localhost')).to match /redirect_uri/ end end context "get_token" do let(:options) { {:client_id => client_id, :client_secret => client_secret} } before do stub_request(:post, 'https://github.com/login/oauth/access_token'). to_return(:body => '', :status => 200, :headers => {}) end it { is_expected.to respond_to(:get_token) } it "should make the authorization request" do expect { github.get_token code a_request(:post, expect("https://github.com/login/oauth/access_token")).to have_been_made }.to raise_error(OAuth2::Error) end it "should fail to get_token without authorization code" do expect { github.get_token }.to raise_error(ArgumentError) end end context ".authenticated?" do it { is_expected.to respond_to(:authenticated?) } it "should return false if falied on basic authentication" do allow(github).to receive(:basic_authed?).and_return false expect(github.authenticated?).to be false end it "should return true if basic authentication performed" do allow(github).to receive(:basic_authed?).and_return true expect(github.authenticated?).to be true end it "should return true if basic authentication performed" do allow(github).to receive(:oauth_token?).and_return true expect(github.authenticated?).to be true end end context ".basic_authed?" do before do allow(github).to receive(:basic_auth?).and_return false end it { is_expected.to respond_to(:basic_authed?) } it "should return false if login is missing" do allow(github).to receive(:login?).and_return false expect(github.basic_authed?).to be false end it "should return true if login && password provided" do allow(github).to receive(:login?).and_return true allow(github).to receive(:password?).and_return true expect(github.basic_authed?).to be true end end context "authentication" do it { is_expected.to respond_to(:authentication) } it "should return empty hash if no basic authentication params available" do allow(github).to receive(:login?).and_return false allow(github).to receive(:basic_auth?).and_return false expect(github.authentication).to be_empty end context 'basic_auth' do let(:options) { { :basic_auth => 'github:pass' } } it "should return hash with basic auth params" do expect(github.authentication).to include({login: 'github'}) expect(github.authentication).to include({password: 'pass'}) end end context 'login & password' do it "should return hash with login & password params" do options = {login: 'github', password: 'pass'} github = Github.new(options) expect(github.authentication).to be_a(Hash) expect(github.authentication).to include({login: 'github'}) expect(github.authentication).to include({password: 'pass'}) <API key>(github) end end end # authentication end # Github::Authorization
require File.expand_path('../spec_helper', __FILE__) module Danger describe DangerProse do it 'is a plugin' do expect(Danger::DangerProse < Danger::Plugin).to be_truthy end describe 'with Dangerfile' do before do @dangerfile = testing_dangerfile @prose = testing_dangerfile.prose end describe 'linter' do it 'handles proselint not being installed' do allow(@prose).to receive(:`).with('which proselint').and_return('') expect(@prose.proselint_installed?).to be_falsy end it 'handles proselint being installed' do allow(@prose).to receive(:`).with('which proselint').and_return('/bin/thing/proselint') expect(@prose.proselint_installed?).to be_truthy end describe :lint_files do before do # So it doesn't try to install on your computer allow(@prose).to receive(:`).with('which proselint').and_return('/bin/thing/proselint') # Proselint returns JSON data, which is nice errors = '[{"start": 1441, "replacements": null, "end": 1445, "severity": "warning", "extent": 4, "column": 1, "message": "!!! is hyperbolic.", "line": 46, "check": "hyperbolic.misc"}]' proselint_response = '{"status" : "success", "data" : { "errors" : ' + errors + '}}' # This is where we generate our JSON allow(@prose).to receive(:`).with('proselint "spec/fixtures/blog_post.md" --json').and_return(proselint_response) # it's worth noting - you can call anything on your plugin that a Dangerfile responds to # The request source's PR JSON typically looks like @prose.env.request_source.pr_json = { "head" => { "ref" => 'my_fake_branch' } } end it 'handles a known JSON report from proselint' do
'use strict' const path = require('path') const hbs = require('express-hbs') module.exports = function (app, express) { hbs.registerHelper('asset', require('./helpers/asset')) app.engine('hbs', hbs.express4({ partialsDir: path.resolve('app/client/views/partials'), layoutsDir: path.resolve('app/client/views/layouts'), beautify: app.locals.isProduction })) app.set('view engine', 'hbs') app.set('views', path.resolve('app/client/views')) app.use(express.static(path.resolve('app/public'))) return app }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>LCOV - result.info - c++/7.1.0/bits/stl_pair.h - functions</title> <link rel="stylesheet" type="text/css" href="../../../gcov.css"> </head> <body> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="title">LCOV - code coverage report</td></tr> <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> <tr> <td width="100%"> <table cellpadding=1 border=0 width="100%"> <tr> <td width="10%" class="headerItem">Current view:</td> <td width="35%" class="headerValue"><a href="../../../index.html">top level</a> - <a href="index.html">c++/7.1.0/bits</a> - stl_pair.h<span style="font-size: 80%;"> (<a href="stl_pair.h.gcov.html">source</a> / functions)</span></td> <td width="5%"></td> <td width="15%"></td> <td width="10%" class="headerCovTableHead">Hit</td> <td width="10%" class="headerCovTableHead">Total</td> <td width="15%" class="headerCovTableHead">Coverage</td> </tr> <tr> <td class="headerItem">Test:</td> <td class="headerValue">result.info</td> <td></td> <td class="headerItem">Lines:</td> <td class="headerCovTableEntry">7</td> <td class="headerCovTableEntry">7</td> <td class="<API key>">100.0 %</td> </tr> <tr> <td class="headerItem">Date:</td> <td class="headerValue">2017-07-07 11:26:11</td> <td></td> <td class="headerItem">Functions:</td> <td class="headerCovTableEntry">0</td> <td class="headerCovTableEntry">0</td> <td class="<API key>">-</td> </tr> <tr><td><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> </table> </td> </tr> <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> </table> <center> <table width="60%" cellpadding=1 cellspacing=1 border=0> <tr><td><br></td></tr> <tr> <td width="80%" class="tableHead">Function Name <span class="tableHeadSort"><a href="stl_pair.h.func.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by function name" title="Sort by function name" border=0></a></span></td> <td width="20%" class="tableHead">Hit count <span class="tableHeadSort"><img src="../../../glass.png" width=10 height=14 alt="Sort by hit count" title="Sort by hit count" border=0></span></td> </tr> </table> <br> </center> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr> <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.13</a></td></tr> </table> <br> </body> </html>
// Name: wx/msw/notebook.h // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) // RCS-ID: $Id$ // Licence: wxWindows licence #ifndef _NOTEBOOK_H #define _NOTEBOOK_H #if wxUSE_NOTEBOOK // headers #include "wx/control.h" // wxNotebook class WXDLLIMPEXP_CORE wxNotebookPageInfo : public wxObject { public : wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } virtual ~wxNotebookPageInfo() { } void Create(wxNotebookPage *page, const wxString& text, bool selected, int imageId) { m_page = page; m_text = text; m_selected = selected; m_imageId = imageId; } wxNotebookPage* GetPage() const { return m_page; } wxString GetText() const { return m_text; } bool GetSelected() const { return m_selected; } int GetImageId() const { return m_imageId; } private: wxNotebookPage *m_page; wxString m_text; bool m_selected; int m_imageId; <API key>(wxNotebookPageInfo) }; <API key>(wxNotebookPageInfo, <API key> ); class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase { public: // ctors // default for dynamic class wxNotebook(); // the same arguments as for wxControl (@@@ any special styles?) wxNotebook(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxNotebookNameStr); // Create() function bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxNotebookNameStr); virtual ~wxNotebook(); // accessors // get number of pages in the dialog virtual size_t GetPageCount() const; // set the currently selected page, return the index of the previously // selected one (or -1 on error) // NB: this function will _not_ generate <API key> events int SetSelection(size_t nPage); // get the currently selected page int GetSelection() const { return m_nSelection; } // changes selected page without sending events int ChangeSelection(size_t nPage); // set/get the title of a page bool SetPageText(size_t nPage, const wxString& strText); wxString GetPageText(size_t nPage) const; // image list stuff: each page may have an image associated with it. All // the images belong to an image list, so you have to // 1) create an image list // 2) associate it with the notebook // 3) set for each page it's image // associate image list with a control void SetImageList(wxImageList* imageList); // sets/returns item's image index in the current image list int GetPageImage(size_t nPage) const; bool SetPageImage(size_t nPage, int nImage); // currently it's always 1 because wxGTK doesn't support multi-row // tab controls int GetRowCount() const; // control the appearance of the notebook pages // set the size (the same for all pages) void SetPageSize(const wxSize& size); // set the padding between tabs (in pixels) void SetPadding(const wxSize& padding); // operations // remove all pages bool DeleteAllPages(); // inserts a new page to the notebook (it will be deleted ny the notebook, // don't delete it yourself). If bSelect, this page becomes active. bool InsertPage(size_t nPage, wxNotebookPage *pPage, const wxString& strText, bool bSelect = false, int imageId = -1); void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ); } const <API key>& GetPageInfos() const; // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH // style. void SetTabSize(const wxSize& sz); // hit test virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; // calculate the size of the notebook from the size of its page virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; // callbacks void OnSize(wxSizeEvent& event); void OnSelChange(wxBookCtrlEvent& event); void OnNavigationKey(<API key>& event); // base class virtuals virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, WXWORD pos, WXHWND control); #if wxUSE_CONSTRAINTS virtual void SetConstraintSizes(bool recurse = true); virtual bool DoPhase(int nPhase); #endif // wxUSE_CONSTRAINTS // Attempts to get colour for UX theme page background wxColour <API key>() const; // implementation only #if wxUSE_UXTHEME virtual bool SetBackgroundColour(const wxColour& colour) { if ( !wxNotebookBase::SetBackgroundColour(colour) ) return false; UpdateBgBrush(); return true; } // return the themed brush for painting our children virtual WXHBRUSH <API key>(WXHDC hDC, wxWindow *child); // draw child background virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win); #endif // wxUSE_UXTHEME // translate wxWin styles to the Windows ones virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; protected: // common part of all ctors void Init(); // hides the currently shown page and shows the given one (if not -1) and // updates m_nSelection accordingly void UpdateSelection(int selNew); // remove one page from the notebook, without deleting virtual wxNotebookPage *DoRemovePage(size_t nPage); // get the page rectangle for the current notebook size // returns empty rectangle if an error occurs, do test for it wxRect GetPageSize() const; // set the size of the given page to fit in the notebook void AdjustPageSize(wxNotebookPage *page); #if wxUSE_UXTHEME // gets the bitmap of notebook background and returns a brush from it WXHBRUSH QueryBgBitmap(); // creates the brush to be used for drawing the tab control background void UpdateBgBrush(); // common part of QueryBgBitmap() and MSWPrintChild() // if child == NULL, draw background for the entire notebook itself bool DoDrawBackground(WXHDC hDC, wxWindow *child = NULL); #endif // wxUSE_UXTHEME // these function are only used for reducing flicker on notebook resize and // we don't need to do this for WinCE #ifndef __WXWINCE__ void OnEraseBackground(wxEraseEvent& event); void OnPaint(wxPaintEvent& event); // true if we have already subclassed our updown control bool <API key>; #endif // __WXWINCE__ // the current selection (-1 if none) int m_nSelection; <API key> m_pageInfos; #if wxUSE_UXTHEME // background brush used to paint the tab control WXHBRUSH m_hbrBackground; #endif // wxUSE_UXTHEME <API key>(wxNotebook) DECLARE_EVENT_TABLE() }; #endif // wxUSE_NOTEBOOK #endif // _NOTEBOOK_H
// Polyfills if ( Number.EPSILON === undefined ) { Number.EPSILON = Math.pow( 2, - 52 ); } if ( Number.isInteger === undefined ) { // Missing in IE Number.isInteger = function ( value ) { return typeof value === 'number' && isFinite( value ) && Math.floor( value ) === value; }; } if ( Math.sign === undefined ) { Math.sign = function ( x ) { return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x; }; } if ( 'name' in Function.prototype === false ) { // Missing in IE Object.defineProperty( Function.prototype, 'name', { get: function () { return this.toString().match( /^\s*function\s*([^\(\s]*)/ )[ 1 ]; } } ); } if ( Object.assign === undefined ) { // Missing in IE Object.assign = function ( target ) { 'use strict'; if ( target === undefined || target === null ) { throw new TypeError( 'Cannot convert undefined or null to object' ); } const output = Object( target ); for ( let index = 1; index < arguments.length; index ++ ) { const source = arguments[ index ]; if ( source !== undefined && source !== null ) { for ( const nextKey in source ) { if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) { output[ nextKey ] = source[ nextKey ]; } } } } return output; }; }
<?php namespace PHPExiftool\Driver\Tag\FlashPix; use JMS\Serializer\Annotation\ExclusionPolicy; use PHPExiftool\Driver\AbstractTag; /** * @ExclusionPolicy("all") */ class LockedPropertyList extends AbstractTag { protected $Id = 65538; protected $Name = 'LockedPropertyList'; protected $FullName = 'mixed'; protected $GroupName = 'FlashPix'; protected $g0 = 'FlashPix'; protected $g1 = 'FlashPix'; protected $g2 = 'Other'; protected $Type = '?'; protected $Writable = false; protected $Description = 'Locked Property List'; }
import supertest from 'supertest'; import { publicChannelName, privateChannelName } from './channel.js'; import { roleNameUsers, <API key>, roleScopeUsers, <API key>, roleDescription } from './role.js'; import { username, email, adminUsername, adminPassword } from './user.js'; export const request = supertest('http://localhost:3000'); const prefix = '/api/v1/'; export function wait(cb, time) { return () => setTimeout(cb, time); } export const apiUsername = `api${ username }`; export const apiEmail = `api${ email }`; export const <API key> = `api${ publicChannelName }`; export const <API key> = `api${ privateChannelName }`; export const apiRoleNameUsers = `api${ roleNameUsers }`; export const <API key> = `api${ <API key> }`; export const apiRoleScopeUsers = `${ roleScopeUsers }`; export const <API key> = `${ <API key> }`; export const apiRoleDescription = `api${ roleDescription }`; export const reservedWords = [ 'admin', 'administrator', 'system', 'user', ]; export const targetUser = {}; export const channel = {}; export const group = {}; export const message = {}; export const directMessage = {}; export const integration = {}; export const credentials = { 'X-Auth-Token': undefined, 'X-User-Id': undefined, }; export const login = { user: adminUsername, password: adminPassword, }; export function api(path) { return prefix + path; } export function methodCall(methodName) { return api(`method.call/${ methodName }`); } export function log(res) { console.log(res.req.path); console.log({ body: res.body, headers: res.headers, }); } export function getCredentials(done = function() {}) { request.post(api('login')) .send(login) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { credentials['X-Auth-Token'] = res.body.data.authToken; credentials['X-User-Id'] = res.body.data.userId; }) .end(done); }
<?php defined('BX_DOL') or die('hack attempt'); define("<API key>", 0); define("<API key>", 1); /** * Base class for Installer classes in modules engine. * * The class contains different check functions which are used during the installation process. * An object of the class is created automatically with modules installer. * Installation/Uninstallation process can be controlled with config.php file located in [module]/install/ folder. * * * Example of usage: * refer to the BoonEx modules * * * Memberships/ACL: * Doesn't depend on user's membership. * * * Alerts: * no alerts available * */ class <API key> extends BxDolInstallerUtils { protected $oDb; protected $_aConfig; protected $_sBasePath; protected $_sHomePath; protected $_sModulePath; protected $_bUseFtp; protected $_aActions; protected $_bShowOnSuccess = false; public function __construct($aConfig) { parent::__construct(); $this->oDb = bx_instance('<API key>'); $this->_aConfig = $aConfig; $this->_sBasePath = <API key>; $this->_sHomePath = $this->_sBasePath . $aConfig['home_dir']; $this->_sModulePath = $this->_sBasePath . $aConfig['home_dir']; $this->_bUseFtp = <API key>; $this->_aActions = array( 'perform_install' => array( 'title' => '', 'success' => _t('<API key>'), 'failed' => '' ), 'perform_uninstall' => array( 'title' => '', 'success' => _t('<API key>'), 'failed' => '' ), 'perform_enable' => array( 'title' => '', 'success' => _t('<API key>'), 'failed' => '' ), 'perform_disable' => array( 'title' => '', 'success' => _t('<API key>'), 'failed' => '' ), '<API key>' => array( 'title' => _t('<API key>'), ), 'check_dependencies' => array( 'title' => _t('<API key>'), ), 'show_introduction' => array( 'title' => _t('<API key>'), ), 'move_sources' => array( 'title' => _t('<API key>'), ), 'execute_sql' => array( 'title' => _t('<API key>'), ), 'install_language' => array( 'title' => _t('<API key>'), ), 'update_languages' => array( 'title' => _t('<API key>'), ), 'update_relations' => array( 'title' => _t('<API key>'), ), '<API key>' => array( 'title' => _t('<API key>'), ), 'process_connections' => array( 'title' => _t('<API key>'), ), '<API key>' => array( 'title' => _t('<API key>'), ), '<API key>' => array( 'title' => _t('<API key>'), ), '<API key>' => array( 'title' => _t('<API key>'), ), 'process_storages' => array( 'title' => _t('<API key>'), ), 'process_esearches' => array( 'title' => _t('<API key>'), ), '<API key>' => array( 'title' => _t('<API key>'), ), '<API key>' => array( 'title' => _t('<API key>'), ), 'clear_db_cache' => array( 'title' => _t('<API key>'), ), '<API key>' => array( 'title' => _t('<API key>'), ), 'show_conclusion' => array( 'title' => _t('<API key>'), ), ); $this->_aNonHashableFiles = array( 'install', 'updates' ); } public function install($aParams, $bAutoEnable = false) { $this->disable($aParams); $this->uninstall($aParams); $bAutoEnable = $bAutoEnable || (isset($aParams['auto_enable']) && (bool)$aParams['auto_enable']); $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response']; if($this->oDb->isModule($this->_aConfig['home_uri'])) return array( 'message' => _t('<API key>'), 'result' => false ); $aResult = array(); bx_alert('system', 'before_install', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); if ($aResult && !$aResult['result']) return $aResult; if($this->oDb->isModuleParamsUsed($this->_aConfig['home_uri'], $this->_aConfig['home_dir'], $this->_aConfig['db_prefix'], $this->_aConfig['class_prefix'])) return array( 'message' => _t('<API key>'), 'result' => false ); if(!$this->_isCompatibleWith()) return array( 'message' => $this->_displayResult('<API key>', false, '<API key>', $bHtmlResponce), 'result' => false ); $oFile = $this->_getFileManager(); $sModuleUri = $this->_aConfig['home_uri']; $aLanguages = $this->oDb->getModulesBy(array('type' => 'languages')); foreach($aLanguages as $aLanguage) { if($aLanguage['uri'] == 'en') continue; $aLanguageConfig = self::getModuleConfig(<API key> . $aLanguage['path'] . '/install/config.php'); if(empty($aLanguageConfig)) continue; if(!isset($aLanguageConfig['includes'][$sModuleUri]) || empty($aLanguageConfig['includes'][$sModuleUri])) continue; $sSrcPath = 'modules/' . $aLanguage['path'] . 'install/data/' . $aLanguageConfig['includes'][$sModuleUri]; $sDstPath = $aLanguageConfig['includes'][$sModuleUri]; $oFile->copy($sSrcPath, $sDstPath); } $aResultBefore = $this->_onInstallBefore(); if($aResultBefore !== <API key>) return array( 'message' => $aResultBefore['content'], 'result' => false ); $aResult = $this->_perform('install', $aParams); if($aResult['result']) { $iModuleId = $this->oDb->insertModule($this->_aConfig); $sTitleKey = BxDolModule::getTitleKey($this->_aConfig['home_uri']); $oLanguages = <API key>::getInstance(); $oLanguages->addLanguageString($sTitleKey, $this->_aConfig['title']); $oLanguages->compileLanguage(); <API key>::getInstance()->checkModules(); $aFiles = array(); $this->hashFiles($this->_sModulePath, $aFiles); foreach($aFiles as $aFile) $this->oDb->insertModuleTrack($iModuleId, $aFile); $this-><API key>($this->_aConfig['home_uri'], $iModuleId); $this->_onInstallAfter(); if(!empty($this->_aConfig['install_success'])) $this->_perform('install_success', $aParams); } else { if(!empty($this->_aConfig['install_failed'])) $this->_perform('install_failed', $aParams); } bx_alert('system', 'install', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); if($aResult['result'] && $bAutoEnable) { $aResultEnable = $this->enable($aParams); $aResult['result'] = $aResult['result'] & $aResultEnable['result']; $aResult['message'] = $aResult['message'] . $aResultEnable['message']; } return $aResult; } public function uninstall($aParams, $bAutoDisable = false) { $bAutoDisable = $bAutoDisable || (isset($aParams['auto_disable']) && (bool)$aParams['auto_disable']); $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response']; if(!$this->oDb->isModule($this->_aConfig['home_uri'])) return array( 'message' => _t('<API key>'), 'result' => false ); if($bAutoDisable) { $aResultDisable = $this->disable($aParams); if(!$aResultDisable['result']) return $aResultDisable; } $aResult = array(); bx_alert('system', 'before_uninstall', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); if ($aResult && !$aResult['result']) return $aResult; $bDependent = false; $aDependents = $this->oDb->getDependent($this->_aConfig['name'], $this->_aConfig['home_uri']); if(is_array($aDependents) && !empty($aDependents)) { $bDependent = true; $sMessage = '<br />' . _t('<API key>') . '<br />'; foreach($aDependents as $aDependent) $sMessage .= $aDependent['title'] . '<br />'; } if($bDependent) return array( 'message' => $this->_displayResult('check_dependencies', false, $sMessage, $bHtmlResponce), 'result' => false ); $aResultBefore = $this->_onUninstallBefore(); if($aResultBefore !== <API key>) return array( 'message' => $aResultBefore['content'], 'result' => false ); $aResult = $this->_perform('uninstall', $aParams); if($aResult['result']) { $iModuleId = $this->oDb->deleteModule($this->_aConfig); $sTitleKey = BxDolModule::getTitleKey($this->_aConfig['home_uri']); $oLanguages = <API key>::getInstance(); $oLanguages-><API key>($sTitleKey); $oLanguages->compileLanguage(); $this-><API key>($this->_aConfig['home_uri'], $iModuleId); $this->_onUninstallAfter(); if(!empty($this->_aConfig['uninstall_success'])) $this->_perform('uninstall_success', $aParams); } else { if(!empty($this->_aConfig['uninstall_failed'])) $this->_perform('uninstall_failed', $aParams); } if($bAutoDisable) { $aResult['result'] = $aResultDisable['result'] & $aResult['result']; $aResult['message'] = $aResultDisable['message'] . $aResult['message']; } bx_alert('system', 'uninstall', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); return $aResult; } public function delete($aParams) { $aError = array( 'message' => _t('<API key>'), 'result' => false ); $oFile = $this->_getFileManager(); if(empty($oFile)) return $aError; if(!$oFile->delete('modules/' . $this->_aConfig['home_dir'])) return $aError; return array( 'message' => '', //_t('<API key>'), 'result' => true ); } public function recompile($aParams) { $oLanguages = <API key>::getInstance(); $aResult = array('message' => '', 'result' => false); $aLanguages = $this->oDb->getLanguages(); if (isAdmin() && !empty($aLanguages)) { $this->_updateLanguage(false, current($aLanguages)); $bResult = false; foreach($aLanguages as $aLanguage) { $bResult = $this->_updateLanguage(true, $aLanguage) && $oLanguages->compileLanguage($aLanguage['id']); $aResult['message'] .= $aLanguage['title'] . ': <span style="color:' . ($bResult ? 'green' : 'red') . '">' . _t($bResult ? '<API key>' : '<API key>') . '</span><br />'; $aResult['result'] |= $bResult; } } return $aResult; } public function enable($aParams) { $this->disable($aParams); $aModule = $this->oDb->getModuleByUri($this->_aConfig['home_uri']); if(empty($aModule) || !is_array($aModule)) return array( 'message' => _t('<API key>'), 'result' => false ); if((int)$aModule['enabled'] != 0) return array( 'message' => _t('<API key>'), 'result' => false ); $aResult = array(); if(!empty($this->_aConfig['before_enable'])) { $aResult = $this->_perform('before_enable', $aParams); if($aResult && !$aResult['result']) return $aResult; } $aResult = array(); bx_alert('system', 'before_enable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); if ($aResult && !$aResult['result']) return $aResult; $aResultBefore = $this->_onEnableBefore(); if($aResultBefore !== <API key>) return array( 'message' => $aResultBefore['content'], 'result' => false ); $aResult = $this->_perform('enable', $aParams); if($aResult['result']) { $this->oDb->enableModuleByUri($aModule['uri']); $this-><API key>($aModule['uri'], $aModule['id']); $this->_onEnableAfter(); if(!empty($this->_aConfig['enable_success'])) $this->_perform('enable_success', $aParams); } else { if(!empty($this->_aConfig['enable_failed'])) $this->_perform('enable_failed', $aParams); } setParam('sys_revision', 1 + getParam('sys_revision')); bx_alert('system', 'enable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); return $aResult; } public function disable($aParams) { $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response']; $aModule = $this->oDb->getModuleByUri($this->_aConfig['home_uri']); if(empty($aModule) || !is_array($aModule)) return array( 'message' => _t('<API key>'), 'result' => false ); if((int)$aModule['enabled'] == 0) return array( 'message' => _t('<API key>'), 'result' => false ); $aResult = array(); if(!empty($this->_aConfig['before_disable'])) { $aResult = $this->_perform('before_disable', $aParams); if($aResult && !$aResult['result']) return $aResult; } $aResult = array(); bx_alert('system', 'before_disable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); if ($aResult && !$aResult['result']) return $aResult; $bDependent = false; $aDependents = $this->oDb->getDependent($this->_aConfig['name'], $this->_aConfig['home_uri']); if(is_array($aDependents) && !empty($aDependents)) { $bDependent = true; $sMessage = '<br />' . _t('<API key>') . '<br />'; foreach($aDependents as $aDependent) $sMessage .= $aDependent['title'] . '<br />'; } if($bDependent) return array( 'message' => $this->_displayResult('check_dependencies', false, $sMessage, $bHtmlResponce), 'result' => false ); $aResultBefore = $this->_onDisableBefore(); if($aResultBefore !== <API key>) return array( 'message' => $aResultBefore['content'], 'result' => false ); $aResult = $this->_perform('disable', $aParams); if($aResult['result']) { $this->oDb->disableModuleByUri($aModule['uri']); $this-><API key>($aModule['uri'], $aModule['id']); $this->_onDisableAfter(); if(!empty($this->_aConfig['disable_success'])) $this->_perform('disable_success', $aParams); } else { if(!empty($this->_aConfig['disable_failed'])) $this->_perform('disable_failed', $aParams); } bx_alert('system', 'disable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult)); return $aResult; } public function getVendor() { return $this->_aConfig['vendor']; } public function getName() { return $this->_aConfig['name']; } public function getTitle() { return $this->_aConfig['title']; } public function getHomeDir() { return $this->_aConfig['home_dir']; } protected function <API key>($mixedResult) { return _t('<API key>'); } protected function <API key>($sOperation) { $sContent = ''; if(in_array($sOperation, array('install', 'enable', 'update'))) { if(!isset($this->_aConfig['dependencies']) || !is_array($this->_aConfig['dependencies'])) return <API key>; foreach($this->_aConfig['dependencies'] as $sModule => $sModuleTitle) { if($this->oDb->isModule($sModule) && $this->oDb->isEnabled($sModule)) continue; if($this->oDb->isModuleByName($sModule) && $this->oDb->isEnabledByName($sModule)) continue; $sContent .= $sModuleTitle . '<br />'; } if(!empty($sContent)) $sContent = '<br />' . _t('<API key>') . '<br />' . $sContent; } return empty($sContent) ? <API key> : array('code' => <API key>, 'content' => $sContent); } protected function <API key>($mixedResult) { return $mixedResult['content']; } protected function <API key>($sOperation) { if(!isset($this->_aConfig[$sOperation . '_info']['introduction'])) return <API key>; $sPath = $this->_sHomePath . 'install/info/' . $this->_aConfig[$sOperation . '_info']['introduction']; return file_exists($sPath) ? array("code" => <API key>, "content" => file_get_contents($sPath)) : <API key>; } protected function <API key>($sOperation) { if(!isset($this->_aConfig[$sOperation . '_info']['conclusion'])) return <API key>; $sPath = $this->_sHomePath . 'install/info/' . $this->_aConfig[$sOperation . '_info']['conclusion']; return file_exists($sPath) ? array("code" => <API key>, "content" => file_get_contents($sPath)) : <API key>; } protected function actionMoveSources($sOperation) { $oFile = $this->_getFileManager(); $aInstalled = array_merge(array('system'), $this->oDb->getModulesUri()); $bResult = true; foreach($this->_aConfig['includes'] as $sUri => $sPath) { if(!in_array($sUri, $aInstalled) || empty($sPath)) continue; if($sOperation == 'install') { $sSrcPath = 'modules/' . $this->_aConfig['home_dir'] . 'install/data/' . $sPath; $sDstPath = $sPath; $bResult &= $oFile->copy($sSrcPath, $sDstPath); } else if($sOperation == 'uninstall') $bResult &= $oFile->delete($sPath); } return $bResult ? <API key> : <API key>; } protected function actionExecuteSql($sOperation) { switch($sOperation) { case 'install': $this->actionExecuteSql('disable'); $this->actionExecuteSql('uninstall'); break; case 'enable': $this->actionExecuteSql('disable'); break; } $mixedResult = $this->oDb->executeSQL($this->_sHomePath . 'install/sql/' . $sOperation . '.sql', $this->getMarkersForDb()); return $mixedResult === true ? <API key> : array('code' => <API key>, 'content' => $mixedResult); } protected function <API key>($mixedResult) { if(is_int($mixedResult)) return $this-><API key>($mixedResult); $sResult = _t('<API key>') . '<br />'; foreach($mixedResult['content'] as $aQuery) { $sResult .= _t('<API key>', $aQuery['error']) . '<br />'; $sResult .= '<pre>' . $aQuery['query'] . '</pre>'; } return $sResult; } protected function <API key>($sOperation) { $oLanguages = <API key>::getInstance(); $sLanguage = isset($this->_aConfig['home_uri']) ? $this->_aConfig['home_uri'] : ''; $bResult = true; if($sOperation == 'install') $bResult = $oLanguages->installLanguage(array('name' => $this->_aConfig['name'], 'path' => $this->_aConfig['home_dir'], 'uri' => $this->_aConfig['home_uri'], 'lang_category' => $this->_aConfig['language_category']), false); return $bResult && $oLanguages->compileLanguage(0, true) ? <API key> : <API key>; } protected function <API key>($sOperation) { if(!isset($this->_aConfig['language_category']) || empty($this->_aConfig['language_category'])) return <API key>; $oLanguages = <API key>::getInstance(); $bResult = true; $aResult = array(); if($sOperation == 'install') $iCategoryId = $oLanguages->addLanguageCategory($this->_aConfig['language_category']); $aModule = array( 'name' => $this->_aConfig['name'], 'path' => $this->_aConfig['home_dir'], 'uri' => $this->_aConfig['home_uri'], 'lang_category' => $this->_aConfig['language_category'] ); if($sOperation == 'install') $bResult = $oLanguages->restoreLanguage(0, $aModule, false); else if($sOperation == 'uninstall') $bResult = $oLanguages-><API key>($aModule, false); if($sOperation == 'uninstall' && $bResult) $oLanguages-><API key>($this->_aConfig['language_category']); return $bResult && $oLanguages->compileLanguage(0, true) ? <API key> : <API key>; } /** * NOTE. The action is ONLY needed for dependent module to let * Notifications based module(s) know that he(they) should * update (request and save) handlers from this dependent module. */ protected function <API key>($sOperation) { if(!in_array($sOperation, array('install', 'uninstall', 'enable', 'disable'))) return <API key>; if(empty($this->_aConfig['relations']) || !is_array($this->_aConfig['relations'])) return <API key>; foreach($this->_aConfig['relations'] as $sModule) { if(!$this->oDb->isModuleByName($sModule)) continue; $aRelation = $this->oDb->getRelationsBy(array('type' => 'module', 'value' => $sModule)); if(empty($aRelation) || empty($aRelation['on_' . $sOperation]) || !BxDolRequest::serviceExists($aRelation['module'], $aRelation['on_' . $sOperation])) continue; BxDolService::call($aRelation['module'], $aRelation['on_' . $sOperation], array($this->_aConfig['home_uri'])); } return <API key>; } /** * NOTE. The action is ONLY needed for Notifications based modules * to update (request and save) handlers from all dependent modules. */ protected function <API key>($sOperation) { if(!in_array($sOperation, array('enable', 'disable'))) return <API key>; if($sOperation == 'enable') $this->oDb->insertRelation($this->_aConfig['name'], $this->_aConfig['relation_handlers']); $aRelation = $this->oDb->getRelationsBy(array('type' => 'module', 'value' => $this->_aConfig['name'])); if(empty($aRelation) || empty($aRelation['on_' . $sOperation])) return <API key>; $aModules = $this->oDb->getModulesBy(array('type' => 'all', 'active' => 1)); foreach($aModules as $aModule) { $aConfig = self::getModuleConfig($aModule); if(!empty($aConfig['relations']) && is_array($aConfig['relations']) && in_array($this->_aConfig['name'], $aConfig['relations'])) BxDolService::call($this->_aConfig['name'], $aRelation['on_' . $sOperation], array($aModule['uri'])); } if($sOperation == 'disable') $this->oDb->deleteRelation($this->_aConfig['name']); return <API key>; } /** * * Connections objects associated with module data. It must be defined which content is associated with the connection. * The key is connection object name and value is array (possible array values: type, conn, table, field_id). * If 'type' == 'profiles', then it is considered profiles connection and other possible param is 'conn' ('initiator', 'content' or 'both') * If 'type' == 'custom' (or ommited), then other possible params are 'conn', 'table' and 'field_id' * @param string $sOperation - operation type. */ protected function <API key>($sOperation) { if(!in_array($sOperation, array('uninstall')) || empty($this->_aConfig['connections'])) return <API key>; foreach($this->_aConfig['connections'] as $sObjectConnections => $a) { $o = BxDolConnection::getObjectInstance($sObjectConnections); if(!$o) continue; $sFuncSuffix = '<API key>'; if (isset($a['conn']) && 'initiator' == $a['conn']) $sFuncSuffix = 'DeleteInitiator'; elseif (isset($a['conn']) && 'content' == $a['conn']) $sFuncSuffix = 'DeleteContent'; if (isset($a['type']) && 'profiles' == $a['type']) { $sFunc = 'onModuleProfile' . $sFuncSuffix; $o->$sFunc($this->_aConfig['name']); } else { $sFunc = 'onModule' . $sFuncSuffix; $o->$sFunc($a['table'], $a['field_id']); } } return <API key>; } /** * * Process the list of menu triggers provided in config array. * It must be specified in the module which adds menu item and in modules where menu items are added, @see BxDolMenu::processMenuTrigger * @param string $sOperation - operation type. */ protected function <API key>($sOperation) { if(empty($this->_aConfig['menu_triggers'])) return <API key>; foreach($this->_aConfig['menu_triggers'] as $sMenuTriggerName) BxDolMenu::processMenuTrigger($sMenuTriggerName); return <API key>; } /** * * Process the list of page triggers provided in config array. * It must be specified in the module which adds page block and in modules where page blocks are added, @see BxDolPage::processPageTrigger * @param string $sOperation - operation type. */ protected function <API key>($sOperation) { if(empty($this->_aConfig['page_triggers'])) return <API key>; foreach($this->_aConfig['page_triggers'] as $sPageTriggerName) BxDolPage::processPageTrigger($sPageTriggerName); return <API key>; } protected function <API key>($sOperation) { if(!in_array($sOperation, array('install', 'uninstall', 'enable', 'disable'))) return <API key>; $o = BxDolProfileQuery::getInstance(); $o-><API key>(); return <API key>; } /** * * Process the list of extended search forms provided in config array. * @param string $sOperation - operation type. */ protected function <API key>($sOperation) { if(empty($this->_aConfig['esearches'])) return <API key>; foreach($this->_aConfig['esearches'] as $sObject) { if(in_array($sOperation, array('install', 'enable', 'enable_success'))) BxDolSearchExtended::getObjectInstance($sObject); else if(in_array($sOperation, array('uninstall', 'disable'))) BxDolSearchExtended::getObjectInstance($sObject)->clean(); } return <API key>; } /** * * Process the list of transcoders provided in config array. * Transcoder objects to automatically register/unregister necessary alerts for. * @param string $sOperation - operation type. */ protected function <API key>($sOperation) { if(empty($this->_aConfig['transcoders'])) return <API key>; <API key>::<API key>($this->_aConfig['transcoders']); return <API key>; } /** * * Process the list of transcoders provided in config array. * Transcoder objects to automatically register/unregister necessary alerts for. * @param string $sOperation - operation type. */ protected function <API key>($sOperation) { if(empty($this->_aConfig['transcoders'])) return <API key>; <API key>::<API key>($this->_aConfig['transcoders']); <API key>::cleanupObjectsArray($this->_aConfig['transcoders']); return <API key>; } protected function actionClearDbCache($sOperation) { $oCache = $this->oDb->getDbCacheObject(); $bResult = $oCache->removeAllByPrefix('db_'); $bResult &= $this->oDb->cleanMemoryAll(); $aKeys = array_keys($GLOBALS); $aKeysPrefixes = array('<API key>'); foreach($aKeysPrefixes as $sKeyPrefix) foreach($aKeys as $sKey) if(substr($sKey, 0, strlen($sKeyPrefix)) == $sKeyPrefix) unset($GLOBALS[$sKey]); return $bResult ? <API key> : <API key>; } protected function <API key>($sOperation) { $aCaches = array('template', 'css', 'js'); $oCacheUtilities = BxDolCacheUtilities::getInstance(); foreach($aCaches as $sCache) { $aResult = $oCacheUtilities->clear($sCache); if($aResult === false) continue; if(isset($aResult['code']) && $aResult['code'] != 0) return <API key>; } return <API key>; } protected function _onInstallBefore() { return <API key>; } protected function _onInstallAfter() { return <API key>; } protected function _onEnableBefore() { return <API key>; } protected function _onEnableAfter() { BxDolCmts::onModuleEnable($this->_aConfig['name']); return <API key>; } protected function _onDisableBefore() { BxDolCmts::onModuleDisable($this->_aConfig['name']); return <API key>; } protected function _onDisableAfter() { return <API key>; } protected function _onUninstallBefore() { // check if module is already waiting while files are deleting if(self::<API key>($this->_aConfig['home_uri'])) return array( 'code' => <API key>, 'content' => _t('<API key>'), ); $<API key> = false; // delete comments and queue for deletion comments attachments $iFiles = 0; BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles); if($iFiles) $<API key> = true; // queue for deletion storage files if(!empty($this->_aConfig['storages']) && is_array($this->_aConfig['storages'])) foreach($this->_aConfig['storages'] as $s) if(($o = BxDolStorage::getObjectInstance($s)) && $o-><API key>()) $<API key> = true; // if some files were added to the queue, set module as pending uninstall if ($<API key>) { self::<API key>($this->_aConfig['home_uri']); return array( 'code' => <API key>, 'content' => _t('<API key>'), ); } return <API key>; } protected function _onUninstallAfter() { return <API key>; } protected function _perform($sOperationName, $aParams = array()) { $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response']; if(!defined('<API key>') && !defined('BX_DOL_CRON_EXECUTE') && !$GLOBALS['logged']['admin']) return array('message' => '<API key>', 'result' => false); $sMessage = ''; foreach($this->_aConfig[$sOperationName] as $sAction => $iEnabled) { $sMethod = 'action' . bx_gen_method_name($sAction); if($iEnabled == 0 || !method_exists($this, $sMethod)) continue; $mixedResult = $this->$sMethod($sOperationName); if((is_int($mixedResult) && (int)$mixedResult == <API key>) || (isset($mixedResult['code']) && (int)$mixedResult['code'] == <API key>)) { $sMessage .= $this->_displayResult($sAction, true, isset($mixedResult['content']) ? $mixedResult['content'] : '', $bHtmlResponce); continue; } $sMethodFailed = $sMethod . 'Failed'; return array('message' => $this->_displayResult($sAction, false, method_exists($this, $sMethodFailed) ? $this->$sMethodFailed($mixedResult) : $this-><API key>($mixedResult), $bHtmlResponce), 'result' => false); } if($this->_bShowOnSuccess) $sMessage = $this->_aActions['perform_' . $sOperationName]['success'] . $sMessage; return array('message' => $sMessage, 'result' => true); } protected function _displayResult($sAction, $bResult, $sResult = '', $bHtmlResponse = true) { if($bResult && !in_array($sAction, array('show_introduction', 'show_conclusion')) && !$this->_bShowOnSuccess) return ''; $sTitle = $this->_aActions[$sAction]['title'] . ' '; if(!empty($sResult)) $sResult = (substr($sResult, 0, 1) == '_' ? _t($sResult) : $sResult); $sContent = !empty($sResult) ? $sResult : _t($bResult ? '<API key>' : '<API key>'); if(!$bHtmlResponse) return $sTitle . $sContent; return BxDolStudioTemplate::getInstance()->parseHtmlByName('<API key>.html', array( 'color' => $bResult ? 'green' : 'red', 'title' => $sTitle, 'content' => $sContent )); } protected function _getFileManager() { $oFile = null; if($this->_bUseFtp) { $oFile = new BxDolFtp(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost', getParam('sys_ftp_login'), getParam('sys_ftp_password'), getParam('sys_ftp_dir')); if(!$oFile->connect()) return null; if(!$oFile->isUna()) return null; } else $oFile = BxDolFile::getInstance(); return $oFile; } protected function _isCompatibleWith() { $sVersionCur = bx_get_ver(); $bCompatible = false; if(isset($this->_aConfig['compatible_with']) && is_array($this->_aConfig['compatible_with'])) foreach($this->_aConfig['compatible_with'] as $iKey => $sVersionReq) $bCompatible = $bCompatible || (version_compare($sVersionCur, $sVersionReq, '>=') == 1); return $bCompatible; } protected function filePathWithoutBase($sPath) { return bx_ltrim_str($sPath, $this->_sModulePath); } protected function getMarkersForDb() { return array( 'from' => array('{db_name}'), 'to' => array(defined('BX_DATABASE_NAME') ? BX_DATABASE_NAME : ''), ); } protected function <API key>($sModuleUri, $iModuleId) { $this->oDb->cleanMemory('sys_modules_' . $sModuleUri); $this->oDb->cleanMemory('sys_modules_' . $iModuleId); $this->oDb->cleanMemory('sys_modules'); $this->oDb->cleanMemory('sys_modules_modules'); $this->oDb->cleanMemory('<API key>'); } }
<?php namespace Illuminate\Database\Eloquent; use Exception; use ArrayAccess; use JsonSerializable; use Illuminate\Support\Arr; use Illuminate\Support\Str; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Routing\UrlRoutable; use Illuminate\Contracts\Queue\QueueableEntity; use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Contracts\Queue\QueueableCollection; use Illuminate\Database\Query\Builder as QueryBuilder; use Illuminate\Database\<API key> as Resolver; abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable { use Concerns\HasAttributes, Concerns\HasEvents, Concerns\HasGlobalScopes, Concerns\HasRelationships, Concerns\HasTimestamps, Concerns\HidesAttributes, Concerns\GuardsAttributes; /** * The connection name for the model. * * @var string */ protected $connection; /** * The table associated with the model. * * @var string */ protected $table; /** * The primary key for the model. * * @var string */ protected $primaryKey = 'id'; /** * The "type" of the auto-incrementing ID. * * @var string */ protected $keyType = 'int'; /** * Indicates if the IDs are auto-incrementing. * * @var bool */ public $incrementing = true; /** * The relations to eager load on every query. * * @var array */ protected $with = []; /** * The relationship counts that should be eager loaded on every query. * * @var array */ protected $withCount = []; /** * The number of models to return for pagination. * * @var int */ protected $perPage = 15; /** * Indicates if the model exists. * * @var bool */ public $exists = false; /** * Indicates if the model was inserted during the current request lifecycle. * * @var bool */ public $wasRecentlyCreated = false; /** * The connection resolver instance. * * @var \Illuminate\Database\<API key> */ protected static $resolver; /** * The event dispatcher instance. * * @var \Illuminate\Contracts\Events\Dispatcher */ protected static $dispatcher; /** * The array of booted models. * * @var array */ protected static $booted = []; /** * The array of global scopes on the model. * * @var array */ protected static $globalScopes = []; /** * The name of the "created at" column. * * @var string */ const CREATED_AT = 'created_at'; /** * The name of the "updated at" column. * * @var string */ const UPDATED_AT = 'updated_at'; /** * Create a new Eloquent model instance. * * @param array $attributes * @return void */ public function __construct(array $attributes = []) { $this->bootIfNotBooted(); $this->syncOriginal(); $this->fill($attributes); } /** * Check if the model needs to be booted and if so, do it. * * @return void */ protected function bootIfNotBooted() { if (! isset(static::$booted[static::class])) { static::$booted[static::class] = true; $this->fireModelEvent('booting', false); static::boot(); $this->fireModelEvent('booted', false); } } /** * The "booting" method of the model. * * @return void */ protected static function boot() { static::bootTraits(); } /** * Boot all of the bootable traits on the model. * * @return void */ protected static function bootTraits() { $class = static::class; foreach (<API key>($class) as $trait) { if (method_exists($class, $method = 'boot'.class_basename($trait))) { forward_static_call([$class, $method]); } } } /** * Clear the list of booted models so they will be re-booted. * * @return void */ public static function clearBootedModels() { static::$booted = []; static::$globalScopes = []; } /** * Fill the model with an array of attributes. * * @param array $attributes * @return $this * * @throws \Illuminate\Database\Eloquent\<API key> */ public function fill(array $attributes) { $totallyGuarded = $this->totallyGuarded(); foreach ($this->fillableFromArray($attributes) as $key => $value) { $key = $this->removeTableFromKey($key); // The developers may choose to place some attributes in the "fillable" array // which means only those attributes may be set through mass assignment to // the model, and all others will just get ignored for security reasons. if ($this->isFillable($key)) { $this->setAttribute($key, $value); } elseif ($totallyGuarded) { throw new <API key>(sprintf( 'Add [%s] to fillable property to allow mass assignment on [%s].', $key, get_class($this) )); } } return $this; } /** * Fill the model with an array of attributes. Force mass assignment. * * @param array $attributes * @return $this */ public function forceFill(array $attributes) { return static::unguarded(function () use ($attributes) { return $this->fill($attributes); }); } /** * Qualify the given column name by the model's table. * * @param string $column * @return string */ public function qualifyColumn($column) { if (Str::contains($column, '.')) { return $column; } return $this->getTable().'.'.$column; } /** * Remove the table name from a given key. * * @param string $key * @return string */ protected function removeTableFromKey($key) { return Str::contains($key, '.') ? last(explode('.', $key)) : $key; } /** * Create a new instance of the given model. * * @param array $attributes * @param bool $exists * @return static */ public function newInstance($attributes = [], $exists = false) { // This method just provides a convenient way for us to generate fresh model // instances of this current model. It is particularly useful during the // hydration of new objects via the Eloquent query builder instances. $model = new static((array) $attributes); $model->exists = $exists; $model->setConnection( $this->getConnectionName() ); return $model; } /** * Create a new model instance that is existing. * * @param array $attributes * @param string|null $connection * @return static */ public function newFromBuilder($attributes = [], $connection = null) { $model = $this->newInstance([], true); $model->setRawAttributes((array) $attributes, true); $model->setConnection($connection ?: $this->getConnectionName()); $model->fireModelEvent('retrieved', false); return $model; } /** * Begin querying the model on a given connection. * * @param string|null $connection * @return \Illuminate\Database\Eloquent\Builder */ public static function on($connection = null) { // First we will just create a fresh instance of this model, and then we can // set the connection on the model so that it is be used for the queries // we execute, as well as being set on each relationship we retrieve. $instance = new static; $instance->setConnection($connection); return $instance->newQuery(); } /** * Begin querying the model on the write connection. * * @return \Illuminate\Database\Query\Builder */ public static function onWriteConnection() { $instance = new static; return $instance->newQuery()->useWritePdo(); } /** * Get all of the models from the database. * * @param array|mixed $columns * @return \Illuminate\Database\Eloquent\Collection|static[] */ public static function all($columns = ['*']) { return (new static)->newQuery()->get( is_array($columns) ? $columns : func_get_args() ); } /** * Begin querying a model with eager loading. * * @param array|string $relations * @return \Illuminate\Database\Eloquent\Builder|static */ public static function with($relations) { return (new static)->newQuery()->with( is_string($relations) ? func_get_args() : $relations ); } /** * Eager load relations on the model. * * @param array|string $relations * @return $this */ public function load($relations) { $query = $this-><API key>()->with( is_string($relations) ? func_get_args() : $relations ); $query->eagerLoadRelations([$this]); return $this; } /** * Eager load relations on the model if they are not already eager loaded. * * @param array|string $relations * @return $this */ public function loadMissing($relations) { $relations = is_string($relations) ? func_get_args() : $relations; return $this->load(array_filter($relations, function ($relation) { return ! $this->relationLoaded($relation); })); } /** * Increment a column's value by a given amount. * * @param string $column * @param int $amount * @param array $extra * @return int */ protected function increment($column, $amount = 1, array $extra = []) { return $this-><API key>($column, $amount, $extra, 'increment'); } /** * Decrement a column's value by a given amount. * * @param string $column * @param int $amount * @param array $extra * @return int */ protected function decrement($column, $amount = 1, array $extra = []) { return $this-><API key>($column, $amount, $extra, 'decrement'); } /** * Run the increment or decrement method on the model. * * @param string $column * @param int $amount * @param array $extra * @param string $method * @return int */ protected function <API key>($column, $amount, $extra, $method) { $query = $this->newQuery(); if (! $this->exists) { return $query->{$method}($column, $amount, $extra); } $this-><API key>($column, $amount, $extra, $method); return $query->where( $this->getKeyName(), $this->getKey() )->{$method}($column, $amount, $extra); } /** * Increment the underlying attribute value and sync with original. * * @param string $column * @param int $amount * @param array $extra * @param string $method * @return void */ protected function <API key>($column, $amount, $extra, $method) { $this->{$column} = $this->{$column} + ($method == 'increment' ? $amount : $amount * -1); $this->forceFill($extra); $this-><API key>($column); } /** * Update the model in the database. * * @param array $attributes * @param array $options * @return bool */ public function update(array $attributes = [], array $options = []) { if (! $this->exists) { return false; } return $this->fill($attributes)->save($options); } /** * Save the model and all of its relationships. * * @return bool */ public function push() { if (! $this->save()) { return false; } // To sync all of the relationships to the database, we will simply spin through // the relationships and save each model via this "push" method, which allows // us to recurse into all of these nested relations for the model instance. foreach ($this->relations as $models) { $models = $models instanceof Collection ? $models->all() : [$models]; foreach (array_filter($models) as $model) { if (! $model->push()) { return false; } } } return true; } /** * Save the model to the database. * * @param array $options * @return bool */ public function save(array $options = []) { $query = $this-><API key>(); // If the "saving" event returns false we'll bail out of the save and return // false, indicating that the save failed. This provides a chance for any // listeners to cancel save operations if validations fail or whatever. if ($this->fireModelEvent('saving') === false) { return false; } // If the model already exists in the database we can just update our record // that is already in this database using the current IDs in this "where" // clause to only update this model. Otherwise, we'll just insert them. if ($this->exists) { $saved = $this->isDirty() ? $this->performUpdate($query) : true; } // If the model is brand new, we'll insert it into our database and set the // ID attribute on the model to the value of the newly inserted row's ID // which is typically an auto-increment value managed by the database. else { $saved = $this->performInsert($query); if (! $this->getConnectionName() && $connection = $query->getConnection()) { $this->setConnection($connection->getName()); } } // If the model is successfully saved, we need to do a few more things once // that is done. We will call the "saved" method here to run any actions // we need to happen after a model gets successfully saved right here. if ($saved) { $this->finishSave($options); } return $saved; } /** * Save the model to the database using transaction. * * @param array $options * @return bool * * @throws \Throwable */ public function saveOrFail(array $options = []) { return $this->getConnection()->transaction(function () use ($options) { return $this->save($options); }); } /** * Perform any actions that are necessary after the model is saved. * * @param array $options * @return void */ protected function finishSave(array $options) { $this->fireModelEvent('saved', false); if ($this->isDirty() && ($options['touch'] ?? true)) { $this->touchOwners(); } $this->syncOriginal(); } /** * Perform a model update operation. * * @param \Illuminate\Database\Eloquent\Builder $query * @return bool */ protected function performUpdate(Builder $query) { // If the updating event returns false, we will cancel the update operation so // developers can hook Validation systems into their models and cancel this // operation if the model does not pass validation. Otherwise, we update. if ($this->fireModelEvent('updating') === false) { return false; } // First we need to create a fresh query instance and touch the creation and // update timestamp on the model which are maintained by us for developer // convenience. Then we will just continue saving the model instances. if ($this->usesTimestamps()) { $this->updateTimestamps(); } // Once we have run the update operation, we will fire the "updated" event for // this model instance. This will allow developers to hook into these after // models are updated, giving them a chance to do any special processing. $dirty = $this->getDirty(); if (count($dirty) > 0) { $this->setKeysForSaveQuery($query)->update($dirty); $this->fireModelEvent('updated', false); $this->syncChanges(); } return true; } /** * Set the keys for a save update query. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ protected function setKeysForSaveQuery(Builder $query) { $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); return $query; } /** * Get the primary key value for a save query. * * @return mixed */ protected function getKeyForSaveQuery() { return $this->original[$this->getKeyName()] ?? $this->getKey(); } /** * Perform a model insert operation. * * @param \Illuminate\Database\Eloquent\Builder $query * @return bool */ protected function performInsert(Builder $query) { if ($this->fireModelEvent('creating') === false) { return false; } // First we'll need to create a fresh query instance and touch the creation and // update timestamps on this model, which are maintained by us for developer // convenience. After, we will just continue saving these model instances. if ($this->usesTimestamps()) { $this->updateTimestamps(); } // If the model has an incrementing key, we can use the "insertGetId" method on // the query builder, which will give us back the final inserted ID for this // table from the database. Not all tables have to be incrementing though. $attributes = $this->attributes; if ($this->getIncrementing()) { $this->insertAndSetId($query, $attributes); } // If the table isn't incrementing we'll simply insert these attributes as they // are. These attribute arrays must contain an "id" column previously placed // there by the developer as the manually determined key for these models. else { if (empty($attributes)) { return true; } $query->insert($attributes); } // We will go ahead and set the exists property to true, so that it is set when // the created event is fired, just in case the developer tries to update it // during the event. This will allow them to do so and run an update here. $this->exists = true; $this->wasRecentlyCreated = true; $this->fireModelEvent('created', false); return true; } /** * Insert the given attributes and set the ID on the model. * * @param \Illuminate\Database\Eloquent\Builder $query * @param array $attributes * @return void */ protected function insertAndSetId(Builder $query, $attributes) { $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); $this->setAttribute($keyName, $id); } /** * Destroy the models for the given IDs. * * @param array|int $ids * @return int */ public static function destroy($ids) { // We'll initialize a count here so we will return the total number of deletes // for the operation. The developers can then check this number as a boolean // type value or get this total count of records deleted for logging, etc. $count = 0; $ids = is_array($ids) ? $ids : func_get_args(); // We will actually pull the models from the database table and call delete on // each of them individually so that their events get fired properly with a // correct set of attributes in case the developers wants to check these. $key = ($instance = new static)->getKeyName(); foreach ($instance->whereIn($key, $ids)->get() as $model) { if ($model->delete()) { $count++; } } return $count; } /** * Delete the model from the database. * * @return bool|null * * @throws \Exception */ public function delete() { if (is_null($this->getKeyName())) { throw new Exception('No primary key defined on model.'); } // If the model doesn't exist, there is nothing to delete so we'll just return // immediately and not do anything else. Otherwise, we will continue with a // deletion process on the model, firing the proper events, and so forth. if (! $this->exists) { return; } if ($this->fireModelEvent('deleting') === false) { return false; } // Here, we'll touch the owning models, verifying these timestamps get updated // for the models. This will allow any caching to get broken on the parents // by the timestamp. Then we will go ahead and delete the model instance. $this->touchOwners(); $this-><API key>(); // Once the model has been deleted, we will fire off the deleted event so that // the developers may hook into post-delete operations. We will then return // a boolean true as the delete is presumably successful on the database. $this->fireModelEvent('deleted', false); return true; } /** * Force a hard delete on a soft deleted model. * * This method protects developers from running forceDelete when trait is missing. * * @return bool|null */ public function forceDelete() { return $this->delete(); } /** * Perform the actual delete query on this model instance. * * @return void */ protected function <API key>() { $this->setKeysForSaveQuery($this-><API key>())->delete(); $this->exists = false; } /** * Begin querying the model. * * @return \Illuminate\Database\Eloquent\Builder */ public static function query() { return (new static)->newQuery(); } /** * Get a new query builder for the model's table. * * @return \Illuminate\Database\Eloquent\Builder */ public function newQuery() { return $this-><API key>($this-><API key>()); } /** * Get a new query builder with no relationships loaded. * * @return \Illuminate\Database\Eloquent\Builder */ public function <API key>() { return $this-><API key>( $this->newEloquentBuilder($this->newBaseQueryBuilder())->setModel($this) ); } /** * Register the global scopes for this builder instance. * * @param \Illuminate\Database\Eloquent\Builder $builder * @return \Illuminate\Database\Eloquent\Builder */ public function <API key>($builder) { foreach ($this->getGlobalScopes() as $identifier => $scope) { $builder->withGlobalScope($identifier, $scope); } return $builder; } /** * Get a new query builder that doesn't have any global scopes. * * @return \Illuminate\Database\Eloquent\Builder|static */ public function <API key>() { $builder = $this->newEloquentBuilder($this->newBaseQueryBuilder()); // Once we have the query builders, we will set the model instances so the // builder can easily access any information it may need from the model // while it is constructing and executing various queries against it. return $builder->setModel($this) ->with($this->with) ->withCount($this->withCount); } /** * Get a new query instance without a given scope. * * @param \Illuminate\Database\Eloquent\Scope|string $scope * @return \Illuminate\Database\Eloquent\Builder */ public function <API key>($scope) { $builder = $this->newQuery(); return $builder->withoutGlobalScope($scope); } /** * Get a new query to restore one or more models by their queueable IDs. * * @param array|int $ids * @return \Illuminate\Database\Eloquent\Builder */ public function <API key>($ids) { return is_array($ids) ? $this-><API key>()->whereIn($this->getQualifiedKeyName(), $ids) : $this-><API key>()->whereKey($ids); } /** * Create a new Eloquent query builder for the model. * * @param \Illuminate\Database\Query\Builder $query * @return \Illuminate\Database\Eloquent\Builder|static */ public function newEloquentBuilder($query) { return new Builder($query); } /** * Get a new query builder instance for the connection. * * @return \Illuminate\Database\Query\Builder */ protected function newBaseQueryBuilder() { $connection = $this->getConnection(); return new QueryBuilder( $connection, $connection->getQueryGrammar(), $connection->getPostProcessor() ); } /** * Create a new Eloquent Collection instance. * * @param array $models * @return \Illuminate\Database\Eloquent\Collection */ public function newCollection(array $models = []) { return new Collection($models); } /** * Create a new pivot model instance. * * @param \Illuminate\Database\Eloquent\Model $parent * @param array $attributes * @param string $table * @param bool $exists * @param string|null $using * @return \Illuminate\Database\Eloquent\Relations\Pivot */ public function newPivot(self $parent, array $attributes, $table, $exists, $using = null) { return $using ? $using::fromRawAttributes($parent, $attributes, $table, $exists) : Pivot::fromAttributes($parent, $attributes, $table, $exists); } /** * Convert the model instance to an array. * * @return array */ public function toArray() { return array_merge($this->attributesToArray(), $this->relationsToArray()); } /** * Convert the model instance to JSON. * * @param int $options * @return string * * @throws \Illuminate\Database\Eloquent\<API key> */ public function toJson($options = 0) { $json = json_encode($this->jsonSerialize(), $options); if (JSON_ERROR_NONE !== json_last_error()) { throw <API key>::forModel($this, json_last_error_msg()); } return $json; } /** * Convert the object into something JSON serializable. * * @return array */ public function jsonSerialize() { return $this->toArray(); } /** * Reload a fresh model instance from the database. * * @param array|string $with * @return static|null */ public function fresh($with = []) { if (! $this->exists) { return; } return static::<API key>() ->with(is_string($with) ? func_get_args() : $with) ->where($this->getKeyName(), $this->getKey()) ->first(); } /** * Reload the current model instance with fresh attributes from the database. * * @return $this */ public function refresh() { if (! $this->exists) { return $this; } $this->setRawAttributes( static::<API key>()->findOrFail($this->getKey())->attributes ); $this->load(collect($this->relations)->except('pivot')->keys()->toArray()); $this->syncOriginal(); return $this; } /** * Clone the model into a new, non-existing instance. * * @param array|null $except * @return \Illuminate\Database\Eloquent\Model */ public function replicate(array $except = null) { $defaults = [ $this->getKeyName(), $this->getCreatedAtColumn(), $this->getUpdatedAtColumn(), ]; $attributes = Arr::except( $this->attributes, $except ? array_unique(array_merge($except, $defaults)) : $defaults ); return tap(new static, function ($instance) use ($attributes) { $instance->setRawAttributes($attributes); $instance->setRelations($this->relations); }); } /** * Determine if two models have the same ID and belong to the same table. * * @param \Illuminate\Database\Eloquent\Model|null $model * @return bool */ public function is($model) { return ! is_null($model) && $this->getKey() === $model->getKey() && $this->getTable() === $model->getTable() && $this->getConnectionName() === $model->getConnectionName(); } /** * Determine if two models are not the same. * * @param \Illuminate\Database\Eloquent\Model|null $model * @return bool */ public function isNot($model) { return ! $this->is($model); } /** * Get the database connection for the model. * * @return \Illuminate\Database\Connection */ public function getConnection() { return static::resolveConnection($this->getConnectionName()); } /** * Get the current connection name for the model. * * @return string */ public function getConnectionName() { return $this->connection; } /** * Set the connection associated with the model. * * @param string $name * @return $this */ public function setConnection($name) { $this->connection = $name; return $this; } /** * Resolve a connection instance. * * @param string|null $connection * @return \Illuminate\Database\Connection */ public static function resolveConnection($connection = null) { return static::$resolver->connection($connection); } /** * Get the connection resolver instance. * * @return \Illuminate\Database\<API key> */ public static function <API key>() { return static::$resolver; } /** * Set the connection resolver instance. * * @param \Illuminate\Database\<API key> $resolver * @return void */ public static function <API key>(Resolver $resolver) { static::$resolver = $resolver; } /** * Unset the connection resolver for models. * * @return void */ public static function <API key>() { static::$resolver = null; } /** * Get the table associated with the model. * * @return string */ public function getTable() { if (! isset($this->table)) { return str_replace( '\\', '', Str::snake(Str::plural(class_basename($this))) ); } return $this->table; } /** * Set the table associated with the model. * * @param string $table * @return $this */ public function setTable($table) { $this->table = $table; return $this; } /** * Get the primary key for the model. * * @return string */ public function getKeyName() { return $this->primaryKey; } /** * Set the primary key for the model. * * @param string $key * @return $this */ public function setKeyName($key) { $this->primaryKey = $key; return $this; } /** * Get the table qualified key name. * * @return string */ public function getQualifiedKeyName() { return $this->qualifyColumn($this->getKeyName()); } /** * Get the auto-incrementing key type. * * @return string */ public function getKeyType() { return $this->keyType; } /** * Set the data type for the primary key. * * @param string $type * @return $this */ public function setKeyType($type) { $this->keyType = $type; return $this; } /** * Get the value indicating whether the IDs are incrementing. * * @return bool */ public function getIncrementing() { return $this->incrementing; } /** * Set whether IDs are incrementing. * * @param bool $value * @return $this */ public function setIncrementing($value) { $this->incrementing = $value; return $this; } /** * Get the value of the model's primary key. * * @return mixed */ public function getKey() { return $this->getAttribute($this->getKeyName()); } /** * Get the queueable identity for the entity. * * @return mixed */ public function getQueueableId() { return $this->getKey(); } /** * Get the queueable relationships for the entity. * * @return array */ public function <API key>() { $relations = []; foreach ($this->getRelations() as $key => $relation) { if (method_exists($this, $key)) { $relations[] = $key; } if ($relation instanceof QueueableCollection) { foreach ($relation-><API key>() as $collectionValue) { $relations[] = $key.'.'.$collectionValue; } } if ($relation instanceof QueueableEntity) { foreach ($relation-><API key>() as $entityKey => $entityValue) { $relations[] = $key.'.'.$entityValue; } } } return array_unique($relations); } /** * Get the queueable connection for the entity. * * @return mixed */ public function <API key>() { return $this->getConnectionName(); } /** * Get the value of the model's route key. * * @return mixed */ public function getRouteKey() { return $this->getAttribute($this->getRouteKeyName()); } /** * Get the route key for the model. * * @return string */ public function getRouteKeyName() { return $this->getKeyName(); } /** * Retrieve the model for a bound value. * * @param mixed $value * @return \Illuminate\Database\Eloquent\Model|null */ public function resolveRouteBinding($value) { return $this->where($this->getRouteKeyName(), $value)->first(); } /** * Get the default foreign key name for the model. * * @return string */ public function getForeignKey() { return Str::snake(class_basename($this)).'_'.$this->getKeyName(); } /** * Get the number of models to return per page. * * @return int */ public function getPerPage() { return $this->perPage; } /** * Set the number of models to return per page. * * @param int $perPage * @return $this */ public function setPerPage($perPage) { $this->perPage = $perPage; return $this; } /** * Dynamically retrieve attributes on the model. * * @param string $key * @return mixed */ public function __get($key) { return $this->getAttribute($key); } /** * Dynamically set attributes on the model. * * @param string $key * @param mixed $value * @return void */ public function __set($key, $value) { $this->setAttribute($key, $value); } /** * Determine if the given attribute exists. * * @param mixed $offset * @return bool */ public function offsetExists($offset) { return ! is_null($this->getAttribute($offset)); } /** * Get the value for a given offset. * * @param mixed $offset * @return mixed */ public function offsetGet($offset) { return $this->getAttribute($offset); } /** * Set the value for a given offset. * * @param mixed $offset * @param mixed $value * @return void */ public function offsetSet($offset, $value) { $this->setAttribute($offset, $value); } /** * Unset the value for a given offset. * * @param mixed $offset * @return void */ public function offsetUnset($offset) { unset($this->attributes[$offset], $this->relations[$offset]); } /** * Determine if an attribute or relation exists on the model. * * @param string $key * @return bool */ public function __isset($key) { return $this->offsetExists($key); } /** * Unset an attribute on the model. * * @param string $key * @return void */ public function __unset($key) { $this->offsetUnset($key); } /** * Handle dynamic method calls into the model. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { if (in_array($method, ['increment', 'decrement'])) { return $this->$method(...$parameters); } return $this->newQuery()->$method(...$parameters); } /** * Handle dynamic static method calls into the method. * * @param string $method * @param array $parameters * @return mixed */ public static function __callStatic($method, $parameters) { return (new static)->$method(...$parameters); } /** * Convert the model to its string representation. * * @return string */ public function __toString() { return $this->toJson(); } /** * When a model is being unserialized, check if it needs to be booted. * * @return void */ public function __wakeup() { $this->bootIfNotBooted(); } }
using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using ECommon.Components; using ECommon.Scheduling; using ECommon.Socketing; using EQueue.Protocols; namespace EQueue.Broker.Client { public class ConsumerManager { private readonly <API key><string, ConsumerGroup> _consumerGroupDict = new <API key><string, ConsumerGroup>(); private readonly IScheduleService _scheduleService; public ConsumerManager() { _scheduleService = ObjectContainer.Resolve<IScheduleService>(); } public void Start() { _consumerGroupDict.Clear(); _scheduleService.StartTask("<API key>", <API key>, 1000, 1000); } public void Shutdown() { _consumerGroupDict.Clear(); _scheduleService.StopTask("<API key>"); } public void RegisterConsumer(string groupName, string consumerId, IEnumerable<string> subscriptionTopics, IEnumerable<MessageQueueEx> consumingQueues, ITcpConnection connection) { var consumerGroup = _consumerGroupDict.GetOrAdd(groupName, key => new ConsumerGroup(key)); consumerGroup.RegisterConsumer(connection, consumerId, subscriptionTopics.ToList(), consumingQueues.ToList()); } public void RemoveConsumer(string connectionId) { foreach (var consumerGroup in _consumerGroupDict.Values) { consumerGroup.RemoveConsumer(connectionId); } } public int <API key>() { return _consumerGroupDict.Count; } public IEnumerable<ConsumerGroup> <API key>() { return _consumerGroupDict.Values.ToList(); } public int GetAllConsumerCount() { return <API key>().Sum(x => x.GetConsumerCount()); } public ConsumerGroup GetConsumerGroup(string groupName) { ConsumerGroup consumerGroup; if (_consumerGroupDict.TryGetValue(groupName, out consumerGroup)) { return consumerGroup; } return null; } public int GetConsumerCount(string groupName) { ConsumerGroup consumerGroup; if (_consumerGroupDict.TryGetValue(groupName, out consumerGroup)) { return consumerGroup.GetConsumerCount(); } return 0; } public int <API key>(string groupName, string topic, int queueId) { ConsumerGroup consumerGroup; if (_consumerGroupDict.TryGetValue(groupName, out consumerGroup)) { return consumerGroup.<API key>(topic, queueId); } return 0; } public bool IsConsumerActive(string consumerGroup, string consumerId) { var group = GetConsumerGroup(consumerGroup); return group != null && group.IsConsumerActive(consumerId); } public bool <API key>(string topic, int queueId) { var groups = <API key>(); foreach (var group in groups) { if (group.<API key>(topic, queueId)) { return true; } } return false; } private void <API key>() { foreach (var consumerGroup in _consumerGroupDict.Values) { consumerGroup.<API key>(); } } } }
<?php namespace Phrest\Skeleton\v1\Requests\Users; use Phrest\SDK\Request\AbstractRequest; use Phrest\SDK\Request\RequestOptions; use Phrest\SDK\PhrestSDK; class CreateUserRequest extends AbstractRequest { /** * @var string */ private $path = '/v1/users/'; /** * @var string */ public $name = null; /** * @var string */ public $email = null; /** * @var string */ public $password = null; /** * @param string $name * @param string $email * @param string $password */ public function __construct($name = null, $email = null, $password = null) { $this->name = $name; $this->email = $email; $this->password = $password; } public function create() { $requestOptions = new RequestOptions(); $requestOptions->addPostParams( [ 'name' => $this->name, 'email' => $this->email, 'password' => $this->password, ] ); return PhrestSDK::getResponse( self::METHOD_POST, $this->path, $requestOptions ); } /** * @param string $name * * @return static */ public function setName($name) { $this->name = $name; return $this; } /** * @param string $email * * @return static */ public function setEmail($email) { $this->email = $email; return $this; } /** * @param string $password * * @return static */ public function setPassword($password) { $this->password = $password; return $this; } }
'use strict'; // Require the module. const gulpRequireTasks = require('gulp-require-tasks'); const gulp = require('gulp'); const env = require('../index'); // Call it when necessary. gulpRequireTasks({ // Pass any options to it. Please see below. path: env.inConfigs('gulp', 'tasks')// This is default }); gulp.task('default', ['scripts:build', 'json-copy:build']);
// Uncomment the following to provide samples for PageResult<T>. Must also add the Microsoft.AspNet.WebApi.OData // package to your project. /#define <API key> using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net.Http.Headers; using System.Reflection; using System.Web; using System.Web.Http; #if <API key> using System.Web.Http.OData; #endif namespace MusicStore.Services.Areas.HelpPage { <summary> Use this class to customize the Help Page. For example you can set a custom <see cref="System.Web.Http.Description.<API key>"/> to supply the documentation or you can provide the samples for the requests/responses. </summary> public static class HelpPageConfig { [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "MusicStore.Services.Areas.HelpPage.TextSample.#ctor(System.String)", Justification = "End users may choose to merge this string with existing localized resources.")] [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "bsonspec", Justification = "Part of a URI.")] public static void Register(HttpConfiguration config) { / Uncomment the following to use the documentation from XML documentation file. //config.<API key>(new <API key>(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml"))); / Uncomment the following to use "sample string" as the sample for all actions that have string as the body parameter or return type. / Also, the string arrays will be used for IEnumerable<string>. The sample objects will be serialized into different media type / formats by the available formatters. //config.SetSampleObjects(new Dictionary<Type, object> // {typeof(string), "sample string"}, // {typeof(IEnumerable<string>), new string[]{"sample 1", "sample 2"}} // Extend the following to provide factories for types not handled automatically (those lacking parameterless // constructors) or for which you prefer to use non-default property values. Line below provides a fallback // since automatic handling will fail and GeneratePageResult handles only a single type. #if <API key> config.<API key>().<API key>.Add(GeneratePageResult); #endif // Extend the following to use a preset object directly as the sample for all actions that support a media // type, regardless of the body parameter or return type. The lines below avoid display of binary content. // The <API key> (if available) is not used to serialize the TextSample object. config.<API key>( new TextSample("Binary JSON content. See http://bsonspec.org for details."), new <API key>("application/bson")); / Uncomment the following to use "[0]=foo&[1]=bar" directly as the sample for all actions that support form URL encoded format / and have IEnumerable<string> as the body parameter or return type. //config.SetSampleForType("[0]=foo&[1]=bar", new <API key>("application/<API key>"), typeof(IEnumerable<string>)); / Uncomment the following to use "1234" directly as the request sample for media type "text/plain" on the controller named "Values" / and action named "Put". //config.SetSampleRequest("1234", new <API key>("text/plain"), "Values", "Put"); / Uncomment the following to use the image on "../images/aspNetHome.png" directly as the response sample for media type "image/png" / on the controller named "Values" and action named "Get" with parameter "id". //config.SetSampleResponse(new ImageSample("../images/aspNetHome.png"), new <API key>("image/png"), "Values", "Get", "id"); / Uncomment the following to correct the sample request when the action expects an HttpRequestMessage with ObjectContent<string>. / The sample will be generated as if the controller named "Values" and action named "Get" were having string as the body parameter. //config.<API key>(typeof(string), "Values", "Get"); / Uncomment the following to correct the sample response when the action returns an HttpResponseMessage with ObjectContent<string>. / The sample will be generated as if the controller named "Values" and action named "Post" were returning a string. //config.<API key>(typeof(string), "Values", "Post"); } #if <API key> private static object GeneratePageResult(<API key> sampleGenerator, Type type) { if (type.IsGenericType) { Type openGenericType = type.<API key>(); if (openGenericType == typeof(PageResult<>)) { // Get the T in PageResult<T> Type[] typeParameters = type.GetGenericArguments(); Debug.Assert(typeParameters.Length == 1); // Create an enumeration to pass as the first parameter to the PageResult<T> constuctor Type itemsType = typeof(List<>).MakeGenericType(typeParameters); object items = sampleGenerator.GetSampleObject(itemsType); // Fill in the other information needed to invoke the PageResult<T> constuctor Type[] parameterTypes = new Type[] { itemsType, typeof(Uri), typeof(long?), }; object[] parameters = new object[] { items, null, (long)ObjectGenerator.<API key>, }; // Call PageResult(IEnumerable<T> items, Uri nextPageLink, long? count) constructor ConstructorInfo constructor = type.GetConstructor(parameterTypes); return constructor.Invoke(parameters); } } return null; } #endif } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CacheCow.Server.EntityTagStore.SqlServer { internal class ColumnNames { public static string CacheKeyHash = "CacheKeyHash"; public static string RoutePattern = "RoutePattern"; public static string ResourceUri = "ResourceUri"; public static string ETag = "ETag"; public static string LastModified = "LastModified"; } }
import * as React from "react"; import { CarbonIconProps } from "../../"; declare const Laptop24: React.<API key>< CarbonIconProps & React.RefAttributes<SVGSVGElement> >; export default Laptop24;
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title> Singapore Gurkhas 070216 Gcspf Gurkha Contingent Archives Kkg 23</title> <!-- URL Structures --> <link rel="canonical" href="http://sgpm-generator.github.io/<API key>/<API key>.html"> <link rel="alternate" type="application/rss+xml" title="Singapore Gurkha Photography Museum" href="http://sgpm-generator.github.io/feed.xml"> <!-- OPENGRAPH tags for Social Media linking --> <meta content="Singapore Gurkha Photography Museum" property="og:site_name"> <meta content=" Singapore Gurkhas 070216 Gcspf Gurkha Contingent Archives Kkg 23" property="og:title"> <meta content="article" property="og:type"> <meta name="description" content=" &lt;h1&gt;&lt;/h1&gt; {"1950s"=&gt;[#&lt;Jekyll::Document _posts/<API key>.md collect..." property="og:description"> <meta content="http://sgpm-generator.github.io/<API key>/<API key>.html" property="og:url"> <meta content="2014-10-07T00:00:00+08:00" property="article:published_time"> <meta content="http://sgpm-generator.github.io/about/" property="article:author"> <meta content="" property="og:image"> <meta content="<API key>" property="article:section"> <meta content="1950s" property="article:tag"> <meta content="1960s" property="article:tag"> <meta content="1970s" property="article:tag"> <meta content="1980s" property="article:tag"> <meta content="1990s" property="article:tag"> <meta content="bhairahawa" property="article:tag"> <meta content="dharan" property="article:tag"> <meta content="gurkhas" property="article:tag"> <meta content="kathmandu" property="article:tag"> <meta content="nepal" property="article:tag"> <meta content="pokhara" property="article:tag"> <meta content="singapore" property="article:tag"> <meta content="singapore gurkha archive" property="article:tag"> <meta content="singapore gurkha old photographs" property="article:tag"> <meta content="singapore gurkha photography museum" property="article:tag"> <meta content="singapore gurkhas" property="article:tag"> <!-- OPENGRAPH tags end --> <!-- CSS --> <link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap-theme.min.css"> <!-- Custom CSS --> <style> @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700italic,700,400italic); .sgpm-title a { color: #030303; } .main-gallery > ul { margin-bottom:1.414em; padding-left:0; } .no-bullets { list-style:none; padding-left:0; } .no-bullets > ul { list-style:none; padding-left:0; } body {min-width:420px;} footer { margin-top:2.84em; padding-top:1.414em; border-top:0.3px solid #aaa ; } header { margin-bottom:2.84em; } main { display:block; clear:both; } </style> </head> <body class="container"> <header class="row"> <!-- masthead --> <div class="col-xs-4" style="display:table-block;"> <h1 class="sgpm-title hidden-xs hidden-sm"><strong><a class="site-title" href="/">Singapore Gurkha Photography Museum</a></strong></h1> <h2 class="sgpm-title visible-sm"><strong><a class="site-title" href="/">Singapore Gurkha Photography Museum</a></strong></h2> <h3 class="sgpm-title visible-xs"><strong><a class="site-title" href="/">Singapore Gurkha Photography Museum</a></strong></h3> <!-- searchbar--> <div class=""> <div class="input-group"> <input type="text" class="form-control" placeholder="Search for..."> <span class="input-group-btn"> <button class="btn btn-default" type="button"><span class="hidden-xs">Search</span><span class="visible-xs">Go</span></button> </span> </div> </div> <!-- searchbar end --> </div> <!-- masthead end --> <nav class="col-xs-4 col-xs-offset-2 col-sm-offset-1"> <ul class="nav col-xs-12" style="padding-top:1.41em;border-left:solid 0.3px #aaa" > <!-- navlinks --> <li class="active"> <a href="/about.html">About</a> </li> <li class="active"> <a href="/archive.html">Archive</a> </li> <li class="active"> <a href="/articles.html">Articles</a> </li> <li class="active"> <a href="/contact.html">Contact</a> </li> <!-- navlinks end--> <!-- dev links --> <li class="small">(these are links for development)</li> <li class="active"> <a href="/sgpm-list.html">Brute Force List</a> </li> <li class="active"> <a href="/basic-generator.html">Brute Generator</a> </li> <!-- dev links end--> </ul> </nav> </header> <main class="row"> <section class="col-sm-6 col-xs-12"> <a href="../img/<API key>.jpg"> <img class="img-responsive" src="../img/<API key>.jpg" /> </a> </section> <section class="col-sm-6 col-xs-12"> <ul style="list-style:none;margin-left:0;"> <li><h3>Photo from: <API key></h3></li> <li> Was at Pasir Ris annual picnic, Nar Bahadur Gurung (4910). Lifeguard at Penguin swimming pool, Pokhara. Date: Late 1970s. </li> <a href="/tags/1950s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1950s </li></a> <a href="/tags/1960s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1960s </li></a> <a href="/tags/1970s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1970s </li></a> <a href="/tags/1980s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1980s </li></a> <a href="/tags/1990s" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> 1990s </li></a> <a href="/tags/bhairahawa" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> bhairahawa </li></a> <a href="/tags/dharan" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> dharan </li></a> <a href="/tags/gurkhas" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> gurkhas </li></a> <a href="/tags/kathmandu" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> kathmandu </li></a> <a href="/tags/nepal" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> nepal </li></a> <a href="/tags/pokhara" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> pokhara </li></a> <a href="/tags/singapore" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore </li></a> <a href="/tags/singapore gurkha archive" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkha archive </li></a> <a href="/tags/singapore gurkha old photographs" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkha old photographs </li></a> <a href="/tags/singapore gurkha photography museum" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkha photography museum </li></a> <a href="/tags/singapore gurkhas" style="padding:3px; display:inline-block; background:#eee; margin-bottom:2px;"><li> singapore gurkhas </li></a> </ul> </section> </main> <footer class="row"> <div class="col-sm-4"> <h5 style="margin:0;font-weight:600;">©2016 Singapore Gurkha Photography Museum</h5> </div> <div class="col-sm-4"> <ul class="no-bullets"> <!-- contact --> <li><strong>email: </strong><a href="mailto:mail@zakariazainal.com">mail@zakariazainal.com</a></li> <!-- social media --> </ul> </div> <div class="col-sm-4"> <p class="small">The Singapore Gurkha Photography Museum project is an online archive of photographs and documents contributed by former members of the Singapore Gurkhas. </p> </div> </footer> <!-- jQuery --> <script src="/js/jquery.js"></script> <!-- Bootstrap Core JavaScript --> <script src="/js/bootstrap.min.js"></script> </body> </html>
<!DOCTYPE html> <!--[if IE 7]> <html class="ie ie7" lang="en"> <![endif] <!--[if IE 8]> <html class="ie ie8" lang="en"> <![endif] <!--[if !(IE 7) | !(IE 8) ]><!--> <html> <head lang="en"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <title>,,,,</title> <meta name="keywords" content=",APP,,,,,,,,,,"> <meta name="description" content="APP-"> <link rel="icon" href="./favicon.ico" type="image/x-icon"> <link rel="stylesheet" href="./css/app_welcome.css"> </head> <body> <div id="skrollr-body" class="aw_main" <API key>="on"> <article class="aw_hero"> <div class="aw_hero_bg"> <img src="./assets/imgs/page1_bg.jpg" title="APP "> </div> <section class="aw_page1_intro" data-0="opacity:1;" data-5="opacity:0;"> <!-- Begin APP --> <div class="aw_brand"> <div class="aw_brand_logo"> <img src="./assets/imgs/aw_logo.png" title="app welcome page logo"> </div> <h1 class="aw_brand_statement"> </h1> </div> <!-- End APP --> <!-- Begin AO --> <div class="aw_aoDo"> <div class="aw_aoDo_list"> <span class="aw_aoDo_amount">&nbsp;20&nbsp;</span> <span id="aw_aoDo_name">Charles</span> </div> <div class="aw_aoDo_detail"> </div> </div> <!-- End AO --> </section> <section class="aw_page1_data" data-0="opacity: 0;" data-5="opacity: 1; display: block;"> <!-- Begin AO --> <div class="aw_aoDiff"> <div class="aw_aoDiff_statement"> <p></p> <p></p> </div> <div class="aw_aoDiff_detail"> <div class="aw_aoDiff_item"> <span class="<API key>">Top10 </span> <span class="aw_aoDiff_item_num">20%</span> <span class="aw_aoDiff_item_line">&nbsp;</span> </div> <div class="aw_aoDiff_item"> <span class="<API key>">Top20 </span> <span class="aw_aoDiff_item_num">35%</span> <span class="aw_aoDiff_item_line">&nbsp;</span> </div> <div class="aw_aoDiff_item"> <span class="<API key>">Top30 </span> <span class="aw_aoDiff_item_num">65%</span> <span class="aw_aoDiff_item_line">&nbsp;</span> </div> <div class="aw_aoDiff_item"> <span class="<API key>">Top80 </span> <span class="aw_aoDiff_item_num">100%</span> <span class="aw_aoDiff_item_line">&nbsp;</span> </div> </div> </div> <div class="aw_skip"> <a href="http://welcome.appedu.org"></a> </div> <!-- End AO --> </section> </article> <!-- Begin AO --> <article class="aw_ao"> <div class="aw_ao_statement"> <h1></h1> <p>APP</p> </div> <div class="aw_ao_wrap"> <section class="aw_ao_detail aw_ao_charles"> <img class="aw_ao_img" src="./assets/imgs/ao_charles.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Charles</h2> <div class="aw_ao_experience"> <h3></h3> <ul> <li>1. </li> <li>2. </li> <li>3. APP</li> </ul> </div> </div> </section> <section class="aw_ao_detail aw_ao_becky"> <img class="aw_ao_img" src="./assets/imgs/ao_becky.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Becky</h2> <div class="aw_ao_experience"> <h3></h3> <ul> <li>1. </li> <li>2. </li> <li>3. </li> </ul> </div> </div> </section> <section class="aw_ao_detail aw_ao_lisa"> <img class="aw_ao_img" src="./assets/imgs/ao_lisa.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Lisa</h2> <div class="aw_ao_experience"> <h3></h3> <ul> <li>1. </li> <li>2. </li> </ul> </div> </div> </section> <section class="aw_ao_detail aw_ao_steve"> <img class="aw_ao_img" src="./assets/imgs/ao_steve.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Steve</h2> <div class="aw_ao_experience"> <h3></h3> <p> 11 </p> </div> </div> </section> <section class="aw_ao_detail aw_ao_tracy"> <img class="aw_ao_img" src="./assets/imgs/ao_tracy.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Tracy</h2> <div class="aw_ao_experience"> <h3></h3> <ul> <li>1. </li> <li>2. </li> <li>3. APP</li> </ul> </div> </div> </section> <section class="aw_ao_detail aw_ao_carlos"> <img class="aw_ao_img" src="./assets/imgs/ao_carlos.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Carlos</h2> <div class="aw_ao_experience"> <h3></h3> <ul> <li>1. </li> <li>2. 16</li> </ul> </div> </div> </section> <section class="aw_ao_detail aw_ao_foster"> <img class="aw_ao_img" src="./assets/imgs/ao_foster.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Foster</h2> <div class="aw_ao_experience"> <h3></h3> <ul> <li>1. </li> <li>2. </li> <li>3. </li> </ul> </div> </div> </section> <section class="aw_ao_detail aw_ao_Anita"> <img class="aw_ao_img" src="./assets/imgs/ao_anita.jpg"> <div class="aw_ao_intro"> <h2 class="aw_ao_name">Anita</h2> <div class="aw_ao_experience"> <h3></h3> <ul> <li>1. </li> <li>2. </li> </ul> </div> </div> </section> </div> </article> <!-- End AO --> <!-- Begin Student --> <article class="aw_student"> <div class="<API key>"> <h1></h1> <p>50 APP </p> </div> <section class="aw_student_list"> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/school_mit.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> YZ </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Charles Charles </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/school_mit.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> XX </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> personal statement </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/school_cornell.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> WX </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Steve OfferSteve </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/schoool_upenn.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> TY </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> APP Becky Becky Master </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/schoool_upenn.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> XR </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Becky </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/schoool_upenn.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> LL </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Tracy offer Tracy </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/<API key>.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> JJ </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Lisa </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/school_washington.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> M </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Lisa Lisa </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/school_washington.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> H </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Steve Steve </p> </div> </div> <div class="aw_student_item"> <img class="aw_student_img" src="./assets/imgs/school_cornell.jpg"> </img> <div class="aw_student_intro"> <h2 class="aw_student_name"> YX </h2> <p class="<API key>"></p> <p class="<API key>"></p> </div> <div class="aw_student_thxToApp"> <p> <span class="<API key>"></span><br> Tracy Tracy </p> </div> </div> </section> </article> <!-- End Student --> <footer id="aw_footer"> <p> E-mailapp@appedu.org</p> <p>691019&nbsp;&nbsp;86-20-37583165</p> <p>1129C1&nbsp;&nbsp;0898-68539758</p> <p><a href="http: </footer> </div> <script type="text/javascript" src="./assets/vendor/require.js" data-main="./assets/app_welcome"></script> </body> </html>
using System; using System.ComponentModel; using System.Web; using System.Web.Security; using System.Xml.Linq; using System.Xml.XPath; using Umbraco.Core; using Umbraco.Core.Dictionary; using Umbraco.Core.Dynamics; using Umbraco.Core.Models; using Umbraco.Core.Security; using Umbraco.Core.Services; using Umbraco.Core.Xml; using Umbraco.Web.Routing; using Umbraco.Web.Security; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web.Mvc; using System.Web.Routing; using Umbraco.Core.Cache; namespace Umbraco.Web { <summary> A helper class that provides many useful methods and functionality for using Umbraco in templates </summary> public class UmbracoHelper : <API key> { private readonly UmbracoContext _umbracoContext; private readonly IPublishedContent _currentPage; private readonly <API key> _typedQuery; private readonly <API key> _dynamicQuery; private readonly HtmlStringUtilities _stringUtilities = new HtmlStringUtilities(); private <API key> _componentRenderer; private <API key> _query; private MembershipHelper _membershipHelper; private TagQuery _tag; private IDataTypeService _dataTypeService; private UrlProvider _urlProvider; private ICultureDictionary _cultureDictionary; <summary> Lazy instantiates the tag context </summary> public TagQuery TagQuery { //TODO: Unfortunately we cannot change this return value to be ITagQuery // since it's a breaking change, need to fix it for v8 get { return _tag ?? (_tag = new TagQuery(UmbracoContext.Application.Services.TagService, _typedQuery ?? ContentQuery)); } } <summary> Lazy instantiates the query context if not specified in the constructor </summary> public <API key> ContentQuery { get { //If the content query doesn't exist it will either be created with the <API key>, <API key> // used to construct this instance or with the content caches of the UmbracoContext return _query ?? (_query = _typedQuery != null ? new <API key>(_typedQuery, _dynamicQuery) : new <API key>(UmbracoContext.ContentCache, UmbracoContext.MediaCache)); } } <summary> Helper method to ensure an umbraco context is set when it is needed </summary> public UmbracoContext UmbracoContext { get { if (_umbracoContext == null) { throw new <API key>("No " + typeof(UmbracoContext) + " reference has been set for this " + typeof(UmbracoHelper) + " instance"); } return _umbracoContext; } } <summary> Lazy instantiates the membership helper if not specified in the constructor </summary> public MembershipHelper MembershipHelper { get { return _membershipHelper ?? (_membershipHelper = new MembershipHelper(UmbracoContext)); } } <summary> Lazy instantiates the UrlProvider if not specified in the constructor </summary> public UrlProvider UrlProvider { get { return _urlProvider ?? (_urlProvider = UmbracoContext.UrlProvider); } } <summary> Lazy instantiates the IDataTypeService if not specified in the constructor </summary> public IDataTypeService DataTypeService { get { return _dataTypeService ?? (_dataTypeService = UmbracoContext.Application.Services.DataTypeService); } } <summary> Lazy instantiates the <API key> if not specified in the constructor </summary> public <API key> <API key> { get { return _componentRenderer ?? (_componentRenderer = new <API key>(UmbracoContext)); } } #region Constructors <summary> Empty constructor to create an umbraco helper for access to methods that don't have dependencies </summary> public UmbracoHelper() { } <summary> Constructor accepting all dependencies </summary> <param name="umbracoContext"></param> <param name="content"></param> <param name="typedQuery"></param> <param name="dynamicQuery"></param> <param name="tagQuery"></param> <param name="dataTypeService"></param> <param name="urlProvider"></param> <param name="cultureDictionary"></param> <param name="componentRenderer"></param> <param name="membershipHelper"></param> <remarks> This constructor can be used to create a testable UmbracoHelper </remarks> public UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content, <API key> typedQuery, <API key> dynamicQuery, ITagQuery tagQuery, IDataTypeService dataTypeService, UrlProvider urlProvider, ICultureDictionary cultureDictionary, <API key> componentRenderer, MembershipHelper membershipHelper) { if (umbracoContext == null) throw new <API key>("umbracoContext"); if (content == null) throw new <API key>("content"); if (typedQuery == null) throw new <API key>("typedQuery"); if (dynamicQuery == null) throw new <API key>("dynamicQuery"); if (tagQuery == null) throw new <API key>("tagQuery"); if (dataTypeService == null) throw new <API key>("dataTypeService"); if (urlProvider == null) throw new <API key>("urlProvider"); if (cultureDictionary == null) throw new <API key>("cultureDictionary"); if (componentRenderer == null) throw new <API key>("componentRenderer"); if (membershipHelper == null) throw new <API key>("membershipHelper"); _umbracoContext = umbracoContext; _tag = new TagQuery(tagQuery); _dataTypeService = dataTypeService; _urlProvider = urlProvider; _cultureDictionary = cultureDictionary; _componentRenderer = componentRenderer; _membershipHelper = membershipHelper; _currentPage = content; _typedQuery = typedQuery; _dynamicQuery = dynamicQuery; } [Obsolete("Use the constructor specifying all dependencies")] [EditorBrowsable(<API key>.Never)] public UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content, <API key> query) : this(umbracoContext) { if (content == null) throw new <API key>("content"); if (query == null) throw new <API key>("query"); _currentPage = content; _query = query; } <summary> Custom constructor setting the current page to the parameter passed in </summary> <param name="umbracoContext"></param> <param name="content"></param> public UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content) : this(umbracoContext) { if (content == null) throw new <API key>("content"); _currentPage = content; } <summary> Standard constructor setting the current page to the page that has been routed to </summary> <param name="umbracoContext"></param> public UmbracoHelper(UmbracoContext umbracoContext) { if (umbracoContext == null) throw new <API key>("umbracoContext"); if (umbracoContext.RoutingContext == null) throw new <API key>("The RoutingContext on the UmbracoContext cannot be null"); _umbracoContext = umbracoContext; if (_umbracoContext.<API key>) { _currentPage = _umbracoContext.<API key>.PublishedContent; } } [Obsolete("Use the constructor specifying all dependencies")] [EditorBrowsable(<API key>.Never)] public UmbracoHelper(UmbracoContext umbracoContext, <API key> query) : this(umbracoContext) { if (query == null) throw new <API key>("query"); _query = query; } #endregion <summary> Returns the current IPublishedContent item assigned to the UmbracoHelper </summary> <remarks> Note that this is the assigned IPublishedContent item to the UmbracoHelper, this is not necessarily the Current IPublishedContent item being rendered. This IPublishedContent object is contextual to the current UmbracoHelper instance. In some cases accessing this property will throw an exception if there is not IPublishedContent assigned to the Helper this will only ever happen if the Helper is constructed with an UmbracoContext and it is not a front-end request </remarks> <exception cref="<API key>">Thrown if the UmbracoHelper is constructed with an UmbracoContext and it is not a front-end request</exception> public IPublishedContent AssignedContentItem { get { if (_currentPage == null) throw new <API key>("Cannot return the " + typeof(IPublishedContent).Name + " because the " + typeof(UmbracoHelper).Name + " was constructed with an " + typeof(UmbracoContext).Name + " and the current request is not a front-end request."); return _currentPage; } } <summary> Renders the template for the specified pageId and an optional altTemplateId </summary> <param name="pageId"></param> <param name="altTemplateId">If not specified, will use the template assigned to the node</param> <returns></returns> public IHtmlString RenderTemplate(int pageId, int? altTemplateId = null) { return <API key>.RenderTemplate(pageId, altTemplateId); } #region RenderMacro <summary> Renders the macro with the specified alias. </summary> <param name="alias">The alias.</param> <returns></returns> public IHtmlString RenderMacro(string alias) { return <API key>.RenderMacro(alias, new { }); } <summary> Renders the macro with the specified alias, passing in the specified parameters. </summary> <param name="alias">The alias.</param> <param name="parameters">The parameters.</param> <returns></returns> public IHtmlString RenderMacro(string alias, object parameters) { return <API key>.RenderMacro(alias, parameters.ToDictionary<object>()); } <summary> Renders the macro with the specified alias, passing in the specified parameters. </summary> <param name="alias">The alias.</param> <param name="parameters">The parameters.</param> <returns></returns> public IHtmlString RenderMacro(string alias, IDictionary<string, object> parameters) { return <API key>.RenderMacro(alias, parameters); } #endregion #region Field <summary> Renders an field to the template </summary> <param name="fieldAlias"></param> <param name="altFieldAlias"></param> <param name="altText"></param> <param name="insertBefore"></param> <param name="insertAfter"></param> <param name="recursive"></param> <param name="convertLineBreaks"></param> <param name="removeParagraphTags"></param> <param name="casing"></param> <param name="encoding"></param> <param name="formatAsDate"></param> <param name="<API key>"></param> <param name="<API key>"></param> / <param name="formatString"></param> <returns></returns> public IHtmlString Field(string fieldAlias, string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, <API key> encoding = <API key>.Unchanged, bool formatAsDate = false, bool <API key> = false, string <API key> = "") { return <API key>.Field(AssignedContentItem, fieldAlias, altFieldAlias, altText, insertBefore, insertAfter, recursive, convertLineBreaks, removeParagraphTags, casing, encoding, formatAsDate, <API key>, <API key>); } <summary> Renders an field to the template </summary> <param name="currentPage"></param> <param name="fieldAlias"></param> <param name="altFieldAlias"></param> <param name="altText"></param> <param name="insertBefore"></param> <param name="insertAfter"></param> <param name="recursive"></param> <param name="convertLineBreaks"></param> <param name="removeParagraphTags"></param> <param name="casing"></param> <param name="encoding"></param> <param name="formatAsDate"></param> <param name="<API key>"></param> <param name="<API key>"></param> / <param name="formatString"></param> <returns></returns> public IHtmlString Field(IPublishedContent currentPage, string fieldAlias, string altFieldAlias = "", string altText = "", string insertBefore = "", string insertAfter = "", bool recursive = false, bool convertLineBreaks = false, bool removeParagraphTags = false, RenderFieldCaseType casing = RenderFieldCaseType.Unchanged, <API key> encoding = <API key>.Unchanged, bool formatAsDate = false, bool <API key> = false, string <API key> = "") { return <API key>.Field(currentPage, fieldAlias, altFieldAlias, altText, insertBefore, insertAfter, recursive, convertLineBreaks, removeParagraphTags, casing, encoding, formatAsDate, <API key>, <API key>); } #endregion #region Dictionary <summary> Returns the dictionary value for the key specified </summary> <param name="key"></param> <returns></returns> public string GetDictionaryValue(string key) { return CultureDictionary[key]; } <summary> Returns the dictionary value for the key specified, and if empty returns the specified default fall back value </summary> <param name="key">key of dictionary item</param> <param name="altText">fall back text if dictionary item is empty - Name altText to match Umbraco.Field</param> <returns></returns> public string GetDictionaryValue(string key, string altText) { var dictionaryValue = GetDictionaryValue(key); if (String.IsNullOrWhiteSpace(dictionaryValue)) { dictionaryValue = altText; } return dictionaryValue; } <summary> Returns the ICultureDictionary for access to dictionary items </summary> public ICultureDictionary CultureDictionary { get { if (_cultureDictionary == null) { var factory = <API key>.Current.Factory; _cultureDictionary = factory.CreateDictionary(); } return _cultureDictionary; } } #endregion #region Membership [EditorBrowsable(<API key>.Never)] [Obsolete("Use the IsProtected method that only specifies path")] public bool IsProtected(int documentId, string path) { return IsProtected(path.EnsureEndsWith("," + documentId)); } <summary> Check if a document object is protected by the "Protect Pages" functionality in umbraco </summary> <param name="path">The full path of the document object to check</param> <returns>True if the document object is protected</returns> public bool IsProtected(string path) { return UmbracoContext.Application.Services.PublicAccessService.IsProtected(path); } [EditorBrowsable(<API key>.Never)] [Obsolete("Use the MemberHasAccess method that only specifies path")] public bool MemberHasAccess(int nodeId, string path) { return MemberHasAccess(path.EnsureEndsWith("," + nodeId)); } <summary> Check if the current user has access to a document </summary> <param name="path">The full path of the document object to check</param> <returns>True if the current user has access or if the current document isn't protected</returns> public bool MemberHasAccess(string path) { if (IsProtected(path)) { return MembershipHelper.IsLoggedIn() && UmbracoContext.Application.Services.PublicAccessService.HasAccess(path, GetCurrentMember(), Roles.Provider); } return true; } <summary> Gets (or adds) the current member from the current request cache </summary> private MembershipUser GetCurrentMember() { return UmbracoContext.Application.ApplicationCache.RequestCache .GetCacheItem<MembershipUser>("UmbracoHelper.GetCurrentMember", () => { var provider = Core.Security.<API key>.<API key>(); return provider.GetCurrentUser(); }); } <summary> Whether or not the current member is logged in (based on the membership provider) </summary> <returns>True is the current user is logged in</returns> public bool MemberIsLoggedOn() { return MembershipHelper.IsLoggedIn(); } #endregion #region NiceUrls <summary> Returns a string with a friendly url from a node. IE.: Instead of having /482 (id) as an url, you can have /screenshots/developer/macros (spoken url) </summary> <param name="nodeId">Identifier for the node that should be returned</param> <returns>String with a friendly url from a node</returns> public string NiceUrl(int nodeId) { return Url(nodeId); } <summary> Gets the url of a content identified by its identifier. </summary> <param name="contentId">The content identifier.</param> <returns>The url for the content.</returns> public string Url(int contentId) { return UrlProvider.GetUrl(contentId); } <summary> Gets the url of a content identified by its identifier, in a specified mode. </summary> <param name="contentId">The content identifier.</param> <param name="mode">The mode.</param> <returns>The url for the content.</returns> public string Url(int contentId, UrlProviderMode mode) { return UrlProvider.GetUrl(contentId, mode); } <summary> This method will always add the domain to the path if the hostnames are set up correctly. </summary> <param name="nodeId">Identifier for the node that should be returned</param> <returns>String with a friendly url with full domain from a node</returns> public string NiceUrlWithDomain(int nodeId) { return UrlAbsolute(nodeId); } <summary> Gets the absolute url of a content identified by its identifier. </summary> <param name="contentId">The content identifier.</param> <returns>The absolute url for the content.</returns> public string UrlAbsolute(int contentId) { return UrlProvider.GetUrl(contentId, true); } #endregion #region Members public IPublishedContent TypedMember(object id) { var asInt = id.TryConvertTo<int>(); return asInt ? MembershipHelper.GetById(asInt.Result) : MembershipHelper.GetByProviderKey(id); } public IPublishedContent TypedMember(int id) { return MembershipHelper.GetById(id); } public IPublishedContent TypedMember(string id) { var asInt = id.TryConvertTo<int>(); return asInt ? MembershipHelper.GetById(asInt.Result) : MembershipHelper.GetByProviderKey(id); } public dynamic Member(object id) { var asInt = id.TryConvertTo<int>(); return asInt ? MembershipHelper.GetById(asInt.Result).AsDynamic() : MembershipHelper.GetByProviderKey(id).AsDynamic(); } public dynamic Member(int id) { return MembershipHelper.GetById(id).AsDynamic(); } public dynamic Member(string id) { var asInt = id.TryConvertTo<int>(); return asInt ? MembershipHelper.GetById(asInt.Result).AsDynamic() : MembershipHelper.GetByProviderKey(id).AsDynamic(); } #endregion #region Content <summary> Gets a content item from the cache. </summary> <param name="id">The unique identifier, or the key, of the content item.</param> <returns>The content, or null of the content item is not in the cache.</returns> public IPublishedContent TypedContent(object id) { return <API key>(id); } private IPublishedContent <API key>(object id) { int intId; if (<API key>(id, out intId)) return ContentQuery.TypedContent(intId); Guid guidId; if (<API key>(id, out guidId)) return ContentQuery.TypedContent(guidId); return null; } <summary> Gets a content item from the cache. </summary> <param name="id">The unique identifier of the content item.</param> <returns>The content, or null of the content item is not in the cache.</returns> public IPublishedContent TypedContent(int id) { return ContentQuery.TypedContent(id); } <summary> Gets a content item from the cache. </summary> <param name="id">The key of the content item.</param> <returns>The content, or null of the content item is not in the cache.</returns> public IPublishedContent TypedContent(Guid id) { return ContentQuery.TypedContent(id); } <summary> Gets a content item from the cache. </summary> <param name="id">The unique identifier, or the key, of the content item.</param> <returns>The content, or null of the content item is not in the cache.</returns> public IPublishedContent TypedContent(string id) { return <API key>(id); } public IPublishedContent <API key>(string xpath, params XPathVariable[] vars) { return ContentQuery.<API key>(xpath, vars); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers, or the keys, of the content items.</param> <returns>The content items that were found in the cache.</returns> <remarks>Does not support mixing identifiers and keys.</remarks> public IEnumerable<IPublishedContent> TypedContent(params object[] ids) { return <API key>(ids); } private IEnumerable<IPublishedContent> <API key>(IEnumerable<object> ids) { var idsA = ids.ToArray(); IEnumerable<int> intIds; if (<API key>(idsA, out intIds)) return ContentQuery.TypedContent(intIds); IEnumerable<Guid> guidIds; if (<API key>(idsA, out guidIds)) return ContentQuery.TypedContent(guidIds); return Enumerable.Empty<IPublishedContent>(); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers of the content items.</param> <returns>The content items that were found in the cache.</returns> public IEnumerable<IPublishedContent> TypedContent(params int[] ids) { return ContentQuery.TypedContent(ids); } <summary> Gets content items from the cache. </summary> <param name="ids">The keys of the content items.</param> <returns>The content items that were found in the cache.</returns> public IEnumerable<IPublishedContent> TypedContent(params Guid[] ids) { return ContentQuery.TypedContent(ids); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers, or the keys, of the content items.</param> <returns>The content items that were found in the cache.</returns> <remarks>Does not support mixing identifiers and keys.</remarks> public IEnumerable<IPublishedContent> TypedContent(params string[] ids) { return <API key>(ids); } <summary> Gets the contents corresponding to the identifiers. </summary> <param name="ids">The content identifiers.</param> <returns>The existing contents corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing content, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedContent(IEnumerable<object> ids) { return <API key>(ids); } <summary> Gets the contents corresponding to the identifiers. </summary> <param name="ids">The content identifiers.</param> <returns>The existing contents corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing content, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedContent(IEnumerable<string> ids) { return <API key>(ids); } <summary> Gets the contents corresponding to the identifiers. </summary> <param name="ids">The content identifiers.</param> <returns>The existing contents corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing content, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedContent(IEnumerable<int> ids) { return ContentQuery.TypedContent(ids); } public IEnumerable<IPublishedContent> TypedContentAtXPath(string xpath, params XPathVariable[] vars) { return ContentQuery.TypedContentAtXPath(xpath, vars); } public IEnumerable<IPublishedContent> TypedContentAtXPath(XPathExpression xpath, params XPathVariable[] vars) { return ContentQuery.TypedContentAtXPath(xpath, vars); } public IEnumerable<IPublishedContent> TypedContentAtRoot() { return ContentQuery.TypedContentAtRoot(); } <summary> Gets a content item from the cache. </summary> <param name="id">The unique identifier, or the key, of the content item.</param> <returns>The content, or DynamicNull of the content item is not in the cache.</returns> public dynamic Content(object id) { return ContentForObject(id); } private dynamic ContentForObject(object id) { int intId; if (<API key>(id, out intId)) return ContentQuery.Content(intId); Guid guidId; if (<API key>(id, out guidId)) return ContentQuery.Content(guidId); return DynamicNull.Null; } <summary> Gets a content item from the cache. </summary> <param name="id">The unique identifier of the content item.</param> <returns>The content, or DynamicNull of the content item is not in the cache.</returns> public dynamic Content(int id) { return ContentQuery.Content(id); } <summary> Gets a content item from the cache. </summary> <param name="id">The unique identifier, or the key, of the content item.</param> <returns>The content, or DynamicNull of the content item is not in the cache.</returns> public dynamic Content(string id) { return ContentForObject(id); } public dynamic <API key>(string xpath, params XPathVariable[] vars) { return ContentQuery.<API key>(xpath, vars); } public dynamic <API key>(XPathExpression xpath, params XPathVariable[] vars) { return ContentQuery.<API key>(xpath, vars); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers, or the keys, of the content items.</param> <returns>The content items that were found in the cache.</returns> <remarks>Does not support mixing identifiers and keys.</remarks> public dynamic Content(params object[] ids) { return ContentForObjects(ids); } private dynamic ContentForObjects(IEnumerable<object> ids) { var idsA = ids.ToArray(); IEnumerable<int> intIds; if (<API key>(idsA, out intIds)) return ContentQuery.Content(intIds); IEnumerable<Guid> guidIds; if (<API key>(idsA, out guidIds)) return ContentQuery.Content(guidIds); return Enumerable.Empty<IPublishedContent>(); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers of the content items.</param> <returns>The content items that were found in the cache.</returns> public dynamic Content(params int[] ids) { return ContentQuery.Content(ids); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers, or the keys, of the content items.</param> <returns>The content items that were found in the cache.</returns> <remarks>Does not support mixing identifiers and keys.</remarks> public dynamic Content(params string[] ids) { return ContentForObjects(ids); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers, or the keys, of the content items.</param> <returns>The content items that were found in the cache.</returns> <remarks>Does not support mixing identifiers and keys.</remarks> public dynamic Content(IEnumerable<object> ids) { return ContentForObjects(ids); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers of the content items.</param> <returns>The content items that were found in the cache.</returns> public dynamic Content(IEnumerable<int> ids) { return ContentQuery.Content(ids); } <summary> Gets content items from the cache. </summary> <param name="ids">The unique identifiers, or the keys, of the content items.</param> <returns>The content items that were found in the cache.</returns> <remarks>Does not support mixing identifiers and keys.</remarks> public dynamic Content(IEnumerable<string> ids) { return ContentForObjects(ids); } public dynamic ContentAtXPath(string xpath, params XPathVariable[] vars) { return ContentQuery.ContentAtXPath(xpath, vars); } public dynamic ContentAtXPath(XPathExpression xpath, params XPathVariable[] vars) { return ContentQuery.ContentAtXPath(xpath, vars); } public dynamic ContentAtRoot() { return ContentQuery.ContentAtRoot(); } private static bool <API key>(object id, out int intId) { var s = id as string; if (s != null) { return int.TryParse(s, out intId); } if (id is int) { intId = (int) id; return true; } intId = default(int); return false; } private static bool <API key>(object id, out Guid guidId) { var s = id as string; if (s != null) { return Guid.TryParse(s, out guidId); } if (id is Guid) { guidId = (Guid) id; return true; } guidId = default(Guid); return false; } private static bool <API key>(IEnumerable<object> ids, out IEnumerable<int> intIds) { var list = new List<int>(); intIds = null; foreach (var id in ids) { int intId; if (<API key>(id, out intId)) list.Add(intId); else return false; // if one of them is not an int, fail } intIds = list; return true; } private static bool <API key>(IEnumerable<object> ids, out IEnumerable<Guid> guidIds) { var list = new List<Guid>(); guidIds = null; foreach (var id in ids) { Guid guidId; if (<API key>(id, out guidId)) list.Add(guidId); else return false; // if one of them is not a guid, fail } guidIds = list; return true; } #endregion #region Media <summary> Overloaded method accepting an 'object' type </summary> <param name="id"></param> <returns></returns> <remarks> We accept an object type because GetPropertyValue now returns an 'object', we still want to allow people to pass this result in to this method. This method will throw an exception if the value is not of type int or string. </remarks> public IPublishedContent TypedMedia(object id) { int intId; return <API key>(id, out intId) ? ContentQuery.TypedMedia(intId) : null; } public IPublishedContent TypedMedia(int id) { return ContentQuery.TypedMedia(id); } public IPublishedContent TypedMedia(string id) { int intId; return <API key>(id, out intId) ? ContentQuery.TypedMedia(intId) : null; } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedMedia(params object[] ids) { return <API key>(ids); } private IEnumerable<IPublishedContent> <API key>(IEnumerable<object> ids) { var idsA = ids.ToArray(); IEnumerable<int> intIds; if (<API key>(idsA, out intIds)) return ContentQuery.TypedMedia(intIds); //IEnumerable<Guid> guidIds; //if (<API key>(idsA, out guidIds)) // return ContentQuery.TypedMedia(guidIds); return Enumerable.Empty<IPublishedContent>(); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedMedia(params int[] ids) { return ContentQuery.TypedMedia(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedMedia(params string[] ids) { return <API key>(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedMedia(IEnumerable<object> ids) { return <API key>(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedMedia(IEnumerable<int> ids) { return ContentQuery.TypedMedia(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable<IPublishedContent> TypedMedia(IEnumerable<string> ids) { return <API key>(ids); } public IEnumerable<IPublishedContent> TypedMediaAtRoot() { return ContentQuery.TypedMediaAtRoot(); } public dynamic Media(object id) { int intId; return <API key>(id, out intId) ? ContentQuery.Media(intId) : DynamicNull.Null; } public dynamic Media(int id) { return ContentQuery.Media(id); } public dynamic Media(string id) { int intId; return <API key>(id, out intId) ? ContentQuery.Media(intId) : DynamicNull.Null; } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public dynamic Media(params object[] ids) { return MediaForObjects(ids); } private dynamic MediaForObjects(IEnumerable<object> ids) { var idsA = ids.ToArray(); IEnumerable<int> intIds; if (<API key>(idsA, out intIds)) return ContentQuery.Media(intIds); //IEnumerable<Guid> guidIds; //if (<API key>(idsA, out guidIds)) // return ContentQuery.Media(guidIds); return Enumerable.Empty<IPublishedContent>(); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public dynamic Media(params int[] ids) { return ContentQuery.Media(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public dynamic Media(params string[] ids) { return MediaForObjects(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public dynamic Media(IEnumerable<object> ids) { return MediaForObjects(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public dynamic Media(IEnumerable<int> ids) { return ContentQuery.Media(ids); } <summary> Gets the medias corresponding to the identifiers. </summary> <param name="ids">The media identifiers.</param> <returns>The existing medias corresponding to the identifiers.</returns> <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public dynamic Media(IEnumerable<string> ids) { return MediaForObjects(ids); } public dynamic MediaAtRoot() { return ContentQuery.MediaAtRoot(); } #endregion #region Search <summary> Searches content </summary> <param name="term"></param> <param name="useWildCards"></param> <param name="searchProvider"></param> <returns></returns> public dynamic Search(string term, bool useWildCards = true, string searchProvider = null) { return ContentQuery.Search(term, useWildCards, searchProvider); } <summary> Searhes content </summary> <param name="criteria"></param> <param name="searchProvider"></param> <returns></returns> public dynamic Search(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null) { return ContentQuery.Search(criteria, searchProvider); } <summary> Searches content </summary> <param name="term"></param> <param name="useWildCards"></param> <param name="searchProvider"></param> <returns></returns> public IEnumerable<IPublishedContent> TypedSearch(string term, bool useWildCards = true, string searchProvider = null) { return ContentQuery.TypedSearch(term, useWildCards, searchProvider); } <summary> Searhes content </summary> <param name="criteria"></param> <param name="searchProvider"></param> <returns></returns> public IEnumerable<IPublishedContent> TypedSearch(Examine.SearchCriteria.ISearchCriteria criteria, Examine.Providers.BaseSearchProvider searchProvider = null) { return ContentQuery.TypedSearch(criteria, searchProvider); } #endregion #region Xml public dynamic ToDynamicXml(string xml) { if (string.IsNullOrWhiteSpace(xml)) return null; var xElement = XElement.Parse(xml); return new DynamicXml(xElement); } public dynamic ToDynamicXml(XElement xElement) { return new DynamicXml(xElement); } public dynamic ToDynamicXml(XPathNodeIterator xpni) { return new DynamicXml(xpni); } #endregion #region Strings <summary> Replaces text line breaks with html line breaks </summary> <param name="text">The text.</param> <returns>The text with text line breaks replaced with html linebreaks (<br/>)</returns> public string <API key>(string text) { return _stringUtilities.<API key>(text); } <summary> Returns an MD5 hash of the string specified </summary> <param name="text">The text to create a hash from</param> <returns>Md5 has of the string</returns> public string CreateMd5Hash(string text) { return text.ToMd5(); } <summary> Strips all html tags from a given string, all contents of the tags will remain. </summary> public HtmlString StripHtml(IHtmlString html, params string[] tags) { return StripHtml(html.ToHtmlString(), tags); } <summary> Strips all html tags from a given string, all contents of the tags will remain. </summary> public HtmlString StripHtml(DynamicNull html, params string[] tags) { return new HtmlString(string.Empty); } <summary> Strips all html tags from a given string, all contents of the tags will remain. </summary> public HtmlString StripHtml(string html, params string[] tags) { return _stringUtilities.StripHtmlTags(html, tags); } <summary> Will take the first non-null value in the collection and return the value of it. </summary> public string Coalesce(params object[] args) { return _stringUtilities.Coalesce<DynamicNull>(args); } <summary> Will take the first non-null value in the collection and return the value of it. </summary> public string Concatenate(params object[] args) { return _stringUtilities.Concatenate<DynamicNull>(args); } <summary> Joins any number of int/string/objects into one string and seperates them with the string seperator parameter. </summary> public string Join(string seperator, params object[] args) { return _stringUtilities.Join<DynamicNull>(seperator, args); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(IHtmlString html, int length) { return Truncate(html.ToHtmlString(), length, true, false); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis) { return Truncate(html.ToHtmlString(), length, addElipsis, false); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis, bool treatTagsAsContent) { return Truncate(html.ToHtmlString(), length, addElipsis, treatTagsAsContent); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(DynamicNull html, int length) { return new HtmlString(string.Empty); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(DynamicNull html, int length, bool addElipsis) { return new HtmlString(string.Empty); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(DynamicNull html, int length, bool addElipsis, bool treatTagsAsContent) { return new HtmlString(string.Empty); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(string html, int length) { return Truncate(html, length, true, false); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(string html, int length, bool addElipsis) { return Truncate(html, length, addElipsis, false); } <summary> Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them </summary> public IHtmlString Truncate(string html, int length, bool addElipsis, bool treatTagsAsContent) { return _stringUtilities.Truncate(html, length, addElipsis, treatTagsAsContent); } #endregion #region If <summary> If the test is true, the string valueIfTrue will be returned, otherwise the valueIfFalse will be returned. </summary> public HtmlString If(bool test, string valueIfTrue, string valueIfFalse) { return test ? new HtmlString(valueIfTrue) : new HtmlString(valueIfFalse); } <summary> If the test is true, the string valueIfTrue will be returned, otherwise the valueIfFalse will be returned. </summary> public HtmlString If(bool test, string valueIfTrue) { return test ? new HtmlString(valueIfTrue) : new HtmlString(string.Empty); } #endregion #region Prevalues <summary> Gets a specific PreValue by its Id </summary> <param name="id">Id of the PreValue to retrieve the value from</param> <returns>PreValue as a string</returns> public string GetPreValueAsString(int id) { return DataTypeService.GetPreValueAsString(id); } #endregion #region canvasdesigner [Obsolete("Use <API key> on the HtmlHelper extensions instead")] public IHtmlString <API key>() { return <API key>(string.Empty, string.Empty); } [Obsolete("Use <API key> on the HtmlHelper extensions instead")] public IHtmlString <API key>(string <API key>) { return <API key>(<API key>, string.Empty); } [Obsolete("Use <API key> on the HtmlHelper extensions instead")] public IHtmlString <API key>(string <API key>, string <API key>) { var html = CreateHtmlHelper(""); var urlHelper = new UrlHelper(UmbracoContext.HttpContext.Request.RequestContext); return html.<API key>(urlHelper, UmbracoContext, <API key>, <API key>); } [Obsolete("This shouldn't need to be used but because the obsolete extension methods above don't have access to the current HtmlHelper, we need to create a fake one, unfortunately however this will not pertain the current views viewdata, tempdata or model state so should not be used")] private HtmlHelper CreateHtmlHelper(object model) { var cc = new ControllerContext { RequestContext = UmbracoContext.HttpContext.Request.RequestContext }; var viewContext = new ViewContext(cc, new FakeView(), new ViewDataDictionary(model), new TempDataDictionary(), new StringWriter()); var htmlHelper = new HtmlHelper(viewContext, new ViewPage()); return htmlHelper; } [Obsolete("This shouldn't need to be used but because the obsolete extension methods above don't have access to the current HtmlHelper, we need to create a fake one, unfortunately however this will not pertain the current views viewdata, tempdata or model state so should not be used")] private class FakeView : IView { public void Render(ViewContext viewContext, TextWriter writer) { } } #endregion <summary> This is used in methods like BeginUmbracoForm and SurfaceAction to generate an encrypted string which gets submitted in a request for which Umbraco can decrypt during the routing process in order to delegate the request to a specific MVC Controller. </summary> <param name="controllerName"></param> <param name="controllerAction"></param> <param name="area"></param> <param name="additionalRouteVals"></param> <returns></returns> internal static string <API key>(string controllerName, string controllerAction, string area, object additionalRouteVals = null) { Mandate.<API key>(controllerName, "controllerName"); Mandate.<API key>(controllerAction, "controllerAction"); Mandate.ParameterNotNull(area, "area"); //need to create a params string as Base64 to put into our hidden field to use during the routes var surfaceRouteParams = string.Format("c={0}&a={1}&ar={2}", HttpUtility.UrlEncode(controllerName), HttpUtility.UrlEncode(controllerAction), area); //checking if the additional route values is already a dictionary and convert to querystring string <API key>; if (additionalRouteVals != null) { var <API key> = additionalRouteVals as Dictionary<string, object>; if (<API key> != null) <API key> = <API key>.ToQueryString(); else <API key> = additionalRouteVals.ToDictionary<object>().ToQueryString(); } else <API key> = null; if (<API key>.IsNullOrWhiteSpace() == false) surfaceRouteParams += "&" + <API key>; return surfaceRouteParams.<API key>(); } } }
* { margin: 0px; padding: 0px; } body{ overflow:hidden; background-color: black; } @font-face { font-family: Bang; src: url('bang.ttf'); } @media screen and (max-height: 650px) { #clouds{ height: 220px; } } } #wrapper { width: 100%; height: 100%; } #score { color: #fff; font-family: Bang; font-size: 1.6em; position:absolute; top: 90%; left:45%; z-index:5; display: none; } #sceneWrapper { margin-left: auto; margin-right: auto; display: block; width: 100%; height: 700px; position:absolute; width: 100%; overflow: hidden; bottom: 10%; } #bg-left { float:left; height:700px; } #bg-right { float:left; height:700px; } footer { position:absolute; width: 100%; z-index:1; height: 10%; background-color: black; display: block; top: 89%; } canvas{ float:left; display:block; margin:0; padding:0; width: 800px; z-index: -1; } #menuscreen-start { font-family: Bang; position:absolute; display: block; width: 300px; height: 150px; z-index:100; left:50%; margin-left: -150px; bottom:50%; margin-bottom: -75px; text-align:center; color: #FFF; font-size:2em; } #menuscreen-start h1, #menuscreen-end h1 { color: #C1003F; -<API key>: 2px; -<API key>: black; } #menuscreen-start h1:hover , #menuscreen-end h1:hover { cursor:default; } #menuscreen-start p:hover , #menuscreen-end h2:hover { cursor: pointer; } #menuscreen-end { font-family: Bang; position:absolute; display: none; width: 300px; height: 150px; color: #fff; z-index:100; left:50%; margin-left: -150px; bottom:50%; margin-bottom: -75px; text-align: center; font-size: 1.2em; } #buildings { background: url(img/buildingsbg.gif) no-repeat center center ; -<API key>: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; width: 100%; height:90%; z-index: 0; position:absolute; } #clouds{ padding: 100px 0; background: #c9dbe9; background: -<API key>(top, #191381 0%, #001848 50%, #D07D00 100%); background: -linear-gradient(top, #c9dbe9 0%, #fff 100%); background: -moz-linear-gradient(top, #c9dbe9 0%, #fff 100%); height: 320px; } .cloud { width: 200px; height: 60px; background: #989898 ; z-index:0; border-radius: 200px; -moz-border-radius: 200px; -<API key>: 200px; position: relative; } .cloud:before, .cloud:after { content: ''; position: absolute; background: #989898 ; width: 100px; height: 80px; position: absolute; top: -15px; left: 10px; border-radius: 100px; -moz-border-radius: 100px; -<API key>: 100px; -webkit-transform: rotate(30deg); transform: rotate(30deg); -moz-transform: rotate(30deg); } .cloud:after { width: 120px; height: 120px; top: -55px; left: auto; right: 15px; } .cloud { -webkit-animation: moveclouds 15s linear infinite; -o-animation: moveclouds 15s linear infinite; -moz-animation: moveclouds 15s linear infinite; } .x1 { -webkit-animation: moveclouds 25s linear infinite; -moz-animation: moveclouds 25s linear infinite; -o-animation: moveclouds 25s linear infinite; } .x2 { left: 65%; top: -250px; -webkit-transform: scale(0.5); -moz-transform: scale(0.5); -o-transform: scale(0.5); transform:scale(0.5); -webkit-animation: moveclouds 18s linear infinite; -moz-animation: moveclouds 18s linear infinite; -o-animation: moveclouds 18s linear infinite; opacity: 0.5; } .x3 { left: 25%; top: -220px; -webkit-transform: scale(0.6); -moz-transform: scale(0.6); -o-transform: scale(0.6); transform:scale(0.6); -webkit-animation: moveclouds 13s linear infinite; -moz-animation: moveclouds 13s linear infinite; -o-animation: moveclouds 13s linear infinite; opacity: 0.6; } .x4 { left: 80%; top: -120px; -webkit-transform: scale(0.75); -moz-transform: scale(0.75); -o-transform: scale(0.75); transform:scale(0.75); -webkit-animation: moveclouds 16s linear infinite; -moz-animation: moveclouds 16s linear infinite; -o-animation: moveclouds 16s linear infinite; opacity: 0.75; } .x5 { left: 35%; top: -200px; -webkit-transform: scale(0.4); -moz-transform: scale(0.4); -o-transform: scale(0.4); transform:scale(0.4); -webkit-animation: moveclouds 20s linear infinite; -moz-animation: moveclouds 20s linear infinite; -o-animation: moveclouds 20s linear infinite; opacity: 0.4; } .x6 { left: 15%; top: -100px; -webkit-transform: scale(0.8); -moz-transform: scale(0.8); -o-transform: scale(0.8); transform:scale(0.8); -webkit-animation: moveclouds 26s linear infinite; -moz-animation: moveclouds 26s linear infinite; -o-animation: moveclouds 26s linear infinite; opacity: 0.8; } .x7 { left: 45%; top: -175px; -webkit-transform: scale(0.65); -moz-transform: scale(0.65); -o-transform: scale(0.65); transform:scale(0.65); -webkit-animation: moveclouds 14s linear infinite; -moz-animation: moveclouds 14s linear infinite; -o-animation: moveclouds 14s linear infinite; opacity: 0.65); } @-webkit-keyframes moveclouds { 0% { margin-left: 100%;} 100% {margin-left: -100%;} } @-moz-keyframes moveclouds { 0% {margin-left: 100%} 100% {margin-left: -100%;} } @-o-keyframes moveclouds { 0% {margin-left: 100%;} 100% {margin-left: -100%;} }
use std::str::FromStr; fn read_line() -> String { let mut input = String::new(); std::io::stdin().read_line(&mut input).expect("Could not read stdin!"); input } fn read_multiple<F>(sep: &str) -> Vec<F> where F: FromStr { read_line().trim().split(sep).map(|token| token.parse().ok().unwrap()).collect() } fn gcd(a: u64, b: u64) -> u64 { if a == 0 { b } else { gcd(b % a, a) } } fn main() { let input = read_multiple::<u64>(" "); let (a, b) = (input[0], input[1]); println!("{}", gcd(a, b)); }
layout: page status: publish published: true title: 'MPC IN THE NEWS: Where We Came From and Where We Went, State by State' author: mpcit teaser: 'The folks at the NYT''s Upshot recently did a piece charting how Americans have moved between states since 1900, using Census microdata obtained from ipums.org, the MPC''s longest running data project.' wordpress_id: 106 wordpress_url: http://tech.popdata.org/?p=106 date: '2014-09-19 16:44:15 -0500' date_gmt: '2014-09-19 16:44:15 -0500' categories: - IPUMS - MPC in the News tags: [] <a href="/images/from_wp/<API key>.jpg"><img class="size-full wp-image-107" src="/images/from_wp/<API key>.jpg" alt="Source: New York Times, The Upshot" width="800" height="381" /></a> Source: New York Times, The Upshot The folks at the NYT's Upshot recently did a piece charting how Americans have moved between states since 1900. The charts in <a title="Where We Came From and Where We Went, State by State" href="http://www.nytimes.com/interactive/2014/08/13/upshot/<API key>.html" target="_blank">Where We Came From and Where We Went, State by State</a> were compiled using Census microdata obtained from <a style="color: To measure domestic migration, the charts look at the place of birth of residents in each state of time. Because the focus of this report is movement of people from their U.S. state of birth to their U.S. state of residence, foreign born residents were collapsed into a single immigrant category. Likewise, the category "U.S. Other" was created to include residents of states born in Puerto Rico, Guam, American Samoa, the U.S. Virgin Islands, and a small number of people who in early Census years were identified as being born in Native American tribal territory. Residents who were classified in the data as U.S. born but without a specific state were allocated a state of birth proportionately based on the make-up of their state of residence for the given year.
/** * Gulp tasks for wrapping Browserify modules. */ const browserify = require("browserify"); const gulp = require("gulp"); const sourcemaps = require("gulp-sourcemaps"); const uglify = require("gulp-uglify"); const path = require("path"); const through2 = require("through2"); const buffer = require("vinyl-buffer"); const source = require("vinyl-source-stream"); const asyncUtil = require("../../util/async-util"); const clientPackages = require("../../util/client-packages"); const display = require("../../util/display"); const uc = require("../../util/unite-config"); gulp.task("build-bundle-app", async () => { const uniteConfig = await uc.getUniteConfig(); const buildConfiguration = uc.<API key>(uniteConfig, false); if (buildConfiguration.bundle) { display.info("Running", "Browserify for App"); const bApp = browserify({ debug: buildConfiguration.sourcemaps, entries: `./${path.join(uniteConfig.dirs.www.dist, "entryPoint.js")}` }); const vendorPackages = await clientPackages.<API key>(uniteConfig); let hasStyleLoader = false; Object.keys(vendorPackages).forEach((key) => { bApp.exclude(key); const idx = key.indexOf("systemjs"); if (idx >= 0 && !hasStyleLoader) { hasStyleLoader = key === "systemjs-plugin-css"; } }); bApp.transform("envify", { NODE_ENV: buildConfiguration.minify ? "production" : "development", global: true }); bApp.transform("browserify-css", { autoInject: hasStyleLoader }); bApp.transform("stringify", { appliesTo: { includeExtensions: uniteConfig.viewExtensions.map(ext => `.${ext}`) } }); bApp.transform("babelify", { global: true, presets: ["@babel/preset-env"] }); return asyncUtil.stream(bApp.bundle().on("error", (err) => { display.error(err); }) .pipe(source("app-bundle.js")) .pipe(buffer()) .pipe(buildConfiguration.minify ? uglify() .on("error", (err) => { display.error(err.toString()); }) : through2.obj()) .pipe(buildConfiguration.sourcemaps ? sourcemaps.init({ loadMaps: true }) : through2.obj()) .pipe(buildConfiguration.sourcemaps ? sourcemaps.mapSources((sourcePath) => sourcePath.replace(/dist\//, "./")) : through2.obj()) .pipe(buildConfiguration.sourcemaps ? sourcemaps.write({ includeContent: true }) : through2.obj()) .pipe(gulp.dest(uniteConfig.dirs.www.dist))); } }); // Generated by UniteJS
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>GLM_GTX_string_cast: String cast</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="logo-mini.png"></td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>GLM_GTX_string_cast: String cast</h1> </div> <div class="ingroups"><a class="el" href="a00247.html">GTX Extensions (Experimental)</a></div></div> <div class="contents"> <p>Setup strings for GLM type values. <a href="#_details">More...</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memTemplParams" colspan="2">template&lt;typename genType &gt; </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">std::string&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00293.html#<API key>">to_string</a> (genType const &amp;x)</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Setup strings for GLM type values. </p> <p>&lt;<a class="el" href="a00106_source.html">glm/gtx/string_cast.hpp</a>&gt; need to be included to use these functionalities. </p> <hr/><h2>Function Documentation</h2> <a class="anchor" id="<API key>"></a><!-- doxytag: member="glm::gtx::string_cast::to_string" ref="<API key>" args="(genType const &amp;x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">std::string glm::gtx::string_cast::to_string </td> <td>(</td> <td class="paramtype">genType const &amp;&#160;</td> <td class="paramname"><em>x</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Create a string from a GLM type value. </p> <p>From GLM_GTX_string_cast extension. </p> </div> </div> </div> <hr class="footer"/><address class="footer"><small>Generated by&#160; <a href="http: <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>
/* * Special implementations of built-in functions and methods. * * Optional optimisations for builtins are in Optimize.c. * * General object operations and protocols are in ObjectHandling.c. */ ///////////////// Globals.proto //////////////////// static PyObject* __Pyx_Globals(void); /*proto*/ ///////////////// Globals //////////////////// //@substitute: naming //@requires: ObjectHandling.c::GetAttr // This is a stub implementation until we have something more complete. // Currently, we only handle the most common case of a read-only dict // of Python names. Supporting cdef names in the module and write // access requires a rewrite as a dedicated class. static PyObject* __Pyx_Globals(void) { Py_ssize_t i; PyObject *names; PyObject *globals = $moddict_cname; Py_INCREF(globals); names = PyObject_Dir($module_cname); if (!names) goto bad; for (i = PyList_GET_SIZE(names)-1; i >= 0; i #if <API key> PyObject* name = PySequence_ITEM(names, i); if (!name) goto bad; #else PyObject* name = PyList_GET_ITEM(names, i); #endif if (!PyDict_Contains(globals, name)) { PyObject* value = __Pyx_GetAttr($module_cname, name); if (!value) { #if <API key> Py_DECREF(name); #endif goto bad; } if (PyDict_SetItem(globals, name, value) < 0) { #if <API key> Py_DECREF(name); #endif Py_DECREF(value); goto bad; } } #if <API key> Py_DECREF(name); #endif } Py_DECREF(names); return globals; bad: Py_XDECREF(names); Py_XDECREF(globals); return NULL; } ///////////////// PyExecGlobals.proto //////////////////// static PyObject* __Pyx_PyExecGlobals(PyObject*); ///////////////// PyExecGlobals //////////////////// //@requires: Globals //@requires: PyExec static PyObject* __Pyx_PyExecGlobals(PyObject* code) { PyObject* result; PyObject* globals = __Pyx_Globals(); if (unlikely(!globals)) return NULL; result = __Pyx_PyExec2(code, globals); Py_DECREF(globals); return result; } ///////////////// PyExec.proto //////////////////// static PyObject* __Pyx_PyExec3(PyObject*, PyObject*, PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject*, PyObject*); ///////////////// PyExec //////////////////// //@substitute: naming static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject* o, PyObject* globals) { return __Pyx_PyExec3(o, globals, NULL); } static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals) { PyObject* result; PyObject* s = 0; char *code = 0; if (!globals || globals == Py_None) { globals = $moddict_cname; } else if (!PyDict_Check(globals)) { PyErr_Format(PyExc_TypeError, "exec() arg 2 must be a dict, not %.200s", Py_TYPE(globals)->tp_name); goto bad; } if (!locals || locals == Py_None) { locals = globals; } if (PyDict_GetItem(globals, PYIDENT("__builtins__")) == NULL) { if (PyDict_SetItem(globals, PYIDENT("__builtins__"), PyEval_GetBuiltins()) < 0) goto bad; } if (PyCode_Check(o)) { if (PyCode_GetNumFree((PyCodeObject *)o) > 0) { PyErr_SetString(PyExc_TypeError, "code object passed to exec() may not contain free variables"); goto bad; } #if PY_VERSION_HEX < 0x030200B1 result = PyEval_EvalCode((PyCodeObject *)o, globals, locals); #else result = PyEval_EvalCode(o, globals, locals); #endif } else { PyCompilerFlags cf; cf.cf_flags = 0; if (PyUnicode_Check(o)) { cf.cf_flags = PyCF_SOURCE_IS_UTF8; s = <API key>(o); if (!s) goto bad; o = s; #if PY_MAJOR_VERSION >= 3 } else if (!PyBytes_Check(o)) { #else } else if (!PyString_Check(o)) { #endif PyErr_Format(PyExc_TypeError, "exec: arg 1 must be string, bytes or code object, got %.200s", Py_TYPE(o)->tp_name); goto bad; } #if PY_MAJOR_VERSION >= 3 code = PyBytes_AS_STRING(o); #else code = PyString_AS_STRING(o); #endif if (<API key>(&cf)) { result = PyRun_StringFlags(code, Py_file_input, globals, locals, &cf); } else { result = PyRun_String(code, Py_file_input, globals, locals); } Py_XDECREF(s); } return result; bad: Py_XDECREF(s); return 0; } ///////////////// GetAttr3.proto //////////////////// static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/ ///////////////// GetAttr3 //////////////////// //@requires: ObjectHandling.c::GetAttr static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { PyObject *r = __Pyx_GetAttr(o, n); if (unlikely(!r)) { if (!<API key>(<API key>)) goto bad; PyErr_Clear(); r = d; Py_INCREF(d); } return r; bad: return NULL; } ///////////////// Intern.proto //////////////////// static PyObject* __Pyx_Intern(PyObject* s); /* proto */ ///////////////// Intern //////////////////// static PyObject* __Pyx_Intern(PyObject* s) { if (!(likely(PyString_CheckExact(s)))) { PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(s)->tp_name); return 0; } Py_INCREF(s); #if PY_MAJOR_VERSION >= 3 <API key>(&s); #else <API key>(&s); #endif return s; } ///////////////// abs_int.proto //////////////////// static CYTHON_INLINE unsigned int __Pyx_abs_int(int x) { if (unlikely(x == -INT_MAX-1)) return ((unsigned int)INT_MAX) + 1U; return (unsigned int) abs(x); } ///////////////// abs_long.proto //////////////////// static CYTHON_INLINE unsigned long __Pyx_abs_long(long x) { if (unlikely(x == -LONG_MAX-1)) return ((unsigned long)LONG_MAX) + 1U; return (unsigned long) labs(x); } ///////////////// abs_longlong.proto //////////////////// static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_abs_longlong(PY_LONG_LONG x) { #ifndef PY_LLONG_MAX #ifdef LLONG_MAX const PY_LONG_LONG PY_LLONG_MAX = LLONG_MAX; #else // copied from pyport.h in CPython 3.3, missing in 2.4 const PY_LONG_LONG PY_LLONG_MAX = (1 + 2 * ((1LL << (CHAR_BIT * sizeof(PY_LONG_LONG) - 2)) - 1)); #endif #endif if (unlikely(x == -PY_LLONG_MAX-1)) return ((unsigned PY_LONG_LONG)PY_LLONG_MAX) + 1U; #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L return (unsigned PY_LONG_LONG) llabs(x); #else return (x<0) ? (unsigned PY_LONG_LONG)-x : (unsigned PY_LONG_LONG)x; #endif } ///////////////// pow2.proto //////////////////// #define <API key>(a, b) PyNumber_Power(a, b, Py_None) ///////////////// py_dict_keys.proto //////////////////// static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/ ///////////////// py_dict_keys //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod1 static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) { if (PY_MAJOR_VERSION >= 3) return <API key>((PyObject*)&PyDict_Type, PYIDENT("keys"), d); else return PyDict_Keys(d); } ///////////////// py_dict_values.proto //////////////////// static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /*proto*/ ///////////////// py_dict_values //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod1 static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { if (PY_MAJOR_VERSION >= 3) return <API key>((PyObject*)&PyDict_Type, PYIDENT("values"), d); else return PyDict_Values(d); } ///////////////// py_dict_items.proto //////////////////// static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /*proto*/ ///////////////// py_dict_items //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod1 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { if (PY_MAJOR_VERSION >= 3) return <API key>((PyObject*)&PyDict_Type, PYIDENT("items"), d); else return PyDict_Items(d); } ///////////////// py_dict_iterkeys.proto //////////////////// static CYTHON_INLINE PyObject* <API key>(PyObject* d); /*proto*/ ///////////////// py_dict_iterkeys //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod0 static CYTHON_INLINE PyObject* <API key>(PyObject* d) { return <API key>(d, (PY_MAJOR_VERSION >= 3) ? PYIDENT("keys") : PYIDENT("iterkeys")); } ///////////////// py_dict_itervalues.proto //////////////////// static CYTHON_INLINE PyObject* <API key>(PyObject* d); /*proto*/ ///////////////// py_dict_itervalues //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod0 static CYTHON_INLINE PyObject* <API key>(PyObject* d) { return <API key>(d, (PY_MAJOR_VERSION >= 3) ? PYIDENT("values") : PYIDENT("itervalues")); } ///////////////// py_dict_iteritems.proto //////////////////// static CYTHON_INLINE PyObject* <API key>(PyObject* d); /*proto*/ ///////////////// py_dict_iteritems //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod0 static CYTHON_INLINE PyObject* <API key>(PyObject* d) { return <API key>(d, (PY_MAJOR_VERSION >= 3) ? PYIDENT("items") : PYIDENT("iteritems")); } ///////////////// py_dict_viewkeys.proto //////////////////// #if PY_VERSION_HEX < 0x02070000 #error This module uses dict views, which require Python 2.7 or later #endif static CYTHON_INLINE PyObject* <API key>(PyObject* d); /*proto*/ ///////////////// py_dict_viewkeys //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod0 static CYTHON_INLINE PyObject* <API key>(PyObject* d) { return <API key>(d, (PY_MAJOR_VERSION >= 3) ? PYIDENT("keys") : PYIDENT("viewkeys")); } ///////////////// py_dict_viewvalues.proto //////////////////// #if PY_VERSION_HEX < 0x02070000 #error This module uses dict views, which require Python 2.7 or later #endif static CYTHON_INLINE PyObject* <API key>(PyObject* d); /*proto*/ ///////////////// py_dict_viewvalues //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod0 static CYTHON_INLINE PyObject* <API key>(PyObject* d) { return <API key>(d, (PY_MAJOR_VERSION >= 3) ? PYIDENT("values") : PYIDENT("viewvalues")); } ///////////////// py_dict_viewitems.proto //////////////////// #if PY_VERSION_HEX < 0x02070000 #error This module uses dict views, which require Python 2.7 or later #endif static CYTHON_INLINE PyObject* <API key>(PyObject* d); /*proto*/ ///////////////// py_dict_viewitems //////////////////// //@requires: ObjectHandling.c::PyObjectCallMethod0 static CYTHON_INLINE PyObject* <API key>(PyObject* d) { return <API key>(d, (PY_MAJOR_VERSION >= 3) ? PYIDENT("items") : PYIDENT("viewitems")); } ///////////////// pyfrozenset_new.proto //////////////////// //@substitute: naming static CYTHON_INLINE PyObject* <API key>(PyObject* it) { if (it) { PyObject* result; #if <API key> // PyPy currently lacks <API key>() and PyFrozenSet_New() PyObject* args; args = PyTuple_Pack(1, it); if (unlikely(!args)) return NULL; result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); Py_DECREF(args); return result; #else if (<API key>(it)) { Py_INCREF(it); return it; } result = PyFrozenSet_New(it); if (unlikely(!result)) return NULL; if (likely(PySet_GET_SIZE(result))) return result; // empty frozenset is a singleton // seems wasteful, but CPython does the same Py_DECREF(result); #endif } #if <API key> return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, $empty_tuple, NULL); #else return PyObject_Call((PyObject*)&PyFrozenSet_Type, $empty_tuple, NULL); #endif }
// Commom Plugins (function($) { 'use strict'; // Scroll to Top Button. if (typeof theme.PluginScrollToTop !== 'undefined') { theme.PluginScrollToTop.initialize(); } // Tooltips if ($.isFunction($.fn['tooltip'])) { $('[data-tooltip]:not(.manual), [data-plugin-tooltip]:not(.manual)').tooltip(); } // Popover if ($.isFunction($.fn['popover'])) { $(function() { $('[data-plugin-popover]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.popover(opts); }); }); } // Validations if (typeof theme.PluginValidation !== 'undefined') { theme.PluginValidation.initialize(); } // Match Height if ($.isFunction($.fn['matchHeight'])) { $('.match-height').matchHeight(); // Featured Boxes $('.featured-boxes .featured-box').matchHeight(); // Featured Box Full $('.featured-box-full').matchHeight(); } }).apply(this, [jQuery]); // Animate (function($) { 'use strict'; if ($.isFunction($.fn['themePluginAnimate'])) { $(function() { $('[data-plugin-animate], [<API key>]').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginAnimate(opts); }); }); } }).apply(this, [jQuery]); // Carousel (function($) { 'use strict'; if ($.isFunction($.fn['themePluginCarousel'])) { $(function() { $('[<API key>]:not(.manual), .owl-carousel:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginCarousel(opts); }); }); } }).apply(this, [jQuery]); // Chart.Circular (function($) { 'use strict'; if ($.isFunction($.fn['<API key>'])) { $(function() { $('[<API key>]:not(.manual), .circular-bar-chart:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.<API key>(opts); }); }); } }).apply(this, [jQuery]); // Counter (function($) { 'use strict'; if ($.isFunction($.fn['themePluginCounter'])) { $(function() { $('[data-plugin-counter]:not(.manual), .counters [data-to]').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginCounter(opts); }); }); } }).apply(this, [jQuery]); // Lazy Load (function($) { 'use strict'; if ($.isFunction($.fn['themePluginLazyLoad'])) { $(function() { $('[<API key>]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginLazyLoad(opts); }); }); } }).apply(this, [jQuery]); // Lightbox (function($) { 'use strict'; if ($.isFunction($.fn['themePluginLightbox'])) { $(function() { $('[<API key>]:not(.manual), .lightbox:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginLightbox(opts); }); }); } }).apply(this, [jQuery]); // Masonry (function($) { 'use strict'; if ($.isFunction($.fn['themePluginMasonry'])) { $(function() { $('[data-plugin-masonry]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginMasonry(opts); }); }); } }).apply(this, [jQuery]); // Match Height (function($) { 'use strict'; if ($.isFunction($.fn['<API key>'])) { $(function() { $('[<API key>]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.<API key>(opts); }); }); } }).apply(this, [jQuery]); // Parallax (function($) { 'use strict'; if ($.isFunction($.fn['themePluginParallax'])) { $(function() { $('[<API key>]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginParallax(opts); }); }); } }).apply(this, [jQuery]); // Progress Bar (function($) { 'use strict'; if ($.isFunction($.fn['<API key>'])) { $(function() { $('[<API key>]:not(.manual), [<API key>]').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.<API key>(opts); }); }); } }).apply(this, [jQuery]); // Revolution Slider (function($) { 'use strict'; if ($.isFunction($.fn['<API key>'])) { $(function() { $('[<API key>]:not(.manual), .slider-container .slider:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.<API key>(opts); }); }); } }).apply(this, [jQuery]); // Sort (function($) { 'use strict'; if ($.isFunction($.fn['themePluginSort'])) { $(function() { $('[data-plugin-sort]:not(.manual), .sort-source:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginSort(opts); }); }); } }).apply(this, [jQuery]); // Sticky (function($) { 'use strict'; if ($.isFunction($.fn['themePluginSticky'])) { $(function() { $('[data-plugin-sticky]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginSticky(opts); }); }); } }).apply(this, [jQuery]); // Toggle (function($) { 'use strict'; if ($.isFunction($.fn['themePluginToggle'])) { $(function() { $('[data-plugin-toggle]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginToggle(opts); }); }); } }).apply(this, [jQuery]); // Tweets (function($) { 'use strict'; if ($.isFunction($.fn['themePluginTweets'])) { $(function() { $('[data-plugin-tweets]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.themePluginTweets(opts); }); }); } }).apply(this, [jQuery]); // Video Background (function($) { 'use strict'; if ($.isFunction($.fn['<API key>'])) { $(function() { $('[<API key>]:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.<API key>(opts); }); }); } }).apply(this, [jQuery]); // Word Rotate (function($) { 'use strict'; if ($.isFunction($.fn['<API key>'])) { $(function() { $('[<API key>]:not(.manual), .word-rotate:not(.manual)').each(function() { var $this = $(this), opts; var pluginOptions = $this.data('plugin-options'); if (pluginOptions) opts = pluginOptions; $this.<API key>(opts); }); }); } }).apply(this, [jQuery]); // Commom Partials (function($) { 'use strict'; // Sticky Header if (typeof theme.StickyHeader !== 'undefined') { theme.StickyHeader.initialize(); } // Nav Menu if (typeof theme.Nav !== 'undefined') { theme.Nav.initialize(); } // Search if (typeof theme.Search !== 'undefined') { theme.Search.initialize(); } // Newsletter if (typeof theme.Newsletter !== 'undefined') { theme.Newsletter.initialize(); } // Account if (typeof theme.Account !== 'undefined') { theme.Account.initialize(); } }).apply(this, [jQuery]);
package main import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" "net/url" "os" "os/user" "path/filepath" "strings" "golang.org/x/net/context" "golang.org/x/oauth2" "golang.org/x/oauth2/google" gmail "google.golang.org/api/gmail/v1" "github.com/codegangsta/cli" "github.com/davecgh/go-spew/spew" ) var me = "me" func main() { app := cli.NewApp() app.Name = "proto" app.Usage = "test" app.Version = "0.0.1" app.Author = "Yusuke Komatsu" app.Commands = []cli.Command{ { Name: "cleanUp", Usage: " Description: "", Action: cleanUp, }, { Name: "<API key>", Usage: " Description: "", Action: <API key>, }, { Name: "getNoLabelSender", Usage: " Description: "", Action: getNoLabelSender, }, { Name: "<API key>", Usage: " Description: "", Action: <API key>, }, { Name: "setParentLabel", Usage: " Description: "", Action: setParentLabel, }, } app.Run(os.Args) } func cleanUp(c *cli.Context) { srv, err := getNewService() if err != nil { log.Fatalf("Unable to retrieve gmail Client %v", err) } req, err := srv.Users.Threads.List(me).Q("label:3day older_than:3d").Do() if err != nil { log.Fatalf("Unable to retrieve threads. %v", err) } if (len(req.Threads) > 0) { for _, th := range req.Threads { _, err := srv.Users.Threads.Trash(me, th.Id).Do() if err != nil { log.Fatalf("Unable to trash thread. ID:%v, %v", th.Id, err) } } } } func <API key>(c *cli.Context) { srv, err := getNewService() if err != nil { log.Fatalf("Unable to retrieve gmail Client %v", err) } req, err := srv.Users.Threads.List(me).Q("in:Sent -label:AwaitingResponse newer_than:7d").Do() if err != nil { log.Fatalf("Unable to retrieve threads. %v", err) } if len(req.Threads) > 0 { label_ar, err := getLabelByName("AwaitingResponse") if err != nil { log.Fatalf("Unable to retrieve AwaitingResponse label. %v", err) } label_fe, err := getLabelByName("FinishedExchange") if err != nil { log.Fatalf("Unable to retrieve FinishedExchange label. %v", err) } for _, th := range req.Threads { mod := &gmail.ModifyThreadRequest{} lbId := label_ar.Id if len(th.Messages) > 1 { lbId = label_fe.Id } mod.AddLabelIds = append(mod.AddLabelIds, lbId) _, err := srv.Users.Threads.Modify(me, th.Id, mod).Do() if err != nil { log.Fatalf("Unable to set label. %v", err) } } } } func <API key>(c *cli.Context) { srv, err := getNewService() if err != nil { log.Fatalf("Unable to retrieve gmail Client %v", err) } req, err := srv.Users.Threads.List(me).Q("label:AwaitingResponse older_than:7d newer_than:14d").Do() if err != nil { log.Fatalf("Unable to retrieve threads. %v", err) } if len(req.Threads) > 0 { removelabel, err := getLabelByName("AwaitingResponse") if err != nil { log.Fatalf("Unable to retrieve AwaitingResponse label. %v", err) } addlabel, err := getLabelByName("FinishedExchange") if err != nil { log.Fatalf("Unable to retrieve FinishedExchange label. %v", err) } for _, th := range req.Threads { mod := &gmail.ModifyThreadRequest{} mod.RemoveLabelIds = append(mod.RemoveLabelIds, removelabel.Id) if len(th.Messages) > 1 { mod.AddLabelIds = append(mod.AddLabelIds, addlabel.Id) } _, err := srv.Users.Threads.Modify(me, th.Id, mod).Do() if err != nil { log.Fatalf("Unable to remove label. %v", err) } } } } func setParentLabel(c *cli.Context) { srv, err := getNewService() if err != nil { log.Fatalf("Unable to retrieve gmail Client %v", err) } req, err := srv.Users.Labels.List(me).Do() if err != nil { log.Fatalf("Unable to retrieve labels. %v", err) } if (len(req.Labels) > 0) { parents := make(map[string]string) for _, lb := range req.Labels { if (strings.Contains(lb.Name, "/") == false) { parents[lb.Name] = lb.Id } } for _, l := range req.Labels { lbName := l.Name if (strings.Contains(lbName, "/")) { splitedLabelNames := strings.Split(lbName, "/") parent := splitedLabelNames[0] query := fmt.Sprintf("label:%s -label:%s", lbName, parent) r, err := srv.Users.Threads.List(me).Q(query).Do() if err != nil { log.Fatalf("Unable to retrieve threads. %v", err) } if parentId, ok := parents[parent]; ok { mod := &gmail.ModifyThreadRequest{} mod.AddLabelIds = append(mod.AddLabelIds, parentId) for _, th := range r.Threads { _, err := srv.Users.Threads.Modify(me, th.Id, mod).Do() if err != nil { log.Fatalf("Unable to set label. %v", err) } } } } } } } func getNoLabelSender(c *cli.Context) { srv, err := getNewService() if err != nil { log.Fatalf("Unable to retrieve gmail Client %v", err) } req, err := srv.Users.Threads.List(me).Q("has:nouserlabels newer_than:1d").Do() if err != nil { log.Fatalf("Unable to retrieve threads. %v", err) } if len(req.Threads) > 0 { sender := []string{} for _, th := range req.Threads { t, err := srv.Users.Threads.Get(me, th.Id).Fields("messages/payload").Do() if err != nil { log.Fatalf("Unable to retrieve a thread information. %v", err) } for _, msg := range t.Messages { headers := msg.Payload.Headers for _, header := range headers { if header.Name == "From" { sender = append(sender, header.Value) } } } } spew.Dump(sender) } } func getLabelByName(labelName string) (*gmail.Label, error) { srv, err := getNewService() if err != nil { return nil, err } req, err := srv.Users.Labels.List(me).Do() if err != nil { return nil, err } if (len(req.Labels) > 0) { for _, l := range req.Labels { if (l.Name == labelName) { return l, nil } } } return nil, nil } func getNewService() (*gmail.Service, error) { b, err := ioutil.ReadFile("client_secret.json") if err != nil { log.Fatalf("Unable to read client secret file: %v", err) } config, err := google.ConfigFromJSON(b, gmail.MailGoogleComScope) if err != nil { log.Fatalf("Unable to parse client secret file to config: %v", err) } client := getClient(context.Background(), config) srv, err := gmail.New(client) return srv, err } // getClient uses a Context and Config to retrieve a Token // then generate a Client. It returns the generated Client. func getClient(ctx context.Context, config *oauth2.Config) *http.Client { cacheFile, err := tokenCacheFile() if err != nil { log.Fatalf("Unable to get path to cached credential file. %v", err) } tok, err := tokenFromFile(cacheFile) if err != nil { tok = getTokenFromWeb(config) saveToken(cacheFile, tok) } return config.Client(ctx, tok) } // getTokenFromWeb uses Config to request a Token. // It returns the retrieved Token. func getTokenFromWeb(config *oauth2.Config) *oauth2.Token { authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) fmt.Printf("Go to the following link in your browser then type the "+ "authorization code: \n%v\n", authURL) var code string if _, err := fmt.Scan(&code); err != nil { log.Fatalf("Unable to read authorization code %v", err) } tok, err := config.Exchange(oauth2.NoContext, code) if err != nil { log.Fatalf("Unable to retrieve token from web %v", err) } return tok } // tokenCacheFile generates credential file path/filename. // It returns the generated credential path/filename. func tokenCacheFile() (string, error) { usr, err := user.Current() if err != nil { return "", err } tokenCacheDir := filepath.Join(usr.HomeDir, ".credentials") os.MkdirAll(tokenCacheDir, 0700) return filepath.Join(tokenCacheDir, url.QueryEscape("token_cache.json")), err } // tokenFromFile retrieves a Token from a given file path. // It returns the retrieved Token and any read error encountered. func tokenFromFile(file string) (*oauth2.Token, error) { f, err := os.Open(file) if err != nil { return nil, err } t := &oauth2.Token{} err = json.NewDecoder(f).Decode(t) defer f.Close() return t, err } // saveToken uses a file path to create a file and store the // token in it. func saveToken(file string, token *oauth2.Token) { fmt.Printf("Saving credential file to: %s\n", file) f, err := os.Create(file) if err != nil { log.Fatalf("Unable to cache oauth token: %v", err) } defer f.Close() json.NewEncoder(f).Encode(token) }
'use strict'; const BitcrusherProps = { bits: { type: 'number', bounds: [1, 16], defaultValue: 4 }, normfreq: { type: 'number', bounds: [0, 1], step: 0.1, defaultValue: 0.1 }, bufferSize: { type: 'number', bounds: [256, 16384], defaultValue: 4096 }, bypass: { type: 'number', bounds: [0, 1], defaultValue: 0 } }; export default BitcrusherProps;
#include "<API key>.hpp" namespace Sn { <API key>::<API key>(QWidget* parent) : QListWidget(parent), m_mouseDown(false) { setFocusPolicy(Qt::NoFocus); <API key>(Qt::ScrollBarAlwaysOff); setMovement(QListView::Static); setResizeMode(QListView::Adjust); setViewMode(QListView::IconMode); <API key>(false); } void <API key>::mousePressEvent(QMouseEvent* event) { m_mouseDown = true; QListWidget::mousePressEvent(event); } void <API key>::mouseMoveEvent(QMouseEvent* event) { if (!itemAt(event->pos())) return; QListWidget::mouseMoveEvent(event); } void <API key>::mouseReleaseEvent(QMouseEvent* event) { m_mouseDown = false; QListWidget::mouseReleaseEvent(event); } void <API key>::wheelEvent(QWheelEvent* event) { Q_UNUSED(event); } }
import os import sys from Bio import SeqIO f = open(sys.argv[1], 'rU') out = open(sys.argv[2], 'w') for records in SeqIO.parse(f, 'fastq'): SeqIO.write(records, out, 'fasta')
require 'strscan' # Parses a gem.deps.rb.lock file and constructs a LockSet containing the # dependencies found inside. If the lock file is missing no LockSet is # constructed. class Gem::RequestSet::Lockfile # Raised when a lockfile cannot be parsed class ParseError < Gem::Exception # The column where the error was encountered attr_reader :column # The line where the error was encountered attr_reader :line # The location of the lock file attr_reader :path # Raises a ParseError with the given +message+ which was encountered at a # +line+ and +column+ while parsing. def initialize message, column, line, path @line = line @column = column @path = path super "#{message} (at line #{line} column #{column})" end end # The platforms for this Lockfile attr_reader :platforms # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+ # location. def initialize request_set, gem_deps_file @set = request_set @gem_deps_file = File.expand_path(gem_deps_file) @gem_deps_dir = File.dirname(@gem_deps_file) @current_token = nil @line = 0 @line_pos = 0 @platforms = [] @tokens = [] end def add_DEPENDENCIES out # :nodoc: out << "DEPENDENCIES" @requests.sort_by { |r| r.name }.each do |request| spec = request.spec if [Gem::Resolver::VendorSpecification, Gem::Resolver::GitSpecification].include? spec.class then out << " #{request.name}!" else requirement = request.request.dependency.requirement out << " #{request.name}#{requirement.for_lockfile}" end end out << nil end def add_GEM out # :nodoc: return if @spec_groups.empty? source_groups = @spec_groups.values.flatten.group_by do |request| request.spec.source.uri end source_groups.sort_by { |group,| group.to_s }.map do |group, requests| out << "GEM" out << " remote: #{group}" out << " specs:" requests.sort_by { |request| request.name }.each do |request| platform = "-#{request.spec.platform}" unless Gem::Platform::RUBY == request.spec.platform out << " #{request.name} (#{request.version}#{platform})" request.full_spec.dependencies.sort.each do |dependency| requirement = dependency.requirement out << " #{dependency.name}#{requirement.for_lockfile}" end end out << nil end end def add_GIT out return unless git_requests = @spec_groups.delete(Gem::Resolver::GitSpecification) <API key> = git_requests.group_by do |request| source = request.spec.source [source.repository, source.rev_parse] end out << "GIT" <API key>.each do |(repository, revision), requests| out << " remote: #{repository}" out << " revision: #{revision}" out << " specs:" requests.sort_by { |request| request.name }.each do |request| out << " #{request.name} (#{request.version})" dependencies = request.spec.dependencies.sort_by { |dep| dep.name } dependencies.each do |dep| out << " #{dep.name}#{dep.requirement.for_lockfile}" end end end out << nil end def relative_path_from dest, base # :nodoc: dest = File.expand_path(dest) base = File.expand_path(base) if dest.index(base) == 0 return dest[base.size+1..-1] else dest end end def add_PATH out # :nodoc: return unless path_requests = @spec_groups.delete(Gem::Resolver::VendorSpecification) out << "PATH" path_requests.each do |request| directory = File.expand_path(request.spec.source.uri) out << " remote: #{relative_path_from directory, @gem_deps_dir}" out << " specs:" out << " #{request.name} (#{request.version})" end out << nil end def add_PLATFORMS out # :nodoc: out << "PLATFORMS" platforms = @requests.map { |request| request.spec.platform }.uniq platforms.delete Gem::Platform::RUBY if platforms.length > 1 platforms.each do |platform| out << " #{platform}" end out << nil end # Gets the next token for a Lockfile def get expected_types = nil, expected_value = nil # :nodoc: @current_token = @tokens.shift type, value, column, line = @current_token if expected_types and not Array(expected_types).include? type then unget message = "unexpected token [#{type.inspect}, #{value.inspect}], " + "expected #{expected_types.inspect}" raise ParseError.new message, column, line, "#{@gem_deps_file}.lock" end if expected_value and expected_value != value then unget message = "unexpected token [#{type.inspect}, #{value.inspect}], " + "expected [#{expected_types.inspect}, " + "#{expected_value.inspect}]" raise ParseError.new message, column, line, "#{@gem_deps_file}.lock" end @current_token end def parse # :nodoc: tokenize until @tokens.empty? do type, data, column, line = get case type when :section then skip :newline case data when 'DEPENDENCIES' then parse_DEPENDENCIES when 'GIT' then parse_GIT when 'GEM' then parse_GEM when 'PATH' then parse_PATH when 'PLATFORMS' then parse_PLATFORMS else type, = get until @tokens.empty? or peek.first == :section end else raise "BUG: unhandled token #{type} (#{data.inspect}) at line #{line} column #{column}" end end end def parse_DEPENDENCIES # :nodoc: while not @tokens.empty? and :text == peek.first do _, name, = get :text requirements = [] case peek[0] when :bang then get :bang spec = @set.sets.select { |set| Gem::Resolver::GitSet === set or Gem::Resolver::VendorSet === set }.map { |set| set.specs[name] }.first requirements << spec.version when :l_paren then get :l_paren loop do _, op, = get :requirement _, version, = get :text requirements << "#{op} #{version}" break unless peek[0] == :comma get :comma end get :r_paren end @set.gem name, *requirements skip :newline end end def parse_GEM # :nodoc: get :entry, 'remote' _, data, = get :text source = Gem::Source.new data skip :newline get :entry, 'specs' skip :newline set = Gem::Resolver::LockSet.new source last_spec = nil while not @tokens.empty? and :text == peek.first do _, name, column, = get :text case peek[0] when :newline then last_spec.add_dependency Gem::Dependency.new name if column == 6 when :l_paren then get :l_paren type, data, = get [:text, :requirement] if type == :text and column == 4 then last_spec = set.add name, data, Gem::Platform::RUBY else dependency = parse_dependency name, data last_spec.add_dependency dependency end get :r_paren else raise "BUG: unknown token #{peek}" end skip :newline end @set.sets << set end def parse_GIT # :nodoc: get :entry, 'remote' _, repository, = get :text skip :newline get :entry, 'revision' _, revision, = get :text skip :newline get :entry, 'specs' skip :newline set = Gem::Resolver::GitSet.new last_spec = nil while not @tokens.empty? and :text == peek.first do _, name, column, = get :text case peek[0] when :newline then last_spec.add_dependency Gem::Dependency.new name if column == 6 when :l_paren then get :l_paren type, data, = get [:text, :requirement] if type == :text and column == 4 then last_spec = set.add_git_spec name, data, repository, revision, true else dependency = parse_dependency name, data last_spec.spec.dependencies << dependency end get :r_paren else raise "BUG: unknown token #{peek}" end skip :newline end @set.sets << set end def parse_PATH # :nodoc: get :entry, 'remote' _, directory, = get :text skip :newline get :entry, 'specs' skip :newline set = Gem::Resolver::VendorSet.new last_spec = nil while not @tokens.empty? and :text == peek.first do _, name, column, = get :text case peek[0] when :newline then last_spec.add_dependency Gem::Dependency.new name if column == 6 when :l_paren then get :l_paren type, data, = get [:text, :requirement] if type == :text and column == 4 then last_spec = set.add_vendor_gem name, directory else dependency = parse_dependency name, data last_spec.spec.dependencies << dependency end get :r_paren else raise "BUG: unknown token #{peek}" end skip :newline end @set.sets << set end def parse_PLATFORMS # :nodoc: while not @tokens.empty? and :text == peek.first do _, name, = get :text @platforms << name skip :newline end end # Parses the requirements following the dependency +name+ and the +op+ for # the first token of the requirements and returns a Gem::Dependency object. def parse_dependency name, op # :nodoc: return Gem::Dependency.new name unless peek[0] == :text _, version, = get :text requirements = ["#{op} #{version}"] while peek[0] == :comma do get :comma _, op, = get :requirement _, version, = get :text requirements << "#{op} #{version}" end Gem::Dependency.new name, requirements end # Peeks at the next token for Lockfile def peek # :nodoc: @tokens.first || [:EOF] end def skip type # :nodoc: get while not @tokens.empty? and peek.first == type end # The contents of the lock file. def to_s @set.resolve out = [] @requests = @set.sorted_requests @spec_groups = @requests.group_by do |request| request.spec.class end add_PATH out add_GIT out add_GEM out add_PLATFORMS out add_DEPENDENCIES out out.join "\n" end # Calculates the column (by byte) and the line of the current token based on # +byte_offset+. def token_pos byte_offset # :nodoc: [byte_offset - @line_pos, @line] end # Converts a lock file into an Array of tokens. If the lock file is missing # an empty Array is returned. def tokenize # :nodoc: @line = 0 @line_pos = 0 @platforms = [] @tokens = [] @current_token = nil lock_file = "#{@gem_deps_file}.lock" @input = File.read lock_file s = StringScanner.new @input until s.eos? do pos = s.pos pos = s.pos if leading_whitespace = s.scan(/ +/) if s.scan(/[<|=>]{7}/) then message = "your #{lock_file} contains merge conflict markers" column, line = token_pos pos raise ParseError.new message, column, line, lock_file end @tokens << case when s.scan(/\r?\n/) then token = [:newline, nil, *token_pos(pos)] @line_pos = s.pos @line += 1 token when s.scan(/[A-Z]+/) then if leading_whitespace then text = s.matched text += s.scan(/[^\s)]*/).to_s # in case of no match [:text, text, *token_pos(pos)] else [:section, s.matched, *token_pos(pos)] end when s.scan(/([a-z]+):\s/) then s.pos -= 1 # rewind for possible newline [:entry, s[1], *token_pos(pos)] when s.scan(/\(/) then [:l_paren, nil, *token_pos(pos)] when s.scan(/\)/) then [:r_paren, nil, *token_pos(pos)] when s.scan(/<=|>=|=|~>|<|>|!=/) then [:requirement, s.matched, *token_pos(pos)] when s.scan(/,/) then [:comma, nil, *token_pos(pos)] when s.scan(/!/) then [:bang, nil, *token_pos(pos)] when s.scan(/[^\s),!]*/) then [:text, s.matched, *token_pos(pos)] else raise "BUG: can't create token for: #{s.string[s.pos..-1].inspect}" end end @tokens rescue Errno::ENOENT @tokens end # Ungets the last token retrieved by #get def unget # :nodoc: @tokens.unshift @current_token end # Writes the lock file alongside the gem dependencies file def write open "#{@gem_deps_file}.lock", 'w' do |io| io.write to_s end end end
define({ "_widgetLabel": "Tra cứu Địa lý", "description": "Duyệt đến hoặc Kéo <a href='./widgets/GeoLookup/data/sample.csv' tooltip='Download an example sheet' target='_blank'> trang tính </a> tại đây để mô phỏng và thêm các dữ liệu bản đồ vào trang tính đó.", "selectCSV": "Chọn một CSV", "loadingCSV": "Đang tải CSV", "savingCSV": "Xuất CSV", "clearResults": "Xóa", "downloadResults": "Tải xuống", "plotOnly": "Chỉ các Điểm Vẽ bản đồ", "plottingRows": "Hàng vẽ bản đồ", "projectionChoice": "CSV trong", "projectionLat": "Vĩ độ/Kinh độ", "projectionMap": "Phép chiếu Bản đồ", "messages": "Thông báo", "error": { "fetchingCSV": "Đã xảy ra lỗi khi truy xuất các mục từ kho lưu trữ CSV: ${0}", "fileIssue": "Không xử lý được tệp.", "notCSVFile": "Hiện chỉ hỗ trợ các tệp được ngăn cách bằng dấu phẩy (.csv).", "invalidCoord": "Trường vị trí không hợp lệ. Vui lòng kiểm tra tệp .csv.", "tooManyRecords": "Rất tiếc, hiện không được có quá ${0} bản ghi.", "CSVNoRecords": "Tệp không chứa bất kỳ hồ sơ nào.", "CSVEmptyFile": "Không có nội dung trong tệp." }, "results": { "csvLoaded": "Đã tải ${0} bản ghi từ tệp CSV", "recordsPlotted": "Đã định vị ${0}/${1} bản ghi trên bản đồ", "recordsEnriched": "Đã xử lý ${0}/${1}, đã bổ sung ${2} so với ${3}", "recordsError": "${0} bản ghi có lỗi", "recordsErrorList": "Hàng ${0} có sự cố", "label": "Kết quả CSV" } });
var chai = require("chai") var should = chai.should(); chai.use(require("chai-http")); var request = chai.request(require("./server")) var db = require("mongojs")("test") describe("CRUD Handler", () => { before(done => { done() }) beforeEach(done => { db.dropDatabase(done); }) after(done => { db.dropDatabase(done) }) it("should save a document", (done) => { var data = { name: "test" } request.post("/test") .send(data) .end((err, res) => { should.not.exist(err) res.should.have.status(201); res.body.should.be.an("object") res.body.should.have.keys(['error', 'data']) res.body.error.should.not.be.ok; res.body.data.name.should.be.eql("test") res.body.data.should.have.property("_id"); done() }) }) it("should list all documents", (done ) => { var list = [ {name: 'test21'}, {name: 'test22'} ] db.collection("test").insert(list, (err, result) => { request.get("/test") .end((err, res) => { should.not.exist(err) res.should.have.status(200) res.body.should.be.an("object") res.body.should.have.keys(['error', 'data']) res.body.error.should.not.be.ok; res.body.data.should.have.keys(['count', 'list']) res.body.data.count.should.be.eql(2) res.body.data.list.length.should.be.eql(2) done() }) }) }) it("should get a single document", done => { var doc = { name: 'test3' } db.collection('test').insert(doc, (err, result ) => { request.get("/test/" + result._id) .end((err, res) => { should.not.exist(err) res.should.have.status(200) res.body.should.be.an("object") res.body.should.have.keys(['error', 'data']) res.body.error.should.not.be.ok; res.body.data.should.have.keys(['_id', 'name']) res.body.data.name.should.be.eql(doc.name); done() }) }) }) it("should update an existing document", done => { var doc = { name: 'test3' } db.collection('test').insert(doc, (err, result ) => { result.name = "test3_updated"; request.put("/test/" + result._id) .send(result) .end((err, res) => { should.not.exist(err) res.should.have.status(202) res.body.should.be.an("object") res.body.should.have.keys(['error', 'data']) res.body.error.should.not.be.ok; db.collection('test').findOne({_id: db.ObjectId(result._id)}, (err, result1) => { should.not.exist(err) result1.name.should.be.eql(result.name); done() }) }) }) }) it("should remove a document", done => { var doc = { name: 'test3' } db.collection('test').insert(doc, (err, result ) => { request.delete("/test/" + result._id) .end((err, res) => { should.not.exist(err) res.should.have.status(202) res.body.should.be.an("object") res.body.should.have.keys(['error', 'data']) res.body.error.should.not.be.ok; db.collection('test').findOne({_id: db.ObjectId(result._id)}, (err, result1) => { should.not.exist(err) should.not.exist(result1); done() }) }) }) }) })
{-# LANGUAGE <API key> #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE Arrows #-} module Main where import Opaleye import Data.Profunctor.Product import Data.Profunctor.Product.Default import Data.Profunctor.Product.TH (<API key>) import Database.PostgreSQL.Simple import Database.PostgreSQL.Simple.FromField (FromField(..)) import Prelude hiding (id) import Control.Arrow newtype UserId = UserId Int deriving (Show) data UserPoly id name email = User { id :: id, name :: name, email :: email } deriving (Show) type User = UserPoly UserId String String type UserPGW = UserPoly (Column PGInt4) (Column PGText) (Column PGText) type UserPGR = UserPoly (Column PGInt4) (Column PGText) (Column PGText) $(<API key> "pUser" ''UserPoly) userTable :: Table UserPGW UserPGR userTable = Table "users" (pUser User { id = required "id", name = required "name", email = required "email" } ) instance FromField UserId where fromField field bs = UserId <$> fromField field bs instance <API key> PGInt4 UserId where <API key> = <API key> getUserRows :: IO [User] getUserRows = do conn <- connect defaultConnectInfo { connectDatabase = "scratch"} runQuery conn $ proc () -> do user@User {name = pgName} <- queryTable userTable -< () restrict -< (pgName .== (pgStrictText "John")) returnA -< user main :: IO () main = do rows <- getUserRows putStrLn $ show rows -- Output -- [User {id = UserId 1, name = "John", email = "john@mail.com"},User {id = UserId -- 2, name = "Bob", email = "bob@mail.com"},User {id = UserId 3, name = "Alice", -- email = "alice@mail.com"}]
"use strict"; devdiv.directive('devDiv', [function () { return { restrict: 'E', link: function (scope, iElement, iAttrs) { iElement.addClass("dev-div"); iElement.addClass("row"); } }; }]) devdiv.controller('NameCtrl', function ($scope, $watch) { });
(function() { 'use strict'; /* Filters */ var md5 = function (s) { if (!s) return ''; function L(k, d) { return (k << d) | (k >>> (32 - d)); } function K(G, k) { var I, d, F, H, x; F = (G & 2147483648); H = (k & 2147483648); I = (G & 1073741824); d = (k & 1073741824); x = (G & 1073741823) + (k & 1073741823); if (I & d) { return (x ^ 2147483648 ^ F ^ H); } if (I | d) { if (x & 1073741824) { return (x ^ 3221225472 ^ F ^ H); } else { return (x ^ 1073741824 ^ F ^ H); } } else { return (x ^ F ^ H); } } function r(d, F, k) { return (d & F) | ((~d) & k); } function q(d, F, k) { return (d & k) | (F & (~k)); } function p(d, F, k) { return (d ^ F ^ k); } function n(d, F, k) { return (F ^ (d | (~k))); } function u(G, F, aa, Z, k, H, I) { G = K(G, K(K(r(F, aa, Z), k), I)); return K(L(G, H), F); } function f(G, F, aa, Z, k, H, I) { G = K(G, K(K(q(F, aa, Z), k), I)); return K(L(G, H), F); } function D(G, F, aa, Z, k, H, I) { G = K(G, K(K(p(F, aa, Z), k), I)); return K(L(G, H), F); } function t(G, F, aa, Z, k, H, I) { G = K(G, K(K(n(F, aa, Z), k), I)); return K(L(G, H), F); } function e(G) { var Z; var F = G.length; var x = F + 8; var k = (x - (x % 64)) / 64; var I = (k + 1) * 16; var aa = Array(I - 1); var d = 0; var H = 0; while (H < F) { Z = (H - (H % 4)) / 4; d = (H % 4) * 8; aa[Z] = (aa[Z] | (G.charCodeAt(H) << d)); H++; } Z = (H - (H % 4)) / 4; d = (H % 4) * 8; aa[Z] = aa[Z] | (128 << d); aa[I - 2] = F << 3; aa[I - 1] = F >>> 29; return aa; } function B(x) { var k = "", F = "", G, d; for (d = 0; d <= 3; d++) { G = (x >>> (d * 8)) & 255; F = "0" + G.toString(16); k = k + F.substr(F.length - 2, 2); } return k; } function J(k) { k = k.replace(/rn/g, "n"); var d = ""; for (var F = 0; F < k.length; F++) { var x = k.charCodeAt(F); if (x < 128) { d += String.fromCharCode(x); } else { if ((x > 127) && (x < 2048)) { d += String.fromCharCode((x >> 6) | 192); d += String.fromCharCode((x & 63) | 128); } else { d += String.fromCharCode((x >> 12) | 224); d += String.fromCharCode(((x >> 6) & 63) | 128); d += String.fromCharCode((x & 63) | 128); } } } return d; } var C = []; var P, h, E, v, g, Y, X, W, V; var S = 7, Q = 12, N = 17, M = 22; var A = 5, z = 9, y = 14, w = 20; var o = 4, m = 11, l = 16, j = 23; var U = 6, T = 10, R = 15, O = 21; s = J(s); C = e(s); Y = 1732584193; X = 4023233417; W = 2562383102; V = 271733878; for (P = 0; P < C.length; P += 16) { h = Y; E = X; v = W; g = V; Y = u(Y, X, W, V, C[P + 0], S, 3614090360); V = u(V, Y, X, W, C[P + 1], Q, 3905402710); W = u(W, V, Y, X, C[P + 2], N, 606105819); X = u(X, W, V, Y, C[P + 3], M, 3250441966); Y = u(Y, X, W, V, C[P + 4], S, 4118548399); V = u(V, Y, X, W, C[P + 5], Q, 1200080426); W = u(W, V, Y, X, C[P + 6], N, 2821735955); X = u(X, W, V, Y, C[P + 7], M, 4249261313); Y = u(Y, X, W, V, C[P + 8], S, 1770035416); V = u(V, Y, X, W, C[P + 9], Q, 2336552879); W = u(W, V, Y, X, C[P + 10], N, 4294925233); X = u(X, W, V, Y, C[P + 11], M, 2304563134); Y = u(Y, X, W, V, C[P + 12], S, 1804603682); V = u(V, Y, X, W, C[P + 13], Q, 4254626195); W = u(W, V, Y, X, C[P + 14], N, 2792965006); X = u(X, W, V, Y, C[P + 15], M, 1236535329); Y = f(Y, X, W, V, C[P + 1], A, 4129170786); V = f(V, Y, X, W, C[P + 6], z, 3225465664); W = f(W, V, Y, X, C[P + 11], y, 643717713); X = f(X, W, V, Y, C[P + 0], w, 3921069994); Y = f(Y, X, W, V, C[P + 5], A, 3593408605); V = f(V, Y, X, W, C[P + 10], z, 38016083); W = f(W, V, Y, X, C[P + 15], y, 3634488961); X = f(X, W, V, Y, C[P + 4], w, 3889429448); Y = f(Y, X, W, V, C[P + 9], A, 568446438); V = f(V, Y, X, W, C[P + 14], z, 3275163606); W = f(W, V, Y, X, C[P + 3], y, 4107603335); X = f(X, W, V, Y, C[P + 8], w, 1163531501); Y = f(Y, X, W, V, C[P + 13], A, 2850285829); V = f(V, Y, X, W, C[P + 2], z, 4243563512); W = f(W, V, Y, X, C[P + 7], y, 1735328473); X = f(X, W, V, Y, C[P + 12], w, 2368359562); Y = D(Y, X, W, V, C[P + 5], o, 4294588738); V = D(V, Y, X, W, C[P + 8], m, 2272392833); W = D(W, V, Y, X, C[P + 11], l, 1839030562); X = D(X, W, V, Y, C[P + 14], j, 4259657740); Y = D(Y, X, W, V, C[P + 1], o, 2763975236); V = D(V, Y, X, W, C[P + 4], m, 1272893353); W = D(W, V, Y, X, C[P + 7], l, 4139469664); X = D(X, W, V, Y, C[P + 10], j, 3200236656); Y = D(Y, X, W, V, C[P + 13], o, 681279174); V = D(V, Y, X, W, C[P + 0], m, 3936430074); W = D(W, V, Y, X, C[P + 3], l, 3572445317); X = D(X, W, V, Y, C[P + 6], j, 76029189); Y = D(Y, X, W, V, C[P + 9], o, 3654602809); V = D(V, Y, X, W, C[P + 12], m, 3873151461); W = D(W, V, Y, X, C[P + 15], l, 530742520); X = D(X, W, V, Y, C[P + 2], j, 3299628645); Y = t(Y, X, W, V, C[P + 0], U, 4096336452); V = t(V, Y, X, W, C[P + 7], T, 1126891415); W = t(W, V, Y, X, C[P + 14], R, 2878612391); X = t(X, W, V, Y, C[P + 5], O, 4237533241); Y = t(Y, X, W, V, C[P + 12], U, 1700485571); V = t(V, Y, X, W, C[P + 3], T, 2399980690); W = t(W, V, Y, X, C[P + 10], R, 4293915773); X = t(X, W, V, Y, C[P + 1], O, 2240044497); Y = t(Y, X, W, V, C[P + 8], U, 1873313359); V = t(V, Y, X, W, C[P + 15], T, 4264355552); W = t(W, V, Y, X, C[P + 6], R, 2734768916); X = t(X, W, V, Y, C[P + 13], O, 1309151649); Y = t(Y, X, W, V, C[P + 4], U, 4149444226); V = t(V, Y, X, W, C[P + 11], T, 3174756917); W = t(W, V, Y, X, C[P + 2], R, 718787259); X = t(X, W, V, Y, C[P + 9], O, 3951481745); Y = K(Y, h); X = K(X, E); W = K(W, v); V = K(V, g); } var i = B(Y) + B(X) + B(W) + B(V); return i.toLowerCase(); }; angular.module('talis.filters.md5', []). filter("md5", function(){ return md5; }); }).call(this);
// All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library using System; using System.IO; public static partial class Extensions { <summary> Changes the extension of a @this string. </summary> <param name="this"> The @this information to modify. The @this cannot contain any of the characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" /> . </param> <param name="extension"> The new extension (with or without a leading period). Specify null to remove an existing extension from <paramref name="this" /> . </param> <returns> The modified @this information.On Windows-based desktop platforms, if <paramref name="this" /> is null or an empty string (""), the @this information is returned unmodified. If <paramref name="extension" /> is null, the returned string contains the specified @this with its extension removed. If <paramref name="this" /> has no extension, and <paramref name="extension" /> is not null, the returned @this string contains <paramref name="extension" /> appended to the end of <paramref name="this" />. </returns> <exception cref="T:System.ArgumentException"> <paramref name="this" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" /> . </exception> public static String ChangeExtension(this FileInfo @this, String extension) { return Path.ChangeExtension(@this.FullName, extension); } }
<?php defined('BASEPATH') OR exit('No direct script access allowed.'); $config['useragent'] = 'PHPMailer'; // Mail engine switcher: 'CodeIgniter' or 'PHPMailer' $config['protocol'] = IS_WINDOWS_OS ? 'smtp' : 'mail'; // 'mail', 'sendmail', or 'smtp' $config['mailpath'] = '/usr/sbin/sendmail'; $config['smtp_host'] = 'localhost'; $config['smtp_user'] = ''; $config['smtp_pass'] = ''; $config['smtp_port'] = 25; $config['smtp_timeout'] = 30; // (in seconds) $config['smtp_crypto'] = ''; // '' or 'tls' or 'ssl' $config['smtp_debug'] = 0; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output. $config['debug_output'] = ''; // PHPMailer's SMTP debug output: 'html', 'echo', 'error_log' or user defined function with parameter $str and $level. NULL or '' means 'echo' on CLI, 'html' otherwise. $config['smtp_auto_tls'] = true; // Whether to enable TLS encryption automatically if a server supports it, even if `smtp_crypto` is not set to 'tls'. $config['smtp_conn_options'] = array(); // SMTP connection options, an array passed to the function <API key>() when connecting via SMTP. $config['wordwrap'] = true; $config['wrapchars'] = 76; $config['mailtype'] = 'html'; // 'text' or 'html' $config['charset'] = null; // 'UTF-8', 'ISO-8859-15', ...; NULL (preferable) means config_item('charset'), i.e. the character set of the site. $config['validate'] = true; $config['priority'] = 3; $config['crlf'] = "\n"; // "\r\n" or "\n" or "\r" $config['newline'] = "\n"; // "\r\n" or "\n" or "\r" $config['bcc_batch_mode'] = false; $config['bcc_batch_size'] = 200; $config['encoding'] = '8bit'; // The body encoding. For CodeIgniter: '8bit' or '7bit'. For PHPMailer: '8bit', '7bit', 'binary', 'base64', or 'quoted-printable'. // DKIM Signing // See https://github.com/PHPMailer/PHPMailer/blob/v5.2.14/test/phpmailerTest.php#L1708 $config['dkim_domain'] = ''; // DKIM signing domain name, for exmple 'example.com'. $config['dkim_private'] = ''; // DKIM private key, set as a file path. $config['dkim_private_string'] = ''; // DKIM private key, set directly from a string. $config['dkim_selector'] = ''; // DKIM selector. $config['dkim_passphrase'] = ''; // DKIM passphrase, used if your key is encrypted. $config['dkim_identity'] = ''; // DKIM Identity, usually the email address used as the source of the email. // An example for a Gmail Account: /* $config['useragent'] = 'PHPMailer'; $config['protocol'] = 'smtp'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['smtp_host'] = 'smtp.gmail.com'; $config['smtp_user'] = 'yourusername@gmail.com'; $config['smtp_pass'] = 'yourpassword'; $config['smtp_port'] = 587; $config['smtp_timeout'] = 30; $config['smtp_crypto'] = 'tls'; $config['smtp_debug'] = 0; $config['debug_output'] = ''; $config['smtp_auto_tls'] = false; $config['smtp_conn_options'] = array(); $config['wordwrap'] = true; $config['wrapchars'] = 76; $config['mailtype'] = 'html'; $config['charset'] = null; $config['validate'] = true; $config['priority'] = 3; $config['crlf'] = "\n"; $config['newline'] = "\n"; $config['bcc_batch_mode'] = false; $config['bcc_batch_size'] = 200; $config['encoding'] = '8bit'; */
'use strict'; import 'vs/css!./glyphMargin'; import { DynamicViewOverlay } from 'vs/editor/browser/view/dynamicViewOverlay'; import { ViewContext } from 'vs/editor/common/view/viewContext'; import { RenderingContext } from 'vs/editor/common/view/renderingContext'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; import { editorBackground } from 'vs/platform/theme/common/colorRegistry'; import { <API key> } from 'vs/platform/theme/common/themeService'; export class DecorationToRender { <API key>: void; public startLineNumber: number; public endLineNumber: number; public className: string; constructor(startLineNumber: number, endLineNumber: number, className: string) { this.startLineNumber = +startLineNumber; this.endLineNumber = +endLineNumber; this.className = String(className); } } export abstract class DedupOverlay extends DynamicViewOverlay { protected _render(<API key>: number, <API key>: number, decorations: DecorationToRender[]): string[][] { let output: string[][] = []; for (let lineNumber = <API key>; lineNumber <= <API key>; lineNumber++) { let lineIndex = lineNumber - <API key>; output[lineIndex] = []; } if (decorations.length === 0) { return output; } decorations.sort((a, b) => { if (a.className === b.className) { if (a.startLineNumber === b.startLineNumber) { return a.endLineNumber - b.endLineNumber; } return a.startLineNumber - b.startLineNumber; } return (a.className < b.className ? -1 : 1); }); let prevClassName: string = null; let prevEndLineIndex = 0; for (let i = 0, len = decorations.length; i < len; i++) { let d = decorations[i]; let className = d.className; let startLineIndex = Math.max(d.startLineNumber, <API key>) - <API key>; let endLineIndex = Math.min(d.endLineNumber, <API key>) - <API key>; if (prevClassName === className) { startLineIndex = Math.max(prevEndLineIndex + 1, startLineIndex); prevEndLineIndex = Math.max(prevEndLineIndex, endLineIndex); } else { prevClassName = className; prevEndLineIndex = endLineIndex; } for (let i = startLineIndex; i <= prevEndLineIndex; i++) { output[i].push(prevClassName); } } return output; } } export class GlyphMarginOverlay extends DedupOverlay { private _context: ViewContext; private _lineHeight: number; private _glyphMargin: boolean; private _glyphMarginLeft: number; private _glyphMarginWidth: number; private _renderResult: string[]; constructor(context: ViewContext) { super(); this._context = context; this._lineHeight = this._context.configuration.editor.lineHeight; this._glyphMargin = this._context.configuration.editor.viewInfo.glyphMargin; this._glyphMarginLeft = this._context.configuration.editor.layoutInfo.glyphMarginLeft; this._glyphMarginWidth = this._context.configuration.editor.layoutInfo.glyphMarginWidth; this._renderResult = null; this._context.addEventHandler(this); } public dispose(): void { this._context.removeEventHandler(this); this._context = null; this._renderResult = null; } public <API key>(e: viewEvents.<API key>): boolean { if (e.lineHeight) { this._lineHeight = this._context.configuration.editor.lineHeight; } if (e.viewInfo.glyphMargin) { this._glyphMargin = this._context.configuration.editor.viewInfo.glyphMargin; } if (e.layoutInfo) { this._glyphMarginLeft = this._context.configuration.editor.layoutInfo.glyphMarginLeft; this._glyphMarginWidth = this._context.configuration.editor.layoutInfo.glyphMarginWidth; } return true; } public <API key>(e: viewEvents.<API key>): boolean { return false; } public <API key>(e: viewEvents.<API key>): boolean { return false; } public <API key>(e: viewEvents.<API key>): boolean { return true; } public onFlushed(e: viewEvents.ViewFlushedEvent): boolean { return true; } public onLinesChanged(e: viewEvents.<API key>): boolean { return true; } public onLinesDeleted(e: viewEvents.<API key>): boolean { return true; } public onLinesInserted(e: viewEvents.<API key>): boolean { return true; } public <API key>(e: viewEvents.<API key>): boolean { return false; } public onScrollChanged(e: viewEvents.<API key>): boolean { return e.scrollTopChanged; } public onZonesChanged(e: viewEvents.<API key>): boolean { return true; } protected _getDecorations(ctx: RenderingContext): DecorationToRender[] { let decorations = ctx.<API key>(); let r: DecorationToRender[] = []; for (let i = 0, len = decorations.length; i < len; i++) { let d = decorations[i]; let <API key> = d.source.options.<API key>; if (<API key>) { r.push(new DecorationToRender(d.range.startLineNumber, d.range.endLineNumber, <API key>)); } } return r; } public prepareRender(ctx: RenderingContext): void { if (!this._glyphMargin) { this._renderResult = null; return; } let <API key> = ctx.visibleRange.startLineNumber; let <API key> = ctx.visibleRange.endLineNumber; let toRender = this._render(<API key>, <API key>, this._getDecorations(ctx)); let lineHeight = this._lineHeight.toString(); let left = this._glyphMarginLeft.toString(); let width = this._glyphMarginWidth.toString(); let common = '" style="left:' + left + 'px;width:' + width + 'px' + ';height:' + lineHeight + 'px;"></div>'; let output: string[] = []; for (let lineNumber = <API key>; lineNumber <= <API key>; lineNumber++) { let lineIndex = lineNumber - <API key>; let classNames = toRender[lineIndex]; if (classNames.length === 0) { output[lineIndex] = ''; } else { output[lineIndex] = ( '<div class="cgmr ' + classNames.join(' ') + common ); } } this._renderResult = output; } public render(startLineNumber: number, lineNumber: number): string { if (!this._renderResult) { return ''; } let lineIndex = lineNumber - startLineNumber; if (lineIndex < 0 || lineIndex >= this._renderResult.length) { throw new Error('Unexpected render request'); } return this._renderResult[lineIndex]; } } <API key>((theme, collector) => { let <API key> = theme.getColor(editorBackground); if (<API key>) { collector.addRule(`.monaco-editor.${theme.selector} .glyph-margin { background-color: ${<API key>}; }`); } });
package net.ontrack.core.security; import lombok.Data; import net.ontrack.core.model.AccountSummary; @Data public class <API key> { private final int project; private final AccountSummary account; private final ProjectRole role; }
require 'set' require 'sprockets/http_utils' require 'sprockets/<API key>' require 'sprockets/uri_utils' module Sprockets module Resolve include HTTPUtils, PathDependencyUtils, URIUtils # Public: Find Asset URI for given a logical path by searching the # environment's load paths. # resolve("application.js") # # => "file:///path/to/app/javascripts/application.js?type=application/javascript" # An accept content type can be given if the logical path doesn't have a # format extension. # resolve("application", accept: "application/javascript") # # => "file:///path/to/app/javascripts/application.coffee?type=application/javascript" # The String Asset URI is returned or nil if no results are found. def resolve(path, load_paths: config[:paths], accept: nil, pipeline: nil, base_path: nil) paths = load_paths if valid_asset_uri?(path) uri, deps = resolve_asset_uri(path) elsif absolute_path?(path) filename, type, deps = <API key>(paths, path, accept) elsif relative_path?(path) filename, type, path_pipeline, deps, index_alias = <API key>(paths, path, base_path, accept) else filename, type, path_pipeline, deps, index_alias = <API key>(paths, path, accept) end if filename uri = build_asset_uri(filename, type: type, pipeline: pipeline || path_pipeline, index_alias: index_alias) end return uri, deps end # Public: Same as resolve() but raises a FileNotFound exception instead of # nil if no assets are found. def resolve!(path, **kargs) uri, deps = resolve(path, **kargs) unless uri message = "couldn't find file '#{path}'" if relative_path?(path) && kargs[:base_path] load_path, _ = paths_split(config[:paths], kargs[:base_path]) message << " under '#{load_path}'" end message << " with type '#{kargs[:accept]}'" if kargs[:accept] raise FileNotFound, message end return uri, deps end protected def resolve_asset_uri(uri) filename, _ = parse_asset_uri(uri) return uri, Set.new([<API key>(filename)]) end def <API key>(paths, filename, accept) deps = Set.new filename = File.expand_path(filename) # Ensure path is under load paths return nil, nil, deps unless paths_split(paths, filename) _, mime_type = match_path_extname(filename, config[:mime_exts]) type = <API key>(mime_type, accept) return nil, nil, deps if accept && !type return nil, nil, deps unless file?(filename) deps << <API key>(filename) return filename, type, deps end def <API key>(paths, path, dirname, accept) filename = File.expand_path(path, dirname) load_path, _ = paths_split(paths, dirname) if load_path && logical_path = split_subpath(load_path, filename) <API key>([load_path], logical_path, accept) else return nil, nil, nil, Set.new end end def <API key>(paths, logical_path, accept) extname, mime_type = match_path_extname(logical_path, config[:mime_exts]) logical_name = logical_path.chomp(extname) extname, pipeline = match_path_extname(logical_name, config[:pipeline_exts]) logical_name = logical_name.chomp(extname) parsed_accept = <API key>(mime_type, accept) transformed_accepts = <API key>(parsed_accept) filename, mime_type, deps, index_alias = resolve_under_paths(paths, logical_name, transformed_accepts) if filename deps << <API key>(filename) type = <API key>(mime_type, parsed_accept) return filename, type, pipeline, deps, index_alias else return nil, nil, nil, deps end end def resolve_under_paths(paths, logical_name, accepts) deps = Set.new return nil, nil, deps if accepts.empty? mime_exts = config[:mime_exts] paths.each do |load_path| # TODO: Allow new path resolves to be registered fns = [ method(:<API key>), method(:<API key>), method(:<API key>) ] candidates = [] fns.each do |fn| result = fn.call(load_path, logical_name, mime_exts) candidates.concat(result[0]) deps.merge(result[1]) end candidate = find_best_q_match(accepts, candidates) do |c, matcher| match_mime_type?(c[:type] || "application/octet-stream", matcher) end return candidate[:filename], candidate[:type], deps, candidate[:index_alias] if candidate end return nil, nil, deps end def <API key>(load_path, logical_name, mime_exts) dirname = File.dirname(File.join(load_path, logical_name)) candidates = <API key>(dirname, File.basename(logical_name), mime_exts) return candidates.map { |c| { filename: c[0], type: c[1] } }, [<API key>(dirname)] end def <API key>(load_path, logical_name, mime_exts) filenames, deps = self.resolve_alternates(load_path, logical_name) return filenames.map { |fn| _, mime_type = match_path_extname(fn, mime_exts) { filename: fn, type: mime_type } }, deps end def <API key>(load_path, logical_name, mime_exts) dirname = File.join(load_path, logical_name) deps = [<API key>(dirname)] candidates = [] if directory?(dirname) candidates = <API key>(dirname, "index", mime_exts) end return candidates.map { |c| { filename: c[0], type: c[1], index_alias: c[0].gsub(/\/index(\.\w{2,4})$/, '\1') } }, deps end def <API key>(mime_type, types) accepts = [] accepts += parse_q_values(types) if types if mime_type if accepts.empty? || accepts.any? { |accept, _| match_mime_type?(mime_type, accept) } accepts = [[mime_type, 1.0]] else return [] end end if accepts.empty? accepts << ['*/*', 1.0] end accepts end def resolve_alternates(load_path, logical_name) return [], Set.new end end end
(function (subdivision) { 'use strict'; var count = 0; var builders; var defaultBuilder; function buildInternal(type, addin, options, meta) { var builder = subdivision.getBuilder(type); if (builder.preBuildTarget) { addin = buildInternal(builder.preBuildTarget, addin, options, meta); } return builder.build(addin, options, meta); } function buildInternalAsync(type, addin, options, meta) { try { var builder = subdivision.getBuilder(type); var promise = Promise.resolve(addin); if (builder.preBuildTarget) { promise = buildInternalAsync(builder.preBuildTarget, addin, options, meta); } return promise.then(function (addin) { return builder.build(addin, options, meta); }); } catch (ex) { return Promise.reject(ex); } } subdivision.Builder = function (options) { var builder = subdivision.Addin.$internalConstructor('builder', count++, options); if (!_.isFunction(builder.build)) { throw new Error('Builder options must contain the "build" function ' + JSON.stringify(options)); } builder.target = builder.target === undefined ? '' : builder.target; return builder; }; subdivision.systemPaths.builders = subdivision.registry.joinPath(subdivision.systemPaths.prefix, 'builders'); subdivision.defaultManifest.paths.push({ path: subdivision.systemPaths.builders, addins: [ { Update docs if this changes id: 'subdivision.defaultBuilder', type: 'subdivision.builder', target: null, order: subdivision.registry.$defaultOrder, build: function (addin) { return _.cloneDeep(addin); } } ] }); /** * Adds a new builder created from the options to the list of known builders. * If a builder that builds the given type already exists then * the new builder is added based on the forced option. If force is truthy it is added anyway otherwise does nothing * Returns true if a builder was added and false otherwise * */ subdivision.addBuilder = function (options, force) { var builder = new subdivision.Builder(options); if (builder.target === null) { if (!defaultBuilder || force) { defaultBuilder = builder; return true; } else { return false; } } if (!builders.hasOwnProperty(builder.target) || force) { builders[builder.target] = builder; return true; } else { return false; } }; subdivision.getBuilder = function (type) { if (type === null && defaultBuilder) { return defaultBuilder; } else { if (builders.hasOwnProperty(type)) { return builders[type]; } if (defaultBuilder) { return defaultBuilder; } } throw new Error('No builder of type "' + type + '" was defined and no default builder was registered'); }; /** * Returns all the addins in the path after applying the appropriate builder on each * @param path - The path to build * @param options - Custom options to be passed to the addin builder * @param searchCriteria - The search criteria for the underscore filter function * @param skipSort - If truthy the topological sort is skipped * @returns {Array} = The built addins */ subdivision.build = function (path, options, searchCriteria, skipSort) { var addins = subdivision.getAddins(path, searchCriteria, skipSort); if (addins.length === 0) { return addins; } return _.map(addins, function (addin) { return buildInternal(addin.type, addin, options, { path: path }); }); }; /** * Returns all the addins in the path after applying the appropriate builder on each * @param path - The path to build * @param options - Custom options to be passed to the addin builder * @param searchCriteria - The search criteria for the underscore filter function * @param skipSort - If truthy the topological sort is skipped * @returns {Array} = A promise that resolves with an array of the built addins */ subdivision.build.async = function (path, options, searchCriteria, skipSort) { var addins = subdivision.getAddins(path, searchCriteria, skipSort); if (addins.length === 0) { return Promise.resolve(addins); } var promises = _.map(addins, function (addin) { //TODO: Optimization that tries to guess the builder from previous builder return buildInternalAsync(addin.type, addin, options, { path: path }); }); return Promise.all(promises); }; /** * Builds a single addin based on its type * @param addin The addin to build * @param options The options to pass to the builder */ subdivision.buildAddin = function (addin, options) { return buildInternal(addin.type, addin, options, { path: null }); }; /** * The async version of buildAddin * @param addin The addin to build * @param options The options to pass to the builder * @returns A promise that when resolved returns the built addin */ subdivision.buildAddin.async = function (addin, options) { return buildInternalAsync(addin.type, addin, options, { path: null }); }; /** * Builds a tree out of the given path. Each addin will have child elements at path+addin.id added * to its items property (default $items). * @param path * @param options - Custom options to be passed to the addin builder */ subdivision.buildTree = function (path, options) { var addins = subdivision.getAddins(path); if (addins.length === 0) { return addins; } return _.map(addins, function (addin) { //TODO: Optimization that tries to guess the builder from previous builder var result = buildInternal(addin.type, addin, options, { path: path }); var itemsProperty = addin.itemsProperty || '$items'; result[itemsProperty] = subdivision.buildTree(subdivision.registry.joinPath(path, addin.id), options); return result; }); }; /** * Regenerates all the builders from the system builders path */ subdivision.$generateBuilders = function () { subdivision.$clearBuilders(); var addins = subdivision.getAddins(subdivision.systemPaths.builders, {target: null}); if (addins.length > 0) { defaultBuilder = new subdivision.Builder(addins[0]); } addins = subdivision.getAddins(subdivision.systemPaths.builders); _.forEach(addins, function (addin) { subdivision.addBuilder(addin); }); }; subdivision.$clearBuilders = function () { builders = {}; defaultBuilder = null; }; subdivision.$clearBuilders(); Object.defineProperty(subdivision, 'builders', { enumerable: true, configurable: false, get: function () { return _.clone(builders); } }); })(subdivision);
// This file is automatically generated. // Please do not change this file! interface CssExports { 'button': string; 'buttonItemCount': string; 'checked': string; 'level': string; 'selector': string; } export const cssExports: CssExports; export default cssExports;
import argparse import asyncio import gc import os.path import pathlib import socket import ssl PRINT = 0 async def echo_server(loop, address, unix): if unix: sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) else: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind(address) sock.listen(5) sock.setblocking(False) if PRINT: print('Server listening at', address) with sock: while True: client, addr = await loop.sock_accept(sock) if PRINT: print('Connection from', addr) loop.create_task(echo_client(loop, client)) async def echo_client(loop, client): try: client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) except (OSError, NameError): pass with client: while True: data = await loop.sock_recv(client, 1000000) if not data: break await loop.sock_sendall(client, data) if PRINT: print('Connection closed') async def echo_client_streams(reader, writer): sock = writer.get_extra_info('socket') try: sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) except (OSError, NameError): pass if PRINT: print('Connection from', sock.getpeername()) while True: data = await reader.read(1000000) if not data: break writer.write(data) if PRINT: print('Connection closed') writer.close() class EchoProtocol(asyncio.Protocol): def connection_made(self, transport): self.transport = transport def connection_lost(self, exc): self.transport = None def data_received(self, data): self.transport.write(data) class <API key>(asyncio.BufferedProtocol): def connection_made(self, transport): self.transport = transport # Here the buffer is intended to be copied, so that the outgoing buffer # won't be wrongly updated by next read self.buffer = bytearray(256 * 1024) def connection_lost(self, exc): self.transport = None def get_buffer(self, sizehint): return self.buffer def buffer_updated(self, nbytes): self.transport.write(self.buffer[:nbytes]) async def print_debug(loop): while True: print(chr(27) + "[2J") # clear screen loop.print_debug_info() await asyncio.sleep(0.5) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--uvloop', default=False, action='store_true') parser.add_argument('--streams', default=False, action='store_true') parser.add_argument('--proto', default=False, action='store_true') parser.add_argument('--addr', default='127.0.0.1:25000', type=str) parser.add_argument('--print', default=False, action='store_true') parser.add_argument('--ssl', default=False, action='store_true') parser.add_argument('--buffered', default=False, action='store_true') args = parser.parse_args() if args.uvloop: import uvloop loop = uvloop.new_event_loop() print('using UVLoop') else: loop = asyncio.new_event_loop() print('using asyncio loop') asyncio.set_event_loop(loop) loop.set_debug(False) if args.print: PRINT = 1 if hasattr(loop, 'print_debug_info'): loop.create_task(print_debug(loop)) PRINT = 0 unix = False if args.addr.startswith('file:'): unix = True addr = args.addr[5:] if os.path.exists(addr): os.remove(addr) else: addr = args.addr.split(':') addr[1] = int(addr[1]) addr = tuple(addr) print('serving on: {}'.format(addr)) server_context = None if args.ssl: print('with SSL') if hasattr(ssl, 'PROTOCOL_TLS'): server_context = ssl.SSLContext(ssl.PROTOCOL_TLS) else: server_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) server_context.load_cert_chain( (pathlib.Path(__file__).parent.parent.parent / 'tests' / 'certs' / 'ssl_cert.pem'), (pathlib.Path(__file__).parent.parent.parent / 'tests' / 'certs' / 'ssl_key.pem')) if hasattr(server_context, 'check_hostname'): server_context.check_hostname = False server_context.verify_mode = ssl.CERT_NONE if args.streams: if args.proto: print('cannot use --stream and --proto simultaneously') exit(1) if args.buffered: print('cannot use --stream and --buffered simultaneously') exit(1) print('using asyncio/streams') if unix: coro = asyncio.start_unix_server(echo_client_streams, addr, ssl=server_context) else: coro = asyncio.start_server(echo_client_streams, *addr, ssl=server_context) srv = loop.run_until_complete(coro) elif args.proto: if args.streams: print('cannot use --stream and --proto simultaneously') exit(1) if args.buffered: print('using buffered protocol') protocol = <API key> else: print('using simple protocol') protocol = EchoProtocol if unix: coro = loop.create_unix_server(protocol, addr, ssl=server_context) else: coro = loop.create_server(protocol, *addr, ssl=server_context) srv = loop.run_until_complete(coro) else: if args.ssl: print('cannot use SSL for loop.sock_* methods') exit(1) print('using sock_recv/sock_sendall') loop.create_task(echo_server(loop, addr, unix)) try: loop.run_forever() finally: if hasattr(loop, 'print_debug_info'): gc.collect() print(chr(27) + "[2J") loop.print_debug_info() loop.close()
<?php namespace PHPExiftool\Driver\Tag\MXF; use JMS\Serializer\Annotation\ExclusionPolicy; use PHPExiftool\Driver\AbstractTag; /** * @ExclusionPolicy("all") */ class EventStart extends AbstractTag { protected $Id = '060e2b34.0101.0102.07020103.03030000'; protected $Name = 'EventStart'; protected $FullName = 'MXF::Main'; protected $GroupName = 'MXF'; protected $g0 = 'MXF'; protected $g1 = 'MXF'; protected $g2 = 'Video'; protected $Type = '?'; protected $Writable = false; protected $Description = 'Event Start'; }
<?php namespace Soda\Cms\Database\Repositories\Contracts; use Illuminate\Http\Request; use Soda\Cms\Database\Models\Contracts\ContentInterface; interface <API key> extends <API key> { public function findBySlug($slug); public function listFolder(Request $request, ContentInterface $contentFolder); public function getBlockTypes(); public function <API key>(ContentInterface $content); public function getRoot(); public function getTypes($creatableOnly = false); public function getShortcuts(ContentInterface $content); public function <API key>($contentFolderId); public function createStub($parentId = null, $contentTypeId = null); }
(function( root, factory ) { if( typeof define === 'function' && define.amd ) { // AMD. Register as an anonymous module. define( function() { root.Reveal = factory(); return root.Reveal; } ); } else if( typeof exports === 'object' ) { // Node. Does not work with strict CommonJS. module.exports = factory(); } else { // Browser globals. root.Reveal = factory(); } }( this, function() { 'use strict'; var Reveal; // The reveal.js version var VERSION = '3.3.0'; var SLIDES_SELECTOR = '.slides section', <API key> = '.slides>section', <API key> = '.slides>section.present>section', HOME_SLIDE_SELECTOR = '.slides>section:first-of-type', UA = navigator.userAgent, // Configuration defaults, can be overridden at initialization time config = { // The "normal" size of the presentation, aspect ratio will be preserved // when the presentation is scaled to fit different resolutions width: 960, height: 700, // Factor of the display size that should remain empty around the content margin: 0.1, // Bounds for smallest/largest possible scale to apply to content minScale: 0.2, maxScale: 1.5, // Display controls in the bottom right corner controls: true, // Display a presentation progress bar progress: true, // Display the page number of the current slide slideNumber: false, // Push each slide change to the browser history history: false, // Enable keyboard shortcuts for navigation keyboard: true, // Optional function that blocks keyboard events when retuning false keyboardCondition: null, // Enable the slide overview mode overview: true, // Vertical centering of slides center: true, // Enables touch navigation on devices with touch input touch: true, // Loop the presentation loop: false, // Change the presentation direction to be RTL rtl: false, // Randomizes the order of slides each time the presentation loads shuffle: false, // Turns fragments on and off globally fragments: true, // Flags if the presentation is running in an embedded mode, // i.e. contained within a limited portion of the screen embedded: false, // Flags if we should show a help overlay when the questionmark // key is pressed help: true, // Flags if it should be possible to pause the presentation (blackout) pause: true, // Flags if speaker notes should be visible to all viewers showNotes: false, // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0, this value can be overwritten // by using a data-autoslide attribute on your slides autoSlide: 0, // Stop auto-sliding after user input autoSlideStoppable: true, // Use this method for navigation when auto-sliding (defaults to navigateNext) autoSlideMethod: null, // Enable slide navigation via mouse wheel mouseWheel: false, // Apply a 3D roll to links on hover rollingLinks: false, // Hides the address bar on mobile devices hideAddressBar: true, // Opens links in an iframe preview overlay previewLinks: false, // Exposes the reveal.js API through window.postMessage postMessage: true, // Dispatches all reveal.js events to the parent window through postMessage postMessageEvents: false, // Focuses body when page changes visiblity to ensure keyboard shortcuts work <API key>: true, // Transition style transition: 'fade', // none/fade/slide/convex/concave/zoom // Transition speed transitionSpeed: 'default', // default/fast/slow // Transition style for full page slide backgrounds <API key>: 'fade', // none/fade/slide/convex/concave/zoom // Parallax background image <API key>: '', // CSS syntax, e.g. "a.jpg" // Parallax background size <API key>: '', // CSS syntax, e.g. "3000px 2000px" // Amount of pixels to move the parallax background per slide step <API key>: null, <API key>: null, // Number of slides away from the current that are visible viewDistance: 3, // Script dependencies to load dependencies: [] }, // Flags if reveal.js is loaded (has dispatched the 'ready' event) loaded = false, // Flags if the overview mode is currently active overview = false, // Holds the dimensions of our overview slides, including margins overviewSlideWidth = null, overviewSlideHeight = null, // The horizontal and vertical index of the currently active slide indexh, indexv, // The previous and current slide HTML elements previousSlide, currentSlide, previousBackground, // Slides may hold a data-state attribute which we pick up and apply // as a class to the body. This list contains the combined state of // all current slides. state = [], // The current scale of the presentation (see width/height config) scale = 1, // CSS transform that is currently applied to the slides container, // split into two groups slidesTransform = { layout: '', overview: '' }, // Cached references to DOM elements dom = {}, // Features supported by the browser, see #checkCapabilities() features = {}, // Client is a mobile device, see #checkCapabilities() isMobileDevice, // Client is a desktop Chrome, see #checkCapabilities() isChrome, // Throttles mouse wheel navigation lastMouseWheelStep = 0, // Delays updates to the URL due to a Chrome thumbnailer bug writeURLTimeout = 0, // Flags if the interaction event listeners are bound eventsAreBound = false, // The current auto-slide duration autoSlide = 0, // Auto slide properties autoSlidePlayer, autoSlideTimeout = 0, autoSlideStartTime = -1, autoSlidePaused = false, // Holds information about the currently ongoing touch input touch = { startX: 0, startY: 0, startSpan: 0, startCount: 0, captured: false, threshold: 40 }, // Holds information about the keyboard shortcuts keyboardShortcuts = { 'N , SPACE': 'Next slide', 'P': 'Previous slide', '&#8592; , H': 'Navigate left', '&#8594; , L': 'Navigate right', '&#8593; , K': 'Navigate up', '&#8595; , J': 'Navigate down', 'Home': 'First slide', 'End': 'Last slide', 'B , .': 'Pause', 'F': 'Fullscreen', 'ESC, O': 'Slide overview' }; /** * Starts up the presentation if the client is capable. */ function initialize( options ) { checkCapabilities(); if( !features.transforms2d && !features.transforms3d ) { document.body.setAttribute( 'class', 'no-transforms' ); // Since JS won't be running any further, we load all lazy // loading elements upfront var images = toArray( document.<API key>( 'img' ) ), iframes = toArray( document.<API key>( 'iframe' ) ); var lazyLoadable = images.concat( iframes ); for( var i = 0, len = lazyLoadable.length; i < len; i++ ) { var element = lazyLoadable[i]; if( element.getAttribute( 'data-src' ) ) { element.setAttribute( 'src', element.getAttribute( 'data-src' ) ); element.removeAttribute( 'data-src' ); } } // If the browser doesn't support core features we won't be // using JavaScript to control the presentation return; } // Cache references to key DOM elements dom.wrapper = document.querySelector( '.reveal' ); dom.slides = document.querySelector( '.reveal .slides' ); // Force a layout when the whole page, incl fonts, has loaded window.addEventListener( 'load', layout, false ); var query = Reveal.getQueryHash(); // Do not accept new dependencies via query config to avoid // the potential of malicious script injection if( typeof query['dependencies'] !== 'undefined' ) delete query['dependencies']; // Copy options over to our config object extend( config, options ); extend( config, query ); // Hide the address bar in mobile browsers hideAddressBar(); // Loads the dependencies and continues to #start() once done load(); } /** * Inspect the client to see what it's capable of, this * should only happens once per runtime. */ function checkCapabilities() { isMobileDevice = /(iphone|ipod|ipad|android)/gi.test( UA ); isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA ); var testElement = document.createElement( 'div' ); features.transforms3d = 'WebkitPerspective' in testElement.style || 'MozPerspective' in testElement.style || 'msPerspective' in testElement.style || 'OPerspective' in testElement.style || 'perspective' in testElement.style; features.transforms2d = 'WebkitTransform' in testElement.style || 'MozTransform' in testElement.style || 'msTransform' in testElement.style || 'OTransform' in testElement.style || 'transform' in testElement.style; features.<API key> = window.<API key> || window.<API key> || window.<API key>; features.<API key> = typeof features.<API key> === 'function'; features.canvas = !!document.createElement( 'canvas' ).getContext; // Transitions in the overview are disabled in desktop and // Safari due to lag features.overviewTransitions = !/Version\/[\d\.]+.*Safari/.test( UA ); // Flags if we should use zoom instead of transform to scale // up slides. Zoom produces crisper results but has a lot of // xbrowser quirks so we only use it in whitelsited browsers. features.zoom = 'zoom' in testElement.style && !isMobileDevice && ( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) ); } /** * Loads the dependencies of reveal.js. Dependencies are * defined via the configuration option 'dependencies' * and will be loaded prior to starting/binding reveal.js. * Some dependencies may have an 'async' flag, if so they * will load after reveal.js has been started up. */ function load() { var scripts = [], scriptsAsync = [], scriptsToPreload = 0; // Called once synchronous scripts finish loading function proceed() { if( scriptsAsync.length ) { // Load asynchronous scripts head.js.apply( null, scriptsAsync ); } start(); } function loadScript( s ) { head.ready( s.src.match( /([\w\d_\-]*)\.?js$|[^\\\/]*$/i )[0], function() { // Extension may contain callback functions if( typeof s.callback === 'function' ) { s.callback.apply( this ); } if( --scriptsToPreload === 0 ) { proceed(); } }); } for( var i = 0, len = config.dependencies.length; i < len; i++ ) { var s = config.dependencies[i]; // Load if there's no condition or the condition is truthy if( !s.condition || s.condition() ) { if( s.async ) { scriptsAsync.push( s.src ); } else { scripts.push( s.src ); } loadScript( s ); } } if( scripts.length ) { scriptsToPreload = scripts.length; // Load synchronous scripts head.js.apply( null, scripts ); } else { proceed(); } } /** * Starts up reveal.js by binding input events and navigating * to the current URL deeplink if there is one. */ function start() { // Make sure we've got all the DOM elements we need setupDOM(); // Listen to messages posted to this window setupPostMessage(); // Prevent the slides from being scrolled out of view <API key>(); // Resets all vertical slides so that only the first is visible resetVerticalSlides(); // Updates the presentation to match the current configuration values configure(); // Read the initial hash readURL(); // Update all backgrounds updateBackground( true ); // Notify listeners that the presentation is ready but use a 1ms // timeout to ensure it's not fired synchronously after #initialize() setTimeout( function() { // Enable transitions now that we're loaded dom.slides.classList.remove( 'no-transition' ); loaded = true; dispatchEvent( 'ready', { 'indexh': indexh, 'indexv': indexv, 'currentSlide': currentSlide } ); }, 1 ); // Special setup and config is required when printing to PDF if( isPrintingPDF() ) { <API key>(); // The document needs to have loaded for the PDF layout // measurements to be accurate if( document.readyState === 'complete' ) { setupPDF(); } else { window.addEventListener( 'load', setupPDF ); } } } /** * Finds and stores references to DOM elements which are * required by the presentation. If a required element is * not found, it is created. */ function setupDOM() { // Prevent transitions while we're loading dom.slides.classList.add( 'no-transition' ); // Background element dom.background = createSingletonNode( dom.wrapper, 'div', 'backgrounds', null ); // Progress bar dom.progress = createSingletonNode( dom.wrapper, 'div', 'progress', '<span></span>' ); dom.progressbar = dom.progress.querySelector( 'span' ); // Arrow controls createSingletonNode( dom.wrapper, 'aside', 'controls', '<button class="navigate-left" aria-label="previous slide"></button>' + '<button class="navigate-right" aria-label="next slide"></button>' + '<button class="navigate-up" aria-label="above slide"></button>' + '<button class="navigate-down" aria-label="below slide"></button>' ); // Slide number dom.slideNumber = createSingletonNode( dom.wrapper, 'div', 'slide-number', '' ); // Element containing notes that are visible to the audience dom.speakerNotes = createSingletonNode( dom.wrapper, 'div', 'speaker-notes', null ); dom.speakerNotes.setAttribute( 'data-prevent-swipe', '' ); // Overlay graphic which is displayed during the paused mode createSingletonNode( dom.wrapper, 'div', 'pause-overlay', null ); // Cache references to elements dom.controls = document.querySelector( '.reveal .controls' ); dom.theme = document.querySelector( '#theme' ); dom.wrapper.setAttribute( 'role', 'application' ); // There can be multiple instances of controls throughout the page dom.controlsLeft = toArray( document.querySelectorAll( '.navigate-left' ) ); dom.controlsRight = toArray( document.querySelectorAll( '.navigate-right' ) ); dom.controlsUp = toArray( document.querySelectorAll( '.navigate-up' ) ); dom.controlsDown = toArray( document.querySelectorAll( '.navigate-down' ) ); dom.controlsPrev = toArray( document.querySelectorAll( '.navigate-prev' ) ); dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) ); dom.statusDiv = createStatusDiv(); } /** * Creates a hidden div with role aria-live to announce the * current slide content. Hide the div off-screen to make it * available only to Assistive Technologies. */ function createStatusDiv() { var statusDiv = document.getElementById( 'aria-status-div' ); if( !statusDiv ) { statusDiv = document.createElement( 'div' ); statusDiv.style.position = 'absolute'; statusDiv.style.height = '1px'; statusDiv.style.width = '1px'; statusDiv.style.overflow ='hidden'; statusDiv.style.clip = 'rect( 1px, 1px, 1px, 1px )'; statusDiv.setAttribute( 'id', 'aria-status-div' ); statusDiv.setAttribute( 'aria-live', 'polite' ); statusDiv.setAttribute( 'aria-atomic','true' ); dom.wrapper.appendChild( statusDiv ); } return statusDiv; } /** * Configures the presentation for printing to a static * PDF. */ function setupPDF() { var slideSize = <API key>( window.innerWidth, window.innerHeight ); // Dimensions of the PDF pages var pageWidth = Math.floor( slideSize.width * ( 1 + config.margin ) ), pageHeight = Math.floor( slideSize.height * ( 1 + config.margin ) ); // Dimensions of slides within the pages var slideWidth = slideSize.width, slideHeight = slideSize.height; // Let the browser know what page size we want to print injectStyleSheet( '@page{size:'+ pageWidth +'px '+ pageHeight +'px; margin: 0;}' ); // Limit the size of certain elements to the dimensions of the slide injectStyleSheet( '.reveal section>img, .reveal section>video, .reveal section>iframe{max-width: '+ slideWidth +'px; max-height:'+ slideHeight +'px}' ); document.body.classList.add( 'print-pdf' ); document.body.style.width = pageWidth + 'px'; document.body.style.height = pageHeight + 'px'; // Add each slide's index as attributes on itself, we need these // indices to generate slide numbers below toArray( dom.wrapper.querySelectorAll( <API key> ) ).forEach( function( hslide, h ) { hslide.setAttribute( 'data-index-h', h ); if( hslide.classList.contains( 'stack' ) ) { toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { vslide.setAttribute( 'data-index-h', h ); vslide.setAttribute( 'data-index-v', v ); } ); } } ); // Slide and slide background layout toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { // Vertical stacks are not centred since their section // children will be if( slide.classList.contains( 'stack' ) === false ) { // Center the slide inside of the page, giving the slide some margin var left = ( pageWidth - slideWidth ) / 2, top = ( pageHeight - slideHeight ) / 2; var contentHeight = getAbsoluteHeight( slide ); var numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 ); // Center slides vertically if( numberOfPages === 1 && config.center || slide.classList.contains( 'center' ) ) { top = Math.max( ( pageHeight - contentHeight ) / 2, 0 ); } // Position the slide inside of the page slide.style.left = left + 'px'; slide.style.top = top + 'px'; slide.style.width = slideWidth + 'px'; // TODO Backgrounds need to be multiplied when the slide // stretches over multiple pages var background = slide.querySelector( '.slide-background' ); if( background ) { background.style.width = pageWidth + 'px'; background.style.height = ( pageHeight * numberOfPages ) + 'px'; background.style.top = -top + 'px'; background.style.left = -left + 'px'; } // Inject notes if `showNotes` is enabled if( config.showNotes ) { var notes = getSlideNotes( slide ); if( notes ) { var notesSpacing = 8; var notesElement = document.createElement( 'div' ); notesElement.classList.add( 'speaker-notes' ); notesElement.classList.add( 'speaker-notes-pdf' ); notesElement.innerHTML = notes; notesElement.style.left = ( notesSpacing - left ) + 'px'; notesElement.style.bottom = ( notesSpacing - top ) + 'px'; notesElement.style.width = ( pageWidth - notesSpacing*2 ) + 'px'; slide.appendChild( notesElement ); } } // Inject slide numbers if `slideNumbers` are enabled if( config.slideNumber ) { var slideNumberH = parseInt( slide.getAttribute( 'data-index-h' ), 10 ) + 1, slideNumberV = parseInt( slide.getAttribute( 'data-index-v' ), 10 ) + 1; var numberElement = document.createElement( 'div' ); numberElement.classList.add( 'slide-number' ); numberElement.classList.add( 'slide-number-pdf' ); numberElement.innerHTML = formatSlideNumber( slideNumberH, '.', slideNumberV ); background.appendChild( numberElement ); } } } ); // Show all fragments toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' .fragment' ) ).forEach( function( fragment ) { fragment.classList.add( 'visible' ); } ); } function <API key>() { setInterval( function() { if( dom.wrapper.scrollTop !== 0 || dom.wrapper.scrollLeft !== 0 ) { dom.wrapper.scrollTop = 0; dom.wrapper.scrollLeft = 0; } }, 1000 ); } /** * Creates an HTML element and returns a reference to it. * If the element already exists the existing instance will * be returned. */ function createSingletonNode( container, tagname, classname, innerHTML ) { // Find all nodes matching the description var nodes = container.querySelectorAll( '.' + classname ); // Check all matches to find one which is a direct child of // the specified container for( var i = 0; i < nodes.length; i++ ) { var testNode = nodes[i]; if( testNode.parentNode === container ) { return testNode; } } // If no node was found, create it now var node = document.createElement( tagname ); node.classList.add( classname ); if( typeof innerHTML === 'string' ) { node.innerHTML = innerHTML; } container.appendChild( node ); return node; } /** * Creates the slide background elements and appends them * to the background container. One element is created per * slide no matter if the given slide has visible background. */ function createBackgrounds() { var printMode = isPrintingPDF(); // Clear prior backgrounds dom.background.innerHTML = ''; dom.background.classList.add( 'no-transition' ); // Iterate over all horizontal slides toArray( dom.wrapper.querySelectorAll( <API key> ) ).forEach( function( slideh ) { var backgroundStack; if( printMode ) { backgroundStack = createBackground( slideh, slideh ); } else { backgroundStack = createBackground( slideh, dom.background ); } // Iterate over all vertical slides toArray( slideh.querySelectorAll( 'section' ) ).forEach( function( slidev ) { if( printMode ) { createBackground( slidev, slidev ); } else { createBackground( slidev, backgroundStack ); } backgroundStack.classList.add( 'stack' ); } ); } ); // Add parallax background if specified if( config.<API key> ) { dom.background.style.backgroundImage = 'url("' + config.<API key> + '")'; dom.background.style.backgroundSize = config.<API key>; // Make sure the below properties are set on the element - these properties are // needed for proper transitions to be set on the element via CSS. To remove // annoying background slide-in effect when the presentation starts, apply // these properties after short time delay setTimeout( function() { dom.wrapper.classList.add( '<API key>' ); }, 1 ); } else { dom.background.style.backgroundImage = ''; dom.wrapper.classList.remove( '<API key>' ); } } /** * Creates a background for the given slide. * * @param {HTMLElement} slide * @param {HTMLElement} container The element that the background * should be appended to */ function createBackground( slide, container ) { var data = { background: slide.getAttribute( 'data-background' ), backgroundSize: slide.getAttribute( '<API key>' ), backgroundImage: slide.getAttribute( '<API key>' ), backgroundVideo: slide.getAttribute( '<API key>' ), backgroundIframe: slide.getAttribute( '<API key>' ), backgroundColor: slide.getAttribute( '<API key>' ), backgroundRepeat: slide.getAttribute( '<API key>' ), backgroundPosition: slide.getAttribute( '<API key>' ), <API key>: slide.getAttribute( '<API key>' ) }; var element = document.createElement( 'div' ); // Carry over custom classes from the slide to the background element.className = 'slide-background ' + slide.className.replace( /present|past|future/, '' ); if( data.background ) { // Auto-wrap image urls in url(...) if( /^(http|file|\/\/)/gi.test( data.background ) || /\.(svg|png|jpg|jpeg|gif|bmp)$/gi.test( data.background ) ) { slide.setAttribute( '<API key>', data.background ); } else { element.style.background = data.background; } } // Create a hash for this combination of background settings. // This is used to determine when two slide backgrounds are // the same. if( data.background || data.backgroundColor || data.backgroundImage || data.backgroundVideo || data.backgroundIframe ) { element.setAttribute( '<API key>', data.background + data.backgroundSize + data.backgroundImage + data.backgroundVideo + data.backgroundIframe + data.backgroundColor + data.backgroundRepeat + data.backgroundPosition + data.<API key> ); } // Additional and optional background properties if( data.backgroundSize ) element.style.backgroundSize = data.backgroundSize; if( data.backgroundColor ) element.style.backgroundColor = data.backgroundColor; if( data.backgroundRepeat ) element.style.backgroundRepeat = data.backgroundRepeat; if( data.backgroundPosition ) element.style.backgroundPosition = data.backgroundPosition; if( data.<API key> ) element.setAttribute( '<API key>', data.<API key> ); container.appendChild( element ); // If backgrounds are being recreated, clear old classes slide.classList.remove( 'has-dark-background' ); slide.classList.remove( '<API key>' ); // If this slide has a background color, add a class that // signals if it is light or dark. If the slide has no background // color, no class will be set var <API key> = window.getComputedStyle( element ).backgroundColor; if( <API key> ) { var rgb = colorToRgb( <API key> ); // Ignore fully transparent backgrounds. Some browsers return // rgba(0,0,0,0) when reading the computed background color of // an element with no background if( rgb && rgb.a !== 0 ) { if( colorBrightness( <API key> ) < 128 ) { slide.classList.add( 'has-dark-background' ); } else { slide.classList.add( '<API key>' ); } } } return element; } /** * Registers a listener to postMessage events, this makes it * possible to call all reveal.js API methods from another * window. For example: * * revealWindow.postMessage( JSON.stringify({ * method: 'slide', * args: [ 2 ] * }), '*' ); */ function setupPostMessage() { if( config.postMessage ) { window.addEventListener( 'message', function ( event ) { var data = event.data; // Make sure we're dealing with JSON if( typeof data === 'string' && data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) { data = JSON.parse( data ); // Check if the requested method can be found if( data.method && typeof Reveal[data.method] === 'function' ) { Reveal[data.method].apply( Reveal, data.args ); } } }, false ); } } /** * Applies the configuration settings from the config * object. May be called multiple times. */ function configure( options ) { var numberOfSlides = dom.wrapper.querySelectorAll( SLIDES_SELECTOR ).length; dom.wrapper.classList.remove( config.transition ); // New config options may be passed when this method // is invoked through the API after initialization if( typeof options === 'object' ) extend( config, options ); // Force linear transition based on browser capabilities if( features.transforms3d === false ) config.transition = 'linear'; dom.wrapper.classList.add( config.transition ); dom.wrapper.setAttribute( '<API key>', config.transitionSpeed ); dom.wrapper.setAttribute( '<API key>', config.<API key> ); dom.controls.style.display = config.controls ? 'block' : 'none'; dom.progress.style.display = config.progress ? 'block' : 'none'; dom.slideNumber.style.display = config.slideNumber && !isPrintingPDF() ? 'block' : 'none'; if( config.shuffle ) { shuffle(); } if( config.rtl ) { dom.wrapper.classList.add( 'rtl' ); } else { dom.wrapper.classList.remove( 'rtl' ); } if( config.center ) { dom.wrapper.classList.add( 'center' ); } else { dom.wrapper.classList.remove( 'center' ); } // Exit the paused mode if it was configured off if( config.pause === false ) { resume(); } if( config.showNotes ) { dom.speakerNotes.classList.add( 'visible' ); } else { dom.speakerNotes.classList.remove( 'visible' ); } if( config.mouseWheel ) { document.addEventListener( 'DOMMouseScroll', <API key>, false ); document.addEventListener( 'mousewheel', <API key>, false ); } else { document.removeEventListener( 'DOMMouseScroll', <API key>, false ); document.removeEventListener( 'mousewheel', <API key>, false ); } // Rolling 3D links if( config.rollingLinks ) { enableRollingLinks(); } else { disableRollingLinks(); } // Iframe link previews if( config.previewLinks ) { enablePreviewLinks(); } else { disablePreviewLinks(); enablePreviewLinks( '[data-preview-link]' ); } // Remove existing auto-slide controls if( autoSlidePlayer ) { autoSlidePlayer.destroy(); autoSlidePlayer = null; } // Generate auto-slide controls if needed if( numberOfSlides > 1 && config.autoSlide && config.autoSlideStoppable && features.canvas && features.<API key> ) { autoSlidePlayer = new Playback( dom.wrapper, function() { return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 ); } ); autoSlidePlayer.on( 'click', <API key> ); autoSlidePaused = false; } // When fragments are turned off they should be visible if( config.fragments === false ) { toArray( dom.slides.querySelectorAll( '.fragment' ) ).forEach( function( element ) { element.classList.add( 'visible' ); element.classList.remove( 'current-fragment' ); } ); } sync(); } /** * Binds all event listeners. */ function addEventListeners() { eventsAreBound = true; window.addEventListener( 'hashchange', onWindowHashChange, false ); window.addEventListener( 'resize', onWindowResize, false ); if( config.touch ) { dom.wrapper.addEventListener( 'touchstart', onTouchStart, false ); dom.wrapper.addEventListener( 'touchmove', onTouchMove, false ); dom.wrapper.addEventListener( 'touchend', onTouchEnd, false ); // Support pointer-style touch interaction as well if( window.navigator.pointerEnabled ) { // IE 11 uses un-prefixed version of pointer events dom.wrapper.addEventListener( 'pointerdown', onPointerDown, false ); dom.wrapper.addEventListener( 'pointermove', onPointerMove, false ); dom.wrapper.addEventListener( 'pointerup', onPointerUp, false ); } else if( window.navigator.msPointerEnabled ) { // IE 10 uses prefixed version of pointer events dom.wrapper.addEventListener( 'MSPointerDown', onPointerDown, false ); dom.wrapper.addEventListener( 'MSPointerMove', onPointerMove, false ); dom.wrapper.addEventListener( 'MSPointerUp', onPointerUp, false ); } } if( config.keyboard ) { document.addEventListener( 'keydown', onDocumentKeyDown, false ); document.addEventListener( 'keypress', onDocumentKeyPress, false ); } if( config.progress && dom.progress ) { dom.progress.addEventListener( 'click', onProgressClicked, false ); } if( config.<API key> ) { var visibilityChange; if( 'hidden' in document ) { visibilityChange = 'visibilitychange'; } else if( 'msHidden' in document ) { visibilityChange = 'msvisibilitychange'; } else if( 'webkitHidden' in document ) { visibilityChange = '<API key>'; } if( visibilityChange ) { document.addEventListener( visibilityChange, <API key>, false ); } } // Listen to both touch and click events, in case the device // supports both var pointerEvents = [ 'touchstart', 'click' ]; // Only support touch for Android, fixes double navigations in // stock browser if( UA.match( /android/gi ) ) { pointerEvents = [ 'touchstart' ]; } pointerEvents.forEach( function( eventName ) { dom.controlsLeft.forEach( function( el ) { el.addEventListener( eventName, <API key>, false ); } ); dom.controlsRight.forEach( function( el ) { el.addEventListener( eventName, <API key>, false ); } ); dom.controlsUp.forEach( function( el ) { el.addEventListener( eventName, onNavigateUpClicked, false ); } ); dom.controlsDown.forEach( function( el ) { el.addEventListener( eventName, <API key>, false ); } ); dom.controlsPrev.forEach( function( el ) { el.addEventListener( eventName, <API key>, false ); } ); dom.controlsNext.forEach( function( el ) { el.addEventListener( eventName, <API key>, false ); } ); } ); } /** * Unbinds all event listeners. */ function <API key>() { eventsAreBound = false; document.removeEventListener( 'keydown', onDocumentKeyDown, false ); document.removeEventListener( 'keypress', onDocumentKeyPress, false ); window.removeEventListener( 'hashchange', onWindowHashChange, false ); window.removeEventListener( 'resize', onWindowResize, false ); dom.wrapper.removeEventListener( 'touchstart', onTouchStart, false ); dom.wrapper.removeEventListener( 'touchmove', onTouchMove, false ); dom.wrapper.removeEventListener( 'touchend', onTouchEnd, false ); // IE11 if( window.navigator.pointerEnabled ) { dom.wrapper.removeEventListener( 'pointerdown', onPointerDown, false ); dom.wrapper.removeEventListener( 'pointermove', onPointerMove, false ); dom.wrapper.removeEventListener( 'pointerup', onPointerUp, false ); } // IE10 else if( window.navigator.msPointerEnabled ) { dom.wrapper.removeEventListener( 'MSPointerDown', onPointerDown, false ); dom.wrapper.removeEventListener( 'MSPointerMove', onPointerMove, false ); dom.wrapper.removeEventListener( 'MSPointerUp', onPointerUp, false ); } if ( config.progress && dom.progress ) { dom.progress.removeEventListener( 'click', onProgressClicked, false ); } [ 'touchstart', 'click' ].forEach( function( eventName ) { dom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, <API key>, false ); } ); dom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, <API key>, false ); } ); dom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } ); dom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, <API key>, false ); } ); dom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, <API key>, false ); } ); dom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, <API key>, false ); } ); } ); } /** * Extend object a with the properties of object b. * If there's a conflict, object b takes precedence. */ function extend( a, b ) { for( var i in b ) { a[ i ] = b[ i ]; } } /** * Converts the target object to an array. */ function toArray( o ) { return Array.prototype.slice.call( o ); } /** * Utility for deserializing a value. */ function deserialize( value ) { if( typeof value === 'string' ) { if( value === 'null' ) return null; else if( value === 'true' ) return true; else if( value === 'false' ) return false; else if( value.match( /^\d+$/ ) ) return parseFloat( value ); } return value; } /** * Measures the distance in pixels between point a * and point b. * * @param {Object} a point with x/y properties * @param {Object} b point with x/y properties */ function distanceBetween( a, b ) { var dx = a.x - b.x, dy = a.y - b.y; return Math.sqrt( dx*dx + dy*dy ); } /** * Applies a CSS transform to the target element. */ function transformElement( element, transform ) { element.style.WebkitTransform = transform; element.style.MozTransform = transform; element.style.msTransform = transform; element.style.transform = transform; } /** * Applies CSS transforms to the slides container. The container * is transformed from two separate sources: layout and the overview * mode. */ function transformSlides( transforms ) { // Pick up new transforms from arguments if( typeof transforms.layout === 'string' ) slidesTransform.layout = transforms.layout; if( typeof transforms.overview === 'string' ) slidesTransform.overview = transforms.overview; // Apply the transforms to the slides container if( slidesTransform.layout ) { transformElement( dom.slides, slidesTransform.layout + ' ' + slidesTransform.overview ); } else { transformElement( dom.slides, slidesTransform.overview ); } } /** * Injects the given CSS styles into the DOM. */ function injectStyleSheet( value ) { var tag = document.createElement( 'style' ); tag.type = 'text/css'; if( tag.styleSheet ) { tag.styleSheet.cssText = value; } else { tag.appendChild( document.createTextNode( value ) ); } document.<API key>( 'head' )[0].appendChild( tag ); } /** * Converts various color input formats to an {r:0,g:0,b:0} object. * * @param {String} color The string representation of a color, * the following formats are supported: * - #000 * - #000000 * - rgb(0,0,0) */ function colorToRgb( color ) { var hex3 = color.match( /^#([0-9a-f]{3})$/i ); if( hex3 && hex3[1] ) { hex3 = hex3[1]; return { r: parseInt( hex3.charAt( 0 ), 16 ) * 0x11, g: parseInt( hex3.charAt( 1 ), 16 ) * 0x11, b: parseInt( hex3.charAt( 2 ), 16 ) * 0x11 }; } var hex6 = color.match( /^#([0-9a-f]{6})$/i ); if( hex6 && hex6[1] ) { hex6 = hex6[1]; return { r: parseInt( hex6.substr( 0, 2 ), 16 ), g: parseInt( hex6.substr( 2, 2 ), 16 ), b: parseInt( hex6.substr( 4, 2 ), 16 ) }; } var rgb = color.match( /^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i ); if( rgb ) { return { r: parseInt( rgb[1], 10 ), g: parseInt( rgb[2], 10 ), b: parseInt( rgb[3], 10 ) }; } var rgba = color.match( /^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\,\s*([\d]+|[\d]*.[\d]+)\s*\)$/i ); if( rgba ) { return { r: parseInt( rgba[1], 10 ), g: parseInt( rgba[2], 10 ), b: parseInt( rgba[3], 10 ), a: parseFloat( rgba[4] ) }; } return null; } /** * Calculates brightness on a scale of 0-255. * * @param color See colorStringToRgb for supported formats. */ function colorBrightness( color ) { if( typeof color === 'string' ) color = colorToRgb( color ); if( color ) { return ( color.r * 299 + color.g * 587 + color.b * 114 ) / 1000; } return null; } /** * Retrieves the height of the given element by looking * at the position and height of its immediate children. */ function getAbsoluteHeight( element ) { var height = 0; if( element ) { var absoluteChildren = 0; toArray( element.childNodes ).forEach( function( child ) { if( typeof child.offsetTop === 'number' && child.style ) { // Count # of abs children if( window.getComputedStyle( child ).position === 'absolute' ) { absoluteChildren += 1; } height = Math.max( height, child.offsetTop + child.offsetHeight ); } } ); // If there are no absolute children, use offsetHeight if( absoluteChildren === 0 ) { height = element.offsetHeight; } } return height; } /** * Returns the remaining height within the parent of the * target element. * * remaining height = [ configured parent height ] - [ current parent height ] */ function getRemainingHeight( element, height ) { height = height || 0; if( element ) { var newHeight, oldHeight = element.style.height; // Change the .stretch element height to 0 in order find the height of all // the other elements element.style.height = '0px'; newHeight = height - element.parentNode.offsetHeight; // Restore the old height, just in case element.style.height = oldHeight + 'px'; return newHeight; } return height; } /** * Checks if this instance is being used to print a PDF. */ function isPrintingPDF() { return ( /print-pdf/gi ).test( window.location.search ); } /** * Hides the address bar if we're on a mobile device. */ function hideAddressBar() { if( config.hideAddressBar && isMobileDevice ) { // Events that should trigger the address bar to hide window.addEventListener( 'load', removeAddressBar, false ); window.addEventListener( 'orientationchange', removeAddressBar, false ); } } /** * Causes the address bar to hide on mobile devices, * more vertical space ftw. */ function removeAddressBar() { setTimeout( function() { window.scrollTo( 0, 1 ); }, 10 ); } /** * Dispatches an event of the specified type from the * reveal DOM element. */ function dispatchEvent( type, args ) { var event = document.createEvent( 'HTMLEvents', 1, 2 ); event.initEvent( type, true, true ); extend( event, args ); dom.wrapper.dispatchEvent( event ); // If we're in an iframe, post each reveal.js event to the // parent window. Used by the notes plugin if( config.postMessageEvents && window.parent !== window.self ) { window.parent.postMessage( JSON.stringify({ namespace: 'reveal', eventName: type, state: getState() }), '*' ); } } /** * Wrap all links in 3D goodness. */ function enableRollingLinks() { if( features.transforms3d && !( 'msPerspective' in document.body.style ) ) { var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a' ); for( var i = 0, len = anchors.length; i < len; i++ ) { var anchor = anchors[i]; if( anchor.textContent && !anchor.querySelector( '*' ) && ( !anchor.className || !anchor.classList.contains( anchor, 'roll' ) ) ) { var span = document.createElement('span'); span.setAttribute('data-title', anchor.text); span.innerHTML = anchor.innerHTML; anchor.classList.add( 'roll' ); anchor.innerHTML = ''; anchor.appendChild(span); } } } } /** * Unwrap all 3D links. */ function disableRollingLinks() { var anchors = dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ' a.roll' ); for( var i = 0, len = anchors.length; i < len; i++ ) { var anchor = anchors[i]; var span = anchor.querySelector( 'span' ); if( span ) { anchor.classList.remove( 'roll' ); anchor.innerHTML = span.innerHTML; } } } /** * Bind preview frame links. */ function enablePreviewLinks( selector ) { var anchors = toArray( document.querySelectorAll( selector ? selector : 'a' ) ); anchors.forEach( function( element ) { if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) { element.addEventListener( 'click', <API key>, false ); } } ); } /** * Unbind preview frame links. */ function disablePreviewLinks() { var anchors = toArray( document.querySelectorAll( 'a' ) ); anchors.forEach( function( element ) { if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) { element.removeEventListener( 'click', <API key>, false ); } } ); } /** * Opens a preview window for the target URL. */ function showPreview( url ) { closeOverlay(); dom.overlay = document.createElement( 'div' ); dom.overlay.classList.add( 'overlay' ); dom.overlay.classList.add( 'overlay-preview' ); dom.wrapper.appendChild( dom.overlay ); dom.overlay.innerHTML = [ '<header>', '<a class="close" href="#"><span class="icon"></span></a>', '<a class="external" href="'+ url +'" target="_blank"><span class="icon"></span></a>', '</header>', '<div class="spinner"></div>', '<div class="viewport">', '<iframe src="'+ url +'"></iframe>', '</div>' ].join(''); dom.overlay.querySelector( 'iframe' ).addEventListener( 'load', function( event ) { dom.overlay.classList.add( 'loaded' ); }, false ); dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) { closeOverlay(); event.preventDefault(); }, false ); dom.overlay.querySelector( '.external' ).addEventListener( 'click', function( event ) { closeOverlay(); }, false ); setTimeout( function() { dom.overlay.classList.add( 'visible' ); }, 1 ); } /** * Opens a overlay window with help material. */ function showHelp() { if( config.help ) { closeOverlay(); dom.overlay = document.createElement( 'div' ); dom.overlay.classList.add( 'overlay' ); dom.overlay.classList.add( 'overlay-help' ); dom.wrapper.appendChild( dom.overlay ); var html = '<p class="title">Keyboard Shortcuts</p><br/>'; html += '<table><th>KEY</th><th>ACTION</th>'; for( var key in keyboardShortcuts ) { html += '<tr><td>' + key + '</td><td>' + keyboardShortcuts[ key ] + '</td></tr>'; } html += '</table>'; dom.overlay.innerHTML = [ '<header>', '<a class="close" href="#"><span class="icon"></span></a>', '</header>', '<div class="viewport">', '<div class="viewport-inner">'+ html +'</div>', '</div>' ].join(''); dom.overlay.querySelector( '.close' ).addEventListener( 'click', function( event ) { closeOverlay(); event.preventDefault(); }, false ); setTimeout( function() { dom.overlay.classList.add( 'visible' ); }, 1 ); } } /** * Closes any currently open overlay. */ function closeOverlay() { if( dom.overlay ) { dom.overlay.parentNode.removeChild( dom.overlay ); dom.overlay = null; } } /** * Applies <API key> layout rules to the * presentation. */ function layout() { if( dom.wrapper && !isPrintingPDF() ) { var size = <API key>(); var slidePadding = 20; // TODO Dig this out of DOM // Layout the contents of the slides layoutSlideContents( config.width, config.height, slidePadding ); dom.slides.style.width = size.width + 'px'; dom.slides.style.height = size.height + 'px'; // Determine scale of content to fit within available space scale = Math.min( size.presentationWidth / size.width, size.presentationHeight / size.height ); // Respect max/min scale settings scale = Math.max( scale, config.minScale ); scale = Math.min( scale, config.maxScale ); // Don't apply any scaling styles if scale is 1 if( scale === 1 ) { dom.slides.style.zoom = ''; dom.slides.style.left = ''; dom.slides.style.top = ''; dom.slides.style.bottom = ''; dom.slides.style.right = ''; transformSlides( { layout: '' } ); } else { // Prefer zoom for scaling up so that content remains crisp. // Don't use zoom to scale down since that can lead to shifts // in text layout/line breaks. if( scale > 1 && features.zoom ) { dom.slides.style.zoom = scale; dom.slides.style.left = ''; dom.slides.style.top = ''; dom.slides.style.bottom = ''; dom.slides.style.right = ''; transformSlides( { layout: '' } ); } // Apply scale transform as a fallback else { dom.slides.style.zoom = ''; dom.slides.style.left = '50%'; dom.slides.style.top = '50%'; dom.slides.style.bottom = 'auto'; dom.slides.style.right = 'auto'; transformSlides( { layout: 'translate(-50%, -50%) scale('+ scale +')' } ); } } // Select all slides, vertical and horizontal var slides = toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ); for( var i = 0, len = slides.length; i < len; i++ ) { var slide = slides[ i ]; // Don't bother updating invisible slides if( slide.style.display === 'none' ) { continue; } if( config.center || slide.classList.contains( 'center' ) ) { // Vertical stacks are not centred since their section // children will be if( slide.classList.contains( 'stack' ) ) { slide.style.top = 0; } else { slide.style.top = Math.max( ( ( size.height - getAbsoluteHeight( slide ) ) / 2 ) - slidePadding, 0 ) + 'px'; } } else { slide.style.top = ''; } } updateProgress(); updateParallax(); } } /** * Applies layout logic to the contents of all slides in * the presentation. */ function layoutSlideContents( width, height, padding ) { // Handle sizing of elements with the 'stretch' class toArray( dom.slides.querySelectorAll( 'section > .stretch' ) ).forEach( function( element ) { // Determine how much vertical space we can use var remainingHeight = getRemainingHeight( element, height ); // Consider the aspect ratio of media elements if( /(img|video)/gi.test( element.nodeName ) ) { var nw = element.naturalWidth || element.videoWidth, nh = element.naturalHeight || element.videoHeight; var es = Math.min( width / nw, remainingHeight / nh ); element.style.width = ( nw * es ) + 'px'; element.style.height = ( nh * es ) + 'px'; } else { element.style.width = width + 'px'; element.style.height = remainingHeight + 'px'; } } ); } /** * Calculates the computed pixel size of our slides. These * values are based on the width and height configuration * options. */ function <API key>( presentationWidth, presentationHeight ) { var size = { // Slide size width: config.width, height: config.height, // Presentation size presentationWidth: presentationWidth || dom.wrapper.offsetWidth, presentationHeight: presentationHeight || dom.wrapper.offsetHeight }; // Reduce available space by margin size.presentationWidth -= ( size.presentationWidth * config.margin ); size.presentationHeight -= ( size.presentationHeight * config.margin ); // Slide width may be a percentage of available width if( typeof size.width === 'string' && /%$/.test( size.width ) ) { size.width = parseInt( size.width, 10 ) / 100 * size.presentationWidth; } // Slide height may be a percentage of available height if( typeof size.height === 'string' && /%$/.test( size.height ) ) { size.height = parseInt( size.height, 10 ) / 100 * size.presentationHeight; } return size; } /** * Stores the vertical index of a stack so that the same * vertical slide can be selected when navigating to and * from the stack. * * @param {HTMLElement} stack The vertical stack element * @param {int} v Index to memorize */ function <API key>( stack, v ) { if( typeof stack === 'object' && typeof stack.setAttribute === 'function' ) { stack.setAttribute( '<API key>', v || 0 ); } } /** * Retrieves the vertical index which was stored using * #<API key>() or 0 if no previous index * exists. * * @param {HTMLElement} stack The vertical stack element */ function <API key>( stack ) { if( typeof stack === 'object' && typeof stack.setAttribute === 'function' && stack.classList.contains( 'stack' ) ) { // Prefer manually defined start-indexv var attributeName = stack.hasAttribute( 'data-start-indexv' ) ? 'data-start-indexv' : '<API key>'; return parseInt( stack.getAttribute( attributeName ) || 0, 10 ); } return 0; } /** * Displays the overview of slides (quick nav) by scaling * down and arranging all slide elements. */ function activateOverview() { // Only proceed if enabled in config if( config.overview && !isOverview() ) { overview = true; dom.wrapper.classList.add( 'overview' ); dom.wrapper.classList.remove( '<API key>' ); if( features.overviewTransitions ) { setTimeout( function() { dom.wrapper.classList.add( 'overview-animated' ); }, 1 ); } // Don't auto-slide while in overview mode cancelAutoSlide(); // Move the backgrounds element into the slide container to // that the same scaling is applied dom.slides.appendChild( dom.background ); // Clicking on an overview slide navigates to it toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { if( !slide.classList.contains( 'stack' ) ) { slide.addEventListener( 'click', <API key>, true ); } } ); // Calculate slide sizes var margin = 70; var slideSize = <API key>(); overviewSlideWidth = slideSize.width + margin; overviewSlideHeight = slideSize.height + margin; // Reverse in RTL mode if( config.rtl ) { overviewSlideWidth = -overviewSlideWidth; } <API key>(); layoutOverview(); updateOverview(); layout(); // Notify observers of the overview showing dispatchEvent( 'overviewshown', { 'indexh': indexh, 'indexv': indexv, 'currentSlide': currentSlide } ); } } /** * Uses CSS transforms to position all slides in a grid for * display inside of the overview mode. */ function layoutOverview() { // Layout slides toArray( dom.wrapper.querySelectorAll( <API key> ) ).forEach( function( hslide, h ) { hslide.setAttribute( 'data-index-h', h ); transformElement( hslide, 'translate3d(' + ( h * overviewSlideWidth ) + 'px, 0, 0)' ); if( hslide.classList.contains( 'stack' ) ) { toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { vslide.setAttribute( 'data-index-h', h ); vslide.setAttribute( 'data-index-v', v ); transformElement( vslide, 'translate3d(0, ' + ( v * overviewSlideHeight ) + 'px, 0)' ); } ); } } ); // Layout slide backgrounds toArray( dom.background.childNodes ).forEach( function( hbackground, h ) { transformElement( hbackground, 'translate3d(' + ( h * overviewSlideWidth ) + 'px, 0, 0)' ); toArray( hbackground.querySelectorAll( '.slide-background' ) ).forEach( function( vbackground, v ) { transformElement( vbackground, 'translate3d(0, ' + ( v * overviewSlideHeight ) + 'px, 0)' ); } ); } ); } /** * Moves the overview viewport to the current slides. * Called each time the current slide changes. */ function updateOverview() { transformSlides( { overview: [ 'translateX('+ ( -indexh * overviewSlideWidth ) +'px)', 'translateY('+ ( -indexv * overviewSlideHeight ) +'px)', 'translateZ('+ ( window.innerWidth < 400 ? -1000 : -2500 ) +'px)' ].join( ' ' ) } ); } /** * Exits the slide overview and enters the currently * active slide. */ function deactivateOverview() { // Only proceed if enabled in config if( config.overview ) { overview = false; dom.wrapper.classList.remove( 'overview' ); dom.wrapper.classList.remove( 'overview-animated' ); // Temporarily add a class so that transitions can do different things // depending on whether they are exiting/entering overview, or just // moving from slide to slide dom.wrapper.classList.add( '<API key>' ); setTimeout( function () { dom.wrapper.classList.remove( '<API key>' ); }, 1 ); // Move the background element back out dom.wrapper.appendChild( dom.background ); // Clean up changes made to slides toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { transformElement( slide, '' ); slide.removeEventListener( 'click', <API key>, true ); } ); // Clean up changes made to backgrounds toArray( dom.background.querySelectorAll( '.slide-background' ) ).forEach( function( background ) { transformElement( background, '' ); } ); transformSlides( { overview: '' } ); slide( indexh, indexv ); layout(); cueAutoSlide(); // Notify observers of the overview hiding dispatchEvent( 'overviewhidden', { 'indexh': indexh, 'indexv': indexv, 'currentSlide': currentSlide } ); } } /** * Toggles the slide overview mode on and off. * * @param {Boolean} override Optional flag which overrides the * toggle logic and forcibly sets the desired state. True means * overview is open, false means it's closed. */ function toggleOverview( override ) { if( typeof override === 'boolean' ) { override ? activateOverview() : deactivateOverview(); } else { isOverview() ? deactivateOverview() : activateOverview(); } } /** * Checks if the overview is currently active. * * @return {Boolean} true if the overview is active, * false otherwise */ function isOverview() { return overview; } /** * Checks if the current or specified slide is vertical * (nested within another slide). * * @param {HTMLElement} slide [optional] The slide to check * orientation of */ function isVerticalSlide( slide ) { // Prefer slide argument, otherwise use current slide slide = slide ? slide : currentSlide; return slide && slide.parentNode && !!slide.parentNode.nodeName.match( /section/i ); } function enterFullscreen() { var element = document.body; // Check which implementation is available var requestMethod = element.requestFullScreen || element.<API key> || element.<API key> || element.<API key> || element.msRequestFullscreen; if( requestMethod ) { requestMethod.apply( element ); } } /** * Enters the paused mode which fades everything on screen to * black. */ function pause() { if( config.pause ) { var wasPaused = dom.wrapper.classList.contains( 'paused' ); cancelAutoSlide(); dom.wrapper.classList.add( 'paused' ); if( wasPaused === false ) { dispatchEvent( 'paused' ); } } } /** * Exits from the paused mode. */ function resume() { var wasPaused = dom.wrapper.classList.contains( 'paused' ); dom.wrapper.classList.remove( 'paused' ); cueAutoSlide(); if( wasPaused ) { dispatchEvent( 'resumed' ); } } /** * Toggles the paused mode on and off. */ function togglePause( override ) { if( typeof override === 'boolean' ) { override ? pause() : resume(); } else { isPaused() ? resume() : pause(); } } /** * Checks if we are currently in the paused mode. */ function isPaused() { return dom.wrapper.classList.contains( 'paused' ); } /** * Toggles the auto slide mode on and off. * * @param {Boolean} override Optional flag which sets the desired state. * True means autoplay starts, false means it stops. */ function toggleAutoSlide( override ) { if( typeof override === 'boolean' ) { override ? resumeAutoSlide() : pauseAutoSlide(); } else { autoSlidePaused ? resumeAutoSlide() : pauseAutoSlide(); } } /** * Checks if the auto slide mode is currently on. */ function isAutoSliding() { return !!( autoSlide && !autoSlidePaused ); } /** * Steps from the current point in the presentation to the * slide which matches the specified horizontal and vertical * indices. * * @param {int} h Horizontal index of the target slide * @param {int} v Vertical index of the target slide * @param {int} f Optional index of a fragment within the * target slide to activate * @param {int} o Optional origin for use in multimaster environments */ function slide( h, v, f, o ) { // Remember where we were at before previousSlide = currentSlide; // Query all horizontal slides in the deck var horizontalSlides = dom.wrapper.querySelectorAll( <API key> ); // If no vertical index is specified and the upcoming slide is a // stack, resume at its previous vertical index if( v === undefined && !isOverview() ) { v = <API key>( horizontalSlides[ h ] ); } // If we were on a vertical stack, remember what vertical index // it was on so we can resume at the same position when returning if( previousSlide && previousSlide.parentNode && previousSlide.parentNode.classList.contains( 'stack' ) ) { <API key>( previousSlide.parentNode, indexv ); } // Remember the state before this slide var stateBefore = state.concat(); // Reset the state array state.length = 0; var indexhBefore = indexh || 0, indexvBefore = indexv || 0; // Activate and transition to the new slide indexh = updateSlides( <API key>, h === undefined ? indexh : h ); indexv = updateSlides( <API key>, v === undefined ? indexv : v ); // Update the visibility of slides now that the indices have changed <API key>(); layout(); // Apply the new state stateLoop: for( var i = 0, len = state.length; i < len; i++ ) { // Check if this state existed on the previous slide. If it // did, we will avoid adding it repeatedly for( var j = 0; j < stateBefore.length; j++ ) { if( stateBefore[j] === state[i] ) { stateBefore.splice( j, 1 ); continue stateLoop; } } document.documentElement.classList.add( state[i] ); // Dispatch custom event matching the state's name dispatchEvent( state[i] ); } // Clean up the remains of the previous state while( stateBefore.length ) { document.documentElement.classList.remove( stateBefore.pop() ); } // Update the overview if it's currently active if( isOverview() ) { updateOverview(); } // Find the current horizontal slide and any possible vertical slides // within it var <API key> = horizontalSlides[ indexh ], <API key> = <API key>.querySelectorAll( 'section' ); // Store references to the previous and current slides currentSlide = <API key>[ indexv ] || <API key>; // Show fragment, if specified if( typeof f !== 'undefined' ) { navigateFragment( f ); } // Dispatch an event if the slide changed var slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore ); if( slideChanged ) { dispatchEvent( 'slidechanged', { 'indexh': indexh, 'indexv': indexv, 'previousSlide': previousSlide, 'currentSlide': currentSlide, 'origin': o } ); } else { // Ensure that the previous slide is never the same as the current previousSlide = null; } // Solves an edge case where the previous slide maintains the // 'present' class when navigating between adjacent vertical // stacks if( previousSlide ) { previousSlide.classList.remove( 'present' ); previousSlide.setAttribute( 'aria-hidden', 'true' ); // Reset all slides upon navigate to home // Issue: #285 if ( dom.wrapper.querySelector( HOME_SLIDE_SELECTOR ).classList.contains( 'present' ) ) { // Launch async task setTimeout( function () { var slides = toArray( dom.wrapper.querySelectorAll( <API key> + '.stack') ), i; for( i in slides ) { if( slides[i] ) { // Reset stack <API key>( slides[i], 0 ); } } }, 0 ); } } // Handle embedded content if( slideChanged || !previousSlide ) { stopEmbeddedContent( previousSlide ); <API key>( currentSlide ); } // Announce the current slide contents, for screen readers dom.statusDiv.textContent = currentSlide.textContent; updateControls(); updateProgress(); updateBackground(); updateParallax(); updateSlideNumber(); updateNotes(); // Update the URL hash writeURL(); cueAutoSlide(); } /** * Syncs the presentation with the current DOM. Useful * when new slides or control elements are added or when * the configuration has changed. */ function sync() { // Subscribe to input <API key>(); addEventListeners(); // Force a layout to make sure the current config is accounted for layout(); // Reflect the current autoSlide value autoSlide = config.autoSlide; // Start auto-sliding if it's enabled cueAutoSlide(); // Re-create the slide backgrounds createBackgrounds(); // Write the current hash to the URL writeURL(); sortAllFragments(); updateControls(); updateProgress(); updateBackground( true ); updateSlideNumber(); <API key>(); updateNotes(); <API key>(); <API key>( currentSlide ); if( isOverview() ) { layoutOverview(); } } /** * Resets all vertical slides so that only the first * is visible. */ function resetVerticalSlides() { var horizontalSlides = toArray( dom.wrapper.querySelectorAll( <API key> ) ); horizontalSlides.forEach( function( horizontalSlide ) { var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); verticalSlides.forEach( function( verticalSlide, y ) { if( y > 0 ) { verticalSlide.classList.remove( 'present' ); verticalSlide.classList.remove( 'past' ); verticalSlide.classList.add( 'future' ); verticalSlide.setAttribute( 'aria-hidden', 'true' ); } } ); } ); } /** * Sorts and formats all of fragments in the * presentation. */ function sortAllFragments() { var horizontalSlides = toArray( dom.wrapper.querySelectorAll( <API key> ) ); horizontalSlides.forEach( function( horizontalSlide ) { var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); verticalSlides.forEach( function( verticalSlide, y ) { sortFragments( verticalSlide.querySelectorAll( '.fragment' ) ); } ); if( verticalSlides.length === 0 ) sortFragments( horizontalSlide.querySelectorAll( '.fragment' ) ); } ); } /** * Randomly shuffles all slides in the deck. */ function shuffle() { var slides = toArray( dom.wrapper.querySelectorAll( <API key> ) ); slides.forEach( function( slide ) { // Insert this slide next to another random slide. This may // cause the slide to insert before itself but that's fine. dom.slides.insertBefore( slide, slides[ Math.floor( Math.random() * slides.length ) ] ); } ); } /** * Updates one dimension of slides by showing the slide * with the specified index. * * @param {String} selector A CSS selector that will fetch * the group of slides we are working with * @param {Number} index The index of the slide that should be * shown * * @return {Number} The index of the slide that is now shown, * might differ from the passed in index if it was out of * bounds. */ function updateSlides( selector, index ) { // Select all slides and convert the NodeList result to // an array var slides = toArray( dom.wrapper.querySelectorAll( selector ) ), slidesLength = slides.length; var printMode = isPrintingPDF(); if( slidesLength ) { // Should the index loop? if( config.loop ) { index %= slidesLength; if( index < 0 ) { index = slidesLength + index; } } // Enforce max and minimum index bounds index = Math.max( Math.min( index, slidesLength - 1 ), 0 ); for( var i = 0; i < slidesLength; i++ ) { var element = slides[i]; var reverse = config.rtl && !isVerticalSlide( element ); element.classList.remove( 'past' ); element.classList.remove( 'present' ); element.classList.remove( 'future' ); // http://www.w3.org/html/wg/drafts/html/master/editing.html#<API key> element.setAttribute( 'hidden', '' ); element.setAttribute( 'aria-hidden', 'true' ); // If this element contains vertical slides if( element.querySelector( 'section' ) ) { element.classList.add( 'stack' ); } // If we're printing static slides, all slides are "present" if( printMode ) { element.classList.add( 'present' ); continue; } if( i < index ) { // Any element previous to index is given the 'past' class element.classList.add( reverse ? 'future' : 'past' ); if( config.fragments ) { var pastFragments = toArray( element.querySelectorAll( '.fragment' ) ); // Show all fragments on prior slides while( pastFragments.length ) { var pastFragment = pastFragments.pop(); pastFragment.classList.add( 'visible' ); pastFragment.classList.remove( 'current-fragment' ); } } } else if( i > index ) { // Any element subsequent to index is given the 'future' class element.classList.add( reverse ? 'past' : 'future' ); if( config.fragments ) { var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) ); // No fragments in future slides should be visible ahead of time while( futureFragments.length ) { var futureFragment = futureFragments.pop(); futureFragment.classList.remove( 'visible' ); futureFragment.classList.remove( 'current-fragment' ); } } } } // Mark the current slide as present slides[index].classList.add( 'present' ); slides[index].removeAttribute( 'hidden' ); slides[index].removeAttribute( 'aria-hidden' ); // If this slide has a state associated with it, add it // onto the current state of the deck var slideState = slides[index].getAttribute( 'data-state' ); if( slideState ) { state = state.concat( slideState.split( ' ' ) ); } } else { // Since there are no slides we can't be anywhere beyond the // zeroth index index = 0; } return index; } /** * Optimization method; hide all slides that are far away * from the present slide. */ function <API key>() { // Select all slides and convert the NodeList result to // an array var horizontalSlides = toArray( dom.wrapper.querySelectorAll( <API key> ) ), <API key> = horizontalSlides.length, distanceX, distanceY; if( <API key> && typeof indexh !== 'undefined' ) { // The number of steps away from the present slide that will // be visible var viewDistance = isOverview() ? 10 : config.viewDistance; // Limit view distance on weaker devices if( isMobileDevice ) { viewDistance = isOverview() ? 6 : 2; } // All slides need to be visible when exporting to PDF if( isPrintingPDF() ) { viewDistance = Number.MAX_VALUE; } for( var x = 0; x < <API key>; x++ ) { var horizontalSlide = horizontalSlides[x]; var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ), <API key> = verticalSlides.length; // Determine how far away this slide is from the present distanceX = Math.abs( ( indexh || 0 ) - x ) || 0; // If the presentation is looped, distance should measure // 1 between the first and last slides if( config.loop ) { distanceX = Math.abs( ( ( indexh || 0 ) - x ) % ( <API key> - viewDistance ) ) || 0; } // Show the horizontal slide if it's within the view distance if( distanceX < viewDistance ) { showSlide( horizontalSlide ); } else { hideSlide( horizontalSlide ); } if( <API key> ) { var oy = <API key>( horizontalSlide ); for( var y = 0; y < <API key>; y++ ) { var verticalSlide = verticalSlides[y]; distanceY = x === ( indexh || 0 ) ? Math.abs( ( indexv || 0 ) - y ) : Math.abs( y - oy ); if( distanceX + distanceY < viewDistance ) { showSlide( verticalSlide ); } else { hideSlide( verticalSlide ); } } } } } } /** * Pick up notes from the current slide and display tham * to the viewer. * * @see `showNotes` config value */ function updateNotes() { if( config.showNotes && dom.speakerNotes && currentSlide && !isPrintingPDF() ) { dom.speakerNotes.innerHTML = getSlideNotes() || ''; } } /** * Updates the progress bar to reflect the current slide. */ function updateProgress() { // Update progress if enabled if( config.progress && dom.progressbar ) { dom.progressbar.style.width = getProgress() * dom.wrapper.offsetWidth + 'px'; } } /** * Updates the slide number div to reflect the current slide. * * The following slide number formats are available: * "h.v": horizontal . vertical slide number (default) * "h/v": horizontal / vertical slide number * "c": flattened slide number * "c/t": flattened slide number / total slides */ function updateSlideNumber() { // Update slide number if enabled if( config.slideNumber && dom.slideNumber ) { var value = []; var format = 'h.v'; // Check if a custom number format is available if( typeof config.slideNumber === 'string' ) { format = config.slideNumber; } switch( format ) { case 'c': value.push( getSlidePastCount() + 1 ); break; case 'c/t': value.push( getSlidePastCount() + 1, '/', getTotalSlides() ); break; case 'h/v': value.push( indexh + 1 ); if( isVerticalSlide() ) value.push( '/', indexv + 1 ); break; default: value.push( indexh + 1 ); if( isVerticalSlide() ) value.push( '.', indexv + 1 ); } dom.slideNumber.innerHTML = formatSlideNumber( value[0], value[1], value[2] ); } } /** * Applies HTML formatting to a slide number before it's * written to the DOM. */ function formatSlideNumber( a, delimiter, b ) { if( typeof b === 'number' && !isNaN( b ) ) { return '<span class="slide-number-a">'+ a +'</span>' + '<span class="<API key>">'+ delimiter +'</span>' + '<span class="slide-number-b">'+ b +'</span>'; } else { return '<span class="slide-number-a">'+ a +'</span>'; } } /** * Updates the state of all control/navigation arrows. */ function updateControls() { var routes = availableRoutes(); var fragments = availableFragments(); // Remove the 'enabled' class from all directions dom.controlsLeft.concat( dom.controlsRight ) .concat( dom.controlsUp ) .concat( dom.controlsDown ) .concat( dom.controlsPrev ) .concat( dom.controlsNext ).forEach( function( node ) { node.classList.remove( 'enabled' ); node.classList.remove( 'fragmented' ); } ); // Add the 'enabled' class to the available routes if( routes.left ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.right ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.up ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.down ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'enabled' ); } ); // Prev/next buttons if( routes.left || routes.up ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.right || routes.down ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'enabled' ); } ); // Highlight fragment directions if( currentSlide ) { // Always apply fragment decorator to prev/next buttons if( fragments.prev ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); if( fragments.next ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); // Apply fragment decorators to directional buttons based on // what slide axis they are in if( isVerticalSlide( currentSlide ) ) { if( fragments.prev ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); if( fragments.next ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); } else { if( fragments.prev ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); if( fragments.next ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } ); } } } /** * Updates the background elements to reflect the current * slide. * * @param {Boolean} includeAll If true, the backgrounds of * all vertical slides (not just the present) will be updated. */ function updateBackground( includeAll ) { var currentBackground = null; // Reverse past/future classes when in RTL mode var horizontalPast = config.rtl ? 'future' : 'past', horizontalFuture = config.rtl ? 'past' : 'future'; // Update the classes of all backgrounds to match the // states of their slides (past/present/future) toArray( dom.background.childNodes ).forEach( function( backgroundh, h ) { backgroundh.classList.remove( 'past' ); backgroundh.classList.remove( 'present' ); backgroundh.classList.remove( 'future' ); if( h < indexh ) { backgroundh.classList.add( horizontalPast ); } else if ( h > indexh ) { backgroundh.classList.add( horizontalFuture ); } else { backgroundh.classList.add( 'present' ); // Store a reference to the current background element currentBackground = backgroundh; } if( includeAll || h === indexh ) { toArray( backgroundh.querySelectorAll( '.slide-background' ) ).forEach( function( backgroundv, v ) { backgroundv.classList.remove( 'past' ); backgroundv.classList.remove( 'present' ); backgroundv.classList.remove( 'future' ); if( v < indexv ) { backgroundv.classList.add( 'past' ); } else if ( v > indexv ) { backgroundv.classList.add( 'future' ); } else { backgroundv.classList.add( 'present' ); // Only if this is the present horizontal and vertical slide if( h === indexh ) currentBackground = backgroundv; } } ); } } ); // Stop any currently playing video background if( previousBackground ) { var previousVideo = previousBackground.querySelector( 'video' ); if( previousVideo ) previousVideo.pause(); } if( currentBackground ) { // Start video playback var currentVideo = currentBackground.querySelector( 'video' ); if( currentVideo ) { var startVideo = function() { currentVideo.currentTime = 0; currentVideo.play(); currentVideo.removeEventListener( 'loadeddata', startVideo ); }; if( currentVideo.readyState > 1 ) { startVideo(); } else { currentVideo.addEventListener( 'loadeddata', startVideo ); } } var backgroundImageURL = currentBackground.style.backgroundImage || ''; // Restart GIFs (doesn't work in Firefox) if( /\.gif/i.test( backgroundImageURL ) ) { currentBackground.style.backgroundImage = ''; window.getComputedStyle( currentBackground ).opacity; currentBackground.style.backgroundImage = backgroundImageURL; } // Don't transition between identical backgrounds. This // prevents unwanted flicker. var <API key> = previousBackground ? previousBackground.getAttribute( '<API key>' ) : null; var <API key> = currentBackground.getAttribute( '<API key>' ); if( <API key> && <API key> === <API key> && currentBackground !== previousBackground ) { dom.background.classList.add( 'no-transition' ); } previousBackground = currentBackground; } // If there's a background brightness flag for this slide, // bubble it to the .reveal container if( currentSlide ) { [ '<API key>', 'has-dark-background' ].forEach( function( classToBubble ) { if( currentSlide.classList.contains( classToBubble ) ) { dom.wrapper.classList.add( classToBubble ); } else { dom.wrapper.classList.remove( classToBubble ); } } ); } // Allow the first background to apply without transition setTimeout( function() { dom.background.classList.remove( 'no-transition' ); }, 1 ); } /** * Updates the position of the parallax background based * on the current slide index. */ function updateParallax() { if( config.<API key> ) { var horizontalSlides = dom.wrapper.querySelectorAll( <API key> ), verticalSlides = dom.wrapper.querySelectorAll( <API key> ); var backgroundSize = dom.background.style.backgroundSize.split( ' ' ), backgroundWidth, backgroundHeight; if( backgroundSize.length === 1 ) { backgroundWidth = backgroundHeight = parseInt( backgroundSize[0], 10 ); } else { backgroundWidth = parseInt( backgroundSize[0], 10 ); backgroundHeight = parseInt( backgroundSize[1], 10 ); } var slideWidth = dom.background.offsetWidth, <API key> = horizontalSlides.length, <API key>, horizontalOffset; if( typeof config.<API key> === 'number' ) { <API key> = config.<API key>; } else { <API key> = <API key> > 1 ? ( backgroundWidth - slideWidth ) / ( <API key> ) : 0; } horizontalOffset = <API key> * indexh * -1; var slideHeight = dom.background.offsetHeight, verticalSlideCount = verticalSlides.length, <API key>, verticalOffset; if( typeof config.<API key> === 'number' ) { <API key> = config.<API key>; } else { <API key> = ( backgroundHeight - slideHeight ) / ( <API key> ); } verticalOffset = verticalSlideCount > 0 ? <API key> * indexv * 1 : 0; dom.background.style.backgroundPosition = horizontalOffset + 'px ' + -verticalOffset + 'px'; } } /** * Called when the given slide is within the configured view * distance. Shows the slide element and loads any content * that is set to load lazily (data-src). */ function showSlide( slide ) { // Show the slide element slide.style.display = 'block'; // Media elements with data-src attributes toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src]' ) ).forEach( function( element ) { element.setAttribute( 'src', element.getAttribute( 'data-src' ) ); element.removeAttribute( 'data-src' ); } ); // Media elements with <source> children toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( media ) { var sources = 0; toArray( media.querySelectorAll( 'source[data-src]' ) ).forEach( function( source ) { source.setAttribute( 'src', source.getAttribute( 'data-src' ) ); source.removeAttribute( 'data-src' ); sources += 1; } ); // If we rewrote sources for this video/audio element, we need // to manually tell it to load from its new origin if( sources > 0 ) { media.load(); } } ); // Show the corresponding background element var indices = getIndices( slide ); var background = getSlideBackground( indices.h, indices.v ); if( background ) { background.style.display = 'block'; // If the background contains media, load it if( background.hasAttribute( 'data-loaded' ) === false ) { background.setAttribute( 'data-loaded', 'true' ); var backgroundImage = slide.getAttribute( '<API key>' ), backgroundVideo = slide.getAttribute( '<API key>' ), backgroundVideoLoop = slide.hasAttribute( '<API key>' ), <API key> = slide.hasAttribute( '<API key>' ), backgroundIframe = slide.getAttribute( '<API key>' ); // Images if( backgroundImage ) { background.style.backgroundImage = 'url('+ backgroundImage +')'; } // Videos else if ( backgroundVideo && !isSpeakerNotes() ) { var video = document.createElement( 'video' ); if( backgroundVideoLoop ) { video.setAttribute( 'loop', '' ); } if( <API key> ) { video.muted = true; } // Support comma separated lists of video sources backgroundVideo.split( ',' ).forEach( function( source ) { video.innerHTML += '<source src="'+ source +'">'; } ); background.appendChild( video ); } // Iframes else if( backgroundIframe ) { var iframe = document.createElement( 'iframe' ); iframe.setAttribute( 'src', backgroundIframe ); iframe.style.width = '100%'; iframe.style.height = '100%'; iframe.style.maxHeight = '100%'; iframe.style.maxWidth = '100%'; background.appendChild( iframe ); } } } } /** * Called when the given slide is moved outside of the * configured view distance. */ function hideSlide( slide ) { // Hide the slide element slide.style.display = 'none'; // Hide the corresponding background element var indices = getIndices( slide ); var background = getSlideBackground( indices.h, indices.v ); if( background ) { background.style.display = 'none'; } } /** * Determine what available routes there are for navigation. * * @return {Object} containing four booleans: left/right/up/down */ function availableRoutes() { var horizontalSlides = dom.wrapper.querySelectorAll( <API key> ), verticalSlides = dom.wrapper.querySelectorAll( <API key> ); var routes = { left: indexh > 0 || config.loop, right: indexh < horizontalSlides.length - 1 || config.loop, up: indexv > 0, down: indexv < verticalSlides.length - 1 }; // reverse horizontal controls for rtl if( config.rtl ) { var left = routes.left; routes.left = routes.right; routes.right = left; } return routes; } /** * Returns an object describing the available fragment * directions. * * @return {Object} two boolean properties: prev/next */ function availableFragments() { if( currentSlide && config.fragments ) { var fragments = currentSlide.querySelectorAll( '.fragment' ); var hiddenFragments = currentSlide.querySelectorAll( '.fragment:not(.visible)' ); return { prev: fragments.length - hiddenFragments.length > 0, next: !!hiddenFragments.length }; } else { return { prev: false, next: false }; } } /** * Enforces origin-specific format rules for embedded media. */ function <API key>() { var <API key> = function( sourceAttribute, sourceURL, param ) { toArray( dom.slides.querySelectorAll( 'iframe['+ sourceAttribute +'*="'+ sourceURL +'"]' ) ).forEach( function( el ) { var src = el.getAttribute( sourceAttribute ); if( src && src.indexOf( param ) === -1 ) { el.setAttribute( sourceAttribute, src + ( !/\?/.test( src ) ? '?' : '&' ) + param ); } }); }; // YouTube frames must include "?enablejsapi=1" <API key>( 'src', 'youtube.com/embed/', 'enablejsapi=1' ); <API key>( 'data-src', 'youtube.com/embed/', 'enablejsapi=1' ); // Vimeo frames must include "?api=1" <API key>( 'src', 'player.vimeo.com/', 'api=1' ); <API key>( 'data-src', 'player.vimeo.com/', 'api=1' ); } /** * Start playback of any embedded content inside of * the targeted slide. */ function <API key>( slide ) { if( slide && !isSpeakerNotes() ) { // Restart GIFs toArray( slide.querySelectorAll( 'img[src$=".gif"]' ) ).forEach( function( el ) { // Setting the same unchanged source like this was confirmed // to work in Chrome, FF & Safari el.setAttribute( 'src', el.getAttribute( 'src' ) ); } ); // HTML5 media elements toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { if( el.hasAttribute( 'data-autoplay' ) && typeof el.play === 'function' ) { el.play(); } } ); // Normal iframes toArray( slide.querySelectorAll( 'iframe[src]' ) ).forEach( function( el ) { startEmbeddedIframe( { target: el } ); } ); // Lazy loading iframes toArray( slide.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) { if( el.getAttribute( 'src' ) !== el.getAttribute( 'data-src' ) ) { el.removeEventListener( 'load', startEmbeddedIframe ); // remove first to avoid dupes el.addEventListener( 'load', startEmbeddedIframe ); el.setAttribute( 'src', el.getAttribute( 'data-src' ) ); } } ); } } /** * "Starts" the content of an embedded iframe using the * postmessage API. */ function startEmbeddedIframe( event ) { var iframe = event.target; // YouTube postMessage API if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { iframe.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' ); } // Vimeo postMessage API else if( /player\.vimeo\.com\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { iframe.contentWindow.postMessage( '{"method":"play"}', '*' ); } // Generic postMessage API else { iframe.contentWindow.postMessage( 'slide:start', '*' ); } } /** * Stop playback of any embedded content inside of * the targeted slide. */ function stopEmbeddedContent( slide ) { if( slide && slide.parentNode ) { // HTML5 media elements toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.pause === 'function' ) { el.pause(); } } ); // Generic postMessage API for non-lazy loaded iframes toArray( slide.querySelectorAll( 'iframe' ) ).forEach( function( el ) { el.contentWindow.postMessage( 'slide:stop', '*' ); el.removeEventListener( 'load', startEmbeddedIframe ); }); // YouTube postMessage API toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' ); } }); // Vimeo postMessage API toArray( slide.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { el.contentWindow.postMessage( '{"method":"pause"}', '*' ); } }); // Lazy loading iframes toArray( slide.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) { // Only removing the src doesn't actually unload the frame // in all browsers (Firefox) so we set it to blank first el.setAttribute( 'src', 'about:blank' ); el.removeAttribute( 'src' ); } ); } } /** * Returns the number of past slides. This can be used as a global * flattened index for slides. */ function getSlidePastCount() { var horizontalSlides = toArray( dom.wrapper.querySelectorAll( <API key> ) ); // The number of past slides var pastCount = 0; // Step through all slides and count the past ones mainLoop: for( var i = 0; i < horizontalSlides.length; i++ ) { var horizontalSlide = horizontalSlides[i]; var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); for( var j = 0; j < verticalSlides.length; j++ ) { // Stop as soon as we arrive at the present if( verticalSlides[j].classList.contains( 'present' ) ) { break mainLoop; } pastCount++; } // Stop as soon as we arrive at the present if( horizontalSlide.classList.contains( 'present' ) ) { break; } // Don't count the wrapping section for vertical slides if( horizontalSlide.classList.contains( 'stack' ) === false ) { pastCount++; } } return pastCount; } /** * Returns a value ranging from 0-1 that represents * how far into the presentation we have navigated. */ function getProgress() { // The number of past and total slides var totalCount = getTotalSlides(); var pastCount = getSlidePastCount(); if( currentSlide ) { var allFragments = currentSlide.querySelectorAll( '.fragment' ); // If there are fragments in the current slide those should be // accounted for in the progress. if( allFragments.length > 0 ) { var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' ); // This value represents how big a portion of the slide progress // that is made up by its fragments (0-1) var fragmentWeight = 0.9; // Add fragment progress to the past slide count pastCount += ( visibleFragments.length / allFragments.length ) * fragmentWeight; } } return pastCount / ( totalCount - 1 ); } /** * Checks if this presentation is running inside of the * speaker notes window. */ function isSpeakerNotes() { return !!window.location.search.match( /receiver/gi ); } /** * Reads the current URL (hash) and navigates accordingly. */ function readURL() { var hash = window.location.hash; // Attempt to parse the hash as either an index or name var bits = hash.slice( 2 ).split( '/' ), name = hash.replace( / // If the first bit is invalid and there is a name we can // assume that this is a named link if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) { var element; // Ensure the named link is a valid HTML ID attribute if( /^[a-zA-Z][\w:.-]*$/.test( name ) ) { // Find the slide with the specified ID element = document.getElementById( name ); } if( element ) { // Find the position of the named slide and navigate to it var indices = Reveal.getIndices( element ); slide( indices.h, indices.v ); } // If the slide doesn't exist, navigate to the current slide else { slide( indexh || 0, indexv || 0 ); } } else { // Read the index components of the hash var h = parseInt( bits[0], 10 ) || 0, v = parseInt( bits[1], 10 ) || 0; if( h !== indexh || v !== indexv ) { slide( h, v ); } } } /** * Updates the page URL (hash) to reflect the current * state. * * @param {Number} delay The time in ms to wait before * writing the hash */ function writeURL( delay ) { if( config.history ) { // Make sure there's never more than one timeout running clearTimeout( writeURLTimeout ); // If a delay is specified, timeout this call if( typeof delay === 'number' ) { writeURLTimeout = setTimeout( writeURL, delay ); } else if( currentSlide ) { var url = '/'; // Attempt to create a named link based on the slide's ID var id = currentSlide.getAttribute( 'id' ); if( id ) { id = id.replace( /[^a-zA-Z0-9\-\_\:\.]/g, '' ); } // If the current slide has an ID, use that as a named link if( typeof id === 'string' && id.length ) { url = '/' + id; } // Otherwise use the /h/v index else { if( indexh > 0 || indexv > 0 ) url += indexh; if( indexv > 0 ) url += '/' + indexv; } window.location.hash = url; } } } /** * Retrieves the h/v location of the current, or specified, * slide. * * @param {HTMLElement} slide If specified, the returned * index will be for this slide rather than the currently * active one * * @return {Object} { h: <int>, v: <int>, f: <int> } */ function getIndices( slide ) { // By default, return the current indices var h = indexh, v = indexv, f; // If a slide is specified, return the indices of that slide if( slide ) { var isVertical = isVerticalSlide( slide ); var slideh = isVertical ? slide.parentNode : slide; // Select all horizontal slides var horizontalSlides = toArray( dom.wrapper.querySelectorAll( <API key> ) ); // Now that we know which the horizontal slide is, get its index h = Math.max( horizontalSlides.indexOf( slideh ), 0 ); // Assume we're not vertical v = undefined; // If this is a vertical slide, grab the vertical index if( isVertical ) { v = Math.max( toArray( slide.parentNode.querySelectorAll( 'section' ) ).indexOf( slide ), 0 ); } } if( !slide && currentSlide ) { var hasFragments = currentSlide.querySelectorAll( '.fragment' ).length > 0; if( hasFragments ) { var currentFragment = currentSlide.querySelector( '.current-fragment' ); if( currentFragment && currentFragment.hasAttribute( 'data-fragment-index' ) ) { f = parseInt( currentFragment.getAttribute( 'data-fragment-index' ), 10 ); } else { f = currentSlide.querySelectorAll( '.fragment.visible' ).length - 1; } } } return { h: h, v: v, f: f }; } /** * Retrieves the total number of slides in this presentation. */ function getTotalSlides() { return dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ).length; } /** * Returns the slide element matching the specified index. */ function getSlide( x, y ) { var horizontalSlide = dom.wrapper.querySelectorAll( <API key> )[ x ]; var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' ); if( verticalSlides && verticalSlides.length && typeof y === 'number' ) { return verticalSlides ? verticalSlides[ y ] : undefined; } return horizontalSlide; } /** * Returns the background element for the given slide. * All slides, even the ones with no background properties * defined, have a background element so as long as the * index is valid an element will be returned. */ function getSlideBackground( x, y ) { // When printing to PDF the slide backgrounds are nested // inside of the slides if( isPrintingPDF() ) { var slide = getSlide( x, y ); if( slide ) { var background = slide.querySelector( '.slide-background' ); if( background && background.parentNode === slide ) { return background; } } return undefined; } var <API key> = dom.wrapper.querySelectorAll( '.backgrounds>.slide-background' )[ x ]; var verticalBackgrounds = <API key> && <API key>.querySelectorAll( '.slide-background' ); if( verticalBackgrounds && verticalBackgrounds.length && typeof y === 'number' ) { return verticalBackgrounds ? verticalBackgrounds[ y ] : undefined; } return <API key>; } /** * Retrieves the speaker notes from a slide. Notes can be * defined in two ways: * 1. As a data-notes attribute on the slide <section> * 2. As an <aside class="notes"> inside of the slide */ function getSlideNotes( slide ) { // Default to the current slide slide = slide || currentSlide; // Notes can be specified via the data-notes attribute... if( slide.hasAttribute( 'data-notes' ) ) { return slide.getAttribute( 'data-notes' ); } // ... or using an <aside class="notes"> element var notesElement = slide.querySelector( 'aside.notes' ); if( notesElement ) { return notesElement.innerHTML; } return null; } /** * Retrieves the current state of the presentation as * an object. This state can then be restored at any * time. */ function getState() { var indices = getIndices(); return { indexh: indices.h, indexv: indices.v, indexf: indices.f, paused: isPaused(), overview: isOverview() }; } /** * Restores the presentation to the given state. * * @param {Object} state As generated by getState() */ function setState( state ) { if( typeof state === 'object' ) { slide( deserialize( state.indexh ), deserialize( state.indexv ), deserialize( state.indexf ) ); var pausedFlag = deserialize( state.paused ), overviewFlag = deserialize( state.overview ); if( typeof pausedFlag === 'boolean' && pausedFlag !== isPaused() ) { togglePause( pausedFlag ); } if( typeof overviewFlag === 'boolean' && overviewFlag !== isOverview() ) { toggleOverview( overviewFlag ); } } } /** * Return a sorted fragments list, ordered by an increasing * "data-fragment-index" attribute. * * Fragments will be revealed in the order that they are returned by * this function, so you can use the index attributes to control the * order of fragment appearance. * * To maintain a sensible default fragment order, fragments are presumed * to be passed in document order. This function adds a "fragment-index" * attribute to each node if such an attribute is not already present, * and sets that attribute to an integer value which is the position of * the fragment within the fragments list. */ function sortFragments( fragments ) { fragments = toArray( fragments ); var ordered = [], unordered = [], sorted = []; // Group ordered and unordered elements fragments.forEach( function( fragment, i ) { if( fragment.hasAttribute( 'data-fragment-index' ) ) { var index = parseInt( fragment.getAttribute( 'data-fragment-index' ), 10 ); if( !ordered[index] ) { ordered[index] = []; } ordered[index].push( fragment ); } else { unordered.push( [ fragment ] ); } } ); // Append fragments without explicit indices in their // DOM order ordered = ordered.concat( unordered ); // Manually count the index up per group to ensure there // are no gaps var index = 0; // Push all fragments in their sorted order to an array, // this flattens the groups ordered.forEach( function( group ) { group.forEach( function( fragment ) { sorted.push( fragment ); fragment.setAttribute( 'data-fragment-index', index ); } ); index ++; } ); return sorted; } /** * Navigate to the specified slide fragment. * * @param {Number} index The index of the fragment that * should be shown, -1 means all are invisible * @param {Number} offset Integer offset to apply to the * fragment index * * @return {Boolean} true if a change was made in any * fragments visibility as part of this call */ function navigateFragment( index, offset ) { if( currentSlide && config.fragments ) { var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment' ) ); if( fragments.length ) { // If no index is specified, find the current if( typeof index !== 'number' ) { var lastVisibleFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop(); if( lastVisibleFragment ) { index = parseInt( lastVisibleFragment.getAttribute( 'data-fragment-index' ) || 0, 10 ); } else { index = -1; } } // If an offset is specified, apply it to the index if( typeof offset === 'number' ) { index += offset; } var fragmentsShown = [], fragmentsHidden = []; toArray( fragments ).forEach( function( element, i ) { if( element.hasAttribute( 'data-fragment-index' ) ) { i = parseInt( element.getAttribute( 'data-fragment-index' ), 10 ); } // Visible fragments if( i <= index ) { if( !element.classList.contains( 'visible' ) ) fragmentsShown.push( element ); element.classList.add( 'visible' ); element.classList.remove( 'current-fragment' ); // Announce the fragments one by one to the Screen Reader dom.statusDiv.textContent = element.textContent; if( i === index ) { element.classList.add( 'current-fragment' ); } } // Hidden fragments else { if( element.classList.contains( 'visible' ) ) fragmentsHidden.push( element ); element.classList.remove( 'visible' ); element.classList.remove( 'current-fragment' ); } } ); if( fragmentsHidden.length ) { dispatchEvent( 'fragmenthidden', { fragment: fragmentsHidden[0], fragments: fragmentsHidden } ); } if( fragmentsShown.length ) { dispatchEvent( 'fragmentshown', { fragment: fragmentsShown[0], fragments: fragmentsShown } ); } updateControls(); updateProgress(); return !!( fragmentsShown.length || fragmentsHidden.length ); } } return false; } /** * Navigate to the next slide fragment. * * @return {Boolean} true if there was a next fragment, * false otherwise */ function nextFragment() { return navigateFragment( null, 1 ); } /** * Navigate to the previous slide fragment. * * @return {Boolean} true if there was a previous fragment, * false otherwise */ function previousFragment() { return navigateFragment( null, -1 ); } /** * Cues a new automated slide if enabled in the config. */ function cueAutoSlide() { cancelAutoSlide(); if( currentSlide ) { var currentFragment = currentSlide.querySelector( '.current-fragment' ); var fragmentAutoSlide = currentFragment ? currentFragment.getAttribute( 'data-autoslide' ) : null; var parentAutoSlide = currentSlide.parentNode ? currentSlide.parentNode.getAttribute( 'data-autoslide' ) : null; var slideAutoSlide = currentSlide.getAttribute( 'data-autoslide' ); // Pick value in the following priority order: // 1. Current fragment's data-autoslide // 2. Current slide's data-autoslide // 3. Parent slide's data-autoslide // 4. Global autoSlide setting if( fragmentAutoSlide ) { autoSlide = parseInt( fragmentAutoSlide, 10 ); } else if( slideAutoSlide ) { autoSlide = parseInt( slideAutoSlide, 10 ); } else if( parentAutoSlide ) { autoSlide = parseInt( parentAutoSlide, 10 ); } else { autoSlide = config.autoSlide; } // If there are media elements with data-autoplay, // automatically set the autoSlide duration to the // length of that media. Not applicable if the slide // is divided up into fragments. if( currentSlide.querySelectorAll( '.fragment' ).length === 0 ) { toArray( currentSlide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { if( el.hasAttribute( 'data-autoplay' ) ) { if( autoSlide && el.duration * 1000 > autoSlide ) { autoSlide = ( el.duration * 1000 ) + 1000; } } } ); } // Cue the next auto-slide if: // - There is an autoSlide value // - Auto-sliding isn't paused by the user // - The presentation isn't paused // - The overview isn't active // - The presentation isn't over if( autoSlide && !autoSlidePaused && !isPaused() && !isOverview() && ( !Reveal.isLastSlide() || availableFragments().next || config.loop === true ) ) { autoSlideTimeout = setTimeout( function() { typeof config.autoSlideMethod === 'function' ? config.autoSlideMethod() : navigateNext(); cueAutoSlide(); }, autoSlide ); autoSlideStartTime = Date.now(); } if( autoSlidePlayer ) { autoSlidePlayer.setPlaying( autoSlideTimeout !== -1 ); } } } /** * Cancels any ongoing request to auto-slide. */ function cancelAutoSlide() { clearTimeout( autoSlideTimeout ); autoSlideTimeout = -1; } function pauseAutoSlide() { if( autoSlide && !autoSlidePaused ) { autoSlidePaused = true; dispatchEvent( 'autoslidepaused' ); clearTimeout( autoSlideTimeout ); if( autoSlidePlayer ) { autoSlidePlayer.setPlaying( false ); } } } function resumeAutoSlide() { if( autoSlide && autoSlidePaused ) { autoSlidePaused = false; dispatchEvent( 'autoslideresumed' ); cueAutoSlide(); } } function navigateLeft() { // Reverse for RTL if( config.rtl ) { if( ( isOverview() || nextFragment() === false ) && availableRoutes().left ) { slide( indexh + 1 ); } } // Normal navigation else if( ( isOverview() || previousFragment() === false ) && availableRoutes().left ) { slide( indexh - 1 ); } } function navigateRight() { // Reverse for RTL if( config.rtl ) { if( ( isOverview() || previousFragment() === false ) && availableRoutes().right ) { slide( indexh - 1 ); } } // Normal navigation else if( ( isOverview() || nextFragment() === false ) && availableRoutes().right ) { slide( indexh + 1 ); } } function navigateUp() { // Prioritize hiding fragments if( ( isOverview() || previousFragment() === false ) && availableRoutes().up ) { slide( indexh, indexv - 1 ); } } function navigateDown() { // Prioritize revealing fragments if( ( isOverview() || nextFragment() === false ) && availableRoutes().down ) { slide( indexh, indexv + 1 ); } } /** * Navigates backwards, prioritized in the following order: * 1) Previous fragment * 2) Previous vertical slide * 3) Previous horizontal slide */ function navigatePrev() { // Prioritize revealing fragments if( previousFragment() === false ) { if( availableRoutes().up ) { navigateUp(); } else { // Fetch the previous horizontal slide, if there is one var previousSlide; if( config.rtl ) { previousSlide = toArray( dom.wrapper.querySelectorAll( <API key> + '.future' ) ).pop(); } else { previousSlide = toArray( dom.wrapper.querySelectorAll( <API key> + '.past' ) ).pop(); } if( previousSlide ) { var v = ( previousSlide.querySelectorAll( 'section' ).length - 1 ) || undefined; var h = indexh - 1; slide( h, v ); } } } } /** * The reverse of #navigatePrev(). */ function navigateNext() { // Prioritize revealing fragments if( nextFragment() === false ) { if( availableRoutes().down ) { navigateDown(); } else if( config.rtl ) { navigateLeft(); } else { navigateRight(); } } } /** * Checks if the target element prevents the triggering of * swipe navigation. */ function isSwipePrevented( target ) { while( target && typeof target.hasAttribute === 'function' ) { if( target.hasAttribute( 'data-prevent-swipe' ) ) return true; target = target.parentNode; } return false; } /** * Called by all event handlers that are based on user * input. */ function onUserInput( event ) { if( config.autoSlideStoppable ) { pauseAutoSlide(); } } /** * Handler for the document level 'keypress' event. */ function onDocumentKeyPress( event ) { // Check if the pressed key is question mark if( event.shiftKey && event.charCode === 63 ) { if( dom.overlay ) { closeOverlay(); } else { showHelp( true ); } } } /** * Handler for the document level 'keydown' event. */ function onDocumentKeyDown( event ) { // If there's a condition specified and it returns false, // ignore this event if( typeof config.keyboardCondition === 'function' && config.keyboardCondition() === false ) { return true; } // Remember if auto-sliding was paused so we can toggle it var autoSlideWasPaused = autoSlidePaused; onUserInput( event ); // Check if there's a focused element that could be using // the keyboard var activeElementIsCE = document.activeElement && document.activeElement.contentEditable !== 'inherit'; var <API key> = document.activeElement && document.activeElement.tagName && /input|textarea/i.test( document.activeElement.tagName ); // Disregard the event if there's a focused element or a // keyboard modifier key is present if( activeElementIsCE || <API key> || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return; // While paused only allow resume keyboard events; 'b', '.'' var resumeKeyCodes = [66,190,191]; var key; // Custom key bindings for togglePause should be able to resume if( typeof config.keyboard === 'object' ) { for( key in config.keyboard ) { if( config.keyboard[key] === 'togglePause' ) { resumeKeyCodes.push( parseInt( key, 10 ) ); } } } if( isPaused() && resumeKeyCodes.indexOf( event.keyCode ) === -1 ) { return false; } var triggered = false; // 1. User defined key bindings if( typeof config.keyboard === 'object' ) { for( key in config.keyboard ) { // Check if this binding matches the pressed key if( parseInt( key, 10 ) === event.keyCode ) { var value = config.keyboard[ key ]; // Callback function if( typeof value === 'function' ) { value.apply( null, [ event ] ); } // String shortcuts to reveal.js API else if( typeof value === 'string' && typeof Reveal[ value ] === 'function' ) { Reveal[ value ].call(); } triggered = true; } } } // 2. System defined key bindings if( triggered === false ) { // Assume true and try to prove false triggered = true; switch( event.keyCode ) { // p, page up case 80: case 33: navigatePrev(); break; // n, page down case 78: case 34: navigateNext(); break; // h, left case 72: case 37: navigateLeft(); break; // l, right case 76: case 39: navigateRight(); break; // k, up case 75: case 38: navigateUp(); break; // j, down case 74: case 40: navigateDown(); break; // home case 36: slide( 0 ); break; // end case 35: slide( Number.MAX_VALUE ); break; // space case 32: isOverview() ? deactivateOverview() : event.shiftKey ? navigatePrev() : navigateNext(); break; // return case 13: isOverview() ? deactivateOverview() : triggered = false; break; // two-spot, semicolon, b, period, Logitech presenter tools "black screen" button case 58: case 59: case 66: case 190: case 191: togglePause(); break; case 70: enterFullscreen(); break; case 65: if ( config.autoSlideStoppable ) toggleAutoSlide( autoSlideWasPaused ); break; default: triggered = false; } } // If the input resulted in a triggered action we should prevent // the browsers default behavior if( triggered ) { event.preventDefault && event.preventDefault(); } // ESC or O key else if ( ( event.keyCode === 27 || event.keyCode === 79 ) && features.transforms3d ) { if( dom.overlay ) { closeOverlay(); } else { toggleOverview(); } event.preventDefault && event.preventDefault(); } // If auto-sliding is enabled we need to cue up // another timeout cueAutoSlide(); } /** * Handler for the 'touchstart' event, enables support for * swipe and pinch gestures. */ function onTouchStart( event ) { if( isSwipePrevented( event.target ) ) return true; touch.startX = event.touches[0].clientX; touch.startY = event.touches[0].clientY; touch.startCount = event.touches.length; // If there's two touches we need to memorize the distance // between those two points to detect pinching if( event.touches.length === 2 && config.overview ) { touch.startSpan = distanceBetween( { x: event.touches[1].clientX, y: event.touches[1].clientY }, { x: touch.startX, y: touch.startY } ); } } /** * Handler for the 'touchmove' event. */ function onTouchMove( event ) { if( isSwipePrevented( event.target ) ) return true; // Each touch should only trigger one action if( !touch.captured ) { onUserInput( event ); var currentX = event.touches[0].clientX; var currentY = event.touches[0].clientY; // If the touch started with two points and still has // two active touches; test for the pinch gesture if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) { // The current distance in pixels between the two touch points var currentSpan = distanceBetween( { x: event.touches[1].clientX, y: event.touches[1].clientY }, { x: touch.startX, y: touch.startY } ); // If the span is larger than the desire amount we've got // ourselves a pinch if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) { touch.captured = true; if( currentSpan < touch.startSpan ) { activateOverview(); } else { deactivateOverview(); } } event.preventDefault(); } // There was only one touch point, look for a swipe else if( event.touches.length === 1 && touch.startCount !== 2 ) { var deltaX = currentX - touch.startX, deltaY = currentY - touch.startY; if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.captured = true; navigateLeft(); } else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.captured = true; navigateRight(); } else if( deltaY > touch.threshold ) { touch.captured = true; navigateUp(); } else if( deltaY < -touch.threshold ) { touch.captured = true; navigateDown(); } // If we're embedded, only block touch events if they have // triggered an action if( config.embedded ) { if( touch.captured || isVerticalSlide( currentSlide ) ) { event.preventDefault(); } } // Not embedded? Block them all to avoid needless tossing // around of the viewport in iOS else { event.preventDefault(); } } } // There's a bug with swiping on some Android devices unless // the default action is always prevented else if( UA.match( /android/gi ) ) { event.preventDefault(); } } /** * Handler for the 'touchend' event. */ function onTouchEnd( event ) { touch.captured = false; } /** * Convert pointer down to touch start. */ function onPointerDown( event ) { if( event.pointerType === event.<API key> || event.pointerType === "touch" ) { event.touches = [{ clientX: event.clientX, clientY: event.clientY }]; onTouchStart( event ); } } /** * Convert pointer move to touch move. */ function onPointerMove( event ) { if( event.pointerType === event.<API key> || event.pointerType === "touch" ) { event.touches = [{ clientX: event.clientX, clientY: event.clientY }]; onTouchMove( event ); } } /** * Convert pointer up to touch end. */ function onPointerUp( event ) { if( event.pointerType === event.<API key> || event.pointerType === "touch" ) { event.touches = [{ clientX: event.clientX, clientY: event.clientY }]; onTouchEnd( event ); } } /** * Handles mouse wheel scrolling, throttled to avoid skipping * multiple slides. */ function <API key>( event ) { if( Date.now() - lastMouseWheelStep > 600 ) { lastMouseWheelStep = Date.now(); var delta = event.detail || -event.wheelDelta; if( delta > 0 ) { navigateNext(); } else { navigatePrev(); } } } /** * Clicking on the progress bar results in a navigation to the * closest approximate horizontal slide using this equation: * * ( clickX / presentationWidth ) * numberOfSlides */ function onProgressClicked( event ) { onUserInput( event ); event.preventDefault(); var slidesTotal = toArray( dom.wrapper.querySelectorAll( <API key> ) ).length; var slideIndex = Math.floor( ( event.clientX / dom.wrapper.offsetWidth ) * slidesTotal ); if( config.rtl ) { slideIndex = slidesTotal - slideIndex; } slide( slideIndex ); } /** * Event handler for navigation control buttons. */ function <API key>( event ) { event.preventDefault(); onUserInput(); navigateLeft(); } function <API key>( event ) { event.preventDefault(); onUserInput(); navigateRight(); } function onNavigateUpClicked( event ) { event.preventDefault(); onUserInput(); navigateUp(); } function <API key>( event ) { event.preventDefault(); onUserInput(); navigateDown(); } function <API key>( event ) { event.preventDefault(); onUserInput(); navigatePrev(); } function <API key>( event ) { event.preventDefault(); onUserInput(); navigateNext(); } /** * Handler for the window level 'hashchange' event. */ function onWindowHashChange( event ) { readURL(); } /** * Handler for the window level 'resize' event. */ function onWindowResize( event ) { layout(); } /** * Handle for the window level 'visibilitychange' event. */ function <API key>( event ) { var isHidden = document.webkitHidden || document.msHidden || document.hidden; // If, after clicking a link or similar and we're coming back, // focus the document.body to ensure we can use keyboard shortcuts if( isHidden === false && document.activeElement !== document.body ) { // Not all elements support .blur() - SVGs among them. if( typeof document.activeElement.blur === 'function' ) { document.activeElement.blur(); } document.body.focus(); } } /** * Invoked when a slide is and we're in the overview. */ function <API key>( event ) { // TODO There's a bug here where the event listeners are not // removed after deactivating the overview. if( eventsAreBound && isOverview() ) { event.preventDefault(); var element = event.target; while( element && !element.nodeName.match( /section/gi ) ) { element = element.parentNode; } if( element && !element.classList.contains( 'disabled' ) ) { deactivateOverview(); if( element.nodeName.match( /section/gi ) ) { var h = parseInt( element.getAttribute( 'data-index-h' ), 10 ), v = parseInt( element.getAttribute( 'data-index-v' ), 10 ); slide( h, v ); } } } } /** * Handles clicks on links that are set to preview in the * iframe overlay. */ function <API key>( event ) { if( event.currentTarget && event.currentTarget.hasAttribute( 'href' ) ) { var url = event.currentTarget.getAttribute( 'href' ); if( url ) { showPreview( url ); event.preventDefault(); } } } /** * Handles click on the auto-sliding controls element. */ function <API key>( event ) { // Replay if( Reveal.isLastSlide() && config.loop === false ) { slide( 0, 0 ); resumeAutoSlide(); } // Resume else if( autoSlidePaused ) { resumeAutoSlide(); } // Pause else { pauseAutoSlide(); } } /** * Constructor for the playback component, which displays * play/pause/progress controls. * * @param {HTMLElement} container The component will append * itself to this * @param {Function} progressCheck A method which will be * called frequently to get the current progress on a range * of 0-1 */ function Playback( container, progressCheck ) { // Cosmetics this.diameter = 100; this.diameter2 = this.diameter/2; this.thickness = 6; // Flags if we are currently playing this.playing = false; // Current progress on a 0-1 range this.progress = 0; // Used to loop the animation smoothly this.progressOffset = 1; this.container = container; this.progressCheck = progressCheck; this.canvas = document.createElement( 'canvas' ); this.canvas.className = 'playback'; this.canvas.width = this.diameter; this.canvas.height = this.diameter; this.canvas.style.width = this.diameter2 + 'px'; this.canvas.style.height = this.diameter2 + 'px'; this.context = this.canvas.getContext( '2d' ); this.container.appendChild( this.canvas ); this.render(); } Playback.prototype.setPlaying = function( value ) { var wasPlaying = this.playing; this.playing = value; // Start repainting if we weren't already if( !wasPlaying && this.playing ) { this.animate(); } else { this.render(); } }; Playback.prototype.animate = function() { var progressBefore = this.progress; this.progress = this.progressCheck(); // When we loop, offset the progress so that it eases // smoothly rather than immediately resetting if( progressBefore > 0.8 && this.progress < 0.2 ) { this.progressOffset = this.progress; } this.render(); if( this.playing ) { features.<API key>.call( window, this.animate.bind( this ) ); } }; /** * Renders the current progress and playback state. */ Playback.prototype.render = function() { var progress = this.playing ? this.progress : 0, radius = ( this.diameter2 ) - this.thickness, x = this.diameter2, y = this.diameter2, iconSize = 28; // Ease towards 1 this.progressOffset += ( 1 - this.progressOffset ) * 0.1; var endAngle = ( - Math.PI / 2 ) + ( progress * ( Math.PI * 2 ) ); var startAngle = ( - Math.PI / 2 ) + ( this.progressOffset * ( Math.PI * 2 ) ); this.context.save(); this.context.clearRect( 0, 0, this.diameter, this.diameter ); // Solid background color this.context.beginPath(); this.context.arc( x, y, radius + 4, 0, Math.PI * 2, false ); this.context.fillStyle = 'rgba( 0, 0, 0, 0.4 )'; this.context.fill(); // Draw progress track this.context.beginPath(); this.context.arc( x, y, radius, 0, Math.PI * 2, false ); this.context.lineWidth = this.thickness; this.context.strokeStyle = '#666'; this.context.stroke(); if( this.playing ) { // Draw progress on top of track this.context.beginPath(); this.context.arc( x, y, radius, startAngle, endAngle, false ); this.context.lineWidth = this.thickness; this.context.strokeStyle = '#fff'; this.context.stroke(); } this.context.translate( x - ( iconSize / 2 ), y - ( iconSize / 2 ) ); // Draw play/pause icons if( this.playing ) { this.context.fillStyle = '#fff'; this.context.fillRect( 0, 0, iconSize / 2 - 4, iconSize ); this.context.fillRect( iconSize / 2 + 4, 0, iconSize / 2 - 4, iconSize ); } else { this.context.beginPath(); this.context.translate( 4, 0 ); this.context.moveTo( 0, 0 ); this.context.lineTo( iconSize - 4, iconSize / 2 ); this.context.lineTo( 0, iconSize ); this.context.fillStyle = '#fff'; this.context.fill(); } this.context.restore(); }; Playback.prototype.on = function( type, listener ) { this.canvas.addEventListener( type, listener, false ); }; Playback.prototype.off = function( type, listener ) { this.canvas.removeEventListener( type, listener, false ); }; Playback.prototype.destroy = function() { this.playing = false; if( this.canvas.parentNode ) { this.container.removeChild( this.canvas ); } }; Reveal = { VERSION: VERSION, initialize: initialize, configure: configure, sync: sync, // Navigation methods slide: slide, left: navigateLeft, right: navigateRight, up: navigateUp, down: navigateDown, prev: navigatePrev, next: navigateNext, // Fragment methods navigateFragment: navigateFragment, prevFragment: previousFragment, nextFragment: nextFragment, // Deprecated aliases navigateTo: slide, navigateLeft: navigateLeft, navigateRight: navigateRight, navigateUp: navigateUp, navigateDown: navigateDown, navigatePrev: navigatePrev, navigateNext: navigateNext, // Forces an update in slide layout layout: layout, // Randomizes the order of slides shuffle: shuffle, // Returns an object with the available routes as booleans (left/right/top/bottom) availableRoutes: availableRoutes, // Returns an object with the available fragments as booleans (prev/next) availableFragments: availableFragments, // Toggles the overview mode on/off toggleOverview: toggleOverview, // Toggles the "black screen" mode on/off togglePause: togglePause, // Toggles the auto slide mode on/off toggleAutoSlide: toggleAutoSlide, // State checks isOverview: isOverview, isPaused: isPaused, isAutoSliding: isAutoSliding, // Adds or removes all internal event listeners (such as keyboard) addEventListeners: addEventListeners, <API key>: <API key>, // Facility for persisting and restoring the presentation state getState: getState, setState: setState, // Presentation progress on range of 0-1 getProgress: getProgress, // Returns the indices of the current, or specified, slide getIndices: getIndices, getTotalSlides: getTotalSlides, // Returns the slide element at the specified index getSlide: getSlide, // Returns the slide background element at the specified index getSlideBackground: getSlideBackground, // Returns the speaker notes string for a slide, or null getSlideNotes: getSlideNotes, // Returns the previous slide element, may be null getPreviousSlide: function() { return previousSlide; }, // Returns the current slide element getCurrentSlide: function() { return currentSlide; }, // Returns the current scale of the presentation content getScale: function() { return scale; }, // Returns the current configuration object getConfig: function() { return config; }, // Helper method, retrieves query string as a key/value hash getQueryHash: function() { var query = {}; location.search.replace( /[A-Z0-9]+?=([\w\.%-]*)/gi, function(a) { query[ a.split( '=' ).shift() ] = a.split( '=' ).pop(); } ); // Basic deserialization for( var i in query ) { var value = query[ i ]; query[ i ] = deserialize( unescape( value ) ); } return query; }, // Returns true if we're currently on the first slide isFirstSlide: function() { return ( indexh === 0 && indexv === 0 ); }, // Returns true if we're currently on the last slide isLastSlide: function() { if( currentSlide ) { // Does this slide has next a sibling? if( currentSlide.nextElementSibling ) return false; // If it's vertical, does its parent have a next sibling? if( isVerticalSlide( currentSlide ) && currentSlide.parentNode.nextElementSibling ) return false; return true; } return false; }, // Checks if reveal.js has been loaded and is ready for use isReady: function() { return loaded; }, // Forward event binding to the reveal DOM element addEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { ( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture ); } }, removeEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { ( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture ); } }, // Programatically triggers a keyboard event triggerKey: function( keyCode ) { onDocumentKeyDown( { keyCode: keyCode } ); }, // Registers a new shortcut to include in the help overlay <API key>: function( key, value ) { keyboardShortcuts[key] = value; } }; return Reveal; }));
#!/usr/bin/python # -*- coding: utf-8 -*- # This program is free software: you can redistribute it and/or modify # (at your option) any later version. # This program is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # @author : beaengine@gmail.com from headers.BeaEnginePython import * from nose.tools import * class TestSuite: def test(self): # EVEX.256.66.0F3A.W0 25 /r ib # vpternlogd ymm1{k1}{z}, ymm2, ymm3/m256/m32bcst, imm8 myEVEX = EVEX('EVEX.256.66.0F3A.W0') Buffer = bytes.fromhex('{}252011'.format(myEVEX.prefix())) myDisasm = Disasm(Buffer) myDisasm.read() assert_equal(myDisasm.infos.Instruction.Opcode, 0x25) assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vpternlogd') assert_equal(myDisasm.repr(), 'vpternlogd ymm28, ymm16, ymmword ptr [r8], 11h') # EVEX.512.66.0F3A.W0 25 /r ib # vpternlogd zmm1{k1}{z}, zmm2, zmm3/m512/m32bcst, imm8 myEVEX = EVEX('EVEX.512.66.0F3A.W0') Buffer = bytes.fromhex('{}252011'.format(myEVEX.prefix())) myDisasm = Disasm(Buffer) myDisasm.read() assert_equal(myDisasm.infos.Instruction.Opcode, 0x25) assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vpternlogd') assert_equal(myDisasm.repr(), 'vpternlogd zmm28, zmm16, zmmword ptr [r8], 11h') # EVEX.256.66.0F3A.W1 25 /r ib # vpternlogq ymm1{k1}{z}, ymm2, ymm3/m256/m64bcst, imm8 myEVEX = EVEX('EVEX.256.66.0F3A.W1') Buffer = bytes.fromhex('{}252011'.format(myEVEX.prefix())) myDisasm = Disasm(Buffer) myDisasm.read() assert_equal(myDisasm.infos.Instruction.Opcode, 0x25) assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vpternlogq') assert_equal(myDisasm.repr(), 'vpternlogq ymm28, ymm16, ymmword ptr [r8], 11h') # EVEX.512.66.0F3A.W1 25 /r ib # vpternlogq zmm1{k1}{z}, zmm2, zmm3/m512/m64bcst, imm8 myEVEX = EVEX('EVEX.512.66.0F3A.W1') Buffer = bytes.fromhex('{}252011'.format(myEVEX.prefix())) myDisasm = Disasm(Buffer) myDisasm.read() assert_equal(myDisasm.infos.Instruction.Opcode, 0x25) assert_equal(myDisasm.infos.Instruction.Mnemonic, b'vpternlogq') assert_equal(myDisasm.repr(), 'vpternlogq zmm28, zmm16, zmmword ptr [r8], 11h')
class Base { public: Resource *p; Base() { p = createResource(); } virtual void f() { //has virtual function } ~Base() { //wrong: is non-virtual freeResource(p); } }; class Derived: public Base { public: Resource *dp; Derived() { dp = createResource2(); } ~Derived() { freeResource2(dp); } }; int f() { Base *b = new Derived(); //creates resources for both Base::p and Derived::dp //will only call Base::~Base(), leaking the resource dp. //Change both destructors to virtual to ensure they are both called. delete b; }
#endregion using System; using System.Collections; using System.Diagnostics; using System.Globalization; using System.IO; using System.Xml; using System.Xml.Serialization; using newtelligence.DasBlog.Runtime.Proxies; using newtelligence.DasBlog.Util; namespace newtelligence.DasBlog.Runtime { [Serializable] [XmlRoot(Namespace=Data.NamespaceURI)] [XmlType(Namespace=Data.NamespaceURI)] public class DayEntry : IDayEntry { private object entriesLock = new object(); //the entries collection is shared and must be protected private bool Loaded { [DebuggerStepThrough()] get { return _loaded; } [DebuggerStepThrough()] set { _loaded = value; } } private bool _loaded = false; public string FileName { get { // Use Invariant Culture, not host culture (or user override), for date formats. return DateUtc.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) + ".dayentry.xml"; } } [XmlIgnore] public DateTime DateUtc { [DebuggerStepThrough()] get { return _date; } [DebuggerStepThrough()] set { _date = value.Date; } } private DateTime _date; [XmlElement("Date")] public DateTime DateLocalTime { get { return (DateUtc==DateTime.MinValue||DateUtc==DateTime.MaxValue)?DateUtc:DateUtc.ToLocalTime(); } set { DateUtc = (value==DateTime.MinValue||value==DateTime.MaxValue)?value:value.Date.ToUniversalTime(); } } [XmlArrayItem(typeof(Entry))] public EntryCollection Entries { [DebuggerStepThrough()] get { return _entries; } [DebuggerStepThrough()] set { _entries = value; } } private EntryCollection _entries = new EntryCollection(); [XmlAnyElement] public XmlElement[] anyElements; [XmlAnyAttribute] public XmlAttribute[] anyAttributes; public void Initialize() { DateUtc = DateTime.Now.ToUniversalTime().Date; } <summary> Return EntryCollection excluding the private entries if the caller is not in the admin role. </summary> public EntryCollection GetEntries() { return GetEntries(null); } <summary> Return EntryCollection with the number of entries limited by <see paramref="maxResults" /> excluding the private entries if the caller is not in the admin role. </summary> public EntryCollection GetEntries(int maxResults) { return GetEntries(null, maxResults); } <summary> Returns the entries that meet the include delegates criteria. </summary> <param name="include">The delegate indicating which items to include.</param> public EntryCollection GetEntries(Predicate<Entry> include) { return GetEntries(include, Int32.MaxValue); } <summary> Returns the entries that meet the include delegates criteria, with the number of entries limited by <see paramref="maxResults" />. </summary> <param name="include">The delegate indicating which items to include.</param> public EntryCollection GetEntries(Predicate<Entry> include, int maxResults) { lock(entriesLock) { Predicate<Entry> filter = null; if(!System.Threading.Thread.CurrentPrincipal.IsInRole("admin")) { filter += <API key>.DefaultFilters.IsPublic(); } if(include != null) { filter += include; } return <API key>.FindAll(Entries, filter, maxResults); } } <param name="entryTitle">An URL-encoded entry title</param> public Entry GetEntryByTitle(string entryTitle) { foreach (Entry entry in this.Entries) { string compressedTitle = entry.CompressedTitle.Replace("+", ""); if (<API key>.Default.Compare(compressedTitle,entryTitle) == 0) { return entry; } } return null; } internal void Load(DataManager data) { if ( Loaded ) { return; } lock(entriesLock) { if ( Loaded ) //SDH: standard thread-safe double check { return; } string fullPath = data.ResolvePath(FileName); FileStream fileStream = FileUtils.OpenForRead(fullPath); if ( fileStream != null ) { try { XmlSerializer ser = new XmlSerializer(typeof(DayEntry),Data.NamespaceURI); using (StreamReader reader = new StreamReader(fileStream)) { //<API key> upg = new <API key>( reader, "", Data.NamespaceURI ); DayEntry e = (DayEntry)ser.Deserialize(reader); Entries = e.Entries; } } catch(Exception e) { ErrorTrace.Trace(System.Diagnostics.TraceLevel.Error,e); } finally { fileStream.Close(); } } Entries.Sort((left,right) => right.CreatedUtc.CompareTo(left.CreatedUtc)); Loaded = true; } } internal void Save(DataManager data) { string fullPath = data.ResolvePath(FileName); // We use the internal list to circumvent ignoring // items where IsPublic is set to false. if ( Entries.Count == 0 ) { if ( File.Exists( fullPath ) ) { File.Delete( fullPath ); } } else { System.Security.Principal.<API key> wi = Impersonation.Impersonate(); FileStream fileStream = FileUtils.OpenForWrite(fullPath); if ( fileStream != null ) { try { XmlSerializer ser = new XmlSerializer(typeof(DayEntry),Data.NamespaceURI); using (StreamWriter writer = new StreamWriter(fileStream)) { ser.Serialize(writer, this); } } catch(Exception e) { ErrorTrace.Trace(System.Diagnostics.TraceLevel.Error,e); } finally { fileStream.Close(); } } wi.Undo(); } } <summary> Returns true if the specified DayEntry occurs before the day specified. </summary> <param name="dayEntry">The DayEntry to check the date of.</param> <param name="dateTime">The date the DayEntry should occur before</param> <returns>Returns true if the dayEntry occurs before the specified date.</returns> public static bool OccursBefore(DayEntry dayEntry, DateTime dateTime) { return (dayEntry.DateUtc.Date <= dateTime); } public static bool OccursBetween(DayEntry dayEntry, TimeZone timeZone, DateTime startDateTime, DateTime endDateTime) { //return ((timeZone.ToLocalTime(dayEntry.DateUtc) >= startDateTime) // && (timeZone.ToLocalTime(dayEntry.DateUtc) <= endDateTime) ); return ((dayEntry.DateUtc >= startDateTime) && (dayEntry.DateUtc <= endDateTime) ); } <summary> Returns true if the specified DayEntry is within the same month as <c>month</c>; </summary> <param name="dayEntry"></param> <param name="timeZone"></param> <param name="month"></param> <returns></returns> public static bool OccursInMonth(DayEntry dayEntry, TimeZone timeZone, DateTime month) { DateTime startOfMonth = new DateTime(month.Year, month.Month, 1, 0, 0, 0); DateTime endOfMonth = new DateTime(month.Year, month.Month, 1, 0, 0, 0); endOfMonth = endOfMonth.AddMonths(1); endOfMonth = endOfMonth.AddSeconds(-1); TimeSpan offset = timeZone.GetUtcOffset(endOfMonth); endOfMonth = endOfMonth.AddHours(offset.Negate().Hours); return ( OccursBetween(dayEntry, timeZone, startOfMonth, endOfMonth) ); } } }
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #undef SCI_NAMESPACE #include <Scintilla.h> #include "iup.h" #include "iup_object.h" #include "iup_attrib.h" #include "iup_str.h" #include "iupsci.h" static char* <API key>(Ihandle *ih) { if(<API key>(ih, SCI_GETCURSOR, 0, 0) == SC_CURSORWAIT) return "WAIT"; else return "NORMAL"; } static int <API key>(Ihandle *ih, const char *value) { if (iupStrEqualNoCase(value, "WAIT")) <API key>(ih, SCI_SETCURSOR, (uptr_t)SC_CURSORWAIT, 0); else /* NORMAL */ <API key>(ih, SCI_SETCURSOR, (uptr_t)SC_CURSORNORMAL, 0); return 0; } static int <API key>(Ihandle *ih, const char *value) { (void)value; <API key>(ih, SCI_ZOOMIN, 0, 0); return 0; } static int <API key>(Ihandle *ih, const char *value) { (void)value; <API key>(ih, SCI_ZOOMOUT, 0, 0); return 0; } static int <API key>(Ihandle *ih, const char *value) { int points; if (!iupStrToInt(value, &points)) return 0; if(points > 20) points = 20; if(points < -10) points = -10; <API key>(ih, SCI_SETZOOM, points, 0); return 0; } static char* <API key>(Ihandle* ih) { int points = <API key>(ih, SCI_GETZOOM, 0, 0); return iupStrReturnInt(points); } void <API key>(Iclass* ic) { <API key>(ic, "CURSOR", <API key>, <API key>, NULL, NULL, IUPAF_NO_INHERIT); <API key>(ic, "ZOOMIN", NULL, <API key>, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT); <API key>(ic, "ZOOMOUT", NULL, <API key>, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT); <API key>(ic, "ZOOM", <API key>, <API key>, NULL, NULL, IUPAF_NO_INHERIT); }
var Example = Example || {}; Example.staticFriction = function() { var Engine = Matter.Engine, Render = Matter.Render, Runner = Matter.Runner, Body = Matter.Body, Composites = Matter.Composites, Events = Matter.Events, MouseConstraint = Matter.MouseConstraint, Mouse = Matter.Mouse, World = Matter.World, Bodies = Matter.Bodies; // create engine var engine = Engine.create(), world = engine.world; // create renderer var render = Render.create({ element: document.body, engine: engine, options: { width: Math.min(document.documentElement.clientWidth, 800), height: Math.min(document.documentElement.clientHeight, 600), showVelocity: true } }); Render.run(render); // create runner var runner = Runner.create(); Runner.run(runner, engine); // add bodies var body = Bodies.rectangle(400, 500, 200, 60, { isStatic: true, chamfer: 10 }), size = 50, counter = -1; var stack = Composites.stack(350, 470 - 6 * size, 1, 6, 0, 0, function(x, y) { return Bodies.rectangle(x, y, size * 2, size, { slop: 0.5, friction: 1, frictionStatic: Infinity }); }); World.add(world, [ body, stack, // walls Bodies.rectangle(400, 0, 800, 50, { isStatic: true }), Bodies.rectangle(400, 600, 800, 50, { isStatic: true }), Bodies.rectangle(800, 300, 50, 600, { isStatic: true }), Bodies.rectangle(0, 300, 50, 600, { isStatic: true }) ]); Events.on(engine, 'beforeUpdate', function(event) { counter += 0.014; if (counter < 0) { return; } var px = 400 + 100 * Math.sin(counter); // body is static so must manually update velocity for friction to work Body.setVelocity(body, { x: px - body.position.x, y: 0 }); Body.setPosition(body, { x: px, y: body.position.y }); }); // add mouse control var mouse = Mouse.create(render.canvas), mouseConstraint = MouseConstraint.create(engine, { mouse: mouse, constraint: { stiffness: 0.2, render: { visible: false } } }); World.add(world, mouseConstraint); // keep the mouse in sync with rendering render.mouse = mouse; // fit the render viewport to the scene Render.lookAt(render, { min: { x: 0, y: 0 }, max: { x: 800, y: 600 } }); // context for MatterTools.Demo return { engine: engine, runner: runner, render: render, canvas: render.canvas, stop: function() { Matter.Render.stop(render); Matter.Runner.stop(runner); } }; };
{% if isTopPage() %} {% set unportalizedPath = '/top-' + Date.now() %} {% else %} {% set unportalizedPath = page.path|replace('(\/)$', '') %} {% endif %} <div class="modal" id="unportalize"> <div class="modal-dialog"> <div class="modal-content"> <form role="form" id="unportalize-form" onsubmit="return false;"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"></h4> </div> <div class="modal-body"> <ul> <li></li> </ul> <div class="form-group"> <p> <label for=""></label><br><code>{{ page.path }}</code> </p> <p> <label for=""></label><br><code>{{ unportalizedPath }}</code> </p> {% if isTopPage() %} <p class="alert alert-info"> </p> {% endif %} </div> </div> <div class="modal-footer"> <p><small class="pull-left" id="newPageNameCheck"></small></p> <input type="hidden" name="_csrf" value="{{ csrf() }}"> <input type="hidden" name="path" value="{{ page.path }}"> <input type="hidden" class="form-control" name="new_path" id="newPageName" value="{{ unportalizedPath }}"> <input type="hidden" name="page_id" value="{{ page._id.toString() }}"> <input type="hidden" name="revision_id" value="{{ page.revision._id.toString() }}"> <input type="submit" class="btn btn-primary" value="Unportalize!"> </div> </form> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
package com.softserve.app.repository; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import com.softserve.app.model.Pet; @RunWith(MockitoJUnitRunner.class) public class <API key> { @Mock PetRepository stubM; @Mock Pet petM; @Test public void <API key>() { List<Pet> pets = stubM.findAllPets(); assertNotNull(pets); } @Test public void <API key>() { PetRepositoryStub stub = new PetRepositoryStub(); List<Pet> pets = (ArrayList<Pet>) stub.findAllPets(); assertNotNull(pets); } @Test public void <API key>() { PetRepositoryStub stub = new PetRepositoryStub(); Pet pet = stub.findPet("101"); System.out.println(pet); assertNotNull(pet); } @Test public void <API key>() { when(stubM.findPet("10").getType()).thenReturn("dog"); assertEquals("dog", stubM.findPet("0").getType()); } @Test(expected=RuntimeException.class) public void <API key>() { PetRepositoryStub stub = new PetRepositoryStub(); Pet pet = stub.findPet("0"); } @Test public void testCreate() { PetRepositoryStub stub = new PetRepositoryStub(); Pet pet5 = new Pet(); pet5.setId("5"); pet5.setType("Dog"); System.out.println(pet5.getType()); stub.create(pet5); System.out.println(stub.findPet("5").getType()); assertNotNull(stub.findPet("5").getType()); } }
##Search in Rotated Sorted Array II Total Accepted: 60092 Total Submissions: 188639 Difficulty: Medium Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function to determine if a given target is in the array. - index,,end--,start++ - index,binary search,target - O(logn),O(n) - ,[](https://leetcode.com/discuss/30308/<API key>) java public class Solution { public boolean search(int[] nums, int target) { if (nums == null || nums.length == 0) { return false; } int len = nums.length; int lowIndex1 = searchLowestIndex1(nums); int lowIndex2 = searchLowestIndex2(nums); return binarySearch(nums, target, 0, lowIndex1 - 1) || binarySearch(nums, target, lowIndex1, len - 1) || binarySearch(nums, target, 0, lowIndex2 - 1) || binarySearch(nums, target, lowIndex2, len - 1); } public int searchLowestIndex1(int[] nums) { if (nums == null || nums.length == 0) { return -1; } int len = nums.length; int start = 0; int end = len - 1; while (start < end - 1) { int mid = start + (end - start) / 2; if (nums[mid] == nums[end]) { end } else if (nums[mid] > nums[end]) { start = mid; } else { end = mid; } } return (nums[start] < nums[end]) ? start : end; } public int searchLowestIndex2(int[] nums) { if (nums == null || nums.length == 0) { return -1; } int len = nums.length; int start = 0; int end = len - 1; while (start < end - 1) { int mid = start + (end - start) / 2; if (nums[mid] == nums[start]) { start++; } else if (nums[mid] > nums[start]) { start = mid; } else { end = mid; } } return (nums[start] < nums[end]) ? start : end; } public boolean binarySearch(int[] nums, int target, int start, int end) { if (end < start || start < 0) { return false; } while (start + 1 < end) { int mid = start + (end - start) / 2; if (nums[mid] == target) { return true; } else if (nums[mid] > target) { end = mid; } else { start = mid; } } return (nums[start] == target) || (nums[end] == target); } }
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2015.07.16 at 03:24:22 PM EEST package org.ecloudmanager.tmrk.cloudapi.model; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.*; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ResourceBurstType", propOrder = { "actions", "status" }) public class ResourceBurstType { @XmlElementRef(name = "Actions", type = JAXBElement.class, required = false) protected JAXBElement<ArrayOfActionType> actions; @XmlElement(name = "Status") @XmlSchemaType(name = "string") protected ResourceBurstStatus status; /** * Gets the value of the actions property. * * @return * possible object is * {@link JAXBElement }{@code <}{@link ArrayOfActionType }{@code >} * */ public JAXBElement<ArrayOfActionType> getActions() { return actions; } /** * Sets the value of the actions property. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link ArrayOfActionType }{@code >} * */ public void setActions(JAXBElement<ArrayOfActionType> value) { this.actions = value; } /** * Gets the value of the status property. * * @return * possible object is * {@link ResourceBurstStatus } * */ public ResourceBurstStatus getStatus() { return status; } /** * Sets the value of the status property. * * @param value * allowed object is * {@link ResourceBurstStatus } * */ public void setStatus(ResourceBurstStatus value) { this.status = value; } }
var searchData= [ ['vertical_5fline',['vertical_line',['../<API key>.html#<API key>',1,'AbstractBoard']]] ];
TR_INFO: request information about an active transaction this is the aux. library to encode the request buffer and decode the reply buffer. encode(options_t) -> encoded options string decode(info_buf, info_buf_len) -> decoded info table USAGE: - use it with <API key>() to encode the info request and decode the info result. - see info_codes table below for what you can request and the structure and meaning of the results. ]=] module(...,require 'fbclient.module') local info = require 'fbclient.info' local info_codes = { --read doc\sql.extensions\README.isc_info_xxx from firebird 2.5 sources for more info! isc_info_tra_id = 4, --number: current tran ID number <API key> = 5, --number: oldest interesting tran ID when current tran started (firebird 2.0+) <API key> = 6, --number: min. tran ID of tra_oldest_active (firebird 2.0+) <API key> = 7, --number: oldest active tran ID when current tran started (firebird 2.0+) <API key> = 8, --pair: {one of <API key>, [one of <API key>]}: (firebird 2.0+) isc_info_tra_access = 9, --string: '<API key>' or '<API key>' (firebird 2.0+) <API key> = 10, --number: lock timeout value; fb 2.0+ } local info_code_lookup = index(info_codes) local info_buf_sizes = { isc_info_tra_id = INT_SIZE, <API key> = INT_SIZE, <API key> = INT_SIZE, <API key> = INT_SIZE, <API key> = 1+1, -- for read_commited, you also get rec_version/no_rec_version flag! isc_info_tra_access = 1, <API key> = INT_SIZE, } local <API key> = { <API key> = 1, <API key> = 2, <API key> = 3, } local <API key> = { <API key> = 0, <API key> = 1, } local <API key> = { <API key> = 0, <API key> = 1, } local decoders = { isc_info_tra_id = info.decode_unsigned, <API key> = info.decode_unsigned, <API key> = info.decode_unsigned, <API key> = info.decode_unsigned, <API key> = function(s) local isolation = info.decode_enum(<API key>)(s:sub(1,1)) local read_commited_flag if isolation == '<API key>' then read_commited_flag = info.decode_enum(<API key>)(s:sub(2,2)) end return {isolation, read_commited_flag} end, isc_info_tra_access = info.decode_enum(<API key>), <API key> = info.decode_unsigned, } function encode(opts) return info.encode('TR_INFO', opts, info_codes, info_buf_sizes) end function decode(info_buf, info_buf_len) return info.decode('TR_INFO', info_buf, info_buf_len, info_code_lookup, decoders) end
package runner import ( "strings" "testing" "gopkg.in/stretchr/testify.v1/assert" ) var fuzzList = ` ' " - '%20 '%20; =%20' =%20; =%20 \x23 \x27 \x3D%20\x3B' \x3D%20\x27 \x27\x4F\x52 SELECT * \x27\x6F\x72 SELECT * 'or%20select * admin' <>"'%;)(&+ '%20or%20''=' '%20or%20'x'='x "%20or%20"x"="x ')%20or%20('x'='x 0 or 1=1 ' or 0=0 " or 0=0 or 0=0 ' or 0=0 " or 0=0 or 0=0 ' or 1=1 " or 1=1 ' or '1'='1' "' or 1 or 1=1 or%201=1 or%201=1 ' or 1=1 or ''=' " or 1=1 or ""=" ' or a=a " or "a"="a ') or ('a'='a ") or ("a"="a hi" or "a"="a hi" or 1=1 hi' or 1=1 hi' or 'a'='a hi') or ('a'='a hi") or ("a"="a 'hi' or 'x'='x'; @variable ,@variable PRINT PRINT @@variable select insert as or procedure limit order by asc desc delete update distinct having truncate replace like handler bfilename ' or username like '% ' or uname like '% ' or userid like '% ' or uid like '% ' or user like '% exec xp exec sp '; exec master..xp_cmdshell '; exec xp_regread t'exec master..xp_cmdshell 'nslookup www.google.com' --sp_password \x27UNION SELECT ' UNION SELECT ' UNION ALL SELECT ' or (EXISTS) ' (select top 1 '||UTL_HTTP.REQUEST 1;SELECT%20* to_timestamp_tz tz_offset &lt;&gt;&quot;'%;)(&amp;+ '%20or%201=1 %27%20or%201=1 %20$(sleep%2050) %20'sleep%2050' char%4039%41%2b%40SELECT &apos;%20OR 'sqlattempt1 (sqlattempt2) | %7C *| %2A%7C *(|(mail=*)) %2A%28%7C%28mail%3D%2A%29%29 *(|(objectclass=*)) %2A%28%7C%28objectclass%3D%2A%29%29 ( %28 ) %29 & %26 ! %21 ' or 1=1 or ''=' ' or ''=' x' or 1=1 or 'x'='y / */*
import flask from donut import auth_utils from donut.modules.account import blueprint, helpers @blueprint.route("/request") def request_account(): """Provides a form to request an account.""" return flask.render_template("request_account.html") @blueprint.route("/request/submit", methods=["POST"]) def <API key>(): """Handles an account creation request.""" uid = flask.request.form.get("uid", None) last_name = flask.request.form.get("last_name", None) if uid is None or last_name is None: flask.flash("Invalid request.") return flask.redirect(flask.url_for("account.request_account")) success, error_msg = helpers.<API key>(uid, last_name) if success: flask.flash( "An email has been sent with a link to create your account.") return flask.redirect(flask.url_for("home")) else: flask.flash(error_msg) return flask.redirect(flask.url_for("account.request_account")) @blueprint.route("/create/<create_account_key>") def create_account(create_account_key): """Checks the key. If valid, displays the create account page.""" user_id = auth_utils.<API key>(create_account_key) if user_id is None: flask.current_app.logger.warn( f'Invalid create_account_key: {create_account_key}') flask.flash("Invalid request. Please check your link and try again.") return flask.redirect(flask.url_for("home")) user_data = helpers.get_user_data(user_id) if user_data is None: flask.flash("An unexpected error occurred. Please contact DevTeam.") return flask.redirect(flask.url_for("home")) return flask.render_template( "create_account.html", user_data=user_data, key=create_account_key) @blueprint.route("/create/<create_account_key>/submit", methods=["POST"]) def <API key>(create_account_key): """Handles a create account request.""" user_id = auth_utils.<API key>(create_account_key) if user_id is None: # Key is invalid. flask.current_app.logger.warn( f'Invalid create_account_key: {create_account_key}') flask.flash("Someone's been naughty.") return flask.redirect(flask.url_for("home")) username = flask.request.form.get("username", None) password = flask.request.form.get("password", None) password2 = flask.request.form.get("password2", None) if username is None \ or password is None \ or password2 is None: flask.current_app.logger.warn( f'Invalid create account form for user ID {user_id}') flask.flash("Invalid request.") return flask.redirect(flask.url_for("home")) if helpers.<API key>(user_id, username, password, password2): flask.session['username'] = username flask.current_app.logger.info( f'Created account with username {username} for user ID {user_id}') flask.flash("Account successfully created.") return flask.redirect(flask.url_for("home")) else: # Flashes already handled. return flask.redirect( flask.url_for( "account.create_account", create_account_key=create_account_key))
<!DOCTYPE html> <html ng-app="recoveryApp" lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="bower_components/angular/angular.js"></script> <script type="text/javascript" src="bower_components/sjcl/sjcl.js"></script> <script type="text/javascript" src="bower_components/bitcore/bitcore.min.js"></script> <script type="text/javascript" src="bower_components/bitcore/bitcore.js"></script> <script type="text/javascript" src="bower_components/bitcore-mnemonic/bitcore-mnemonic.min.js"></script> <script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script> <script type="text/javascript" src="bower_components/ng-lodash/build/ng-lodash.min.js"></script> <script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <link rel="stylesheet" href="http://css-spinners.com/css/spinner/hexdots.css" type="text/css"> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="main.css"></link> <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"></script> <script type="text/javascript" src="js/services.js"></script> <script type="text/javascript" src="js/controllers.js"></script> <title>Copay recovery tool</title> </head> <div id="wrapper"> <header class="page-header"> <div class="container"> <img src="./img/logo-white.svg" alt="Copay" width="100" style="vertical-align: middle";> <span class="label">recovery tool</span> <ul class="pull-right"> <li><a href="https://github.com/bitpay/copay-recovery">View the Code</a></li> </ul> </div> </header> <body ng-controller="recoveryController" style="background-color:#F4F6F9"> <div class="container"> <div id="sendBlock" style="display: none;"> <div class="form-group"> <label>{{totalBalance}}</label> <div class="input-group"> <div class="input-group-addon" >Destination Address :</div> <input type="text" class="form-control" ng-model="addr"> </div> </div> <button class="btn btn-primary" ng-click="sendFunds()">Transfer</button><br><br> </div> <div id="inputs"> <h4>Wallet configuration:</h4> <div class="row"> <div class="col-md-3"> <label>Required signatures</label> <select class="pull-right" id="selectM"> <option id="1">1</option> <option id="2">2</option> <option id="3">3</option> <option id="4">4</option> <option id="5">5</option> <option id="6">6</option> </select><br> <label>Total Copayers</label> <select class="pull-right" id="selectN"> <option id="1">1</option> <option id="2">2</option> <option id="3">3</option> <option id="4">4</option> <option id="5">5</option> <option id="6">6</option> </select><br> <label>Network</label> <select class="pull-right" id="selectNet"> <option id="livenet">Livenet</option> <option id="testnet">Testnet</option> </select><br><br> </div> </div> <div class="form-group" id="block1"> <label>Backup for copayer 1:</label> <div class="form-group" id="backup1"> <input type="text" class="form-control" ng-model="backUp[1]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile1"> <label>Or upload a file: </label> <input type="file" ng-model="file1" on-read-file="showContent($fileContent, 1)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password1"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[1]"> </div> <div class="form-goup" id="passwordX1"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[1]" id="passX1"> </div><hr> </div> <div id="block2" style="display: none"> <label>Backup for copayer 2:</label> <br> <div class="form-group" id="backup2"> <input type="text" class="form-control" ng-model="backUp[2]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile2"> <label>Or upload a file: </label> <input type="file" ng-model="file2" on-read-file="showContent($fileContent, 2)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password2"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[2]"> </div> <div class="form-goup" id="passwordX2"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[2]" id="passX2"> </div><hr> </div> <div id="block3" style="display: none"> <label>Backup for copayer 3:</label> <br> <div class="form-group" id="backup3"> <input type="text" class="form-control" ng-model="backUp[3]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile3"> <label>Or upload a file: </label> <input type="file" ng-model="file3" on-read-file="showContent($fileContent, 3)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password3"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[3]"> </div> <div class="form-goup" id="passwordX3"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[3]" id="passX3"> </div><hr> </div> <div id="block4" style="display: none"> <br> <label>Backup for copayer 4:</label> <br> <div class="form-group" id="backup4"> <input type="text" class="form-control" ng-model="backUp[4]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile4"> <label>Or upload a file: </label> <input type="file" ng-model="file4" on-read-file="showContent($fileContent, 4)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password4"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[4]"> </div> <div class="form-goup" id="passwordX4"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[4]" id="passX4"> </div><hr> </div> <div id="block5" style="display: none"> <br> <label>Backup for copayer 5:</label> <br> <div class="form-group" id="backup5"> <input type="text" class="form-control" ng-model="backUp[5]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile5"> <label>Or upload a file: </label> <input type="file" ng-model="file5" on-read-file="showContent($fileContent, 5)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password5"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[5]"> </div> <div class="form-goup" id="passwordX5"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[5]" id="passX5"> </div><hr> </div> <div id="block6" style="display: none"> <br> <label>Backup for copayer 6:</label> <br> <div class="form-group" id="backup6"> <input type="text" class="form-control" ng-model="backUp[6]" placeholder="Mnemonic or export wallet data"> </div> <div class="form-group" id="backupFile6"> <label>Or upload a file: </label> <input type="file" ng-model="file6" on-read-file="showContent($fileContent, 6)" accept="application/json, .txt" style="display: inline"> </div> <div class="form-group" id="password6"> <label>Password:</label> <input type="password" class="form-control" ng-model="pass[6]"> </div> <div class="form-goup" id="passwordX6"> <br> <label>Encrypted private key password (in case you have one):</label> <input type="password" class="form-control" ng-model="passX[6]" id="passX6"> </div><hr> </div> <button class="btn btn-primary" ng-click="proccessInputs()">Scan wallet</button><br><br> </div> <div class="modal fade" id="myModal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog" style="position: absolute;display: block;top: 50%;left: 50%;"> <!-- Modal content--> <div class="hexdots-loader" ></div> </div> </div> <div id="successMessage" class="alert alert-success" style="display: none;"> {{successMessage}} </div> <div id="errorMessage" class="alert alert-danger" style="display: none;"> {{errorMessage}} </div> <div id="statusMessage" class="alert alert-info" style="display: none;"> {{statusMessage}} </div> </div> </body> <footer class="page-footer"> <div id="back" style="display: none"> <ul> <li><a href="http://bitpay.github.io/copay-recovery/">Back</a></li> </ul> </div> </footer> </div> </html>
package org.ominidi.api.controller; import org.ominidi.api.exception.ConnectionException; import org.ominidi.api.exception.NotFoundException; import org.ominidi.api.model.Errors; import org.ominidi.domain.model.Feed; import org.ominidi.domain.model.Post; import org.ominidi.facebook.service.PageFeedService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.Optional; @RestController @RequestMapping("/api/v1") public class FeedController { private PageFeedService pageFeedService; @Autowired public FeedController(PageFeedService pageFeedService) { this.pageFeedService = pageFeedService; } @GetMapping(value = "/feed", produces = MediaType.<API key>) public Feed<Post> getFeed(@RequestParam(value = "u", required = false) Optional<String> feedUrl) { Optional<Feed<Post>> result = feedUrl.isPresent() ? pageFeedService.getFeed(feedUrl.get()) : pageFeedService.getFeed(); return result.orElseThrow(() -> new ConnectionException(Errors.CONNECTION_PROBLEM)); } @GetMapping(value = "/post/{id}", produces = MediaType.<API key>) public Post getPost(@PathVariable(value = "id") String id) { return pageFeedService.getPostById(id).orElseThrow(() -> new NotFoundException(Errors.postNotFound(id))); } }
#include "jsonobject.h" #include "jsonparser.h" namespace amgcommon { namespace json { JsonObject::JsonObject(string rawJson) { this->originalJson = rawJson; this->root = JsonNode(); } JsonObject::JsonObject(const JsonObject &a) { this->originalJson = a.originalJson; this->root = a.root; } JsonObject *JsonObject::clone() { return new JsonObject(*this); } JsonObject::~JsonObject() { } string JsonObject::toString() { return this->root.toString(); } JsonNode JsonObject::getRoot() { return root; } void JsonObject::setKey(string path, Object *value) { this->root.setKey(path, value); } Object *JsonObject::getKey(string path) { return this->root.getKey(path); } } }
default rel %define XMMWORD %define YMMWORD %define ZMMWORD section .text code align=64 EXTERN OPENSSL_ia32cap_P global <API key> ALIGN 16 <API key>: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$<API key>: mov rdi,rcx mov rsi,rdx mov rdx,r8 lea r10,[OPENSSL_ia32cap_P] mov r9d,DWORD[r10] mov r8d,DWORD[4+r10] mov r10d,DWORD[8+r10] test r8d,512 jz NEAR $L$ialu and r8d,268435456 and r9d,1073741824 or r8d,r9d cmp r8d,1342177280 je NEAR _avx_shortcut jmp NEAR _ssse3_shortcut ALIGN 16 $L$ialu: mov rax,rsp push rbx push rbp push r12 push r13 push r14 mov r8,rdi sub rsp,72 mov r9,rsi and rsp,-64 mov r10,rdx mov QWORD[64+rsp],rax $L$prologue: mov esi,DWORD[r8] mov edi,DWORD[4+r8] mov r11d,DWORD[8+r8] mov r12d,DWORD[12+r8] mov r13d,DWORD[16+r8] jmp NEAR $L$loop ALIGN 16 $L$loop: mov edx,DWORD[r9] bswap edx mov ebp,DWORD[4+r9] mov eax,r12d mov DWORD[rsp],edx mov ecx,esi bswap ebp xor eax,r11d rol ecx,5 and eax,edi lea r13d,[1518500249+r13*1+rdx] add r13d,ecx xor eax,r12d rol edi,30 add r13d,eax mov r14d,DWORD[8+r9] mov eax,r11d mov DWORD[4+rsp],ebp mov ecx,r13d bswap r14d xor eax,edi rol ecx,5 and eax,esi lea r12d,[1518500249+r12*1+rbp] add r12d,ecx xor eax,r11d rol esi,30 add r12d,eax mov edx,DWORD[12+r9] mov eax,edi mov DWORD[8+rsp],r14d mov ecx,r12d bswap edx xor eax,esi rol ecx,5 and eax,r13d lea r11d,[1518500249+r11*1+r14] add r11d,ecx xor eax,edi rol r13d,30 add r11d,eax mov ebp,DWORD[16+r9] mov eax,esi mov DWORD[12+rsp],edx mov ecx,r11d bswap ebp xor eax,r13d rol ecx,5 and eax,r12d lea edi,[1518500249+rdi*1+rdx] add edi,ecx xor eax,esi rol r12d,30 add edi,eax mov r14d,DWORD[20+r9] mov eax,r13d mov DWORD[16+rsp],ebp mov ecx,edi bswap r14d xor eax,r12d rol ecx,5 and eax,r11d lea esi,[1518500249+rsi*1+rbp] add esi,ecx xor eax,r13d rol r11d,30 add esi,eax mov edx,DWORD[24+r9] mov eax,r12d mov DWORD[20+rsp],r14d mov ecx,esi bswap edx xor eax,r11d rol ecx,5 and eax,edi lea r13d,[1518500249+r13*1+r14] add r13d,ecx xor eax,r12d rol edi,30 add r13d,eax mov ebp,DWORD[28+r9] mov eax,r11d mov DWORD[24+rsp],edx mov ecx,r13d bswap ebp xor eax,edi rol ecx,5 and eax,esi lea r12d,[1518500249+r12*1+rdx] add r12d,ecx xor eax,r11d rol esi,30 add r12d,eax mov r14d,DWORD[32+r9] mov eax,edi mov DWORD[28+rsp],ebp mov ecx,r12d bswap r14d xor eax,esi rol ecx,5 and eax,r13d lea r11d,[1518500249+r11*1+rbp] add r11d,ecx xor eax,edi rol r13d,30 add r11d,eax mov edx,DWORD[36+r9] mov eax,esi mov DWORD[32+rsp],r14d mov ecx,r11d bswap edx xor eax,r13d rol ecx,5 and eax,r12d lea edi,[1518500249+rdi*1+r14] add edi,ecx xor eax,esi rol r12d,30 add edi,eax mov ebp,DWORD[40+r9] mov eax,r13d mov DWORD[36+rsp],edx mov ecx,edi bswap ebp xor eax,r12d rol ecx,5 and eax,r11d lea esi,[1518500249+rsi*1+rdx] add esi,ecx xor eax,r13d rol r11d,30 add esi,eax mov r14d,DWORD[44+r9] mov eax,r12d mov DWORD[40+rsp],ebp mov ecx,esi bswap r14d xor eax,r11d rol ecx,5 and eax,edi lea r13d,[1518500249+r13*1+rbp] add r13d,ecx xor eax,r12d rol edi,30 add r13d,eax mov edx,DWORD[48+r9] mov eax,r11d mov DWORD[44+rsp],r14d mov ecx,r13d bswap edx xor eax,edi rol ecx,5 and eax,esi lea r12d,[1518500249+r12*1+r14] add r12d,ecx xor eax,r11d rol esi,30 add r12d,eax mov ebp,DWORD[52+r9] mov eax,edi mov DWORD[48+rsp],edx mov ecx,r12d bswap ebp xor eax,esi rol ecx,5 and eax,r13d lea r11d,[1518500249+r11*1+rdx] add r11d,ecx xor eax,edi rol r13d,30 add r11d,eax mov r14d,DWORD[56+r9] mov eax,esi mov DWORD[52+rsp],ebp mov ecx,r11d bswap r14d xor eax,r13d rol ecx,5 and eax,r12d lea edi,[1518500249+rdi*1+rbp] add edi,ecx xor eax,esi rol r12d,30 add edi,eax mov edx,DWORD[60+r9] mov eax,r13d mov DWORD[56+rsp],r14d mov ecx,edi bswap edx xor eax,r12d rol ecx,5 and eax,r11d lea esi,[1518500249+rsi*1+r14] add esi,ecx xor eax,r13d rol r11d,30 add esi,eax xor ebp,DWORD[rsp] mov eax,r12d mov DWORD[60+rsp],edx mov ecx,esi xor ebp,DWORD[8+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[32+rsp] and eax,edi lea r13d,[1518500249+r13*1+rdx] rol edi,30 xor eax,r12d add r13d,ecx rol ebp,1 add r13d,eax xor r14d,DWORD[4+rsp] mov eax,r11d mov DWORD[rsp],ebp mov ecx,r13d xor r14d,DWORD[12+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[36+rsp] and eax,esi lea r12d,[1518500249+r12*1+rbp] rol esi,30 xor eax,r11d add r12d,ecx rol r14d,1 add r12d,eax xor edx,DWORD[8+rsp] mov eax,edi mov DWORD[4+rsp],r14d mov ecx,r12d xor edx,DWORD[16+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[40+rsp] and eax,r13d lea r11d,[1518500249+r11*1+r14] rol r13d,30 xor eax,edi add r11d,ecx rol edx,1 add r11d,eax xor ebp,DWORD[12+rsp] mov eax,esi mov DWORD[8+rsp],edx mov ecx,r11d xor ebp,DWORD[20+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[44+rsp] and eax,r12d lea edi,[1518500249+rdi*1+rdx] rol r12d,30 xor eax,esi add edi,ecx rol ebp,1 add edi,eax xor r14d,DWORD[16+rsp] mov eax,r13d mov DWORD[12+rsp],ebp mov ecx,edi xor r14d,DWORD[24+rsp] xor eax,r12d rol ecx,5 xor r14d,DWORD[48+rsp] and eax,r11d lea esi,[1518500249+rsi*1+rbp] rol r11d,30 xor eax,r13d add esi,ecx rol r14d,1 add esi,eax xor edx,DWORD[20+rsp] mov eax,edi mov DWORD[16+rsp],r14d mov ecx,esi xor edx,DWORD[28+rsp] xor eax,r12d rol ecx,5 xor edx,DWORD[52+rsp] lea r13d,[1859775393+r13*1+r14] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol edx,1 xor ebp,DWORD[24+rsp] mov eax,esi mov DWORD[20+rsp],edx mov ecx,r13d xor ebp,DWORD[32+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[56+rsp] lea r12d,[1859775393+r12*1+rdx] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol ebp,1 xor r14d,DWORD[28+rsp] mov eax,r13d mov DWORD[24+rsp],ebp mov ecx,r12d xor r14d,DWORD[36+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[60+rsp] lea r11d,[1859775393+r11*1+rbp] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol r14d,1 xor edx,DWORD[32+rsp] mov eax,r12d mov DWORD[28+rsp],r14d mov ecx,r11d xor edx,DWORD[40+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[rsp] lea edi,[1859775393+rdi*1+r14] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol edx,1 xor ebp,DWORD[36+rsp] mov eax,r11d mov DWORD[32+rsp],edx mov ecx,edi xor ebp,DWORD[44+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[4+rsp] lea esi,[1859775393+rsi*1+rdx] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol ebp,1 xor r14d,DWORD[40+rsp] mov eax,edi mov DWORD[36+rsp],ebp mov ecx,esi xor r14d,DWORD[48+rsp] xor eax,r12d rol ecx,5 xor r14d,DWORD[8+rsp] lea r13d,[1859775393+r13*1+rbp] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol r14d,1 xor edx,DWORD[44+rsp] mov eax,esi mov DWORD[40+rsp],r14d mov ecx,r13d xor edx,DWORD[52+rsp] xor eax,r11d rol ecx,5 xor edx,DWORD[12+rsp] lea r12d,[1859775393+r12*1+r14] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol edx,1 xor ebp,DWORD[48+rsp] mov eax,r13d mov DWORD[44+rsp],edx mov ecx,r12d xor ebp,DWORD[56+rsp] xor eax,edi rol ecx,5 xor ebp,DWORD[16+rsp] lea r11d,[1859775393+r11*1+rdx] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol ebp,1 xor r14d,DWORD[52+rsp] mov eax,r12d mov DWORD[48+rsp],ebp mov ecx,r11d xor r14d,DWORD[60+rsp] xor eax,esi rol ecx,5 xor r14d,DWORD[20+rsp] lea edi,[1859775393+rdi*1+rbp] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol r14d,1 xor edx,DWORD[56+rsp] mov eax,r11d mov DWORD[52+rsp],r14d mov ecx,edi xor edx,DWORD[rsp] xor eax,r13d rol ecx,5 xor edx,DWORD[24+rsp] lea esi,[1859775393+rsi*1+r14] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol edx,1 xor ebp,DWORD[60+rsp] mov eax,edi mov DWORD[56+rsp],edx mov ecx,esi xor ebp,DWORD[4+rsp] xor eax,r12d rol ecx,5 xor ebp,DWORD[28+rsp] lea r13d,[1859775393+r13*1+rdx] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol ebp,1 xor r14d,DWORD[rsp] mov eax,esi mov DWORD[60+rsp],ebp mov ecx,r13d xor r14d,DWORD[8+rsp] xor eax,r11d rol ecx,5 xor r14d,DWORD[32+rsp] lea r12d,[1859775393+r12*1+rbp] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol r14d,1 xor edx,DWORD[4+rsp] mov eax,r13d mov DWORD[rsp],r14d mov ecx,r12d xor edx,DWORD[12+rsp] xor eax,edi rol ecx,5 xor edx,DWORD[36+rsp] lea r11d,[1859775393+r11*1+r14] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol edx,1 xor ebp,DWORD[8+rsp] mov eax,r12d mov DWORD[4+rsp],edx mov ecx,r11d xor ebp,DWORD[16+rsp] xor eax,esi rol ecx,5 xor ebp,DWORD[40+rsp] lea edi,[1859775393+rdi*1+rdx] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol ebp,1 xor r14d,DWORD[12+rsp] mov eax,r11d mov DWORD[8+rsp],ebp mov ecx,edi xor r14d,DWORD[20+rsp] xor eax,r13d rol ecx,5 xor r14d,DWORD[44+rsp] lea esi,[1859775393+rsi*1+rbp] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol r14d,1 xor edx,DWORD[16+rsp] mov eax,edi mov DWORD[12+rsp],r14d mov ecx,esi xor edx,DWORD[24+rsp] xor eax,r12d rol ecx,5 xor edx,DWORD[48+rsp] lea r13d,[1859775393+r13*1+r14] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol edx,1 xor ebp,DWORD[20+rsp] mov eax,esi mov DWORD[16+rsp],edx mov ecx,r13d xor ebp,DWORD[28+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[52+rsp] lea r12d,[1859775393+r12*1+rdx] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol ebp,1 xor r14d,DWORD[24+rsp] mov eax,r13d mov DWORD[20+rsp],ebp mov ecx,r12d xor r14d,DWORD[32+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[56+rsp] lea r11d,[1859775393+r11*1+rbp] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol r14d,1 xor edx,DWORD[28+rsp] mov eax,r12d mov DWORD[24+rsp],r14d mov ecx,r11d xor edx,DWORD[36+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[60+rsp] lea edi,[1859775393+rdi*1+r14] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol edx,1 xor ebp,DWORD[32+rsp] mov eax,r11d mov DWORD[28+rsp],edx mov ecx,edi xor ebp,DWORD[40+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[rsp] lea esi,[1859775393+rsi*1+rdx] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol ebp,1 xor r14d,DWORD[36+rsp] mov eax,r12d mov DWORD[32+rsp],ebp mov ebx,r12d xor r14d,DWORD[44+rsp] and eax,r11d mov ecx,esi xor r14d,DWORD[4+rsp] lea r13d,[((-1894007588))+r13*1+rbp] xor ebx,r11d rol ecx,5 add r13d,eax rol r14d,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor edx,DWORD[40+rsp] mov eax,r11d mov DWORD[36+rsp],r14d mov ebx,r11d xor edx,DWORD[48+rsp] and eax,edi mov ecx,r13d xor edx,DWORD[8+rsp] lea r12d,[((-1894007588))+r12*1+r14] xor ebx,edi rol ecx,5 add r12d,eax rol edx,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor ebp,DWORD[44+rsp] mov eax,edi mov DWORD[40+rsp],edx mov ebx,edi xor ebp,DWORD[52+rsp] and eax,esi mov ecx,r12d xor ebp,DWORD[12+rsp] lea r11d,[((-1894007588))+r11*1+rdx] xor ebx,esi rol ecx,5 add r11d,eax rol ebp,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor r14d,DWORD[48+rsp] mov eax,esi mov DWORD[44+rsp],ebp mov ebx,esi xor r14d,DWORD[56+rsp] and eax,r13d mov ecx,r11d xor r14d,DWORD[16+rsp] lea edi,[((-1894007588))+rdi*1+rbp] xor ebx,r13d rol ecx,5 add edi,eax rol r14d,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor edx,DWORD[52+rsp] mov eax,r13d mov DWORD[48+rsp],r14d mov ebx,r13d xor edx,DWORD[60+rsp] and eax,r12d mov ecx,edi xor edx,DWORD[20+rsp] lea esi,[((-1894007588))+rsi*1+r14] xor ebx,r12d rol ecx,5 add esi,eax rol edx,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor ebp,DWORD[56+rsp] mov eax,r12d mov DWORD[52+rsp],edx mov ebx,r12d xor ebp,DWORD[rsp] and eax,r11d mov ecx,esi xor ebp,DWORD[24+rsp] lea r13d,[((-1894007588))+r13*1+rdx] xor ebx,r11d rol ecx,5 add r13d,eax rol ebp,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor r14d,DWORD[60+rsp] mov eax,r11d mov DWORD[56+rsp],ebp mov ebx,r11d xor r14d,DWORD[4+rsp] and eax,edi mov ecx,r13d xor r14d,DWORD[28+rsp] lea r12d,[((-1894007588))+r12*1+rbp] xor ebx,edi rol ecx,5 add r12d,eax rol r14d,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor edx,DWORD[rsp] mov eax,edi mov DWORD[60+rsp],r14d mov ebx,edi xor edx,DWORD[8+rsp] and eax,esi mov ecx,r12d xor edx,DWORD[32+rsp] lea r11d,[((-1894007588))+r11*1+r14] xor ebx,esi rol ecx,5 add r11d,eax rol edx,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor ebp,DWORD[4+rsp] mov eax,esi mov DWORD[rsp],edx mov ebx,esi xor ebp,DWORD[12+rsp] and eax,r13d mov ecx,r11d xor ebp,DWORD[36+rsp] lea edi,[((-1894007588))+rdi*1+rdx] xor ebx,r13d rol ecx,5 add edi,eax rol ebp,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor r14d,DWORD[8+rsp] mov eax,r13d mov DWORD[4+rsp],ebp mov ebx,r13d xor r14d,DWORD[16+rsp] and eax,r12d mov ecx,edi xor r14d,DWORD[40+rsp] lea esi,[((-1894007588))+rsi*1+rbp] xor ebx,r12d rol ecx,5 add esi,eax rol r14d,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor edx,DWORD[12+rsp] mov eax,r12d mov DWORD[8+rsp],r14d mov ebx,r12d xor edx,DWORD[20+rsp] and eax,r11d mov ecx,esi xor edx,DWORD[44+rsp] lea r13d,[((-1894007588))+r13*1+r14] xor ebx,r11d rol ecx,5 add r13d,eax rol edx,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor ebp,DWORD[16+rsp] mov eax,r11d mov DWORD[12+rsp],edx mov ebx,r11d xor ebp,DWORD[24+rsp] and eax,edi mov ecx,r13d xor ebp,DWORD[48+rsp] lea r12d,[((-1894007588))+r12*1+rdx] xor ebx,edi rol ecx,5 add r12d,eax rol ebp,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor r14d,DWORD[20+rsp] mov eax,edi mov DWORD[16+rsp],ebp mov ebx,edi xor r14d,DWORD[28+rsp] and eax,esi mov ecx,r12d xor r14d,DWORD[52+rsp] lea r11d,[((-1894007588))+r11*1+rbp] xor ebx,esi rol ecx,5 add r11d,eax rol r14d,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor edx,DWORD[24+rsp] mov eax,esi mov DWORD[20+rsp],r14d mov ebx,esi xor edx,DWORD[32+rsp] and eax,r13d mov ecx,r11d xor edx,DWORD[56+rsp] lea edi,[((-1894007588))+rdi*1+r14] xor ebx,r13d rol ecx,5 add edi,eax rol edx,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor ebp,DWORD[28+rsp] mov eax,r13d mov DWORD[24+rsp],edx mov ebx,r13d xor ebp,DWORD[36+rsp] and eax,r12d mov ecx,edi xor ebp,DWORD[60+rsp] lea esi,[((-1894007588))+rsi*1+rdx] xor ebx,r12d rol ecx,5 add esi,eax rol ebp,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor r14d,DWORD[32+rsp] mov eax,r12d mov DWORD[28+rsp],ebp mov ebx,r12d xor r14d,DWORD[40+rsp] and eax,r11d mov ecx,esi xor r14d,DWORD[rsp] lea r13d,[((-1894007588))+r13*1+rbp] xor ebx,r11d rol ecx,5 add r13d,eax rol r14d,1 and ebx,edi add r13d,ecx rol edi,30 add r13d,ebx xor edx,DWORD[36+rsp] mov eax,r11d mov DWORD[32+rsp],r14d mov ebx,r11d xor edx,DWORD[44+rsp] and eax,edi mov ecx,r13d xor edx,DWORD[4+rsp] lea r12d,[((-1894007588))+r12*1+r14] xor ebx,edi rol ecx,5 add r12d,eax rol edx,1 and ebx,esi add r12d,ecx rol esi,30 add r12d,ebx xor ebp,DWORD[40+rsp] mov eax,edi mov DWORD[36+rsp],edx mov ebx,edi xor ebp,DWORD[48+rsp] and eax,esi mov ecx,r12d xor ebp,DWORD[8+rsp] lea r11d,[((-1894007588))+r11*1+rdx] xor ebx,esi rol ecx,5 add r11d,eax rol ebp,1 and ebx,r13d add r11d,ecx rol r13d,30 add r11d,ebx xor r14d,DWORD[44+rsp] mov eax,esi mov DWORD[40+rsp],ebp mov ebx,esi xor r14d,DWORD[52+rsp] and eax,r13d mov ecx,r11d xor r14d,DWORD[12+rsp] lea edi,[((-1894007588))+rdi*1+rbp] xor ebx,r13d rol ecx,5 add edi,eax rol r14d,1 and ebx,r12d add edi,ecx rol r12d,30 add edi,ebx xor edx,DWORD[48+rsp] mov eax,r13d mov DWORD[44+rsp],r14d mov ebx,r13d xor edx,DWORD[56+rsp] and eax,r12d mov ecx,edi xor edx,DWORD[16+rsp] lea esi,[((-1894007588))+rsi*1+r14] xor ebx,r12d rol ecx,5 add esi,eax rol edx,1 and ebx,r11d add esi,ecx rol r11d,30 add esi,ebx xor ebp,DWORD[52+rsp] mov eax,edi mov DWORD[48+rsp],edx mov ecx,esi xor ebp,DWORD[60+rsp] xor eax,r12d rol ecx,5 xor ebp,DWORD[20+rsp] lea r13d,[((-899497514))+r13*1+rdx] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol ebp,1 xor r14d,DWORD[56+rsp] mov eax,esi mov DWORD[52+rsp],ebp mov ecx,r13d xor r14d,DWORD[rsp] xor eax,r11d rol ecx,5 xor r14d,DWORD[24+rsp] lea r12d,[((-899497514))+r12*1+rbp] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol r14d,1 xor edx,DWORD[60+rsp] mov eax,r13d mov DWORD[56+rsp],r14d mov ecx,r12d xor edx,DWORD[4+rsp] xor eax,edi rol ecx,5 xor edx,DWORD[28+rsp] lea r11d,[((-899497514))+r11*1+r14] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol edx,1 xor ebp,DWORD[rsp] mov eax,r12d mov DWORD[60+rsp],edx mov ecx,r11d xor ebp,DWORD[8+rsp] xor eax,esi rol ecx,5 xor ebp,DWORD[32+rsp] lea edi,[((-899497514))+rdi*1+rdx] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol ebp,1 xor r14d,DWORD[4+rsp] mov eax,r11d mov DWORD[rsp],ebp mov ecx,edi xor r14d,DWORD[12+rsp] xor eax,r13d rol ecx,5 xor r14d,DWORD[36+rsp] lea esi,[((-899497514))+rsi*1+rbp] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol r14d,1 xor edx,DWORD[8+rsp] mov eax,edi mov DWORD[4+rsp],r14d mov ecx,esi xor edx,DWORD[16+rsp] xor eax,r12d rol ecx,5 xor edx,DWORD[40+rsp] lea r13d,[((-899497514))+r13*1+r14] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol edx,1 xor ebp,DWORD[12+rsp] mov eax,esi mov DWORD[8+rsp],edx mov ecx,r13d xor ebp,DWORD[20+rsp] xor eax,r11d rol ecx,5 xor ebp,DWORD[44+rsp] lea r12d,[((-899497514))+r12*1+rdx] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol ebp,1 xor r14d,DWORD[16+rsp] mov eax,r13d mov DWORD[12+rsp],ebp mov ecx,r12d xor r14d,DWORD[24+rsp] xor eax,edi rol ecx,5 xor r14d,DWORD[48+rsp] lea r11d,[((-899497514))+r11*1+rbp] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol r14d,1 xor edx,DWORD[20+rsp] mov eax,r12d mov DWORD[16+rsp],r14d mov ecx,r11d xor edx,DWORD[28+rsp] xor eax,esi rol ecx,5 xor edx,DWORD[52+rsp] lea edi,[((-899497514))+rdi*1+r14] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol edx,1 xor ebp,DWORD[24+rsp] mov eax,r11d mov DWORD[20+rsp],edx mov ecx,edi xor ebp,DWORD[32+rsp] xor eax,r13d rol ecx,5 xor ebp,DWORD[56+rsp] lea esi,[((-899497514))+rsi*1+rdx] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol ebp,1 xor r14d,DWORD[28+rsp] mov eax,edi mov DWORD[24+rsp],ebp mov ecx,esi xor r14d,DWORD[36+rsp] xor eax,r12d rol ecx,5 xor r14d,DWORD[60+rsp] lea r13d,[((-899497514))+r13*1+rbp] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol r14d,1 xor edx,DWORD[32+rsp] mov eax,esi mov DWORD[28+rsp],r14d mov ecx,r13d xor edx,DWORD[40+rsp] xor eax,r11d rol ecx,5 xor edx,DWORD[rsp] lea r12d,[((-899497514))+r12*1+r14] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol edx,1 xor ebp,DWORD[36+rsp] mov eax,r13d mov ecx,r12d xor ebp,DWORD[44+rsp] xor eax,edi rol ecx,5 xor ebp,DWORD[4+rsp] lea r11d,[((-899497514))+r11*1+rdx] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol ebp,1 xor r14d,DWORD[40+rsp] mov eax,r12d mov ecx,r11d xor r14d,DWORD[48+rsp] xor eax,esi rol ecx,5 xor r14d,DWORD[8+rsp] lea edi,[((-899497514))+rdi*1+rbp] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol r14d,1 xor edx,DWORD[44+rsp] mov eax,r11d mov ecx,edi xor edx,DWORD[52+rsp] xor eax,r13d rol ecx,5 xor edx,DWORD[12+rsp] lea esi,[((-899497514))+rsi*1+r14] xor eax,r12d add esi,ecx rol r11d,30 add esi,eax rol edx,1 xor ebp,DWORD[48+rsp] mov eax,edi mov ecx,esi xor ebp,DWORD[56+rsp] xor eax,r12d rol ecx,5 xor ebp,DWORD[16+rsp] lea r13d,[((-899497514))+r13*1+rdx] xor eax,r11d add r13d,ecx rol edi,30 add r13d,eax rol ebp,1 xor r14d,DWORD[52+rsp] mov eax,esi mov ecx,r13d xor r14d,DWORD[60+rsp] xor eax,r11d rol ecx,5 xor r14d,DWORD[20+rsp] lea r12d,[((-899497514))+r12*1+rbp] xor eax,edi add r12d,ecx rol esi,30 add r12d,eax rol r14d,1 xor edx,DWORD[56+rsp] mov eax,r13d mov ecx,r12d xor edx,DWORD[rsp] xor eax,edi rol ecx,5 xor edx,DWORD[24+rsp] lea r11d,[((-899497514))+r11*1+r14] xor eax,esi add r11d,ecx rol r13d,30 add r11d,eax rol edx,1 xor ebp,DWORD[60+rsp] mov eax,r12d mov ecx,r11d xor ebp,DWORD[4+rsp] xor eax,esi rol ecx,5 xor ebp,DWORD[28+rsp] lea edi,[((-899497514))+rdi*1+rdx] xor eax,r13d add edi,ecx rol r12d,30 add edi,eax rol ebp,1 mov eax,r11d mov ecx,edi xor eax,r13d lea esi,[((-899497514))+rsi*1+rbp] rol ecx,5 xor eax,r12d add esi,ecx rol r11d,30 add esi,eax add esi,DWORD[r8] add edi,DWORD[4+r8] add r11d,DWORD[8+r8] add r12d,DWORD[12+r8] add r13d,DWORD[16+r8] mov DWORD[r8],esi mov DWORD[4+r8],edi mov DWORD[8+r8],r11d mov DWORD[12+r8],r12d mov DWORD[16+r8],r13d sub r10,1 lea r9,[64+r9] jnz NEAR $L$loop mov rsi,QWORD[64+rsp] mov r14,QWORD[((-40))+rsi] mov r13,QWORD[((-32))+rsi] mov r12,QWORD[((-24))+rsi] mov rbp,QWORD[((-16))+rsi] mov rbx,QWORD[((-8))+rsi] lea rsp,[rsi] $L$epilogue: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$<API key>: ALIGN 16 <API key>: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$<API key>: mov rdi,rcx mov rsi,rdx mov rdx,r8 _ssse3_shortcut: mov r11,rsp push rbx push rbp push r12 push r13 push r14 lea rsp,[((-160))+rsp] movaps XMMWORD[(-40-96)+r11],xmm6 movaps XMMWORD[(-40-80)+r11],xmm7 movaps XMMWORD[(-40-64)+r11],xmm8 movaps XMMWORD[(-40-48)+r11],xmm9 movaps XMMWORD[(-40-32)+r11],xmm10 movaps XMMWORD[(-40-16)+r11],xmm11 $L$prologue_ssse3: and rsp,-64 mov r8,rdi mov r9,rsi mov r10,rdx shl r10,6 add r10,r9 lea r14,[((K_XX_XX+64))] mov eax,DWORD[r8] mov ebx,DWORD[4+r8] mov ecx,DWORD[8+r8] mov edx,DWORD[12+r8] mov esi,ebx mov ebp,DWORD[16+r8] mov edi,ecx xor edi,edx and esi,edi movdqa xmm6,XMMWORD[64+r14] movdqa xmm9,XMMWORD[((-64))+r14] movdqu xmm0,XMMWORD[r9] movdqu xmm1,XMMWORD[16+r9] movdqu xmm2,XMMWORD[32+r9] movdqu xmm3,XMMWORD[48+r9] DB 102,15,56,0,198 DB 102,15,56,0,206 DB 102,15,56,0,214 add r9,64 paddd xmm0,xmm9 DB 102,15,56,0,222 paddd xmm1,xmm9 paddd xmm2,xmm9 movdqa XMMWORD[rsp],xmm0 psubd xmm0,xmm9 movdqa XMMWORD[16+rsp],xmm1 psubd xmm1,xmm9 movdqa XMMWORD[32+rsp],xmm2 psubd xmm2,xmm9 jmp NEAR $L$oop_ssse3 ALIGN 16 $L$oop_ssse3: ror ebx,2 pshufd xmm4,xmm0,238 xor esi,edx movdqa xmm8,xmm3 paddd xmm9,xmm3 mov edi,eax add ebp,DWORD[rsp] punpcklqdq xmm4,xmm1 xor ebx,ecx rol eax,5 add ebp,esi psrldq xmm8,4 and edi,ebx xor ebx,ecx pxor xmm4,xmm0 add ebp,eax ror eax,7 pxor xmm8,xmm2 xor edi,ecx mov esi,ebp add edx,DWORD[4+rsp] pxor xmm4,xmm8 xor eax,ebx rol ebp,5 movdqa XMMWORD[48+rsp],xmm9 add edx,edi and esi,eax movdqa xmm10,xmm4 xor eax,ebx add edx,ebp ror ebp,7 movdqa xmm8,xmm4 xor esi,ebx pslldq xmm10,12 paddd xmm4,xmm4 mov edi,edx add ecx,DWORD[8+rsp] psrld xmm8,31 xor ebp,eax rol edx,5 add ecx,esi movdqa xmm9,xmm10 and edi,ebp xor ebp,eax psrld xmm10,30 add ecx,edx ror edx,7 por xmm4,xmm8 xor edi,eax mov esi,ecx add ebx,DWORD[12+rsp] pslld xmm9,2 pxor xmm4,xmm10 xor edx,ebp movdqa xmm10,XMMWORD[((-64))+r14] rol ecx,5 add ebx,edi and esi,edx pxor xmm4,xmm9 xor edx,ebp add ebx,ecx ror ecx,7 pshufd xmm5,xmm1,238 xor esi,ebp movdqa xmm9,xmm4 paddd xmm10,xmm4 mov edi,ebx add eax,DWORD[16+rsp] punpcklqdq xmm5,xmm2 xor ecx,edx rol ebx,5 add eax,esi psrldq xmm9,4 and edi,ecx xor ecx,edx pxor xmm5,xmm1 add eax,ebx ror ebx,7 pxor xmm9,xmm3 xor edi,edx mov esi,eax add ebp,DWORD[20+rsp] pxor xmm5,xmm9 xor ebx,ecx rol eax,5 movdqa XMMWORD[rsp],xmm10 add ebp,edi and esi,ebx movdqa xmm8,xmm5 xor ebx,ecx add ebp,eax ror eax,7 movdqa xmm9,xmm5 xor esi,ecx pslldq xmm8,12 paddd xmm5,xmm5 mov edi,ebp add edx,DWORD[24+rsp] psrld xmm9,31 xor eax,ebx rol ebp,5 add edx,esi movdqa xmm10,xmm8 and edi,eax xor eax,ebx psrld xmm8,30 add edx,ebp ror ebp,7 por xmm5,xmm9 xor edi,ebx mov esi,edx add ecx,DWORD[28+rsp] pslld xmm10,2 pxor xmm5,xmm8 xor ebp,eax movdqa xmm8,XMMWORD[((-32))+r14] rol edx,5 add ecx,edi and esi,ebp pxor xmm5,xmm10 xor ebp,eax add ecx,edx ror edx,7 pshufd xmm6,xmm2,238 xor esi,eax movdqa xmm10,xmm5 paddd xmm8,xmm5 mov edi,ecx add ebx,DWORD[32+rsp] punpcklqdq xmm6,xmm3 xor edx,ebp rol ecx,5 add ebx,esi psrldq xmm10,4 and edi,edx xor edx,ebp pxor xmm6,xmm2 add ebx,ecx ror ecx,7 pxor xmm10,xmm4 xor edi,ebp mov esi,ebx add eax,DWORD[36+rsp] pxor xmm6,xmm10 xor ecx,edx rol ebx,5 movdqa XMMWORD[16+rsp],xmm8 add eax,edi and esi,ecx movdqa xmm9,xmm6 xor ecx,edx add eax,ebx ror ebx,7 movdqa xmm10,xmm6 xor esi,edx pslldq xmm9,12 paddd xmm6,xmm6 mov edi,eax add ebp,DWORD[40+rsp] psrld xmm10,31 xor ebx,ecx rol eax,5 add ebp,esi movdqa xmm8,xmm9 and edi,ebx xor ebx,ecx psrld xmm9,30 add ebp,eax ror eax,7 por xmm6,xmm10 xor edi,ecx mov esi,ebp add edx,DWORD[44+rsp] pslld xmm8,2 pxor xmm6,xmm9 xor eax,ebx movdqa xmm9,XMMWORD[((-32))+r14] rol ebp,5 add edx,edi and esi,eax pxor xmm6,xmm8 xor eax,ebx add edx,ebp ror ebp,7 pshufd xmm7,xmm3,238 xor esi,ebx movdqa xmm8,xmm6 paddd xmm9,xmm6 mov edi,edx add ecx,DWORD[48+rsp] punpcklqdq xmm7,xmm4 xor ebp,eax rol edx,5 add ecx,esi psrldq xmm8,4 and edi,ebp xor ebp,eax pxor xmm7,xmm3 add ecx,edx ror edx,7 pxor xmm8,xmm5 xor edi,eax mov esi,ecx add ebx,DWORD[52+rsp] pxor xmm7,xmm8 xor edx,ebp rol ecx,5 movdqa XMMWORD[32+rsp],xmm9 add ebx,edi and esi,edx movdqa xmm10,xmm7 xor edx,ebp add ebx,ecx ror ecx,7 movdqa xmm8,xmm7 xor esi,ebp pslldq xmm10,12 paddd xmm7,xmm7 mov edi,ebx add eax,DWORD[56+rsp] psrld xmm8,31 xor ecx,edx rol ebx,5 add eax,esi movdqa xmm9,xmm10 and edi,ecx xor ecx,edx psrld xmm10,30 add eax,ebx ror ebx,7 por xmm7,xmm8 xor edi,edx mov esi,eax add ebp,DWORD[60+rsp] pslld xmm9,2 pxor xmm7,xmm10 xor ebx,ecx movdqa xmm10,XMMWORD[((-32))+r14] rol eax,5 add ebp,edi and esi,ebx pxor xmm7,xmm9 pshufd xmm9,xmm6,238 xor ebx,ecx add ebp,eax ror eax,7 pxor xmm0,xmm4 xor esi,ecx mov edi,ebp add edx,DWORD[rsp] punpcklqdq xmm9,xmm7 xor eax,ebx rol ebp,5 pxor xmm0,xmm1 add edx,esi and edi,eax movdqa xmm8,xmm10 xor eax,ebx paddd xmm10,xmm7 add edx,ebp pxor xmm0,xmm9 ror ebp,7 xor edi,ebx mov esi,edx add ecx,DWORD[4+rsp] movdqa xmm9,xmm0 xor ebp,eax rol edx,5 movdqa XMMWORD[48+rsp],xmm10 add ecx,edi and esi,ebp xor ebp,eax pslld xmm0,2 add ecx,edx ror edx,7 psrld xmm9,30 xor esi,eax mov edi,ecx add ebx,DWORD[8+rsp] por xmm0,xmm9 xor edx,ebp rol ecx,5 pshufd xmm10,xmm7,238 add ebx,esi and edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[12+rsp] xor edi,ebp mov esi,ebx rol ebx,5 add eax,edi xor esi,edx ror ecx,7 add eax,ebx pxor xmm1,xmm5 add ebp,DWORD[16+rsp] xor esi,ecx punpcklqdq xmm10,xmm0 mov edi,eax rol eax,5 pxor xmm1,xmm2 add ebp,esi xor edi,ecx movdqa xmm9,xmm8 ror ebx,7 paddd xmm8,xmm0 add ebp,eax pxor xmm1,xmm10 add edx,DWORD[20+rsp] xor edi,ebx mov esi,ebp rol ebp,5 movdqa xmm10,xmm1 add edx,edi xor esi,ebx movdqa XMMWORD[rsp],xmm8 ror eax,7 add edx,ebp add ecx,DWORD[24+rsp] pslld xmm1,2 xor esi,eax mov edi,edx psrld xmm10,30 rol edx,5 add ecx,esi xor edi,eax ror ebp,7 por xmm1,xmm10 add ecx,edx add ebx,DWORD[28+rsp] pshufd xmm8,xmm0,238 xor edi,ebp mov esi,ecx rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 add ebx,ecx pxor xmm2,xmm6 add eax,DWORD[32+rsp] xor esi,edx punpcklqdq xmm8,xmm1 mov edi,ebx rol ebx,5 pxor xmm2,xmm3 add eax,esi xor edi,edx movdqa xmm10,XMMWORD[r14] ror ecx,7 paddd xmm9,xmm1 add eax,ebx pxor xmm2,xmm8 add ebp,DWORD[36+rsp] xor edi,ecx mov esi,eax rol eax,5 movdqa xmm8,xmm2 add ebp,edi xor esi,ecx movdqa XMMWORD[16+rsp],xmm9 ror ebx,7 add ebp,eax add edx,DWORD[40+rsp] pslld xmm2,2 xor esi,ebx mov edi,ebp psrld xmm8,30 rol ebp,5 add edx,esi xor edi,ebx ror eax,7 por xmm2,xmm8 add edx,ebp add ecx,DWORD[44+rsp] pshufd xmm9,xmm1,238 xor edi,eax mov esi,edx rol edx,5 add ecx,edi xor esi,eax ror ebp,7 add ecx,edx pxor xmm3,xmm7 add ebx,DWORD[48+rsp] xor esi,ebp punpcklqdq xmm9,xmm2 mov edi,ecx rol ecx,5 pxor xmm3,xmm4 add ebx,esi xor edi,ebp movdqa xmm8,xmm10 ror edx,7 paddd xmm10,xmm2 add ebx,ecx pxor xmm3,xmm9 add eax,DWORD[52+rsp] xor edi,edx mov esi,ebx rol ebx,5 movdqa xmm9,xmm3 add eax,edi xor esi,edx movdqa XMMWORD[32+rsp],xmm10 ror ecx,7 add eax,ebx add ebp,DWORD[56+rsp] pslld xmm3,2 xor esi,ecx mov edi,eax psrld xmm9,30 rol eax,5 add ebp,esi xor edi,ecx ror ebx,7 por xmm3,xmm9 add ebp,eax add edx,DWORD[60+rsp] pshufd xmm10,xmm2,238 xor edi,ebx mov esi,ebp rol ebp,5 add edx,edi xor esi,ebx ror eax,7 add edx,ebp pxor xmm4,xmm0 add ecx,DWORD[rsp] xor esi,eax punpcklqdq xmm10,xmm3 mov edi,edx rol edx,5 pxor xmm4,xmm5 add ecx,esi xor edi,eax movdqa xmm9,xmm8 ror ebp,7 paddd xmm8,xmm3 add ecx,edx pxor xmm4,xmm10 add ebx,DWORD[4+rsp] xor edi,ebp mov esi,ecx rol ecx,5 movdqa xmm10,xmm4 add ebx,edi xor esi,ebp movdqa XMMWORD[48+rsp],xmm8 ror edx,7 add ebx,ecx add eax,DWORD[8+rsp] pslld xmm4,2 xor esi,edx mov edi,ebx psrld xmm10,30 rol ebx,5 add eax,esi xor edi,edx ror ecx,7 por xmm4,xmm10 add eax,ebx add ebp,DWORD[12+rsp] pshufd xmm8,xmm3,238 xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax pxor xmm5,xmm1 add edx,DWORD[16+rsp] xor esi,ebx punpcklqdq xmm8,xmm4 mov edi,ebp rol ebp,5 pxor xmm5,xmm6 add edx,esi xor edi,ebx movdqa xmm10,xmm9 ror eax,7 paddd xmm9,xmm4 add edx,ebp pxor xmm5,xmm8 add ecx,DWORD[20+rsp] xor edi,eax mov esi,edx rol edx,5 movdqa xmm8,xmm5 add ecx,edi xor esi,eax movdqa XMMWORD[rsp],xmm9 ror ebp,7 add ecx,edx add ebx,DWORD[24+rsp] pslld xmm5,2 xor esi,ebp mov edi,ecx psrld xmm8,30 rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 por xmm5,xmm8 add ebx,ecx add eax,DWORD[28+rsp] pshufd xmm9,xmm4,238 ror ecx,7 mov esi,ebx xor edi,edx rol ebx,5 add eax,edi xor esi,ecx xor ecx,edx add eax,ebx pxor xmm6,xmm2 add ebp,DWORD[32+rsp] and esi,ecx xor ecx,edx ror ebx,7 punpcklqdq xmm9,xmm5 mov edi,eax xor esi,ecx pxor xmm6,xmm7 rol eax,5 add ebp,esi movdqa xmm8,xmm10 xor edi,ebx paddd xmm10,xmm5 xor ebx,ecx pxor xmm6,xmm9 add ebp,eax add edx,DWORD[36+rsp] and edi,ebx xor ebx,ecx ror eax,7 movdqa xmm9,xmm6 mov esi,ebp xor edi,ebx movdqa XMMWORD[16+rsp],xmm10 rol ebp,5 add edx,edi xor esi,eax pslld xmm6,2 xor eax,ebx add edx,ebp psrld xmm9,30 add ecx,DWORD[40+rsp] and esi,eax xor eax,ebx por xmm6,xmm9 ror ebp,7 mov edi,edx xor esi,eax rol edx,5 pshufd xmm10,xmm5,238 add ecx,esi xor edi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[44+rsp] and edi,ebp xor ebp,eax ror edx,7 mov esi,ecx xor edi,ebp rol ecx,5 add ebx,edi xor esi,edx xor edx,ebp add ebx,ecx pxor xmm7,xmm3 add eax,DWORD[48+rsp] and esi,edx xor edx,ebp ror ecx,7 punpcklqdq xmm10,xmm6 mov edi,ebx xor esi,edx pxor xmm7,xmm0 rol ebx,5 add eax,esi movdqa xmm9,XMMWORD[32+r14] xor edi,ecx paddd xmm8,xmm6 xor ecx,edx pxor xmm7,xmm10 add eax,ebx add ebp,DWORD[52+rsp] and edi,ecx xor ecx,edx ror ebx,7 movdqa xmm10,xmm7 mov esi,eax xor edi,ecx movdqa XMMWORD[32+rsp],xmm8 rol eax,5 add ebp,edi xor esi,ebx pslld xmm7,2 xor ebx,ecx add ebp,eax psrld xmm10,30 add edx,DWORD[56+rsp] and esi,ebx xor ebx,ecx por xmm7,xmm10 ror eax,7 mov edi,ebp xor esi,ebx rol ebp,5 pshufd xmm8,xmm6,238 add edx,esi xor edi,eax xor eax,ebx add edx,ebp add ecx,DWORD[60+rsp] and edi,eax xor eax,ebx ror ebp,7 mov esi,edx xor edi,eax rol edx,5 add ecx,edi xor esi,ebp xor ebp,eax add ecx,edx pxor xmm0,xmm4 add ebx,DWORD[rsp] and esi,ebp xor ebp,eax ror edx,7 punpcklqdq xmm8,xmm7 mov edi,ecx xor esi,ebp pxor xmm0,xmm1 rol ecx,5 add ebx,esi movdqa xmm10,xmm9 xor edi,edx paddd xmm9,xmm7 xor edx,ebp pxor xmm0,xmm8 add ebx,ecx add eax,DWORD[4+rsp] and edi,edx xor edx,ebp ror ecx,7 movdqa xmm8,xmm0 mov esi,ebx xor edi,edx movdqa XMMWORD[48+rsp],xmm9 rol ebx,5 add eax,edi xor esi,ecx pslld xmm0,2 xor ecx,edx add eax,ebx psrld xmm8,30 add ebp,DWORD[8+rsp] and esi,ecx xor ecx,edx por xmm0,xmm8 ror ebx,7 mov edi,eax xor esi,ecx rol eax,5 pshufd xmm9,xmm7,238 add ebp,esi xor edi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[12+rsp] and edi,ebx xor ebx,ecx ror eax,7 mov esi,ebp xor edi,ebx rol ebp,5 add edx,edi xor esi,eax xor eax,ebx add edx,ebp pxor xmm1,xmm5 add ecx,DWORD[16+rsp] and esi,eax xor eax,ebx ror ebp,7 punpcklqdq xmm9,xmm0 mov edi,edx xor esi,eax pxor xmm1,xmm2 rol edx,5 add ecx,esi movdqa xmm8,xmm10 xor edi,ebp paddd xmm10,xmm0 xor ebp,eax pxor xmm1,xmm9 add ecx,edx add ebx,DWORD[20+rsp] and edi,ebp xor ebp,eax ror edx,7 movdqa xmm9,xmm1 mov esi,ecx xor edi,ebp movdqa XMMWORD[rsp],xmm10 rol ecx,5 add ebx,edi xor esi,edx pslld xmm1,2 xor edx,ebp add ebx,ecx psrld xmm9,30 add eax,DWORD[24+rsp] and esi,edx xor edx,ebp por xmm1,xmm9 ror ecx,7 mov edi,ebx xor esi,edx rol ebx,5 pshufd xmm10,xmm0,238 add eax,esi xor edi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[28+rsp] and edi,ecx xor ecx,edx ror ebx,7 mov esi,eax xor edi,ecx rol eax,5 add ebp,edi xor esi,ebx xor ebx,ecx add ebp,eax pxor xmm2,xmm6 add edx,DWORD[32+rsp] and esi,ebx xor ebx,ecx ror eax,7 punpcklqdq xmm10,xmm1 mov edi,ebp xor esi,ebx pxor xmm2,xmm3 rol ebp,5 add edx,esi movdqa xmm9,xmm8 xor edi,eax paddd xmm8,xmm1 xor eax,ebx pxor xmm2,xmm10 add edx,ebp add ecx,DWORD[36+rsp] and edi,eax xor eax,ebx ror ebp,7 movdqa xmm10,xmm2 mov esi,edx xor edi,eax movdqa XMMWORD[16+rsp],xmm8 rol edx,5 add ecx,edi xor esi,ebp pslld xmm2,2 xor ebp,eax add ecx,edx psrld xmm10,30 add ebx,DWORD[40+rsp] and esi,ebp xor ebp,eax por xmm2,xmm10 ror edx,7 mov edi,ecx xor esi,ebp rol ecx,5 pshufd xmm8,xmm1,238 add ebx,esi xor edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[44+rsp] and edi,edx xor edx,ebp ror ecx,7 mov esi,ebx xor edi,edx rol ebx,5 add eax,edi xor esi,edx add eax,ebx pxor xmm3,xmm7 add ebp,DWORD[48+rsp] xor esi,ecx punpcklqdq xmm8,xmm2 mov edi,eax rol eax,5 pxor xmm3,xmm4 add ebp,esi xor edi,ecx movdqa xmm10,xmm9 ror ebx,7 paddd xmm9,xmm2 add ebp,eax pxor xmm3,xmm8 add edx,DWORD[52+rsp] xor edi,ebx mov esi,ebp rol ebp,5 movdqa xmm8,xmm3 add edx,edi xor esi,ebx movdqa XMMWORD[32+rsp],xmm9 ror eax,7 add edx,ebp add ecx,DWORD[56+rsp] pslld xmm3,2 xor esi,eax mov edi,edx psrld xmm8,30 rol edx,5 add ecx,esi xor edi,eax ror ebp,7 por xmm3,xmm8 add ecx,edx add ebx,DWORD[60+rsp] xor edi,ebp mov esi,ecx rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 add ebx,ecx add eax,DWORD[rsp] xor esi,edx mov edi,ebx rol ebx,5 paddd xmm10,xmm3 add eax,esi xor edi,edx movdqa XMMWORD[48+rsp],xmm10 ror ecx,7 add eax,ebx add ebp,DWORD[4+rsp] xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax add edx,DWORD[8+rsp] xor esi,ebx mov edi,ebp rol ebp,5 add edx,esi xor edi,ebx ror eax,7 add edx,ebp add ecx,DWORD[12+rsp] xor edi,eax mov esi,edx rol edx,5 add ecx,edi xor esi,eax ror ebp,7 add ecx,edx cmp r9,r10 je NEAR $L$done_ssse3 movdqa xmm6,XMMWORD[64+r14] movdqa xmm9,XMMWORD[((-64))+r14] movdqu xmm0,XMMWORD[r9] movdqu xmm1,XMMWORD[16+r9] movdqu xmm2,XMMWORD[32+r9] movdqu xmm3,XMMWORD[48+r9] DB 102,15,56,0,198 add r9,64 add ebx,DWORD[16+rsp] xor esi,ebp mov edi,ecx DB 102,15,56,0,206 rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 paddd xmm0,xmm9 add ebx,ecx add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx movdqa XMMWORD[rsp],xmm0 rol ebx,5 add eax,edi xor esi,edx ror ecx,7 psubd xmm0,xmm9 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax rol eax,5 add ebp,esi xor edi,ecx ror ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp rol ebp,5 add edx,edi xor esi,ebx ror eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax mov edi,edx DB 102,15,56,0,214 rol edx,5 add ecx,esi xor edi,eax ror ebp,7 paddd xmm1,xmm9 add ecx,edx add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx movdqa XMMWORD[16+rsp],xmm1 rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 psubd xmm1,xmm9 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx rol ebx,5 add eax,esi xor edi,edx ror ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx mov edi,ebp DB 102,15,56,0,222 rol ebp,5 add edx,esi xor edi,ebx ror eax,7 paddd xmm2,xmm9 add edx,ebp add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx movdqa XMMWORD[32+rsp],xmm2 rol edx,5 add ecx,edi xor esi,eax ror ebp,7 psubd xmm2,xmm9 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx rol ebx,5 add eax,edi ror ecx,7 add eax,ebx add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] add edx,DWORD[12+r8] mov DWORD[r8],eax add ebp,DWORD[16+r8] mov DWORD[4+r8],esi mov ebx,esi mov DWORD[8+r8],ecx mov edi,ecx mov DWORD[12+r8],edx xor edi,edx mov DWORD[16+r8],ebp and esi,edi jmp NEAR $L$oop_ssse3 ALIGN 16 $L$done_ssse3: add ebx,DWORD[16+rsp] xor esi,ebp mov edi,ecx rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 add ebx,ecx add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx rol ebx,5 add eax,edi xor esi,edx ror ecx,7 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax rol eax,5 add ebp,esi xor edi,ecx ror ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp rol ebp,5 add edx,edi xor esi,ebx ror eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax mov edi,edx rol edx,5 add ecx,esi xor edi,eax ror ebp,7 add ecx,edx add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx rol ecx,5 add ebx,edi xor esi,ebp ror edx,7 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx rol ebx,5 add eax,esi xor edi,edx ror ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax rol eax,5 add ebp,edi xor esi,ecx ror ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx mov edi,ebp rol ebp,5 add edx,esi xor edi,ebx ror eax,7 add edx,ebp add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx rol edx,5 add ecx,edi xor esi,eax ror ebp,7 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx rol ecx,5 add ebx,esi xor edi,ebp ror edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx rol ebx,5 add eax,edi ror ecx,7 add eax,ebx add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] mov DWORD[r8],eax add edx,DWORD[12+r8] mov DWORD[4+r8],esi add ebp,DWORD[16+r8] mov DWORD[8+r8],ecx mov DWORD[12+r8],edx mov DWORD[16+r8],ebp movaps xmm6,XMMWORD[((-40-96))+r11] movaps xmm7,XMMWORD[((-40-80))+r11] movaps xmm8,XMMWORD[((-40-64))+r11] movaps xmm9,XMMWORD[((-40-48))+r11] movaps xmm10,XMMWORD[((-40-32))+r11] movaps xmm11,XMMWORD[((-40-16))+r11] mov r14,QWORD[((-40))+r11] mov r13,QWORD[((-32))+r11] mov r12,QWORD[((-24))+r11] mov rbp,QWORD[((-16))+r11] mov rbx,QWORD[((-8))+r11] lea rsp,[r11] $L$epilogue_ssse3: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$<API key>: ALIGN 16 <API key>: mov QWORD[8+rsp],rdi ;WIN64 prologue mov QWORD[16+rsp],rsi mov rax,rsp $L$<API key>: mov rdi,rcx mov rsi,rdx mov rdx,r8 _avx_shortcut: mov r11,rsp push rbx push rbp push r12 push r13 push r14 lea rsp,[((-160))+rsp] vzeroupper vmovaps XMMWORD[(-40-96)+r11],xmm6 vmovaps XMMWORD[(-40-80)+r11],xmm7 vmovaps XMMWORD[(-40-64)+r11],xmm8 vmovaps XMMWORD[(-40-48)+r11],xmm9 vmovaps XMMWORD[(-40-32)+r11],xmm10 vmovaps XMMWORD[(-40-16)+r11],xmm11 $L$prologue_avx: and rsp,-64 mov r8,rdi mov r9,rsi mov r10,rdx shl r10,6 add r10,r9 lea r14,[((K_XX_XX+64))] mov eax,DWORD[r8] mov ebx,DWORD[4+r8] mov ecx,DWORD[8+r8] mov edx,DWORD[12+r8] mov esi,ebx mov ebp,DWORD[16+r8] mov edi,ecx xor edi,edx and esi,edi vmovdqa xmm6,XMMWORD[64+r14] vmovdqa xmm11,XMMWORD[((-64))+r14] vmovdqu xmm0,XMMWORD[r9] vmovdqu xmm1,XMMWORD[16+r9] vmovdqu xmm2,XMMWORD[32+r9] vmovdqu xmm3,XMMWORD[48+r9] vpshufb xmm0,xmm0,xmm6 add r9,64 vpshufb xmm1,xmm1,xmm6 vpshufb xmm2,xmm2,xmm6 vpshufb xmm3,xmm3,xmm6 vpaddd xmm4,xmm0,xmm11 vpaddd xmm5,xmm1,xmm11 vpaddd xmm6,xmm2,xmm11 vmovdqa XMMWORD[rsp],xmm4 vmovdqa XMMWORD[16+rsp],xmm5 vmovdqa XMMWORD[32+rsp],xmm6 jmp NEAR $L$oop_avx ALIGN 16 $L$oop_avx: shrd ebx,ebx,2 xor esi,edx vpalignr xmm4,xmm1,xmm0,8 mov edi,eax add ebp,DWORD[rsp] vpaddd xmm9,xmm11,xmm3 xor ebx,ecx shld eax,eax,5 vpsrldq xmm8,xmm3,4 add ebp,esi and edi,ebx vpxor xmm4,xmm4,xmm0 xor ebx,ecx add ebp,eax vpxor xmm8,xmm8,xmm2 shrd eax,eax,7 xor edi,ecx mov esi,ebp add edx,DWORD[4+rsp] vpxor xmm4,xmm4,xmm8 xor eax,ebx shld ebp,ebp,5 vmovdqa XMMWORD[48+rsp],xmm9 add edx,edi and esi,eax vpsrld xmm8,xmm4,31 xor eax,ebx add edx,ebp shrd ebp,ebp,7 xor esi,ebx vpslldq xmm10,xmm4,12 vpaddd xmm4,xmm4,xmm4 mov edi,edx add ecx,DWORD[8+rsp] xor ebp,eax shld edx,edx,5 vpsrld xmm9,xmm10,30 vpor xmm4,xmm4,xmm8 add ecx,esi and edi,ebp xor ebp,eax add ecx,edx vpslld xmm10,xmm10,2 vpxor xmm4,xmm4,xmm9 shrd edx,edx,7 xor edi,eax mov esi,ecx add ebx,DWORD[12+rsp] vpxor xmm4,xmm4,xmm10 xor edx,ebp shld ecx,ecx,5 add ebx,edi and esi,edx xor edx,ebp add ebx,ecx shrd ecx,ecx,7 xor esi,ebp vpalignr xmm5,xmm2,xmm1,8 mov edi,ebx add eax,DWORD[16+rsp] vpaddd xmm9,xmm11,xmm4 xor ecx,edx shld ebx,ebx,5 vpsrldq xmm8,xmm4,4 add eax,esi and edi,ecx vpxor xmm5,xmm5,xmm1 xor ecx,edx add eax,ebx vpxor xmm8,xmm8,xmm3 shrd ebx,ebx,7 xor edi,edx mov esi,eax add ebp,DWORD[20+rsp] vpxor xmm5,xmm5,xmm8 xor ebx,ecx shld eax,eax,5 vmovdqa XMMWORD[rsp],xmm9 add ebp,edi and esi,ebx vpsrld xmm8,xmm5,31 xor ebx,ecx add ebp,eax shrd eax,eax,7 xor esi,ecx vpslldq xmm10,xmm5,12 vpaddd xmm5,xmm5,xmm5 mov edi,ebp add edx,DWORD[24+rsp] xor eax,ebx shld ebp,ebp,5 vpsrld xmm9,xmm10,30 vpor xmm5,xmm5,xmm8 add edx,esi and edi,eax xor eax,ebx add edx,ebp vpslld xmm10,xmm10,2 vpxor xmm5,xmm5,xmm9 shrd ebp,ebp,7 xor edi,ebx mov esi,edx add ecx,DWORD[28+rsp] vpxor xmm5,xmm5,xmm10 xor ebp,eax shld edx,edx,5 vmovdqa xmm11,XMMWORD[((-32))+r14] add ecx,edi and esi,ebp xor ebp,eax add ecx,edx shrd edx,edx,7 xor esi,eax vpalignr xmm6,xmm3,xmm2,8 mov edi,ecx add ebx,DWORD[32+rsp] vpaddd xmm9,xmm11,xmm5 xor edx,ebp shld ecx,ecx,5 vpsrldq xmm8,xmm5,4 add ebx,esi and edi,edx vpxor xmm6,xmm6,xmm2 xor edx,ebp add ebx,ecx vpxor xmm8,xmm8,xmm4 shrd ecx,ecx,7 xor edi,ebp mov esi,ebx add eax,DWORD[36+rsp] vpxor xmm6,xmm6,xmm8 xor ecx,edx shld ebx,ebx,5 vmovdqa XMMWORD[16+rsp],xmm9 add eax,edi and esi,ecx vpsrld xmm8,xmm6,31 xor ecx,edx add eax,ebx shrd ebx,ebx,7 xor esi,edx vpslldq xmm10,xmm6,12 vpaddd xmm6,xmm6,xmm6 mov edi,eax add ebp,DWORD[40+rsp] xor ebx,ecx shld eax,eax,5 vpsrld xmm9,xmm10,30 vpor xmm6,xmm6,xmm8 add ebp,esi and edi,ebx xor ebx,ecx add ebp,eax vpslld xmm10,xmm10,2 vpxor xmm6,xmm6,xmm9 shrd eax,eax,7 xor edi,ecx mov esi,ebp add edx,DWORD[44+rsp] vpxor xmm6,xmm6,xmm10 xor eax,ebx shld ebp,ebp,5 add edx,edi and esi,eax xor eax,ebx add edx,ebp shrd ebp,ebp,7 xor esi,ebx vpalignr xmm7,xmm4,xmm3,8 mov edi,edx add ecx,DWORD[48+rsp] vpaddd xmm9,xmm11,xmm6 xor ebp,eax shld edx,edx,5 vpsrldq xmm8,xmm6,4 add ecx,esi and edi,ebp vpxor xmm7,xmm7,xmm3 xor ebp,eax add ecx,edx vpxor xmm8,xmm8,xmm5 shrd edx,edx,7 xor edi,eax mov esi,ecx add ebx,DWORD[52+rsp] vpxor xmm7,xmm7,xmm8 xor edx,ebp shld ecx,ecx,5 vmovdqa XMMWORD[32+rsp],xmm9 add ebx,edi and esi,edx vpsrld xmm8,xmm7,31 xor edx,ebp add ebx,ecx shrd ecx,ecx,7 xor esi,ebp vpslldq xmm10,xmm7,12 vpaddd xmm7,xmm7,xmm7 mov edi,ebx add eax,DWORD[56+rsp] xor ecx,edx shld ebx,ebx,5 vpsrld xmm9,xmm10,30 vpor xmm7,xmm7,xmm8 add eax,esi and edi,ecx xor ecx,edx add eax,ebx vpslld xmm10,xmm10,2 vpxor xmm7,xmm7,xmm9 shrd ebx,ebx,7 xor edi,edx mov esi,eax add ebp,DWORD[60+rsp] vpxor xmm7,xmm7,xmm10 xor ebx,ecx shld eax,eax,5 add ebp,edi and esi,ebx xor ebx,ecx add ebp,eax vpalignr xmm8,xmm7,xmm6,8 vpxor xmm0,xmm0,xmm4 shrd eax,eax,7 xor esi,ecx mov edi,ebp add edx,DWORD[rsp] vpxor xmm0,xmm0,xmm1 xor eax,ebx shld ebp,ebp,5 vpaddd xmm9,xmm11,xmm7 add edx,esi and edi,eax vpxor xmm0,xmm0,xmm8 xor eax,ebx add edx,ebp shrd ebp,ebp,7 xor edi,ebx vpsrld xmm8,xmm0,30 vmovdqa XMMWORD[48+rsp],xmm9 mov esi,edx add ecx,DWORD[4+rsp] xor ebp,eax shld edx,edx,5 vpslld xmm0,xmm0,2 add ecx,edi and esi,ebp xor ebp,eax add ecx,edx shrd edx,edx,7 xor esi,eax mov edi,ecx add ebx,DWORD[8+rsp] vpor xmm0,xmm0,xmm8 xor edx,ebp shld ecx,ecx,5 add ebx,esi and edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[12+rsp] xor edi,ebp mov esi,ebx shld ebx,ebx,5 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx vpalignr xmm8,xmm0,xmm7,8 vpxor xmm1,xmm1,xmm5 add ebp,DWORD[16+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 vpxor xmm1,xmm1,xmm2 add ebp,esi xor edi,ecx vpaddd xmm9,xmm11,xmm0 shrd ebx,ebx,7 add ebp,eax vpxor xmm1,xmm1,xmm8 add edx,DWORD[20+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 vpsrld xmm8,xmm1,30 vmovdqa XMMWORD[rsp],xmm9 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp vpslld xmm1,xmm1,2 add ecx,DWORD[24+rsp] xor esi,eax mov edi,edx shld edx,edx,5 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx vpor xmm1,xmm1,xmm8 add ebx,DWORD[28+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx vpalignr xmm8,xmm1,xmm0,8 vpxor xmm2,xmm2,xmm6 add eax,DWORD[32+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 vpxor xmm2,xmm2,xmm3 add eax,esi xor edi,edx vpaddd xmm9,xmm11,xmm1 vmovdqa xmm11,XMMWORD[r14] shrd ecx,ecx,7 add eax,ebx vpxor xmm2,xmm2,xmm8 add ebp,DWORD[36+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 vpsrld xmm8,xmm2,30 vmovdqa XMMWORD[16+rsp],xmm9 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax vpslld xmm2,xmm2,2 add edx,DWORD[40+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp vpor xmm2,xmm2,xmm8 add ecx,DWORD[44+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx vpalignr xmm8,xmm2,xmm1,8 vpxor xmm3,xmm3,xmm7 add ebx,DWORD[48+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 vpxor xmm3,xmm3,xmm4 add ebx,esi xor edi,ebp vpaddd xmm9,xmm11,xmm2 shrd edx,edx,7 add ebx,ecx vpxor xmm3,xmm3,xmm8 add eax,DWORD[52+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 vpsrld xmm8,xmm3,30 vmovdqa XMMWORD[32+rsp],xmm9 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx vpslld xmm3,xmm3,2 add ebp,DWORD[56+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 add ebp,esi xor edi,ecx shrd ebx,ebx,7 add ebp,eax vpor xmm3,xmm3,xmm8 add edx,DWORD[60+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp vpalignr xmm8,xmm3,xmm2,8 vpxor xmm4,xmm4,xmm0 add ecx,DWORD[rsp] xor esi,eax mov edi,edx shld edx,edx,5 vpxor xmm4,xmm4,xmm5 add ecx,esi xor edi,eax vpaddd xmm9,xmm11,xmm3 shrd ebp,ebp,7 add ecx,edx vpxor xmm4,xmm4,xmm8 add ebx,DWORD[4+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 vpsrld xmm8,xmm4,30 vmovdqa XMMWORD[48+rsp],xmm9 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx vpslld xmm4,xmm4,2 add eax,DWORD[8+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi xor edi,edx shrd ecx,ecx,7 add eax,ebx vpor xmm4,xmm4,xmm8 add ebp,DWORD[12+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax vpalignr xmm8,xmm4,xmm3,8 vpxor xmm5,xmm5,xmm1 add edx,DWORD[16+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 vpxor xmm5,xmm5,xmm6 add edx,esi xor edi,ebx vpaddd xmm9,xmm11,xmm4 shrd eax,eax,7 add edx,ebp vpxor xmm5,xmm5,xmm8 add ecx,DWORD[20+rsp] xor edi,eax mov esi,edx shld edx,edx,5 vpsrld xmm8,xmm5,30 vmovdqa XMMWORD[rsp],xmm9 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx vpslld xmm5,xmm5,2 add ebx,DWORD[24+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx vpor xmm5,xmm5,xmm8 add eax,DWORD[28+rsp] shrd ecx,ecx,7 mov esi,ebx xor edi,edx shld ebx,ebx,5 add eax,edi xor esi,ecx xor ecx,edx add eax,ebx vpalignr xmm8,xmm5,xmm4,8 vpxor xmm6,xmm6,xmm2 add ebp,DWORD[32+rsp] and esi,ecx xor ecx,edx shrd ebx,ebx,7 vpxor xmm6,xmm6,xmm7 mov edi,eax xor esi,ecx vpaddd xmm9,xmm11,xmm5 shld eax,eax,5 add ebp,esi vpxor xmm6,xmm6,xmm8 xor edi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[36+rsp] vpsrld xmm8,xmm6,30 vmovdqa XMMWORD[16+rsp],xmm9 and edi,ebx xor ebx,ecx shrd eax,eax,7 mov esi,ebp vpslld xmm6,xmm6,2 xor edi,ebx shld ebp,ebp,5 add edx,edi xor esi,eax xor eax,ebx add edx,ebp add ecx,DWORD[40+rsp] and esi,eax vpor xmm6,xmm6,xmm8 xor eax,ebx shrd ebp,ebp,7 mov edi,edx xor esi,eax shld edx,edx,5 add ecx,esi xor edi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[44+rsp] and edi,ebp xor ebp,eax shrd edx,edx,7 mov esi,ecx xor edi,ebp shld ecx,ecx,5 add ebx,edi xor esi,edx xor edx,ebp add ebx,ecx vpalignr xmm8,xmm6,xmm5,8 vpxor xmm7,xmm7,xmm3 add eax,DWORD[48+rsp] and esi,edx xor edx,ebp shrd ecx,ecx,7 vpxor xmm7,xmm7,xmm0 mov edi,ebx xor esi,edx vpaddd xmm9,xmm11,xmm6 vmovdqa xmm11,XMMWORD[32+r14] shld ebx,ebx,5 add eax,esi vpxor xmm7,xmm7,xmm8 xor edi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[52+rsp] vpsrld xmm8,xmm7,30 vmovdqa XMMWORD[32+rsp],xmm9 and edi,ecx xor ecx,edx shrd ebx,ebx,7 mov esi,eax vpslld xmm7,xmm7,2 xor edi,ecx shld eax,eax,5 add ebp,edi xor esi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[56+rsp] and esi,ebx vpor xmm7,xmm7,xmm8 xor ebx,ecx shrd eax,eax,7 mov edi,ebp xor esi,ebx shld ebp,ebp,5 add edx,esi xor edi,eax xor eax,ebx add edx,ebp add ecx,DWORD[60+rsp] and edi,eax xor eax,ebx shrd ebp,ebp,7 mov esi,edx xor edi,eax shld edx,edx,5 add ecx,edi xor esi,ebp xor ebp,eax add ecx,edx vpalignr xmm8,xmm7,xmm6,8 vpxor xmm0,xmm0,xmm4 add ebx,DWORD[rsp] and esi,ebp xor ebp,eax shrd edx,edx,7 vpxor xmm0,xmm0,xmm1 mov edi,ecx xor esi,ebp vpaddd xmm9,xmm11,xmm7 shld ecx,ecx,5 add ebx,esi vpxor xmm0,xmm0,xmm8 xor edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[4+rsp] vpsrld xmm8,xmm0,30 vmovdqa XMMWORD[48+rsp],xmm9 and edi,edx xor edx,ebp shrd ecx,ecx,7 mov esi,ebx vpslld xmm0,xmm0,2 xor edi,edx shld ebx,ebx,5 add eax,edi xor esi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[8+rsp] and esi,ecx vpor xmm0,xmm0,xmm8 xor ecx,edx shrd ebx,ebx,7 mov edi,eax xor esi,ecx shld eax,eax,5 add ebp,esi xor edi,ebx xor ebx,ecx add ebp,eax add edx,DWORD[12+rsp] and edi,ebx xor ebx,ecx shrd eax,eax,7 mov esi,ebp xor edi,ebx shld ebp,ebp,5 add edx,edi xor esi,eax xor eax,ebx add edx,ebp vpalignr xmm8,xmm0,xmm7,8 vpxor xmm1,xmm1,xmm5 add ecx,DWORD[16+rsp] and esi,eax xor eax,ebx shrd ebp,ebp,7 vpxor xmm1,xmm1,xmm2 mov edi,edx xor esi,eax vpaddd xmm9,xmm11,xmm0 shld edx,edx,5 add ecx,esi vpxor xmm1,xmm1,xmm8 xor edi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[20+rsp] vpsrld xmm8,xmm1,30 vmovdqa XMMWORD[rsp],xmm9 and edi,ebp xor ebp,eax shrd edx,edx,7 mov esi,ecx vpslld xmm1,xmm1,2 xor edi,ebp shld ecx,ecx,5 add ebx,edi xor esi,edx xor edx,ebp add ebx,ecx add eax,DWORD[24+rsp] and esi,edx vpor xmm1,xmm1,xmm8 xor edx,ebp shrd ecx,ecx,7 mov edi,ebx xor esi,edx shld ebx,ebx,5 add eax,esi xor edi,ecx xor ecx,edx add eax,ebx add ebp,DWORD[28+rsp] and edi,ecx xor ecx,edx shrd ebx,ebx,7 mov esi,eax xor edi,ecx shld eax,eax,5 add ebp,edi xor esi,ebx xor ebx,ecx add ebp,eax vpalignr xmm8,xmm1,xmm0,8 vpxor xmm2,xmm2,xmm6 add edx,DWORD[32+rsp] and esi,ebx xor ebx,ecx shrd eax,eax,7 vpxor xmm2,xmm2,xmm3 mov edi,ebp xor esi,ebx vpaddd xmm9,xmm11,xmm1 shld ebp,ebp,5 add edx,esi vpxor xmm2,xmm2,xmm8 xor edi,eax xor eax,ebx add edx,ebp add ecx,DWORD[36+rsp] vpsrld xmm8,xmm2,30 vmovdqa XMMWORD[16+rsp],xmm9 and edi,eax xor eax,ebx shrd ebp,ebp,7 mov esi,edx vpslld xmm2,xmm2,2 xor edi,eax shld edx,edx,5 add ecx,edi xor esi,ebp xor ebp,eax add ecx,edx add ebx,DWORD[40+rsp] and esi,ebp vpor xmm2,xmm2,xmm8 xor ebp,eax shrd edx,edx,7 mov edi,ecx xor esi,ebp shld ecx,ecx,5 add ebx,esi xor edi,edx xor edx,ebp add ebx,ecx add eax,DWORD[44+rsp] and edi,edx xor edx,ebp shrd ecx,ecx,7 mov esi,ebx xor edi,edx shld ebx,ebx,5 add eax,edi xor esi,edx add eax,ebx vpalignr xmm8,xmm2,xmm1,8 vpxor xmm3,xmm3,xmm7 add ebp,DWORD[48+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 vpxor xmm3,xmm3,xmm4 add ebp,esi xor edi,ecx vpaddd xmm9,xmm11,xmm2 shrd ebx,ebx,7 add ebp,eax vpxor xmm3,xmm3,xmm8 add edx,DWORD[52+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 vpsrld xmm8,xmm3,30 vmovdqa XMMWORD[32+rsp],xmm9 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp vpslld xmm3,xmm3,2 add ecx,DWORD[56+rsp] xor esi,eax mov edi,edx shld edx,edx,5 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx vpor xmm3,xmm3,xmm8 add ebx,DWORD[60+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[rsp] vpaddd xmm9,xmm11,xmm3 xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi vmovdqa XMMWORD[48+rsp],xmm9 xor edi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[4+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[8+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[12+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx cmp r9,r10 je NEAR $L$done_avx vmovdqa xmm6,XMMWORD[64+r14] vmovdqa xmm11,XMMWORD[((-64))+r14] vmovdqu xmm0,XMMWORD[r9] vmovdqu xmm1,XMMWORD[16+r9] vmovdqu xmm2,XMMWORD[32+r9] vmovdqu xmm3,XMMWORD[48+r9] vpshufb xmm0,xmm0,xmm6 add r9,64 add ebx,DWORD[16+rsp] xor esi,ebp vpshufb xmm1,xmm1,xmm6 mov edi,ecx shld ecx,ecx,5 vpaddd xmm4,xmm0,xmm11 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx vmovdqa XMMWORD[rsp],xmm4 add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 add ebp,esi xor edi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax vpshufb xmm2,xmm2,xmm6 mov edi,edx shld edx,edx,5 vpaddd xmm5,xmm1,xmm11 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx vmovdqa XMMWORD[16+rsp],xmm5 add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi xor edi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx vpshufb xmm3,xmm3,xmm6 mov edi,ebp shld ebp,ebp,5 vpaddd xmm6,xmm2,xmm11 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp vmovdqa XMMWORD[32+rsp],xmm6 add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi shrd ecx,ecx,7 add eax,ebx add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] add edx,DWORD[12+r8] mov DWORD[r8],eax add ebp,DWORD[16+r8] mov DWORD[4+r8],esi mov ebx,esi mov DWORD[8+r8],ecx mov edi,ecx mov DWORD[12+r8],edx xor edi,edx mov DWORD[16+r8],ebp and esi,edi jmp NEAR $L$oop_avx ALIGN 16 $L$done_avx: add ebx,DWORD[16+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[20+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi xor esi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[24+rsp] xor esi,ecx mov edi,eax shld eax,eax,5 add ebp,esi xor edi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[28+rsp] xor edi,ebx mov esi,ebp shld ebp,ebp,5 add edx,edi xor esi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[32+rsp] xor esi,eax mov edi,edx shld edx,edx,5 add ecx,esi xor edi,eax shrd ebp,ebp,7 add ecx,edx add ebx,DWORD[36+rsp] xor edi,ebp mov esi,ecx shld ecx,ecx,5 add ebx,edi xor esi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[40+rsp] xor esi,edx mov edi,ebx shld ebx,ebx,5 add eax,esi xor edi,edx shrd ecx,ecx,7 add eax,ebx add ebp,DWORD[44+rsp] xor edi,ecx mov esi,eax shld eax,eax,5 add ebp,edi xor esi,ecx shrd ebx,ebx,7 add ebp,eax add edx,DWORD[48+rsp] xor esi,ebx mov edi,ebp shld ebp,ebp,5 add edx,esi xor edi,ebx shrd eax,eax,7 add edx,ebp add ecx,DWORD[52+rsp] xor edi,eax mov esi,edx shld edx,edx,5 add ecx,edi xor esi,eax shrd ebp,ebp,7 add ecx,edx add ebx,DWORD[56+rsp] xor esi,ebp mov edi,ecx shld ecx,ecx,5 add ebx,esi xor edi,ebp shrd edx,edx,7 add ebx,ecx add eax,DWORD[60+rsp] xor edi,edx mov esi,ebx shld ebx,ebx,5 add eax,edi shrd ecx,ecx,7 add eax,ebx vzeroupper add eax,DWORD[r8] add esi,DWORD[4+r8] add ecx,DWORD[8+r8] mov DWORD[r8],eax add edx,DWORD[12+r8] mov DWORD[4+r8],esi add ebp,DWORD[16+r8] mov DWORD[8+r8],ecx mov DWORD[12+r8],edx mov DWORD[16+r8],ebp movaps xmm6,XMMWORD[((-40-96))+r11] movaps xmm7,XMMWORD[((-40-80))+r11] movaps xmm8,XMMWORD[((-40-64))+r11] movaps xmm9,XMMWORD[((-40-48))+r11] movaps xmm10,XMMWORD[((-40-32))+r11] movaps xmm11,XMMWORD[((-40-16))+r11] mov r14,QWORD[((-40))+r11] mov r13,QWORD[((-32))+r11] mov r12,QWORD[((-24))+r11] mov rbp,QWORD[((-16))+r11] mov rbx,QWORD[((-8))+r11] lea rsp,[r11] $L$epilogue_avx: mov rdi,QWORD[8+rsp] ;WIN64 epilogue mov rsi,QWORD[16+rsp] DB 0F3h,0C3h ;repret $L$<API key>: ALIGN 64 K_XX_XX: DD 0x5a827999,0x5a827999,0x5a827999,0x5a827999 DD 0x5a827999,0x5a827999,0x5a827999,0x5a827999 DD 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1 DD 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1 DD 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc DD 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc DD 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 DD 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f DB 0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0 DB 83,72,65,49,32,98,108,111,99,107,32,116,114,97,110,115 DB 102,111,114,109,32,102,111,114,32,120,56,54,95,54,52,44 DB 32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60 DB 97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114 DB 103,62,0 ALIGN 64 EXTERN <API key> ALIGN 16 se_handler: push rsi push rdi push rbx push rbp push r12 push r13 push r14 push r15 pushfq sub rsp,64 mov rax,QWORD[120+r8] mov rbx,QWORD[248+r8] lea r10,[$L$prologue] cmp rbx,r10 jb NEAR $L$common_seh_tail mov rax,QWORD[152+r8] lea r10,[$L$epilogue] cmp rbx,r10 jae NEAR $L$common_seh_tail mov rax,QWORD[64+rax] mov rbx,QWORD[((-8))+rax] mov rbp,QWORD[((-16))+rax] mov r12,QWORD[((-24))+rax] mov r13,QWORD[((-32))+rax] mov r14,QWORD[((-40))+rax] mov QWORD[144+r8],rbx mov QWORD[160+r8],rbp mov QWORD[216+r8],r12 mov QWORD[224+r8],r13 mov QWORD[232+r8],r14 jmp NEAR $L$common_seh_tail ALIGN 16 ssse3_handler: push rsi push rdi push rbx push rbp push r12 push r13 push r14 push r15 pushfq sub rsp,64 mov rax,QWORD[120+r8] mov rbx,QWORD[248+r8] mov rsi,QWORD[8+r9] mov r11,QWORD[56+r9] mov r10d,DWORD[r11] lea r10,[r10*1+rsi] cmp rbx,r10 jb NEAR $L$common_seh_tail mov rax,QWORD[208+r8] mov r10d,DWORD[4+r11] lea r10,[r10*1+rsi] cmp rbx,r10 jae NEAR $L$common_seh_tail lea rsi,[((-40-96))+rax] lea rdi,[512+r8] mov ecx,12 DD 0xa548f3fc mov rbx,QWORD[((-8))+rax] mov rbp,QWORD[((-16))+rax] mov r12,QWORD[((-24))+rax] mov r13,QWORD[((-32))+rax] mov r14,QWORD[((-40))+rax] mov QWORD[144+r8],rbx mov QWORD[160+r8],rbp mov QWORD[216+r8],r12 mov QWORD[224+r8],r13 mov QWORD[232+r8],r14 $L$common_seh_tail: mov rdi,QWORD[8+rax] mov rsi,QWORD[16+rax] mov QWORD[152+r8],rax mov QWORD[168+r8],rsi mov QWORD[176+r8],rdi mov rdi,QWORD[40+r9] mov rsi,r8 mov ecx,154 DD 0xa548f3fc mov rsi,r9 xor rcx,rcx mov rdx,QWORD[8+rsi] mov r8,QWORD[rsi] mov r9,QWORD[16+rsi] mov r10,QWORD[40+rsi] lea r11,[56+rsi] lea r12,[24+rsi] mov QWORD[32+rsp],r10 mov QWORD[40+rsp],r11 mov QWORD[48+rsp],r12 mov QWORD[56+rsp],rcx call QWORD[<API key>] mov eax,1 add rsp,64 popfq pop r15 pop r14 pop r13 pop r12 pop rbp pop rbx pop rdi pop rsi DB 0F3h,0C3h ;repret section .pdata rdata align=4 ALIGN 4 DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase DD $L$<API key> wrt ..imagebase section .xdata rdata align=8 ALIGN 8 $L$<API key>: DB 9,0,0,0 DD se_handler wrt ..imagebase $L$<API key>: DB 9,0,0,0 DD ssse3_handler wrt ..imagebase DD $L$prologue_ssse3 wrt ..imagebase,$L$epilogue_ssse3 wrt ..imagebase $L$<API key>: DB 9,0,0,0 DD ssse3_handler wrt ..imagebase DD $L$prologue_avx wrt ..imagebase,$L$epilogue_avx wrt ..imagebase
package org.datasyslab.geospark.utils; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; public class RDDSampleUtilsTest { /** * Test get sample numbers. */ @Test public void <API key>() { assertEquals(10, RDDSampleUtils.getSampleNumbers(2, 10, -1)); assertEquals(100, RDDSampleUtils.getSampleNumbers(2, 100, -1)); assertEquals(10, RDDSampleUtils.getSampleNumbers(5, 1000, -1)); assertEquals(100, RDDSampleUtils.getSampleNumbers(5, 10000, -1)); assertEquals(100, RDDSampleUtils.getSampleNumbers(5, 10001, -1)); assertEquals(1000, RDDSampleUtils.getSampleNumbers(5, 100011, -1)); assertEquals(99, RDDSampleUtils.getSampleNumbers(6, 100011, 99)); assertEquals(999, RDDSampleUtils.getSampleNumbers(20, 999, -1)); assertEquals(40, RDDSampleUtils.getSampleNumbers(20, 1000, -1)); } /** * Test too many partitions. */ @Test public void <API key>() { assertFailure(505, 999); assertFailure(505, 1000); assertFailure(10, 1000, 2100); } private void assertFailure(int numPartitions, long <API key>) { assertFailure(numPartitions, <API key>, -1); } private void assertFailure(int numPartitions, long <API key>, int givenSampleNumber) { try { RDDSampleUtils.getSampleNumbers(numPartitions, <API key>, givenSampleNumber); fail("Expected <API key>"); } catch (<API key> e) { // expected } } }
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Include file Image/Graph/Axis.php */ require_once 'Image/Graph/Axis.php'; class <API key> extends Image_Graph_Axis { /** * The labels shown on the axis * @var array * @access private */ var $_labels = false; /** * <API key> [Constructor]. * * @param int $type The type (direction) of the Axis */ function <API key>($type = IMAGE_GRAPH_AXIS_X) { parent::Image_Graph_Axis($type); $this->_labels = array(); $this->setlabelInterval(1); } /** * Gets the minimum value the axis will show. * * This is always 0 * * @return double The minumum value * @access private */ function _getMinimum() { return 0; } /** * Gets the maximum value the axis will show. * * This is always the number of labels passed to the constructor. * * @return double The maximum value * @access private */ function _getMaximum() { return count($this->_labels) - 1; } /** * Sets the minimum value the axis will show. * * A minimum cannot be set on a SequentialAxis, it is always 0. * * @param double Minimum The minumum value to use on the axis * @access private */ function _setMinimum($minimum) { } /** * Sets the maximum value the axis will show * * A maximum cannot be set on a SequentialAxis, it is always the number * of labels passed to the constructor. * * @param double Maximum The maximum value to use on the axis * @access private */ function _setMaximum($maximum) { } /** * Forces the minimum value of the axis * * <b>A minimum cannot be set on this type of axis</b> * * To modify the labels which are displayed on the axis, instead use * setLabelInterval($labels) where $labels is an array containing the * values/labels the axis should display. <b>Note!</b> Only values in * this array will then be displayed on the graph! * * @param double $minimum A minimum cannot be set on this type of axis */ function forceMinimum($minimum, $userEnforce = true) { } /** * Forces the maximum value of the axis * * <b>A maximum cannot be set on this type of axis</b> * * To modify the labels which are displayed on the axis, instead use * setLabelInterval($labels) where $labels is an array containing the * values/labels the axis should display. <b>Note!</b> Only values in * this array will then be displayed on the graph! * * @param double $maximum A maximum cannot be set on this type of axis */ function forceMaximum($maximum, $userEnforce = true) { } /** * Sets an interval for where labels are shown on the axis. * * The label interval is rounded to nearest integer value. * * @param double $labelInterval The interval with which labels are shown */ function setLabelInterval($labelInterval = 'auto', $level = 1) { if (is_array($labelInterval)) { parent::setLabelInterval($labelInterval); } elseif ($labelInterval == 'auto') { parent::setLabelInterval(1); } else { parent::setLabelInterval(round($labelInterval)); } } /** * Preprocessor for values, ie for using logarithmic axis * * @param double $value The value to preprocess * @return double The preprocessed value * @access private */ function _value($value) { // $the_value = array_search($value, $this->_labels); if (isset($this->_labels[$value])) { $the_value = $this->_labels[$value]; if ($the_value !== false) { return $the_value + ($this->_pushValues ? 0.5 : 0); } else { return 0; } } } /** * Get the minor label interval with which axis label ticks are drawn. * * For a sequential axis this is always disabled (i.e false) * * @return double The minor label interval, always false * @access private */ function _minorLabelInterval() { return false; } /** * Get the size in pixels of the axis. * * For an x-axis this is the width of the axis including labels, and for an * y-axis it is the corrresponding height * * @return int The size of the axis * @access private */ function _size() { if (!$this->_visible) { return 0; } $this->_canvas->setFont($this->_getFont()); $maxSize = 0; foreach($this->_labels as $label => $id) { $labelPosition = $this->_point($label); if (is_object($this->_dataPreProcessor)) { $labelText = $this->_dataPreProcessor->_process($label); } else { $labelText = $label; } if ((($this->_type == IMAGE_GRAPH_AXIS_X) && (!$this->_transpose)) || (($this->_type != IMAGE_GRAPH_AXIS_X) && ($this->_transpose))) { $maxSize = max($maxSize, $this->_canvas->textHeight($labelText)); } else { $maxSize = max($maxSize, $this->_canvas->textWidth($labelText)); } } if ($this->_title) { $this->_canvas->setFont($this->_getTitleFont()); if ((($this->_type == IMAGE_GRAPH_AXIS_X) && (!$this->_transpose)) || (($this->_type != IMAGE_GRAPH_AXIS_X) && ($this->_transpose))) { $maxSize += $this->_canvas->textHeight($this->_title); } else { $maxSize += $this->_canvas->textWidth($this->_title); } $maxSize += 10; } return $maxSize +3; } /** * Apply the dataset to the axis. * * This calculates the order of the categories, which is very important * for fx. line plots, so that the line does not "go backwards", consider * these X-sets:<p> * 1: (1, 2, 3, 4, 5, 6)<br> * 2: (0, 1, 2, 3, 4, 5, 6, 7)<p> * If they are not ordered, but simply appended, the categories on the axis * would be:<p> * X: (1, 2, 3, 4, 5, 6, 0, 7)<p> * Which would render the a line for the second plot to show incorrectly. * Instead this algorithm, uses and 'value- is- before' method to see that * the 0 is before a 1 in the second set, and that it should also be before * a 1 in the X set. Hence:<p> * X: (0, 1, 2, 3, 4, 5, 6, 7) * * @param Image_Graph_Dataset $dataset The dataset * @access private */ function _applyDataset(&$dataset) { $newLabels = array(); $allLabels = array(); $dataset->_reset(); $count = 0; $count_new = 0; while ($point = $dataset->_next()) { if ($this->_type == IMAGE_GRAPH_AXIS_X) { $data = $point['X']; } else { $data = $point['Y']; } if (!isset($this->_labels[$data])) { $newLabels[$data] = $count_new++; //$this->_labels[] = $data; } $allLabels[$data] = $count++; } if (count($this->_labels) == 0) { $this->_labels = $newLabels; } elseif ((is_array($newLabels)) && (count($newLabels) > 0)) { // get all intersecting labels $intersect = array_intersect(array_keys($allLabels), array_keys($this->_labels)); // traverse all new and find their relative position withing the // intersec, fx value X0 is before X1 in the intersection, which // means that X0 should be placed before X1 in the label array foreach($newLabels as $newLabel => $id) { $key = $allLabels[$newLabel]; reset($intersect); $this_value = false; // intersect indexes are the same as in allLabels! $first = true; while ((list($id, $value) = each($intersect)) && ($this_value === false)) { if (($first) && ($id > $key)) { $this_value = $value; } elseif ($id >= $key) { $this_value = $value; } $first = false; } if ($this_value === false) { // the new label was not found before anything in the // intersection -> append it $this->_labels[$newLabel] = count($this->_labels); } else { // the new label was found before $this_value in the // intersection, insert the label before this position in // the label array // $key = $this->_labels[$this_value]; $keys = array_keys($this->_labels); $key = array_search($this_value, $keys); $pre = array_slice($keys, 0, $key); $pre[] = $newLabel; $post = array_slice($keys, $key); $this->_labels = array_flip(array_merge($pre, $post)); } } unset($keys); } $labels = array_keys($this->_labels); $i = 0; foreach ($labels as $label) { $this->_labels[$label] = $i++; } // $this->_labels = array_values(array_unique($this->_labels)); $this->_calcLabelInterval(); } /** * Return the label distance. * * @return int The distance between 2 adjacent labels * @access private */ function _labelDistance($level = 1) { reset($this->_labels); list($l1) = each($this->_labels); list($l2) = each($this->_labels); return abs($this->_point($l2) - $this->_point($l1)); } /** * Get next label point * * @param doubt $point The current point, if omitted or false, the first is * returned * @return double The next label point * @access private */ function _getNextLabel($currentLabel = false, $level = 1) { if ($currentLabel === false) { reset($this->_labels); } $result = false; $count = ($currentLabel === false ? $this->_labelInterval() - 1 : 0); while ($count < $this->_labelInterval()) { $result = (list($label) = each($this->_labels)); $count++; } if ($result) { return $label; } else { return false; } } /** * Is the axis numeric or not? * * @return bool True if numeric, false if not * @access private */ function _isNumeric() { return false; } /** * Output the axis * * @return bool Was the output 'good' (true) or 'bad' (false). * @access private */ function _done() { $result = true; if (Image_Graph_Element::_done() === false) { $result = false; } $this->_canvas->startGroup(get_class($this)); $this->_drawAxisLines(); $this->_canvas->startGroup(get_class($this) . '_ticks'); $label = false; while (($label = $this->_getNextLabel($label)) !== false) { $this->_drawTick($label); } $this->_canvas->endGroup(); $this->_canvas->endGroup(); return $result; } } ?>
var _ = require('lodash'); var color =require('colors'); var fs =require('fs'); var config = require('../config.js'); var path = require('path'); var mongoose = require("mongoose"); var lcommon = require('lush').common; console.log(config.db); mongoose.connect(config.db,function (err) { if(err){ throw new Error('db connect error!\n'+err); } console.log('db connect success!'.yellow); }); // console.log('point'); // var models = { // init : function (callback) { // fs.readdir(path+'/module',function (err,files) { // if(err){ // throw err; // // console.log(files); // return callback(files.filter(function (item) { // models.init(function (files) { // // console.log(files); // for (var item in files) { // //reuire all modules // // console.log(lcommon.literat(files[item]).slice(0,-3)); // console.log(files[item]); // item = files[item].split('.')[0]; // require('./'+ item); // var m = lcommon.literat(item); // console.log('loading and use ',m,' model'); // exports[m] = mongoose.model(m); // // _.extend(models,file.exports); // // console.log(file); var models = fs.readdirSync(path.resolve('.','module')); models.forEach(function(item,index){ if(item !== '.' && item !== '..' && item !== 'index.js'){ // console.log(item.indexOf('.js')); //ends with .js if(item.indexOf('.js') == (item.length-3)){ item = item.split('.')[0]; require('./'+ item); var m = lcommon.literat(item); console.log('loading and use ',m,' model'); exports[m] = mongoose.model(m); } } });
namespace SalesDatabase.Models { using System.Collections.Generic; public class StoreLocation { public StoreLocation() { this.SalesInStore = new HashSet<Sale>(); } public int Id { get; set; } public string LocationName { get; set; } public ICollection<Sale> SalesInStore { get; set; } } }
# -*- coding:utf-8 -*- from re import sub from itertools import islice # mm/dd/yyyy # sub with open("./log.log","r") as f: for line in islice(f,0,None): #print sub("(\d{4})-(\d{2})-(\d{2})",r"\2/\3/\1",line) print sub("(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})",r"\g<month>/\g<day>/\g<>",line)
MACRO(ADD_PCH SOURCE_FILES NO_PCH_FILES PROJECT_PATH PCH_PATH_LOCAL PCH_FILE_NAME) SET(<API key> ${PCH_PATH_LOCAL}) IF (${<API key>} STREQUAL "./" OR ${<API key>} STREQUAL ".") SET(<API key>) ELSE() SET(<API key> ${<API key>}/) ENDIF() SET(<API key> ${PROJECT_PATH}/${<API key>}${PCH_FILE_NAME}.h) SET(PCH_BINARY_OUT ${<API key>}/${PCH_FILE_NAME}.pch) SET(PHP_FILE_CPP ${<API key>}${PCH_FILE_NAME}.cpp) FOREACH(source_file ${SOURCE_FILES}) <API key>(CPP ${source_file} EXT) IF(${CPP} STREQUAL ".cpp") IF(${source_file} STREQUAL ${PHP_FILE_CPP}) <API key>(${PHP_FILE_CPP} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} /Yc${<API key>} /Fp${PCH_BINARY_OUT}" ) <API key>(${PHP_FILE_CPP} PROPERTIES OBJECT_OUTPUTS ${PCH_BINARY_OUT} ) ELSE() LIST(FIND NO_PCH_FILES ${source_file} no_pch_index) IF(${no_pch_index} EQUAL -1) <API key>(${source_file} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} /Yu${<API key>} /Fp${PCH_BINARY_OUT}" ) <API key>(${source_file} PROPERTIES OBJECT_DEPENDS ${PCH_BINARY_OUT} ) ENDIF(${no_pch_index} EQUAL -1) ENDIF() ENDIF() ENDFOREACH(source_file) ENDMACRO(ADD_PCH)
/* form elements */ input[type="submit"], input[type="text"], input[type="password"], input[type="submit"], input[type="tel"], button[type="button"], button[type="submit"], textarea { -webkit-appearance: none; -moz-appearance: none; -o-appearance: none; border-radius: 0 !important; } input[type="text"] { padding: 0; } /* web accecibility settings */ a:focus, select:focus, input[type="radio"]:focus, input[type="checkbox"]:focus, input[type="text"]:focus, input[type="tel"]:focus, input[type="password"]:focus, button:focus, textarea:focus { outline: #ccc dashed 1px; } a:active, select:active, input[type="radio"]:active, input[type="checkbox"]:active, input[type="text"]:active, input[type="tel"]:active, input[type="password"]:active, textarea:active { outline: 0; } /* default fonts & color */ body { font-size: 14px; margin: 0; color: white; background: #002144; } select, input, button, textarea { font-family: '<API key>', sans-serif; } a { text-decoration: none; color: inherit; } .setWidth { margin: 0 auto; } #contentWrap { margin-bottom: 100px; } .modalFull { display: none; } .topCover { display: none; } .mobile { display: none; } /* preloader */ #preloader { position: fixed; z-index: 500; top: 0; left: 0; right: 0; bottom: 0; background: url(../images/ajax-loader.gif) center no-repeat #002144; } /* header */ #headerMobile { display: none; } .gnbMobileBtn { display: none; } header .setWidth { padding: 10px 0; } header #logo { padding-top: 20px; } header #logo a { display: block; } header #logo img { width: 200px; } header nav.gnb { float: right; } header nav.gnb > ul { float: right; } header nav.gnb > ul > li { float: left; position: relative; } header nav.gnb > ul > li.last ul { right: 0; } header nav.gnb li ul { display: none; position: absolute; width: 140px; background: white; } header nav.gnb li li a { color: #002144; } header nav.gnb > ul > li.active ul { display: block; } header nav.gnb a { display: block; padding: 10px; } header nav.gnb a:hover { background: #f05f5f; color: white; } header nav.shortMenu ul { float: right; } header nav.shortMenu li { float: left; } header nav.shortMenu a { display: block; padding: 10px; } nav.lnb li a { display: block; padding: 10px 10px; } nav.lnb li a:hover { background: #f05f5f; } /* footer */ footer { clear: both; } footer nav.footerMenu li { float: left; } footer nav.footerMenu a { display: block; padding: 10px; } footer nav.footerMenu li:first-child a { padding-left: 0; } footer .familySite { position: relative; } footer .familySite:hover ul { display: block; } footer .familySite p { border: 1px solid white; } footer .familySite p a { display: block; padding: 10px; } footer .familySite ul { position: absolute; width: 100%; bottom: 38px; display: none; border: 1px solid white; border-top: 0 none; } footer .familySite li:last-child a { border-bottom: 0 none; } footer .familySite li a { display: block; padding: 10px; border-top: 1px solid white; background: #002144; } footer .familySite li a:hover { background: #f05f5f; } footer .copyright { clear: both; padding: 10px 0; font-size: 0.9em; } footer .copyright .logoFooter a { display: block; } footer .copyright .logoFooter img { width: 100%; max-width: 200px; } footer address { margin-bottom: 5px; }
module Supa class Builder <API key> = %w(attribute virtual object namespace collection append).freeze def initialize(subject, representer:, tree:) @subject = subject @representer = representer @tree = tree end <API key>.each do |command| klass = Supa::Commands.const_get(command.capitalize) define_method(command) do |name, **options, &block| klass.new(@subject, representer: @representer, tree: @tree, name: name, options: options, &block).represent end end def attributes(*names, **options) Supa::Commands::Attributes.new( @subject, representer: @representer, tree: @tree, name: names, options: options ).represent end def to_hash @tree.to_hash end def to_json Oj.dump(to_hash, mode: :strict) end end end
import org.scalatest.{Matchers, FunSuite} class SeriesTest extends FunSuite with Matchers { test("slices of one") { Series.slices(1, "") should be (List()) Series.slices(1, "01234") should be (List(List(0), List(1), List(2), List(3), List(4))) } test("slices of two") { Series.slices(2, "") should be (List()) Series.slices(2, "01") should be (List(List(0, 1))) Series.slices(2, "01234") should be (List(List(0, 1), List(1, 2), List(2, 3), List(3, 4))) } test("slices of three") { Series.slices(3, "") should be (List()) Series.slices(3, "012") should be (List(List(0, 1, 2))) Series.slices(3, "01234") should be (List(List(0, 1, 2), List(1, 2, 3), List(2, 3, 4))) } }
/** * Copyright (c) 2016 by Silicon Laboratories Inc. All rights reserved. * * http: *****************************************************************************/ #include "uart_1.h" #if <API key> == 1 // declare variable needed for autopage enter/exit #define DECL_PAGE uint8_t savedPage // enter autopage section #define SET_PAGE(p) do \ { \ savedPage = SFRPAGE; /* save current SFR page */ \ SFRPAGE = (p); /* set SFR page */ \ } while(0) // exit autopage section #define RESTORE_PAGE do \ { \ SFRPAGE = savedPage; /* restore saved SFR page */ \ } while(0) #else #define DECL_PAGE #define SET_PAGE(x) #define RESTORE_PAGE #endif //<API key> // SFR page used to access UART1 registers #define UART1_SFR_PAGE 0x20 // Clock prescaler values for baud rate initialization #define NUM_PRESC 8 static const uint8_t PRESC[NUM_PRESC] = {1, 4, 8, 12, 16, 24, 32, 48}; static const uint8_t PRESC_ENUM[NUM_PRESC] = {<API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>, <API key>}; static void UART1_initBaudRate(uint32_t sysclk, uint32_t baudrate) { uint8_t i; uint8_t min_presc; uint16_t reload; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); // Calculate baud rate prescaler and baud rate reload // value to maximize precision. // See reference manual for calculation details min_presc = ((*((uint16_t*)(&sysclk)) >> 1) + baudrate) / baudrate; // calculate minimum prescaler necessary for(i = 0; i < NUM_PRESC; ++i) { if(PRESC[i] >= min_presc) // use a prescaler that is equal or just greater than the minimum { reload = ((1 << 16) - (sysclk / (2 * baudrate * PRESC[i]))); // calculate reload value using prescaler SBRL1 = reload; SBCON1 |= (<API key> | PRESC_ENUM[i]); // enable baud rate with calculated prescaler RESTORE_PAGE; return; } } // Baud rate is too small to be match while(1); } // Runtime API #if (<API key> == 1) uint8_t UART1_getIntFlags(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = SCON1 & (UART1_TX_IF | UART1_RX_IF); RESTORE_PAGE; return val; } void UART1_clearIntFlags(uint8_t flags) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 &= ~(flags); RESTORE_PAGE; } void UART1_enableTxInt(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN1_TIE = enable; RESTORE_PAGE; } void UART1_enableRxInt(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN1_RIE = enable; RESTORE_PAGE; } void UART1_initTxPolling(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1_TI = 1; RESTORE_PAGE; } void UART1_write(uint8_t value) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SBUF1 = value; RESTORE_PAGE; } uint8_t UART1_read(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = SBUF1; RESTORE_PAGE; return val; } #endif void <API key>(uint16_t value) { uint8_t shift, mask; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); // Calculate shift and mask for data length shift = ((SMOD1 & SMOD1_SDL__FMASK) >> SMOD1_SDL__SHIFT) + 5; mask = 0xFF >> (8 - shift); SCON1_TBX = (value >> shift) & 0x1; SBUF1 = (value & mask); RESTORE_PAGE; } uint16_t <API key>(void) { uint8_t shift, mask; uint16_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); // Calculate shift and mask for data length shift = ((SMOD1 & SMOD1_SDL__FMASK) >> SMOD1_SDL__SHIFT) + 5; mask = 0xFF >> (8 - shift); val = SCON1_RBX; val = val << shift; val |= (SBUF1 & mask); RESTORE_PAGE; return val; } #if (<API key> == 1) uint8_t UART1_getErrFlags(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = SCON1 & (UART1_RXOVR_EF | UART1_PARITY_EF); RESTORE_PAGE; return val; } void UART1_clearErrFlags(uint8_t flags) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 &= ~flags; RESTORE_PAGE; } uint8_t <API key>(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = UART1FCN1 & (UART1_TFRQ_IF | UART1_RFRQ_IF); RESTORE_PAGE; return val; } #endif void <API key>(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1FCN0 |= <API key>; } else { UART1FCN0 &= ~<API key>; } RESTORE_PAGE; } void <API key>(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1FCN0 |= <API key>; } else { UART1FCN0 &= ~<API key>; } RESTORE_PAGE; } #if (<API key> == 1) uint8_t <API key>(void) { uint8_t txcnt; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); txcnt = (UART1FCT & <API key>) >> <API key>; RESTORE_PAGE; return txcnt; } uint8_t <API key>(void) { uint8_t rxcnt; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); rxcnt = (UART1FCT & <API key>) >> <API key>; RESTORE_PAGE; return rxcnt; } #endif bool UART1_isTxFifoFull(void){ bool txfull; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(UART1FCN1 & <API key>) { txfull = false; } else { txfull = true; } RESTORE_PAGE; return txfull; } void UART1_stallTxFifo(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1FCN1 |= <API key>; } else { UART1FCN1 &= ~<API key>; } RESTORE_PAGE; } #if (<API key> == 1) void UART1_flushTxFifo(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 |= <API key>; RESTORE_PAGE; } void UART1_flushRxFifo(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 |= <API key>; RESTORE_PAGE; } uint8_t <API key>(void) { uint8_t val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); val = UART1LIN & UART1_AUTOBAUD_IF; RESTORE_PAGE; return val; } void <API key>(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1LIN &= ~UART1_AUTOBAUD_IF; RESTORE_PAGE; } #endif void <API key>(bool enable) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); if(enable) { UART1LIN |= (<API key> | <API key>); } else { UART1LIN &= ~(<API key> | <API key>); } RESTORE_PAGE; } // Initialization API void UART1_init(uint32_t sysclk, uint32_t baudrate, UART1_DataLen_t datalen, UART1_StopLen_t stoplen, UART1_FeatureBit_t featbit, UART1_ParityType_t partype, UART1_RxEnable_t rxen, UART1_Multiproc_t mcen) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1_initBaudRate(sysclk, baudrate); SCON1 = rxen; SMOD1 = datalen | stoplen | featbit | partype | mcen; RESTORE_PAGE; } void <API key>(UART1_BrPrescaler_t presc, UART1_StopLen_t stoplen, UART1_FeatureBit_t featbit, UART1_ParityType_t partype, UART1_RxEnable_t rxen, UART1_Multiproc_t mcen) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 = rxen; SMOD1 = SMOD1_SDL__8_BITS | stoplen | featbit | partype | mcen; UART1LIN = (<API key> | <API key>); SBCON1 = (<API key> | presc); RESTORE_PAGE; } void UART1_reset(void) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 = SCON1_OVR__NOT_SET | SCON1_PERR__NOT_SET | <API key> | SCON1_TBX__LOW | SCON1_RBX__LOW | SCON1_TI__NOT_SET | SCON1_RI__NOT_SET; SMOD1 = <API key> | <API key> | <API key> | SMOD1_SDL__8_BITS | SMOD1_XBE__DISABLED | SMOD1_SBL__SHORT; SBCON1 = <API key> | <API key>; UART1LIN = (<API key> | <API key>); RESTORE_PAGE; } void UART1_initTxFifo(<API key> txth, UART1_TxFifoInt_t txint) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 &= ~(<API key> | <API key> | <API key> | <API key>); UART1FCN0 |= (txth | txint); UART1FCN1 &= ~(<API key> | <API key> | <API key> | <API key>); UART1FCN1 |= (UART1FCN1_TFRQ__SET | <API key> | <API key>); RESTORE_PAGE; } void UART1_initRxFifo(<API key> rxth, <API key> rxto, UART1_RxFifoInt_t rxint) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); UART1FCN0 &= ~(<API key> | <API key> | <API key> | <API key>); UART1FCN0 |= (rxth | rxint); UART1FCN1 &= ~(<API key> | <API key> | <API key>); UART1FCN1 |= (UART1FCN1_RFRQ__SET | rxto | <API key>); RESTORE_PAGE; } // Buffer Access API #if <API key> == 1 SI_SEGMENT_VARIABLE(txRemaining, static uint8_t, SI_SEG_XDATA) = 0; SI_SEGMENT_VARIABLE(rxRemaining, static uint8_t, SI_SEG_XDATA) = 0; <API key>(txBuffer, static uint8_t, <API key>, SI_SEG_XDATA); <API key>(rxBuffer, static uint8_t, <API key>, SI_SEG_XDATA); SI_INTERRUPT(UART1_ISR, UART1_IRQn) { #if (<API key> == 1) uint8_t discard; uint8_t errors; #endif //<API key> // If auto-baud sync word detected to set baudrate, clear flag and disable auto-baud detection if (UART1LIN & UART1_AUTOBAUD_IF) { UART1LIN &= ~(UART1_AUTOBAUD_IF | <API key> | <API key>); } // If rx fifo request interrupt is set and enabled if ((UART1FCN1 & UART1_RFRQ_IF) && (UART1FCN0 & <API key>)) { // Read bytes as long as rx fifo count is not zero and there // is room in the tx buffer while (rxRemaining && ((UART1FCT & <API key>) >> <API key>)) { #if (<API key> == 1) // If parity or overrun error, clear flags, and call user errors = SCON1 & (UART1_RXOVR_EF | UART1_PARITY_EF); if(errors) { SCON1 &= ~errors; <API key>(errors); } // Store byte if there is no parity error a if (errors & UART1_PARITY_EF) { discard = SBUF1; } else #endif //<API key> { *rxBuffer = SBUF1; ++rxBuffer; --rxRemaining; if (!rxRemaining) { <API key>(); } } } if(!rxRemaining) { // Flush Fifo if there is no room available in rx buffer UART1FCN0 |= <API key>; } } // If tx fifo request interrupt is set and enabled if ((UART1FCN1 & UART1_TFRQ_IF) && (UART1FCN0 & <API key>)) { // Write bytes as long as the tx fifo is not full and there // is room in the tx buffer while (txRemaining && (UART1FCN1 & <API key>)) { SBUF1 = *txBuffer; ++txBuffer; --txRemaining; } if(!txRemaining) { <API key>(); } } } void UART1_writeBuffer(<API key>(buffer, uint8_t, <API key>), uint8_t length) { // Initialize internal data txBuffer = buffer; txRemaining = length; // Enable tx fifo interrupts to kick off transfer UART1FCN0 |= <API key>; } void UART1_readBuffer(<API key>(buffer, uint8_t, <API key>), uint8_t length) { // Initialize internal data rxBuffer = buffer; rxRemaining = length; } void UART1_abortTx(void) { txRemaining = 0; UART1_flushTxFifo(); } void UART1_abortRx(void) { rxRemaining = 0; UART1_flushRxFifo(); } uint8_t <API key>(void) { return txRemaining; } uint8_t <API key>(void) { return rxRemaining; } #endif //<API key> // STDIO API #if <API key> == 1 char putchar(char c){ DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); while(!SCON1_TI); SBUF1 = c; SCON1_TI = 0; RESTORE_PAGE; return c; } char _getkey(void){ char val; DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); while(!SCON1_RI); SCON1_RI = 0; val = SBUF1; RESTORE_PAGE; return val; } void UART1_initStdio(uint32_t sysclk, uint32_t baudrate) { DECL_PAGE; SET_PAGE(UART1_SFR_PAGE); SCON1 |= <API key> | SCON1_TI__SET; SMOD1 |= SMOD1_SDL__8_BITS; UART1_initBaudRate(sysclk, baudrate); RESTORE_PAGE; } #endif //<API key>
define(["widgetjs/widgetjs", "lodash", "jquery", "prettify", "code", "bootstrap"], function(widgetjs, lodash, jQuery, prettify, code) { var examples = {}; examples.modals = code({ group: "Modals", label: "Modals", links: ["http://getbootstrap.com/javascript/#modals"], example : function(html) { // Modal html.div({"class": "clearfix bs-example-modal"}, html.div({ klass: "modal"}, html.div({ klass: "modal-dialog"}, html.div({ klass: "modal-content"}, html.div({ klass: "modal-header"}, html.button({ type: "button", klass: "close", "data-dismiss": "modal", "aria-hidden": "true"}, "&times;" ), html.h4({ klass: "modal-title"}, "Modal title" ) ), html.div({ klass: "modal-body"}, html.p( "One fine body&hellip;" ) ), html.div({ klass: "modal-footer"}, html.button({ type: "button", klass: "btn btn-default", "data-dismiss": "modal"}, "Close" ), html.button({ type: "button", klass: "btn btn-primary"}, "Save changes" ) ) ) ) ) ); } }); examples.modalsDemo = code({ group: "Modals", label: "Live Demo", links: ["http://getbootstrap.com/javascript/#modals"], example : function(html) { // Modal html.div({ id: "myModal", klass: "modal fade"}, html.div({ klass: "modal-dialog"}, html.div({ klass: "modal-content"}, html.div({ klass: "modal-header"}, html.button({ type: "button", klass: "close", "data-dismiss": "modal", "aria-hidden": "true"}, "&times;" ), html.h4({ klass: "modal-title"}, "Modal title" ) ), html.div({ klass: "modal-body"}, html.p( "One fine body&hellip;" ) ), html.div({ klass: "modal-footer"}, html.button({ type: "button", klass: "btn btn-default", "data-dismiss": "modal"}, "Close" ), html.button({ type: "button", klass: "btn btn-primary"}, "Save changes" ) ) ) ) ); html.button({ klass: "btn btn-primary btn-lg", "data-toggle": "modal", "data-target": "#myModal"}, "Show modal"); } }); examples.toolTips = code({ group: "Tooltips", label: "Live Demo", links: ["http://getbootstrap.com/javascript/#tooltips"], example : function(html) { // TOOLTIPS html.div({ klass: "tooltip-demo"}, html.div({ klass: "bs-example-tooltips"}, html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "left", title: "", "data-original-title": "Tooltip on left"}, "Tooltip on left" ), html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "top", title: "", "data-original-title": "Tooltip on top"}, "Tooltip on top" ), html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "bottom", title: "", "data-original-title": "Tooltip on bottom"}, "Tooltip on bottom" ), html.button({ type: "button", klass: "btn btn-default", "data-toggle": "tooltip", "data-placement": "right", title: "", "data-original-title": "Tooltip on right"}, "Tooltip on right" ) ) ); jQuery(".bs-example-tooltips").tooltip(); } }); examples.popovers = code({ group: "Popovers", label: "Popovers", links: ["http://getbootstrap.com/javascript/#popovers"], example : function(html) { // Popovers html.div({ klass: "bs-example-popovers"}, html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "left", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Left" ), html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "top", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Top" ), html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "bottom", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Bottom" ), html.button({ type: "button", klass: "btn btn-default", "data-container": "body", "data-toggle": "popover", "data-placement": "right", "data-content": "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", "data-original-title": "", title: ""}, "Right" ) ); jQuery(".bs-example-popovers button").popover(); } }); examples.buttonsCheckbox = code({ group: "Buttons", label: "Checkbox", links: ["http://getbootstrap.com/javascript/#buttons"], example : function(html) { html.div({ style: "padding-bottom: 24px;"}, html.div({ klass: "btn-group", "data-toggle": "buttons"}, html.label({ klass: "btn btn-primary"}, html.input({ type: "checkbox"}), "Option 1" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "checkbox"}), "Option 2" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "checkbox"}), "Option 3" ) ) ); } }); examples.buttonsRadio= code({ group: "Buttons", label: "Radio", links: ["http://getbootstrap.com/javascript/#buttons"], example : function(html) { html.div({ style: "padding-bottom: 24px;"}, html.div({ klass: "btn-group", "data-toggle": "buttons"}, html.label({ klass: "btn btn-primary"}, html.input({ type: "radio"}), "Option 1" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "radio"}), "Option 2" ), html.label({ klass: "btn btn-primary"}, html.input({ type: "radio"}), "Option 3" ) ) ); } }); examples.collapse = code({ group: "Collapse", label: "Collapse", links: ["http://getbootstrap.com/javascript/#collapse"], example : function(html) { html.div({ klass: "panel-group", id: "accordion"}, html.div({ klass: "panel panel-default"}, html.div({ klass: "panel-heading"}, html.h4({ klass: "panel-title"}, html.a({ "data-toggle": "collapse", "data-parent": "#accordion", href: "#collapseOne"}, "Heading ) ) ), html.div({ id: "collapseOne", klass: "panel-collapse collapse in"}, html.div({ klass: "panel-body"}, "Content" ) ) ), html.div({ klass: "panel panel-default"}, html.div({ klass: "panel-heading"}, html.h4({ klass: "panel-title"}, html.a({ "data-toggle": "collapse", "data-parent": "#accordion", href: "#collapseTwo"}, "Heading ) ) ), html.div({ id: "collapseTwo", klass: "panel-collapse collapse"}, html.div({ klass: "panel-body"}, "Content" ) ) ), html.div({ klass: "panel panel-default"}, html.div({ klass: "panel-heading"}, html.h4({ klass: "panel-title"}, html.a({ "data-toggle": "collapse", "data-parent": "#accordion", href: "#collapseThree"}, "Heading ) ) ), html.div({ id: "collapseThree", klass: "panel-collapse collapse"}, html.div({ klass: "panel-body"}, "Content" ) ) ) ); } }); return examples; });
class <API key> < ActiveRecord::Migration def change add_column :questions, :correct_answer, :integer, :default => nil end end
module.exports = require('./lib/dustjs-browserify');
namespace GE.WebUI.ViewModels { public sealed class VMGameMenuEmptyGame { public string IconPath { get; set; } public string GoodImagePath { get; set; } public string BadImagePath { get; set; } } }
/* orconfig.h. Generated from orconfig.h.in by configure. */ /* orconfig.h.in. Generated from configure.ac by autoheader. */ #include <openssl/opensslv.h> /* Define if building universal (internal helper macro) */ /* #undef <API key> */ /* tor's configuration directory */ #define CONFDIR "/usr/local/etc/tor" /* Defined if we're not going to look for a torrc in SYSCONF */ /* #undef <API key> */ /* shared data dir */ #define SHARE_DATADIR "/usr/share" /* home tor folder */ #define LOCALSTATEDIR "" /* Defined if we have a curve25519 implementation */ #define CURVE25519_ENABLED 1 /* Enable dmalloc's malloc function check */ /* #undef DMALLOC_FUNC_CHECK */ /* Define to 1 iff memset(0) sets doubles to 0.0 */ #define <API key> 1 /* Defined if we try to use freelists for buffer RAM chunks */ #define <API key> 1 /* Defined if we default to host local appdata paths on Windows */ /* #undef <API key> */ /* Defined if we will try to use multithreading */ #define ENABLE_THREADS 1 /* Define if enum is always signed */ /* #undef <API key> */ /* Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like `struct s { int n; double d[<API key>]; };', the struct hack can be used with pre-C99 compilers. When computing the size of such an object, don't use 'sizeof (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with MSVC and with C++ compilers. */ #define <API key> /* Define to 1 if you have the `accept4' function. */ /* #undef HAVE_ACCEPT4 */ /* Define to 1 if you have the <arpa/inet.h> header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H 1 /* Define to 1 if you have the `backtrace' function. */ #define HAVE_BACKTRACE 1 /* Define to 1 if you have the `<API key>' function. */ #define <API key> 1 /* Define to 1 if you have the `cap_set_proc' function. */ /* #undef HAVE_CAP_SET_PROC */ /* Defined if the requested minimum BOOST version is satisfied */ #define HAVE_BOOST 1 /* Define to 1 if you have <boost/filesystem/path.hpp> */ #define <API key> 1 /* Define to 1 if you have <boost/system/error_code.hpp> */ #define <API key> 1 /* Define to 1 if you have the `clock_gettime' function. */ /* #undef HAVE_CLOCK_GETTIME */ /* Define to 1 if you have the <crt_externs.h> header file. */ #define HAVE_CRT_EXTERNS_H 1 /* Define to 1 if you have the <<API key>.h> header file. */ /* #undef <API key> */ /* Define to 1 if you have the <cygwin/signal.h> header file. */ /* #undef <API key> */ /* Define to 1 if you have the declaration of `mlockall', and to 0 if you don't. */ #define HAVE_DECL_MLOCKALL 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the declaration of `SecureZeroMemory', and to 0 if you don't. */ /* #undef <API key> */ /* Define to 1 if you have the declaration of `_getwch', and to 0 if you don't. */ /* #undef HAVE_DECL__GETWCH */ /* Define to 1 if you have the <dmalloc.h> header file. */ /* #undef HAVE_DMALLOC_H */ /* Define to 1 if you have the `dmalloc_strdup' function. */ /* #undef HAVE_DMALLOC_STRDUP */ /* Define to 1 if you have the `dmalloc_strndup' function. */ /* #undef <API key> */ /* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the `<API key>' function. */ /* #undef <API key> */ /* Define to 1 if you have the <event2/bufferevent_ssl.h> header file. */ #define <API key> 1 /* Define to 1 if you have the <event2/dns.h> header file. */ #define HAVE_EVENT2_DNS_H 1 /* Define to 1 if you have the <event2/event.h> header file. */ #define HAVE_EVENT2_EVENT_H 1 /* Define to 1 if you have the `eventfd' function. */ /* #undef HAVE_EVENTFD */ /* Define to 1 if you have the `event_base_loopexit' function. */ #define <API key> 1 /* Define to 1 if you have the `event_get_method' function. */ #define <API key> 1 /* Define to 1 if you have the `event_get_version' function. */ #define <API key> 1 /* Define to 1 if you have the `<API key>' function. */ #define <API key> 1 /* Define to 1 if you have the `EVP_PBE_scrypt' function. */ /* #undef HAVE_EVP_PBE_SCRYPT */ /* Define to 1 if you have the `<API key>' function. */ #define <API key> 1 /* Define to 1 if you have the `<API key>' function. */ /* #undef <API key> */ /* Define to 1 if you have the <execinfo.h> header file. */ #define HAVE_EXECINFO_H 1 /* Define to 1 if you have the `explicit_bzero' function. */ /* #undef HAVE_EXPLICIT_BZERO */ /* Defined if we have extern char **environ already declared */ /* #undef <API key> */ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `flock' function. */ #define HAVE_FLOCK 1 /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 /* Define to 1 if you have the `getaddrinfo' function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `getentropy' function. */ /* #undef HAVE_GETENTROPY */ /* Define this if you have any gethostbyname_r() */ /* #undef <API key> */ /* Define this if gethostbyname_r takes 3 arguments */ /* #undef <API key> */ /* Define this if gethostbyname_r takes 5 arguments */ /* #undef <API key> */ /* Define this if gethostbyname_r takes 6 arguments */ /* #undef <API key> */ /* Define to 1 if you have the `getifaddrs' function. */ #define HAVE_GETIFADDRS 1 /* Define to 1 if you have the `getpass' function. */ #define HAVE_GETPASS 1 /* Define to 1 if you have the `getresgid' function. */ /* #undef HAVE_GETRESGID */ /* Define to 1 if you have the `getresuid' function. */ /* #undef HAVE_GETRESUID */ /* Define to 1 if you have the `getrlimit' function. */ #define HAVE_GETRLIMIT 1 /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the `gmtime_r' function. */ #define HAVE_GMTIME_R 1 /* Define to 1 if you have the <grp.h> header file. */ #define HAVE_GRP_H 1 /* Define to 1 if you have the `htonll' function. */ /* #undef HAVE_HTONLL */ /* Define to 1 if you have the <ifaddrs.h> header file. */ #define HAVE_IFADDRS_H 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `ioctl' function. */ #define HAVE_IOCTL 1 /* Define to 1 if you have the `issetugid' function. */ #define HAVE_ISSETUGID 1 /* Define to 1 if you have the `cap' library (-lcap). */ /* #undef HAVE_LIBCAP */ /* Define to 1 if you have the <libscrypt.h> header file. */ /* #undef HAVE_LIBSCRYPT_H */ /* Define to 1 if you have the `libscrypt_scrypt' function. */ /* #undef <API key> */ /* Define to 1 if you have the <limits.h> header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the <linux/if.h> header file. */ /* #undef HAVE_LINUX_IF_H */ /* Define to 1 if you have the <linux/netfilter_ipv4.h> header file. */ /* #undef <API key> */ /* Define to 1 if you have the <linux/netfilter_ipv6/ip6_tables.h> header file. */ /* #undef <API key> */ /* Define to 1 if you have the <linux/types.h> header file. */ /* #undef HAVE_LINUX_TYPES_H */ /* Define to 1 if you have the `llround' function. */ #define HAVE_LLROUND 1 /* Define to 1 if you have the `localtime_r' function. */ #define HAVE_LOCALTIME_R 1 /* Define to 1 if you have the `lround' function. */ #define HAVE_LROUND 1 /* Define to 1 if you have the <machine/limits.h> header file. */ #define <API key> 1 /* Defined if the compiler supports __FUNCTION__ */ #define <API key> 1 /* Defined if the compiler supports __FUNC__ */ /* #undef HAVE_MACRO__FUNC__ */ /* Defined if the compiler supports __func__ */ #define HAVE_MACRO__func__ 1 /* Define to 1 if you have the `mallinfo' function. */ /* #undef HAVE_MALLINFO */ /* Define to 1 if you have the <malloc.h> header file. */ /* #undef HAVE_MALLOC_H */ /* Define to 1 if you have the <malloc/malloc.h> header file. */ #define <API key> 1 /* Define to 1 if you have the <malloc_np.h> header file. */ /* #undef HAVE_MALLOC_NP_H */ /* Define to 1 if you have the `memmem' function. */ #define HAVE_MEMMEM 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `memset_s' function. */ /* #undef HAVE_MEMSET_S */ /* Define to 1 if you have the `mlockall' function. */ #define HAVE_MLOCKALL 1 /* Define to 1 if you have the <nacl/<API key>.h> header file. */ /* #undef <API key> */ /* Define to 1 if you have the <netdb.h> header file. */ #define HAVE_NETDB_H 1 /* Define to 1 if you have the <netinet/in6.h> header file. */ /* #undef HAVE_NETINET_IN6_H */ /* Define to 1 if you have the <netinet/in.h> header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the <net/if.h> header file. */ #define HAVE_NET_IF_H 1 /* Define to 1 if you have the <net/pfvar.h> header file. */ /* #undef HAVE_NET_PFVAR_H */ /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 /* Define to 1 if you have the `pipe2' function. */ /* #undef HAVE_PIPE2 */ /* Define to 1 if you have the `prctl' function. */ /* #undef HAVE_PRCTL */ /* Define to 1 if you have the `<API key>' function. */ /* #undef <API key> */ /* Define to 1 if you have the `pthread_create' function. */ #define HAVE_PTHREAD_CREATE 1 /* Define to 1 if you have the <pthread.h> header file. */ #define HAVE_PTHREAD_H 1 /* Define to 1 if you have the <pwd.h> header file. */ #define HAVE_PWD_H 1 /* Define to 1 if you have the `readpassphrase' function. */ #define HAVE_READPASSPHRASE 1 /* Define to 1 if you have the <readpassphrase.h> header file. */ #define <API key> 1 /* Define to 1 if you have the `rint' function. */ #define HAVE_RINT 1 /* Define to 1 if the system has the type `rlim_t'. */ #define HAVE_RLIM_T 1 /* Define to 1 if you have the `RtlSecureZeroMemory' function. */ /* #undef <API key> */ /* Define to 1 if the system has the type `sa_family_t'. */ #define HAVE_SA_FAMILY_T 1 /* Define to 1 if you have the <seccomp.h> header file. */ /* #undef HAVE_SECCOMP_H */ /* Define to 1 if you have the `SecureZeroMemory' function. */ /* #undef <API key> */ /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the `socketpair' function. */ #define HAVE_SOCKETPAIR 1 /* Define to 1 if the system has the type `ssize_t'. */ #define HAVE_SSIZE_T 1 /* Define to 1 if you have the `SSL_CIPHER_find' function. */ /* #undef <API key> */ /* Define to 1 if you have the `<API key>' function. */ #define <API key> 1 /* Define to 1 if you have the `<API key>' function. */ #define <API key> 1 /* Define to 1 if you have the `<API key>' function. */ #define <API key> 1 /* Define to 1 if you have the `<API key>' function. */ #define <API key> 1 /* Define to 1 if you have the `statvfs' function. */ #define HAVE_STATVFS 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strlcat' function. */ #define HAVE_STRLCAT 1 /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 /* Define to 1 if you have the `strnlen' function. */ #define HAVE_STRNLEN 1 /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 /* Define to 1 if you have the `strtok_r' function. */ #define HAVE_STRTOK_R 1 /* Define to 1 if you have the `strtoull' function. */ #define HAVE_STRTOULL 1 /* Define to 1 if `min_heap_idx' is a member of `struct event'. */ /* #undef <API key> */ /* Define to 1 if the system has the type `struct in6_addr'. */ #define <API key> 1 /* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */ /* #undef <API key> */ /* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */ /* #undef <API key> */ /* Define to 1 if the system has the type `struct sockaddr_in6'. */ #define <API key> 1 /* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */ #define <API key> 1 /* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */ #define <API key> 1 /* Define to 1 if `get_cipher_by_char' is a member of `struct ssl_method_st'. */ /* #undef <API key> */ /* Define to 1 if `tv_sec' is a member of `struct timeval'. */ #define <API key> 1 /* Define to 1 if you have the `sysconf' function. */ #define HAVE_SYSCONF 1 /* Define to 1 if you have the `sysctl' function. */ #define HAVE_SYSCTL 1 /* Define to 1 if you have the <syslog.h> header file. */ #define HAVE_SYSLOG_H 1 /* Have systemd */ /* #undef HAVE_SYSTEMD */ /* Have systemd v209 or more */ /* #undef HAVE_SYSTEMD_209 */ /* Define to 1 if you have the <sys/capability.h> header file. */ /* #undef <API key> */ /* Define to 1 if you have the <sys/eventfd.h> header file. */ /* #undef HAVE_SYS_EVENTFD_H */ /* Define to 1 if you have the <sys/fcntl.h> header file. */ #define HAVE_SYS_FCNTL_H 1 /* Define to 1 if you have the <sys/file.h> header file. */ #define HAVE_SYS_FILE_H 1 /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the <sys/limits.h> header file. */ /* #undef HAVE_SYS_LIMITS_H */ /* Define to 1 if you have the <sys/mman.h> header file. */ #define HAVE_SYS_MMAN_H 1 /* Define to 1 if you have the <sys/param.h> header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the <sys/prctl.h> header file. */ /* #undef HAVE_SYS_PRCTL_H */ /* Define to 1 if you have the <sys/resource.h> header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the <sys/statvfs.h> header file. */ #define HAVE_SYS_STATVFS_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/syscall.h> header file. */ #define HAVE_SYS_SYSCALL_H 1 /* Define to 1 if you have the <sys/sysctl.h> header file. */ #define HAVE_SYS_SYSCTL_H 1 /* Define to 1 if you have the <sys/syslimits.h> header file. */ #define <API key> 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <sys/ucontext.h> header file. */ #define HAVE_SYS_UCONTEXT_H 1 /* Define to 1 if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 /* Define to 1 if you have the <sys/utime.h> header file. */ /* #undef HAVE_SYS_UTIME_H */ /* Define to 1 if you have the <sys/wait.h> header file. */ #define HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the <time.h> header file. */ #define HAVE_TIME_H 1 /* Define to 1 if you have the `timingsafe_memcmp' function. */ /* #undef <API key> */ /* Define to 1 if you have the `TLS_method' function. */ /* #undef HAVE_TLS_METHOD */ /* Define to 1 if you have the <ucontext.h> header file. */ /* #undef HAVE_UCONTEXT_H */ /* Define to 1 if the system has the type `uint'. */ #define HAVE_UINT 1 /* Define to 1 if you have the `uname' function. */ #define HAVE_UNAME 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `usleep' function. */ #define HAVE_USLEEP 1 /* Define to 1 if you have the <utime.h> header file. */ #define HAVE_UTIME_H 1 /* Define to 1 if the system has the type `u_char'. */ #define HAVE_U_CHAR 1 /* Define to 1 if you have the `vasprintf' function. */ #define HAVE_VASPRINTF 1 /* Define to 1 if you have the `_NSGetEnviron' function. */ #define HAVE__NSGETENVIRON 1 /* Define to 1 if you have the `_vscprintf' function. */ /* #undef HAVE__VSCPRINTF */ /* Defined if we want to keep track of how much of each kind of resource we download. */ /* #undef <API key> */ /* name of the syslog facility */ #define LOGFACILITY LOG_DAEMON /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Define to 1 iff malloc(0) returns a pointer */ #define MALLOC_ZERO_WORKS 1 /* Define to 1 if we are building with UPnP. */ /* #undef MINIUPNPC */ /* libminiupnpc version 1.5 found */ /* #undef MINIUPNPC15 */ /* Define to 1 if we are building with nat-pmp. */ /* #undef NAT_PMP */ /* Define to 1 iff memset(0) sets pointers to NULL */ #define <API key> 1 /* "Define to handle pf on OpenBSD properly" */ /* #undef OPENBSD */ /* Name of package */ #define PACKAGE "tor" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "tor" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "tor 0.3.0.9" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "tor" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "0.3.0.9" /* How to access the PC from a struct ucontext */ #define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip /* Define to 1 iff right-shifting a negative value performs sign-extension */ #define <API key> 1 /* The size of `cell_t', as computed by sizeof. */ #define SIZEOF_CELL_T 0 /* The size of `char', as computed by sizeof. */ #define SIZEOF_CHAR 1 /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `int16_t', as computed by sizeof. */ #define SIZEOF_INT16_T 2 /* The size of `int32_t', as computed by sizeof. */ #define SIZEOF_INT32_T 4 /* The size of `int64_t', as computed by sizeof. */ #define SIZEOF_INT64_T 8 /* The size of `int8_t', as computed by sizeof. */ #define SIZEOF_INT8_T 1 /* The size of `intptr_t', as computed by sizeof. */ #define SIZEOF_INTPTR_T 8 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 /* The size of `pid_t', as computed by sizeof. */ #define SIZEOF_PID_T 4 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `socklen_t', as computed by sizeof. */ #define SIZEOF_SOCKLEN_T 4 /* The size of `time_t', as computed by sizeof. */ #define SIZEOF_TIME_T 8 /* The size of `uint16_t', as computed by sizeof. */ #define SIZEOF_UINT16_T 2 /* The size of `uint32_t', as computed by sizeof. */ #define SIZEOF_UINT32_T 4 /* The size of `uint64_t', as computed by sizeof. */ #define SIZEOF_UINT64_T 8 /* The size of `uint8_t', as computed by sizeof. */ #define SIZEOF_UINT8_T 1 /* The size of `uintptr_t', as computed by sizeof. */ #define SIZEOF_UINTPTR_T 8 /* The size of `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 8 /* The size of `__int64', as computed by sizeof. */ #define SIZEOF___INT64 0 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if time_t is signed */ #define TIME_T_IS_SIGNED 1 /* Defined if we're going to use Libevent's buffered IO API */ /* #undef USE_BUFFEREVENTS */ /* Defined if we should use an internal curve25519_donna{,_c64} implementation */ #define <API key> 1 /* Defined if we should use a curve25519 from nacl */ /* #undef USE_CURVE25519_NACL */ /* Debug memory allocation library */ /* #undef USE_DMALLOC */ /* "Define to enable transparent proxy support" */ /* #undef USE_TRANSPARENT */ /* Define to 1 iff we represent negative integers with two's complement */ #define <API key> 1 /* Version number of package */ #define VERSION "0.3.0.9" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined <API key> # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef <API key> # define <API key> 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define on some platforms to activate x_r() functions in time.h */ /* #undef _REENTRANT */ /* Define to `unsigned short' if <sys/types.h> does not define. */ /* #undef u_int16_t */ /* Define to `unsigned long' if <sys/types.h> does not define. */ /* #undef u_int32_t */ /* Define to `unsigned long long' if <sys/types.h> does not define. */ /* #undef u_int64_t */ /* Define to `unsigned char' if <sys/types.h> does not define. */ /* #undef u_int8_t */
// This source file is part of appleseed. // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // all copies or substantial portions of the Software. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // 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 <API key> #define <API key> // appleseed.renderer headers. #include "renderer/modeling/entity/entity.h" // appleseed.foundation headers. #include "foundation/image/colorspace.h" #include "foundation/utility/uid.h" // appleseed.main headers. #include "main/dllsymbol.h" // Standard headers. #include <cstddef> // Forward declarations. namespace foundation { class CanvasProperties; } namespace foundation { class Tile; } namespace renderer { class ParamArray; } namespace renderer { // The base class for textures. class APPLESEED_DLLSYMBOL Texture : public Entity { public: // Return the unique ID of this class of entities. static foundation::UniqueID get_class_uid(); // Constructor. Texture( const char* name, const ParamArray& params); // Return a string identifying the model of this entity. virtual const char* get_model() const = 0; // Return the color space of the texture. virtual foundation::ColorSpace get_color_space() const = 0; // Access canvas properties. virtual const foundation::CanvasProperties& properties() = 0; // Load a given tile. virtual foundation::Tile* load_tile( const size_t tile_x, const size_t tile_y) = 0; // Unload a given tile. virtual void unload_tile( const size_t tile_x, const size_t tile_y, const foundation::Tile* tile) = 0; }; } // namespace renderer #endif // !<API key>
#ifndef <API key> #define <API key> #include <iterator> #include <functional> #include <asio/deadline_timer.hpp> #include <asio/streambuf.hpp> #include <boost/network/protocol/http/algorithms/linearize.hpp> #include <boost/network/protocol/http/response.hpp> #include <boost/network/protocol/http/traits/resolver_policy.hpp> #include <boost/network/traits/string.hpp> namespace boost { namespace network { namespace http { namespace impl { template <class Tag, unsigned version_major, unsigned version_minor> struct <API key>; template <class Tag, unsigned version_major, unsigned version_minor> struct <API key>; template <class Tag, unsigned version_major, unsigned version_minor> struct <API key> : public virtual <API key><Tag, version_major, version_minor>, <API key><Tag, version_major, version_minor>, std::<API key>< <API key><Tag, version_major, version_minor> > { typedef typename resolver_policy<Tag>::type resolver_base; typedef typename resolver_base::resolver_type resolver_type; typedef typename string<Tag>::type string_type; typedef std::function<typename resolver_base::<API key>( resolver_type&, string_type const&, string_type const&)> <API key>; typedef <API key><Tag, version_major, version_minor> this_type; typedef <API key><Tag, version_major, version_minor> connection_base; typedef std::function<bool(string_type&)> <API key>; <API key>(resolver_type& resolver, <API key> resolve, int timeout) : connection_base(), timeout_(timeout), timer_(resolver.get_io_service()), resolver_(resolver), resolve_(std::move(resolve)), socket_(resolver.get_io_service()) {} void init_socket(string_type const& hostname, string_type const& port) { connection_base::init_socket(socket_, resolver_, hostname, port, resolve_); } void send_request_impl(string_type const& method, basic_request<Tag> const& request_, <API key> generator) { asio::streambuf request_buffer; linearize( request_, method, version_major, version_minor, std::ostreambuf_iterator<typename char_<Tag>::type>(&request_buffer)); connection_base::send_request_impl(socket_, method, request_buffer); if (generator) { string_type chunk; while (generator(chunk)) { std::copy(chunk.begin(), chunk.end(), std::ostreambuf_iterator<typename char_<Tag>::type>( &request_buffer)); chunk.clear(); connection_base::send_request_impl(socket_, method, request_buffer); } } if (timeout_ > 0) { timer_.expires_from_now(boost::posix_time::seconds(timeout_)); auto self = this->shared_from_this(); timer_.async_wait([=] (std::error_code const &ec) { self->handle_timeout(ec); }); } } void read_status(basic_response<Tag>& response_, asio::streambuf& response_buffer) { connection_base::read_status(socket_, response_, response_buffer); } void read_headers(basic_response<Tag>& response, asio::streambuf& response_buffer) { connection_base::read_headers(socket_, response, response_buffer); } void read_body(basic_response<Tag>& response_, asio::streambuf& response_buffer) { connection_base::read_body(socket_, response_, response_buffer); typename headers_range<basic_response<Tag> >::type connection_range = headers(response_)["Connection"]; if (version_major == 1 && version_minor == 1 && !boost::empty(connection_range) && boost::iequals(std::begin(connection_range)->second, "close")) { close_socket(); } else if (version_major == 1 && version_minor == 0) { close_socket(); } } bool is_open() { return socket_.is_open(); } void close_socket() { timer_.cancel(); if (!is_open()) { return; } std::error_code ignored; socket_.shutdown(asio::ip::tcp::socket::shutdown_both, ignored); if (ignored) { return; } socket_.close(ignored); } private: void handle_timeout(std::error_code const& ec) { if (!ec) { close_socket(); } } int timeout_; asio::deadline_timer timer_; resolver_type& resolver_; <API key> resolve_; asio::ip::tcp::socket socket_; }; } // namespace impl } // namespace http } // namespace network } // namespace boost #endif // <API key>
import React from 'react' import Icon from 'react-icon-base' const IoTshirtOutline = props => ( <Icon viewBox="0 0 40 40" {...props}> <g><path d="m11.4 6.7l-8.1 2.4 0.8 2.5 3.1-0.3 3-0.4-0.2 3-1.1 19.9h17.2l-1.1-19.9-0.2-3 3 0.4 3.1 0.3 0.8-2.5-8.1-2.4c-0.5 0.6-1 1.1-1.6 1.5-1.2 0.8-2.7 1.2-4.5 1.2-2.7-0.1-4.6-0.9-6.1-2.7z m11.1-2.9l12.5 3.7-2.5 6.9-5-0.6 1.3 22.5h-22.5l1.2-22.5-5 0.6-2.5-6.9 12.5-3.7c1.1 2.1 2.4 3 5 3.1 2.6 0 3.9-1 5-3.1z"/></g> </Icon> ) export default IoTshirtOutline
import {<API key>} from './<API key>'; import {NgbDate} from '../ngb-date'; import {Injectable} from '@angular/core'; const <API key> = new Date(1882, 10, 12); const GREGORIAN_LAST_DATE = new Date(2174, 10, 25); const HIJRI_BEGIN = 1300; const HIJRI_END = 1600; const ONE_DAY = 1000 * 60 * 60 * 24; const MONTH_LENGTH = [ // 1300-1304 '101010101010', '110101010100', '111011001001', '011011010100', '011011101010', // 1305-1309 '001101101100', '101010101101', '010101010101', '011010101001', '011110010010', // 1310-1314 '101110101001', '010111010100', '101011011010', '010101011100', '110100101101', // 1315-1319 '011010010101', '011101001010', '101101010100', '101101101010', '010110101101', // 1320-1324 '010010101110', '101001001111', '010100010111', '011010001011', '011010100101', // 1325-1329 '101011010101', '001011010110', '100101011011', '010010011101', '101001001101', // 1330-1334 '110100100110', '110110010101', '010110101100', '100110110110', '001010111010', // 1335-1339 '101001011011', '010100101011', '101010010101', '011011001010', '101011101001', // 1340-1344 '001011110100', '100101110110', '001010110110', '100101010110', '101011001010', // 1345-1349 '101110100100', '101111010010', '010111011001', '001011011100', '100101101101', // 1350-1354 '010101001101', '101010100101', '101101010010', '101110100101', '010110110100', // 1355-1359 '100110110110', '010101010111', '001010010111', '010101001011', '011010100011', // 1360-1364 '011101010010', '101101100101', '010101101010', '101010101011', '010100101011', // 1365-1369 '110010010101', '110101001010', '110110100101', '010111001010', '101011010110', // 1370-1374 '100101010111', '010010101011', '100101001011', '101010100101', '101101010010', // 1375-1379 '101101101010', '010101110101', '001001110110', '100010110111', '010001011011', // 1380-1384 '010101010101', '010110101001', '010110110100', '100111011010', '010011011101', // 1385-1389 '001001101110', '100100110110', '101010101010', '110101010100', '110110110010', // 1390-1394 '010111010101', '001011011010', '100101011011', '010010101011', '101001010101', // 1395-1399 '101101001001', '101101100100', '101101110001', '010110110100', '101010110101', // 1400-1404 '101001010101', '110100100101', '111010010010', '111011001001', '011011010100', // 1405-1409 '101011101001', '100101101011', '010010101011', '101010010011', '110101001001', // 1410-1414 '110110100100', '110110110010', '101010111001', '010010111010', '101001011011', // 1415-1419 '010100101011', '101010010101', '101100101010', '101101010101', '010101011100', // 1420-1424 '010010111101', '001000111101', '100100011101', '101010010101', '101101001010', // 1425-1429 '101101011010', '010101101101', '001010110110', '100100111011', '010010011011', // 1430-1434 '011001010101', '011010101001', '011101010100', '101101101010', '010101101100', // 1435-1439 '101010101101', '010101010101', '101100101001', '101110010010', '101110101001', // 1440-1444 '010111010100', '101011011010', '010101011010', '101010101011', '010110010101', // 1445-1449 '011101001001', '011101100100', '101110101010', '010110110101', '001010110110', // 1450-1454 '101001010110', '111001001101', '101100100101', '101101010010', '101101101010', // 1455-1459 '010110101101', '001010101110', '100100101111', '010010010111', '011001001011', // 1460-1464 '011010100101', '011010101100', '101011010110', '010101011101', '010010011101', // 1465-1469 '101001001101', '110100010110', '110110010101', '010110101010', '010110110101', // 1470-1474 '001011011010', '100101011011', '010010101101', '010110010101', '011011001010', // 1475-1479 '011011100100', '101011101010', '010011110101', '001010110110', '100101010110', // 1480-1484 '101010101010', '101101010100', '101111010010', '010111011001', '001011101010', // 1485-1489 '100101101101', '010010101101', '101010010101', '101101001010', '101110100101', // 1490-1494 '010110110010', '100110110101', '010011010110', '101010010111', '010101000111', // 1495-1499 '011010010011', '011101001001', '101101010101', '010101101010', '101001101011', // 1500-1504 '010100101011', '101010001011', '110101000110', '110110100011', '010111001010', // 1505-1509 '101011010110', '010011011011', '001001101011', '100101001011', '101010100101', // 1510-1514 '101101010010', '101101101001', '010101110101', '000101110110', '100010110111', // 1515-1519 '001001011011', '010100101011', '010101100101', '010110110100', '100111011010', // 1520-1524 '010011101101', '000101101101', '100010110110', '101010100110', '110101010010', // 1525-1529 '110110101001', '010111010100', '101011011010', '100101011011', '010010101011', // 1530-1534 '011001010011', '011100101001', '011101100010', '101110101001', '010110110010', // 1535-1539 '101010110101', '010101010101', '101100100101', '110110010010', '111011001001', // 1540-1544 '011011010010', '101011101001', '010101101011', '010010101011', '101001010101', // 1545-1549 '110100101001', '110101010100', '110110101010', '100110110101', '010010111010', // 1550-1554 '101000111011', '010010011011', '101001001101', '101010101010', '101011010101', // 1555-1559 '001011011010', '100101011101', '010001011110', '101000101110', '110010011010', // 1560-1564 '110101010101', '011010110010', '011010111001', '010010111010', '101001011101', // 1565-1569 '010100101101', '101010010101', '101101010010', '101110101000', '101110110100', // 1570-1574 '010110111001', '001011011010', '100101011010', '101101001010', '110110100100', // 1575-1579 '111011010001', '011011101000', '101101101010', '010101101101', '010100110101', // 1580-1584 '011010010101', '110101001010', '110110101000', '110111010100', '011011011010', // 1585-1589 '010101011011', '001010011101', '011000101011', '101100010101', '101101001010', // 1590-1594 '101110010101', '010110101010', '101010101110', '100100101110', '110010001111', // 1595-1599 '010100100111', '011010010101', '011010101010', '101011010110', '010101011101', // 1600 '001010011101' ]; function getDaysDiff(date1: Date, date2: Date): number { const diff = Math.abs(date1.getTime() - date2.getTime()); return Math.round(diff / ONE_DAY); } @Injectable() export class <API key> extends <API key> { /** * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date. * `gdate` is s JS Date to be converted to Hijri. */ fromGregorian(gDate: Date): NgbDate { let hDay = 1, hMonth = 0, hYear = 1300; let daysDiff = getDaysDiff(gDate, <API key>); if (gDate.getTime() - <API key>.getTime() >= 0 && gDate.getTime() - GREGORIAN_LAST_DATE.getTime() <= 0) { let year = 1300; for (let i = 0; i < MONTH_LENGTH.length; i++, year++) { for (let j = 0; j < 12; j++) { let numOfDays = +MONTH_LENGTH[i][j] + 29; if (daysDiff <= numOfDays) { hDay = daysDiff + 1; if (hDay > numOfDays) { hDay = 1; j++; } if (j > 11) { j = 0; year++; } hMonth = j; hYear = year; return new NgbDate(hYear, hMonth + 1, hDay); } daysDiff = daysDiff - numOfDays; } } } else { return super.fromGregorian(gDate); } } /** * Converts the current Hijri date to Gregorian. */ toGregorian(hDate: NgbDate): Date { const hYear = hDate.year; const hMonth = hDate.month - 1; const hDay = hDate.day; let gDate = new Date(<API key>); let dayDiff = hDay - 1; if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) { for (let y = 0; y < hYear - HIJRI_BEGIN; y++) { for (let m = 0; m < 12; m++) { dayDiff += +MONTH_LENGTH[y][m] + 29; } } for (let m = 0; m < hMonth; m++) { dayDiff += +MONTH_LENGTH[hYear - HIJRI_BEGIN][m] + 29; } gDate.setDate(<API key>.getDate() + dayDiff); } else { gDate = super.toGregorian(hDate); } return gDate; } /** * Returns the number of days in a specific Hijri hMonth. * `hMonth` is 1 for Muharram, 2 for Safar, etc. * `hYear` is any Hijri hYear. */ getDaysPerMonth(hMonth: number, hYear: number): number { if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) { const pos = hYear - HIJRI_BEGIN; return +MONTH_LENGTH[pos][hMonth - 1] + 29; } return super.getDaysPerMonth(hMonth, hYear); } }
# Supported tags and respective `Dockerfile` links - [`3.1.23`, `3.1`, `3`, `latest` (*Dockerfile*)](https://github.com/docker-library/celery/blob/<SHA1-like>/Dockerfile) [![](https: For more information about this image and its history, please see [the relevant manifest file (`library/celery`)](https: For detailed information about the virtual/transfer sizes and individual layers of each of the above supported tags, please see [the `celery/tag-details.md` file](https: # Celery Celery is an open source asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well. > [wikipedia.org/wiki/Celery_Task_Queue](https://en.wikipedia.org/wiki/Celery_Task_Queue) # How to use this image ## start a celery worker (RabbitMQ Broker) console $ docker run --link some-rabbit:rabbit --name some-celery -d celery check the status of the cluster console $ docker run --link some-rabbit:rabbit --rm celery celery status ## start a celery worker (Redis Broker) console $ docker run --link some-redis:redis -e CELERY_BROKER_URL=redis://redis --name some-celery -d celery check the status of the cluster console $ docker run --link some-redis:redis -e CELERY_BROKER_URL=redis://redis --rm celery celery status # Supported Docker versions This image is officially supported on Docker version 1.11.1. Support for older versions (down to 1.6) is provided on a best-effort basis. Please see [the Docker installation documentation](https://docs.docker.com/installation/) for details on how to upgrade your Docker daemon. # User Feedback ## Documentation Documentation for this image is stored in the [`celery/` directory](https: ## Issues If you have any problems with or questions about this image, please contact us through a [GitHub issue](https: You can also reach many of the official image maintainers via the ` ## Contributing You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. Before you start to code, we recommend discussing your plans through a [GitHub issue](https://github.com/docker-library/celery/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Permalinks</title> <link rel="stylesheet" href="../assets/css/ghost.min.css"> <!-- Styles not needed for this. Just to get around various bits that Ember handles for us. --> <style> @media (max-width: 900px) { .settings-nav { top: 0; left: -100%; } .settings-content { margin-left: 0; } } </style> </head> <body class="ember-application settings <API key>" data-apps="false" data-filestorage="true" data-blogurl="http://127.0.0.1:2368"> <div id="container"><a class="sr-only sr-only-focusable" href="#gh-main">Skip to main content</a> <nav class="global-nav" role="navigation"> <a class="nav-item ghost-logo" href="/" title="/"> <div class="nav-label"><i class="icon-ghost"></i> <span>Visit blog</span> </div> </a> <a class="nav-item nav-content js-nav-item" href="/ghost/"> <div class="nav-label"><i class="icon-content"></i> Content</div> </a> <a class="nav-item nav-new js-nav-item" href="/ghost/editor/"> <div class="nav-label"><i class="icon-add"></i> New Post</div> </a> <a class="nav-item nav-settings js-nav-item active" href="/ghost/settings/"> <div class="nav-label"><i class="icon-settings2"></i> Settings</div> </a> <div class="nav-item user-menu" data-href=" <div class=" nav-label"> <div class="image"> <img src="../../../core/shared/img/user-image.png" alt="Paul Davis's profile picture"> </div> <div class="name"> Paul Davis <i class="icon-chevron-down"></i> <small>Profile &amp; Settings</small> </div> </div> </div> </nav> <div class="nav-cover js-nav-cover"></div> <main id="gh-main" class="viewport" role="main" <API key>="0" data-bindattr-448="448"> <aside class="notifications top"> </aside> <aside class="notifications bottom"> </aside> <div> <header class="page-header"> <button class="menu-button js-menu-button" data-ember-action="1221"> <span class="sr-only">Menu</span> </button> <h2 class="page-title">Settings</h2> </header> <div class="page-content"> <nav class="settings-nav js-settings-nav"> <ul> <li class="<API key> icon-settings active"><a class="active" href="/ghost/settings/general/">General</a> </li> <li class="settings-nav-users icon-users"><a href="/ghost/settings/users/">Users</a> </li> <li class="settings-nav-about icon-pacman"><a href="/ghost/settings/about/">About</a> </li> </ul> </nav> <section class="settings-content js-settings-content fade-in"> <header class="<API key>"> <a class="gh-btn gh-btn-default gh-btn-back active" href="/ghost/settings/"><span>Back</span></a> <h2 class="page-title">General</h2> <section class="page-actions"> <button type="button" class="gh-btn gh-btn-blue" data-ember-action="1271"><span>Save</span></button> </section> </header> <section class="content settings-general"> <form id="settings-general" novalidate="novalidate"> <div class="form-group"> <label for="blog-title">Blog Title</label> <input id="blog-title" class="" type="text" name="general[title]" value="Paul Davis"> <p>The name of your blog</p> </div> <div class="form-group"> <label for="blog-logo">Blog Logo</label> <button type="button" class="gh-btn gh-btn-green js-modal-logo" data-ember-action="1277"><span>Upload Image</span></button> <p>Display a sexy logo for your publication</p> </div> <fieldset> <div class="form-group"> <label for="postsPerPage">Posts per page</label> <input id="postsPerPage" class="" type="number" name="general[postsPerPage]" min="1" max="1000" value="5"> <p>How many posts should be displayed on each page</p> </div> <div class="form-group"> <label for="blog-permalinks">Permalinks</label> <label class="<API key> input" tabindex="0"> <div class="<API key>"> <span class="permalink-domain">http://myblog.ghost.io</span> <span class="permalink-parameter label label-default">journal</span> <span class="permalink-parameter label label-default">year</span> <span class="permalink-parameter label label-default">hello</span> <span class="permalink-parameter label label-default">agaian</span> <span class="permalink-parameter label label-default">this</span> <span class="permalink-parameter label label-default">is</span> <span class="permalink-parameter label label-default">nice</span> <span class="permalink-parameter label label-default">yo</span> <span class="permalink-parameter label label-default">yo</span> <span class="permalink-parameter label label-default">yo</span> <input id="blog-permalinks" class="permalink-input" type="text" name="general[permalinks]"> </div> <div class="popover"> <button class="permalink-help button icon-question hover-me"> <span class="hidden">URL Structure Formatting</span> </button> <div class="popover-item closed <API key>"> <div class="popover-title">URL Structure Formatting</div> <div class="popover-desc">You can use dynamic variables in this field.</div> <div class="popover-body"> <p> <b>%t</b> - The title of your post (or page)<br> <b>%c</b> - The tag which your post is categorised in<br> <b>%y</b> - The year your post was published<br> <b>%m</b> - The month your post was published<br> <b>%d</b> - The day your post was published </p> </div> </div> </div> </label> <p>The default URL structure for your blog</p> </div> <div class="form-group for-select"> <label for="activeTheme">Theme</label> <span class="gh-select" data-bindattr-1286="1286" tabindex="0" data-select-text="Casper - 1.1.0"> <select id="activeTheme" class="ember-select" name="general[activeTheme]"> <option value="casper">Casper - 1.1.0</option> <option value="hayleybrowne">HJB - 0.5</option> <option value="mono">Mono - 0.1.0</option> <option value="pad-gs">PAD-GS - 0.8</option> <option value="pauladamdavis">PAD - 0.8</option> </select> </span> <p>Select a theme for your blog</p> </div> </fieldset> </form> </section> </section> </div> </div> </main> </div> </body> </html> <script src="../../../bower_components/jquery/dist/jquery.js"></script> <script> $(function(){ $('.<API key>').on('click', function(){ $(this).addClass('focus'); $('#blog-permalinks').focus(); }); $('#blog-permalinks').on('blur', function(){ $('.<API key>').removeClass('focus'); }); $('.hover-me').hover(function(){ $(this).next('.popover-item').addClass('open fade-in').removeClass('closed fade-out'); }, function(){ $(this).next('.popover-item').removeClass('fade-in').addClass('fade-out'); $(this).next('.popover-item').on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) { if (event.originalEvent.animationName === 'fade-out') { $(this).removeClass('open fade-out').addClass('closed'); } }); }); function convertToSlug(Text){ return Text.toLowerCase().replace(/[^\w ]+/g,'').replace(/ +/g,'-').trim(); } $('#blog-permalinks').on('keyup', function(e){ // 188 = comma // Append the new parameter when pressing comma if (e.keyCode === 188) { var input_val = convertToSlug($(this).val()); var the_param = '<span class="permalink-parameter label label-default">' + input_val + '</span>'; // If a parameter exists, append after it. // Else append after the domain if ($('.permalink-parameter').length) { $('.permalink-parameter:last').after(the_param); } else { $('.permalink-domain').after(the_param); } $(this).val(''); } // 8 = backspace // When backspace is pressed AND the input is empty, delete the last parameter if (e.keyCode === 8 && $(this).val() == '') { $('.permalink-parameter:last').remove(); } }); }); </script>
<?php namespace Chamilo\Application\Weblcms\Tool\Implementation\ExamAssignment\Ajax\Component; use Chamilo\Application\Weblcms\Tool\Implementation\ExamAssignment\Ajax\Manager; use Symfony\Component\HttpFoundation\JsonResponse; class ListUsersComponent extends Manager { /** * @return string */ function run() { try { $publication = $this->getAjaxComponent()-><API key>(); $users = $this-><API key>()-><API key>($publication); return new JsonResponse([self::PARAM_RESULTS => $users]); } catch(\Exception $ex) { $this->getExceptionLogger()->logException($ex); return new JsonResponse([self::PARAM_ERROR_MESSAGE => $ex->getMessage()], 500); } } }