text
stringlengths 2
97.5k
| meta
dict |
|---|---|
/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
readers do not read off random characters that represent icons */
.#{$fa-css-prefix}-glass:before { content: $fa-var-glass; }
.#{$fa-css-prefix}-music:before { content: $fa-var-music; }
.#{$fa-css-prefix}-search:before { content: $fa-var-search; }
.#{$fa-css-prefix}-envelope-o:before { content: $fa-var-envelope-o; }
.#{$fa-css-prefix}-heart:before { content: $fa-var-heart; }
.#{$fa-css-prefix}-star:before { content: $fa-var-star; }
.#{$fa-css-prefix}-star-o:before { content: $fa-var-star-o; }
.#{$fa-css-prefix}-user:before { content: $fa-var-user; }
.#{$fa-css-prefix}-film:before { content: $fa-var-film; }
.#{$fa-css-prefix}-th-large:before { content: $fa-var-th-large; }
.#{$fa-css-prefix}-th:before { content: $fa-var-th; }
.#{$fa-css-prefix}-th-list:before { content: $fa-var-th-list; }
.#{$fa-css-prefix}-check:before { content: $fa-var-check; }
.#{$fa-css-prefix}-remove:before,
.#{$fa-css-prefix}-close:before,
.#{$fa-css-prefix}-times:before { content: $fa-var-times; }
.#{$fa-css-prefix}-search-plus:before { content: $fa-var-search-plus; }
.#{$fa-css-prefix}-search-minus:before { content: $fa-var-search-minus; }
.#{$fa-css-prefix}-power-off:before { content: $fa-var-power-off; }
.#{$fa-css-prefix}-signal:before { content: $fa-var-signal; }
.#{$fa-css-prefix}-gear:before,
.#{$fa-css-prefix}-cog:before { content: $fa-var-cog; }
.#{$fa-css-prefix}-trash-o:before { content: $fa-var-trash-o; }
.#{$fa-css-prefix}-home:before { content: $fa-var-home; }
.#{$fa-css-prefix}-file-o:before { content: $fa-var-file-o; }
.#{$fa-css-prefix}-clock-o:before { content: $fa-var-clock-o; }
.#{$fa-css-prefix}-road:before { content: $fa-var-road; }
.#{$fa-css-prefix}-download:before { content: $fa-var-download; }
.#{$fa-css-prefix}-arrow-circle-o-down:before { content: $fa-var-arrow-circle-o-down; }
.#{$fa-css-prefix}-arrow-circle-o-up:before { content: $fa-var-arrow-circle-o-up; }
.#{$fa-css-prefix}-inbox:before { content: $fa-var-inbox; }
.#{$fa-css-prefix}-play-circle-o:before { content: $fa-var-play-circle-o; }
.#{$fa-css-prefix}-rotate-right:before,
.#{$fa-css-prefix}-repeat:before { content: $fa-var-repeat; }
.#{$fa-css-prefix}-refresh:before { content: $fa-var-refresh; }
.#{$fa-css-prefix}-list-alt:before { content: $fa-var-list-alt; }
.#{$fa-css-prefix}-lock:before { content: $fa-var-lock; }
.#{$fa-css-prefix}-flag:before { content: $fa-var-flag; }
.#{$fa-css-prefix}-headphones:before { content: $fa-var-headphones; }
.#{$fa-css-prefix}-volume-off:before { content: $fa-var-volume-off; }
.#{$fa-css-prefix}-volume-down:before { content: $fa-var-volume-down; }
.#{$fa-css-prefix}-volume-up:before { content: $fa-var-volume-up; }
.#{$fa-css-prefix}-qrcode:before { content: $fa-var-qrcode; }
.#{$fa-css-prefix}-barcode:before { content: $fa-var-barcode; }
.#{$fa-css-prefix}-tag:before { content: $fa-var-tag; }
.#{$fa-css-prefix}-tags:before { content: $fa-var-tags; }
.#{$fa-css-prefix}-book:before { content: $fa-var-book; }
.#{$fa-css-prefix}-bookmark:before { content: $fa-var-bookmark; }
.#{$fa-css-prefix}-print:before { content: $fa-var-print; }
.#{$fa-css-prefix}-camera:before { content: $fa-var-camera; }
.#{$fa-css-prefix}-font:before { content: $fa-var-font; }
.#{$fa-css-prefix}-bold:before { content: $fa-var-bold; }
.#{$fa-css-prefix}-italic:before { content: $fa-var-italic; }
.#{$fa-css-prefix}-text-height:before { content: $fa-var-text-height; }
.#{$fa-css-prefix}-text-width:before { content: $fa-var-text-width; }
.#{$fa-css-prefix}-align-left:before { content: $fa-var-align-left; }
.#{$fa-css-prefix}-align-center:before { content: $fa-var-align-center; }
.#{$fa-css-prefix}-align-right:before { content: $fa-var-align-right; }
.#{$fa-css-prefix}-align-justify:before { content: $fa-var-align-justify; }
.#{$fa-css-prefix}-list:before { content: $fa-var-list; }
.#{$fa-css-prefix}-dedent:before,
.#{$fa-css-prefix}-outdent:before { content: $fa-var-outdent; }
.#{$fa-css-prefix}-indent:before { content: $fa-var-indent; }
.#{$fa-css-prefix}-video-camera:before { content: $fa-var-video-camera; }
.#{$fa-css-prefix}-photo:before,
.#{$fa-css-prefix}-image:before,
.#{$fa-css-prefix}-picture-o:before { content: $fa-var-picture-o; }
.#{$fa-css-prefix}-pencil:before { content: $fa-var-pencil; }
.#{$fa-css-prefix}-map-marker:before { content: $fa-var-map-marker; }
.#{$fa-css-prefix}-adjust:before { content: $fa-var-adjust; }
.#{$fa-css-prefix}-tint:before { content: $fa-var-tint; }
.#{$fa-css-prefix}-edit:before,
.#{$fa-css-prefix}-pencil-square-o:before { content: $fa-var-pencil-square-o; }
.#{$fa-css-prefix}-share-square-o:before { content: $fa-var-share-square-o; }
.#{$fa-css-prefix}-check-square-o:before { content: $fa-var-check-square-o; }
.#{$fa-css-prefix}-arrows:before { content: $fa-var-arrows; }
.#{$fa-css-prefix}-step-backward:before { content: $fa-var-step-backward; }
.#{$fa-css-prefix}-fast-backward:before { content: $fa-var-fast-backward; }
.#{$fa-css-prefix}-backward:before { content: $fa-var-backward; }
.#{$fa-css-prefix}-play:before { content: $fa-var-play; }
.#{$fa-css-prefix}-pause:before { content: $fa-var-pause; }
.#{$fa-css-prefix}-stop:before { content: $fa-var-stop; }
.#{$fa-css-prefix}-forward:before { content: $fa-var-forward; }
.#{$fa-css-prefix}-fast-forward:before { content: $fa-var-fast-forward; }
.#{$fa-css-prefix}-step-forward:before { content: $fa-var-step-forward; }
.#{$fa-css-prefix}-eject:before { content: $fa-var-eject; }
.#{$fa-css-prefix}-chevron-left:before { content: $fa-var-chevron-left; }
.#{$fa-css-prefix}-chevron-right:before { content: $fa-var-chevron-right; }
.#{$fa-css-prefix}-plus-circle:before { content: $fa-var-plus-circle; }
.#{$fa-css-prefix}-minus-circle:before { content: $fa-var-minus-circle; }
.#{$fa-css-prefix}-times-circle:before { content: $fa-var-times-circle; }
.#{$fa-css-prefix}-check-circle:before { content: $fa-var-check-circle; }
.#{$fa-css-prefix}-question-circle:before { content: $fa-var-question-circle; }
.#{$fa-css-prefix}-info-circle:before { content: $fa-var-info-circle; }
.#{$fa-css-prefix}-crosshairs:before { content: $fa-var-crosshairs; }
.#{$fa-css-prefix}-times-circle-o:before { content: $fa-var-times-circle-o; }
.#{$fa-css-prefix}-check-circle-o:before { content: $fa-var-check-circle-o; }
.#{$fa-css-prefix}-ban:before { content: $fa-var-ban; }
.#{$fa-css-prefix}-arrow-left:before { content: $fa-var-arrow-left; }
.#{$fa-css-prefix}-arrow-right:before { content: $fa-var-arrow-right; }
.#{$fa-css-prefix}-arrow-up:before { content: $fa-var-arrow-up; }
.#{$fa-css-prefix}-arrow-down:before { content: $fa-var-arrow-down; }
.#{$fa-css-prefix}-mail-forward:before,
.#{$fa-css-prefix}-share:before { content: $fa-var-share; }
.#{$fa-css-prefix}-expand:before { content: $fa-var-expand; }
.#{$fa-css-prefix}-compress:before { content: $fa-var-compress; }
.#{$fa-css-prefix}-plus:before { content: $fa-var-plus; }
.#{$fa-css-prefix}-minus:before { content: $fa-var-minus; }
.#{$fa-css-prefix}-asterisk:before { content: $fa-var-asterisk; }
.#{$fa-css-prefix}-exclamation-circle:before { content: $fa-var-exclamation-circle; }
.#{$fa-css-prefix}-gift:before { content: $fa-var-gift; }
.#{$fa-css-prefix}-leaf:before { content: $fa-var-leaf; }
.#{$fa-css-prefix}-fire:before { content: $fa-var-fire; }
.#{$fa-css-prefix}-eye:before { content: $fa-var-eye; }
.#{$fa-css-prefix}-eye-slash:before { content: $fa-var-eye-slash; }
.#{$fa-css-prefix}-warning:before,
.#{$fa-css-prefix}-exclamation-triangle:before { content: $fa-var-exclamation-triangle; }
.#{$fa-css-prefix}-plane:before { content: $fa-var-plane; }
.#{$fa-css-prefix}-calendar:before { content: $fa-var-calendar; }
.#{$fa-css-prefix}-random:before { content: $fa-var-random; }
.#{$fa-css-prefix}-comment:before { content: $fa-var-comment; }
.#{$fa-css-prefix}-magnet:before { content: $fa-var-magnet; }
.#{$fa-css-prefix}-chevron-up:before { content: $fa-var-chevron-up; }
.#{$fa-css-prefix}-chevron-down:before { content: $fa-var-chevron-down; }
.#{$fa-css-prefix}-retweet:before { content: $fa-var-retweet; }
.#{$fa-css-prefix}-shopping-cart:before { content: $fa-var-shopping-cart; }
.#{$fa-css-prefix}-folder:before { content: $fa-var-folder; }
.#{$fa-css-prefix}-folder-open:before { content: $fa-var-folder-open; }
.#{$fa-css-prefix}-arrows-v:before { content: $fa-var-arrows-v; }
.#{$fa-css-prefix}-arrows-h:before { content: $fa-var-arrows-h; }
.#{$fa-css-prefix}-bar-chart-o:before,
.#{$fa-css-prefix}-bar-chart:before { content: $fa-var-bar-chart; }
.#{$fa-css-prefix}-twitter-square:before { content: $fa-var-twitter-square; }
.#{$fa-css-prefix}-facebook-square:before { content: $fa-var-facebook-square; }
.#{$fa-css-prefix}-camera-retro:before { content: $fa-var-camera-retro; }
.#{$fa-css-prefix}-key:before { content: $fa-var-key; }
.#{$fa-css-prefix}-gears:before,
.#{$fa-css-prefix}-cogs:before { content: $fa-var-cogs; }
.#{$fa-css-prefix}-comments:before { content: $fa-var-comments; }
.#{$fa-css-prefix}-thumbs-o-up:before { content: $fa-var-thumbs-o-up; }
.#{$fa-css-prefix}-thumbs-o-down:before { content: $fa-var-thumbs-o-down; }
.#{$fa-css-prefix}-star-half:before { content: $fa-var-star-half; }
.#{$fa-css-prefix}-heart-o:before { content: $fa-var-heart-o; }
.#{$fa-css-prefix}-sign-out:before { content: $fa-var-sign-out; }
.#{$fa-css-prefix}-linkedin-square:before { content: $fa-var-linkedin-square; }
.#{$fa-css-prefix}-thumb-tack:before { content: $fa-var-thumb-tack; }
.#{$fa-css-prefix}-external-link:before { content: $fa-var-external-link; }
.#{$fa-css-prefix}-sign-in:before { content: $fa-var-sign-in; }
.#{$fa-css-prefix}-trophy:before { content: $fa-var-trophy; }
.#{$fa-css-prefix}-github-square:before { content: $fa-var-github-square; }
.#{$fa-css-prefix}-upload:before { content: $fa-var-upload; }
.#{$fa-css-prefix}-lemon-o:before { content: $fa-var-lemon-o; }
.#{$fa-css-prefix}-phone:before { content: $fa-var-phone; }
.#{$fa-css-prefix}-square-o:before { content: $fa-var-square-o; }
.#{$fa-css-prefix}-bookmark-o:before { content: $fa-var-bookmark-o; }
.#{$fa-css-prefix}-phone-square:before { content: $fa-var-phone-square; }
.#{$fa-css-prefix}-twitter:before { content: $fa-var-twitter; }
.#{$fa-css-prefix}-facebook:before { content: $fa-var-facebook; }
.#{$fa-css-prefix}-github:before { content: $fa-var-github; }
.#{$fa-css-prefix}-unlock:before { content: $fa-var-unlock; }
.#{$fa-css-prefix}-credit-card:before { content: $fa-var-credit-card; }
.#{$fa-css-prefix}-rss:before { content: $fa-var-rss; }
.#{$fa-css-prefix}-hdd-o:before { content: $fa-var-hdd-o; }
.#{$fa-css-prefix}-bullhorn:before { content: $fa-var-bullhorn; }
.#{$fa-css-prefix}-bell:before { content: $fa-var-bell; }
.#{$fa-css-prefix}-certificate:before { content: $fa-var-certificate; }
.#{$fa-css-prefix}-hand-o-right:before { content: $fa-var-hand-o-right; }
.#{$fa-css-prefix}-hand-o-left:before { content: $fa-var-hand-o-left; }
.#{$fa-css-prefix}-hand-o-up:before { content: $fa-var-hand-o-up; }
.#{$fa-css-prefix}-hand-o-down:before { content: $fa-var-hand-o-down; }
.#{$fa-css-prefix}-arrow-circle-left:before { content: $fa-var-arrow-circle-left; }
.#{$fa-css-prefix}-arrow-circle-right:before { content: $fa-var-arrow-circle-right; }
.#{$fa-css-prefix}-arrow-circle-up:before { content: $fa-var-arrow-circle-up; }
.#{$fa-css-prefix}-arrow-circle-down:before { content: $fa-var-arrow-circle-down; }
.#{$fa-css-prefix}-globe:before { content: $fa-var-globe; }
.#{$fa-css-prefix}-wrench:before { content: $fa-var-wrench; }
.#{$fa-css-prefix}-tasks:before { content: $fa-var-tasks; }
.#{$fa-css-prefix}-filter:before { content: $fa-var-filter; }
.#{$fa-css-prefix}-briefcase:before { content: $fa-var-briefcase; }
.#{$fa-css-prefix}-arrows-alt:before { content: $fa-var-arrows-alt; }
.#{$fa-css-prefix}-group:before,
.#{$fa-css-prefix}-users:before { content: $fa-var-users; }
.#{$fa-css-prefix}-chain:before,
.#{$fa-css-prefix}-link:before { content: $fa-var-link; }
.#{$fa-css-prefix}-cloud:before { content: $fa-var-cloud; }
.#{$fa-css-prefix}-flask:before { content: $fa-var-flask; }
.#{$fa-css-prefix}-cut:before,
.#{$fa-css-prefix}-scissors:before { content: $fa-var-scissors; }
.#{$fa-css-prefix}-copy:before,
.#{$fa-css-prefix}-files-o:before { content: $fa-var-files-o; }
.#{$fa-css-prefix}-paperclip:before { content: $fa-var-paperclip; }
.#{$fa-css-prefix}-save:before,
.#{$fa-css-prefix}-floppy-o:before { content: $fa-var-floppy-o; }
.#{$fa-css-prefix}-square:before { content: $fa-var-square; }
.#{$fa-css-prefix}-navicon:before,
.#{$fa-css-prefix}-reorder:before,
.#{$fa-css-prefix}-bars:before { content: $fa-var-bars; }
.#{$fa-css-prefix}-list-ul:before { content: $fa-var-list-ul; }
.#{$fa-css-prefix}-list-ol:before { content: $fa-var-list-ol; }
.#{$fa-css-prefix}-strikethrough:before { content: $fa-var-strikethrough; }
.#{$fa-css-prefix}-underline:before { content: $fa-var-underline; }
.#{$fa-css-prefix}-table:before { content: $fa-var-table; }
.#{$fa-css-prefix}-magic:before { content: $fa-var-magic; }
.#{$fa-css-prefix}-truck:before { content: $fa-var-truck; }
.#{$fa-css-prefix}-pinterest:before { content: $fa-var-pinterest; }
.#{$fa-css-prefix}-pinterest-square:before { content: $fa-var-pinterest-square; }
.#{$fa-css-prefix}-google-plus-square:before { content: $fa-var-google-plus-square; }
.#{$fa-css-prefix}-google-plus:before { content: $fa-var-google-plus; }
.#{$fa-css-prefix}-money:before { content: $fa-var-money; }
.#{$fa-css-prefix}-caret-down:before { content: $fa-var-caret-down; }
.#{$fa-css-prefix}-caret-up:before { content: $fa-var-caret-up; }
.#{$fa-css-prefix}-caret-left:before { content: $fa-var-caret-left; }
.#{$fa-css-prefix}-caret-right:before { content: $fa-var-caret-right; }
.#{$fa-css-prefix}-columns:before { content: $fa-var-columns; }
.#{$fa-css-prefix}-unsorted:before,
.#{$fa-css-prefix}-sort:before { content: $fa-var-sort; }
.#{$fa-css-prefix}-sort-down:before,
.#{$fa-css-prefix}-sort-desc:before { content: $fa-var-sort-desc; }
.#{$fa-css-prefix}-sort-up:before,
.#{$fa-css-prefix}-sort-asc:before { content: $fa-var-sort-asc; }
.#{$fa-css-prefix}-envelope:before { content: $fa-var-envelope; }
.#{$fa-css-prefix}-linkedin:before { content: $fa-var-linkedin; }
.#{$fa-css-prefix}-rotate-left:before,
.#{$fa-css-prefix}-undo:before { content: $fa-var-undo; }
.#{$fa-css-prefix}-legal:before,
.#{$fa-css-prefix}-gavel:before { content: $fa-var-gavel; }
.#{$fa-css-prefix}-dashboard:before,
.#{$fa-css-prefix}-tachometer:before { content: $fa-var-tachometer; }
.#{$fa-css-prefix}-comment-o:before { content: $fa-var-comment-o; }
.#{$fa-css-prefix}-comments-o:before { content: $fa-var-comments-o; }
.#{$fa-css-prefix}-flash:before,
.#{$fa-css-prefix}-bolt:before { content: $fa-var-bolt; }
.#{$fa-css-prefix}-sitemap:before { content: $fa-var-sitemap; }
.#{$fa-css-prefix}-umbrella:before { content: $fa-var-umbrella; }
.#{$fa-css-prefix}-paste:before,
.#{$fa-css-prefix}-clipboard:before { content: $fa-var-clipboard; }
.#{$fa-css-prefix}-lightbulb-o:before { content: $fa-var-lightbulb-o; }
.#{$fa-css-prefix}-exchange:before { content: $fa-var-exchange; }
.#{$fa-css-prefix}-cloud-download:before { content: $fa-var-cloud-download; }
.#{$fa-css-prefix}-cloud-upload:before { content: $fa-var-cloud-upload; }
.#{$fa-css-prefix}-user-md:before { content: $fa-var-user-md; }
.#{$fa-css-prefix}-stethoscope:before { content: $fa-var-stethoscope; }
.#{$fa-css-prefix}-suitcase:before { content: $fa-var-suitcase; }
.#{$fa-css-prefix}-bell-o:before { content: $fa-var-bell-o; }
.#{$fa-css-prefix}-coffee:before { content: $fa-var-coffee; }
.#{$fa-css-prefix}-cutlery:before { content: $fa-var-cutlery; }
.#{$fa-css-prefix}-file-text-o:before { content: $fa-var-file-text-o; }
.#{$fa-css-prefix}-building-o:before { content: $fa-var-building-o; }
.#{$fa-css-prefix}-hospital-o:before { content: $fa-var-hospital-o; }
.#{$fa-css-prefix}-ambulance:before { content: $fa-var-ambulance; }
.#{$fa-css-prefix}-medkit:before { content: $fa-var-medkit; }
.#{$fa-css-prefix}-fighter-jet:before { content: $fa-var-fighter-jet; }
.#{$fa-css-prefix}-beer:before { content: $fa-var-beer; }
.#{$fa-css-prefix}-h-square:before { content: $fa-var-h-square; }
.#{$fa-css-prefix}-plus-square:before { content: $fa-var-plus-square; }
.#{$fa-css-prefix}-angle-double-left:before { content: $fa-var-angle-double-left; }
.#{$fa-css-prefix}-angle-double-right:before { content: $fa-var-angle-double-right; }
.#{$fa-css-prefix}-angle-double-up:before { content: $fa-var-angle-double-up; }
.#{$fa-css-prefix}-angle-double-down:before { content: $fa-var-angle-double-down; }
.#{$fa-css-prefix}-angle-left:before { content: $fa-var-angle-left; }
.#{$fa-css-prefix}-angle-right:before { content: $fa-var-angle-right; }
.#{$fa-css-prefix}-angle-up:before { content: $fa-var-angle-up; }
.#{$fa-css-prefix}-angle-down:before { content: $fa-var-angle-down; }
.#{$fa-css-prefix}-desktop:before { content: $fa-var-desktop; }
.#{$fa-css-prefix}-laptop:before { content: $fa-var-laptop; }
.#{$fa-css-prefix}-tablet:before { content: $fa-var-tablet; }
.#{$fa-css-prefix}-mobile-phone:before,
.#{$fa-css-prefix}-mobile:before { content: $fa-var-mobile; }
.#{$fa-css-prefix}-circle-o:before { content: $fa-var-circle-o; }
.#{$fa-css-prefix}-quote-left:before { content: $fa-var-quote-left; }
.#{$fa-css-prefix}-quote-right:before { content: $fa-var-quote-right; }
.#{$fa-css-prefix}-spinner:before { content: $fa-var-spinner; }
.#{$fa-css-prefix}-circle:before { content: $fa-var-circle; }
.#{$fa-css-prefix}-mail-reply:before,
.#{$fa-css-prefix}-reply:before { content: $fa-var-reply; }
.#{$fa-css-prefix}-github-alt:before { content: $fa-var-github-alt; }
.#{$fa-css-prefix}-folder-o:before { content: $fa-var-folder-o; }
.#{$fa-css-prefix}-folder-open-o:before { content: $fa-var-folder-open-o; }
.#{$fa-css-prefix}-smile-o:before { content: $fa-var-smile-o; }
.#{$fa-css-prefix}-frown-o:before { content: $fa-var-frown-o; }
.#{$fa-css-prefix}-meh-o:before { content: $fa-var-meh-o; }
.#{$fa-css-prefix}-gamepad:before { content: $fa-var-gamepad; }
.#{$fa-css-prefix}-keyboard-o:before { content: $fa-var-keyboard-o; }
.#{$fa-css-prefix}-flag-o:before { content: $fa-var-flag-o; }
.#{$fa-css-prefix}-flag-checkered:before { content: $fa-var-flag-checkered; }
.#{$fa-css-prefix}-terminal:before { content: $fa-var-terminal; }
.#{$fa-css-prefix}-code:before { content: $fa-var-code; }
.#{$fa-css-prefix}-mail-reply-all:before,
.#{$fa-css-prefix}-reply-all:before { content: $fa-var-reply-all; }
.#{$fa-css-prefix}-star-half-empty:before,
.#{$fa-css-prefix}-star-half-full:before,
.#{$fa-css-prefix}-star-half-o:before { content: $fa-var-star-half-o; }
.#{$fa-css-prefix}-location-arrow:before { content: $fa-var-location-arrow; }
.#{$fa-css-prefix}-crop:before { content: $fa-var-crop; }
.#{$fa-css-prefix}-code-fork:before { content: $fa-var-code-fork; }
.#{$fa-css-prefix}-unlink:before,
.#{$fa-css-prefix}-chain-broken:before { content: $fa-var-chain-broken; }
.#{$fa-css-prefix}-question:before { content: $fa-var-question; }
.#{$fa-css-prefix}-info:before { content: $fa-var-info; }
.#{$fa-css-prefix}-exclamation:before { content: $fa-var-exclamation; }
.#{$fa-css-prefix}-superscript:before { content: $fa-var-superscript; }
.#{$fa-css-prefix}-subscript:before { content: $fa-var-subscript; }
.#{$fa-css-prefix}-eraser:before { content: $fa-var-eraser; }
.#{$fa-css-prefix}-puzzle-piece:before { content: $fa-var-puzzle-piece; }
.#{$fa-css-prefix}-microphone:before { content: $fa-var-microphone; }
.#{$fa-css-prefix}-microphone-slash:before { content: $fa-var-microphone-slash; }
.#{$fa-css-prefix}-shield:before { content: $fa-var-shield; }
.#{$fa-css-prefix}-calendar-o:before { content: $fa-var-calendar-o; }
.#{$fa-css-prefix}-fire-extinguisher:before { content: $fa-var-fire-extinguisher; }
.#{$fa-css-prefix}-rocket:before { content: $fa-var-rocket; }
.#{$fa-css-prefix}-maxcdn:before { content: $fa-var-maxcdn; }
.#{$fa-css-prefix}-chevron-circle-left:before { content: $fa-var-chevron-circle-left; }
.#{$fa-css-prefix}-chevron-circle-right:before { content: $fa-var-chevron-circle-right; }
.#{$fa-css-prefix}-chevron-circle-up:before { content: $fa-var-chevron-circle-up; }
.#{$fa-css-prefix}-chevron-circle-down:before { content: $fa-var-chevron-circle-down; }
.#{$fa-css-prefix}-html5:before { content: $fa-var-html5; }
.#{$fa-css-prefix}-css3:before { content: $fa-var-css3; }
.#{$fa-css-prefix}-anchor:before { content: $fa-var-anchor; }
.#{$fa-css-prefix}-unlock-alt:before { content: $fa-var-unlock-alt; }
.#{$fa-css-prefix}-bullseye:before { content: $fa-var-bullseye; }
.#{$fa-css-prefix}-ellipsis-h:before { content: $fa-var-ellipsis-h; }
.#{$fa-css-prefix}-ellipsis-v:before { content: $fa-var-ellipsis-v; }
.#{$fa-css-prefix}-rss-square:before { content: $fa-var-rss-square; }
.#{$fa-css-prefix}-play-circle:before { content: $fa-var-play-circle; }
.#{$fa-css-prefix}-ticket:before { content: $fa-var-ticket; }
.#{$fa-css-prefix}-minus-square:before { content: $fa-var-minus-square; }
.#{$fa-css-prefix}-minus-square-o:before { content: $fa-var-minus-square-o; }
.#{$fa-css-prefix}-level-up:before { content: $fa-var-level-up; }
.#{$fa-css-prefix}-level-down:before { content: $fa-var-level-down; }
.#{$fa-css-prefix}-check-square:before { content: $fa-var-check-square; }
.#{$fa-css-prefix}-pencil-square:before { content: $fa-var-pencil-square; }
.#{$fa-css-prefix}-external-link-square:before { content: $fa-var-external-link-square; }
.#{$fa-css-prefix}-share-square:before { content: $fa-var-share-square; }
.#{$fa-css-prefix}-compass:before { content: $fa-var-compass; }
.#{$fa-css-prefix}-toggle-down:before,
.#{$fa-css-prefix}-caret-square-o-down:before { content: $fa-var-caret-square-o-down; }
.#{$fa-css-prefix}-toggle-up:before,
.#{$fa-css-prefix}-caret-square-o-up:before { content: $fa-var-caret-square-o-up; }
.#{$fa-css-prefix}-toggle-right:before,
.#{$fa-css-prefix}-caret-square-o-right:before { content: $fa-var-caret-square-o-right; }
.#{$fa-css-prefix}-euro:before,
.#{$fa-css-prefix}-eur:before { content: $fa-var-eur; }
.#{$fa-css-prefix}-gbp:before { content: $fa-var-gbp; }
.#{$fa-css-prefix}-dollar:before,
.#{$fa-css-prefix}-usd:before { content: $fa-var-usd; }
.#{$fa-css-prefix}-rupee:before,
.#{$fa-css-prefix}-inr:before { content: $fa-var-inr; }
.#{$fa-css-prefix}-cny:before,
.#{$fa-css-prefix}-rmb:before,
.#{$fa-css-prefix}-yen:before,
.#{$fa-css-prefix}-jpy:before { content: $fa-var-jpy; }
.#{$fa-css-prefix}-ruble:before,
.#{$fa-css-prefix}-rouble:before,
.#{$fa-css-prefix}-rub:before { content: $fa-var-rub; }
.#{$fa-css-prefix}-won:before,
.#{$fa-css-prefix}-krw:before { content: $fa-var-krw; }
.#{$fa-css-prefix}-bitcoin:before,
.#{$fa-css-prefix}-btc:before { content: $fa-var-btc; }
.#{$fa-css-prefix}-file:before { content: $fa-var-file; }
.#{$fa-css-prefix}-file-text:before { content: $fa-var-file-text; }
.#{$fa-css-prefix}-sort-alpha-asc:before { content: $fa-var-sort-alpha-asc; }
.#{$fa-css-prefix}-sort-alpha-desc:before { content: $fa-var-sort-alpha-desc; }
.#{$fa-css-prefix}-sort-amount-asc:before { content: $fa-var-sort-amount-asc; }
.#{$fa-css-prefix}-sort-amount-desc:before { content: $fa-var-sort-amount-desc; }
.#{$fa-css-prefix}-sort-numeric-asc:before { content: $fa-var-sort-numeric-asc; }
.#{$fa-css-prefix}-sort-numeric-desc:before { content: $fa-var-sort-numeric-desc; }
.#{$fa-css-prefix}-thumbs-up:before { content: $fa-var-thumbs-up; }
.#{$fa-css-prefix}-thumbs-down:before { content: $fa-var-thumbs-down; }
.#{$fa-css-prefix}-youtube-square:before { content: $fa-var-youtube-square; }
.#{$fa-css-prefix}-youtube:before { content: $fa-var-youtube; }
.#{$fa-css-prefix}-xing:before { content: $fa-var-xing; }
.#{$fa-css-prefix}-xing-square:before { content: $fa-var-xing-square; }
.#{$fa-css-prefix}-youtube-play:before { content: $fa-var-youtube-play; }
.#{$fa-css-prefix}-dropbox:before { content: $fa-var-dropbox; }
.#{$fa-css-prefix}-stack-overflow:before { content: $fa-var-stack-overflow; }
.#{$fa-css-prefix}-instagram:before { content: $fa-var-instagram; }
.#{$fa-css-prefix}-flickr:before { content: $fa-var-flickr; }
.#{$fa-css-prefix}-adn:before { content: $fa-var-adn; }
.#{$fa-css-prefix}-bitbucket:before { content: $fa-var-bitbucket; }
.#{$fa-css-prefix}-bitbucket-square:before { content: $fa-var-bitbucket-square; }
.#{$fa-css-prefix}-tumblr:before { content: $fa-var-tumblr; }
.#{$fa-css-prefix}-tumblr-square:before { content: $fa-var-tumblr-square; }
.#{$fa-css-prefix}-long-arrow-down:before { content: $fa-var-long-arrow-down; }
.#{$fa-css-prefix}-long-arrow-up:before { content: $fa-var-long-arrow-up; }
.#{$fa-css-prefix}-long-arrow-left:before { content: $fa-var-long-arrow-left; }
.#{$fa-css-prefix}-long-arrow-right:before { content: $fa-var-long-arrow-right; }
.#{$fa-css-prefix}-apple:before { content: $fa-var-apple; }
.#{$fa-css-prefix}-windows:before { content: $fa-var-windows; }
.#{$fa-css-prefix}-android:before { content: $fa-var-android; }
.#{$fa-css-prefix}-linux:before { content: $fa-var-linux; }
.#{$fa-css-prefix}-dribbble:before { content: $fa-var-dribbble; }
.#{$fa-css-prefix}-skype:before { content: $fa-var-skype; }
.#{$fa-css-prefix}-foursquare:before { content: $fa-var-foursquare; }
.#{$fa-css-prefix}-trello:before { content: $fa-var-trello; }
.#{$fa-css-prefix}-female:before { content: $fa-var-female; }
.#{$fa-css-prefix}-male:before { content: $fa-var-male; }
.#{$fa-css-prefix}-gittip:before { content: $fa-var-gittip; }
.#{$fa-css-prefix}-sun-o:before { content: $fa-var-sun-o; }
.#{$fa-css-prefix}-moon-o:before { content: $fa-var-moon-o; }
.#{$fa-css-prefix}-archive:before { content: $fa-var-archive; }
.#{$fa-css-prefix}-bug:before { content: $fa-var-bug; }
.#{$fa-css-prefix}-vk:before { content: $fa-var-vk; }
.#{$fa-css-prefix}-weibo:before { content: $fa-var-weibo; }
.#{$fa-css-prefix}-renren:before { content: $fa-var-renren; }
.#{$fa-css-prefix}-pagelines:before { content: $fa-var-pagelines; }
.#{$fa-css-prefix}-stack-exchange:before { content: $fa-var-stack-exchange; }
.#{$fa-css-prefix}-arrow-circle-o-right:before { content: $fa-var-arrow-circle-o-right; }
.#{$fa-css-prefix}-arrow-circle-o-left:before { content: $fa-var-arrow-circle-o-left; }
.#{$fa-css-prefix}-toggle-left:before,
.#{$fa-css-prefix}-caret-square-o-left:before { content: $fa-var-caret-square-o-left; }
.#{$fa-css-prefix}-dot-circle-o:before { content: $fa-var-dot-circle-o; }
.#{$fa-css-prefix}-wheelchair:before { content: $fa-var-wheelchair; }
.#{$fa-css-prefix}-vimeo-square:before { content: $fa-var-vimeo-square; }
.#{$fa-css-prefix}-turkish-lira:before,
.#{$fa-css-prefix}-try:before { content: $fa-var-try; }
.#{$fa-css-prefix}-plus-square-o:before { content: $fa-var-plus-square-o; }
.#{$fa-css-prefix}-space-shuttle:before { content: $fa-var-space-shuttle; }
.#{$fa-css-prefix}-slack:before { content: $fa-var-slack; }
.#{$fa-css-prefix}-envelope-square:before { content: $fa-var-envelope-square; }
.#{$fa-css-prefix}-wordpress:before { content: $fa-var-wordpress; }
.#{$fa-css-prefix}-openid:before { content: $fa-var-openid; }
.#{$fa-css-prefix}-institution:before,
.#{$fa-css-prefix}-bank:before,
.#{$fa-css-prefix}-university:before { content: $fa-var-university; }
.#{$fa-css-prefix}-mortar-board:before,
.#{$fa-css-prefix}-graduation-cap:before { content: $fa-var-graduation-cap; }
.#{$fa-css-prefix}-yahoo:before { content: $fa-var-yahoo; }
.#{$fa-css-prefix}-google:before { content: $fa-var-google; }
.#{$fa-css-prefix}-reddit:before { content: $fa-var-reddit; }
.#{$fa-css-prefix}-reddit-square:before { content: $fa-var-reddit-square; }
.#{$fa-css-prefix}-stumbleupon-circle:before { content: $fa-var-stumbleupon-circle; }
.#{$fa-css-prefix}-stumbleupon:before { content: $fa-var-stumbleupon; }
.#{$fa-css-prefix}-delicious:before { content: $fa-var-delicious; }
.#{$fa-css-prefix}-digg:before { content: $fa-var-digg; }
.#{$fa-css-prefix}-pied-piper:before { content: $fa-var-pied-piper; }
.#{$fa-css-prefix}-pied-piper-alt:before { content: $fa-var-pied-piper-alt; }
.#{$fa-css-prefix}-drupal:before { content: $fa-var-drupal; }
.#{$fa-css-prefix}-joomla:before { content: $fa-var-joomla; }
.#{$fa-css-prefix}-language:before { content: $fa-var-language; }
.#{$fa-css-prefix}-fax:before { content: $fa-var-fax; }
.#{$fa-css-prefix}-building:before { content: $fa-var-building; }
.#{$fa-css-prefix}-child:before { content: $fa-var-child; }
.#{$fa-css-prefix}-paw:before { content: $fa-var-paw; }
.#{$fa-css-prefix}-spoon:before { content: $fa-var-spoon; }
.#{$fa-css-prefix}-cube:before { content: $fa-var-cube; }
.#{$fa-css-prefix}-cubes:before { content: $fa-var-cubes; }
.#{$fa-css-prefix}-behance:before { content: $fa-var-behance; }
.#{$fa-css-prefix}-behance-square:before { content: $fa-var-behance-square; }
.#{$fa-css-prefix}-steam:before { content: $fa-var-steam; }
.#{$fa-css-prefix}-steam-square:before { content: $fa-var-steam-square; }
.#{$fa-css-prefix}-recycle:before { content: $fa-var-recycle; }
.#{$fa-css-prefix}-automobile:before,
.#{$fa-css-prefix}-car:before { content: $fa-var-car; }
.#{$fa-css-prefix}-cab:before,
.#{$fa-css-prefix}-taxi:before { content: $fa-var-taxi; }
.#{$fa-css-prefix}-tree:before { content: $fa-var-tree; }
.#{$fa-css-prefix}-spotify:before { content: $fa-var-spotify; }
.#{$fa-css-prefix}-deviantart:before { content: $fa-var-deviantart; }
.#{$fa-css-prefix}-soundcloud:before { content: $fa-var-soundcloud; }
.#{$fa-css-prefix}-database:before { content: $fa-var-database; }
.#{$fa-css-prefix}-file-pdf-o:before { content: $fa-var-file-pdf-o; }
.#{$fa-css-prefix}-file-word-o:before { content: $fa-var-file-word-o; }
.#{$fa-css-prefix}-file-excel-o:before { content: $fa-var-file-excel-o; }
.#{$fa-css-prefix}-file-powerpoint-o:before { content: $fa-var-file-powerpoint-o; }
.#{$fa-css-prefix}-file-photo-o:before,
.#{$fa-css-prefix}-file-picture-o:before,
.#{$fa-css-prefix}-file-image-o:before { content: $fa-var-file-image-o; }
.#{$fa-css-prefix}-file-zip-o:before,
.#{$fa-css-prefix}-file-archive-o:before { content: $fa-var-file-archive-o; }
.#{$fa-css-prefix}-file-sound-o:before,
.#{$fa-css-prefix}-file-audio-o:before { content: $fa-var-file-audio-o; }
.#{$fa-css-prefix}-file-movie-o:before,
.#{$fa-css-prefix}-file-video-o:before { content: $fa-var-file-video-o; }
.#{$fa-css-prefix}-file-code-o:before { content: $fa-var-file-code-o; }
.#{$fa-css-prefix}-vine:before { content: $fa-var-vine; }
.#{$fa-css-prefix}-codepen:before { content: $fa-var-codepen; }
.#{$fa-css-prefix}-jsfiddle:before { content: $fa-var-jsfiddle; }
.#{$fa-css-prefix}-life-bouy:before,
.#{$fa-css-prefix}-life-buoy:before,
.#{$fa-css-prefix}-life-saver:before,
.#{$fa-css-prefix}-support:before,
.#{$fa-css-prefix}-life-ring:before { content: $fa-var-life-ring; }
.#{$fa-css-prefix}-circle-o-notch:before { content: $fa-var-circle-o-notch; }
.#{$fa-css-prefix}-ra:before,
.#{$fa-css-prefix}-rebel:before { content: $fa-var-rebel; }
.#{$fa-css-prefix}-ge:before,
.#{$fa-css-prefix}-empire:before { content: $fa-var-empire; }
.#{$fa-css-prefix}-git-square:before { content: $fa-var-git-square; }
.#{$fa-css-prefix}-git:before { content: $fa-var-git; }
.#{$fa-css-prefix}-hacker-news:before { content: $fa-var-hacker-news; }
.#{$fa-css-prefix}-tencent-weibo:before { content: $fa-var-tencent-weibo; }
.#{$fa-css-prefix}-qq:before { content: $fa-var-qq; }
.#{$fa-css-prefix}-wechat:before,
.#{$fa-css-prefix}-weixin:before { content: $fa-var-weixin; }
.#{$fa-css-prefix}-send:before,
.#{$fa-css-prefix}-paper-plane:before { content: $fa-var-paper-plane; }
.#{$fa-css-prefix}-send-o:before,
.#{$fa-css-prefix}-paper-plane-o:before { content: $fa-var-paper-plane-o; }
.#{$fa-css-prefix}-history:before { content: $fa-var-history; }
.#{$fa-css-prefix}-circle-thin:before { content: $fa-var-circle-thin; }
.#{$fa-css-prefix}-header:before { content: $fa-var-header; }
.#{$fa-css-prefix}-paragraph:before { content: $fa-var-paragraph; }
.#{$fa-css-prefix}-sliders:before { content: $fa-var-sliders; }
.#{$fa-css-prefix}-share-alt:before { content: $fa-var-share-alt; }
.#{$fa-css-prefix}-share-alt-square:before { content: $fa-var-share-alt-square; }
.#{$fa-css-prefix}-bomb:before { content: $fa-var-bomb; }
.#{$fa-css-prefix}-soccer-ball-o:before,
.#{$fa-css-prefix}-futbol-o:before { content: $fa-var-futbol-o; }
.#{$fa-css-prefix}-tty:before { content: $fa-var-tty; }
.#{$fa-css-prefix}-binoculars:before { content: $fa-var-binoculars; }
.#{$fa-css-prefix}-plug:before { content: $fa-var-plug; }
.#{$fa-css-prefix}-slideshare:before { content: $fa-var-slideshare; }
.#{$fa-css-prefix}-twitch:before { content: $fa-var-twitch; }
.#{$fa-css-prefix}-yelp:before { content: $fa-var-yelp; }
.#{$fa-css-prefix}-newspaper-o:before { content: $fa-var-newspaper-o; }
.#{$fa-css-prefix}-wifi:before { content: $fa-var-wifi; }
.#{$fa-css-prefix}-calculator:before { content: $fa-var-calculator; }
.#{$fa-css-prefix}-paypal:before { content: $fa-var-paypal; }
.#{$fa-css-prefix}-google-wallet:before { content: $fa-var-google-wallet; }
.#{$fa-css-prefix}-cc-visa:before { content: $fa-var-cc-visa; }
.#{$fa-css-prefix}-cc-mastercard:before { content: $fa-var-cc-mastercard; }
.#{$fa-css-prefix}-cc-discover:before { content: $fa-var-cc-discover; }
.#{$fa-css-prefix}-cc-amex:before { content: $fa-var-cc-amex; }
.#{$fa-css-prefix}-cc-paypal:before { content: $fa-var-cc-paypal; }
.#{$fa-css-prefix}-cc-stripe:before { content: $fa-var-cc-stripe; }
.#{$fa-css-prefix}-bell-slash:before { content: $fa-var-bell-slash; }
.#{$fa-css-prefix}-bell-slash-o:before { content: $fa-var-bell-slash-o; }
.#{$fa-css-prefix}-trash:before { content: $fa-var-trash; }
.#{$fa-css-prefix}-copyright:before { content: $fa-var-copyright; }
.#{$fa-css-prefix}-at:before { content: $fa-var-at; }
.#{$fa-css-prefix}-eyedropper:before { content: $fa-var-eyedropper; }
.#{$fa-css-prefix}-paint-brush:before { content: $fa-var-paint-brush; }
.#{$fa-css-prefix}-birthday-cake:before { content: $fa-var-birthday-cake; }
.#{$fa-css-prefix}-area-chart:before { content: $fa-var-area-chart; }
.#{$fa-css-prefix}-pie-chart:before { content: $fa-var-pie-chart; }
.#{$fa-css-prefix}-line-chart:before { content: $fa-var-line-chart; }
.#{$fa-css-prefix}-lastfm:before { content: $fa-var-lastfm; }
.#{$fa-css-prefix}-lastfm-square:before { content: $fa-var-lastfm-square; }
.#{$fa-css-prefix}-toggle-off:before { content: $fa-var-toggle-off; }
.#{$fa-css-prefix}-toggle-on:before { content: $fa-var-toggle-on; }
.#{$fa-css-prefix}-bicycle:before { content: $fa-var-bicycle; }
.#{$fa-css-prefix}-bus:before { content: $fa-var-bus; }
.#{$fa-css-prefix}-ioxhost:before { content: $fa-var-ioxhost; }
.#{$fa-css-prefix}-angellist:before { content: $fa-var-angellist; }
.#{$fa-css-prefix}-cc:before { content: $fa-var-cc; }
.#{$fa-css-prefix}-shekel:before,
.#{$fa-css-prefix}-sheqel:before,
.#{$fa-css-prefix}-ils:before { content: $fa-var-ils; }
.#{$fa-css-prefix}-meanpath:before { content: $fa-var-meanpath; }
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#ifndef ALEXA_CLIENT_SDK_SETTINGS_INCLUDE_SETTINGS_SETTINGCALLBACKS_H_
#define ALEXA_CLIENT_SDK_SETTINGS_INCLUDE_SETTINGS_SETTINGCALLBACKS_H_
#include <functional>
#include <memory>
#include <vector>
#include "SettingObserverInterface.h"
#include "SettingCallbackAdapter.h"
namespace alexaClientSDK {
namespace settings {
/**
* The SettingCallbacks allow easy management of callbacks to monitor multiple settings with one object only.
*
* This object can be used to register multiple callbacks that are member functions, lambdas and static functions. E.g.:
*
* @code
*
* MyClass(std::shared_ptr<DeviceSettingManagers> manager) : m_callbacks {manager} {
* m_callbacks.add<ALARM_VOLUME_RAMP>([](bool enable, SettingNotifications notification){
* // do something...
* });
* m_callbacks.add<TIMEZONE>(staticFunction);
* m_callbacks.add<WAKEWORD_CONFIRMATION>(std::bind(this, &MyClass::onWakewordConfirmation, std::placeholder::_1));
* }
*
* ~MyClass() {
* // Observers get removed during destruction.
* }
* @endcode
*
* If you would like to listen notifications related to only one setting, see @c SettingEventCallback class or extend
* the @c SettingObserverInterface class.
*
* @tparam SettingsT Settings type enumeration.
*/
template <typename ManagerT>
class SettingCallbacks {
public:
/// Setting value type.
template <size_t id>
using ValueType = typename ManagerT::template ValueType<id>;
/// Callback function value type.
template <size_t id>
using FunctionType = std::function<void(const ValueType<id>&, SettingNotifications)>;
/**
* The destructor.
*/
virtual ~SettingCallbacks();
/**
* Create a SettingCallbacks object.
*
* This method allow user to use static / lambda functions as the callbacks.
*
* @param manager The object that manages all settings.
* @param callback The callback function for @c SettingT.
* @param otherCallbacks The callback functions for the rest of the settings.
* @return Pointer to new object if it succeeds to add all callbacks, @c nullptr otherwise.
*/
static std::shared_ptr<SettingCallbacks<ManagerT>> create(std::shared_ptr<ManagerT> manager);
/**
* Add a callback function to the setting with @c id.
* @tparam id The property id.
* @param callback The callback function.
* @return @c true if it succeeds; @c false otherwise.
*/
template <size_t id>
bool add(FunctionType<id> callback);
/**
* Disconnects the observed setting from all observed settings. This function also gets called by the destructor.
*
* @param manager The object that manages all settings.
* @param observer The observer object to be disconnected.
* @return @true if it succeeds, @c false otherwise.
*/
void removeAll();
private:
/**
* Constructor.
*/
SettingCallbacks(std::shared_ptr<ManagerT> manager);
/// Keep a pointer to settings manager.
std::shared_ptr<ManagerT> m_manager;
/// Store all the callbacks that were successfully registered.
std::vector<std::shared_ptr<SettingCallbackAdapterInterface<ManagerT>>> m_callbacks;
};
template <typename ManagerT>
SettingCallbacks<ManagerT>::~SettingCallbacks() {
removeAll();
}
template <typename ManagerT>
std::shared_ptr<SettingCallbacks<ManagerT>> SettingCallbacks<ManagerT>::create(std::shared_ptr<ManagerT> manager) {
if (manager) {
return std::shared_ptr<SettingCallbacks<ManagerT>>(new SettingCallbacks<ManagerT>(manager));
}
return nullptr;
}
template <typename ManagerT>
template <size_t id>
bool SettingCallbacks<ManagerT>::add(SettingCallbacks::FunctionType<id> callback) {
auto wrapper = SettingCallbackAdapter<ManagerT, id>::create(callback);
if (wrapper) {
if (wrapper->addToManager(*m_manager)) {
m_callbacks.push_back(wrapper);
return true;
}
}
return false;
}
template <typename ManagerT>
void SettingCallbacks<ManagerT>::removeAll() {
for (auto& wrapper : m_callbacks) {
wrapper->removeFromManager(*m_manager);
}
m_callbacks.clear();
}
template <typename ManagerT>
SettingCallbacks<ManagerT>::SettingCallbacks(std::shared_ptr<ManagerT> manager) : m_manager{manager} {
}
} // namespace settings
} // namespace alexaClientSDK
#endif // ALEXA_CLIENT_SDK_SETTINGS_INCLUDE_SETTINGS_SETTINGCALLBACKS_H_
|
{
"pile_set_name": "Github"
}
|
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2010 The Go Authors. All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package proto_test
import (
"math"
"reflect"
"testing"
. "github.com/kandoo/beehive/Godeps/_workspace/src/github.com/golang/protobuf/proto"
proto3pb "github.com/kandoo/beehive/Godeps/_workspace/src/github.com/golang/protobuf/proto/proto3_proto"
. "github.com/kandoo/beehive/Godeps/_workspace/src/github.com/golang/protobuf/proto/testdata"
)
type UnmarshalTextTest struct {
in string
err string // if "", no error expected
out *MyMessage
}
func buildExtStructTest(text string) UnmarshalTextTest {
msg := &MyMessage{
Count: Int32(42),
}
SetExtension(msg, E_Ext_More, &Ext{
Data: String("Hello, world!"),
})
return UnmarshalTextTest{in: text, out: msg}
}
func buildExtDataTest(text string) UnmarshalTextTest {
msg := &MyMessage{
Count: Int32(42),
}
SetExtension(msg, E_Ext_Text, String("Hello, world!"))
SetExtension(msg, E_Ext_Number, Int32(1729))
return UnmarshalTextTest{in: text, out: msg}
}
func buildExtRepStringTest(text string) UnmarshalTextTest {
msg := &MyMessage{
Count: Int32(42),
}
if err := SetExtension(msg, E_Greeting, []string{"bula", "hola"}); err != nil {
panic(err)
}
return UnmarshalTextTest{in: text, out: msg}
}
var unMarshalTextTests = []UnmarshalTextTest{
// Basic
{
in: " count:42\n name:\"Dave\" ",
out: &MyMessage{
Count: Int32(42),
Name: String("Dave"),
},
},
// Empty quoted string
{
in: `count:42 name:""`,
out: &MyMessage{
Count: Int32(42),
Name: String(""),
},
},
// Quoted string concatenation
{
in: `count:42 name: "My name is "` + "\n" + `"elsewhere"`,
out: &MyMessage{
Count: Int32(42),
Name: String("My name is elsewhere"),
},
},
// Quoted string with escaped apostrophe
{
in: `count:42 name: "HOLIDAY - New Year\'s Day"`,
out: &MyMessage{
Count: Int32(42),
Name: String("HOLIDAY - New Year's Day"),
},
},
// Quoted string with single quote
{
in: `count:42 name: 'Roger "The Ramster" Ramjet'`,
out: &MyMessage{
Count: Int32(42),
Name: String(`Roger "The Ramster" Ramjet`),
},
},
// Quoted string with all the accepted special characters from the C++ test
{
in: `count:42 name: ` + "\"\\\"A string with \\' characters \\n and \\r newlines and \\t tabs and \\001 slashes \\\\ and multiple spaces\"",
out: &MyMessage{
Count: Int32(42),
Name: String("\"A string with ' characters \n and \r newlines and \t tabs and \001 slashes \\ and multiple spaces"),
},
},
// Quoted string with quoted backslash
{
in: `count:42 name: "\\'xyz"`,
out: &MyMessage{
Count: Int32(42),
Name: String(`\'xyz`),
},
},
// Quoted string with UTF-8 bytes.
{
in: "count:42 name: '\303\277\302\201\xAB'",
out: &MyMessage{
Count: Int32(42),
Name: String("\303\277\302\201\xAB"),
},
},
// Bad quoted string
{
in: `inner: < host: "\0" >` + "\n",
err: `line 1.15: invalid quoted string "\0": \0 requires 2 following digits`,
},
// Number too large for int64
{
in: "count: 1 others { key: 123456789012345678901 }",
err: "line 1.23: invalid int64: 123456789012345678901",
},
// Number too large for int32
{
in: "count: 1234567890123",
err: "line 1.7: invalid int32: 1234567890123",
},
// Number in hexadecimal
{
in: "count: 0x2beef",
out: &MyMessage{
Count: Int32(0x2beef),
},
},
// Number in octal
{
in: "count: 024601",
out: &MyMessage{
Count: Int32(024601),
},
},
// Floating point number with "f" suffix
{
in: "count: 4 others:< weight: 17.0f >",
out: &MyMessage{
Count: Int32(4),
Others: []*OtherMessage{
{
Weight: Float32(17),
},
},
},
},
// Floating point positive infinity
{
in: "count: 4 bigfloat: inf",
out: &MyMessage{
Count: Int32(4),
Bigfloat: Float64(math.Inf(1)),
},
},
// Floating point negative infinity
{
in: "count: 4 bigfloat: -inf",
out: &MyMessage{
Count: Int32(4),
Bigfloat: Float64(math.Inf(-1)),
},
},
// Number too large for float32
{
in: "others:< weight: 12345678901234567890123456789012345678901234567890 >",
err: "line 1.17: invalid float32: 12345678901234567890123456789012345678901234567890",
},
// Number posing as a quoted string
{
in: `inner: < host: 12 >` + "\n",
err: `line 1.15: invalid string: 12`,
},
// Quoted string posing as int32
{
in: `count: "12"`,
err: `line 1.7: invalid int32: "12"`,
},
// Quoted string posing a float32
{
in: `others:< weight: "17.4" >`,
err: `line 1.17: invalid float32: "17.4"`,
},
// Enum
{
in: `count:42 bikeshed: BLUE`,
out: &MyMessage{
Count: Int32(42),
Bikeshed: MyMessage_BLUE.Enum(),
},
},
// Repeated field
{
in: `count:42 pet: "horsey" pet:"bunny"`,
out: &MyMessage{
Count: Int32(42),
Pet: []string{"horsey", "bunny"},
},
},
// Repeated message with/without colon and <>/{}
{
in: `count:42 others:{} others{} others:<> others:{}`,
out: &MyMessage{
Count: Int32(42),
Others: []*OtherMessage{
{},
{},
{},
{},
},
},
},
// Missing colon for inner message
{
in: `count:42 inner < host: "cauchy.syd" >`,
out: &MyMessage{
Count: Int32(42),
Inner: &InnerMessage{
Host: String("cauchy.syd"),
},
},
},
// Missing colon for string field
{
in: `name "Dave"`,
err: `line 1.5: expected ':', found "\"Dave\""`,
},
// Missing colon for int32 field
{
in: `count 42`,
err: `line 1.6: expected ':', found "42"`,
},
// Missing required field
{
in: `name: "Pawel"`,
err: `proto: required field "testdata.MyMessage.count" not set`,
out: &MyMessage{
Name: String("Pawel"),
},
},
// Repeated non-repeated field
{
in: `name: "Rob" name: "Russ"`,
err: `line 1.12: non-repeated field "name" was repeated`,
},
// Group
{
in: `count: 17 SomeGroup { group_field: 12 }`,
out: &MyMessage{
Count: Int32(17),
Somegroup: &MyMessage_SomeGroup{
GroupField: Int32(12),
},
},
},
// Semicolon between fields
{
in: `count:3;name:"Calvin"`,
out: &MyMessage{
Count: Int32(3),
Name: String("Calvin"),
},
},
// Comma between fields
{
in: `count:4,name:"Ezekiel"`,
out: &MyMessage{
Count: Int32(4),
Name: String("Ezekiel"),
},
},
// Extension
buildExtStructTest(`count: 42 [testdata.Ext.more]:<data:"Hello, world!" >`),
buildExtStructTest(`count: 42 [testdata.Ext.more] {data:"Hello, world!"}`),
buildExtDataTest(`count: 42 [testdata.Ext.text]:"Hello, world!" [testdata.Ext.number]:1729`),
buildExtRepStringTest(`count: 42 [testdata.greeting]:"bula" [testdata.greeting]:"hola"`),
// Big all-in-one
{
in: "count:42 # Meaning\n" +
`name:"Dave" ` +
`quote:"\"I didn't want to go.\"" ` +
`pet:"bunny" ` +
`pet:"kitty" ` +
`pet:"horsey" ` +
`inner:<` +
` host:"footrest.syd" ` +
` port:7001 ` +
` connected:true ` +
`> ` +
`others:<` +
` key:3735928559 ` +
` value:"\x01A\a\f" ` +
`> ` +
`others:<` +
" weight:58.9 # Atomic weight of Co\n" +
` inner:<` +
` host:"lesha.mtv" ` +
` port:8002 ` +
` >` +
`>`,
out: &MyMessage{
Count: Int32(42),
Name: String("Dave"),
Quote: String(`"I didn't want to go."`),
Pet: []string{"bunny", "kitty", "horsey"},
Inner: &InnerMessage{
Host: String("footrest.syd"),
Port: Int32(7001),
Connected: Bool(true),
},
Others: []*OtherMessage{
{
Key: Int64(3735928559),
Value: []byte{0x1, 'A', '\a', '\f'},
},
{
Weight: Float32(58.9),
Inner: &InnerMessage{
Host: String("lesha.mtv"),
Port: Int32(8002),
},
},
},
},
},
}
func TestUnmarshalText(t *testing.T) {
for i, test := range unMarshalTextTests {
pb := new(MyMessage)
err := UnmarshalText(test.in, pb)
if test.err == "" {
// We don't expect failure.
if err != nil {
t.Errorf("Test %d: Unexpected error: %v", i, err)
} else if !reflect.DeepEqual(pb, test.out) {
t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v",
i, pb, test.out)
}
} else {
// We do expect failure.
if err == nil {
t.Errorf("Test %d: Didn't get expected error: %v", i, test.err)
} else if err.Error() != test.err {
t.Errorf("Test %d: Incorrect error.\nHave: %v\nWant: %v",
i, err.Error(), test.err)
} else if _, ok := err.(*RequiredNotSetError); ok && test.out != nil && !reflect.DeepEqual(pb, test.out) {
t.Errorf("Test %d: Incorrect populated \nHave: %v\nWant: %v",
i, pb, test.out)
}
}
}
}
func TestUnmarshalTextCustomMessage(t *testing.T) {
msg := &textMessage{}
if err := UnmarshalText("custom", msg); err != nil {
t.Errorf("Unexpected error from custom unmarshal: %v", err)
}
if UnmarshalText("not custom", msg) == nil {
t.Errorf("Didn't get expected error from custom unmarshal")
}
}
// Regression test; this caused a panic.
func TestRepeatedEnum(t *testing.T) {
pb := new(RepeatedEnum)
if err := UnmarshalText("color: RED", pb); err != nil {
t.Fatal(err)
}
exp := &RepeatedEnum{
Color: []RepeatedEnum_Color{RepeatedEnum_RED},
}
if !Equal(pb, exp) {
t.Errorf("Incorrect populated \nHave: %v\nWant: %v", pb, exp)
}
}
func TestProto3TextParsing(t *testing.T) {
m := new(proto3pb.Message)
const in = `name: "Wallace" true_scotsman: true`
want := &proto3pb.Message{
Name: "Wallace",
TrueScotsman: true,
}
if err := UnmarshalText(in, m); err != nil {
t.Fatal(err)
}
if !Equal(m, want) {
t.Errorf("\n got %v\nwant %v", m, want)
}
}
func TestMapParsing(t *testing.T) {
m := new(MessageWithMap)
const in = `name_mapping:<key:1234 value:"Feist"> name_mapping:<key:1 value:"Beatles">` +
`msg_mapping:<key:-4, value:<f: 2.0>,>` + // separating commas are okay
`msg_mapping<key:-2 value<f: 4.0>>` + // no colon after "value"
`byte_mapping:<key:true value:"so be it">`
want := &MessageWithMap{
NameMapping: map[int32]string{
1: "Beatles",
1234: "Feist",
},
MsgMapping: map[int64]*FloatingPoint{
-4: {F: Float64(2.0)},
-2: {F: Float64(4.0)},
},
ByteMapping: map[bool][]byte{
true: []byte("so be it"),
},
}
if err := UnmarshalText(in, m); err != nil {
t.Fatal(err)
}
if !Equal(m, want) {
t.Errorf("\n got %v\nwant %v", m, want)
}
}
var benchInput string
func init() {
benchInput = "count: 4\n"
for i := 0; i < 1000; i++ {
benchInput += "pet: \"fido\"\n"
}
// Check it is valid input.
pb := new(MyMessage)
err := UnmarshalText(benchInput, pb)
if err != nil {
panic("Bad benchmark input: " + err.Error())
}
}
func BenchmarkUnmarshalText(b *testing.B) {
pb := new(MyMessage)
for i := 0; i < b.N; i++ {
UnmarshalText(benchInput, pb)
}
b.SetBytes(int64(len(benchInput)))
}
|
{
"pile_set_name": "Github"
}
|
.box-title {
h2 {
margin: 0;
color: #9ea8bb;
}
}
|
{
"pile_set_name": "Github"
}
|
module github.com/hashicorp/go-plugin
require (
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/protobuf v1.2.0
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77
github.com/oklog/run v1.0.0
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc // indirect
golang.org/x/text v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 // indirect
google.golang.org/grpc v1.14.0
)
go 1.13
|
{
"pile_set_name": "Github"
}
|
console_log: {
input: {
console.log("%% %s");
console.log("%% %s", "%s");
}
expect: {
console.log("%% %s");
console.log("%% %s", "%s");
}
expect_stdout: [
"%% %s",
"% %s",
]
}
|
{
"pile_set_name": "Github"
}
|
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package snowman
import (
"github.com/ava-labs/avalanchego/ids"
)
// Voter records chits received from [vdr] once its dependencies are met.
type voter struct {
t *Transitive
vdr ids.ShortID
requestID uint32
response ids.ID
deps ids.Set
}
func (v *voter) Dependencies() ids.Set { return v.deps }
// Mark that a dependency has been met.
func (v *voter) Fulfill(id ids.ID) {
v.deps.Remove(id)
v.Update()
}
// Abandon this attempt to record chits.
func (v *voter) Abandon(id ids.ID) { v.Fulfill(id) }
func (v *voter) Update() {
if v.deps.Len() != 0 || v.t.errs.Errored() {
return
}
results := ids.Bag{}
finished := false
if v.response.IsZero() {
results, finished = v.t.polls.Drop(v.requestID, v.vdr)
} else {
results, finished = v.t.polls.Vote(v.requestID, v.vdr, v.response)
}
if !finished {
return
}
// To prevent any potential deadlocks with un-disclosed dependencies, votes
// must be bubbled to the nearest valid block
results = v.bubbleVotes(results)
v.t.Ctx.Log.Debug("Finishing poll [%d] with:\n%s", v.requestID, &results)
if err := v.t.Consensus.RecordPoll(results); err != nil {
v.t.errs.Add(err)
return
}
v.t.VM.SetPreference(v.t.Consensus.Preference())
if v.t.Consensus.Finalized() {
v.t.Ctx.Log.Debug("Snowman engine can quiesce")
return
}
v.t.Ctx.Log.Debug("Snowman engine can't quiesce")
v.t.repoll()
}
func (v *voter) bubbleVotes(votes ids.Bag) ids.Bag {
bubbledVotes := ids.Bag{}
for _, vote := range votes.List() {
count := votes.Count(vote)
blk, err := v.t.VM.GetBlock(vote)
if err != nil {
continue
}
for blk.Status().Fetched() && !v.t.Consensus.Issued(blk) {
blk = blk.Parent()
}
if !blk.Status().Decided() && v.t.Consensus.Issued(blk) {
bubbledVotes.AddCount(blk.ID(), count)
}
}
return bubbledVotes
}
|
{
"pile_set_name": "Github"
}
|
(*
*
* Copyright (c) 2001-2002,
* Jeremy Condit <jcondit@cs.berkeley.edu>
* George C. Necula <necula@cs.berkeley.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The names of the contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*)
(* This feature implements data slicing. The user annotates base types
* and function types with region(i) annotations, and this transformation
* will separate the fields into parallel data structures accordingly. *)
val feature: Cil.featureDescr
|
{
"pile_set_name": "Github"
}
|
/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#ifndef ANT_KEY_MANAGER_CONFIG_H__
#define ANT_KEY_MANAGER_CONFIG_H__
/**
* @addtogroup ant_key_manager
* @{
*/
#ifndef ANT_PLUS_NETWORK_KEY
#define ANT_PLUS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT+ network key. */
#endif //ANT_PLUS_NETWORK_KEY
#ifndef ANT_FS_NETWORK_KEY
#define ANT_FS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT-FS network key. */
#endif // ANT_FS_NETWORK_KEY
/**
* @}
*/
#endif // ANT_KEY_MANAGER_CONFIG_H__
|
{
"pile_set_name": "Github"
}
|
import datetime
import dateparser
import aiohttp
import discord
from discord.ext import commands
from meowth.utils import formatters, fuzzymatch
from meowth.exts.users import MeowthUser
from .errors import *
class SilphBadge:
__slots__ = ('count', '_awarded', 'slug', 'name', 'description', 'image_url')
def __init__(self, data):
self.count = data.get('count')
badge_info = data.get('Badge', {})
self.slug = badge_info.get('slug')
self.name = badge_info.get('name')
self.description = badge_info.get('description')
self.image_url = badge_info.get('image_url')
self._awarded = data.get('awarded')
def __str__(self):
return self.name
def __repr__(self):
type_name = type(self).__name__
name = self.name
created = self.awarded()
return f"<{type_name} name='{name}' awarded='{created}'>"
def awarded(self, utc_offset=None):
if not self._awarded:
return None
date = dateparser.parse(self._awarded, settings={'TIMEZONE': 'UTC'})
if utc_offset:
date = date + datetime.timedelta(hours=utc_offset)
return date.date().isoformat()
class SilphCheckin:
__slots__ = ('name', 'description', 'image_url', '_is_global', '_start',
'_end', '_created')
def __init__(self, data):
self.name = data.get('name')
self.description = data.get('description')
self.image_url = data.get('image')
self._is_global = data.get('is_global')
event_checkin_data = data.get('EventCheckin', {})
self._created = event_checkin_data.get('created')
def __str__(self):
return self.name
def __repr__(self):
type_name = type(self).__name__
name = self.name
created = self.created()
return f"<{type_name} name='{name}' created='{created}'>"
@property
def is_global(self):
if not self._is_global:
return None
return formatters.convert_to_bool(self._is_global)
def created(self, utc_offset=None):
if not self._created:
return None
date = dateparser.parse(self._created, settings={'TIMEZONE': 'UTC'})
if utc_offset:
date = date + datetime.timedelta(hours=utc_offset)
return date.date().isoformat()
class SilphCard:
__slots__ = ('id', 'home_region', 'team', 'title', 'playstyle', 'level',
'avatar_url', 'silph_name', 'game_name', 'url',
'data_url', '_badges', '_top_6_pokemon', '_nest_migrations',
'_pokedex_count', '_xp', '_raid_average', '_goal', '_joined',
'_modified', '_connected_accounts', '_checkins', '_handshakes')
def __init__(self, silph_username, data):
data = data.get('data', data)
self.silph_name = silph_username
self.game_name = data.get('in_game_username')
self.data_url = f'https://sil.ph/{silph_username}.json'
self.url = f'https://sil.ph/{silph_username}'
self.id = data.get('card_id')
self.home_region = data.get('home_region')
self.team = data.get('team')
self.title = data.get('title')
self.playstyle = data.get('playstyle')
self.level = data.get('trainer_level')
self.avatar_url = data.get('avatar')
self._badges = data.get('badges')
self._top_6_pokemon = data.get('top_6_pokemon')
self._nest_migrations = data.get('nest_migrations')
self._pokedex_count = data.get('pokedex_count')
self._xp = data.get('xp')
self._raid_average = data.get('raid_average')
self._handshakes = data.get('handshakes')
self._goal = data.get('goal')
self._joined = data.get('joined')
self._modified = data.get('modified')
self._connected_accounts = data.get('socials')
self._checkins = data.get('checkins')
def __str__(self):
return f"{self.id} - {self.silph_name}"
def __repr__(self):
type_name = type(self).__name__
name = self.silph_name
ign = self.game_name
return f"<{type_name} id='{self.id}' silph_name='{name}' ign='{ign}'>"
def get_connected_account(self, vendor):
con_acc = self._connected_accounts
search = (acc for acc in con_acc if acc.get('vendor') == vendor)
return next(search, None)
@property
def badges(self):
if not self._badges:
return None
return tuple(SilphBadge(b) for b in self._badges)
@property
def badge_count(self):
if not self._badges:
return 0
return len(self._badges)
@property
def checkins(self):
if not self._badges:
return None
return tuple(SilphCheckin(c) for c in self._checkins)
@property
def checkin_count(self):
if not self._badges:
return 0
return len(self._checkins)
@property
def top_pkmn(self):
if not self._top_6_pokemon:
return None
return tuple(self._top_6_pokemon)
@property
def migrations(self):
return int(self._nest_migrations) if self._nest_migrations else 0
@property
def pd_count(self):
return int(self._pokedex_count) if self._pokedex_count else 0
@property
def xp(self):
return int(self._xp) if self._xp else 0
@property
def raid_avg(self):
return int(self._raid_average) if self._raid_average else 0
@property
def handshakes(self):
return int(self._handshakes) if self._handshakes else 0
@property
def goal(self):
return self._goal.lower() if self._goal else None
@property
def discord_name(self):
data = self.get_connected_account('Discord')
return data.get('username') if data else None
def joined(self):
if not self._joined:
return None
date = dateparser.parse(self._joined, settings={'TIMEZONE': 'UTC'})
return date.date().isoformat()
def modified(self, utc_offset=None):
if not self._modified:
return None
date = dateparser.parse(self._modified, settings={'TIMEZONE': 'UTC'})
return date
def embed(self):
colour = discord.Colour(0xe8c13c)
hyperlink_icon = "https://i.imgur.com/fn9E5nb.png"
silph_icon = "https://assets.thesilphroad.com/img/snoo_sr_icon.png"
if not self.discord_name:
connected_str = "\u2754 **Discord Not Provided**"
else:
connected_str = (
f"\u2611 **Connected to Discord:** {self.discord_name}")
embed = discord.Embed(
title='Playstyle', colour=colour, description=(
f"{self.playstyle}, working on {self.goal}.\n"
f"Active around {self.home_region}.\n\n"
f"{connected_str}"))
embed.set_thumbnail(url=self.avatar_url)
embed.set_author(
name=(
f"{self.title} {self.game_name} - "
f"Level {self.level} {self.team}"),
url=self.url,
icon_url=hyperlink_icon)
embed.add_field(
name="__Silph Stats__",
value=(
f"**Joined:** {self.joined()}\n"
f"**Badges:** {self.badge_count}\n"
f"**Check-ins:** {self.checkin_count}\n"
f"**Handshakes:** {self.handshakes}\n"
f"**Migrations:** {self.migrations}"),
inline=True)
embed.add_field(
name="__Game Stats__",
value=(
f"**Name:** {self.game_name}\n"
f"**Team:** {self.team}\n"
f"**Level:** {self.level}\n"
f"**Pokedex:** {self.pd_count}\n"
f"**Raids:** {self.raid_avg}/week"),
inline=True)
embed.set_footer(
text=(
f"Silph Road Travelers Card - ID{self.id} - "
f"Updated"),
icon_url=silph_icon)
embed.timestamp = self.modified()
return embed
@classmethod
async def get_trainer_card(cls, silph_user):
url = f'https://sil.ph/{silph_user}.json'
async with aiohttp.ClientSession() as sess:
async with sess.get(url) as resp:
data = await resp.json()
if data.get('error', None):
error = data['error']
if error == "Card not found":
raise SilphCardNotFound
elif error == "Private Travelers Card":
raise SilphCardPrivate
else:
return None
return cls(silph_user, data)
class SilphTrainer:
def __init__(self, silph_user):
self.name = silph_user
self.card = None
async def load_card_data(self):
self.card = await SilphCard.get_trainer_card(self.name)
return self.card
@classmethod
async def load_trainer_data(cls, silph_user):
instance = cls(silph_user)
await instance.load_card_data()
return instance
@classmethod
async def convert(cls, ctx, arg):
try:
meowth_user = await MeowthUser.convert(ctx, arg)
silph_id = await meowth_user.silph()
except:
meowth_user = None
if not meowth_user:
silph_id = arg
return await cls.load_trainer_data(silph_id)
|
{
"pile_set_name": "Github"
}
|
2015.11.09
========
## 业界会议
**[报名]D2前端技术论坛-2015**
http://d2forum.alibaba-inc.com/
D2前端技术论坛(Designer & Developer Frontend Technology Forum),简称D2。为国内前端开发者和网站设计师提供一个交流的机会,一起分享技术的乐趣,探讨行业的发展,以技术会友。它是中国所有前端开发者的节日,包括前端设计师,前端开发工程师,和所有对前端技术感兴趣的人。经历了近10年的发展,前端岗位从刀耕火种走到了今天的百花齐放,各领域全面发展,进入盛况时期。2015年第10届D2的主题即为“融合”!
**2015 腾讯WE大会 - 11.08**
http://we.tencent.com/
http://tech.qq.com/zt2015/we2015/index.htm
WE大会关注协作创新,分享互联网和科技界最前沿的思想和技术,展示未来的革新力量。WE大会邀请全球多位互联网思想家、前沿创新项目团队进行现场互动和分享。我们希望启发人们去创造、创新、探索改变未来的一切可能性。可以围观一下高科技。
**[报名]2015重庆前端交流会**
http://2015.yufe.org/
由重庆地区的土豪公司 @猪八戒网 举办
**[报名]360与Facebook工程师畅聊大前端 - 交流会**
http://www.huodongxing.com/event/3307503611100
Facebook 的工程师及大前端的话题比较吸引人。
**UPYUN•架构与运维大会 - 11.28**
http://www.huodongxing.com/event/3303212982600
UPYUN 架构与运维大会 (Arch&Ops Conf) 是面向运维和架构从业人员者所举办的大型技术会议,致力于推动各项运维技术、产品架构等在互联网和移动互联网的研发和应用。
## 深阅读
**揭密 Google 秒开技术:如何让网站瞬间加载完毕?**
http://www.leiphone.com/news/201511/0EQQdrIAhtw2MYGv.html
详细介绍了 AMP
**caoz谈能力成长 - 取舍之道**
http://mp.weixin.qq.com/s?__biz=MzI0MjA1Mjg2Ng==&mid=400320941&idx=1&sn=b3883278d2d58b760e3dadbfef225a95
取舍是永恒的话题,懂得取舍和选择是成熟、自信的重要标志。这问文章对做技术和做产品都非常有参考意义,大家认真看看。
**Immutable 详解及 React 中实践**
https://github.com/camsong/blog/issues/3
Shared mutable state is the root of all evil(共享的可变状态是万恶之源)-- Pete Hunt.
有人说 Immutable 可以给 React 应用带来数十倍的提升,也有人说 Immutable 的引入是近期 JavaScript 中伟大的发明,因为同期 React 太火,它的光芒被掩盖了。这些至少说明 Immutable 是很有价值的,下面我们来一探究竟。
**移动端图片格式调研**
http://blog.ibireme.com/2015/11/02/mobile_image_benchmark/
图片通常是移动端流量耗费最多的部分,并且占据着重要的视觉空间。合理的图片格式选用和优化可以为你节省带宽、提升视觉效果。在这篇文章里我会分析一下目前主流和新兴的几种图片格式的特点、性能分析、参数调优,以及相关开源库的选择。
**当我们谈论 cluster 时我们在谈论什么**
http://taobaofed.org/blog/2015/11/03/nodejs-cluster/
Node Cluster 科普文
**被误解的 MVC 和被神化的 MVVM**
http://blog.devtang.com/blog/2015/11/02/mvc-and-mvvm/
MVC,全称是 Model View Controller,是模型 (model)-视图 (view)-控制器 (controller) 的缩写。表示的是一种常见的客户端软件开发框架。MVVM 最早于 2005 年被微软的WPF和Silverlight的架构师John Gossman提出,并且应用在微软的软件开发中。
**Facebook’s code quality problem**
http://www.darkcoding.net/software/facebooks-code-quality-problem/
Facebook is very successful, manifestly has some great engineers, unlimited money, and yet seems to have big issues with software quality. I take two lessons from this:
- Culture matters. The “Hack” and “Move fast and break things” culture must make it very hard for developers to focus on quality.
- Quality matters. We all know that if you don’t focus on quality it will come back to bite you.
**Why Static Website Generators Are The Next Big Thing**
http://www.smashingmagazine.com/2015/11/modern-static-website-generators-next-big-thing/
At StaticGen, our open-source directory of static website generators, we’ve kept track of more than a hundred generators for more than a year now, and we’ve seen both the volume and popularity of these projects take off incredibly on GitHub during that time, going from just 50 to more than 100 generators and a total of more than 100,000 stars for static website generator repositories.
**jQuery’s Relevancy – There and Back Again**
http://developer.telerik.com/featured/jquerys-relevancy-there-and-back-again/
In this article, I’m going to remind everyone what exactly jQuery is, because I believe that jQuery is as relevant today as it was when it was first written. The question relevancy should be tied to the original intent of the solution (i.e. the jQuery API itself) and not browser bugs or missing features.
**TypeScript 和 JSX 搞基的事**
https://github.com/techird/blog/issues/3
对 JSX 的支持已经在 TypeScript 官方落地了!非常感谢 Ryan Cavanaugh 和 François de Campredon 的大力推动。在这篇文章中,笔者打算跟大家探索一下如何把 JSX 和 TypeScript 的第一特性——静态类型检查完美结合使用。
**[译]Service Worker 入门**
http://www.w3ctech.com/topic/866
一个 service worker 是一段运行在浏览器后台进程里的脚本,它独立于当前页面,提供了那些不需要与web页面交互的功能在网页背后悄悄执行的能力。在将来,基于它可以实现消息推送,静默更新以及地理围栏等服务,但是目前它首先要具备的功能是拦截和处理网络请求,包括可编程的响应缓存管理。
**Redux 中文文档**
http://camsong.github.io/redux-in-chinese/
Redux 的文档写的蛮清晰的。
**东京大学:交互式计算机图形学**
https://www.coursera.org/learn/interactive-computer-graphics
计算机图形是支撑可视化问题求解的强大工具。这门课将介绍计算机图形研究领域的多种交互工具,以及它们的原理和算法。例子涵盖图形化用户界面(GUI)的增强,2D绘画及3D动画的创作工具,和交互式计算机辅助设计(CAD)系统。
**七牛CEO许式伟:服务端开发那些事儿**
http://www.csdn.net/article/2015-11-06/2826139
服务器开发的基础知识,主要谈的是用 Go 实现。
**朱冠胤:百度大规模数据处理架构之“不平凡之路”**
http://www.csdn.net/article/2015-11-06/2826137
介绍了百度内部 Hadoop 平台的发展及实现。
**Docker 工程师必读论文:Google Borg**
http://mp.weixin.qq.com/s?__biz=MzA4MzQ1NjQ5Nw==&mid=400243103&idx=1&sn=c76e7acfbf73649190277a7cbe3b0191
Borg 是在传说中流传已久的 Google 内部集群管理系统,现在火热的 Mesos 和 Kubnetes 都是源自于 Borg。
**谷歌第二代深度学习系统TensorFlow首次解密**
http://mp.weixin.qq.com/s?__biz=MzI3MTA0MTk1MA==&mid=400301663&idx=1&sn=c83c92328c9c936b1fb39cece6e852f6
Google资深系统专家Jeff Dean在最近的湾区机器学习大会做了 Large-Scale Deep Learning for Inelligent Computer Systems 的演讲。在大会上,Jeff Dean 解密了谷歌未曾在论文上发表过的第二代深度学习系统TensorFlow。
**[译]使用HTTP/2提升性能的7个建议**
http://www.w3ctech.com/topic/1563
大约有三分之二的浏览器已经支持HTTP/2,而且这个比例每月都在增加。你需要决定是否迁移到HTTP/2,而其中关键是知道如何最大限度地利用它。这篇文章会带你了解从性能角度考虑为什么要做这个决定,以及如何实现。接下来我们要逐一讨论关于HTTP/2性能的7个小建议。
**阿里云破纪录的背后:377秒是如何炼成的**
http://www.csdn.net/article/2015-11-05/2826124
10月28日,Sort Benchmark官方宣布,阿里云用377秒完成了100TB的数据排序,打破了此前Apache Spark创造的1406秒纪录。在含金量最高的GraySort和MinuteSort两个评测系统中,阿里云分别在通用和专用目的排序类别中创造了4项世界纪录。
## 新鲜货
**百度 iCafe**
http://cafe.baidu.com/
「iCafe」是百度推出的一款轻量级团队协作工具,面向的人群较为广泛,适用于开发者、设计师、创业团队、测试团队、开源团队等。其功能特点包括:工作量估时、需求可进行无限拆分、数据实时展现、按人跟踪进度等。目前已超过 5000 个团队正在使用。 icafe 在百度已经经历 N 次升级了,总算迈出了开放这一步,不过似乎和内部给工程师用的有差别。
**Flutter – Cross-platform mobile framework from Google**
http://flutter.io/
https://github.com/flutter/flutter
Flutter is a new way to build high-performance, cross-platform mobile apps. Flutter is optimized for today's, and tomorrow's, mobile devices. We are focused on low-latency input and high frame rates on Android and iOS.
**Ant Design of Vue**
http://okoala.github.io/vue-antd/
这里是 Ant Design 的 Vue 实现,开发和服务于企业级后台产品。不知道 AntD 的同学请移步: http://ant.design/
**A high-level browser automation library**
https://github.com/segmentio/nightmare
The goal is to expose just a few simple methods, and have an API that feels synchronous for each block of scripting, rather than deeply nested callbacks. It's designed for automating tasks across sites that don't have APIs. Under the covers it uses Electron, which is similar to PhantomJS but faster and more modern.
**An update on Object.observe - Being Withdrawn As A TC39 Proposal**
https://mail.mozilla.org/pipermail/es-discuss/2015-November/044684.html
After much discussion with the parties involved, I plan to withdraw the Object.observe proposal from TC39 (where it currently sits at stage 2 in the ES spec process), and hope to remove support from V8 by the end of the year (the feature is used on 0.0169% of Chrome pageviews, according to chromestatus.com).
**React Cheat Sheet v0.14.1**
http://reactcheatsheet.com/
**IntelliJ IDEA 15**
https://www.jetbrains.com/idea/whatsnew/
IntelliJ IDEA 15 brings better user interface, more built-in tools and integrations, further improved coding assistance, and out-of-the-box support for Kotlin.
**Nova.js - 一个小巧的Web Component框架**
http://novajs.com/
旨在帮助开发者方便快速地开发组件。作者起初希望在一个移动端项目中使用Polymer进行开发,但发现Polymer的代码对于移动端小型项目过于庞大、且只支持到Android4.4。因此借鉴了Polymer的部分组件开发的思想,实现了Nova.js。
**GitLab 的安装配置**
http://www.360doc.com/content/15/1104/14/22505981_510681759.shtml
想自己搭 GitLab 的可以参考。
**Git Town 支持高级别工作流开源 Git 插件**
https://github.com/Originate/git-town
http://www.oschina.net/p/git-town
Git Town makes software development teams who use Git even more productive and happy. It adds additional Git commands that support GitHub Flow, Git Flow, the Nvie model, GitLab Flow, and other workflows more directly, and it allows you to perform many common Git operations faster and easier.
**Stash is now called Bitbucket Server**
https://www.atlassian.com/software/bitbucket/server
Bitbucket makes it easy for teams to build great software. Deliver at speed without sacrificing quality.
**Scooter**
http://dropbox.github.io/scooter/
Dropbox 开源的 SCSS 样式组件。
**Announcing Docker 1.9: Production-ready Swarm and Multi-host Networking**
http://blog.docker.com/2015/11/docker-1-9-production-ready-swarm-multi-host-networking/
多主机网络和 Swarm 集群系统已经达到生产水平了。
**React Toolbox**
http://react-toolbox.com/#/
Material Design 风格的 React 组件。
**微软与Red Hat宣布合作**
http://blogs.microsoft.com/blog/2015/11/04/microsoft-and-red-hat-partner-to-deliver-more-flexibility-and-choice/
今年流行联合。在遥远的过去,微软视Linux为敌人,曾诅咒它是“癌症”。但过去一年,微软在新CEO的带领下改变了对待Linux和开源的态度,它甚至公开宣称“爱Linux”。
**React For Beginners**
https://reactforbeginners.com/
A premium step-by-step training course to get you building real world React.js + Firebase apps and website components.
**Javascript quiz. ES6 edition.**
http://perfectionkills.com/javascript-quiz-es6/
Remember that crazy Javascript quiz from 6 years ago? Craving to solve another set of mind-bending snippets no sensible developer would ever use in their code? Looking for a new installment of the most ridiculous Javascript interview questions? Look no further! The "ECMAScript Two Thousand Fifteen" installment of good old Javascript Quiz is finally here.
**Five Open-Source Slack Alternatives**
https://blog.okturtles.com/2015/11/five-open-source-slack-alternatives/
**A 27 Minute Tour of Next Gen Front End Dev with Scala.js**
https://www.youtube.com/watch?v=n1GgVWOThhY
A great introductory talk on Scala.js which compiles Scala code to JavaScript. It’s not commercially supported by Typesafe but is production ready.
## 产品及其它
**Hello, World of Programming Languages**
http://mp.weixin.qq.com/s?__biz=MzAxMzMxNDIyOA==&mid=401571407&idx=1&sn=384ee1acf8d2165a46ac90d51719affa
竟然还可以这么来看编程语言,长见识了,期待后续。
**如何才能成为一个好的技术领导者?**
http://mp.weixin.qq.com/s?__biz=MzA4NTU2MTg3MQ==&mid=400644089&idx=1&sn=1cf732f5529c64ee8d3fa9e55dbd84db
这个话题是码农职业生涯必须面对的,可以看看大家总结出来的经验。另附:唱吧CEO-创业四年,我积累的7点管理经验
http://mp.weixin.qq.com/s?__biz=MTA3NDM1MzUwMQ==&mid=400390613&idx=1&sn=2f67c1fb74d18cf1d939790a9b3cf992
**在实际工作中评估你的工程师伙伴**
http://gulu-dev.com/post/2015-11-05-tips-for-non-programmers
在日常工作中,对于一些非技术向的小伙伴们,由于对工程师文化了解并不多,要么难以寻找到合适的技术伙伴,要么在工作中与工程师难以保持稳定的沟通节奏,对于这些小伙伴,俺愿意把俺知道的分享出来,肤浅也好,片面也罢,总之是多了一点参考,希望能有所帮助。
**[译]辞去工作,以开发首个 app**
http://www.labazhou.net/2015/11/how-i-quit-my-job-and-built-my-first-app/
本故事可追溯到 2009 年夏天。我刚刚入手了第一台 iPhone 3GS,当时非常可心。可想而知,当时《愤怒的小鸟》还没有成为 App Store 上的黑马。Apple 在 2008 年上线了 App Store,就在同一年,我卖掉了之前的创业公司。我在一家大型软件公司做全职工作,但不是凭直觉进入的。我对移动领域感到极度狂热,开始着手开发 app。
**别人都读《重新定义公司》而你没时间?那先来看这最重要的13句话**
http://mp.weixin.qq.com/s?__biz=MjM5NjMyOTMzNA==&mid=400303668&idx=1&sn=3888d25d43f0fc9833ccae841a7a914e
谷歌何以成为这样重要的存在?它的成长、运转能给中国公司哪些启示?谷歌掌门人施密特的这本《重新定义公司》确实是一份很良心的答卷。
**如何写一本技术类的书**
http://mp.weixin.qq.com/s?__biz=MzA4Nzg5Nzc5OA==&mid=400254392&idx=1&sn=17198b3ecb12a0a6def632ba03ea1b9e
另附一篇同类文章 : http://icodeit.org/2015/08/how-to-write-a-book/
|
{
"pile_set_name": "Github"
}
|
/***************************************************************************/
/* */
/* ftpfr.h */
/* */
/* FreeType API for accessing PFR-specific data (specification only). */
/* */
/* Copyright 2002, 2003, 2004, 2006, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef __FTPFR_H__
#define __FTPFR_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* pfr_fonts */
/* */
/* <Title> */
/* PFR Fonts */
/* */
/* <Abstract> */
/* PFR/TrueDoc specific API. */
/* */
/* <Description> */
/* This section contains the declaration of PFR-specific functions. */
/* */
/*************************************************************************/
/**********************************************************************
*
* @function:
* FT_Get_PFR_Metrics
*
* @description:
* Return the outline and metrics resolutions of a given PFR face.
*
* @input:
* face :: Handle to the input face. It can be a non-PFR face.
*
* @output:
* aoutline_resolution ::
* Outline resolution. This is equivalent to `face->units_per_EM'
* for non-PFR fonts. Optional (parameter can be NULL).
*
* ametrics_resolution ::
* Metrics resolution. This is equivalent to `outline_resolution'
* for non-PFR fonts. Optional (parameter can be NULL).
*
* ametrics_x_scale ::
* A 16.16 fixed-point number used to scale distance expressed
* in metrics units to device sub-pixels. This is equivalent to
* `face->size->x_scale', but for metrics only. Optional (parameter
* can be NULL).
*
* ametrics_y_scale ::
* Same as `ametrics_x_scale' but for the vertical direction.
* optional (parameter can be NULL).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If the input face is not a PFR, this function will return an error.
* However, in all cases, it will return valid values.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Metrics( FT_Face face,
FT_UInt *aoutline_resolution,
FT_UInt *ametrics_resolution,
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale );
/**********************************************************************
*
* @function:
* FT_Get_PFR_Kerning
*
* @description:
* Return the kerning pair corresponding to two glyphs in a PFR face.
* The distance is expressed in metrics units, unlike the result of
* @FT_Get_Kerning.
*
* @input:
* face :: A handle to the input face.
*
* left :: Index of the left glyph.
*
* right :: Index of the right glyph.
*
* @output:
* avector :: A kerning vector.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function always return distances in original PFR metrics
* units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED
* mode, which always returns distances converted to outline units.
*
* You can use the value of the `x_scale' and `y_scale' parameters
* returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Kerning( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
/**********************************************************************
*
* @function:
* FT_Get_PFR_Advance
*
* @description:
* Return a given glyph advance, expressed in original metrics units,
* from a PFR font.
*
* @input:
* face :: A handle to the input face.
*
* gindex :: The glyph index.
*
* @output:
* aadvance :: The glyph advance in metrics units.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
* to convert the advance to device sub-pixels (i.e., 1/64th of pixels).
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Advance( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
/* */
FT_END_HEADER
#endif /* __FTPFR_H__ */
/* END */
|
{
"pile_set_name": "Github"
}
|
/**
* firewall API generated from firewall.yang
*
* NOTE: This file is auto generated by polycube-codegen
* https://github.com/polycube-network/polycube-codegen
*/
/* Do not edit this file manually */
#include "ChainBase.h"
#include "../Firewall.h"
ChainBase::ChainBase(Firewall &parent)
: parent_(parent) {}
ChainBase::~ChainBase() {}
void ChainBase::update(const ChainJsonObject &conf) {
if (conf.defaultIsSet()) {
setDefault(conf.getDefault());
}
if (conf.statsIsSet()) {
for (auto &i : conf.getStats()) {
auto id = i.getId();
auto m = getStats(id);
m->update(i);
}
}
if (conf.ruleIsSet()) {
for (auto &i : conf.getRule()) {
auto id = i.getId();
auto m = getRule(id);
m->update(i);
}
}
}
ChainJsonObject ChainBase::toJsonObject() {
ChainJsonObject conf;
conf.setName(getName());
conf.setDefault(getDefault());
for(auto &i : getStatsList()) {
conf.addChainStats(i->toJsonObject());
}
for(auto &i : getRuleList()) {
conf.addChainRule(i->toJsonObject());
}
return conf;
}
void ChainBase::addStatsList(const std::vector<ChainStatsJsonObject> &conf) {
for (auto &i : conf) {
uint32_t id_ = i.getId();
addStats(id_, i);
}
}
void ChainBase::replaceStats(const uint32_t &id, const ChainStatsJsonObject &conf) {
delStats(id);
uint32_t id_ = conf.getId();
addStats(id_, conf);
}
void ChainBase::delStatsList() {
auto elements = getStatsList();
for (auto &i : elements) {
uint32_t id_ = i->getId();
delStats(id_);
}
}
void ChainBase::addRuleList(const std::vector<ChainRuleJsonObject> &conf) {
for (auto &i : conf) {
uint32_t id_ = i.getId();
addRule(id_, i);
}
}
void ChainBase::replaceRule(const uint32_t &id, const ChainRuleJsonObject &conf) {
delRule(id);
uint32_t id_ = conf.getId();
addRule(id_, conf);
}
void ChainBase::delRuleList() {
auto elements = getRuleList();
for (auto &i : elements) {
uint32_t id_ = i->getId();
delRule(id_);
}
}
std::shared_ptr<spdlog::logger> ChainBase::logger() {
return parent_.logger();
}
|
{
"pile_set_name": "Github"
}
|
package peregin.gpv.model
import org.specs2.mutable.Specification
import org.joda.time.{DateTime, DateTimeZone}
import org.specs2.matcher.{Expectable, MatchResult, Matcher, SignificantFigures}
import peregin.gpv.util.Logging
import scala.xml.XML
class TelemetrySpec extends Specification with Logging {
def beCloseTo(ref: MinMax, figures: SignificantFigures): Matcher[MinMax] = new Matcher[MinMax] {
def apply[T <: MinMax](e: Expectable[T]): MatchResult[T] = {
val res1 = e.value.min must beCloseTo(ref.min within figures).updateMessage(s => s"min value $s")
val res2 = e.value.max must beCloseTo(ref.max within figures).updateMessage(s => s"max value $s")
result(res1 and res2, e)
}
}
"telemetry data with 2 track points" should {
val track = Seq(
TrackPoint(TrackPoint.centerPosition, 100, new DateTime(2014, 6, 1, 10, 0), GarminExtension(Some(72), Some(12), Some(110), None)),
TrackPoint(TrackPoint.centerPosition, 200, new DateTime(2014, 6, 1, 11, 0), GarminExtension(Some(81), Some(14), Some(120), None))
)
track(0).distance = 0
track(0).segment = 200
track(1).distance = 200
track(1).segment = 180
val telemetry = Telemetry(track)
"interpolate time" in {
telemetry.progressForTime(new DateTime(2014, 6, 1, 10, 0)) === 0
telemetry.progressForTime(new DateTime(2014, 6, 1, 10, 30)) === 50
telemetry.progressForTime(new DateTime(2014, 6, 1, 11, 0)) === 100
}
"interpolate elevation" in {
val sonda = telemetry.sondaForAbsoluteTime(new DateTime(2014, 6, 1, 10, 30))
sonda.time === new DateTime(2014, 6, 1, 10, 30)
sonda.elevation.current === 150
telemetry.sondaForAbsoluteTime(new DateTime(2014, 6, 1, 9, 0)).elevation.current === 100
telemetry.sondaForAbsoluteTime(new DateTime(2014, 6, 1, 10, 0)).elevation.current === 100
telemetry.sondaForAbsoluteTime(new DateTime(2014, 6, 1, 11, 0)).elevation.current === 200
telemetry.sondaForAbsoluteTime(new DateTime(2014, 6, 1, 12, 0)).elevation.current === 200
telemetry.sondaForAbsoluteTime(new DateTime(2014, 6, 1, 10, 15)).elevation.current === 125
}
"interpolate distance" in {
telemetry.sondaForDistance(-10).distance.current === 0
telemetry.sondaForDistance(0).distance.current === 0
telemetry.sondaForDistance(100).distance.current === 100
telemetry.sondaForDistance(200).distance.current === 200
telemetry.sondaForDistance(300).distance.current === 200
}
}
"telemetry data cycling from Sihlwald collected with Garmin" should {
// activity tracked:
// http://connect.garmin.com/activity/491279898 - extact data
// http://app.strava.com/activities/127544825 - contains more data
val telemetry = Telemetry.loadWith(XML.load(getClass.getResource("/gps/sihlwald.gpx")))
"calculate telemetry data min max" in {
telemetry.track must haveSize(2219)
val tz = DateTimeZone.forID("Europe/Zurich")
telemetry.minTime.getMillis === new DateTime(2014, 4, 6, 10, 6, 21, tz).getMillis
telemetry.maxTime.getMillis === new DateTime(2014, 4, 6, 12, 6, 26, tz).getMillis
telemetry.elevationBoundary === MinMax(446.2, 913.2)
telemetry.latitudeBoundary === MinMax(47.231995, 47.310311)
telemetry.longitudeBoundary === MinMax(8.504216, 8.566166)
telemetry.totalDistance === 25.969048381307253
telemetry.speedBoundary must beCloseTo(MinMax(0.07879420148031871, 86.28724568098714), 6.significantFigures)
telemetry.gradeBoundary must beCloseTo(MinMax(-35.5112900107015, 38.58484806897635), 6.significantFigures)
telemetry.cadenceBoundary === MinMax(0, 120)
telemetry.temperatureBoundary === MinMax(6, 14)
telemetry.heartRateBoundary === MinMax(104, 175)
}
"validate first segment details" in {
val first = telemetry.track(0)
first.segment === 0.005317274837638873
first.speed === 19.142189415499942
first.grade === 0d
}
"find outliers" in {
val outliers = telemetry.track.count(_.grade > 30)
log.info(s"found $outliers outliers out of ${telemetry.track.size}")
outliers === 9
}
}
"telemetry cycling data from Stelvio collected with Strava" should {
// activity tracked:
// http://app.strava.com/activities/78985204 - exact data
val telemetry = Telemetry.loadWith(XML.load(getClass.getResource("/gps/stelvio.gpx")))
"calculate min max" in {
telemetry.track must haveSize(9558)
telemetry.elevationBoundary === MinMax(886.0, 2763.0)
telemetry.speedBoundary.max must beCloseTo(85.56435201871793 within 6.significantFigures)
telemetry.totalDistance must beCloseTo(63.23256444282121 within 6.significantFigures)
telemetry.gradeBoundary must beCloseTo(MinMax(-38.71463504215173, 114.48149716420424), 6.significantFigures)
}
}
"telemetry running data from Tuefi track collected with Strava" in {
val telemetry = Telemetry.loadWith(XML.load(getClass.getResource("/gps/track-run.gpx")))
"calculate min max" in {
telemetry.track must haveSize(1009)
telemetry.elevationBoundary === MinMax(442.0, 447.0)
telemetry.speedBoundary.max must beCloseTo(23.656438316953857 within 6.significantFigures)
telemetry.totalDistance must beCloseTo(4.234620202017025 within 6.significantFigures)
}
}
"telemetry cycling data along Sihl river collected with Garmin 510" should {
val telemetry = Telemetry.loadWith(XML.load(getClass.getResource("/gps/sample.gpx")))
"calculate min max" in {
telemetry.track must haveSize(674)
telemetry.elevationBoundary === MinMax(452.6, 513.2)
telemetry.speedBoundary.max must beCloseTo(33.471772761781544 within 6.significantFigures)
telemetry.totalDistance must beCloseTo(12.492226904069824 within 6.significantFigures)
telemetry.gradeBoundary must beCloseTo(MinMax(-6.504534982064397, 11.890875118231593), 6.significantFigures)
}
}
"telemetry cycling data with power meter and heart rate from Iron Bike Einsiedeln 2017 and Garmin Edge 820" should {
val telemetry = Telemetry.loadWith(XML.load(getClass.getResource("/gps/power-and-heart.gpx")))
"calculate min max" in {
telemetry.track must haveSize(64)
telemetry.heartRateBoundary === MinMax(160, 169)
telemetry.powerBoundary === MinMax(5, 363)
telemetry.track.head.extension.power must beSome(205d)
telemetry.track.head.extension.heartRate must beSome(160d)
}
}
"telemetry data having a few trackpoints without elevation nodes" should {
val telemetry = Telemetry.loadWith(XML.load(getClass.getResource("/gps/20190517_221037.gpx")))
"be parsed" in {
telemetry.track must haveSize(2522)
}
}
"telemetry data without any elevation" should {
val telemetry = Telemetry.loadWith(XML.load(getClass.getResource("/gps/noelevation.gpx")))
"be parsed" in {
telemetry.track must haveSize(179)
}
}
}
|
{
"pile_set_name": "Github"
}
|
#import "YapDatabaseManager.h"
#import <libkern/OSAtomic.h>
/**
* There should only be one YapDatabase or YapCollectionDatabase per file.
*
* The architecture design is to create a single parent database instance,
* and then spawn connections to the database as needed from the parent.
*
* The architecture is built around this restriction, and is dependent upon it for proper operation.
* This class simply helps maintain this requirement.
**/
@implementation YapDatabaseManager
static NSMutableSet *registeredPaths;
static OSSpinLock lock;
+ (void)initialize
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
registeredPaths = [[NSMutableSet alloc] init];
lock = OS_SPINLOCK_INIT;
});
}
+ (BOOL)registerDatabaseForPath:(NSString *)path
{
if (path == nil) return NO;
// Note: The path has already been standardized by the caller (path = [inPath stringByStandardizingPath]).
BOOL result = NO;
OSSpinLockLock(&lock);
if (![registeredPaths containsObject:path])
{
[registeredPaths addObject:path];
result = YES;
}
OSSpinLockUnlock(&lock);
return result;
}
+ (void)deregisterDatabaseForPath:(NSString *)inPath
{
NSString *path = [inPath stringByStandardizingPath];
if (path == nil) return;
OSSpinLockLock(&lock);
[registeredPaths removeObject:path];
OSSpinLockUnlock(&lock);
}
@end
|
{
"pile_set_name": "Github"
}
|
require File.expand_path('../../test_helper', __FILE__)
require 'rack'
module AdvaStatic
class ServerExportTest < Test::Unit::TestCase
include Adva::Static::Server
attr_reader :app
def setup
Factory(:site)
super
end
def teardown
FileUtils.rm_r(export.target)
@export = nil
super
end
def export
@export ||= Export.new(app, :target => '/tmp/adva-static-test/export')
end
test "exports a page /foo.html if response is 200" do
@app = lambda { |env| [200, {}, 'ok'] }
export.call(env_for('/foo'))
assert export.target.join('foo.html').file?
end
test "exports a page /index.html if response is 200" do
@app = lambda { |env| [200, {}, 'ok'] }
export.call(env_for('/'))
assert export.target.join('index.html').file?
end
test "does not export a page if response is not 200" do
@app = lambda { |env| [404, {}, '404 not found'] }
export.call(env_for('/foo'))
assert !export.target.join('foo').file?
end
test "purges files referenced by a given rack-cache.purge header" do
@app = lambda { |env|
case env['PATH_INFO']
when '/'
[200, { PURGE_HEADER => ['/bar', '/baz'] }, 'ok']
else
[404, {}, 'not found']
end
}
%w(bar.html baz.html).each { |path| FileUtils.touch(export.target.join(path)) }
export.call(env_for('/'))
assert export.target.join('index.html').file?
assert !export.target.join('bar.html').file?
assert !export.target.join('baz.html').file?
end
protected
def env_for(uri, options = nil)
Rack::MockRequest.env_for(uri, options || {}).merge(STORE_HEADER => true)
end
end
end
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdio.h>
#include <stdint.h>
#include <ipxe/crypto.h>
#include <ipxe/md5.h>
/**
* Print an MD5 checksum with specified display address
*
* @v dispaddr Display address
* @v data Data to checksum
* @v len Length of data
*/
void dbg_md5_da ( unsigned long dispaddr, const void *data,
unsigned long len ) {
struct digest_algorithm *digest = &md5_algorithm;
uint8_t digest_ctx[digest->ctxsize];
uint8_t digest_out[digest->digestsize];
unsigned int i;
printf ( "md5sum ( %#08lx, %#lx ) = ", dispaddr, len );
digest_init ( digest, digest_ctx );
digest_update ( digest, digest_ctx, data, len );
digest_final ( digest, digest_ctx, digest_out );
for ( i = 0 ; i < sizeof ( digest_out ) ; i++ )
printf ( "%02x", digest_out[i] );
printf ( "\n" );
}
|
{
"pile_set_name": "Github"
}
|
#pragma once
#include "AP_HAL_Linux.h"
#include <AP_ADC/AP_ADC.h>
#include <fcntl.h>
#include <unistd.h>
#define IIO_ANALOG_IN_COUNT 8
#define IIO_ANALOG_IN_DIR "/sys/bus/iio/devices/iio:device0/"
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_PXF
// Note that echo BB-ADC cape should be loaded
#define IIO_VOLTAGE_SCALING 0.00142602816
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI
#define IIO_VOLTAGE_SCALING 3.0*1.8/4095.0
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE
#define IIO_VOLTAGE_SCALING 2.0 / 1000
#else
#define IIO_VOLTAGE_SCALING 1.0
#endif
class AnalogSource_IIO : public AP_HAL::AnalogSource {
public:
friend class AnalogIn_IIO;
AnalogSource_IIO(int16_t pin, float initial_value, float voltage_scaling);
float read_average();
float read_latest();
void set_pin(uint8_t p);
void set_stop_pin(uint8_t p);
void set_settle_time(uint16_t settle_time_ms);
float voltage_average();
float voltage_latest();
float voltage_average_ratiometric() { return voltage_average(); }
private:
float _value;
float _latest;
float _sum_value;
float _voltage_scaling;
uint8_t _sum_count;
int16_t _pin;
int _pin_fd;
int fd_analog_sources[IIO_ANALOG_IN_COUNT];
void init_pins(void);
void select_pin(void);
static const char *analog_sources[];
};
class AnalogIn_IIO : public AP_HAL::AnalogIn {
public:
AnalogIn_IIO();
void init();
AP_HAL::AnalogSource* channel(int16_t n);
// we don't yet know how to get the board voltage
float board_voltage(void) { return 5.0f; }
};
|
{
"pile_set_name": "Github"
}
|
config BR2_PACKAGE_PYTHON_SERIAL
bool "python-serial"
help
python-serial is a Python library to access serial ports.
https://github.com/pyserial/pyserial
|
{
"pile_set_name": "Github"
}
|
{
"imports": "import Button from \"@kiwicom/orbit-components/lib/Button\";\nimport Radio from \"@kiwicom/orbit-components/lib/Radio\";\nimport Stack from \"@kiwicom/orbit-components/lib/Stack\";",
"example": "() => {\n const [checked, setChecked] = React.useState(false)\n return (\n <Stack>\n <Radio\n label=\"Cabin bag\"\n checked={checked}\n onChange={() => setChecked(!checked)}\n info=\"56 × 45 × 25 cm, 8 kg\"\n hasError\n />\n <Button type=\"secondary\" onClick={() => setChecked(false)}>\n Clear\n </Button>\n </Stack>\n )\n}\n",
"info": {
"title": "Errors",
"description": "Show users there is an error with a radio by passing the hasError prop. Note that the radio will show the error only when checked and disabled are false."
}
}
|
{
"pile_set_name": "Github"
}
|
<docs>
<DefaultCtor>
<summary>
Initializes a new instance of the <see cref="MySqlConnection"/> class.
</summary>
<remarks>
When a new instance of <see cref="MySqlConnection"/> is created, the read/write
properties are set to the following initial values unless they are specifically
set using their associated keywords in the <see cref="ConnectionString"/> property.
<para/>
<list type="table">
<listheader>
<term>Properties</term>
<term>Initial Value</term>
</listheader>
<item>
<term>
<see cref="ConnectionString"/>
</term>
<term>empty string ("")</term>
</item>
<item>
<term>
<see cref="ConnectionTimeout"/>
</term>
<term>15</term>
</item>
<item>
<term>
<see cref="Database"/>
</term>
<term>empty string ("")</term>
</item>
<item>
<term>
<see cref="DataSource"/>
</term>
<term>empty string ("")</term>
</item>
<item>
<term>
<see cref="ServerVersion"/>
</term>
<term>empty string ("")</term>
</item>
</list>
<para/>
You can change the value for these properties only by using the <B>ConnectionString</B> property.
</remarks>
<example>
</example>
<overloads>
<summary>
Initializes a new instance of the <see cref="MySqlConnection"/> class.
</summary>
</overloads>
</DefaultCtor>
<Ctor1>
<summary>
Initializes a new instance of the <see cref="MySqlConnection"/> class when given a string containing the connection string.
</summary>
<remarks>
When a new instance of <see cref="MySqlConnection"/> is created, the read/write
properties are set to the following initial values unless they are specifically
set using their associated keywords in the <see cref="ConnectionString"/> property.
<para/>
<list type="table">
<listheader>
<term>Properties</term>
<term>Initial Value</term>
</listheader>
<item>
<term>
<see cref="ConnectionString"/>
</term>
<term>empty string ("")</term>
</item>
<item>
<term>
<see cref="ConnectionTimeout"/>
</term>
<term>15</term>
</item>
<item>
<term>
<see cref="Database"/>
</term>
<term>empty string ("")</term>
</item>
<item>
<term>
<see cref="DataSource"/>
</term>
<term>empty string ("")</term>
</item>
<item>
<term>
<see cref="ServerVersion"/>
</term>
<term>empty string ("")</term>
</item>
</list>
<para/>
You can change the value for these properties only by using the <B>ConnectionString</B> property.
</remarks>
<example>
</example>
<param name="connectionString">The connection properties used to open the MySQL database. </param>
</Ctor1>
<Open>
<summary>Opens a database connection with the property settings specified by the ConnectionString.</summary>
<exception cref="InvalidOperationException">Cannot open a connection without specifying a data source or server.</exception>
<exception cref="MySqlException">A connection-level error occurred while opening the connection.</exception>
<remarks>
<para>
The <see cref="MySqlConnection"/> draws an open connection from the connection pool if one is available.
Otherwise, it establishes a new connection to an instance of MySQL.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlConnection"/>, opens it,
displays some of its properties, then closes the connection.
<code lang="vbnet">
Public Sub CreateMySqlConnection(myConnString As String)
Dim myConnection As New MySqlConnection(myConnString)
myConnection.Open()
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.Cr + "State: " + myConnection.State.ToString())
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlConnection(string myConnString)
{
MySqlConnection myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
"\nState: " + myConnection.State.ToString());
myConnection.Close();
}
</code>
</example>
</Open>
<Database>
<summary>Gets the name of the current database or the database to be used after a connection is opened.</summary>
<returns>The name of the current database or the name of the database to be used after a connection is opened. The default value is an empty string.</returns>
<remarks>
<para>
The <B>Database</B> property does not update dynamically.
If you change the current database using a SQL statement, then this property
may reflect the wrong value. If you change the current database using the <see cref="ChangeDatabase"/>
method, this property is updated to reflect the new database.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlConnection"/> and displays
some of its read-only properties.
<code lang="vbnet">
Public Sub CreateMySqlConnection()
Dim myConnString As String = _
"Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
Dim myConnection As New MySqlConnection( myConnString )
myConnection.Open()
MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
+ ControlChars.NewLine + "Database: " + myConnection.Database )
myConnection.ChangeDatabase( "test2" )
MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.NewLine + "Database: " + myConnection.Database )
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlConnection()
{
string myConnString =
"Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
MySqlConnection myConnection = new MySqlConnection( myConnString );
myConnection.Open();
MessageBox.Show( "Server Version: " + myConnection.ServerVersion
+ "\nDatabase: " + myConnection.Database );
myConnection.ChangeDatabase( "test2" );
MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
+ "\nDatabase: " + myConnection.Database );
myConnection.Close();
}
</code>
</example>
</Database>
<State>
<summary>Gets the current state of the connection.</summary>
<returns>
A bitwise combination of the <see cref="System.Data.ConnectionState"/> values. The default is <B>Closed</B>.
</returns>
<remarks>
The allowed state changes are:
<list type="bullet">
<item>
From <B>Closed</B> to <B>Open</B>, using the <B>Open</B> method of the connection object.
</item>
<item>
From <B>Open</B> to <B>Closed</B>, using either the <B>Close</B> method or the <B>Dispose</B> method of the connection object.
</item>
</list>
</remarks>
<example>
The following example creates a <see cref="MySqlConnection"/>, opens it,
displays some of its properties, then closes the connection.
<code lang="vbnet">
Public Sub CreateMySqlConnection(myConnString As String)
Dim myConnection As New MySqlConnection(myConnString)
myConnection.Open()
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.Cr + "State: " + myConnection.State.ToString())
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlConnection(string myConnString)
{
MySqlConnection myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
"\nState: " + myConnection.State.ToString());
myConnection.Close();
}
</code>
</example>
</State>
<ServerVersion>
<summary>Gets a string containing the version of the MySQL server to which the client is connected.</summary>
<returns>The version of the instance of MySQL.</returns>
<exception cref="InvalidOperationException">The connection is closed.</exception>
<example>
The following example creates a <see cref="MySqlConnection"/>, opens it,
displays some of its properties, then closes the connection.
<code lang="vbnet">
Public Sub CreateMySqlConnection(myConnString As String)
Dim myConnection As New MySqlConnection(myConnString)
myConnection.Open()
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.Cr + "State: " + myConnection.State.ToString())
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlConnection(string myConnString)
{
MySqlConnection myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
"\nState: " + myConnection.State.ToString());
myConnection.Close();
}
</code>
</example>
</ServerVersion>
<Close>
<summary>Closes the connection to the database. This is the preferred method of closing any open connection.</summary>
<remarks>
<para>
The <B>Close</B> method rolls back any pending transactions. It then releases
the connection to the connection pool, or closes the connection if connection
pooling is disabled.
</para>
<para>
An application can call <B>Close</B> more than one time. No exception is
generated.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlConnection"/>, opens it,
displays some of its properties, then closes the connection.
<code lang="vbnet">
Public Sub CreateMySqlConnection(myConnString As String)
Dim myConnection As New MySqlConnection(myConnString)
myConnection.Open()
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.Cr + "State: " + myConnection.State.ToString())
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlConnection(string myConnString)
{
MySqlConnection myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
"\nState: " + myConnection.State.ToString());
myConnection.Close();
}
</code>
</example>
</Close>
<CreateCommand>
<summary>
Creates and returns a <see cref="MySqlCommand"/> object associated with the <see cref="MySqlConnection"/>.
</summary>
<returns>
A <see cref="MySqlCommand"/> object.
</returns>
</CreateCommand>
<BeginTransaction>
<summary>Begins a database transaction.</summary>
<returns>An object representing the new transaction.</returns>
<exception cref="InvalidOperationException">Parallel transactions are not supported.</exception>
<remarks>
<para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
<para>
You must explicitly commit or roll back the transaction using the <see cref="MySqlTransaction.Commit"/> or
<see cref="MySqlTransaction.Rollback"/> method.
<note>
If you do not specify an isolation level, the default isolation level is used. To specify an isolation
level with the <see cref="BeginTransaction()"/> method, use the overload that takes the <I>iso</I> parameter. Also
note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher.
On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status.
</note>
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlConnection"/> and a
<see cref="MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
<see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
<code lang="vbnet">
Public Sub RunTransaction(myConnString As String)
Dim myConnection As New MySqlConnection(myConnString)
myConnection.Open()
Dim myCommand As MySqlCommand = myConnection.CreateCommand()
Dim myTrans As MySqlTransaction
' Start a local transaction
myTrans = myConnection.BeginTransaction()
' Must assign both transaction object and connection
' to Command object for a pending local transaction
myCommand.Connection = myConnection
myCommand.Transaction = myTrans
Try
myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
myCommand.ExecuteNonQuery()
myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
myCommand.ExecuteNonQuery()
myTrans.Commit()
Console.WriteLine("Both records are written to database.")
Catch e As Exception
Try
myTrans.Rollback()
Catch ex As MySqlException
If Not myTrans.Connection Is Nothing Then
Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
" was encountered while attempting to roll back the transaction.")
End If
End Try
Console.WriteLine("An exception of type " + e.GetType().ToString() + _
"was encountered while inserting the data.")
Console.WriteLine("Neither record was written to database.")
Finally
myConnection.Close()
End Try
End Sub
</code>
<code lang="C#">
public void RunTransaction(string myConnString)
{
MySqlConnection myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MySqlCommand myCommand = myConnection.CreateCommand();
MySqlTransaction myTrans;
// Start a local transaction
myTrans = myConnection.BeginTransaction();
// Must assign both transaction object and connection
// to Command object for a pending local transaction
myCommand.Connection = myConnection;
myCommand.Transaction = myTrans;
try
{
myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
myCommand.ExecuteNonQuery();
myTrans.Commit();
Console.WriteLine("Both records are written to database.");
}
catch(Exception e)
{
try
{
myTrans.Rollback();
}
catch (SqlException ex)
{
if (myTrans.Connection != null)
{
Console.WriteLine("An exception of type " + ex.GetType() +
" was encountered while attempting to roll back the transaction.");
}
}
Console.WriteLine("An exception of type " + e.GetType() +
" was encountered while inserting the data.");
Console.WriteLine("Neither record was written to database.");
}
finally
{
myConnection.Close();
}
}
</code>
</example>
</BeginTransaction>
<BeginTransaction1>
<summary>Begins a database transaction with the specified isolation level.</summary>
<param name="iso">The isolation level under which the transaction should run. </param>
<returns>An object representing the new transaction.</returns>
<exception cref="InvalidOperationException">Parallel exceptions are not supported.</exception>
<remarks>
<para>This command is equivalent to the MySQL BEGIN TRANSACTION command.</para>
<para>
You must explicitly commit or roll back the transaction using the <see cref="MySqlTransaction.Commit"/> or
<see cref="MySqlTransaction.Rollback"/> method.
<note>
If you do not specify an isolation level, the default isolation level is used. To specify an isolation
level with the <see cref="BeginTransaction()"/> method, use the overload that takes the <I>iso</I> parameter.
Also note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher.
On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status.
</note>
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlConnection"/> and a
<see cref="MySqlTransaction"/>. It also demonstrates how to use the <B>BeginTransaction</B>, a
<see cref="MySqlTransaction.Commit"/>, and <see cref="MySqlTransaction.Rollback"/> methods.
<code lang="vbnet">
Public Sub RunTransaction(myConnString As String)
Dim myConnection As New MySqlConnection(myConnString)
myConnection.Open()
Dim myCommand As MySqlCommand = myConnection.CreateCommand()
Dim myTrans As MySqlTransaction
' Start a local transaction
myTrans = myConnection.BeginTransaction()
' Must assign both transaction object and connection
' to Command object for a pending local transaction
myCommand.Connection = myConnection
myCommand.Transaction = myTrans
Try
myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
myCommand.ExecuteNonQuery()
myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
myCommand.ExecuteNonQuery()
myTrans.Commit()
Console.WriteLine("Both records are written to database.")
Catch e As Exception
Try
myTrans.Rollback()
Catch ex As MySqlException
If Not myTrans.Connection Is Nothing Then
Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
" was encountered while attempting to roll back the transaction.")
End If
End Try
Console.WriteLine("An exception of type " + e.GetType().ToString() + _
"was encountered while inserting the data.")
Console.WriteLine("Neither record was written to database.")
Finally
myConnection.Close()
End Try
End Sub
</code>
<code lang="C#">
public void RunTransaction(string myConnString)
{
MySqlConnection myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MySqlCommand myCommand = myConnection.CreateCommand();
MySqlTransaction myTrans;
// Start a local transaction
myTrans = myConnection.BeginTransaction();
// Must assign both transaction object and connection
// to Command object for a pending local transaction
myCommand.Connection = myConnection;
myCommand.Transaction = myTrans;
try
{
myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
myCommand.ExecuteNonQuery();
myTrans.Commit();
Console.WriteLine("Both records are written to database.");
}
catch(Exception e)
{
try
{
myTrans.Rollback();
}
catch (SqlException ex)
{
if (myTrans.Connection != null)
{
Console.WriteLine("An exception of type " + ex.GetType() +
" was encountered while attempting to roll back the transaction.");
}
}
Console.WriteLine("An exception of type " + e.GetType() +
" was encountered while inserting the data.");
Console.WriteLine("Neither record was written to database.");
}
finally
{
myConnection.Close();
}
}
</code>
</example>
</BeginTransaction1>
<ChangeDatabase>
<summary>Changes the current database for an open MySqlConnection.</summary>
<param name="databaseName">The name of the database to use.</param>
<remarks>
<para>
The value supplied in the <I>database</I> parameter must be a valid database
name. The <I>database</I> parameter cannot contain a null value, an empty
string, or a string with only blank characters.
</para>
<para>
When you are using connection pooling against MySQL, and you close
the connection, it is returned to the connection pool. The next time the
connection is retrieved from the pool, the reset connection request
executes before the user performs any operations.
</para>
</remarks>
<exception cref="ArgumentException">The database name is not valid.</exception>
<exception cref="InvalidOperationException">The connection is not open.</exception>
<exception cref="MySqlException">Cannot change the database.</exception>
<example>
The following example creates a <see cref="MySqlConnection"/> and displays
some of its read-only properties.
<code lang="vbnet">
Public Sub CreateMySqlConnection()
Dim myConnString As String = _
"Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
Dim myConnection As New MySqlConnection( myConnString )
myConnection.Open()
MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
+ ControlChars.NewLine + "Database: " + myConnection.Database )
myConnection.ChangeDatabase( "test2" )
MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.NewLine + "Database: " + myConnection.Database )
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlConnection()
{
string myConnString =
"Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
MySqlConnection myConnection = new MySqlConnection( myConnString );
myConnection.Open();
MessageBox.Show( "Server Version: " + myConnection.ServerVersion
+ "\nDatabase: " + myConnection.Database );
myConnection.ChangeDatabase( "test2" );
MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
+ "\nDatabase: " + myConnection.Database );
myConnection.Close();
}
</code>
</example>
</ChangeDatabase>
<StateChange>
<summary>Occurs when the state of the connection changes.</summary>
<remarks>
<para>
The <B>StateChange</B> event fires whenever the <see cref="State"/> changes from
closed to opened, or from opened to closed. <B>StateChange</B> fires immediately
after the <see cref="MySqlConnection"/> transitions.
</para>
<para>
If an event handler throws an exception from within the <B>StateChange</B>
event, the exception propagates to the caller of the <see cref="Open"/> or
<see cref="Close"/> method.
</para>
<para>
The <B>StateChange</B> event is not raised unless you explicitly call
<B>Close</B> or <B>Dispose</B>.
</para>
</remarks>
<event cref="StateChange">
Raised.
<data>
<para>
The event handler receives an argument of type <see cref="System.Data.StateChangeEventArgs"/>
containing data related to this event. The following <B>StateChangeEventArgs</B>
properties provide information specific to this event.
</para>
<list type="table">
<listheader>
<term>Property</term>
<description>Description</description>
</listheader>
<item>
<term>
<see cref="System.Data.StateChangeEventArgs.CurrentState"/>
</term>
<description>
Gets the new state of the connection. The connection object will
be in the new state already when the event is fired.
</description>
</item>
<item>
<term>
<see cref="System.Data.StateChangeEventArgs.OriginalState"/>
</term>
<description>Gets the original state of the connection.</description>
</item>
</list>
</data>
</event>
</StateChange>
<InfoMessage>
<summary>Occurs when MySQL returns warnings as a result of executing a command or query.</summary>
<remarks>
</remarks>
</InfoMessage>
<ClassSummary>
<summary>
Represents an open connection to a MySQL Server database. This class cannot be inherited.
</summary>
<remarks>
<para>
A <b>MySqlConnection</b> object represents a session to a MySQL Server
data source. When you create an instance of <B>MySqlConnection</B>, all
properties are set to their initial values. For a list of these values, see the
<B>MySqlConnection</B> constructor.
</para>
<para>
If the <B>MySqlConnection</B> goes out of scope, it is not closed. Therefore,
you must explicitly close the connection by calling <see cref="MySqlConnection.Close"/>
or <see cref="MySqlConnection.Dispose()"/>.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and
a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the
<see cref="MySqlCommand.Connection"/> for the <B>MySqlCommand</B>. The example then calls
<see cref="MySqlCommand.ExecuteNonQuery"/>, and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
passed a connection string and a query string that is a SQL INSERT
statement.
<code lang="vbnet">
<c>
Public Sub InsertRow(myConnectionString As String)
' If the connection string is null, use a default.
If myConnectionString = "" Then
myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
End If
Dim myConnection As New MySqlConnection(myConnectionString)
Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
Dim myCommand As New MySqlCommand(myInsertQuery)
myCommand.Connection = myConnection
myConnection.Open()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
End Sub
</c>
</code>
<code lang="C#">
<c>
public void InsertRow(string myConnectionString)
{
// If the connection string is null, use a default.
if(myConnectionString == "")
{
myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
}
MySqlConnection myConnection = new MySqlConnection(myConnectionString);
string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
}
</c>
</code>
</example>
</ClassSummary>
<ConnectionTimeout>
<summary>
Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error.
</summary>
<exception cref="System.ArgumentException">The value set is less than 0.</exception>
<remarks>
A value of 0 indicates no limit, and should be avoided in a
<see cref="MySqlConnection.ConnectionString"/> because an attempt to connect
will wait indefinitely.
</remarks>
<example>
The following example creates a MySqlConnection
and sets some of its properties in the connection string.
<code lang="vbnet">
Public Sub CreateSqlConnection()
Dim myConnection As New MySqlConnection()
myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"
myConnection.Open()
End Sub
</code>
<code lang="C#">
public void CreateSqlConnection()
{
MySqlConnection myConnection = new MySqlConnection();
myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30";
myConnection.Open();
}
</code>
</example>
</ConnectionTimeout>
<ConnectionString>
<summary>
Gets or sets the string used to connect to a MySQL Server database.
</summary>
<remarks>
<para>
The <B>ConnectionString</B> returned may not be exactly like what was originally
set but will be indentical in terms of keyword/value pairs. Security information
will not be included unless the Persist Security Info value is set to true.
</para>
<para>
You can use the <B>ConnectionString</B> property to connect to a database.
The following example illustrates a typical connection string.
</para>
<c>"Persist Security Info=False;database=MyDB;server=MySqlServer;user id=myUser;Password=myPass"</c>
<para>
The <B>ConnectionString</B> property can be set only when the connection is
closed. Many of the connection string values have corresponding read-only
properties. When the connection string is set, all of these properties are
updated, except when an error is detected. In this case, none of the properties
are updated. <see cref="MySqlConnection"/> properties return only those settings contained in the
<B>ConnectionString</B>.
</para>
<para>
To connect to a local machine, specify "localhost" for the server. If you do not
specify a server, localhost is assumed.
</para>
<para>
Resetting the <B>ConnectionString</B> on a closed connection resets all
connection string values (and related properties) including the password. For
example, if you set a connection string that includes "Database= MyDb", and
then reset the connection string to "Data Source=myserver;User Id=myUser;Password=myPass",
the <see cref="MySqlConnection.Database"/> property is no longer set to MyDb.
</para>
<para>
The connection string is parsed immediately after being set. If errors in
syntax are found when parsing, a runtime exception, such as <see cref="ArgumentException"/>,
is generated. Other errors can be found only when an attempt is made to open the
connection.
</para>
<para>
The basic format of a connection string consists of a series of keyword/value
pairs separated by semicolons. The equal sign (=) connects each keyword and its
value. To include values that contain a semicolon, single-quote character, or
double-quote character, the value must be enclosed in double quotes. If the
value contains both a semicolon and a double-quote character, the value can be
enclosed in single quotes. The single quote is also useful if the value begins
with a double-quote character. Conversely, the double quote can be used if the
value begins with a single quote. If the value contains both single-quote and
double-quote characters, the quote character used to enclose the value must be
doubled each time it occurs within the value.
</para>
<para>
To include preceding or trailing spaces in the string value, the value must
be enclosed in either single quotes or double quotes. Any leading or trailing
spaces around integer, Boolean, or enumerated values are ignored, even if
enclosed in quotes. However, spaces within a string literal keyword or value are
preserved. Using .NET Framework version 1.1, single or double quotes may be used
within a connection string without using delimiters (for example, Data Source=
my'Server or Data Source= my"Server), unless a quote character is the first or
last character in the value.
</para>
<para>
To include an equal sign (=) in a keyword or value, it must be preceded by
another equal sign. For example, in the hypothetical connection string
</para>
<c>"key==word=value"</c>
<para></para>
<para>the keyword is "key=word" and the value is "value".</para>
<para>
If a specific keyword in a keyword= value pair occurs multiple times in a
connection string, the last occurrence listed is used in the value set.
</para>
<para>Keywords are not case sensitive.</para>
<para>
The following table lists the valid names for keyword values within the
<B>ConnectionString</B>.
</para>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr valign="top">
<th width="33%">Name</th>
<th width="33%">Default</th>
<th width="33%">Description</th>
</tr>
<tr>
<td>
Connect Timeout<para> -or- </para>Connection Timeout
</td>
<td>15</td>
<td>
The length of time (in seconds) to wait for a connection to the server before
terminating the attempt and generating an error.
</td>
</tr>
<tr>
<td>
Host<para> -or- </para>Server<para> -or- </para>Data Source<para> -or- </para>
DataSource<para> -or- </para>Address<para> -or- </para>Addr<para> -or- </para>
Network Address
</td>
<td>localhost</td>
<td>
<para>
The name or network address of the instance of MySQL to which to connect. Multiple hosts can be
specified separated by &. This can be useful where multiple MySQL servers are configured for replication
and you are not concerned about the precise server you are connecting to. No attempt is made by the provider to
synchronize writes to the database so care should be taken when using this option.
</para>
<para>
In Unix environment with Mono, this can be a fully qualified path to MySQL socket filename. With this configuration, the Unix socket will be used instead of TCP/IP socket.
Currently only a single socket name can be given so accessing MySQL in a replicated environment using Unix sockets is not currently supported.
</para>
</td>
</tr>
<tr>
<td>Port</td>
<td>3306</td>
<td>
The port MySQL is using to listen for connections. This value is ignored if the connection protocol
is anything but socket.
</td>
</tr>
<tr>
<td>Protocol</td>
<td>socket</td>
<td>
Specifies the type of connection to make to the server.<para>Values can be:</para>
socket or tcp for a socket connection<br/>
pipe for a named pipe connection<br/>
unix for a Unix socket connection<br/>
memory to use MySQL shared memory
</td>
</tr>
<tr>
<td>
CharSet<para> -or </para>Character Set
</td>
<td></td>
<td>
Specifies the character set that should be used to encode all queries sent to the server.
Resultsets are still returned in the character set of the data returned.
</td>
</tr>
<tr>
<td>Logging</td>
<td>false</td>
<td>When true, various pieces of information is output to any configured TraceListeners.</td>
</tr>
<tr>
<td>Allow Batch</td>
<td>true</td>
<td>
When true, multiple SQL statements can be sent with one command execution.<br/><br/>
-Note-<br/>
Starting with MySQL 4.1.1, batch statements should be separated by the server-defined seperator character.<br/>
Commands sent to earlier versions of MySQL should be seperated with ';'.
</td>
</tr>
<tr>
<td>Encrypt</td>
<td>false</td>
<td>
When <B>true</B>, SSL/TLS encryption is used for all data sent between the
client and server if the server has a certificate installed. Recognized values
are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.
</td>
</tr>
<tr>
<td>
Initial Catalog<para> -or- </para>Database
</td>
<td>mysql</td>
<td>The name of the database to use intially</td>
</tr>
<tr>
<td>
Password<para> -or- </para>pwd
</td>
<td></td>
<td>The password for the MySQL account being used.</td>
</tr>
<tr>
<td>Persist Security Info</td>
<td>false</td>
<td>
When set to <B>false</B> or <B>no</B> (strongly recommended), security-sensitive
information, such as the password, is not returned as part of the connection if
the connection is open or has ever been in an open state. Resetting the
connection string resets all connection string values including the password.
Recognized values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.
</td>
</tr>
<tr>
<td>
User Id<para> -or- </para>Username<para> -or- </para>Uid<para> -or- </para>User name
</td>
<td></td>
<td>The MySQL login account being used.</td>
</tr>
<tr>
<td>Shared Memory Name</td>
<td>MYSQL</td>
<td>The name of the shared memory object to use for communication if the connection protocol is set to memory.</td>
</tr>
<tr>
<td>Allow Zero Datetime</td>
<td>false</td>
<td>
True to have MySqlDataReader.GetValue() return a MySqlDateTime for date or datetime columns that have illegal values.
False will cause a DateTime object to be returned for legal values and an exception will be thrown for illegal values.
</td>
</tr>
<tr>
<td>Convert Zero Datetime</td>
<td>false</td>
<td>
True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime()
return DateTime.MinValue for date or datetime columns that have illegal values.
</td>
</tr>
<tr>
<td>
Pipe Name<para> -or- </para>Pipe
</td>
<td>mysql</td>
<td>
When set to the name of a named pipe, the <B>MySqlConnection</B> will attempt to connect to MySQL
on that named pipe.<br/><br/>This settings only applies to the Windows platform.
</td>
</tr>
<tr>
<td>
Use Performance Monitor<para> -or- </para>UsePerformanceMonitor
</td>
<td>false</td>
<td>
Posts performance data that can be tracked using perfmon
</td>
</tr>
<tr>
<td>
Procedure Cache Size
</td>
<td>25</td>
<td>
How many stored procedure definitions can be held in the cache
</td>
</tr>
<tr>
<td>
Ignore Prepare
</td>
<td>true</td>
<td>
Instructs the provider to ignore any attempts to prepare commands. This option
was added to allow a user to disable prepared statements in an entire application
without modifying the code. A user might want to do this if errors or bugs are
encountered with MySQL prepared statements.
</td>
</tr>
<tr>
<td>Use Procedure Bodies</td>
<td>true</td>
<td>
Instructs the provider to attempt to call the procedure without first resolving the metadata. This
is useful in situations where the calling user does not have access to the mysql.proc table. To
use this mode, the parameters for the procedure must be added to the command in the same order
as they appear in the procedure definition and their types must be explicitly set.
</td>
</tr>
<tr>
<td>Auto Enlist</td>
<td>true</td>
<td>
Indicates whether the connection should automatically enlist in the current transaction,
if there is one.
</td>
</tr>
<tr>
<td>Respect Binary Flags</td>
<td>true</td>
<td>
Indicates whether the connection should respect all binary flags sent to the client
as part of column metadata. False will cause the connector to behave like
Connector/Net 5.0 and earlier.
</td>
</tr>
<tr>
<td>BlobAsUTF8IncludePattern</td>
<td>null</td>
<td>
Pattern that should be used to indicate which blob columns should be treated as UTF-8.
</td>
</tr>
<tr>
<td>BlobAsUTF8ExcludePattern</td>
<td>null</td>
<td>
Pattern that should be used to indicate which blob columns should not be treated as UTF-8.
</td>
</tr>
<tr>
<td>Default Command Timeout</td>
<td>30</td>
<td>
The default timeout that new MySqlCommand objects will use unless changed.
</td>
</tr>
<tr>
<td>Allow User Variables</td>
<td>false</td>
<td>
Should the provider expect user variables in the SQL.
</td>
</tr>
<tr>
<td>Interactive -or- Interactive Session</td>
<td>false</td>
<td>
Should this session be considered interactive?
</td>
</tr>
<tr>
<td>Functions Return String</td>
<td>false</td>
<td>
Set this option to true to force the return value of SQL functions to be string.
</td>
</tr>
<tr>
<td>Use Affected Rows</td>
<td>false</td>
<td>
Set this option to true to cause the affected rows reported to reflect only the
rows that are actually changed. By default, the number of rows that are matched
is returned.
</td>
</tr>
</table>
</div>
<para>
The following table lists the valid names for connection pooling values within
the <B>ConnectionString</B>. For more information about connection pooling, see
Connection Pooling for the MySql Data Provider.
</para>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr valign="top">
<th width="33%">Name</th>
<th width="33%">Default</th>
<th width="33%">Description</th>
</tr>
<tr>
<td>Connection Lifetime</td>
<td>0</td>
<td>
When a connection is returned to the pool, its creation time is compared with
the current time, and the connection is destroyed if that time span (in seconds)
exceeds the value specified by <B>Connection Lifetime</B>. This is useful in
clustered configurations to force load balancing between a running server and a
server just brought online.
<para>
A value of zero (0) causes pooled connections to have the maximum connection
timeout.
</para>
</td>
</tr>
<tr>
<td>Max Pool Size</td>
<td>100</td>
<td>The maximum number of connections allowed in the pool.</td>
</tr>
<tr>
<td>Min Pool Size</td>
<td>0</td>
<td>The minimum number of connections allowed in the pool.</td>
</tr>
<tr>
<td>Pooling</td>
<td>true</td>
<td>
When <B>true</B>, the <B>MySqlConnection</B> object is drawn from the appropriate
pool, or if necessary, is created and added to the appropriate pool. Recognized
values are <B>true</B>, <B>false</B>, <B>yes</B>, and <B>no</B>.
</td>
</tr>
<tr>
<td>Connection Reset</td>
<td>false</td>
<td>
Specifies whether the database connection should be reset when being
drawn from the pool. Leaving this as <b>false</b> will yeild much faster
connection opens but the user should understand the side effects
of doing this such as temporary tables and user variables from the previous
session not being cleared out.
</td>
</tr>
<tr>
<td>Cache Server Properties</td>
<td>false</td>
<td>
Specifies whether the server variables are cached between pooled connections.
On systems where the variables change infrequently and there are lots of
connection attempts, this can speed up things dramatically.
</td>
</tr>
</table>
</div>
<para>
When setting keyword or connection pooling values that require a Boolean
value, you can use 'yes' instead of 'true', and 'no' instead of 'false'.
</para>
<para>
<B>Note</B> The MySql Data Provider uses the native socket protocol to
communicate with MySQL. Therefore, it does not support the use of an ODBC data source name (DSN) when
connecting to MySQL because it does not add an ODBC layer.
</para>
<para>
<B>CAUTION</B> In this release, the application should use caution when constructing a
connection string based on user input (for example when retrieving user ID and password information from a
dialog box, and appending it to the connection string). The application should
ensure that a user cannot embed extra connection string parameters in these
values (for example, entering a password as "validpassword;database=somedb" in
an attempt to attach to a different database).
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlConnection"/> and sets some of its properties
<code lang="vbnet">
Public Sub CreateConnection()
Dim myConnection As New MySqlConnection()
myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass"
myConnection.Open()
End Sub 'CreateConnection
</code>
<code lang="C#">
public void CreateConnection()
{
MySqlConnection myConnection = new MySqlConnection();
myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass";
myConnection.Open();
}
</code>
</example>
<example>
The following example creates a <see cref="MySqlConnection"/> in Unix environment with Mono installed. MySQL socket filename used in this example is "/var/lib/mysql/mysql.sock". The actual filename depends on your MySQL configuration.
<code lang="vbnet">
Public Sub CreateConnection()
Dim myConnection As New MySqlConnection()
myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass"
myConnection.Open()
End Sub 'CreateConnection
</code>
<code lang="C#">
public void CreateConnection()
{
MySqlConnection myConnection = new MySqlConnection();
myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass";
myConnection.Open();
}
</code>
</example>
</ConnectionString>
<ClearPool>
<summary>Empties the connection pool associated with the specified connection.</summary>
<param name="connection">
The <see cref="MySqlConnection"/> associated with the pool to be cleared.
</param>
<remarks>
<para>
ClearPool clears the connection pool that is associated with the connection.
If additional connections associated with connection are in use at the time of the call,
they are marked appropriately and are discarded (instead of being returned to the pool)
when Close is called on them.
</para>
</remarks>
</ClearPool>
<ClearAllPools>
<summary>Clears all connection pools.</summary>
<remarks>
<para>
ClearAllPools essentially performs a <see cref="ClearPool"/> on all current connection
pools.
</para>
</remarks>
</ClearAllPools>
</docs>
|
{
"pile_set_name": "Github"
}
|
/**
* The base implementation of `_.sortBy` which uses `comparer` to define
* the sort order of `array` and replaces criteria objects with their
* corresponding values.
*
* @private
* @param {Array} array The array to sort.
* @param {Function} comparer The function to define sort order.
* @returns {Array} Returns `array`.
*/
function baseSortBy(array, comparer) {
var length = array.length;
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
module.exports = baseSortBy;
|
{
"pile_set_name": "Github"
}
|
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) 2017 Payara Foundation and/or its affiliates. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://github.com/payara/Payara/blob/master/LICENSE.txt
See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at glassfish/legal/LICENSE.txt.
GPL Classpath Exception:
The Payara Foundation designates this particular file as subject to the "Classpath"
exception as provided by the Payara Foundation in the GPL Version 2 section of the License
file that accompanied this code.
Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"
Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->
<!initPage
setResourceBundle(key="i18nc" bundle="org.glassfish.common.admingui.Strings");
setResourceBundle(key="i18ncs" bundle="org.glassfish.cluster.admingui.Strings");
setResourceBundle(key="i18ndn" bundle="fish.payara.admingui.notifier.datadog.Strings");
setResourceBundle(key="i18nn" bundle="fish.payara.admingui.extras.Strings");
/>
<!composition template="/templates/default.layout" guiTitle="$resource{i18ndn.notifier.datadog.configuration.pageTitle}" >
<!define name="content">
<event>
<!beforeCreate
getRequestValue(key="configName" value="#{pageSession.configName}" );
createMap(result="#{pageSession.attrsMap}")
mapPut(map="#{pageSession.attrsMap}" key="target" value="#{pageSession.configName}");
gf.restRequest(endpoint="#{sessionScope.NOTIFICATION_CONFIG_URL}/get-datadog-notifier-configuration?target=#{pageSession.configName}"
method="GET" result="#{requestScope.resp}");
setPageSessionAttribute(key="valueMap", value="#{requestScope.resp.data.extraProperties.notifierConfiguration}");
mapPut(map="#{pageSession.valueMap}" key="target" value="#{pageSession.configName}");
setPageSessionAttribute(key="convertToFalseList", value={"enabled", "noisy", "dynamic"});
if (#{pageSession.valueMap['enabled']}=true) {
setPageSessionAttribute(key="enabledSelected", value="true");
}
if (#{pageSession.valueMap['noisy']}=true) {
setPageSessionAttribute(key="noisy", value="true");
}
setPageSessionAttribute(key="dynamic", value="true");
/>
</event>
<sun:form id="propertyForm">
#include "/common/shared/alertMsg_1.inc"
#include "/payaraExtras/notification/notificationConfigTabs.inc"
<sun:title id="propertyContentPage" title="$resource{i18ndn.notifier.datadog.configuration.pageTitle}"
helpText="$resource{i18ndn.notifier.datadog.configuration.pageHelpText}" >
<sun:button id = "test" text="$resource{i18ndn.notifier.datadog.buttons.test}">
<!command
mapCopy(source="#{pageSession.valueMap}" dest="#{pageSession.attrsMap}");
mapRemove(map="#{pageSession.attrsMap}" key="enabled");
mapRemove(map="#{pageSession.attrsMap}" key="noisy");
mapRemove(map="#{pageSession.attrsMap}" key="noisy");
mapRemove(map="#{pageSession.attrsMap}" key="dynamic");
gf.restRequest(endpoint="#{sessionScope.NOTIFICATION_CONFIG_URL}/test-datadog-notifier-configuration?target=#{pageSession.configName}" method="GET"
attrs="#{pageSession.attrsMap}" result="#{requestScope.result}");
if ("#{requestScope.result.data['exit_code']} = SUCCESS") {
prepareAlertMsg(summary="$resource{i18ndn.notifier.datadog.msg.success}", type="success");
}
/>
</sun:button>
<!facet pageButtonsTop>
<sun:panelGroup id="topButtons">
<sun:button id="saveButton" text="$resource{i18n.button.Save}"
onClick="if (guiValidate('#{reqMsg}','#{reqInt}','#{reqPort}')) submitAndDisable(this, '$resource{i18n.button.Processing}'); return false;" >
<!command
mapPut(map="#{pageSession.valueMap}" key="enabled" value="#{pageSession.enabledSelected}");
mapPut(map="#{pageSession.valueMap}" key="noisy" value="#{pageSession.noisy}");
mapPut(map="#{pageSession.valueMap}" key="noisy" value="#{pageSession.noisy}");
mapPut(map="#{pageSession.valueMap}" key="dynamic" value="#{pageSession.dynamic}");
prepareSuccessfulMsg();
gf.updateEntity(endpoint="#{sessionScope.NOTIFICATION_CONFIG_URL}/notification-datadog-configure"
attrs="#{pageSession.valueMap}" convertToFalse="#{pageSession.convertToFalseList}");
/>
</sun:button>
</sun:panelGroup>
</facet>
</sun:title>
<sun:propertySheet id="propertySheet">
#include "/common/shared/configNameSection.inc"
<sun:propertySheetSection id="datadogNotifierProperties">
<sun:property id="enabledProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18ndn.notifier.datadog.configuration.enabledLabel}"
helpText="$resource{i18ndn.notifier.datadog.configuration.enabledLabelHelpText}">
<sun:checkbox id="enabledProp" selected="#{pageSession.enabledSelected}" selectedValue="true" />
</sun:property>
<sun:property id="noisy" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nn.notification.configuration.notifier.noisyLabel}"
helpText="$resource{i18nn.notification.configuration.notifier.noisyLabelHelpText}">
<sun:checkbox id="noisy" selected="#{pageSession.noisy}" selectedValue="true" />
</sun:property>
<sun:property id="dynamic" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18nn.notification.configuration.dynamic}"
helpText="$resource{i18nn.notification.configuration.notifier.dynamicHelp}">
<sun:checkbox id="dynamic" selected="#{pageSession.dynamic}" selectedValue="true" />
</sun:property>
<sun:property id="keyProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}"
label="$resource{i18ndn.notifier.datadog.configuration.keyLabel}"
helpText="$resource{i18ndn.notifier.datadog.configuration.keyLabelHelpText}">
<sun:textField id="keyField" columns="$int{75}" maxLength="255"
text="#{pageSession.valueMap['key']}" styleClass="required"
required="#{true}"/>
</sun:property>
</sun:propertySheetSection>
</sun:propertySheet>
</sun:form>
</define>
</composition>
|
{
"pile_set_name": "Github"
}
|
#ifndef BOOST_MPL_LIST_AUX_EMPTY_HPP_INCLUDED
#define BOOST_MPL_LIST_AUX_EMPTY_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
// $Revision: 49267 $
#include <boost/mpl/empty_fwd.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/list/aux_/tag.hpp>
namespace boost { namespace mpl {
template<>
struct empty_impl< aux::list_tag >
{
template< typename List > struct apply
: not_<typename List::size>
{
};
};
}}
#endif // BOOST_MPL_LIST_AUX_EMPTY_HPP_INCLUDED
|
{
"pile_set_name": "Github"
}
|
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright Jaap Suter 2003
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// *Preprocessed* version of the main "bitand.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct bitand_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< bitand_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< bitand_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct bitand_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct bitand_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct bitand_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct bitand_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
, typename N3 = na, typename N4 = na, typename N5 = na
>
struct bitand_
: bitand_< bitand_< bitand_< bitand_< N1,N2 >, N3>, N4>, N5>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
5
, bitand_
, ( N1, N2, N3, N4, N5 )
)
};
template<
typename N1, typename N2, typename N3, typename N4
>
struct bitand_< N1,N2,N3,N4,na >
: bitand_< bitand_< bitand_< N1,N2 >, N3>, N4>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, bitand_
, ( N1, N2, N3, N4, na )
)
};
template<
typename N1, typename N2, typename N3
>
struct bitand_< N1,N2,N3,na,na >
: bitand_< bitand_< N1,N2 >, N3>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, bitand_
, ( N1, N2, N3, na, na )
)
};
template<
typename N1, typename N2
>
struct bitand_< N1,N2,na,na,na >
: bitand_impl<
typename bitand_tag<N1>::type
, typename bitand_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, bitand_
, ( N1, N2, na, na, na )
)
};
BOOST_MPL_AUX_NA_SPEC2(2, 5, bitand_)
}}
namespace boost { namespace mpl {
template<>
struct bitand_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: integral_c<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
& BOOST_MPL_AUX_VALUE_WKND(N2)::value
)
>
{
};
};
}}
|
{
"pile_set_name": "Github"
}
|
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
int n;
cin>>n;
if(n<60)
cout<<"7";
else if(n<70)
cout<<"6";
else if(n<80)
cout<<"5";
else if(n<85)
cout<<"4";
else if(n<90)
cout<<"3";
else if(n<95)
cout<<"2";
else if(n<=100)
cout<<"1";
}
|
{
"pile_set_name": "Github"
}
|
/********************************************************************************
* Copyright (C) 2015 by Simon Wendsche *
* *
* This file is part of NormalmapGenerator. *
* *
* NormalmapGenerator is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* NormalmapGenerator is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* Sourcecode: https://github.com/Theverat/NormalmapGenerator *
********************************************************************************/
#ifndef SOBEL_H
#define SOBEL_H
#include <QImage>
#include "intensitymap.h"
class NormalmapGenerator
{
public:
enum Kernel {
SOBEL,
PREWITT
};
NormalmapGenerator(IntensityMap::Mode mode, double redMultiplier, double greenMultiplier,
double blueMultiplier, double alphaMultiplier);
QImage calculateNormalmap(const QImage& input, Kernel kernel, double strength = 2.0, bool invert = false,
bool tileable = true, bool keepLargeDetail = true,
int largeDetailScale = 25, double largeDetailHeight = 1.0);
const IntensityMap& getIntensityMap() const;
private:
IntensityMap intensity;
bool tileable;
double redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier;
IntensityMap::Mode mode;
int handleEdges(int iterator, int maxValue) const;
int mapComponent(double value) const;
QVector3D sobel(const double convolution_kernel[3][3], double strengthInv) const;
QVector3D prewitt(const double convolution_kernel[3][3], double strengthInv) const;
int blendSoftLight(int color1, int color2) const;
};
#endif // SOBEL_H
|
{
"pile_set_name": "Github"
}
|
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.content.model;
/**
* Model definition for OrdersCreateTestOrderResponse.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Content API for Shopping. For a detailed explanation
* see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class OrdersCreateTestOrderResponse extends com.google.api.client.json.GenericJson {
/**
* Identifies what kind of resource this is. Value: the fixed string
* "content#ordersCreateTestOrderResponse".
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String kind;
/**
* The ID of the newly created test order.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String orderId;
/**
* Identifies what kind of resource this is. Value: the fixed string
* "content#ordersCreateTestOrderResponse".
* @return value or {@code null} for none
*/
public java.lang.String getKind() {
return kind;
}
/**
* Identifies what kind of resource this is. Value: the fixed string
* "content#ordersCreateTestOrderResponse".
* @param kind kind or {@code null} for none
*/
public OrdersCreateTestOrderResponse setKind(java.lang.String kind) {
this.kind = kind;
return this;
}
/**
* The ID of the newly created test order.
* @return value or {@code null} for none
*/
public java.lang.String getOrderId() {
return orderId;
}
/**
* The ID of the newly created test order.
* @param orderId orderId or {@code null} for none
*/
public OrdersCreateTestOrderResponse setOrderId(java.lang.String orderId) {
this.orderId = orderId;
return this;
}
@Override
public OrdersCreateTestOrderResponse set(String fieldName, Object value) {
return (OrdersCreateTestOrderResponse) super.set(fieldName, value);
}
@Override
public OrdersCreateTestOrderResponse clone() {
return (OrdersCreateTestOrderResponse) super.clone();
}
}
|
{
"pile_set_name": "Github"
}
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestTraceAudit(AlertTestSuite):
alert_filename = "trace_audit"
alert_classname = 'TraceAudit'
# This event is the default positive event that will cause the
# alert to trigger
default_event = {
"_source": {
"category": "ptrace",
"summary": "Ptrace",
"hostname": "exhostname",
"tags": ["audisp-json","2.1.0", "audit"],
"details": {
"processname": "strace",
"originaluser": "randomjoe",
"auditkey": "strace",
}
}
}
# This alert is the expected result from running this task
default_alert = {
"category": "trace",
"severity": "WARNING",
"summary": "5 instances of Strace or Ptrace executed by randomjoe on exhostname",
"tags": ['audit'],
}
test_cases = []
test_cases.append(
PositiveAlertTestCase(
description="Positive test with default event and default alert expected",
events=AlertTestSuite.create_events(default_event, 5),
expected_alert=default_alert
)
)
events = AlertTestSuite.create_events(default_event, 5)
for event in events:
event['_source']['summary'] = 'Unknown'
test_cases.append(
PositiveAlertTestCase(
description="Positive test with events with a summary of 'Write: /etc/audit/rules.d/'",
events=events,
expected_alert=default_alert
)
)
events = AlertTestSuite.create_events(default_event, 5)
for event in events:
event['_source']['utctimestamp'] = AlertTestSuite.subtract_from_timestamp_lambda(date_timedelta={'minutes': 1})
event['_source']['receivedtimestamp'] = AlertTestSuite.subtract_from_timestamp_lambda(date_timedelta={'minutes': 1})
test_cases.append(
PositiveAlertTestCase(
description="Positive test with events a minute earlier",
events=events,
expected_alert=default_alert
)
)
events = AlertTestSuite.create_events(default_event, 5)
for event in events:
event['_source']['hostname'] = 'example.hostname.com'
test_cases.append(
NegativeAlertTestCase(
description="Negative test case with events with example hostname that matches exclusion of 'hostfilter'",
events=events,
)
)
events = AlertTestSuite.create_events(default_event, 5)
for event in events:
event['_source']['details']['originaluser'] = None
test_cases.append(
NegativeAlertTestCase(
description="Negative test case aggregation key excluded",
events=events,
)
)
events = AlertTestSuite.create_events(default_event, 5)
for event in events:
event['_source']['utctimestamp'] = AlertTestSuite.subtract_from_timestamp_lambda({'minutes': 15})
event['_source']['receivedtimestamp'] = AlertTestSuite.subtract_from_timestamp_lambda({'minutes': 15})
test_cases.append(
NegativeAlertTestCase(
description="Negative test case with old timestamp",
events=events,
)
)
|
{
"pile_set_name": "Github"
}
|
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'rootfolder.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class RadarrRootFolderAdapter extends TypeAdapter<RadarrRootFolder> {
@override
final int typeId = 5;
@override
RadarrRootFolder read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return RadarrRootFolder(
id: fields[0] as int,
path: fields[1] as String,
freeSpace: fields[2] as int,
);
}
@override
void write(BinaryWriter writer, RadarrRootFolder obj) {
writer
..writeByte(3)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.path)
..writeByte(2)
..write(obj.freeSpace);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RadarrRootFolderAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
|
{
"pile_set_name": "Github"
}
|
module.exports = {
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
"206": "Partial Content",
"207": "Multi-Status",
"208": "Already Reported",
"226": "IM Used",
"300": "Multiple Choices",
"301": "Moved Permanently",
"302": "Found",
"303": "See Other",
"304": "Not Modified",
"305": "Use Proxy",
"307": "Temporary Redirect",
"308": "Permanent Redirect",
"400": "Bad Request",
"401": "Unauthorized",
"402": "Payment Required",
"403": "Forbidden",
"404": "Not Found",
"405": "Method Not Allowed",
"406": "Not Acceptable",
"407": "Proxy Authentication Required",
"408": "Request Timeout",
"409": "Conflict",
"410": "Gone",
"411": "Length Required",
"412": "Precondition Failed",
"413": "Payload Too Large",
"414": "URI Too Long",
"415": "Unsupported Media Type",
"416": "Range Not Satisfiable",
"417": "Expectation Failed",
"418": "I'm a teapot",
"421": "Misdirected Request",
"422": "Unprocessable Entity",
"423": "Locked",
"424": "Failed Dependency",
"425": "Unordered Collection",
"426": "Upgrade Required",
"428": "Precondition Required",
"429": "Too Many Requests",
"431": "Request Header Fields Too Large",
"451": "Unavailable For Legal Reasons",
"500": "Internal Server Error",
"501": "Not Implemented",
"502": "Bad Gateway",
"503": "Service Unavailable",
"504": "Gateway Timeout",
"505": "HTTP Version Not Supported",
"506": "Variant Also Negotiates",
"507": "Insufficient Storage",
"508": "Loop Detected",
"509": "Bandwidth Limit Exceeded",
"510": "Not Extended",
"511": "Network Authentication Required"
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>claf.config.namespace — CLaF 0.2.0 documentation</title>
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/language_data.js"></script>
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/theme_overrides.css" type="text/css" />
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../../../index.html">
<img src="../../../_static/logo.png" class="logo" alt="Logo"/>
</a>
<div class="version">
0.2.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../contents/dataset_and_model.html">Dataset and Model</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contents/pretrained_vector.html">Pretrained Vector</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contents/tokens.html">Tokens</a></li>
</ul>
<p class="caption"><span class="caption-text">Package Reference</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../claf.config.html">config</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../claf.data.html">data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../claf.learn.html">learn</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../claf.metric.html">metric</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../claf.model.html">model</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../claf.modules.html">modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../claf.tokens.html">tokens</a></li>
</ul>
<p class="caption"><span class="caption-text">Reports</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../reports/glue.html">GLUE</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reports/historyqa.html">HistoryQA</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reports/korquad.html">KorQuAD</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reports/squad.html">SQuAD</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reports/wikisql.html">WikiSQL</a></li>
</ul>
<p class="caption"><span class="caption-text">Summary</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../summary/reading_comprehension.html">Reading Comprehension</a></li>
</ul>
<p class="caption"><span class="caption-text">Appendix</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../references.html">References</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../../index.html">CLaF</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../../index.html">Docs</a> »</li>
<li><a href="../../index.html">Module code</a> »</li>
<li>claf.config.namespace</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Source code for claf.config.namespace</h1><div class="highlight"><pre>
<span></span>
<span class="kn">import</span> <span class="nn">argparse</span>
<div class="viewcode-block" id="NestedNamespace"><a class="viewcode-back" href="../../../claf.config.html#claf.config.namespace.NestedNamespace">[docs]</a><span class="k">class</span> <span class="nc">NestedNamespace</span><span class="p">(</span><span class="n">argparse</span><span class="o">.</span><span class="n">Namespace</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Nested Namespace</span>
<span class="sd"> (Simple class used by default by parse_args() to create</span>
<span class="sd"> an object holding attributes and return it.)</span>
<span class="sd"> """</span>
<span class="k">def</span> <span class="nf">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="k">if</span> <span class="s2">"."</span> <span class="ow">in</span> <span class="n">name</span><span class="p">:</span>
<span class="n">group</span><span class="p">,</span> <span class="n">name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"."</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">namespace</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">group</span><span class="p">,</span> <span class="n">NestedNamespace</span><span class="p">())</span>
<span class="nb">setattr</span><span class="p">(</span><span class="n">namespace</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">[</span><span class="n">group</span><span class="p">]</span> <span class="o">=</span> <span class="n">namespace</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
<div class="viewcode-block" id="NestedNamespace.delete_unselected"><a class="viewcode-back" href="../../../claf.config.html#claf.config.namespace.NestedNamespace.delete_unselected">[docs]</a> <span class="k">def</span> <span class="nf">delete_unselected</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">namespace</span><span class="p">,</span> <span class="n">excepts</span><span class="o">=</span><span class="p">[]):</span>
<span class="n">delete_keys</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">namespace</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">:</span>
<span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">excepts</span><span class="p">:</span>
<span class="n">delete_keys</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">delete_keys</span><span class="p">:</span>
<span class="nb">delattr</span><span class="p">(</span><span class="n">namespace</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span></div>
<div class="viewcode-block" id="NestedNamespace.overwrite"><a class="viewcode-back" href="../../../claf.config.html#claf.config.namespace.NestedNamespace.overwrite">[docs]</a> <span class="k">def</span> <span class="nf">overwrite</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">config</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">_overwrite</span><span class="p">(</span><span class="n">namespace</span><span class="p">,</span> <span class="n">d</span><span class="p">):</span>
<span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">d</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="o">==</span> <span class="nb">dict</span><span class="p">:</span>
<span class="n">nested_namespace</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">namespace</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">nested_namespace</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">nested_namespace</span> <span class="o">=</span> <span class="n">NestedNamespace</span><span class="p">()</span>
<span class="n">nested_namespace</span><span class="o">.</span><span class="n">load_from_json</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
<span class="nb">setattr</span><span class="p">(</span><span class="n">namespace</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">nested_namespace</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">_overwrite</span><span class="p">(</span><span class="n">nested_namespace</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="nb">setattr</span><span class="p">(</span><span class="n">namespace</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
<span class="k">return</span> <span class="n">namespace</span>
<span class="k">return</span> <span class="n">_overwrite</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">config</span><span class="p">)</span></div>
<div class="viewcode-block" id="NestedNamespace.load_from_json"><a class="viewcode-back" href="../../../claf.config.html#claf.config.namespace.NestedNamespace.load_from_json">[docs]</a> <span class="k">def</span> <span class="nf">load_from_json</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dict_data</span><span class="p">):</span>
<span class="n">name_value_pairs</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">def</span> <span class="nf">make_key_value_pairs</span><span class="p">(</span><span class="n">d</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">""</span><span class="p">):</span>
<span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">d</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="o">==</span> <span class="nb">dict</span><span class="p">:</span>
<span class="n">next_prefix</span> <span class="o">=</span> <span class="n">k</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="o">!=</span> <span class="s2">""</span><span class="p">:</span>
<span class="n">next_prefix</span> <span class="o">=</span> <span class="n">f</span><span class="s2">"</span><span class="si">{prefix}</span><span class="s2">.</span><span class="si">{k}</span><span class="s2">"</span>
<span class="n">make_key_value_pairs</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="n">next_prefix</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">key_with_prefix</span> <span class="o">=</span> <span class="n">k</span>
<span class="k">if</span> <span class="n">prefix</span> <span class="o">!=</span> <span class="s2">""</span><span class="p">:</span>
<span class="n">key_with_prefix</span> <span class="o">=</span> <span class="n">f</span><span class="s2">"</span><span class="si">{prefix}</span><span class="s2">.</span><span class="si">{k}</span><span class="s2">"</span>
<span class="n">name_value_pairs</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">key_with_prefix</span><span class="p">,</span> <span class="n">v</span><span class="p">))</span>
<span class="n">make_key_value_pairs</span><span class="p">(</span><span class="n">dict_data</span><span class="p">)</span>
<span class="k">for</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="ow">in</span> <span class="n">name_value_pairs</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="fm">__setattr__</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span></div></div>
</pre></div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2019, Dongjun Lee
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
commandlinefu_id: 13251
translator:
weibo: ''
hide: true
command: |-
num_errs=`grep ERROR /var/log/syslog | tee >(cat >&2) | wc -l`
summary: |-
Save a result based on a command's output in a variable while printing the command output
|
{
"pile_set_name": "Github"
}
|
{ lib
, buildPythonPackage
, flake8
, nose2
, mock
, requests
, pyjwt
, fetchPypi
}:
buildPythonPackage rec {
pname = "globus-sdk";
version = "1.9.1";
src = fetchPypi {
inherit pname version;
sha256 = "883a862ddd17b0f4868ec55d6697a64c13d91c41b9fa5103198d2140053abac2";
};
checkPhase = ''
py.test tests
'';
# No tests in archive
doCheck = false;
checkInputs = [ flake8 nose2 mock ];
propagatedBuildInputs = [ requests pyjwt ];
meta = with lib; {
description = "A convenient Pythonic interface to Globus REST APIs, including the Transfer API and the Globus Auth API.";
homepage = "https://github.com/globus/globus-sdk-python";
license = licenses.asl20;
maintainers = with maintainers; [ ixxie ];
};
}
|
{
"pile_set_name": "Github"
}
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/white"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zm-6,0C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z" />
</vector>
|
{
"pile_set_name": "Github"
}
|
select LandMarks --sortby '_id' --output_columns 'point' --limit -1 --filter 'geo_in_rectangle(point, "-3x-5", "-4x-3")'
[
[
0,
0.0,
0.0
],
[
[
[
6
],
[
[
"point",
"WGS84GeoPoint"
]
],
[
"-3x-3"
],
[
"-3x-4"
],
[
"-3x-5"
],
[
"-4x-3"
],
[
"-4x-4"
],
[
"-4x-5"
]
]
]
]
|
{
"pile_set_name": "Github"
}
|
{****************************
* *
* Autor: Adrian M. Hanslik *
* Date 02. May 1999 *
* Version: 1.0 *
* *
****************************}
unit AMHLEDVecStd;
interface
uses
System.Types, System.UITypes, Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms, Dialogs;
type
TBorderStyle = (bsNone, bsStd, esPro);
TLEDStyle = (lsEllipse, lsRectangle);
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidOSX32)]
TAMHLEDVecStd = class(TGraphicControl)
private
{ Private-Deklarationen }
fBorderStyle: TBorderStyle;
fColorEffect: Boolean;
fColorEffectOff: TColor;
fColorEffectOn: TColor;
fColorLeftTop: TColor;
fColorRightBottom: TColor;
fLEDActive: Boolean;
fLEDColorOff: TColor;
fLEDColorOn: TColor;
fLEDStyle: TLEDStyle;
procedure SetBorderStyle(Value: TBorderStyle);
procedure SetColorEffect(Value: Boolean);
procedure SetColorEffectOff(Value: TColor);
procedure SetColorEffectOn(Value: TColor);
procedure SetColorLeftTop(Value: TColor);
procedure SetColorRightBottom(Value: TColor);
procedure SetLEDActive(Value: Boolean);
procedure SetLEDColorOff(Value: TColor);
procedure SetLEDColorOn(Value: TColor);
procedure SetLEDStyle(Value: TLEDStyle);
protected
{ Protected-Deklarationen }
procedure DrawEllipseBorder;
procedure DrawEllipseEffect;
procedure DrawRectangleBorder;
procedure DrawRectangleEffect;
procedure Paint; override;
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published-Deklarationen }
property BorderStyle: TBorderStyle read fBorderStyle write SetBorderStyle;
property ColorEffect: Boolean read fColorEffect write SetColorEffect;
property ColorEffectOff: TColor read fColorEffectOff write SetColorEffectOff;
property ColorEffectOn: TColor read fColorEffectOn write SetColorEffectOn;
property ColorLeftTop: TColor read fColorLeftTop write SetColorLeftTop;
property ColorRightBottom: TColor read fColorRightBottom write SetColorRightBottom;
property LEDActive: Boolean read fLEDActive write SetLEDActive;
property LEDColorOff: TColor read fLEDColorOff write SetLEDColorOff;
property LEDColorOn: TColor read fLEDColorOn write SetLEDColorOn;
property LEDStyle: TLEDStyle read fLEDStyle write SetLEDStyle;
property ShowHint;
property Visible;
property PopupMenu;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
procedure Register;
implementation
constructor TAMHLEDVecStd.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Height := 16;
Width := 16;
fBorderStyle := bsNone;
fColorEffect := True;
fColorEffectOff := clLtGray;
fColorEffectOn := clLtGray;
fColorLeftTop := clLtGray;
fColorRightBottom := clDkGray;
fLEDActive := True;
fLEDColorOn := clGreen;
fLEDColorOff := clRed;
fLEDStyle := lsEllipse;
end;
destructor TAMHLEDVecStd.Destroy;
begin
inherited Destroy;
end;
procedure TAMHLEDVecStd.DrawEllipseBorder;
begin
with Canvas do begin
if fBorderStyle = bsNone then begin
Pen.Color := Brush.Color;
Arc(0, 0, Width, Height, 0, 0, 0, 0)
end else if fBorderStyle = bsStd then begin
Pen.Color := clBlack;
Arc(0, 0, Width, Height, 0, 0, 0, 0)
end else begin
Pen.Color := fColorLeftTop;
Arc(0, 0, Width, Height, Width, 0, 0, Height);
Pen.Color := fColorRightBottom;
Arc(0, 0, Width, Height, 0, Height, Width, 0);
end;
end;
end;
procedure TAMHLEDVecStd.DrawEllipseEffect;
var
R: TRect;
begin
with Canvas do begin
if fColorEffect = True then begin
if fLEDActive = True then
Brush.Color := fColorEffectOn
else
Brush.Color := fColorEffectOff;
Pen.Color := Brush.Color;
R := GetClientRect;
InflateRect (R, -Width DIV 5, -Height DIV 5);
Chord(R.Left, R.Top, R.Right, R.Bottom,
Width DIV 2, Height DIV 5, Width DIV 5, Height DIV 2);
end;
end;
end;
procedure TAMHLEDVecStd.DrawRectangleBorder;
begin
with Canvas do begin
if fBorderStyle = bsNone then begin
Pen.Color := Brush.Color;
PolyLine([Point(0, 0), Point(Width - 1, 0),
Point(Width - 1, Height - 1), Point(0, Height - 1), Point(0, 0)]);
end else if fBorderStyle = bsStd then begin
Pen.Color := clBlack;
PolyLine([Point(0, 0), Point(Width - 1, 0),
Point(Width - 1, Height - 1), Point(0, Height - 1), Point(0, 0)]);
end else begin
Pen.Color := fColorLeftTop;
MoveTo(0, 0);
LineTo(Width, 0);
MoveTo(0, 0);
LineTo(0, Height);
Pen.Color := fColorRightBottom;
MoveTo(Width, Height);
LineTo(Width, 1);
MoveTo(Width, Height);
LineTo(1, Height);
end;
end;
end;
procedure TAMHLEDVecStd.DrawRectangleEffect;
var
R: TRect;
begin
with Canvas do begin
if fColorEffect = True then begin
if fLEDActive = True then
Brush.Color := fColorEffectOn
else
Brush.Color := fColorEffectOff;
Pen.Color := Brush.Color;
R := GetClientRect;
InflateRect (R, -Width DIV 5, -Height DIV 5);
Polygon([Point(R.Left, R.Top), Point(R.Right div 2, R.Top),
Point(R.Left, R.Bottom div 2)]);
end;
end;
end;
procedure TAMHLEDVecStd.Paint;
begin
inherited Paint;
with Canvas do begin
if fLEDActive = True then
Brush.Color := fLEDColorOn
else
Brush.Color := fLEDColorOff;
end;
case fLEDStyle of
lsEllipse: begin
Canvas.Ellipse(0, 0, Width, Height);
DrawEllipseBorder;
if fColorEffect <> False then
DrawEllipseEffect;
end;
lsRectangle: begin
Canvas.Rectangle(0, 0, Width, Height);
DrawRectangleBorder;
if fColorEffect <> False then
DrawRectangleEffect;
end;
end;
end;
procedure TAMHLEDVecStd.SetBorderStyle(Value: TBorderStyle);
begin
if Value <> fBorderStyle then
fBorderStyle := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetColorEffect(Value: boolean);
begin
if Value <> fColorEffect then
fColorEffect := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetColorEffectOff(Value: TColor);
begin
if Value <> fColorEffectOff then
fColorEffectOff := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetColorEffectOn(Value: TColor);
begin
if Value <> fColorEffectOn then
fColorEffectOn := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetColorLeftTop(Value: TColor);
begin
if Value <> fColorLeftTop then
fColorLeftTop := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetColorRightBottom(Value: TColor);
begin
if Value <> fColorRightBottom then
fColorRightBottom := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetLEDActive(Value: Boolean);
begin
if Value <> fLEDActive then
fLEDActive := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetLEDColorOff(Value: TColor);
begin
if Value <> fLEDColorOff then
fLEDColorOff := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetLEDColorOn(Value: TColor);
begin
if Value <> fLEDColorOn then
fLEDColorOn := Value;
Invalidate;
end;
procedure TAMHLEDVecStd.SetLEDStyle(Value: TLEDStyle);
begin
if Value <> fLEDStyle then
fLEDStyle := Value;
Invalidate;
end;
procedure Register;
begin
RegisterComponents('PyScripter Custom', [TAMHLEDVecStd]);
end;
end.
|
{
"pile_set_name": "Github"
}
|
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2018-2020 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/
#include <modules/webbrowser/webbrowserapp.h>
namespace inviwo {
WebBrowserApp::WebBrowserApp() = default;
void WebBrowserApp::OnBeforeCommandLineProcessing(const CefString&,
CefRefPtr<CefCommandLine> command_line) {
command_line->AppendSwitch("allow-file-access-from-files");
// Avoid pop-up when application starts:
// "Inviwo wants to use your confidential information stored in
// Chromium Safe Storage in your keychain"
// https://bitbucket.org/chromiumembedded/cef/issues/2692/mac-networkservice-allow-custom-service
command_line->AppendSwitch("use-mock-keychain");
}
} // namespace inviwo
|
{
"pile_set_name": "Github"
}
|
Kenyatta University
|
{
"pile_set_name": "Github"
}
|
StartChar: edieresis
Encoding: 235 235 131
Width: 478
Flags: W
LayerCount: 2
Fore
SplineSet
170 213 m 1,0,1
165 156 165 156 186.5 120 c 128,-1,2
208 84 208 84 256 84 c 0,3,4
285 84 285 84 307 99 c 128,-1,5
329 114 329 114 337 145 c 1,6,-1
448 145 l 1,7,8
431.994733377 74.9769585253 431.994733377 74.9769585253 376.5 31 c 0,9,10
319.714285714 -14 319.714285714 -14 247 -14 c 0,11,12
160.611940299 -14 160.611940299 -14 108 56.5 c 0,13,14
53.2907328892 129.810417929 53.2907328892 129.810417929 65 243 c 0,15,16
76.8592057762 361.592057762 76.8592057762 361.592057762 143 432 c 0,17,18
206.878787879 500 206.878787879 500 295 500 c 0,19,20
386 500 386 500 430 428.5 c 0,21,22
480.569536424 346.324503311 480.569536424 346.324503311 452 213 c 1,23,-1
170 213 l 1,0,1
286 403 m 0,24,25
243 403 243 403 215 371 c 128,-1,26
187 339 187 339 178 290 c 1,27,-1
361 290 l 1,28,29
368.355587808 367.233671988 368.355587808 367.233671988 325.5 393.5 c 0,30,31
310 403 310 403 286 403 c 0,24,25
163.5 632.5 m 128,-1,33
147 651 147 651 149.5 680.5 c 128,-1,34
152 710 152 710 172 729.5 c 128,-1,35
192 749 192 749 220.5 749 c 128,-1,36
249 749 249 749 265.5 729.5 c 128,-1,37
282 710 282 710 279.5 680.5 c 128,-1,38
277 651 277 651 256 632.5 c 128,-1,39
235 614 235 614 207.5 614 c 128,-1,32
180 614 180 614 163.5 632.5 c 128,-1,33
326 681 m 0,40,41
328 710 328 710 348.5 730 c 128,-1,42
369 750 369 750 397.5 750 c 128,-1,43
426 750 426 750 441.5 730 c 128,-1,44
457 710 457 710 454.5 681 c 128,-1,45
452 652 452 652 433 633.5 c 128,-1,46
414 615 414 615 385.5 615 c 128,-1,47
357 615 357 615 340 633.5 c 128,-1,48
323 652 323 652 326 681 c 0,40,41
EndSplineSet
EndChar
|
{
"pile_set_name": "Github"
}
|
/**
* This file is part of Aion-Lightning <aion-lightning.org>.
*
* Aion-Lightning is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Aion-Lightning is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License
* along with Aion-Lightning.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.aionemu.gameserver.utils.stats.enums;
/**
* @author ATracer
*/
public enum ATTACK_RANGE {
WARRIOR(0),
GLADIATOR(0),
TEMPLAR(0),
SCOUT(0),
ASSASSIN(0),
RANGER(0),
MAGE(0),
SORCERER(0),
SPIRIT_MASTER(0),
PRIEST(0),
CLERIC(0),
CHANTER(0),
ENGINEER(0),
RIDER(0),
GUNNER(0),
ARTIST(0),
PAINTER(0),
BARD(0);
private int value;
private ATTACK_RANGE(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/*============================================================
**
**
** Purpose: This class will encapsulate an unsigned long and
** provide an Object representation of it.
**
**
===========================================================*/
namespace System {
using System.Globalization;
using System;
using System.Runtime.InteropServices;
using System.Diagnostics.Contracts;
// Wrapper for unsigned 64 bit integers.
[Serializable]
[CLSCompliant(false), System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)]
[System.Runtime.InteropServices.ComVisible(true)]
public struct UInt64 : IComparable, IFormattable, IConvertible
, IComparable<UInt64>, IEquatable<UInt64>
{
private ulong m_value;
public const ulong MaxValue = (ulong) 0xffffffffffffffffL;
public const ulong MinValue = 0x0;
// Compares this object to another object, returning an integer that
// indicates the relationship.
// Returns a value less than zero if this object
// null is considered to be less than any instance.
// If object is not of type UInt64, this method throws an ArgumentException.
//
public int CompareTo(Object value) {
if (value == null) {
return 1;
}
if (value is UInt64) {
// Need to use compare because subtraction will wrap
// to positive for very large neg numbers, etc.
ulong i = (ulong)value;
if (m_value < i) return -1;
if (m_value > i) return 1;
return 0;
}
throw new ArgumentException (Environment.GetResourceString("Arg_MustBeUInt64"));
}
public int CompareTo(UInt64 value) {
// Need to use compare because subtraction will wrap
// to positive for very large neg numbers, etc.
if (m_value < value) return -1;
if (m_value > value) return 1;
return 0;
}
public override bool Equals(Object obj) {
if (!(obj is UInt64)) {
return false;
}
return m_value == ((UInt64)obj).m_value;
}
[System.Runtime.Versioning.NonVersionable]
public bool Equals(UInt64 obj)
{
return m_value == obj;
}
// The value of the lower 32 bits XORed with the uppper 32 bits.
public override int GetHashCode() {
return ((int)m_value) ^ (int)(m_value >> 32);
}
[System.Security.SecuritySafeCritical] // auto-generated
public override String ToString() {
Contract.Ensures(Contract.Result<String>() != null);
return Number.FormatUInt64(m_value, null, NumberFormatInfo.CurrentInfo);
}
[System.Security.SecuritySafeCritical] // auto-generated
public String ToString(IFormatProvider provider) {
Contract.Ensures(Contract.Result<String>() != null);
return Number.FormatUInt64(m_value, null, NumberFormatInfo.GetInstance(provider));
}
[System.Security.SecuritySafeCritical] // auto-generated
public String ToString(String format) {
Contract.Ensures(Contract.Result<String>() != null);
return Number.FormatUInt64(m_value, format, NumberFormatInfo.CurrentInfo);
}
[System.Security.SecuritySafeCritical] // auto-generated
public String ToString(String format, IFormatProvider provider) {
Contract.Ensures(Contract.Result<String>() != null);
return Number.FormatUInt64(m_value, format, NumberFormatInfo.GetInstance(provider));
}
[CLSCompliant(false)]
public static ulong Parse(String s) {
return Number.ParseUInt64(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo);
}
[CLSCompliant(false)]
public static ulong Parse(String s, NumberStyles style) {
NumberFormatInfo.ValidateParseStyleInteger(style);
return Number.ParseUInt64(s, style, NumberFormatInfo.CurrentInfo);
}
[CLSCompliant(false)]
public static ulong Parse(string s, IFormatProvider provider) {
return Number.ParseUInt64(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider));
}
[CLSCompliant(false)]
public static ulong Parse(String s, NumberStyles style, IFormatProvider provider) {
NumberFormatInfo.ValidateParseStyleInteger(style);
return Number.ParseUInt64(s, style, NumberFormatInfo.GetInstance(provider));
}
[CLSCompliant(false)]
public static Boolean TryParse(String s, out UInt64 result) {
return Number.TryParseUInt64(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);
}
[CLSCompliant(false)]
public static Boolean TryParse(String s, NumberStyles style, IFormatProvider provider, out UInt64 result) {
NumberFormatInfo.ValidateParseStyleInteger(style);
return Number.TryParseUInt64(s, style, NumberFormatInfo.GetInstance(provider), out result);
}
//
// IConvertible implementation
//
public TypeCode GetTypeCode() {
return TypeCode.UInt64;
}
/// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider) {
return Convert.ToBoolean(m_value);
}
/// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider) {
return Convert.ToChar(m_value);
}
/// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider) {
return Convert.ToSByte(m_value);
}
/// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider) {
return Convert.ToByte(m_value);
}
/// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider) {
return Convert.ToInt16(m_value);
}
/// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider) {
return Convert.ToUInt16(m_value);
}
/// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider) {
return Convert.ToInt32(m_value);
}
/// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider) {
return Convert.ToUInt32(m_value);
}
/// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider) {
return Convert.ToInt64(m_value);
}
/// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider) {
return m_value;
}
/// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider) {
return Convert.ToSingle(m_value);
}
/// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider) {
return Convert.ToDouble(m_value);
}
/// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider) {
return Convert.ToDecimal(m_value);
}
/// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider) {
throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "UInt64", "DateTime"));
}
/// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider) {
return Convert.DefaultToType((IConvertible)this, type, provider);
}
}
}
|
{
"pile_set_name": "Github"
}
|
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.app.plugin.core.analysis;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import ghidra.framework.options.*;
import ghidra.program.model.listing.Program;
import ghidra.util.exception.InvalidInputException;
class AnalysisOptionsEditor implements OptionsEditor, PropertyChangeListener {
private PropertyChangeListener listener;
private AnalysisPanel panel;
private Program program;
AnalysisOptionsEditor(Program program) {
this.program = program;
}
@Override
public void dispose() {
// stub
}
@Override
public void apply() throws InvalidInputException {
panel.applyChanges();
}
@Override
public void cancel() {
// don't care
}
@Override
public void reload() {
// this component doesn't respond to reloads
}
@Override
public JComponent getEditorComponent(Options options, EditorStateFactory editorStateFactory) {
panel = new AnalysisPanel(program, editorStateFactory, this);
return panel;
}
@Override
public void setOptionsPropertyChangeListener(PropertyChangeListener listener) {
this.listener = listener;
}
@Override
public void propertyChange(PropertyChangeEvent event) {
if (listener != null) {
listener.propertyChange(event);
}
}
}
|
{
"pile_set_name": "Github"
}
|
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>0</xorig>
<yorigin>16</yorigin>
<colkind>1</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>15</bbox_right>
<bbox_top>8</bbox_top>
<bbox_bottom>31</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>16</width>
<height>32</height>
<frames>
<frame index="0">images\spr_mapmario_tanooki_0.png</frame>
<frame index="1">images\spr_mapmario_tanooki_1.png</frame>
</frames>
</sprite>
|
{
"pile_set_name": "Github"
}
|
<!--
File isopub.ent produced by the XSL script characters.xsl
from input data in unicode.xml.
Please report any errors to David Carlisle
via the public W3C list www-math@w3.org.
The numeric character values assigned to each entity
(should) match the Unicode assignments in Unicode 4.0.
Entity names in this file are derived from files carrying the
following notice:
(C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!ENTITY blank "␣" ><!--=significant blank symbol -->
<!ENTITY blk12 "▒" ><!--=50% shaded block -->
<!ENTITY blk14 "░" ><!--=25% shaded block -->
<!ENTITY blk34 "▓" ><!--=75% shaded block -->
<!ENTITY block "█" ><!--=full block -->
<!ENTITY bull "•" ><!--/bullet B: =round bullet, filled -->
<!ENTITY caret "⁁" ><!--=caret (insertion mark) -->
<!ENTITY check "✓" ><!--/checkmark =tick, check mark -->
<!ENTITY cir "○" ><!--/circ B: =circle, open -->
<!ENTITY clubs "♣" ><!--/clubsuit =club suit symbol -->
<!ENTITY copysr "℗" ><!--=sound recording copyright sign -->
<!ENTITY cross "✗" ><!--=ballot cross -->
<!ENTITY Dagger "‡" ><!--/ddagger B: =double dagger -->
<!ENTITY dagger "†" ><!--/dagger B: =dagger -->
<!ENTITY dash "‐" ><!--=hyphen (true graphic) -->
<!ENTITY diams "♦" ><!--/diamondsuit =diamond suit symbol -->
<!ENTITY dlcrop "⌍" ><!--downward left crop mark -->
<!ENTITY drcrop "⌌" ><!--downward right crop mark -->
<!ENTITY dtri "▿" ><!--/triangledown =down triangle, open -->
<!ENTITY dtrif "▾" ><!--/blacktriangledown =dn tri, filled -->
<!ENTITY emsp " " ><!--=em space -->
<!ENTITY emsp13 " " ><!--=1/3-em space -->
<!ENTITY emsp14 " " ><!--=1/4-em space -->
<!ENTITY ensp " " ><!--=en space (1/2-em) -->
<!ENTITY female "♀" ><!--=female symbol -->
<!ENTITY ffilig "ffi" ><!--small ffi ligature -->
<!ENTITY fflig "ff" ><!--small ff ligature -->
<!ENTITY ffllig "ffl" ><!--small ffl ligature -->
<!ENTITY filig "fi" ><!--small fi ligature -->
<!ENTITY flat "♭" ><!--/flat =musical flat -->
<!ENTITY fllig "fl" ><!--small fl ligature -->
<!ENTITY frac13 "⅓" ><!--=fraction one-third -->
<!ENTITY frac15 "⅕" ><!--=fraction one-fifth -->
<!ENTITY frac16 "⅙" ><!--=fraction one-sixth -->
<!ENTITY frac23 "⅔" ><!--=fraction two-thirds -->
<!ENTITY frac25 "⅖" ><!--=fraction two-fifths -->
<!ENTITY frac35 "⅗" ><!--=fraction three-fifths -->
<!ENTITY frac45 "⅘" ><!--=fraction four-fifths -->
<!ENTITY frac56 "⅚" ><!--=fraction five-sixths -->
<!ENTITY hairsp " " ><!--=hair space -->
<!ENTITY hearts "♥" ><!--/heartsuit =heart suit symbol -->
<!ENTITY hellip "…" ><!--=ellipsis (horizontal) -->
<!ENTITY hybull "⁃" ><!--rectangle, filled (hyphen bullet) -->
<!ENTITY incare "℅" ><!--=in-care-of symbol -->
<!ENTITY ldquor "„" ><!--=rising dbl quote, left (low) -->
<!ENTITY lhblk "▄" ><!--=lower half block -->
<!ENTITY loz "◊" ><!--/lozenge - lozenge or total mark -->
<!ENTITY lozf "⧫" ><!--/blacklozenge - lozenge, filled -->
<!ENTITY lsquor "‚" ><!--=rising single quote, left (low) -->
<!ENTITY ltri "◃" ><!--/triangleleft B: l triangle, open -->
<!ENTITY ltrif "◂" ><!--/blacktriangleleft R: =l tri, filled -->
<!ENTITY male "♂" ><!--=male symbol -->
<!ENTITY malt "✠" ><!--/maltese =maltese cross -->
<!ENTITY marker "▮" ><!--=histogram marker -->
<!ENTITY mdash "—" ><!--=em dash -->
<!ENTITY mldr "…" ><!--em leader -->
<!ENTITY natur "♮" ><!--/natural - music natural -->
<!ENTITY ndash "–" ><!--=en dash -->
<!ENTITY nldr "‥" ><!--=double baseline dot (en leader) -->
<!ENTITY numsp " " ><!--=digit space (width of a number) -->
<!ENTITY phone "☎" ><!--=telephone symbol -->
<!ENTITY puncsp " " ><!--=punctuation space (width of comma) -->
<!ENTITY rdquor "”" ><!--rising dbl quote, right (high) -->
<!ENTITY rect "▭" ><!--=rectangle, open -->
<!ENTITY rsquor "’" ><!--rising single quote, right (high) -->
<!ENTITY rtri "▹" ><!--/triangleright B: r triangle, open -->
<!ENTITY rtrif "▸" ><!--/blacktriangleright R: =r tri, filled -->
<!ENTITY rx "℞" ><!--pharmaceutical prescription (Rx) -->
<!ENTITY sext "✶" ><!--sextile (6-pointed star) -->
<!ENTITY sharp "♯" ><!--/sharp =musical sharp -->
<!ENTITY spades "♠" ><!--/spadesuit =spades suit symbol -->
<!ENTITY squ "□" ><!--=square, open -->
<!ENTITY squf "▪" ><!--/blacksquare =sq bullet, filled -->
<!ENTITY star "☆" ><!--=star, open -->
<!ENTITY starf "★" ><!--/bigstar - star, filled -->
<!ENTITY target "⌖" ><!--register mark or target -->
<!ENTITY telrec "⌕" ><!--=telephone recorder symbol -->
<!ENTITY thinsp " " ><!--=thin space (1/6-em) -->
<!ENTITY uhblk "▀" ><!--=upper half block -->
<!ENTITY ulcrop "⌏" ><!--upward left crop mark -->
<!ENTITY urcrop "⌎" ><!--upward right crop mark -->
<!ENTITY utri "▵" ><!--/triangle =up triangle, open -->
<!ENTITY utrif "▴" ><!--/blacktriangle =up tri, filled -->
<!ENTITY vellip "⋮" ><!--vertical ellipsis -->
|
{
"pile_set_name": "Github"
}
|
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/qvm/gen/vec_mat_operations4.hpp>
|
{
"pile_set_name": "Github"
}
|
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="bookstore" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<properties>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
|
{
"pile_set_name": "Github"
}
|
using System;
using System.Threading.Tasks;
using NUnit.Framework;
namespace Salesforce.Force.Tests
{
public static class AssertEx
{
public static async Task ThrowsAsync<TException>(Func<Task> func) where TException : class
{
await ThrowsAsync<TException>(func, exception => { });
}
public static async Task ThrowsAsync<TException>(Func<Task> func, Action<TException> action) where TException : class
{
var exception = default(TException);
var expected = typeof(TException);
Type actual = null;
try
{
await func();
}
catch (Exception e)
{
exception = e as TException;
actual = e.GetType();
}
Assert.AreEqual(expected, actual);
action(exception);
}
}
}
|
{
"pile_set_name": "Github"
}
|
// (C) Copyright Edward Diener 2011-2015
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
#if !defined(BOOST_VMD_DETAIL_DATA_EQUAL_COMMON_HPP)
#define BOOST_VMD_DETAIL_DATA_EQUAL_COMMON_HPP
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/array/elem.hpp>
#include <boost/preprocessor/array/size.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/list/at.hpp>
#include <boost/preprocessor/list/size.hpp>
#include <boost/preprocessor/logical/bitand.hpp>
#include <boost/preprocessor/logical/bitor.hpp>
#include <boost/preprocessor/logical/compl.hpp>
#include <boost/preprocessor/punctuation/is_begin_parens.hpp>
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <boost/preprocessor/tuple/pop_front.hpp>
#include <boost/preprocessor/tuple/push_back.hpp>
#include <boost/preprocessor/tuple/replace.hpp>
#include <boost/preprocessor/tuple/size.hpp>
#include <boost/vmd/empty.hpp>
#include <boost/vmd/is_empty.hpp>
#include <boost/vmd/get_type.hpp>
#include <boost/vmd/detail/equal_type.hpp>
#define BOOST_VMD_DETAIL_DATA_EQUAL_IS_BOTH_COMPOSITE(vseq1,vseq2) \
BOOST_PP_BITAND \
( \
BOOST_PP_IS_BEGIN_PARENS(vseq1), \
BOOST_PP_IS_BEGIN_PARENS(vseq2) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_ARRAY(d,index,data) \
BOOST_PP_ARRAY_ELEM(index,data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_LIST(d,index,data) \
BOOST_PP_LIST_AT_D(d,data,index) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_SEQ(d,index,data) \
BOOST_PP_SEQ_ELEM(index,data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_TUPLE(d,index,data) \
BOOST_PP_TUPLE_ELEM(index,data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY(data) \
BOOST_PP_ARRAY_SIZE(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST(data) \
BOOST_PP_LIST_SIZE(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ(data) \
BOOST_PP_SEQ_SIZE(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE(data) \
BOOST_PP_TUPLE_SIZE(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY_D(d,data) \
BOOST_PP_ARRAY_SIZE(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST_D(d,data) \
BOOST_PP_LIST_SIZE_D(d,data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ_D(d,data) \
BOOST_PP_SEQ_SIZE(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE_D(d,data) \
BOOST_PP_TUPLE_SIZE(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM(d,index,data,vtype) \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_ARRAY), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_ARRAY, \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_LIST), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_LIST, \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_SEQ), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_SEQ, \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_TUPLE \
) \
) \
) \
(d,index,data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE(data,vtype) \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_ARRAY), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY, \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_LIST), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST, \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_SEQ), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ, \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE \
) \
) \
) \
(data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_D(d,data,vtype) \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_ARRAY), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY_D, \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_LIST), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST_D, \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_SEQ), \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ_D, \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE_D \
) \
) \
) \
(d,data) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_RESULT(state) \
BOOST_PP_TUPLE_ELEM(0,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_FIRST(state) \
BOOST_PP_TUPLE_ELEM(1,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SECOND(state) \
BOOST_PP_TUPLE_ELEM(2,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SIZE(state) \
BOOST_PP_TUPLE_ELEM(3,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_TYPE(state) \
BOOST_PP_TUPLE_ELEM(4,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state) \
BOOST_PP_TUPLE_ELEM(5,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state) \
BOOST_PP_TUPLE_ELEM(6,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state) \
BOOST_PP_BITAND \
( \
BOOST_PP_EQUAL_D \
( \
d, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SIZE(state) \
), \
BOOST_PP_COMPL(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state)) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state) \
BOOST_VMD_IS_EMPTY(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_INDEX(state) \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state), \
BOOST_VMD_EMPTY, \
BOOST_PP_TUPLE_ELEM \
) \
(0,BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_EMPTY(d,state) \
BOOST_PP_TUPLE_REPLACE_D \
( \
d, \
state, \
6, \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_REMOVE(d,state) \
BOOST_PP_TUPLE_REPLACE_D \
( \
d, \
state, \
6, \
BOOST_PP_TUPLE_POP_FRONT(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP(d,state) \
BOOST_PP_IIF \
( \
BOOST_PP_EQUAL_D(d,BOOST_PP_TUPLE_SIZE(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)),1), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_EMPTY, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_REMOVE \
) \
(d,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_CREATE(d,state) \
BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS \
( \
d, \
BOOST_PP_TUPLE_REPLACE_D \
( \
d, \
state, \
6, \
(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state)) \
) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_ADD(d,state) \
BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS \
( \
d, \
BOOST_PP_TUPLE_REPLACE_D \
( \
d, \
state, \
6, \
BOOST_PP_TUPLE_PUSH_BACK \
( \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state) \
) \
) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH(d,state) \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_CREATE, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_ADD \
) \
(d,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_INDEX(d,state) \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_INDEX, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX \
) \
(state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_FIRST_ELEMENT(d,state) \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM \
( \
d, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_INDEX(d,state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_FIRST(state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_TYPE(state) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_SECOND_ELEMENT(d,state) \
BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM \
( \
d, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_INDEX(d,state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SECOND(state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_TYPE(state) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_PRED(d,state) \
BOOST_PP_BITAND \
( \
BOOST_PP_EQUAL_D \
( \
d, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_RESULT(state), \
1 \
), \
BOOST_PP_BITOR \
( \
BOOST_PP_NOT_EQUAL_D \
( \
d, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SIZE(state) \
), \
BOOST_PP_COMPL \
( \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state) \
) \
) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS_NCP(d,state) \
BOOST_PP_TUPLE_REPLACE_D \
( \
d, \
state, \
5, \
BOOST_PP_INC(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state)) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS(d,state) \
BOOST_PP_IIF \
( \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state), \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP, \
BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS_NCP \
) \
(d,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_OP_FAILURE(d,state) \
BOOST_PP_TUPLE_REPLACE_D \
( \
d, \
state, \
0, \
0 \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_OP_RESULT(d,state,result) \
BOOST_PP_IIF \
( \
BOOST_PP_EQUAL_D(d,result,0), \
BOOST_VMD_DETAIL_DATA_EQUAL_OP_FAILURE, \
BOOST_PP_IIF \
( \
BOOST_PP_EQUAL_D(d,result,1), \
BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS, \
BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH \
) \
) \
(d,state) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_TYPE(emf,ems,vtype) \
BOOST_PP_BITAND \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE \
( \
BOOST_VMD_GET_TYPE(emf), \
vtype \
), \
BOOST_VMD_DETAIL_EQUAL_TYPE \
( \
BOOST_VMD_GET_TYPE(ems), \
vtype \
) \
) \
/**/
#define BOOST_VMD_DETAIL_DATA_EQUAL_TYPE_D(d,emf,ems,vtype) \
BOOST_PP_BITAND \
( \
BOOST_VMD_DETAIL_EQUAL_TYPE_D \
( \
d, \
BOOST_VMD_GET_TYPE(emf), \
vtype \
), \
BOOST_VMD_DETAIL_EQUAL_TYPE_D \
( \
d, \
BOOST_VMD_GET_TYPE(ems), \
vtype \
) \
) \
/**/
#endif /* BOOST_VMD_DETAIL_DATA_EQUAL_COMMON_HPP */
|
{
"pile_set_name": "Github"
}
|
-- GRIDS
UPDATE `sys_objects_grid` SET `field_order`='name' WHERE `object`='bx_developer_pgt_manage';
|
{
"pile_set_name": "Github"
}
|
error_virtual_type2.nit:40,17--27: Redef Error: expected `G[T]` bound type; got `G[Discrete]`.
|
{
"pile_set_name": "Github"
}
|
38--Tennis/38_Tennis_Tennis_38_683.jpg
7
587.882 158.477 52.8623 72.0175 0.999593
469.611 221.22 58.389 72.1749 0.999247
795.209 150.298 58.7067 73.1956 0.999175
335.093 149.094 66.4236 79.9599 0.99873
648.271 177.485 60.0408 76.474 0.998155
430.612 154.348 53.3208 65.1635 0.998148
177.092 147.801 63.183 76.4476 0.997766
|
{
"pile_set_name": "Github"
}
|
<div class="modal-header">
<div {{bind-attr class=":search-field-container view.isHighlight:search-highlight"}}>
<a class="close" data-dismiss="modal"><i class="icon-x"></i></a>
<label class="icon-search"></label>
{{view "form-fields/text-field" id="q" autocomplete="off" value=view.query name="search_query"}}
</div>
</div>
{{yield}}
|
{
"pile_set_name": "Github"
}
|
{
"reference_table": {
"column": {
"tinyint_ref": true,
"tinyint_without_padding": true,
"bigint_without_padding": true,
"integer_without_padding": true,
"smallint_with_big_padding": true,
"smallint_without_default": true,
"int_without_unsigned": true,
"int_unsigned": true,
"bigint_default_nullable": true,
"bigint_not_default_not_nullable": true,
"smallint_without_padding": true
},
"constraint": {
"tinyint_primary": true
}
},
"auto_increment_test": {
"column": {
"int_auto_increment_with_nullable": true,
"int_disabled_auto_increment": true
},
"constraint": {
"AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE": true
}
},
"test_table": {
"column": {
"smallint": true,
"tinyint": true,
"bigint": true,
"float": true,
"double": true,
"decimal": true,
"date": true,
"timestamp": true,
"datetime": true,
"longtext": true,
"mediumtext": true,
"varchar": true,
"mediumblob": true,
"blob": true,
"boolean": true,
"varbinary_rename": true
},
"index": {
"TEST_TABLE_TINYINT_BIGINT": true
},
"constraint": {
"TEST_TABLE_SMALLINT_BIGINT": true,
"TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF": true
}
}
}
|
{
"pile_set_name": "Github"
}
|
#version 150 core
uniform vec4 part_life;
vec4 part_time();
float part_uni();
bool born_ready() {
vec4 t = part_time();
float u = part_uni();
return t.z > u*part_life.z;
}
|
{
"pile_set_name": "Github"
}
|
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Full license terms provided in LICENSE.md file.
image_urls=(
http://farm3.static.flickr.com/2017/2496831224_221cd963a2.jpg
http://farm3.static.flickr.com/2582/4106642219_190bf0f817.jpg
http://farm4.static.flickr.com/3226/2719028129_9aa2e27675.jpg
)
image_names=(
gordon_setter.jpg
lifeboat.jpg
golden_retriever.jpg
)
image_folder=data/images
mkdir -p $image_folder
for i in ${!image_urls[@]}
do
echo ${image_urls[$i]}
echo ${image_names[$i]}
wget -O $image_folder/${image_names[$i]} ${image_urls[$i]}
done
|
{
"pile_set_name": "Github"
}
|
<?php
namespace GuzzleHttp\Exception;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\UriInterface;
/**
* HTTP Request exception
*/
class RequestException extends TransferException
{
/** @var RequestInterface */
private $request;
/** @var ResponseInterface */
private $response;
/** @var array */
private $handlerContext;
public function __construct(
$message,
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
array $handlerContext = []
) {
// Set the code of the exception if the response is set and not future.
$code = $response && !($response instanceof PromiseInterface)
? $response->getStatusCode()
: 0;
parent::__construct($message, $code, $previous);
$this->request = $request;
$this->response = $response;
$this->handlerContext = $handlerContext;
}
/**
* Wrap non-RequestExceptions with a RequestException
*
* @param RequestInterface $request
* @param \Exception $e
*
* @return RequestException
*/
public static function wrapException(RequestInterface $request, \Exception $e)
{
return $e instanceof RequestException
? $e
: new RequestException($e->getMessage(), $request, null, $e);
}
/**
* Factory method to create a new exception with a normalized error message
*
* @param RequestInterface $request Request
* @param ResponseInterface $response Response received
* @param \Exception $previous Previous exception
* @param array $ctx Optional handler context.
*
* @return self
*/
public static function create(
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
array $ctx = []
) {
if (!$response) {
return new self(
'Error completing request',
$request,
null,
$previous,
$ctx
);
}
$level = (int) floor($response->getStatusCode() / 100);
if ($level === 4) {
$label = 'Client error';
$className = ClientException::class;
} elseif ($level === 5) {
$label = 'Server error';
$className = ServerException::class;
} else {
$label = 'Unsuccessful request';
$className = __CLASS__;
}
$uri = $request->getUri();
$uri = static::obfuscateUri($uri);
// Client Error: `GET /` resulted in a `404 Not Found` response:
// <html> ... (truncated)
$message = sprintf(
'%s: `%s %s` resulted in a `%s %s` response',
$label,
$request->getMethod(),
$uri,
$response->getStatusCode(),
$response->getReasonPhrase()
);
$summary = static::getResponseBodySummary($response);
if ($summary !== null) {
$message .= ":\n{$summary}\n";
}
return new $className($message, $request, $response, $previous, $ctx);
}
/**
* Get a short summary of the response
*
* Will return `null` if the response is not printable.
*
* @param ResponseInterface $response
*
* @return string|null
*/
public static function getResponseBodySummary(ResponseInterface $response)
{
$body = $response->getBody();
if (!$body->isSeekable()) {
return null;
}
$size = $body->getSize();
if ($size === 0) {
return null;
}
$summary = $body->read(120);
$body->rewind();
if ($size > 120) {
$summary .= ' (truncated...)';
}
// Matches any printable character, including unicode characters:
// letters, marks, numbers, punctuation, spacing, and separators.
if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
return null;
}
return $summary;
}
/**
* Obfuscates URI if there is an username and a password present
*
* @param UriInterface $uri
*
* @return UriInterface
*/
private static function obfuscateUri($uri)
{
$userInfo = $uri->getUserInfo();
if (false !== ($pos = strpos($userInfo, ':'))) {
return $uri->withUserInfo(substr($userInfo, 0, $pos), '***');
}
return $uri;
}
/**
* Get the request that caused the exception
*
* @return RequestInterface
*/
public function getRequest()
{
return $this->request;
}
/**
* Get the associated response
*
* @return ResponseInterface|null
*/
public function getResponse()
{
return $this->response;
}
/**
* Check if a response was received
*
* @return bool
*/
public function hasResponse()
{
return $this->response !== null;
}
/**
* Get contextual information about the error from the underlying handler.
*
* The contents of this array will vary depending on which handler you are
* using. It may also be just an empty array. Relying on this data will
* couple you to a specific handler, but can give more debug information
* when needed.
*
* @return array
*/
public function getHandlerContext()
{
return $this->handlerContext;
}
}
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process-archive name="fulltext-tasklist">
<process-engine>default</process-engine>
<properties>
<property name="isDeleteUponUndeploy">true</property>
<property name="isScanForProcessDefinitions">true</property>
</properties>
</process-archive>
</process-application>
|
{
"pile_set_name": "Github"
}
|
package volumetypes
import (
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
// CreateOptsBuilder allows extensions to add additional parameters to the
// Create request.
type CreateOptsBuilder interface {
ToVolumeTypeCreateMap() (map[string]interface{}, error)
}
// CreateOpts are options for creating a volume type.
type CreateOpts struct {
// See VolumeType.
ExtraSpecs map[string]interface{} `json:"extra_specs,omitempty"`
// See VolumeType.
Name string `json:"name,omitempty"`
}
// ToVolumeTypeCreateMap casts a CreateOpts struct to a map.
func (opts CreateOpts) ToVolumeTypeCreateMap() (map[string]interface{}, error) {
return gophercloud.BuildRequestBody(opts, "volume_type")
}
// Create will create a new volume. To extract the created volume type object,
// call the Extract method on the CreateResult.
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToVolumeTypeCreateMap()
if err != nil {
r.Err = err
return
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200, 201},
})
return
}
// Delete will delete the volume type with the provided ID.
func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
return
}
// Get will retrieve the volume type with the provided ID. To extract the volume
// type from the result, call the Extract method on the GetResult.
func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
return
}
// List returns all volume types.
func List(client *gophercloud.ServiceClient) pagination.Pager {
return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page {
return VolumeTypePage{pagination.SinglePageBase(r)}
})
}
|
{
"pile_set_name": "Github"
}
|
var fs = require("fs");
exports.FILES = [
"../lib/utils.js",
"../lib/ast.js",
"../lib/parse.js",
"../lib/transform.js",
"../lib/scope.js",
"../lib/output.js",
"../lib/compress.js",
"../lib/sourcemap.js",
"../lib/mozilla-ast.js",
"../lib/propmangle.js",
"../lib/minify.js",
"./exports.js",
].map(function(file) {
return require.resolve(file);
});
new Function("MOZ_SourceMap", "exports", function() {
var code = exports.FILES.map(function(file) {
return fs.readFileSync(file, "utf8");
});
code.push("exports.describe_ast = " + describe_ast.toString());
return code.join("\n\n");
}())(require("source-map"), exports);
function describe_ast() {
var out = OutputStream({ beautify: true });
function doitem(ctor) {
out.print("AST_" + ctor.TYPE);
var props = ctor.SELF_PROPS.filter(function(prop) {
return !/^\$/.test(prop);
});
if (props.length > 0) {
out.space();
out.with_parens(function() {
props.forEach(function(prop, i) {
if (i) out.space();
out.print(prop);
});
});
}
if (ctor.documentation) {
out.space();
out.print_string(ctor.documentation);
}
if (ctor.SUBCLASSES.length > 0) {
out.space();
out.with_block(function() {
ctor.SUBCLASSES.forEach(function(ctor, i) {
out.indent();
doitem(ctor);
out.newline();
});
});
}
};
doitem(AST_Node);
return out + "\n";
}
function infer_options(options) {
var result = exports.minify("", options);
return result.error && result.error.defs;
}
exports.default_options = function() {
var defs = {};
Object.keys(infer_options({ 0: 0 })).forEach(function(component) {
var options = {};
options[component] = { 0: 0 };
if (options = infer_options(options)) {
defs[component] = options;
}
});
return defs;
};
|
{
"pile_set_name": "Github"
}
|
{
"parent": "item/handheld",
"textures": {
"layer0": "thebetweenlands:items/octine_axe_corrodible"
},
"overrides": [
{ "predicate": { "corrosion": 0.0 }, "model": "thebetweenlands:item/octine_axe_corrosion_0" },
{ "predicate": { "corrosion": 1.0 }, "model": "thebetweenlands:item/octine_axe_corrosion_1" },
{ "predicate": { "corrosion": 2.0 }, "model": "thebetweenlands:item/octine_axe_corrosion_2" },
{ "predicate": { "corrosion": 3.0 }, "model": "thebetweenlands:item/octine_axe_corrosion_3" },
{ "predicate": { "corrosion": 4.0 }, "model": "thebetweenlands:item/octine_axe_corrosion_4" },
{ "predicate": { "corrosion": 5.0 }, "model": "thebetweenlands:item/octine_axe_corrosion_5" }
]
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityServer4.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace IdentityServerHost.Quickstart.UI
{
[SecurityHeaders]
[AllowAnonymous]
public class HomeController : Controller
{
private readonly IIdentityServerInteractionService _interaction;
private readonly IWebHostEnvironment _environment;
private readonly ILogger _logger;
public HomeController(IIdentityServerInteractionService interaction, IWebHostEnvironment environment, ILogger<HomeController> logger)
{
_interaction = interaction;
_environment = environment;
_logger = logger;
}
public IActionResult Index()
{
if (_environment.IsDevelopment())
{
// only show in development
return View();
}
_logger.LogInformation("Homepage is disabled in production. Returning 404.");
return NotFound();
}
/// <summary>
/// Shows the error page
/// </summary>
public async Task<IActionResult> Error(string errorId)
{
var vm = new ErrorViewModel();
// retrieve error details from identityserver
var message = await _interaction.GetErrorContextAsync(errorId);
if (message != null)
{
vm.Error = message;
if (!_environment.IsDevelopment())
{
// only show in development
message.ErrorDescription = null;
}
}
return View("Error", vm);
}
}
}
|
{
"pile_set_name": "Github"
}
|
// This file was procedurally generated from the following sources:
// - src/arguments/args-trailing-comma-spread-operator.case
// - src/arguments/default/gen-func-decl.template
/*---
description: A trailing comma should not increase the arguments.length, using spread args (generator function declaration)
esid: sec-arguments-exotic-objects
features: [generators]
flags: [generated]
info: |
9.4.4 Arguments Exotic Objects
Most ECMAScript functions make an arguments object available to their code. Depending upon the
characteristics of the function definition, its arguments object is either an ordinary object
or an arguments exotic object.
Trailing comma in the arguments list
Left-Hand-Side Expressions
Arguments :
( )
( ArgumentList )
( ArgumentList , )
ArgumentList :
AssignmentExpression
... AssignmentExpression
ArgumentList , AssignmentExpression
ArgumentList , ... AssignmentExpression
---*/
var arr = [2, 3];
var callCount = 0;
// Stores a reference `ref` for case evaluation
function* ref() {
assert.sameValue(arguments.length, 4);
assert.sameValue(arguments[0], 42);
assert.sameValue(arguments[1], 1);
assert.sameValue(arguments[2], 2);
assert.sameValue(arguments[3], 3);
callCount = callCount + 1;
}
ref(42, ...[1], ...arr,).next();
assert.sameValue(callCount, 1, 'generator function invoked exactly once');
|
{
"pile_set_name": "Github"
}
|
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX ex: <http://example.org/things#>
SELECT ?name ?emp
WHERE { ?x foaf:name ?name ;
ex:empId ?emp
}
ORDER BY ?name DESC(?emp)
|
{
"pile_set_name": "Github"
}
|
package ephemeral
import (
"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/protocol/gregor1"
"github.com/keybase/client/go/protocol/keybase1"
)
type EphemeralKeyer interface {
Fetch(mctx libkb.MetaContext, teamID keybase1.TeamID, generation keybase1.EkGeneration, contentCtime *gregor1.Time) (keybase1.TeamEphemeralKeyBoxed, error)
Unbox(mctx libkb.MetaContext, boxed keybase1.TeamEphemeralKeyBoxed, contentCtime *gregor1.Time) (keybase1.TeamEphemeralKey, error)
Type() keybase1.TeamEphemeralKeyType
}
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright 1999-2011 Alibaba Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.cobar.client.router.rules;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import com.alibaba.cobar.client.router.rules.ibatis.AbstractIBatisOrientedRule;
/**
* vertical partitioning oriented rule that matches against entity/table type.<br>
*
* @author fujohnwang
* @param <F>, the fact type
* @param <T>, the action result type
* @see AbstractIBatisOrientedRule
*/
public abstract class AbstractEntityTypeRule<F, T> implements IRoutingRule<F, T> {
private String typePatten; // when
private String action; // then, it's a more generic expression, although for us, a String[] is preferable.
public AbstractEntityTypeRule(String pattern, String action) {
Validate.notEmpty(StringUtils.trim(pattern));
Validate.notEmpty(StringUtils.trim(action));
this.typePatten = pattern;
this.action = action;
}
public void setTypePattern(String leftExpression) {
this.typePatten = leftExpression;
}
public String getTypePattern() {
return typePatten;
}
public void setAction(String rightExpression) {
this.action = rightExpression;
}
public String getAction() {
return action;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((action == null) ? 0 : action.hashCode());
result = prime * result + ((typePatten == null) ? 0 : typePatten.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AbstractEntityTypeRule other = (AbstractEntityTypeRule) obj;
if (action == null) {
if (other.action != null)
return false;
} else if (!action.equals(other.action))
return false;
if (typePatten == null) {
if (other.typePatten != null)
return false;
} else if (!typePatten.equals(other.typePatten))
return false;
return true;
}
}
|
{
"pile_set_name": "Github"
}
|
'use strict';
const BooleanPrompt = require('../types/boolean');
class TogglePrompt extends BooleanPrompt {
async initialize() {
await super.initialize();
this.value = this.initial = !!this.options.initial;
this.disabled = this.options.disabled || 'no';
this.enabled = this.options.enabled || 'yes';
await this.render();
}
reset() {
this.value = this.initial;
this.render();
}
delete() {
this.alert();
}
toggle() {
this.value = !this.value;
this.render();
}
enable() {
if (this.value === true) return this.alert();
this.value = true;
this.render();
}
disable() {
if (this.value === false) return this.alert();
this.value = false;
this.render();
}
up() {
this.toggle();
}
down() {
this.toggle();
}
right() {
this.toggle();
}
left() {
this.toggle();
}
next() {
this.toggle();
}
prev() {
this.toggle();
}
dispatch(ch = '', key) {
switch (ch.toLowerCase()) {
case ' ':
return this.toggle();
case '1':
case 'y':
case 't':
return this.enable();
case '0':
case 'n':
case 'f':
return this.disable();
default: {
return this.alert();
}
}
}
format() {
let active = str => this.styles.primary.underline(str);
let value = [
this.value ? this.disabled : active(this.disabled),
this.value ? active(this.enabled) : this.enabled
];
return value.join(this.styles.muted(' / '));
}
async render() {
let { size } = this.state;
let header = await this.header();
let prefix = await this.prefix();
let separator = await this.separator();
let message = await this.message();
let output = await this.format();
let help = (await this.error()) || (await this.hint());
let footer = await this.footer();
let prompt = [prefix, message, separator, output].join(' ');
this.state.prompt = prompt;
if (help && !prompt.includes(help)) prompt += ' ' + help;
this.clear(size);
this.write([header, prompt, footer].filter(Boolean).join('\n'));
this.write(this.margin[2]);
this.restore();
}
}
module.exports = TogglePrompt;
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{fe21032a-ae41-4d20-9ebf-c7c66079836a}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{bf483b80-fa3d-400f-b144-ae8153e9fb44}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Array.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Handler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\JSONException.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Object.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ParseHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Parser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ParserImpl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\pdjson.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\PrintHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Query.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Stringifier.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Template.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\TemplateCache.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Poco\JSON\Array.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\Handler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\JSON.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\JSONException.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\Object.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\ParseHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\Parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\ParserImpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\pdjson.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\PrintHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\Query.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\Stringifier.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\Template.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\JSON\TemplateCache.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" href="images/favicon.png">
<title>Grids</title>
<!--Core CSS -->
<link href="bs3/css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-reset.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet" />
<!-- Custom styles for this template -->
<link href="css/style.css" rel="stylesheet">
<link href="css/style-responsive.css" rel="stylesheet" />
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]>
<script src="js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body class="fixed-width">
<section id="container" >
<!--header start-->
<header class="header fixed-top clearfix">
<!--logo start-->
<div class="brand">
<a href="index.html" class="logo">
<img src="images/logo.png" alt="">
</a>
<div class="sidebar-toggle-box">
<div class="fa fa-bars"></div>
</div>
</div>
<!--logo end-->
<div class="nav notify-row" id="top_menu">
<!-- notification start -->
<ul class="nav top-menu">
<!-- settings start -->
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<i class="fa fa-tasks"></i>
<span class="badge bg-success">8</span>
</a>
<ul class="dropdown-menu extended tasks-bar">
<li>
<p class="">You have 8 pending tasks</p>
</li>
<li>
<a href="#">
<div class="task-info clearfix">
<div class="desc pull-left">
<h5>Target Sell</h5>
<p>25% , Deadline 12 June’13</p>
</div>
<span class="notification-pie-chart pull-right" data-percent="45">
<span class="percent"></span>
</span>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info clearfix">
<div class="desc pull-left">
<h5>Product Delivery</h5>
<p>45% , Deadline 12 June’13</p>
</div>
<span class="notification-pie-chart pull-right" data-percent="78">
<span class="percent"></span>
</span>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info clearfix">
<div class="desc pull-left">
<h5>Payment collection</h5>
<p>87% , Deadline 12 June’13</p>
</div>
<span class="notification-pie-chart pull-right" data-percent="60">
<span class="percent"></span>
</span>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info clearfix">
<div class="desc pull-left">
<h5>Target Sell</h5>
<p>33% , Deadline 12 June’13</p>
</div>
<span class="notification-pie-chart pull-right" data-percent="90">
<span class="percent"></span>
</span>
</div>
</a>
</li>
<li class="external">
<a href="#">See All Tasks</a>
</li>
</ul>
</li>
<!-- settings end -->
<!-- inbox dropdown start-->
<li id="header_inbox_bar" class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<i class="fa fa-envelope-o"></i>
<span class="badge bg-important">4</span>
</a>
<ul class="dropdown-menu extended inbox">
<li>
<p class="red">You have 4 Mails</p>
</li>
<li>
<a href="#">
<span class="photo"><img alt="avatar" src="images/avatar-mini.jpg"></span>
<span class="subject">
<span class="from">Jonathan Smith</span>
<span class="time">Just now</span>
</span>
<span class="message">
Hello, this is an example msg.
</span>
</a>
</li>
<li>
<a href="#">
<span class="photo"><img alt="avatar" src="images/avatar-mini-2.jpg"></span>
<span class="subject">
<span class="from">Jane Doe</span>
<span class="time">2 min ago</span>
</span>
<span class="message">
Nice admin template
</span>
</a>
</li>
<li>
<a href="#">
<span class="photo"><img alt="avatar" src="images/avatar-mini-3.jpg"></span>
<span class="subject">
<span class="from">Tasi sam</span>
<span class="time">2 days ago</span>
</span>
<span class="message">
This is an example msg.
</span>
</a>
</li>
<li>
<a href="#">
<span class="photo"><img alt="avatar" src="images/avatar-mini.jpg"></span>
<span class="subject">
<span class="from">Mr. Perfect</span>
<span class="time">2 hour ago</span>
</span>
<span class="message">
Hi there, its a test
</span>
</a>
</li>
<li>
<a href="#">See all messages</a>
</li>
</ul>
</li>
<!-- inbox dropdown end -->
<!-- notification dropdown start-->
<li id="header_notification_bar" class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<i class="fa fa-bell-o"></i>
<span class="badge bg-warning">3</span>
</a>
<ul class="dropdown-menu extended notification">
<li>
<p>Notifications</p>
</li>
<li>
<div class="alert alert-info clearfix">
<span class="alert-icon"><i class="fa fa-bolt"></i></span>
<div class="noti-info">
<a href="#"> Server #1 overloaded.</a>
</div>
</div>
</li>
<li>
<div class="alert alert-danger clearfix">
<span class="alert-icon"><i class="fa fa-bolt"></i></span>
<div class="noti-info">
<a href="#"> Server #2 overloaded.</a>
</div>
</div>
</li>
<li>
<div class="alert alert-success clearfix">
<span class="alert-icon"><i class="fa fa-bolt"></i></span>
<div class="noti-info">
<a href="#"> Server #3 overloaded.</a>
</div>
</div>
</li>
</ul>
</li>
<!-- notification dropdown end -->
</ul>
<!-- notification end -->
</div>
<div class="top-nav clearfix">
<!--search & user info start-->
<ul class="nav pull-right top-menu">
<li>
<input type="text" class="form-control search" placeholder=" Search">
</li>
<!-- user login dropdown start-->
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<img alt="" src="images/avatar1_small.jpg">
<span class="username">John Doe</span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu extended logout">
<li><a href="#"><i class=" fa fa-suitcase"></i>Profile</a></li>
<li><a href="#"><i class="fa fa-cog"></i> Settings</a></li>
<li><a href="login.html"><i class="fa fa-key"></i> Log Out</a></li>
</ul>
</li>
<!-- user login dropdown end -->
</ul>
<!--search & user info end-->
</div>
</header>
<!--header end-->
<aside>
<div id="sidebar" class="nav-collapse">
<!-- sidebar menu start--> <div class="leftside-navigation">
<ul class="sidebar-menu" id="nav-accordion">
<li>
<a href="index.html">
<i class="fa fa-dashboard"></i>
<span>Dashboard</span>
</a>
</li>
<li class="sub-menu">
<a href="javascript:;">
<i class="fa fa-laptop"></i>
<span>Layouts</span>
</a>
<ul class="sub">
<li><a href="boxed_page.html">Boxed Page</a></li>
<li><a href="horizontal_menu.html">Horizontal Menu</a></li>
<li><a href="language_switch.html">Language Switch Bar</a></li>
</ul>
</li>
<li class="sub-menu">
<a href="javascript:;" class="active">
<i class="fa fa-book"></i>
<span>UI Elements</span>
</a>
<ul class="sub">
<li><a href="general.html">General</a></li>
<li><a href="buttons.html">Buttons</a></li>
<li><a href="typography.html">Typography</a></li>
<li><a href="widget.html">Widget</a></li>
<li><a href="slider.html">Slider</a></li>
<li><a href="tree_view.html">Tree View</a></li>
<li><a href="nestable.html">Nestable</a></li>
<li class="active"><a href="grids.html">Grids</a></li>
<li><a href="calendar.html">Calender</a></li>
<li><a href="draggable_portlet.html">Draggable Portlet</a></li>
</ul>
</li>
<li>
<a href="fontawesome.html">
<i class="fa fa-bullhorn"></i>
<span>Fontawesome </span>
</a>
</li>
<li class="sub-menu">
<a href="javascript:;">
<i class="fa fa-th"></i>
<span>Data Tables</span>
</a>
<ul class="sub">
<li><a href="basic_table.html">Basic Table</a></li>
<li><a href="responsive_table.html">Responsive Table</a></li>
<li><a href="dynamic_table.html">Dynamic Table</a></li>
<li><a href="editable_table.html">Editable Table</a></li>
</ul>
</li>
<li class="sub-menu">
<a href="javascript:;">
<i class="fa fa-tasks"></i>
<span>Form Components</span>
</a>
<ul class="sub">
<li><a href="form_component.html">Form Elements</a></li>
<li><a href="advanced_form.html">Advanced Components</a></li>
<li><a href="form_wizard.html">Form Wizard</a></li>
<li><a href="form_validation.html">Form Validation</a></li>
<li><a href="file_upload.html">Muliple File Upload</a></li>
<li><a href="dropzone.html">Dropzone</a></li>
<li><a href="inline_editor.html">Inline Editor</a></li>
</ul>
</li>
<li class="sub-menu">
<a href="javascript:;">
<i class="fa fa-envelope"></i>
<span>Mail </span>
</a>
<ul class="sub">
<li><a href="mail.html">Inbox</a></li>
<li><a href="mail_compose.html">Compose Mail</a></li>
<li><a href="mail_view.html">View Mail</a></li>
</ul>
</li>
<li class="sub-menu">
<a href="javascript:;">
<i class=" fa fa-bar-chart-o"></i>
<span>Charts</span>
</a>
<ul class="sub">
<li><a href="morris.html">Morris</a></li>
<li><a href="chartjs.html">Chartjs</a></li>
<li><a href="flot_chart.html">Flot Charts</a></li>
<li><a href="c3_chart.html">C3 Chart</a></li>
</ul>
</li>
<li class="sub-menu">
<a href="javascript:;">
<i class=" fa fa-bar-chart-o"></i>
<span>Maps</span>
</a>
<ul class="sub">
<li><a href="google_map.html">Google Map</a></li>
<li><a href="vector_map.html">Vector Map</a></li>
</ul>
</li>
<li class="sub-menu">
<a href="javascript:;">
<i class="fa fa-glass"></i>
<span>Extra</span>
</a>
<ul class="sub">
<li><a href="blank.html">Blank Page</a></li>
<li><a href="lock_screen.html">Lock Screen</a></li>
<li><a href="profile.html">Profile</a></li>
<li><a href="invoice.html">Invoice</a></li>
<li><a href="pricing_table.html">Pricing Table</a></li>
<li><a href="timeline.html">Timeline</a></li>
<li><a href="gallery.html">Media Gallery</a></li><li><a href="404.html">404 Error</a></li>
<li><a href="500.html">500 Error</a></li>
<li><a href="registration.html">Registration</a></li>
</ul>
</li>
<li>
<a href="login.html">
<i class="fa fa-user"></i>
<span>Login Page</span>
</a>
</li>
</ul></div>
<!-- sidebar menu end-->
</div>
</aside>
<!--sidebar end-->
<!--main content start-->
<section id="main-content">
<section class=" wrapper site-min-height">
<div class="row">
<div class="col-lg-12"> <p class="hd-title">Base on Bootstrap grid system.</div>
<div class="col-lg-12">
<section class="panel">
<div class="panel-body">col-lg-12</div>
</section>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<section class="panel">
<div class="panel-body">col-lg-6</div>
</section>
</div>
<div class="col-lg-6">
<section class="panel">
<div class="panel-body">col-lg-6</div>
</section>
</div>
</div>
<div class="row">
<div class="col-lg-4">
<section class="panel">
<div class="panel-body">col-lg-4</div>
</section>
</div>
<div class="col-lg-4">
<section class="panel">
<div class="panel-body">col-lg-4</div>
</section>
</div>
<div class="col-lg-4">
<section class="panel">
<div class="panel-body">col-lg-4</div>
</section>
</div>
</div>
<div class="row">
<div class="col-lg-3">
<section class="panel">
<div class="panel-body">col-lg-3</div>
</section>
</div>
<div class="col-lg-3">
<section class="panel">
<div class="panel-body">col-lg-3</div>
</section>
</div>
<div class="col-lg-3">
<section class="panel">
<div class="panel-body">col-lg-3</div>
</section>
</div>
<div class="col-lg-3">
<section class="panel">
<div class="panel-body">col-lg-3</div>
</section>
</div>
</div>
<div class="row">
<div class="col-lg-2">
<section class="panel">
<div class="panel-body">col-lg-2</div>
</section>
</div>
<div class="col-lg-2">
<section class="panel">
<div class="panel-body">col-lg-2</div>
</section>
</div>
<div class="col-lg-2">
<section class="panel">
<div class="panel-body">col-lg-2</div>
</section>
</div>
<div class="col-lg-2">
<section class="panel">
<div class="panel-body">col-lg-2</div>
</section>
</div>
<div class="col-lg-2">
<section class="panel">
<div class="panel-body">col-lg-2</div>
</section>
</div>
<div class="col-lg-2">
<section class="panel">
<div class="panel-body">col-lg-2</div>
</section>
</div>
</div>
<div class="row">
<div class="col-lg-12"> <p class="hd-title">Mobile, tablet, and desktop</p> </div>
</div>
<div class="row">
<div class="col-lg-4">
<div class="row">
<div class="col-xs-6">
<section class="panel">
<div class="panel-body">col-xs-6</div>
</section>
</div>
<div class="col-xs-6">
<section class="panel">
<div class="panel-body">col-xs-6</div>
</section>
</div>
</div>
</div>
<div class="col-lg-8">
<section class="panel">
<div class="panel-body">col-lg-8</div>
</section>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="row">
<div class="col-sm-6">
<section class="panel">
<div class="panel-body">col-sm-6</div>
</section>
</div>
<div class="col-sm-6">
<section class="panel">
<div class="panel-body">col-sm-6</div>
</section>
</div>
</div>
</div>
<div class="col-lg-6">
<section class="panel">
<div class="panel-body">col-lg-6</div>
</section>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="row">
<div class="col-md-6">
<section class="panel">
<div class="panel-body">col-md-6</div>
</section>
</div>
<div class="col-md-6">
<section class="panel">
<div class="panel-body">col-md-6</div>
</section>
</div>
</div>
</div>
<div class="col-lg-4">
<section class="panel">
<div class="panel-body">col-lg-4</div>
</section>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<section class="panel">
<div class="panel-body">col-sm-6</div>
</section>
</div>
<div class="col-sm-6">
<section class="panel">
<div class="panel-body">col-sm-6</div>
</section>
</div>
</div>
</section>
</section>
<!--main content end-->
</section>
<!-- Placed js at the end of the document so the pages load faster -->
<!--Core js-->
<script src="js/jquery.js"></script>
<script src="bs3/js/bootstrap.min.js"></script>
<script class="include" type="text/javascript" src="js/jquery.dcjqaccordion.2.7.js"></script>
<script src="js/jquery.scrollTo.min.js"></script>
<script src="js/jQuery-slimScroll-1.3.0/jquery.slimscroll.js"></script>
<script src="js/jquery.nicescroll.js"></script>
<!--common script init for all pages-->
<script src="js/scripts.js"></script>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
// Copyright 2016 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
"github.com/mwitkow/go-conntrack"
"gopkg.in/yaml.v2"
)
// BasicAuth contains basic HTTP authentication credentials.
type BasicAuth struct {
Username string `yaml:"username"`
Password Secret `yaml:"password,omitempty"`
PasswordFile string `yaml:"password_file,omitempty"`
}
// URL is a custom URL type that allows validation at configuration load time.
type URL struct {
*url.URL
}
// UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.
func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
urlp, err := url.Parse(s)
if err != nil {
return err
}
u.URL = urlp
return nil
}
// MarshalYAML implements the yaml.Marshaler interface for URLs.
func (u URL) MarshalYAML() (interface{}, error) {
if u.URL != nil {
return u.String(), nil
}
return nil, nil
}
// HTTPClientConfig configures an HTTP client.
type HTTPClientConfig struct {
// The HTTP basic authentication credentials for the targets.
BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"`
// The bearer token for the targets.
BearerToken Secret `yaml:"bearer_token,omitempty"`
// The bearer token file for the targets.
BearerTokenFile string `yaml:"bearer_token_file,omitempty"`
// HTTP proxy server to use to connect to the targets.
ProxyURL URL `yaml:"proxy_url,omitempty"`
// TLSConfig to use to connect to the targets.
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
}
// Validate validates the HTTPClientConfig to check only one of BearerToken,
// BasicAuth and BearerTokenFile is configured.
func (c *HTTPClientConfig) Validate() error {
if len(c.BearerToken) > 0 && len(c.BearerTokenFile) > 0 {
return fmt.Errorf("at most one of bearer_token & bearer_token_file must be configured")
}
if c.BasicAuth != nil && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) {
return fmt.Errorf("at most one of basic_auth, bearer_token & bearer_token_file must be configured")
}
if c.BasicAuth != nil && (string(c.BasicAuth.Password) != "" && c.BasicAuth.PasswordFile != "") {
return fmt.Errorf("at most one of basic_auth password & password_file must be configured")
}
return nil
}
// UnmarshalYAML implements the yaml.Unmarshaler interface
func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
type plain HTTPClientConfig
if err := unmarshal((*plain)(c)); err != nil {
return err
}
return c.Validate()
}
// UnmarshalYAML implements the yaml.Unmarshaler interface.
func (a *BasicAuth) UnmarshalYAML(unmarshal func(interface{}) error) error {
type plain BasicAuth
return unmarshal((*plain)(a))
}
// NewClient returns a http.Client using the specified http.RoundTripper.
func newClient(rt http.RoundTripper) *http.Client {
return &http.Client{Transport: rt}
}
// NewClientFromConfig returns a new HTTP client configured for the
// given config.HTTPClientConfig. The name is used as go-conntrack metric label.
func NewClientFromConfig(cfg HTTPClientConfig, name string) (*http.Client, error) {
rt, err := NewRoundTripperFromConfig(cfg, name)
if err != nil {
return nil, err
}
return newClient(rt), nil
}
// NewRoundTripperFromConfig returns a new HTTP RoundTripper configured for the
// given config.HTTPClientConfig. The name is used as go-conntrack metric label.
func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string) (http.RoundTripper, error) {
tlsConfig, err := NewTLSConfig(&cfg.TLSConfig)
if err != nil {
return nil, err
}
// The only timeout we care about is the configured scrape timeout.
// It is applied on request. So we leave out any timings here.
var rt http.RoundTripper = &http.Transport{
Proxy: http.ProxyURL(cfg.ProxyURL.URL),
MaxIdleConns: 20000,
MaxIdleConnsPerHost: 1000, // see https://github.com/golang/go/issues/13801
DisableKeepAlives: false,
TLSClientConfig: tlsConfig,
DisableCompression: true,
// 5 minutes is typically above the maximum sane scrape interval. So we can
// use keepalive for all configurations.
IdleConnTimeout: 5 * time.Minute,
DialContext: conntrack.NewDialContextFunc(
conntrack.DialWithTracing(),
conntrack.DialWithName(name),
),
}
// If a bearer token is provided, create a round tripper that will set the
// Authorization header correctly on each request.
if len(cfg.BearerToken) > 0 {
rt = NewBearerAuthRoundTripper(cfg.BearerToken, rt)
} else if len(cfg.BearerTokenFile) > 0 {
rt = NewBearerAuthFileRoundTripper(cfg.BearerTokenFile, rt)
}
if cfg.BasicAuth != nil {
rt = NewBasicAuthRoundTripper(cfg.BasicAuth.Username, cfg.BasicAuth.Password, cfg.BasicAuth.PasswordFile, rt)
}
// Return a new configured RoundTripper.
return rt, nil
}
type bearerAuthRoundTripper struct {
bearerToken Secret
rt http.RoundTripper
}
// NewBearerAuthRoundTripper adds the provided bearer token to a request unless the authorization
// header has already been set.
func NewBearerAuthRoundTripper(token Secret, rt http.RoundTripper) http.RoundTripper {
return &bearerAuthRoundTripper{token, rt}
}
func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
if len(req.Header.Get("Authorization")) == 0 {
req = cloneRequest(req)
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", string(rt.bearerToken)))
}
return rt.rt.RoundTrip(req)
}
type bearerAuthFileRoundTripper struct {
bearerFile string
rt http.RoundTripper
}
// NewBearerAuthFileRoundTripper adds the bearer token read from the provided file to a request unless
// the authorization header has already been set. This file is read for every request.
func NewBearerAuthFileRoundTripper(bearerFile string, rt http.RoundTripper) http.RoundTripper {
return &bearerAuthFileRoundTripper{bearerFile, rt}
}
func (rt *bearerAuthFileRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
if len(req.Header.Get("Authorization")) == 0 {
b, err := ioutil.ReadFile(rt.bearerFile)
if err != nil {
return nil, fmt.Errorf("unable to read bearer token file %s: %s", rt.bearerFile, err)
}
bearerToken := strings.TrimSpace(string(b))
req = cloneRequest(req)
req.Header.Set("Authorization", "Bearer "+bearerToken)
}
return rt.rt.RoundTrip(req)
}
type basicAuthRoundTripper struct {
username string
password Secret
passwordFile string
rt http.RoundTripper
}
// NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has
// already been set.
func NewBasicAuthRoundTripper(username string, password Secret, passwordFile string, rt http.RoundTripper) http.RoundTripper {
return &basicAuthRoundTripper{username, password, passwordFile, rt}
}
func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
if len(req.Header.Get("Authorization")) != 0 {
return rt.rt.RoundTrip(req)
}
req = cloneRequest(req)
if rt.passwordFile != "" {
bs, err := ioutil.ReadFile(rt.passwordFile)
if err != nil {
return nil, fmt.Errorf("unable to read basic auth password file %s: %s", rt.passwordFile, err)
}
req.SetBasicAuth(rt.username, strings.TrimSpace(string(bs)))
} else {
req.SetBasicAuth(rt.username, strings.TrimSpace(string(rt.password)))
}
return rt.rt.RoundTrip(req)
}
// cloneRequest returns a clone of the provided *http.Request.
// The clone is a shallow copy of the struct and its Header map.
func cloneRequest(r *http.Request) *http.Request {
// Shallow copy of the struct.
r2 := new(http.Request)
*r2 = *r
// Deep copy of the Header.
r2.Header = make(http.Header)
for k, s := range r.Header {
r2.Header[k] = s
}
return r2
}
// NewTLSConfig creates a new tls.Config from the given TLSConfig.
func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error) {
tlsConfig := &tls.Config{InsecureSkipVerify: cfg.InsecureSkipVerify}
// If a CA cert is provided then let's read it in so we can validate the
// scrape target's certificate properly.
if len(cfg.CAFile) > 0 {
caCertPool := x509.NewCertPool()
// Load CA cert.
caCert, err := ioutil.ReadFile(cfg.CAFile)
if err != nil {
return nil, fmt.Errorf("unable to use specified CA cert %s: %s", cfg.CAFile, err)
}
caCertPool.AppendCertsFromPEM(caCert)
tlsConfig.RootCAs = caCertPool
}
if len(cfg.ServerName) > 0 {
tlsConfig.ServerName = cfg.ServerName
}
// If a client cert & key is provided then configure TLS config accordingly.
if len(cfg.CertFile) > 0 && len(cfg.KeyFile) == 0 {
return nil, fmt.Errorf("client cert file %q specified without client key file", cfg.CertFile)
} else if len(cfg.KeyFile) > 0 && len(cfg.CertFile) == 0 {
return nil, fmt.Errorf("client key file %q specified without client cert file", cfg.KeyFile)
} else if len(cfg.CertFile) > 0 && len(cfg.KeyFile) > 0 {
cert, err := tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile)
if err != nil {
return nil, fmt.Errorf("unable to use specified client cert (%s) & key (%s): %s", cfg.CertFile, cfg.KeyFile, err)
}
tlsConfig.Certificates = []tls.Certificate{cert}
}
tlsConfig.BuildNameToCertificate()
return tlsConfig, nil
}
// TLSConfig configures the options for TLS connections.
type TLSConfig struct {
// The CA cert to use for the targets.
CAFile string `yaml:"ca_file,omitempty"`
// The client cert file for the targets.
CertFile string `yaml:"cert_file,omitempty"`
// The client key file for the targets.
KeyFile string `yaml:"key_file,omitempty"`
// Used to verify the hostname for the targets.
ServerName string `yaml:"server_name,omitempty"`
// Disable target certificate validation.
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
}
// UnmarshalYAML implements the yaml.Unmarshaler interface.
func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
type plain TLSConfig
return unmarshal((*plain)(c))
}
func (c HTTPClientConfig) String() string {
b, err := yaml.Marshal(c)
if err != nil {
return fmt.Sprintf("<error creating http client config string: %s>", err)
}
return string(b)
}
|
{
"pile_set_name": "Github"
}
|
#ifndef BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED
#define BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/apply.hpp>
#include <boost/mpl/iterator_tags.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/aux_/lambda_spec.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace mpl {
namespace aux {
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template<
typename Iterator
, typename LastIterator
, typename F
>
struct transform_iter
{
typedef Iterator base;
typedef forward_iterator_tag category;
typedef transform_iter< typename mpl::next<base>::type,LastIterator,F > next;
typedef typename apply1<
F
, typename deref<base>::type
>::type type;
};
template<
typename LastIterator
, typename F
>
struct transform_iter< LastIterator,LastIterator,F >
{
typedef LastIterator base;
typedef forward_iterator_tag category;
};
#else
template<
typename Iterator
, typename LastIterator
, typename F
>
struct transform_iter;
template< bool >
struct transform_iter_impl
{
template<
typename Iterator
, typename LastIterator
, typename F
>
struct result_
{
typedef Iterator base;
typedef forward_iterator_tag category;
typedef transform_iter< typename mpl::next<Iterator>::type,LastIterator,F > next;
typedef typename apply1<
F
, typename deref<Iterator>::type
>::type type;
};
};
template<>
struct transform_iter_impl<true>
{
template<
typename Iterator
, typename LastIterator
, typename F
>
struct result_
{
typedef Iterator base;
typedef forward_iterator_tag category;
};
};
template<
typename Iterator
, typename LastIterator
, typename F
>
struct transform_iter
: transform_iter_impl<
::boost::is_same<Iterator,LastIterator>::value
>::template result_< Iterator,LastIterator,F >
{
};
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
} // namespace aux
BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::transform_iter)
}}
#endif // BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2018-2019 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "arm_compute/graph/GraphContext.h"
#include "arm_compute/graph.h"
#include "arm_compute/graph/Utils.h"
#include "arm_compute/graph/backends/BackendRegistry.h"
namespace arm_compute
{
namespace graph
{
GraphContext::GraphContext()
: _config(), _memory_managers(), _weights_managers()
{
}
GraphContext::~GraphContext()
{
_memory_managers.clear();
_weights_managers.clear();
release_default_graph_context(*this);
}
const GraphConfig &GraphContext::config() const
{
return _config;
}
void GraphContext::set_config(const GraphConfig &config)
{
_config = config;
}
bool GraphContext::insert_memory_management_ctx(MemoryManagerContext &&memory_ctx)
{
Target target = memory_ctx.target;
if(target == Target::UNSPECIFIED || _memory_managers.find(target) != std::end(_memory_managers))
{
return false;
}
_memory_managers[target] = std::move(memory_ctx);
return true;
}
MemoryManagerContext *GraphContext::memory_management_ctx(Target target)
{
return (_memory_managers.find(target) != std::end(_memory_managers)) ? &_memory_managers[target] : nullptr;
}
std::map<Target, MemoryManagerContext> &GraphContext::memory_managers()
{
return _memory_managers;
}
bool GraphContext::insert_weights_management_ctx(WeightsManagerContext &&weights_managers)
{
Target target = weights_managers.target;
if(_weights_managers.find(target) != std::end(_weights_managers))
{
return false;
}
_weights_managers[target] = std::move(weights_managers);
return true;
}
WeightsManagerContext *GraphContext::weights_management_ctx(Target target)
{
return (_weights_managers.find(target) != std::end(_weights_managers)) ? &_weights_managers[target] : nullptr;
}
std::map<Target, WeightsManagerContext> &GraphContext::weights_managers()
{
return _weights_managers;
}
void GraphContext::finalize()
{
const size_t num_pools = 1;
for(auto &mm_obj : _memory_managers)
{
ARM_COMPUTE_ERROR_ON(!mm_obj.second.allocator);
// Finalize intra layer memory manager
if(mm_obj.second.intra_mm != nullptr)
{
mm_obj.second.intra_mm->populate(*mm_obj.second.allocator, num_pools);
}
// Finalize cross layer memory manager
if(mm_obj.second.cross_mm != nullptr)
{
mm_obj.second.cross_mm->populate(*mm_obj.second.allocator, num_pools);
}
}
}
} // namespace graph
} // namespace arm_compute
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B2_DISTANCE_JOINT_H
#define B2_DISTANCE_JOINT_H
#include <Box2D/Dynamics/Joints/b2Joint.h>
/// Distance joint definition. This requires defining an
/// anchor point on both bodies and the non-zero length of the
/// distance joint. The definition uses local anchor points
/// so that the initial configuration can violate the constraint
/// slightly. This helps when saving and loading a game.
/// @warning Do not use a zero or short length.
struct b2DistanceJointDef : public b2JointDef
{
b2DistanceJointDef()
{
type = e_distanceJoint;
localAnchorA.Set(0.0f, 0.0f);
localAnchorB.Set(0.0f, 0.0f);
length = 1.0f;
frequencyHz = 0.0f;
dampingRatio = 0.0f;
}
/// Initialize the bodies, anchors, and length using the world
/// anchors.
void Initialize(b2Body* bodyA, b2Body* bodyB,
const b2Vec2& anchorA, const b2Vec2& anchorB);
/// The local anchor point relative to body1's origin.
b2Vec2 localAnchorA;
/// The local anchor point relative to body2's origin.
b2Vec2 localAnchorB;
/// The natural length between the anchor points.
float32 length;
/// The mass-spring-damper frequency in Hertz.
float32 frequencyHz;
/// The damping ratio. 0 = no damping, 1 = critical damping.
float32 dampingRatio;
};
/// A distance joint constrains two points on two bodies
/// to remain at a fixed distance from each other. You can view
/// this as a massless, rigid rod.
class b2DistanceJoint : public b2Joint
{
public:
b2Vec2 GetAnchorA() const;
b2Vec2 GetAnchorB() const;
/// Get the reaction force given the inverse time step.
/// Unit is N.
b2Vec2 GetReactionForce(float32 inv_dt) const;
/// Get the reaction torque given the inverse time step.
/// Unit is N*m. This is always zero for a distance joint.
float32 GetReactionTorque(float32 inv_dt) const;
/// Set/get the natural length.
/// Manipulating the length can lead to non-physical behavior when the frequency is zero.
void SetLength(float32 length);
float32 GetLength() const;
// Set/get frequency in Hz.
void SetFrequency(float32 hz);
float32 GetFrequency() const;
// Set/get damping ratio.
void SetDampingRatio(float32 ratio);
float32 GetDampingRatio() const;
protected:
friend class b2Joint;
b2DistanceJoint(const b2DistanceJointDef* data);
void InitVelocityConstraints(const b2SolverData& data);
void SolveVelocityConstraints(const b2SolverData& data);
bool SolvePositionConstraints(const b2SolverData& data);
float32 m_frequencyHz;
float32 m_dampingRatio;
float32 m_bias;
// Solver shared
b2Vec2 m_localAnchorA;
b2Vec2 m_localAnchorB;
float32 m_gamma;
float32 m_impulse;
float32 m_length;
// Solver temp
int32 m_indexA;
int32 m_indexB;
b2Vec2 m_u;
b2Vec2 m_rA;
b2Vec2 m_rB;
b2Vec2 m_localCenterA;
b2Vec2 m_localCenterB;
float32 m_invMassA;
float32 m_invMassB;
float32 m_invIA;
float32 m_invIB;
float32 m_mass;
};
inline void b2DistanceJoint::SetLength(float32 length)
{
m_length = length;
}
inline float32 b2DistanceJoint::GetLength() const
{
return m_length;
}
inline void b2DistanceJoint::SetFrequency(float32 hz)
{
m_frequencyHz = hz;
}
inline float32 b2DistanceJoint::GetFrequency() const
{
return m_frequencyHz;
}
inline void b2DistanceJoint::SetDampingRatio(float32 ratio)
{
m_dampingRatio = ratio;
}
inline float32 b2DistanceJoint::GetDampingRatio() const
{
return m_dampingRatio;
}
#endif
|
{
"pile_set_name": "Github"
}
|
o convex_0
v 0.211336 4.500991 -0.972388
v 1.220083 -2.329995 1.916211
v 1.128409 -2.329995 1.916211
v -0.797410 -2.514329 -2.027384
v -1.164106 2.070510 0.907151
v 1.220083 -2.421783 -1.201684
v 0.853387 4.133840 1.136448
v -1.255780 -2.514329 1.044574
v -1.301617 2.254086 -1.660278
v -1.760320 -2.514329 -1.981062
v 1.357594 1.611571 -0.330434
v -0.338708 5.142748 0.448557
v -0.430382 2.666752 1.548718
v 1.586779 -2.513571 1.732465
v 1.036735 1.611571 -1.247621
v 1.128409 2.528691 1.595041
v -0.751241 -2.514329 1.549104
v -1.118269 3.308508 -1.568405
v 0.623869 4.776355 -0.375984
v 0.073825 1.704118 -1.660278
v 0.669706 -2.514329 -1.614341
v -1.301617 2.345874 0.081451
v -1.439128 -1.871815 0.631917
v -0.843247 4.592779 -0.375984
v 1.495105 -2.513571 -0.330434
v 1.082572 3.767447 -0.238561
v -0.751241 3.995779 0.952701
v -0.384545 5.097233 -0.605667
v -0.017849 4.363689 1.227935
v -0.797410 0.237788 1.549104
v 0.257173 5.235294 0.585981
v 1.265920 2.300359 1.273871
v 0.578032 3.538357 -1.201298
v -1.760320 -2.468056 -1.339108
v 0.669706 -0.266666 -1.614341
v 1.632948 -2.421783 0.998638
v 1.220083 2.162298 -0.834964
v 0.807550 -2.514329 1.916211
v -0.889084 2.070510 1.365744
v -1.164106 -1.412876 1.273871
v 1.174246 -1.550178 -1.339494
v 1.403431 -1.275573 -0.789027
v -0.247034 2.529449 1.594655
v 0.532195 4.959930 -0.376371
v 0.807550 4.363689 1.044574
v -1.164106 2.483176 -1.660278
v 0.119662 4.455477 -1.063875
v -1.760320 -2.330754 -1.935511
v 1.403431 -2.376268 1.916211
v 1.036735 2.666752 1.595041
v -1.255780 2.621237 0.127387
v -0.292871 -1.183785 1.686914
v -1.439128 -2.514329 0.540430
v -0.980758 3.308508 -1.568405
v -0.889084 4.455477 -0.284497
v 0.578032 -0.587544 -1.660278
v 1.174246 2.483176 -0.834964
v 1.220083 2.621237 1.273871
v -1.393291 -1.412876 0.769341
v -0.338708 2.391388 1.594655
v -0.201197 -2.421783 -1.889575
v -0.063686 4.226386 1.273871
v 1.082572 -2.514329 -1.385045
v 1.586779 -2.376268 1.732465
f 49 14 64
f 4 8 10
f 8 4 17
f 17 4 21
f 24 12 28
f 18 24 28
f 12 27 29
f 28 12 31
f 12 29 31
f 11 26 32
f 15 20 33
f 19 26 33
f 23 22 34
f 20 15 35
f 25 11 36
f 14 25 36
f 11 32 36
f 26 11 37
f 2 3 38
f 17 21 38
f 13 27 39
f 27 5 39
f 30 13 39
f 30 39 40
f 8 17 40
f 17 30 40
f 39 5 40
f 35 15 41
f 21 35 41
f 15 37 41
f 41 37 42
f 25 6 42
f 11 25 42
f 37 11 42
f 6 41 42
f 38 3 43
f 28 31 44
f 33 1 44
f 19 33 44
f 26 19 45
f 29 7 45
f 31 29 45
f 19 44 45
f 44 31 45
f 4 10 46
f 10 9 46
f 9 18 46
f 20 4 46
f 18 28 47
f 1 33 47
f 44 1 47
f 28 44 47
f 9 10 48
f 22 9 48
f 10 34 48
f 34 22 48
f 2 38 49
f 38 14 49
f 3 2 50
f 16 7 50
f 7 29 50
f 43 3 50
f 2 49 50
f 49 16 50
f 18 9 51
f 22 5 51
f 9 22 51
f 5 27 51
f 30 17 52
f 17 38 52
f 10 8 53
f 8 23 53
f 34 10 53
f 23 34 53
f 33 20 54
f 46 18 54
f 20 46 54
f 18 47 54
f 47 33 54
f 12 24 55
f 24 18 55
f 27 12 55
f 18 51 55
f 51 27 55
f 4 20 56
f 20 35 56
f 35 21 56
f 15 33 57
f 33 26 57
f 37 15 57
f 26 37 57
f 7 16 58
f 16 32 58
f 32 26 58
f 45 7 58
f 26 45 58
f 5 22 59
f 23 8 59
f 22 23 59
f 8 40 59
f 40 5 59
f 13 30 60
f 43 13 60
f 38 43 60
f 30 52 60
f 52 38 60
f 21 4 61
f 4 56 61
f 56 21 61
f 27 13 62
f 29 27 62
f 13 43 62
f 50 29 62
f 43 50 62
f 6 25 63
f 25 14 63
f 14 38 63
f 38 21 63
f 41 6 63
f 21 41 63
f 32 16 64
f 14 36 64
f 36 32 64
f 16 49 64
o convex_1
v 2.550045 -7.191379 2.420732
v 0.532410 -6.412737 2.283057
v 0.532410 -6.412737 2.329061
v 1.312128 -4.669550 2.329061
v 1.449588 -7.328479 3.429339
v 3.192044 -7.879116 3.429339
v 1.953606 -7.603797 2.283057
v 2.733064 -8.475577 3.383447
v 1.999426 -6.640741 3.429339
v 2.045506 -5.495133 2.283057
v 0.945309 -4.669550 2.329061
v 1.449588 -6.916060 3.383447
v 1.953606 -7.879116 3.429339
v 2.457885 -6.916060 2.283057
v 0.945309 -4.669550 2.283057
v 2.824704 -8.475577 3.383447
v 2.137146 -7.649994 2.329061
v 1.770847 -6.640741 3.429339
v 3.192044 -7.970765 3.383447
v 0.899489 -6.824411 2.558295
v 0.624310 -5.908297 2.329061
v 2.641685 -8.429380 3.429339
v 1.495408 -4.853592 2.329061
v 2.228786 -8.062786 3.199993
v 3.192044 -7.879116 3.383447
v 2.320425 -7.328479 2.283057
v 2.045506 -5.495133 2.329061
v 1.495408 -7.420873 3.429339
v 1.266569 -7.099357 3.245884
v 1.541748 -7.283027 2.283057
f 88 84 94
f 69 70 73
f 71 66 74
f 73 68 75
f 70 69 77
f 71 74 78
f 74 66 79
f 68 74 79
f 75 68 79
f 80 72 81
f 72 71 81
f 69 73 82
f 73 75 82
f 76 69 82
f 75 76 82
f 70 80 83
f 67 66 84
f 66 67 85
f 76 75 85
f 79 66 85
f 75 79 85
f 71 72 86
f 70 77 86
f 80 70 86
f 72 80 86
f 68 73 87
f 73 70 87
f 74 68 87
f 77 84 88
f 71 86 88
f 86 77 88
f 74 70 89
f 65 78 89
f 78 74 89
f 83 65 89
f 70 83 89
f 78 65 90
f 71 78 90
f 80 81 90
f 81 71 90
f 65 83 90
f 83 80 90
f 70 74 91
f 87 70 91
f 74 87 91
f 69 67 92
f 77 69 92
f 67 84 92
f 84 77 92
f 67 69 93
f 69 76 93
f 85 67 93
f 76 85 93
f 66 71 94
f 84 66 94
f 71 88 94
o convex_2
v 2.137348 -6.136934 2.283057
v 0.761828 -6.183037 0.402971
v 0.715860 -6.183037 0.494804
v 2.045412 -7.604175 2.283057
v 0.165564 -6.136934 2.007559
v 1.632580 -6.136934 0.678469
v 2.412496 -7.053959 2.191224
v 0.486680 -6.136934 2.283057
v 1.724516 -7.420626 2.237049
v 2.045412 -6.136934 1.595140
v 0.165564 -6.183037 1.961919
v 0.486680 -6.412257 2.283057
v 2.045412 -7.604175 2.237049
v 1.632580 -6.183037 0.678469
v 2.412496 -6.824883 2.283057
v 0.761828 -6.136934 0.402971
v 1.724516 -7.328995 1.870086
v 0.853544 -6.183037 0.402971
v 0.807796 -6.274668 0.540628
f 111 105 113
f 99 95 100
f 98 95 102
f 95 99 102
f 100 95 104
f 101 100 104
f 105 103 106
f 98 102 106
f 102 99 106
f 103 98 106
f 99 105 106
f 101 98 107
f 98 103 107
f 100 101 108
f 101 107 108
f 95 98 109
f 98 101 109
f 104 95 109
f 101 104 109
f 96 97 110
f 99 100 110
f 97 105 110
f 105 99 110
f 103 105 111
f 107 103 111
f 107 111 112
f 100 108 112
f 108 107 112
f 96 110 112
f 110 100 112
f 111 96 112
f 97 96 113
f 105 97 113
f 96 111 113
o convex_3
v 2.687509 -7.375403 3.429451
v 2.687509 -8.887947 5.676383
v 2.641582 -8.887947 5.676383
v 2.687509 -8.429367 3.429451
v 1.449525 -7.283467 3.475639
v 1.999929 -6.687203 3.475639
v 2.687509 -7.696079 4.575571
v 1.999929 -7.925260 3.429451
v 1.816461 -6.687203 3.475639
v 2.641582 -8.934135 5.492731
v 1.541380 -7.466899 3.429451
v 1.495574 -7.100035 3.475639
v 2.641582 -8.475555 3.567135
v 1.816461 -6.687203 3.429451
v 2.641582 -8.613020 5.446763
v 2.595775 -8.887947 5.584667
f 118 124 129
f 114 115 117
f 114 119 120
f 115 114 120
f 114 117 121
f 120 119 122
f 115 116 123
f 117 115 123
f 121 123 124
f 114 121 124
f 118 116 125
f 116 122 125
f 124 118 125
f 121 117 126
f 117 123 126
f 123 121 126
f 119 114 127
f 122 119 127
f 114 124 127
f 125 122 127
f 124 125 127
f 116 115 128
f 115 120 128
f 122 116 128
f 120 122 128
f 116 118 129
f 123 116 129
f 124 123 129
o convex_4
v -0.981037 -3.660432 -2.486103
v -2.356503 -2.927341 -2.440234
v -2.356503 -2.927341 -2.394365
v -0.614074 -2.514329 -1.935799
v -1.989540 -2.743927 -3.219508
v -0.981037 -4.440083 -1.935799
v -1.805875 -2.514329 -1.935799
v -1.805875 -3.202368 -3.173639
v -2.081005 -3.339975 -1.935799
v -0.476417 -4.119061 -1.981668
v -2.264670 -2.560513 -3.036031
v -1.576753 -2.881346 -3.081901
v -0.476417 -2.743927 -1.981668
v -1.485104 -4.073255 -1.981668
v -0.797555 -4.440083 -1.981668
v -1.897891 -3.156561 -3.173639
v -2.172837 -2.514329 -2.715072
v -2.356503 -2.789733 -2.394365
v -2.127013 -3.064760 -1.935799
v -0.476417 -4.119061 -1.935799
v -0.614074 -2.514329 -1.981668
v -1.393824 -3.843846 -2.577590
v -2.081005 -2.835540 -3.219508
v -2.172837 -2.560513 -3.036031
f 146 150 153
f 135 133 136
f 132 131 138
f 135 136 138
f 137 130 139
f 130 137 141
f 137 134 141
f 139 130 141
f 139 141 142
f 138 131 143
f 135 138 143
f 137 139 144
f 143 131 145
f 136 133 146
f 146 140 147
f 131 132 147
f 140 131 147
f 136 146 147
f 136 147 148
f 132 138 148
f 138 136 148
f 147 132 148
f 133 135 149
f 139 142 149
f 142 133 149
f 135 144 149
f 144 139 149
f 141 134 150
f 142 141 150
f 133 142 150
f 146 133 150
f 135 143 151
f 144 135 151
f 137 144 151
f 145 137 151
f 143 145 151
f 134 137 152
f 131 140 152
f 140 134 152
f 137 145 152
f 145 131 152
f 134 140 153
f 140 146 153
f 150 134 153
o convex_5
v -1.805822 -2.560356 -1.476882
v 2.137317 -5.999005 2.282644
v 2.091481 -5.723856 2.282644
v 1.174347 -2.514971 -1.247693
v 0.211377 -5.356874 -1.659820
v -1.026610 -2.514971 1.365888
v -0.430328 -5.723856 1.594664
v 1.586871 -2.514971 1.732591
v -2.035416 -3.385802 -1.935673
v -1.209954 -5.311488 -1.431044
v 1.632707 -6.136934 0.631657
v 0.532229 -6.136934 2.283057
v -1.347462 -4.760836 0.402881
v -0.430328 -2.514971 -1.935673
v 0.853081 -2.652191 1.961780
v 1.266019 -4.898411 -0.880577
v 1.495199 -2.514971 -0.330524
v 0.669737 -6.136934 0.311206
v -1.393298 -2.514971 0.723333
v 2.045232 -6.136934 1.595077
v 0.898917 -4.485688 2.283057
v 0.761409 -4.715096 -1.568557
v -0.797016 -4.531427 -1.935673
v 0.119292 -6.136934 2.007617
v -1.347462 -5.219299 -0.468037
v -1.164118 -4.211248 1.090448
v 1.311855 -5.632022 -0.559713
v -1.805822 -2.514971 -1.935673
v -0.751180 -2.514971 1.549239
v 1.632707 -2.514971 0.952935
v -2.081252 -3.202488 -1.843584
v 1.403527 -2.514971 1.915942
v 0.669737 -2.514971 -1.614395
v -0.659508 -5.219299 1.549239
v -0.384492 -4.211248 -1.935673
v 1.357691 -2.560711 -0.880577
v 1.311855 -4.439948 2.282644
v 1.220183 -4.211248 -1.109766
v 2.137317 -6.136934 2.145131
v -1.255790 -5.265394 -1.476882
v -1.439134 -4.119059 -1.935673
v -2.081252 -3.018819 -1.889422
v 1.999396 -5.357228 2.282644
v 0.119705 -2.514971 1.778428
v -1.301626 -5.265394 -1.201442
v 0.532229 -5.861431 2.283057
v 0.990590 -3.340062 -1.431044
v 1.632707 -2.514971 1.365475
v 1.541035 -6.136934 0.539982
v 0.119292 -6.136934 1.870104
v 0.073456 -5.356874 -1.660233
v 1.266019 -4.073674 -1.018091
v -1.118282 -2.606451 1.273800
v -1.393298 -3.936100 0.448719
v -1.026610 -5.402968 -1.247280
v -1.393298 -4.760836 0.219117
v 0.440557 -6.136934 2.236806
v 0.807245 -4.760836 -1.522720
v -1.164118 -3.981839 1.136286
v -0.888689 -4.531427 -1.935673
v 0.853081 -6.136934 0.311206
v 2.137317 -6.090839 2.145131
v 2.137317 -6.136934 2.282644
v -1.301626 -5.265394 -0.421786
f 178 198 217
f 157 159 161
f 159 157 167
f 157 161 170
f 164 165 171
f 159 167 172
f 165 164 173
f 155 156 174
f 162 167 176
f 171 165 177
f 160 166 178
f 173 164 180
f 169 173 180
f 167 162 181
f 154 172 181
f 172 167 181
f 161 159 182
f 170 161 183
f 162 178 184
f 161 182 185
f 167 157 186
f 166 160 187
f 160 177 187
f 179 166 187
f 182 159 187
f 175 158 188
f 158 176 188
f 176 167 188
f 167 186 188
f 186 175 188
f 157 170 189
f 170 173 189
f 168 174 190
f 185 168 190
f 157 189 191
f 165 173 192
f 162 176 194
f 193 162 194
f 172 154 195
f 154 181 195
f 181 162 195
f 184 172 195
f 162 184 195
f 156 161 196
f 174 156 196
f 161 185 196
f 190 174 196
f 185 190 196
f 174 168 197
f 182 174 197
f 168 185 197
f 185 182 197
f 178 162 198
f 193 163 198
f 162 193 198
f 165 174 199
f 174 182 199
f 186 157 200
f 175 186 200
f 157 191 200
f 156 155 201
f 161 156 201
f 155 183 201
f 183 161 201
f 164 171 202
f 158 180 202
f 180 164 202
f 171 177 203
f 198 163 203
f 177 198 203
f 176 158 204
f 163 193 204
f 173 169 205
f 189 173 205
f 169 191 205
f 191 189 205
f 159 172 206
f 187 159 206
f 166 179 207
f 172 184 207
f 184 166 207
f 203 163 208
f 171 203 208
f 163 204 208
f 204 171 208
f 178 166 209
f 166 184 209
f 184 178 209
f 177 165 210
f 187 177 210
f 182 187 210
f 165 199 210
f 199 182 210
f 158 175 211
f 180 158 211
f 169 180 211
f 191 169 211
f 175 200 211
f 200 191 211
f 179 187 212
f 206 172 212
f 187 206 212
f 207 179 212
f 172 207 212
f 194 176 213
f 193 194 213
f 176 204 213
f 204 193 213
f 158 202 214
f 202 171 214
f 171 204 214
f 204 158 214
f 173 170 215
f 183 155 215
f 170 183 215
f 155 192 215
f 192 173 215
f 155 174 216
f 174 165 216
f 192 155 216
f 165 192 216
f 177 160 217
f 160 178 217
f 198 177 217
o convex_6
v 3.100332 -8.796236 3.796315
v 2.779360 -8.842214 5.676383
v 2.916927 -8.796236 5.630195
v 2.687630 -7.421129 3.429451
v 2.687630 -9.621721 5.217803
v 3.237900 -8.154893 5.171615
v 3.237900 -9.713442 4.988183
v 3.237900 -7.925708 3.429451
v 2.687630 -8.475798 3.429451
v 2.687630 -7.742267 4.621539
v 3.191954 -9.163118 5.676383
v 3.054387 -9.805162 4.942655
v 2.779360 -9.484024 5.676383
v 2.687630 -8.842214 5.676383
v 3.237900 -8.979677 4.025715
v 2.733576 -7.421129 3.475639
v 2.825198 -8.521775 3.429451
v 3.237900 -8.979677 5.630195
v 3.100332 -9.759185 5.171615
v 3.054387 -8.246614 5.263551
v 2.825198 -7.788011 4.713035
v 2.687630 -9.621721 5.401235
v 3.191954 -9.805162 4.942655
v 3.237900 -8.017429 3.429451
f 234 225 241
f 223 224 225
f 221 225 226
f 222 221 226
f 221 222 227
f 222 226 229
f 228 219 230
f 227 222 231
f 230 219 231
f 225 224 232
f 223 225 233
f 225 221 233
f 221 227 233
f 226 225 234
f 229 226 234
f 218 232 234
f 220 219 235
f 223 220 235
f 224 223 235
f 219 228 235
f 228 224 235
f 224 228 236
f 228 230 236
f 219 220 237
f 220 223 237
f 231 219 237
f 227 231 237
f 223 233 238
f 233 227 238
f 237 223 238
f 227 237 238
f 222 229 239
f 231 222 239
f 230 231 239
f 229 236 239
f 236 230 239
f 232 224 240
f 229 234 240
f 234 232 240
f 224 236 240
f 236 229 240
f 225 232 241
f 232 218 241
f 218 234 241
o convex_7
v 3.375642 -8.292424 5.263402
v 3.237998 -9.667625 4.804809
v 3.283912 -9.667625 4.804809
v 3.237998 -7.925650 3.429662
v 4.246628 -8.338271 3.796494
v 4.108984 -7.879803 4.575723
v 3.237998 -9.025569 5.584671
v 3.833894 -7.604319 4.255088
v 3.237998 -8.109037 5.125867
v 3.879809 -8.796335 4.621498
v 4.246628 -7.833956 3.842480
v 3.283912 -8.979722 4.071777
v 3.879809 -8.200730 3.567409
v 3.604818 -8.429964 5.263402
v 3.283912 -9.117262 5.538474
v 4.108984 -8.017344 4.575723
v 3.513187 -9.300650 4.438398
v 3.283912 -9.621576 4.988331
v 3.237998 -8.017344 3.429662
v 3.788079 -8.704641 4.896570
v 4.246628 -8.246577 3.980016
v 3.879809 -7.650569 4.392623
v 4.154899 -8.292424 3.704944
v 4.017354 -8.658794 4.346848
v 4.200714 -7.925650 3.750719
v 3.650732 -7.742263 4.529737
v 3.559002 -8.338271 5.263402
f 248 255 268
f 245 243 248
f 245 248 250
f 248 242 250
f 245 249 252
f 244 243 253
f 255 248 256
f 247 255 257
f 246 244 258
f 244 253 258
f 243 244 259
f 248 243 259
f 251 256 259
f 256 248 259
f 243 245 260
f 253 243 260
f 254 253 260
f 245 254 260
f 256 251 261
f 255 256 261
f 251 257 261
f 257 255 261
f 246 252 262
f 252 247 262
f 247 257 262
f 250 247 263
f 247 252 263
f 252 249 263
f 253 254 264
f 246 258 264
f 258 253 264
f 244 246 265
f 257 251 265
f 259 244 265
f 251 259 265
f 246 262 265
f 262 257 265
f 245 252 266
f 252 246 266
f 254 245 266
f 246 264 266
f 264 254 266
f 249 245 267
f 245 250 267
f 250 263 267
f 263 249 267
f 242 248 268
f 247 250 268
f 250 242 268
f 255 247 268
|
{
"pile_set_name": "Github"
}
|
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package k8s.io.apimachinery.pkg.runtime.schema;
// Package-wide variables from generator "generated".
option go_package = "schema";
|
{
"pile_set_name": "Github"
}
|
Markdown:MARKDOWN_FILE
Markdown:PARAGRAPH
Markdown:TEXT('aa.aa')
Markdown:EOL('\n')
Markdown:TEXT('www.aa.aa')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('www.aa.be')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('http://aa.aa')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('https://aa.aa')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('ftp://aa.aa')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('ssh://aa.aa')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('file://aa.aa')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('www.aa.be/')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('www.aa.be/')
Markdown:TEXT('/')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('www.aa.be/script.php?a=b&x=%20y#hashtag')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:SHORT_REFERENCE_LINK
Markdown:LINK_LABEL
Markdown:[('[')
Markdown:TEXT('www.not.rendered.as.autolink.be')
Markdown:](']')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:SHORT_REFERENCE_LINK
Markdown:LINK_LABEL
Markdown:[('[')
Markdown:TEXT('www.not.rendered.as.autolink.be')
Markdown:](']')
Markdown:[('[')
Markdown:](']')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:FULL_REFERENCE_LINK
Markdown:LINK_TEXT
Markdown:[('[')
Markdown:TEXT('www.not.rendered.as.autolink.be')
Markdown:](']')
Markdown:LINK_LABEL
Markdown:[('[')
Markdown:TEXT('www.and.this.be')
Markdown:](']')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('Google Group')
Markdown::(':')
WHITE_SPACE(' ')
Markdown:GFM_AUTOLINK('https://groups.google.com/forum/#!forum/markdown-here')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('JetBrains Account portal')
WHITE_SPACE(' ')
Markdown:EOL('\n')
Markdown:GFM_AUTOLINK('https://account.jetbrains.com')
Markdown:EOL('\n')
Markdown:TEXT('JetBrains Account portal')
WHITE_SPACE(' ')
Markdown:GFM_AUTOLINK('https://account.jetbrains.com')
Markdown:EOL('\n')
Markdown:TEXT('JetBrains Online Store')
WHITE_SPACE(' ')
Markdown:GFM_AUTOLINK('https://www.jetbrains.com/store')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('Check out library called Exposed')
Markdown::(':')
WHITE_SPACE(' ')
Markdown:GFM_AUTOLINK('https://github.com/JetBrains/Exposed')
Markdown:TEXT('.')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('Credits for the testdata to')
WHITE_SPACE(' ')
Markdown:GFM_AUTOLINK('https://mathiasbynens.be/demo/url-regex')
Markdown::(':')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://142.42.1.1:8080/')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://142.42.1.1:8080')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://localhost:8080')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://localhost.com:8080')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://foo.com/blah_(wikipedia)#cite-1')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://foo.com/blah_(wikipedia)_blah#cite-1')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://foo.com/(something)?after=parens')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://code.google.com/events/#&product=browser')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('http://a.b-c.de')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://foo_bar.example.com/')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://test.com/~repo/large-files-editor')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://test.com/~repo')
Markdown:~('~')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://test.com/~repo~/')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://youtrack.jetbrains.com/issues?q=for:%20me%20')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://youtrack.jetbrains.com/issues?q=for:%20me%20')
Markdown::(':')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://youtrack.jetbrains.com/issues?q=for:%20me%20:/')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://www.owasp.org/index.php/Cross-site_Scripting_XSS')
Markdown:)(')')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://www.owasp.org/index.php/Cross-site_Scripting_XSS')
Markdown:TEXT('..')
Markdown:)(')')
Markdown:TEXT('..')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://www.owasp.org/index.php/Cross-site_Scripting_(XSS..)')
Markdown:TEXT('..')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://www.owasp.org/index.php/Cross-site_Scripting_(XSS]📭')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://www.owasp.org/index.php/Cross-site_Scripting_(XSS]$')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://www.owasp.org/index.php/Cross-site_Scripting/////asd')
Markdown:!('!')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://google.com/p')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('https://google.com/p')
Markdown:EMPH('_')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('https://google.com/p/')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('t.co/foo')
WHITE_SPACE(' ')
Markdown:(('(')
Markdown:TEXT('Twitter URL shortener')
Markdown:)(')')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('jetbrains.team/abc')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('yandex.ru')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('FullyQN.WS')
Markdown:EMPH('_')
Markdown:TEXT('FOO_BAR')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:"('"')
Markdown:TEXT('FullyQN.WS')
Markdown:"('"')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('boo_foobar.com')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('name.name@gmail.com')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:GFM_AUTOLINK('kek.рф')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('Reference link')
WHITE_SPACE(' ')
Markdown:FULL_REFERENCE_LINK
Markdown:LINK_TEXT
Markdown:[('[')
Markdown:TEXT('https://github.com/nodeca/pica')
Markdown:](']')
Markdown:LINK_LABEL
Markdown:[('[')
Markdown:TEXT('id')
Markdown:](']')
Markdown:EOL('\n')
Markdown:EOL('\n')
Markdown:PARAGRAPH
Markdown:TEXT('Inline link')
WHITE_SPACE(' ')
Markdown:INLINE_LINK
Markdown:LINK_TEXT
Markdown:[('[')
Markdown:TEXT('https://github.com/nodeca/pica')
Markdown:](']')
Markdown:(('(')
Markdown:LINK_DESTINATION
Markdown:TEXT('id')
Markdown:)(')')
|
{
"pile_set_name": "Github"
}
|
<?php
namespace Elgg\Di;
use Elgg\Helpers\Di\DiContainerTestObject;
/**
* @group UnitTests
*/
class DiContainerUnitTest extends \Elgg\UnitTestCase {
const TEST_CLASS = '\Elgg\Helpers\Di\DiContainerTestObject';
public function up() {
}
public function down() {
}
public function getFoo(\Elgg\Di\DiContainer $di) {
return new DiContainerTestObject($di);
}
public function testEmptyContainer() {
$di = new \Elgg\Di\DiContainer();
$this->assertFalse($di->has('foo'));
}
public function testSetValue() {
$di = new \Elgg\Di\DiContainer();
$this->assertSame($di, $di->setValue('foo', 'Foo'));
$this->assertTrue($di->has('foo'));
$this->assertEquals('Foo', $di->foo);
}
public function testSetFactoryShared() {
$di = new \Elgg\Di\DiContainer();
$this->assertSame($di, $di->setFactory('foo', array($this, 'getFoo')));
$this->assertTrue($di->has('foo'));
$foo1 = $di->foo;
$foo2 = $di->foo;
$this->assertInstanceOf(self::TEST_CLASS, $foo1);
$this->assertSame($foo1, $foo2);
}
public function testSetFactoryUnshared() {
$di = new \Elgg\Di\DiContainer();
$this->assertSame($di, $di->setFactory('foo', array($this, 'getFoo'), false));
$this->assertTrue($di->has('foo'));
$foo1 = $di->foo;
$foo2 = $di->foo;
$this->assertInstanceOf(self::TEST_CLASS, $foo1);
$this->assertNotSame($foo1, $foo2);
}
public function testContainerIsPassedToFactory() {
$di = new \Elgg\Di\DiContainer();
$di->setFactory('foo', array($this, 'getFoo'));
$foo = $di->foo;
$this->assertSame($di, $foo->di);
}
public function testSetFactoryLooksUncallable() {
$di = new \Elgg\Di\DiContainer();
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$factory must appear callable');
$di->setFactory('foo', new \stdClass());
}
public function testGetFactoryUncallable() {
$di = new \Elgg\Di\DiContainer();
$di->setFactory('foo', 'not-a-real-callable');
$this->expectException(FactoryUncallableException::class);
$this->expectExceptionMessage("Factory for 'foo' was uncallable: 'not-a-real-callable'");
$di->foo;
}
public function testGetFactoryUncallableArray() {
$di = new \Elgg\Di\DiContainer();
$di->setFactory('foo', array('fakeClass', 'not-a-real-callable'));
$this->expectException(FactoryUncallableException::class);
$this->expectExceptionMessage("Factory for 'foo' was uncallable: 'fakeClass::not-a-real-callable'");
$di->foo;
}
public function testGetFactoryUncallableArrayObject() {
$di = new \Elgg\Di\DiContainer();
$di->setFactory('foo', array($this, 'not-a-real-callable'));
$this->expectException(FactoryUncallableException::class);
$this->expectExceptionMessage("Factory for 'foo' was uncallable: Elgg\Di\DiContainerUnitTest->not-a-real-callable");
$di->foo;
}
public function testGetMissingValue() {
$di = new \Elgg\Di\DiContainer();
$this->expectException(MissingValueException::class);
$this->expectExceptionMessage('Value or factory was not set for: foo');
$di->foo;
}
public function testRemove() {
$di = new \Elgg\Di\DiContainer();
$di->setValue('foo', 'Foo');
$this->assertSame($di, $di->remove('foo'));
$this->assertFalse($di->has('foo'));
}
public function testSetClassNames() {
$di = new \Elgg\Di\DiContainer();
$di->setClassName('foo', self::TEST_CLASS);
$this->assertInstanceOf(self::TEST_CLASS, $di->foo);
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Class names must be valid PHP class names');
$di->setClassName('foo', array());
}
public function testSettingInvalidClassNameThrows() {
$di = new \Elgg\Di\DiContainer();
$euro = "\xE2\x82\xAC";
$di->setClassName('foo1', "Foo2{$euro}3");
$di->setClassName('foo2', "\\Foo2{$euro}3");
$di->setClassName('foo3', "Foo2{$euro}3\\Foo2{$euro}3");
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Class names must be valid PHP class names');
$di->setClassName('foo', 'Not Valid');
}
public function testAccessRemovedValue() {
$di = new \Elgg\Di\DiContainer();
$di->setValue('foo', 'Foo');
$di->remove('foo');
$this->expectException(MissingValueException::class);
$di->foo;
}
public function testNamesCannotEndWithUnderscore() {
$di = new \Elgg\Di\DiContainer();
try {
$di->setValue('foo_', 'foo');
$this->fail('setValue did not throw');
} catch (\InvalidArgumentException $e) {
}
$this->assertFalse($di->has('foo_'));
try {
$di->setFactory('foo_', function () {
});
$this->fail('setFactory did not throw');
} catch (\InvalidArgumentException $e) {
}
try {
$di->remove('foo_');
$this->fail('remove did not throw');
} catch (\InvalidArgumentException $e) {
}
try {
$di->_foo;
$this->fail('->_foo did not throw');
} catch (MissingValueException $e) {
}
}
}
|
{
"pile_set_name": "Github"
}
|
# Configuration schema for the Libraries API module.
# Base configuration schema
libraries.settings:
type: config_object
label: 'Libraries API settings'
mapping:
definition:
type: mapping
label: 'Library definition settings'
mapping:
local:
type: mapping
label: 'Local'
mapping:
path:
type: path
label: 'Local path'
remote:
type: mapping
title: 'Remote'
mapping:
enable:
type: boolean
label: 'Enable remote fetching of library definitions'
urls:
type: sequence
label: 'A list of remote library registry URLs'
sequence:
type: uri
label: 'The URL of a remote library registry'
global_locators:
type: sequence
title: 'Global library locators'
sequence:
type: mapping
title: 'Global locator plugins'
mapping:
id:
type: string
title: 'The locator plugin id'
configuration:
type: libraries.locator.[%parent.id]
title: 'The plugin configuration'
# Dynamic locator plugin schema
libraries.locator.uri:
type: mapping
label: 'URI locator configuration'
mapping:
uri:
type: uri
label: 'The locator URI'
|
{
"pile_set_name": "Github"
}
|
---
title: "Plan alternate access mappings for SharePoint Server"
ms.reviewer:
ms.author: serdars
author: SerdarSoysal
manager: serdars
ms.date: 5/30/2017
audience: ITPro
f1.keywords:
- NOCSH
ms.topic: article
ms.prod: sharepoint-server-itpro
localization_priority: Normal
ms.collection:
- IT_Sharepoint_Server
- IT_Sharepoint_Server_Top
ms.assetid: 0d2efc06-afb4-40fe-9ac9-f973ac3d985f
description: "Learn how to plan for alternate access mappings in SharePoint Server."
---
# Plan alternate access mappings for SharePoint Server
[!INCLUDE[appliesto-2013-2016-2019-xxx-md](../includes/appliesto-2013-2016-2019-xxx-md.md)]
Alternate access mappings direct users to the correct URLs during their interaction with SharePoint Server 2016 (while browsing to the home page of a SharePoint Server 2016 website, for example). Alternate access mappings enable SharePoint Server to map web requests to the correct web applications and sites, and they enable SharePoint Server to serve the correct content back to the user.
Because the features of alternate access mapping are deprecated, we recommend that you use host-named site collections over alternate access mappings.
For additional information about how to plan for host-named site collections, see [Host-named site collection architecture and deployment in SharePoint Server](host-named-site-collection-architecture-and-deployment.md).
Alternate access mappings were implemented because there are common Internet deployment scenarios in which the URL of a web request received by Internet Information Services (IIS) differs from the URL that was typed by a user. This is most likely to occur in deployment scenarios that include reverse proxy publishing and load balancing.
> [!NOTE]
> Alternate access mappings must be configured for load balancing, even though it generally does not apply to host header site collections. The default zone public URL should be set to a domain URL that is appropriate for all users to see. Unless you do this, the names of web servers or their IP addresses might be displayed in parameters that were passed between pages within SharePoint Server 2016.
## About alternate access mappings
<a name="section1"> </a>
Alternate access mappings enable a web application that receives a request for an internal URL in one of the five zones to return pages that contain links to the public URL for the zone. You can associate a web application by using a collection of mappings between internal and public URLs. Internal refers to the URL of a web request as it is received by SharePoint Server. Public refers to the URL by which SharePoint will format links that correspond to requests that match one of the internal URLs on that zone when it returns a response. The public URL is the base URL that SharePoint Server uses in the pages that it returns. If the internal URL was changed by a reverse proxy device, it can differ from the public URL.
> [!NOTE]
> Host-named site collections can't use alternate access mappings. Host-named site collections are automatically considered in the Default zone, and the URL of the request must not be changed between the user and the server.
Multiple internal URLs can be associated with a single public URL. Mapping collections can contain up to five authentication zones. But each zone can have only a single public URL. Mapping collections correspond to the following authentication zones:
- Default
- Intranet
- Internet
- Custom
- Extranet
## Reverse proxy publishing
<a name="section2"> </a>
A reverse proxy is a device that sits between users and your web server. All requests to your web server are first received by the reverse proxy device and, if those requests pass the proxy's security filtering, the proxy forwards the requests to your web server.
## Alternate access mapping integration with authentication providers
<a name="section3"> </a>
Alternate access mappings allow you to expose a web application in as many as five different zones, with a different IIS website backing each zone.
> [!NOTE]
> Some people mistakenly refer to this as having up to five different web applications sharing the same content databases. In reality, there is just one web application.
Not only do these zones allow you to use multiple URLs to access the same web application, they also allow you to use multiple authentication providers to access the same web application.
When extending a web application into a zone, you have to use Windows authentication provided by IIS. After the web application has extended into the zone, you can change the zone to use a different type of authentication.
Use the following procedure to change the authentication configuration for a zone.
**To change the authentication type for a zone**
1. From **Administrative Tools**, open Central Administration.
2. On the Central Administration home page, click **Application Management**.
3. On the **Application Management** page, in the **Application Security** section, click **Authentication providers**.
4. On the **Authentication Providers** page, select your web application, which is listed in the **Web Application** box.
5. Click the name of the zone whose authentication configuration you want to change.
> [!NOTE]
> You'll be able to select only from among zones that have a backing IIS website. These zones were assigned an IIS website during the "Extend an existing web application" procedure.
6. On the **Edit Authentication** page, in the **Claims Authentication Types** section, select the authentication type that you want to use for this zone:
- **Windows authentication (default value)**
- **Basic authentication**
- **Forms based authentication (FBA)**
- **Trusted Identity provider**
7. Change any other authentication configuration settings that you want to change, and click **Save**.
At this point, you can change authentication configuration settings for any other zone. You can configure completely independent authentication settings for different zones accessing the same content. For example, you might configure some content to be anonymously available while other content requires credentials. You could configure one zone to have anonymous access enabled and all other forms of authentication disabled, guaranteeing that only the anonymous content will be available. At the same time, another zone can have anonymous access disabled while NTLM authentication is enabled, guaranteeing that only authenticated access will be enabled. In addition, you can have different types of accounts to access the same content: one zone can be configured to use Active Directory accounts in Windows while another zone can be configured to use non-Active Directory accounts that use ASP.NET forms-based authentication.
## Alternate access mapping integration with web application policies
<a name="section4"> </a>
Web application policies allow administrators to grant or deny access to accounts and security groups for all sites exposed through a zone. This can be useful for many scenarios.
For example, the SharePoint Server search crawler must undergo the same authorization infrastructure as any other user: it can only crawl content that it has access to. But users would still like search to crawl restricted content so that authorized users can find that content in search results. The search service uses a Full Read policy on the web applications to give its crawler permission to read all content on that web application. That way, it can crawl and index all existing and future content, even content to which the site administrator had not explicitly given it access.
Another example would be helpdesk personnel who need administrative access to SharePoint Server sites so that they can help users. To do this, you can create a web application policy that grants the helpdesk staff accounts Full Control permission so that they have full administrative access to all current and future sites on the web application.
Because policies are tied to both web applications and their zones, you can guarantee that the policy that you have applied to one zone does not affect other zones. This can be useful if you have content exposed both on the corporate network and to the Internet. For example, suppose that you have given a helpdesk staff account Full Control permission over a web application's zone that is assigned to the corporate network. If someone were to try to use that account to access the site over the Internet, that Full Control policy wouldn't apply because it would recognize that the URL is in a different zone. Therefore, the account wouldn't automatically be given administrative access to the site.
## Alternate access mapping and external resource mapping
<a name="section5"> </a>
SharePoint Server allows you to extend the alternate access mapping functionality to content that is not hosted within the SharePoint Server farm. To configure this functionality, browse to the **Alternate Access Mappings** page, and then click **Map to External Resource**. You'll then be asked to create an entry for an external resource, which you can think of as another web application. After you have an external resource, you can assign different URLs and zones to it in the same manner that you do for web applications. This feature is not used in SharePoint Server, but third-party products that build onto SharePoint Server can use it.
For example, the search technology in SharePoint Server can crawl content external to the farm, such as file shares and websites. If that content is available at different URLs on different networks, you would want search to return results by using the appropriate URLs for the user's current network. By using alternate access mapping's external resource mapping technology, search can remap the external URLs in its results to match the user's zone.
## See also
<a name="section5"> </a>
#### Concepts
[Configure alternate access mappings for SharePoint Server](configure-alternate-access-mappings.md)
|
{
"pile_set_name": "Github"
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace CSLE
{
public class RegHelper_DeleAction<T> : RegHelper_Type, ICLS_Type_Dele
{
public RegHelper_DeleAction(Type type, string setkeyword)
: base(type, setkeyword)
{
}
public override object Math2Value(CLS_Content env, char code, object left, CLS_Content.Value right, out CLType returntype)
{
returntype = null;
if (left is DeleEvent)
{
DeleEvent info = left as DeleEvent;
Delegate calldele = null;
if (right.value is DeleFunction) calldele = CreateDelegate(env.environment, right.value as DeleFunction);
else if (right.value is DeleLambda) calldele = CreateDelegate(env.environment, right.value as DeleLambda);
else if (right.value is Delegate) calldele = right.value as Delegate;
if (code == '+')
{
info._event.AddEventHandler(info.source, calldele);
return null;
}
else if (code == '-')
{
info._event.AddEventHandler(info.source, calldele);
return null;
}
}
else if (left is Delegate)
{
Delegate info = left as Delegate;
Delegate calldele = null;
if (right.value is DeleFunction) calldele = CreateDelegate(env.environment, right.value as DeleFunction);
else if (right.value is DeleLambda) calldele = CreateDelegate(env.environment, right.value as DeleLambda);
else if (right.value is Delegate) calldele = right.value as Delegate;
if (code == '+')
{
Delegate.Combine(info, calldele);
return null;
}
else if (code == '-')
{
Delegate.Remove(info, calldele);
}
}
return new NotSupportedException();
}
public Delegate CreateDelegate(ICLS_Environment env,DeleFunction delefunc)
{
CLS_Content content = new CLS_Content(env);
DeleFunction _func = delefunc;
Action<T> dele = (T param0) =>
{
content.DepthAdd();
content.CallThis = _func.callthis;
content.CallType = _func.calltype;
content.function = _func.function;
var func = _func.calltype.functions[_func.function];
content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
func.expr_runtime.ComputeValue(content);
content.DepthRemove();
};
Delegate d = dele as Delegate;
if ((Type)this.type != typeof(Action<T>))
{
return Delegate.CreateDelegate(this.type, d.Target, d.Method);
}
else
{
return dele;
}
}
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
{
CLS_Content content = lambda.content.Clone();
var pnames = lambda.paramNames;
var expr = lambda.expr_func;
Action<T> dele = (T param0) =>
{
content.DepthAdd();
content.DefineAndSet(pnames[0], typeof(T), param0);
expr.ComputeValue(content);
content.DepthRemove();
};
Delegate d = dele as Delegate;
if ((Type)this.type != typeof(Action<T>))
{
return Delegate.CreateDelegate(this.type, d.Target, d.Method);
}
else
{
return dele;
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
struct S {
S();
S(int);
S(const S &);
~S();
};
void f() {
try {
} catch (S e) {
}
}
// RUN: c-index-test -write-pch %t.pch %s
// RUN: c-index-test -test-load-tu-usrs %t.pch local | FileCheck %s
// CHECK: pch-opaque-value.cpp c:pch-opaque-value.cpp@86@F@f#@e Extent=[10:12 - 10:15]
|
{
"pile_set_name": "Github"
}
|
from goldsberry.masterclass import NbaDataProvider
from goldsberry.apiparams import *
class demographics(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'commonplayerinfo'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_player_common, PlayerID=player_id)
def player_info(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
def headline_stats(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 1)
class career_stats(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerprofilev2'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_career, PlayerID=player_id)
def seasons_regular(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
def career_regular(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 1)
def seasons_post(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 2)
def career_post(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 3)
def seasons_allstar(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 4)
def career_allstar(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 5)
def seasons_college(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 6)
def career_college(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 7)
def seasons_rankings_regular(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 8)
def seasons_rankings_post(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 9)
def season_high_post(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 10)
def career_high_post(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 11)
def next_game(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 12)
class game_logs(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playergamelog'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_gamelogs, PlayerID=player_id,
Season=season)
def logs(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
class shot_dashboard(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerdashptshots'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_dashboard, PlayerID=player_id,
Season=season)
def overall(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
def general(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 1)
def shot_clock(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 2)
def dribble(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 3)
def closest_defender(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 4)
def closest_defender_10ft(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 5)
def touch_time(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 6)
class rebound_dashboard(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerdashptreb'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_dashboard, PlayerID=player_id,
Season=season)
def overall(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
def shot_type(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 1)
def contesting_rebounders(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 2)
def shot_distance(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 3)
def rebound_distanct(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 4)
class passing_dashboard(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerdashptpass'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_dashboard, PlayerID=player_id,
Season=season)
def passes_made(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
def passes_received(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 1)
class defense_dashboard(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerdashptshotdefend'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_dashboard, PlayerID=player_id,
Season=season)
def defending_shot(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
class shot_chart(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'shotchartdetail'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_shotchart, PlayerID=player_id,
Season=season)
def chart(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
def leagueaverage(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 1)
class PlayerList(NbaDataProvider):
def __init__(self, season=default_season, is_only_current_season=1):
url_modifier = 'commonallplayers'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_list, Season=season,
IsOnlyCurrentSeason=is_only_current_season)
def players(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
# BLOCKED BY NBA
class shot_log(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerdashptsshotlog'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_base, PlayerID=player_id,
Season=season)
def log(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
# BLOCKED BY NBA
class rebound_log(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerdashptreboundlogs'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_base, PlayerID=player_id,
Season=season)
def log(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
# BLOCKED BY NBA
class general_splits(NbaDataProvider):
def __init__(self, player_id, season=default_season):
url_modifier = 'playerdashboardbygeneralsplits'
NbaDataProvider.__init__(self, url_modifier=url_modifier, default_params=p_ply_career, PlayerID=player_id,
Season=season)
def overall(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 0)
def location(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 1)
def wins_losses(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 2)
def month(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 3)
def pre_post_allstar(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 4)
def starting_position(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 5)
def days_rest(self):
return self.object_manager.get_table_from_data(self.object_manager.data_tables, 6)
__all__ = ["demographics", "career_stats",
"game_logs", "shot_dashboard", "rebound_dashboard",
"passing_dashboard", "defense_dashboard",
"shot_chart"]
|
{
"pile_set_name": "Github"
}
|
defmodule GitGud.Web.LayoutView do
@moduledoc false
use GitGud.Web, :view
@spec render_layout({atom(), binary() | atom()}, map, keyword) :: binary
def render_layout(layout, assigns, do: content) do
render(layout, Map.put(assigns, :inner_layout, content))
end
@spec render_inner_layout(Plug.Conn.t, map) :: binary
def render_inner_layout(_conn, assigns) do
Map.get(assigns, :inner_layout, assigns.inner_content)
end
@spec session_params(Plug.Conn.t) :: keyword
def session_params(conn) do
cond do
current_route?(conn, :landing_page) -> []
current_route?(conn, :session) -> []
current_route?(conn, :user, :new) -> []
true -> [redirect_to: conn.request_path]
end
end
@spec global_search_input() :: binary
def global_search_input() do
react_component("global-search-input", [], [class: "search"], do: [
content_tag(:div, [class: "control has-icons-left"], do: [
tag(:input, class: "input", type: "text", placeholder: "Search ...", readonly: true),
content_tag(:span, [class: "icon is-small is-left"], do: [
content_tag(:i, "", class: "fa fa-search")
])
])
])
end
@spec title(Plug.Conn.t, binary) :: binary
def title(conn, default \\ "") do
try do
apply(view_module(conn), :title, [action_name(conn), conn.assigns])
rescue
_error -> default
end
end
end
|
{
"pile_set_name": "Github"
}
|
# From http://libestr.adiscon.com/download/libestr-0-1-11/
sha256 46632b2785ff4a231dcf241eeb0dcb5fc0c7d4da8ee49cf5687722cdbe8b2024 libestr-0.1.11.tar.gz
# Hash for license file:
sha256 835b4793da5cbb8965fbd63905b55a4cb4310b7d1b882077d23066b08f901ff8 COPYING
|
{
"pile_set_name": "Github"
}
|
rule Vidar
{
meta:
author = "kevoreilly"
description = "Vidar Payload"
cape_type = "Vidar Payload"
strings:
$decode = {FF 75 0C 8D 34 1F FF 15 ?? ?? ?? ?? 8B C8 33 D2 8B C7 F7 F1 8B 45 0C 8B 4D 08 8A 04 02 32 04 31 47 88 06 3B 7D 10 72 D8}
$wallet = "*walle*.dat"
condition:
uint16(0) == 0x5A4D and all of them
}
|
{
"pile_set_name": "Github"
}
|
/*
* QEMU SuperH CPU
*
* Copyright (c) 2005 Samuel Tardieu
* Copyright (c) 2012 SUSE LINUX Products GmbH
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "cpu.h"
#include "qemu-common.h"
#include "migration/vmstate.h"
#include "exec/exec-all.h"
static void superh_cpu_set_pc(CPUState *cs, vaddr value)
{
SuperHCPU *cpu = SUPERH_CPU(cs);
cpu->env.pc = value;
}
static void superh_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb)
{
SuperHCPU *cpu = SUPERH_CPU(cs);
cpu->env.pc = tb->pc;
cpu->env.flags = tb->flags & TB_FLAG_ENVFLAGS_MASK;
}
static bool superh_cpu_has_work(CPUState *cs)
{
return cs->interrupt_request & CPU_INTERRUPT_HARD;
}
/* CPUClass::reset() */
static void superh_cpu_reset(CPUState *s)
{
SuperHCPU *cpu = SUPERH_CPU(s);
SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(cpu);
CPUSH4State *env = &cpu->env;
scc->parent_reset(s);
memset(env, 0, offsetof(CPUSH4State, end_reset_fields));
env->pc = 0xA0000000;
#if defined(CONFIG_USER_ONLY)
env->fpscr = FPSCR_PR; /* value for userspace according to the kernel */
set_float_rounding_mode(float_round_nearest_even, &env->fp_status); /* ?! */
#else
env->sr = (1u << SR_MD) | (1u << SR_RB) | (1u << SR_BL) |
(1u << SR_I3) | (1u << SR_I2) | (1u << SR_I1) | (1u << SR_I0);
env->fpscr = FPSCR_DN | FPSCR_RM_ZERO; /* CPU reset value according to SH4 manual */
set_float_rounding_mode(float_round_to_zero, &env->fp_status);
set_flush_to_zero(1, &env->fp_status);
#endif
set_default_nan_mode(1, &env->fp_status);
set_snan_bit_is_one(1, &env->fp_status);
}
static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
{
info->mach = bfd_mach_sh4;
info->print_insn = print_insn_sh;
}
typedef struct SuperHCPUListState {
fprintf_function cpu_fprintf;
FILE *file;
} SuperHCPUListState;
/* Sort alphabetically by type name. */
static gint superh_cpu_list_compare(gconstpointer a, gconstpointer b)
{
ObjectClass *class_a = (ObjectClass *)a;
ObjectClass *class_b = (ObjectClass *)b;
const char *name_a, *name_b;
name_a = object_class_get_name(class_a);
name_b = object_class_get_name(class_b);
return strcmp(name_a, name_b);
}
static void superh_cpu_list_entry(gpointer data, gpointer user_data)
{
ObjectClass *oc = data;
SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
SuperHCPUListState *s = user_data;
(*s->cpu_fprintf)(s->file, "%s\n",
scc->name);
}
void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf)
{
SuperHCPUListState s = {
.cpu_fprintf = cpu_fprintf,
.file = f,
};
GSList *list;
list = object_class_get_list(TYPE_SUPERH_CPU, false);
list = g_slist_sort(list, superh_cpu_list_compare);
g_slist_foreach(list, superh_cpu_list_entry, &s);
g_slist_free(list);
}
static gint superh_cpu_name_compare(gconstpointer a, gconstpointer b)
{
const SuperHCPUClass *scc = SUPERH_CPU_CLASS(a);
const char *name = b;
return strcasecmp(scc->name, name);
}
static ObjectClass *superh_cpu_class_by_name(const char *cpu_model)
{
ObjectClass *oc;
GSList *list, *item;
if (cpu_model == NULL) {
return NULL;
}
if (strcasecmp(cpu_model, "any") == 0) {
return object_class_by_name(TYPE_SH7750R_CPU);
}
oc = object_class_by_name(cpu_model);
if (oc != NULL && object_class_dynamic_cast(oc, TYPE_SUPERH_CPU) != NULL
&& !object_class_is_abstract(oc)) {
return oc;
}
oc = NULL;
list = object_class_get_list(TYPE_SUPERH_CPU, false);
item = g_slist_find_custom(list, cpu_model, superh_cpu_name_compare);
if (item != NULL) {
oc = item->data;
}
g_slist_free(list);
return oc;
}
SuperHCPU *cpu_sh4_init(const char *cpu_model)
{
return SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model));
}
static void sh7750r_cpu_initfn(Object *obj)
{
SuperHCPU *cpu = SUPERH_CPU(obj);
CPUSH4State *env = &cpu->env;
env->id = SH_CPU_SH7750R;
env->features = SH_FEATURE_BCR3_AND_BCR4;
}
static void sh7750r_class_init(ObjectClass *oc, void *data)
{
SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
scc->name = "SH7750R";
scc->pvr = 0x00050000;
scc->prr = 0x00000100;
scc->cvr = 0x00110000;
}
static const TypeInfo sh7750r_type_info = {
.name = TYPE_SH7750R_CPU,
.parent = TYPE_SUPERH_CPU,
.class_init = sh7750r_class_init,
.instance_init = sh7750r_cpu_initfn,
};
static void sh7751r_cpu_initfn(Object *obj)
{
SuperHCPU *cpu = SUPERH_CPU(obj);
CPUSH4State *env = &cpu->env;
env->id = SH_CPU_SH7751R;
env->features = SH_FEATURE_BCR3_AND_BCR4;
}
static void sh7751r_class_init(ObjectClass *oc, void *data)
{
SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
scc->name = "SH7751R";
scc->pvr = 0x04050005;
scc->prr = 0x00000113;
scc->cvr = 0x00110000; /* Neutered caches, should be 0x20480000 */
}
static const TypeInfo sh7751r_type_info = {
.name = TYPE_SH7751R_CPU,
.parent = TYPE_SUPERH_CPU,
.class_init = sh7751r_class_init,
.instance_init = sh7751r_cpu_initfn,
};
static void sh7785_cpu_initfn(Object *obj)
{
SuperHCPU *cpu = SUPERH_CPU(obj);
CPUSH4State *env = &cpu->env;
env->id = SH_CPU_SH7785;
env->features = SH_FEATURE_SH4A;
}
static void sh7785_class_init(ObjectClass *oc, void *data)
{
SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
scc->name = "SH7785";
scc->pvr = 0x10300700;
scc->prr = 0x00000200;
scc->cvr = 0x71440211;
}
static const TypeInfo sh7785_type_info = {
.name = TYPE_SH7785_CPU,
.parent = TYPE_SUPERH_CPU,
.class_init = sh7785_class_init,
.instance_init = sh7785_cpu_initfn,
};
static void superh_cpu_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cs = CPU(dev);
SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(dev);
Error *local_err = NULL;
cpu_exec_realizefn(cs, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
cpu_reset(cs);
qemu_init_vcpu(cs);
scc->parent_realize(dev, errp);
}
static void superh_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
SuperHCPU *cpu = SUPERH_CPU(obj);
CPUSH4State *env = &cpu->env;
cs->env_ptr = env;
env->movcal_backup_tail = &(env->movcal_backup);
if (tcg_enabled()) {
sh4_translate_init();
}
}
static const VMStateDescription vmstate_sh_cpu = {
.name = "cpu",
.unmigratable = 1,
};
static void superh_cpu_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
scc->parent_realize = dc->realize;
dc->realize = superh_cpu_realizefn;
scc->parent_reset = cc->reset;
cc->reset = superh_cpu_reset;
cc->class_by_name = superh_cpu_class_by_name;
cc->has_work = superh_cpu_has_work;
cc->do_interrupt = superh_cpu_do_interrupt;
cc->cpu_exec_interrupt = superh_cpu_exec_interrupt;
cc->dump_state = superh_cpu_dump_state;
cc->set_pc = superh_cpu_set_pc;
cc->synchronize_from_tb = superh_cpu_synchronize_from_tb;
cc->gdb_read_register = superh_cpu_gdb_read_register;
cc->gdb_write_register = superh_cpu_gdb_write_register;
#ifdef CONFIG_USER_ONLY
cc->handle_mmu_fault = superh_cpu_handle_mmu_fault;
#else
cc->do_unaligned_access = superh_cpu_do_unaligned_access;
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
#endif
cc->disas_set_info = superh_cpu_disas_set_info;
cc->gdb_num_core_regs = 59;
dc->vmsd = &vmstate_sh_cpu;
}
static const TypeInfo superh_cpu_type_info = {
.name = TYPE_SUPERH_CPU,
.parent = TYPE_CPU,
.instance_size = sizeof(SuperHCPU),
.instance_init = superh_cpu_initfn,
.abstract = true,
.class_size = sizeof(SuperHCPUClass),
.class_init = superh_cpu_class_init,
};
static void superh_cpu_register_types(void)
{
type_register_static(&superh_cpu_type_info);
type_register_static(&sh7750r_type_info);
type_register_static(&sh7751r_type_info);
type_register_static(&sh7785_type_info);
}
type_init(superh_cpu_register_types)
|
{
"pile_set_name": "Github"
}
|
// Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package mock
import (
"context"
"fmt"
"sync"
apicorev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
)
var _ corev1.EndpointsInterface = &endpointsImpl{}
type endpointsImpl struct {
mux sync.Mutex
endpoints map[string]*apicorev1.Endpoints
watches Watches
}
func newEndpointsInterface() corev1.EndpointsInterface {
return &endpointsImpl{
endpoints: make(map[string]*apicorev1.Endpoints),
}
}
func (e *endpointsImpl) Create(ctx context.Context, obj *apicorev1.Endpoints, opts metav1.CreateOptions) (*apicorev1.Endpoints, error) {
e.mux.Lock()
defer e.mux.Unlock()
e.endpoints[obj.Name] = obj
e.watches.Send(watch.Event{
Type: watch.Added,
Object: obj,
})
return obj, nil
}
func (e *endpointsImpl) Update(ctx context.Context, obj *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints, error) {
e.mux.Lock()
defer e.mux.Unlock()
e.endpoints[obj.Name] = obj
e.watches.Send(watch.Event{
Type: watch.Modified,
Object: obj,
})
return obj, nil
}
func (e *endpointsImpl) Delete(ctx context.Context, name string, options metav1.DeleteOptions) error {
e.mux.Lock()
defer e.mux.Unlock()
obj := e.endpoints[name]
if obj == nil {
return fmt.Errorf("unable to delete endpoints %s", name)
}
delete(e.endpoints, name)
e.watches.Send(watch.Event{
Type: watch.Deleted,
Object: obj,
})
return nil
}
func (e *endpointsImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.EndpointsList, error) {
e.mux.Lock()
defer e.mux.Unlock()
out := &apicorev1.EndpointsList{}
for _, v := range e.endpoints {
out.Items = append(out.Items, *v)
}
return out, nil
}
func (e *endpointsImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
e.mux.Lock()
defer e.mux.Unlock()
w := NewWatch()
e.watches = append(e.watches, w)
// Send add events for all current resources.
for _, pod := range e.endpoints {
w.Send(watch.Event{
Type: watch.Added,
Object: pod,
})
}
return w, nil
}
func (e *endpointsImpl) DeleteCollection(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions) error {
panic("not implemented")
}
func (e *endpointsImpl) Get(ctx context.Context, name string, options metav1.GetOptions) (*apicorev1.Endpoints, error) {
panic("not implemented")
}
func (e *endpointsImpl) Patch(ctx context.Context, name string, pt types.PatchType,
data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Endpoints, err error) {
panic("not implemented")
}
|
{
"pile_set_name": "Github"
}
|
/******************************************************************************
*******************************************************************************
**
** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
** of the GNU General Public License v.2.
**
*******************************************************************************
******************************************************************************/
#include "dlm_internal.h"
#include "member.h"
#include "lock.h"
#include "dir.h"
#include "config.h"
#include "requestqueue.h"
struct rq_entry {
struct list_head list;
uint32_t recover_seq;
int nodeid;
struct dlm_message request;
};
/*
* Requests received while the lockspace is in recovery get added to the
* request queue and processed when recovery is complete. This happens when
* the lockspace is suspended on some nodes before it is on others, or the
* lockspace is enabled on some while still suspended on others.
*/
void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms)
{
struct rq_entry *e;
int length = ms->m_header.h_length - sizeof(struct dlm_message);
e = kmalloc(sizeof(struct rq_entry) + length, GFP_NOFS);
if (!e) {
log_print("dlm_add_requestqueue: out of memory len %d", length);
return;
}
e->recover_seq = ls->ls_recover_seq & 0xFFFFFFFF;
e->nodeid = nodeid;
memcpy(&e->request, ms, ms->m_header.h_length);
mutex_lock(&ls->ls_requestqueue_mutex);
list_add_tail(&e->list, &ls->ls_requestqueue);
mutex_unlock(&ls->ls_requestqueue_mutex);
}
/*
* Called by dlm_recoverd to process normal messages saved while recovery was
* happening. Normal locking has been enabled before this is called. dlm_recv
* upon receiving a message, will wait for all saved messages to be drained
* here before processing the message it got. If a new dlm_ls_stop() arrives
* while we're processing these saved messages, it may block trying to suspend
* dlm_recv if dlm_recv is waiting for us in dlm_wait_requestqueue. In that
* case, we don't abort since locking_stopped is still 0. If dlm_recv is not
* waiting for us, then this processing may be aborted due to locking_stopped.
*/
int dlm_process_requestqueue(struct dlm_ls *ls)
{
struct rq_entry *e;
struct dlm_message *ms;
int error = 0;
mutex_lock(&ls->ls_requestqueue_mutex);
for (;;) {
if (list_empty(&ls->ls_requestqueue)) {
mutex_unlock(&ls->ls_requestqueue_mutex);
error = 0;
break;
}
e = list_entry(ls->ls_requestqueue.next, struct rq_entry, list);
mutex_unlock(&ls->ls_requestqueue_mutex);
ms = &e->request;
log_limit(ls, "dlm_process_requestqueue msg %d from %d "
"lkid %x remid %x result %d seq %u",
ms->m_type, ms->m_header.h_nodeid,
ms->m_lkid, ms->m_remid, ms->m_result,
e->recover_seq);
dlm_receive_message_saved(ls, &e->request, e->recover_seq);
mutex_lock(&ls->ls_requestqueue_mutex);
list_del(&e->list);
kfree(e);
if (dlm_locking_stopped(ls)) {
log_debug(ls, "process_requestqueue abort running");
mutex_unlock(&ls->ls_requestqueue_mutex);
error = -EINTR;
break;
}
schedule();
}
return error;
}
/*
* After recovery is done, locking is resumed and dlm_recoverd takes all the
* saved requests and processes them as they would have been by dlm_recv. At
* the same time, dlm_recv will start receiving new requests from remote nodes.
* We want to delay dlm_recv processing new requests until dlm_recoverd has
* finished processing the old saved requests. We don't check for locking
* stopped here because dlm_ls_stop won't stop locking until it's suspended us
* (dlm_recv).
*/
void dlm_wait_requestqueue(struct dlm_ls *ls)
{
for (;;) {
mutex_lock(&ls->ls_requestqueue_mutex);
if (list_empty(&ls->ls_requestqueue))
break;
mutex_unlock(&ls->ls_requestqueue_mutex);
schedule();
}
mutex_unlock(&ls->ls_requestqueue_mutex);
}
static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
{
uint32_t type = ms->m_type;
/* the ls is being cleaned up and freed by release_lockspace */
if (!ls->ls_count)
return 1;
if (dlm_is_removed(ls, nodeid))
return 1;
/* directory operations are always purged because the directory is
always rebuilt during recovery and the lookups resent */
if (type == DLM_MSG_REMOVE ||
type == DLM_MSG_LOOKUP ||
type == DLM_MSG_LOOKUP_REPLY)
return 1;
if (!dlm_no_directory(ls))
return 0;
return 1;
}
void dlm_purge_requestqueue(struct dlm_ls *ls)
{
struct dlm_message *ms;
struct rq_entry *e, *safe;
mutex_lock(&ls->ls_requestqueue_mutex);
list_for_each_entry_safe(e, safe, &ls->ls_requestqueue, list) {
ms = &e->request;
if (purge_request(ls, ms, e->nodeid)) {
list_del(&e->list);
kfree(e);
}
}
mutex_unlock(&ls->ls_requestqueue_mutex);
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DAL_IRQ_TYPES_H__
#define __DAL_IRQ_TYPES_H__
struct dc_context;
typedef void (*interrupt_handler)(void *);
typedef void *irq_handler_idx;
#define DAL_INVALID_IRQ_HANDLER_IDX NULL
/* The order of the IRQ sources is important and MUST match the one's
of base driver */
enum dc_irq_source {
/* Use as mask to specify invalid irq source */
DC_IRQ_SOURCE_INVALID = 0,
DC_IRQ_SOURCE_HPD1,
DC_IRQ_SOURCE_HPD2,
DC_IRQ_SOURCE_HPD3,
DC_IRQ_SOURCE_HPD4,
DC_IRQ_SOURCE_HPD5,
DC_IRQ_SOURCE_HPD6,
DC_IRQ_SOURCE_HPD1RX,
DC_IRQ_SOURCE_HPD2RX,
DC_IRQ_SOURCE_HPD3RX,
DC_IRQ_SOURCE_HPD4RX,
DC_IRQ_SOURCE_HPD5RX,
DC_IRQ_SOURCE_HPD6RX,
DC_IRQ_SOURCE_I2C_DDC1,
DC_IRQ_SOURCE_I2C_DDC2,
DC_IRQ_SOURCE_I2C_DDC3,
DC_IRQ_SOURCE_I2C_DDC4,
DC_IRQ_SOURCE_I2C_DDC5,
DC_IRQ_SOURCE_I2C_DDC6,
DC_IRQ_SOURCE_DPSINK1,
DC_IRQ_SOURCE_DPSINK2,
DC_IRQ_SOURCE_DPSINK3,
DC_IRQ_SOURCE_DPSINK4,
DC_IRQ_SOURCE_DPSINK5,
DC_IRQ_SOURCE_DPSINK6,
DC_IRQ_SOURCE_TIMER,
DC_IRQ_SOURCE_PFLIP_FIRST,
DC_IRQ_SOURCE_PFLIP1 = DC_IRQ_SOURCE_PFLIP_FIRST,
DC_IRQ_SOURCE_PFLIP2,
DC_IRQ_SOURCE_PFLIP3,
DC_IRQ_SOURCE_PFLIP4,
DC_IRQ_SOURCE_PFLIP5,
DC_IRQ_SOURCE_PFLIP6,
DC_IRQ_SOURCE_PFLIP_UNDERLAY0,
DC_IRQ_SOURCE_PFLIP_LAST = DC_IRQ_SOURCE_PFLIP_UNDERLAY0,
DC_IRQ_SOURCE_GPIOPAD0,
DC_IRQ_SOURCE_GPIOPAD1,
DC_IRQ_SOURCE_GPIOPAD2,
DC_IRQ_SOURCE_GPIOPAD3,
DC_IRQ_SOURCE_GPIOPAD4,
DC_IRQ_SOURCE_GPIOPAD5,
DC_IRQ_SOURCE_GPIOPAD6,
DC_IRQ_SOURCE_GPIOPAD7,
DC_IRQ_SOURCE_GPIOPAD8,
DC_IRQ_SOURCE_GPIOPAD9,
DC_IRQ_SOURCE_GPIOPAD10,
DC_IRQ_SOURCE_GPIOPAD11,
DC_IRQ_SOURCE_GPIOPAD12,
DC_IRQ_SOURCE_GPIOPAD13,
DC_IRQ_SOURCE_GPIOPAD14,
DC_IRQ_SOURCE_GPIOPAD15,
DC_IRQ_SOURCE_GPIOPAD16,
DC_IRQ_SOURCE_GPIOPAD17,
DC_IRQ_SOURCE_GPIOPAD18,
DC_IRQ_SOURCE_GPIOPAD19,
DC_IRQ_SOURCE_GPIOPAD20,
DC_IRQ_SOURCE_GPIOPAD21,
DC_IRQ_SOURCE_GPIOPAD22,
DC_IRQ_SOURCE_GPIOPAD23,
DC_IRQ_SOURCE_GPIOPAD24,
DC_IRQ_SOURCE_GPIOPAD25,
DC_IRQ_SOURCE_GPIOPAD26,
DC_IRQ_SOURCE_GPIOPAD27,
DC_IRQ_SOURCE_GPIOPAD28,
DC_IRQ_SOURCE_GPIOPAD29,
DC_IRQ_SOURCE_GPIOPAD30,
DC_IRQ_SOURCE_DC1UNDERFLOW,
DC_IRQ_SOURCE_DC2UNDERFLOW,
DC_IRQ_SOURCE_DC3UNDERFLOW,
DC_IRQ_SOURCE_DC4UNDERFLOW,
DC_IRQ_SOURCE_DC5UNDERFLOW,
DC_IRQ_SOURCE_DC6UNDERFLOW,
DC_IRQ_SOURCE_DMCU_SCP,
DC_IRQ_SOURCE_VBIOS_SW,
DC_IRQ_SOURCE_VUPDATE1,
DC_IRQ_SOURCE_VUPDATE2,
DC_IRQ_SOURCE_VUPDATE3,
DC_IRQ_SOURCE_VUPDATE4,
DC_IRQ_SOURCE_VUPDATE5,
DC_IRQ_SOURCE_VUPDATE6,
DC_IRQ_SOURCE_VBLANK1,
DC_IRQ_SOURCE_VBLANK2,
DC_IRQ_SOURCE_VBLANK3,
DC_IRQ_SOURCE_VBLANK4,
DC_IRQ_SOURCE_VBLANK5,
DC_IRQ_SOURCE_VBLANK6,
DAL_IRQ_SOURCES_NUMBER
};
enum irq_type
{
IRQ_TYPE_PFLIP = DC_IRQ_SOURCE_PFLIP1,
IRQ_TYPE_VUPDATE = DC_IRQ_SOURCE_VUPDATE1,
IRQ_TYPE_VBLANK = DC_IRQ_SOURCE_VBLANK1,
};
#define DAL_VALID_IRQ_SRC_NUM(src) \
((src) <= DAL_IRQ_SOURCES_NUMBER && (src) > DC_IRQ_SOURCE_INVALID)
/* Number of Page Flip IRQ Sources. */
#define DAL_PFLIP_IRQ_SRC_NUM \
(DC_IRQ_SOURCE_PFLIP_LAST - DC_IRQ_SOURCE_PFLIP_FIRST + 1)
/* the number of contexts may be expanded in the future based on needs */
enum dc_interrupt_context {
INTERRUPT_LOW_IRQ_CONTEXT = 0,
INTERRUPT_HIGH_IRQ_CONTEXT,
INTERRUPT_CONTEXT_NUMBER
};
enum dc_interrupt_porlarity {
INTERRUPT_POLARITY_DEFAULT = 0,
INTERRUPT_POLARITY_LOW = INTERRUPT_POLARITY_DEFAULT,
INTERRUPT_POLARITY_HIGH,
INTERRUPT_POLARITY_BOTH
};
#define DC_DECODE_INTERRUPT_POLARITY(int_polarity) \
(int_polarity == INTERRUPT_POLARITY_LOW) ? "Low" : \
(int_polarity == INTERRUPT_POLARITY_HIGH) ? "High" : \
(int_polarity == INTERRUPT_POLARITY_BOTH) ? "Both" : "Invalid"
struct dc_timer_interrupt_params {
uint32_t micro_sec_interval;
enum dc_interrupt_context int_context;
};
struct dc_interrupt_params {
/* The polarity *change* which will trigger an interrupt.
* If 'requested_polarity == INTERRUPT_POLARITY_BOTH', then
* 'current_polarity' must be initialised. */
enum dc_interrupt_porlarity requested_polarity;
/* If 'requested_polarity == INTERRUPT_POLARITY_BOTH',
* 'current_polarity' should contain the current state, which means
* the interrupt will be triggered when state changes from what is,
* in 'current_polarity'. */
enum dc_interrupt_porlarity current_polarity;
enum dc_irq_source irq_source;
enum dc_interrupt_context int_context;
};
#endif
|
{
"pile_set_name": "Github"
}
|
using MigSharp.Core.Commands;
namespace MigSharp.Core.Entities
{
internal class ExistingForeignKey : IForeignKey
{
private readonly AlterForeignKeyCommand _command;
public ExistingForeignKey(AlterForeignKeyCommand command)
{
_command = command;
}
public void Drop()
{
_command.Add(new DropCommand(_command));
}
}
}
|
{
"pile_set_name": "Github"
}
|
/* struct::set - critcl - layer 3 definitions.
*
* -> Set functions.
* Implementations for all set commands.
*/
#include "s.h"
#include "m.h"
/* .................................................. */
/*
*---------------------------------------------------------------------------
*
* sm_ADD --
*
* Copies the argument tree over into this tree object. Uses direct
* access to internal data structures for matching tree objects, and
* goes through a serialize/deserialize combination otherwise.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* Only internal, memory allocation changes ...
*
*---------------------------------------------------------------------------
*/
int
sm_ADD (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set add SETVAR SET
* [0] [1] [2] [3]
*/
SPtr vs, s;
Tcl_Obj* val;
int new = 0;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "Avar B");
return TCL_ERROR;
}
if (s_get (interp, objv[3], &s) != TCL_OK) {
return TCL_ERROR;
}
val = Tcl_ObjGetVar2(interp, objv[2], NULL, 0);
if (val == NULL) {
/* Create missing variable */
vs = s_dup (NULL);
val = s_new (vs);
(void) Tcl_ObjSetVar2 (interp, objv[2], NULL, val, 0);
} else if (s_get (interp, val, &vs) != TCL_OK) {
return TCL_ERROR;
}
if (s->el.numEntries) {
int new, nx = 0;
Tcl_HashSearch hs;
Tcl_HashEntry* he;
CONST char* key;
for(he = Tcl_FirstHashEntry(&s->el, &hs);
he != NULL;
he = Tcl_NextHashEntry(&hs)) {
key = Tcl_GetHashKey (&s->el, he);
if (Tcl_FindHashEntry (&vs->el, key) != NULL) continue;
/* Key not known to vs, to be added */
/* _Now_ unshare the object, if required */
if (Tcl_IsShared (val)) {
val = Tcl_DuplicateObj (val);
(void) Tcl_ObjSetVar2 (interp, objv[2], NULL, val, 0);
s_get (interp, val, &vs);
}
(void*) Tcl_CreateHashEntry(&vs->el, key, &new);
nx = 1;
}
if (nx) {
Tcl_InvalidateStringRep(val);
}
}
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_CONTAINS --
*
* Copies this tree over into the argument tree. Uses direct access to
* internal data structures for matching tree objects, and goes through a
* serialize/deserialize combination otherwise.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* Only internal, memory allocation changes ...
*
*---------------------------------------------------------------------------
*/
int
sm_CONTAINS (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set contains SET ITEM
* [0] [1] [2] [3]
*/
SPtr s;
CONST char* item;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "set item");
return TCL_ERROR;
}
if (s_get (interp, objv[2], &s) != TCL_OK) {
return TCL_ERROR;
}
item = Tcl_GetString (objv [3]);
Tcl_SetObjResult (interp,
Tcl_NewIntObj (s_contains (s, item)));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_DIFFERENCE --
*
* Returns a list containing the ancestors of the named node.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_DIFFERENCE (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set difference SETa SETb
* [0] [1] [2] [3]
*/
SPtr sa, sb;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "A B");
return TCL_ERROR;
}
if (s_get (interp, objv[2], &sa) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[3], &sb) != TCL_OK) {
return TCL_ERROR;
}
Tcl_SetObjResult (interp,
s_new (s_difference (sa, sb)));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_EMPTY --
*
* Appends a value to an attribute of the named node.
* May create the attribute.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_EMPTY (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set empty SET
* [0] [1] [2]
*/
SPtr s;
if (objc != 3) {
Tcl_WrongNumArgs (interp, 2, objv, "set");
return TCL_ERROR;
}
if (objv[2]->typePtr == s_ltype ()) {
int lc;
Tcl_Obj** lv;
Tcl_ListObjGetElements(interp, objv[2], &lc, &lv);
Tcl_SetObjResult (interp, Tcl_NewIntObj (lc == 0));
return TCL_OK;
}
if (s_get (interp, objv[2], &s) != TCL_OK) {
return TCL_ERROR;
}
Tcl_SetObjResult (interp,
Tcl_NewIntObj (s_empty (s)));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_EQUAL --
*
* Returns a dictionary mapping from nodes to attribute values, for a
* named attribute.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_EQUAL (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set equal SETa SETb
* [0] [1] [2] [3]
*/
SPtr sa, sb;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "A B");
return TCL_ERROR;
}
if (s_get (interp, objv[2], &sa) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[3], &sb) != TCL_OK) {
return TCL_ERROR;
}
Tcl_SetObjResult (interp,
Tcl_NewIntObj (s_equal (sa, sb)));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_EXCLUDE --
*
* Returns a list of all direct or indirect descendants of the named
* node, possibly run through a Tcl command prefix for filtering.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory. Per the filter command prefix, if
* one has been specified.
*
*---------------------------------------------------------------------------
*/
int
sm_EXCLUDE (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set exclude SETVAR ITEM
* [0] [1] [2] [3]
*/
SPtr vs;
Tcl_Obj* val;
char* key;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "Avar element");
return TCL_ERROR;
}
val = Tcl_ObjGetVar2(interp, objv[2], NULL, TCL_LEAVE_ERR_MSG);
if (val == NULL) {
return TCL_ERROR;
}
if (s_get (interp, val, &vs) != TCL_OK) {
return TCL_ERROR;
}
key = Tcl_GetString (objv[3]);
if (s_contains (vs, key)) {
if (Tcl_IsShared (val)) {
val = Tcl_DuplicateObj (val);
(void) Tcl_ObjSetVar2 (interp, objv[2], NULL, val, 0);
s_get (interp, val, &vs);
}
s_subtract1 (vs, key);
Tcl_InvalidateStringRep(val);
}
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_INCLUDE --
*
* Deletes the named nodes, but not its children. They are put into the
* place where the deleted node was. Complementary to sm_SPLICE.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_INCLUDE (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set include SETVAR ITEM
* [0] [1] [2] [3]
*/
SPtr vs;
Tcl_Obj* val;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "Avar element");
return TCL_ERROR;
}
val = Tcl_ObjGetVar2(interp, objv[2], NULL, 0);
if (val == NULL) {
/* Create missing variable */
vs = s_dup (NULL);
s_add1 (vs, Tcl_GetString (objv[3]));
val = s_new (vs);
(void) Tcl_ObjSetVar2 (interp, objv[2], NULL, val, 0);
} else {
/* Extend variable */
char* key;
if (s_get (interp, val, &vs) != TCL_OK) {
return TCL_ERROR;
}
key = Tcl_GetString (objv[3]);
if (!s_contains (vs, key)) {
if (Tcl_IsShared (val)) {
val = Tcl_DuplicateObj (val);
(void) Tcl_ObjSetVar2 (interp, objv[2], NULL, val, 0);
s_get (interp, val, &vs);
}
s_add1 (vs, key);
Tcl_InvalidateStringRep(val);
}
}
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_INTERSECT --
*
* Deletes the named node and its children.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_INTERSECT (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set intersect ?SET...?
* [0] [1] [2]
*/
SPtr sa, sb, next, acc;
int i;
if (objc == 2) {
/* intersect nothing = nothing */
Tcl_SetObjResult (interp, s_new (s_dup (NULL)));
return TCL_OK;
}
for (i = 2; i < objc; i++) {
if (s_get (interp, objv[i], &sa) != TCL_OK) {
return TCL_ERROR;
}
}
s_get (interp, objv[2], &sa);
if (objc == 3) {
/* intersect with itself = unchanged */
Tcl_SetObjResult (interp, s_new (s_dup (sa)));
return TCL_OK;
}
acc = sa;
for (i = 3; i < objc; i++) {
s_get (interp, objv[i], &sb);
next = s_intersect (acc, sb);
if (acc != sa) s_free (acc);
acc = next;
if (s_empty (acc)) break;
}
if (acc == sa) {
acc = s_dup (acc);
}
Tcl_SetObjResult (interp, s_new (acc));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_INTERSECT3 --
*
* Returns a non-negative integer number describing the distance between
* the named node and the root of the tree. A depth of 0 implies that
* the node is the root node.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_INTERSECT3 (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set intersect3 SETa SETb
* [0] [1] [2] [3]
*/
SPtr sa, sb;
Tcl_Obj* lv [3];
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "A B");
return TCL_ERROR;
}
if (s_get (interp, objv[2], &sa) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[3], &sb) != TCL_OK) {
return TCL_ERROR;
}
lv [0] = s_new (s_intersect (sa, sb));
lv [1] = s_new (s_difference (sa, sb));
lv [2] = s_new (s_difference (sb, sa));
Tcl_SetObjResult (interp, Tcl_NewListObj (3, lv));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_SIZE --
*
* Returns a list of all descendants of the named node, possibly run
* through a Tcl command prefix for filtering.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory. Per the filter command prefix, if
* one has been specified.
*
*---------------------------------------------------------------------------
*/
int
sm_SIZE (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set size SET
* [0] [1] [2]
*/
SPtr s;
if (objc != 3) {
Tcl_WrongNumArgs (interp, 2, objv, "set");
return TCL_ERROR;
}
if (s_get (interp, objv[2], &s) != TCL_OK) {
return TCL_ERROR;
}
Tcl_SetObjResult (interp,
Tcl_NewIntObj (s_size (s)));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_SUBSETOF --
*
* Parses a Tcl value containing a serialized tree and copies it over
* he existing tree.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_SUBSETOF (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set subsetof SETa SETb
* [0] [1] [2] [3]
*/
SPtr sa, sb;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "A B");
return TCL_ERROR;
}
if (s_get (interp, objv[2], &sa) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[3], &sb) != TCL_OK) {
return TCL_ERROR;
}
Tcl_SetObjResult (interp,
Tcl_NewIntObj (s_subsetof (sa, sb)));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_SUBTRACT --
*
* Destroys the whole tree object.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* Releases memory.
*
*---------------------------------------------------------------------------
*/
int
sm_SUBTRACT (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set subtract SETVAR SET
* [0] [1] [2] [3]
*/
SPtr vs, s;
Tcl_Obj* val;
int del;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "Avar B");
return TCL_ERROR;
}
val = Tcl_ObjGetVar2(interp, objv[2], NULL, TCL_LEAVE_ERR_MSG);
if (val == NULL) {
return TCL_ERROR;
}
if (s_get (interp, val, &vs) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[3], &s) != TCL_OK) {
return TCL_ERROR;
}
if (s->el.numEntries) {
int new, dx = 0;
Tcl_HashSearch hs;
Tcl_HashEntry* he;
CONST char* key;
for(he = Tcl_FirstHashEntry(&s->el, &hs);
he != NULL;
he = Tcl_NextHashEntry(&hs)) {
key = Tcl_GetHashKey (&s->el, he);
if (Tcl_FindHashEntry (&vs->el, key) == NULL) continue;
/* Key known to vs, to be removed */
/* _Now_ unshare the object, if required */
if (Tcl_IsShared (val)) {
val = Tcl_DuplicateObj (val);
(void) Tcl_ObjSetVar2 (interp, objv[2], NULL, val, 0);
s_get (interp, val, &vs);
}
Tcl_DeleteHashEntry (Tcl_FindHashEntry (&vs->el, key));
dx = 1;
}
if (dx) {
Tcl_InvalidateStringRep(val);
}
}
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_SYMDIFF --
*
* Returns a boolean value signaling whether the named node exists in
* the tree. True implies existence, and false non-existence.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_SYMDIFF (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set symdiff SETa SETb
* [0] [1] [2] [3]
*/
SPtr sa, sb, xa, xb, u;
if (objc != 4) {
Tcl_WrongNumArgs (interp, 2, objv, "A B");
return TCL_ERROR;
}
if (s_get (interp, objv[2], &sa) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[3], &sb) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[2], &sa) != TCL_OK) {
return TCL_ERROR;
}
if (s_get (interp, objv[3], &sb) != TCL_OK) {
return TCL_ERROR;
}
xa = s_difference (sa, sb);
xb = s_difference (sb, sa);
u = s_union (xa, xb);
s_free (xa);
s_free (xb);
Tcl_SetObjResult (interp, s_new (u));
return TCL_OK;
}
/*
*---------------------------------------------------------------------------
*
* sm_UNION --
*
* Returns the value of the named attribute at the given node.
*
* Results:
* A standard Tcl result code.
*
* Side effects:
* May release and allocate memory.
*
*---------------------------------------------------------------------------
*/
int
sm_UNION (ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
/* Syntax: set union ?SET...?
* [0] [1] [2]
*/
SPtr sa, acc;
int i;
if (objc == 2) {
/* union nothing = nothing */
Tcl_SetObjResult (interp, s_new (s_dup (NULL)));
return TCL_OK;
}
for (i = 2; i < objc; i++) {
if (s_get (interp, objv[i], &sa) != TCL_OK) {
return TCL_ERROR;
}
}
acc = s_dup (NULL);
for (i = 2; i < objc; i++) {
s_get (interp, objv[i], &sa);
s_add (acc, sa, NULL);
}
Tcl_SetObjResult (interp, s_new (acc));
return TCL_OK;
}
/* .................................................. */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/audio_processing/aecm/aecm_core.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
extern "C" {
#include "common_audio/ring_buffer.h"
#include "common_audio/signal_processing/include/real_fft.h"
}
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "modules/audio_processing/aecm/echo_control_mobile.h"
#include "modules/audio_processing/utility/delay_estimator_wrapper.h"
#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_conversions.h"
namespace webrtc {
namespace {
#ifdef AEC_DEBUG
FILE* dfile;
FILE* testfile;
#endif
// Initialization table for echo channel in 8 kHz
static const int16_t kChannelStored8kHz[PART_LEN1] = {
2040, 1815, 1590, 1498, 1405, 1395, 1385, 1418, 1451, 1506, 1562,
1644, 1726, 1804, 1882, 1918, 1953, 1982, 2010, 2025, 2040, 2034,
2027, 2021, 2014, 1997, 1980, 1925, 1869, 1800, 1732, 1683, 1635,
1604, 1572, 1545, 1517, 1481, 1444, 1405, 1367, 1331, 1294, 1270,
1245, 1239, 1233, 1247, 1260, 1282, 1303, 1338, 1373, 1407, 1441,
1470, 1499, 1524, 1549, 1565, 1582, 1601, 1621, 1649, 1676};
// Initialization table for echo channel in 16 kHz
static const int16_t kChannelStored16kHz[PART_LEN1] = {
2040, 1590, 1405, 1385, 1451, 1562, 1726, 1882, 1953, 2010, 2040,
2027, 2014, 1980, 1869, 1732, 1635, 1572, 1517, 1444, 1367, 1294,
1245, 1233, 1260, 1303, 1373, 1441, 1499, 1549, 1582, 1621, 1676,
1741, 1802, 1861, 1921, 1983, 2040, 2102, 2170, 2265, 2375, 2515,
2651, 2781, 2922, 3075, 3253, 3471, 3738, 3976, 4151, 4258, 4308,
4288, 4270, 4253, 4237, 4179, 4086, 3947, 3757, 3484, 3153};
} // namespace
const int16_t WebRtcAecm_kCosTable[] = {
8192, 8190, 8187, 8180, 8172, 8160, 8147, 8130, 8112, 8091, 8067,
8041, 8012, 7982, 7948, 7912, 7874, 7834, 7791, 7745, 7697, 7647,
7595, 7540, 7483, 7424, 7362, 7299, 7233, 7164, 7094, 7021, 6947,
6870, 6791, 6710, 6627, 6542, 6455, 6366, 6275, 6182, 6087, 5991,
5892, 5792, 5690, 5586, 5481, 5374, 5265, 5155, 5043, 4930, 4815,
4698, 4580, 4461, 4341, 4219, 4096, 3971, 3845, 3719, 3591, 3462,
3331, 3200, 3068, 2935, 2801, 2667, 2531, 2395, 2258, 2120, 1981,
1842, 1703, 1563, 1422, 1281, 1140, 998, 856, 713, 571, 428,
285, 142, 0, -142, -285, -428, -571, -713, -856, -998, -1140,
-1281, -1422, -1563, -1703, -1842, -1981, -2120, -2258, -2395, -2531, -2667,
-2801, -2935, -3068, -3200, -3331, -3462, -3591, -3719, -3845, -3971, -4095,
-4219, -4341, -4461, -4580, -4698, -4815, -4930, -5043, -5155, -5265, -5374,
-5481, -5586, -5690, -5792, -5892, -5991, -6087, -6182, -6275, -6366, -6455,
-6542, -6627, -6710, -6791, -6870, -6947, -7021, -7094, -7164, -7233, -7299,
-7362, -7424, -7483, -7540, -7595, -7647, -7697, -7745, -7791, -7834, -7874,
-7912, -7948, -7982, -8012, -8041, -8067, -8091, -8112, -8130, -8147, -8160,
-8172, -8180, -8187, -8190, -8191, -8190, -8187, -8180, -8172, -8160, -8147,
-8130, -8112, -8091, -8067, -8041, -8012, -7982, -7948, -7912, -7874, -7834,
-7791, -7745, -7697, -7647, -7595, -7540, -7483, -7424, -7362, -7299, -7233,
-7164, -7094, -7021, -6947, -6870, -6791, -6710, -6627, -6542, -6455, -6366,
-6275, -6182, -6087, -5991, -5892, -5792, -5690, -5586, -5481, -5374, -5265,
-5155, -5043, -4930, -4815, -4698, -4580, -4461, -4341, -4219, -4096, -3971,
-3845, -3719, -3591, -3462, -3331, -3200, -3068, -2935, -2801, -2667, -2531,
-2395, -2258, -2120, -1981, -1842, -1703, -1563, -1422, -1281, -1140, -998,
-856, -713, -571, -428, -285, -142, 0, 142, 285, 428, 571,
713, 856, 998, 1140, 1281, 1422, 1563, 1703, 1842, 1981, 2120,
2258, 2395, 2531, 2667, 2801, 2935, 3068, 3200, 3331, 3462, 3591,
3719, 3845, 3971, 4095, 4219, 4341, 4461, 4580, 4698, 4815, 4930,
5043, 5155, 5265, 5374, 5481, 5586, 5690, 5792, 5892, 5991, 6087,
6182, 6275, 6366, 6455, 6542, 6627, 6710, 6791, 6870, 6947, 7021,
7094, 7164, 7233, 7299, 7362, 7424, 7483, 7540, 7595, 7647, 7697,
7745, 7791, 7834, 7874, 7912, 7948, 7982, 8012, 8041, 8067, 8091,
8112, 8130, 8147, 8160, 8172, 8180, 8187, 8190};
const int16_t WebRtcAecm_kSinTable[] = {
0, 142, 285, 428, 571, 713, 856, 998, 1140, 1281, 1422,
1563, 1703, 1842, 1981, 2120, 2258, 2395, 2531, 2667, 2801, 2935,
3068, 3200, 3331, 3462, 3591, 3719, 3845, 3971, 4095, 4219, 4341,
4461, 4580, 4698, 4815, 4930, 5043, 5155, 5265, 5374, 5481, 5586,
5690, 5792, 5892, 5991, 6087, 6182, 6275, 6366, 6455, 6542, 6627,
6710, 6791, 6870, 6947, 7021, 7094, 7164, 7233, 7299, 7362, 7424,
7483, 7540, 7595, 7647, 7697, 7745, 7791, 7834, 7874, 7912, 7948,
7982, 8012, 8041, 8067, 8091, 8112, 8130, 8147, 8160, 8172, 8180,
8187, 8190, 8191, 8190, 8187, 8180, 8172, 8160, 8147, 8130, 8112,
8091, 8067, 8041, 8012, 7982, 7948, 7912, 7874, 7834, 7791, 7745,
7697, 7647, 7595, 7540, 7483, 7424, 7362, 7299, 7233, 7164, 7094,
7021, 6947, 6870, 6791, 6710, 6627, 6542, 6455, 6366, 6275, 6182,
6087, 5991, 5892, 5792, 5690, 5586, 5481, 5374, 5265, 5155, 5043,
4930, 4815, 4698, 4580, 4461, 4341, 4219, 4096, 3971, 3845, 3719,
3591, 3462, 3331, 3200, 3068, 2935, 2801, 2667, 2531, 2395, 2258,
2120, 1981, 1842, 1703, 1563, 1422, 1281, 1140, 998, 856, 713,
571, 428, 285, 142, 0, -142, -285, -428, -571, -713, -856,
-998, -1140, -1281, -1422, -1563, -1703, -1842, -1981, -2120, -2258, -2395,
-2531, -2667, -2801, -2935, -3068, -3200, -3331, -3462, -3591, -3719, -3845,
-3971, -4095, -4219, -4341, -4461, -4580, -4698, -4815, -4930, -5043, -5155,
-5265, -5374, -5481, -5586, -5690, -5792, -5892, -5991, -6087, -6182, -6275,
-6366, -6455, -6542, -6627, -6710, -6791, -6870, -6947, -7021, -7094, -7164,
-7233, -7299, -7362, -7424, -7483, -7540, -7595, -7647, -7697, -7745, -7791,
-7834, -7874, -7912, -7948, -7982, -8012, -8041, -8067, -8091, -8112, -8130,
-8147, -8160, -8172, -8180, -8187, -8190, -8191, -8190, -8187, -8180, -8172,
-8160, -8147, -8130, -8112, -8091, -8067, -8041, -8012, -7982, -7948, -7912,
-7874, -7834, -7791, -7745, -7697, -7647, -7595, -7540, -7483, -7424, -7362,
-7299, -7233, -7164, -7094, -7021, -6947, -6870, -6791, -6710, -6627, -6542,
-6455, -6366, -6275, -6182, -6087, -5991, -5892, -5792, -5690, -5586, -5481,
-5374, -5265, -5155, -5043, -4930, -4815, -4698, -4580, -4461, -4341, -4219,
-4096, -3971, -3845, -3719, -3591, -3462, -3331, -3200, -3068, -2935, -2801,
-2667, -2531, -2395, -2258, -2120, -1981, -1842, -1703, -1563, -1422, -1281,
-1140, -998, -856, -713, -571, -428, -285, -142};
// Moves the pointer to the next entry and inserts |far_spectrum| and
// corresponding Q-domain in its buffer.
//
// Inputs:
// - self : Pointer to the delay estimation instance
// - far_spectrum : Pointer to the far end spectrum
// - far_q : Q-domain of far end spectrum
//
void WebRtcAecm_UpdateFarHistory(AecmCore* self,
uint16_t* far_spectrum,
int far_q) {
// Get new buffer position
self->far_history_pos++;
if (self->far_history_pos >= MAX_DELAY) {
self->far_history_pos = 0;
}
// Update Q-domain buffer
self->far_q_domains[self->far_history_pos] = far_q;
// Update far end spectrum buffer
memcpy(&(self->far_history[self->far_history_pos * PART_LEN1]), far_spectrum,
sizeof(uint16_t) * PART_LEN1);
}
// Returns a pointer to the far end spectrum aligned to current near end
// spectrum. The function WebRtc_DelayEstimatorProcessFix(...) should have been
// called before AlignedFarend(...). Otherwise, you get the pointer to the
// previous frame. The memory is only valid until the next call of
// WebRtc_DelayEstimatorProcessFix(...).
//
// Inputs:
// - self : Pointer to the AECM instance.
// - delay : Current delay estimate.
//
// Output:
// - far_q : The Q-domain of the aligned far end spectrum
//
// Return value:
// - far_spectrum : Pointer to the aligned far end spectrum
// NULL - Error
//
const uint16_t* WebRtcAecm_AlignedFarend(AecmCore* self,
int* far_q,
int delay) {
int buffer_position = 0;
RTC_DCHECK(self);
buffer_position = self->far_history_pos - delay;
// Check buffer position
if (buffer_position < 0) {
buffer_position += MAX_DELAY;
}
// Get Q-domain
*far_q = self->far_q_domains[buffer_position];
// Return far end spectrum
return &(self->far_history[buffer_position * PART_LEN1]);
}
// Declare function pointers.
CalcLinearEnergies WebRtcAecm_CalcLinearEnergies;
StoreAdaptiveChannel WebRtcAecm_StoreAdaptiveChannel;
ResetAdaptiveChannel WebRtcAecm_ResetAdaptiveChannel;
AecmCore* WebRtcAecm_CreateCore() {
// Allocate zero-filled memory.
AecmCore* aecm = static_cast<AecmCore*>(calloc(1, sizeof(AecmCore)));
aecm->farFrameBuf =
WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
if (!aecm->farFrameBuf) {
WebRtcAecm_FreeCore(aecm);
return NULL;
}
aecm->nearNoisyFrameBuf =
WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
if (!aecm->nearNoisyFrameBuf) {
WebRtcAecm_FreeCore(aecm);
return NULL;
}
aecm->nearCleanFrameBuf =
WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
if (!aecm->nearCleanFrameBuf) {
WebRtcAecm_FreeCore(aecm);
return NULL;
}
aecm->outFrameBuf =
WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(int16_t));
if (!aecm->outFrameBuf) {
WebRtcAecm_FreeCore(aecm);
return NULL;
}
aecm->delay_estimator_farend =
WebRtc_CreateDelayEstimatorFarend(PART_LEN1, MAX_DELAY);
if (aecm->delay_estimator_farend == NULL) {
WebRtcAecm_FreeCore(aecm);
return NULL;
}
aecm->delay_estimator =
WebRtc_CreateDelayEstimator(aecm->delay_estimator_farend, 0);
if (aecm->delay_estimator == NULL) {
WebRtcAecm_FreeCore(aecm);
return NULL;
}
// TODO(bjornv): Explicitly disable robust delay validation until no
// performance regression has been established. Then remove the line.
WebRtc_enable_robust_validation(aecm->delay_estimator, 0);
aecm->real_fft = WebRtcSpl_CreateRealFFT(PART_LEN_SHIFT);
if (aecm->real_fft == NULL) {
WebRtcAecm_FreeCore(aecm);
return NULL;
}
// Init some aecm pointers. 16 and 32 byte alignment is only necessary
// for Neon code currently.
aecm->xBuf = (int16_t*)(((uintptr_t)aecm->xBuf_buf + 31) & ~31);
aecm->dBufClean = (int16_t*)(((uintptr_t)aecm->dBufClean_buf + 31) & ~31);
aecm->dBufNoisy = (int16_t*)(((uintptr_t)aecm->dBufNoisy_buf + 31) & ~31);
aecm->outBuf = (int16_t*)(((uintptr_t)aecm->outBuf_buf + 15) & ~15);
aecm->channelStored =
(int16_t*)(((uintptr_t)aecm->channelStored_buf + 15) & ~15);
aecm->channelAdapt16 =
(int16_t*)(((uintptr_t)aecm->channelAdapt16_buf + 15) & ~15);
aecm->channelAdapt32 =
(int32_t*)(((uintptr_t)aecm->channelAdapt32_buf + 31) & ~31);
return aecm;
}
void WebRtcAecm_InitEchoPathCore(AecmCore* aecm, const int16_t* echo_path) {
int i = 0;
// Reset the stored channel
memcpy(aecm->channelStored, echo_path, sizeof(int16_t) * PART_LEN1);
// Reset the adapted channels
memcpy(aecm->channelAdapt16, echo_path, sizeof(int16_t) * PART_LEN1);
for (i = 0; i < PART_LEN1; i++) {
aecm->channelAdapt32[i] = (int32_t)aecm->channelAdapt16[i] << 16;
}
// Reset channel storing variables
aecm->mseAdaptOld = 1000;
aecm->mseStoredOld = 1000;
aecm->mseThreshold = WEBRTC_SPL_WORD32_MAX;
aecm->mseChannelCount = 0;
}
static void CalcLinearEnergiesC(AecmCore* aecm,
const uint16_t* far_spectrum,
int32_t* echo_est,
uint32_t* far_energy,
uint32_t* echo_energy_adapt,
uint32_t* echo_energy_stored) {
int i;
// Get energy for the delayed far end signal and estimated
// echo using both stored and adapted channels.
for (i = 0; i < PART_LEN1; i++) {
echo_est[i] =
WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
(*far_energy) += (uint32_t)(far_spectrum[i]);
*echo_energy_adapt += aecm->channelAdapt16[i] * far_spectrum[i];
(*echo_energy_stored) += (uint32_t)echo_est[i];
}
}
static void StoreAdaptiveChannelC(AecmCore* aecm,
const uint16_t* far_spectrum,
int32_t* echo_est) {
int i;
// During startup we store the channel every block.
memcpy(aecm->channelStored, aecm->channelAdapt16,
sizeof(int16_t) * PART_LEN1);
// Recalculate echo estimate
for (i = 0; i < PART_LEN; i += 4) {
echo_est[i] =
WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
echo_est[i + 1] =
WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 1], far_spectrum[i + 1]);
echo_est[i + 2] =
WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 2], far_spectrum[i + 2]);
echo_est[i + 3] =
WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i + 3], far_spectrum[i + 3]);
}
echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
}
static void ResetAdaptiveChannelC(AecmCore* aecm) {
int i;
// The stored channel has a significantly lower MSE than the adaptive one for
// two consecutive calculations. Reset the adaptive channel.
memcpy(aecm->channelAdapt16, aecm->channelStored,
sizeof(int16_t) * PART_LEN1);
// Restore the W32 channel
for (i = 0; i < PART_LEN; i += 4) {
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
aecm->channelAdapt32[i + 1] = (int32_t)aecm->channelStored[i + 1] << 16;
aecm->channelAdapt32[i + 2] = (int32_t)aecm->channelStored[i + 2] << 16;
aecm->channelAdapt32[i + 3] = (int32_t)aecm->channelStored[i + 3] << 16;
}
aecm->channelAdapt32[i] = (int32_t)aecm->channelStored[i] << 16;
}
// Initialize function pointers for ARM Neon platform.
#if defined(WEBRTC_HAS_NEON)
static void WebRtcAecm_InitNeon(void) {
WebRtcAecm_StoreAdaptiveChannel = WebRtcAecm_StoreAdaptiveChannelNeon;
WebRtcAecm_ResetAdaptiveChannel = WebRtcAecm_ResetAdaptiveChannelNeon;
WebRtcAecm_CalcLinearEnergies = WebRtcAecm_CalcLinearEnergiesNeon;
}
#endif
// Initialize function pointers for MIPS platform.
#if defined(MIPS32_LE)
static void WebRtcAecm_InitMips(void) {
#if defined(MIPS_DSP_R1_LE)
WebRtcAecm_StoreAdaptiveChannel = WebRtcAecm_StoreAdaptiveChannel_mips;
WebRtcAecm_ResetAdaptiveChannel = WebRtcAecm_ResetAdaptiveChannel_mips;
#endif
WebRtcAecm_CalcLinearEnergies = WebRtcAecm_CalcLinearEnergies_mips;
}
#endif
// WebRtcAecm_InitCore(...)
//
// This function initializes the AECM instant created with
// WebRtcAecm_CreateCore(...) Input:
// - aecm : Pointer to the Echo Suppression instance
// - samplingFreq : Sampling Frequency
//
// Output:
// - aecm : Initialized instance
//
// Return value : 0 - Ok
// -1 - Error
//
int WebRtcAecm_InitCore(AecmCore* const aecm, int samplingFreq) {
int i = 0;
int32_t tmp32 = PART_LEN1 * PART_LEN1;
int16_t tmp16 = PART_LEN1;
if (samplingFreq != 8000 && samplingFreq != 16000) {
samplingFreq = 8000;
return -1;
}
// sanity check of sampling frequency
aecm->mult = (int16_t)samplingFreq / 8000;
aecm->farBufWritePos = 0;
aecm->farBufReadPos = 0;
aecm->knownDelay = 0;
aecm->lastKnownDelay = 0;
WebRtc_InitBuffer(aecm->farFrameBuf);
WebRtc_InitBuffer(aecm->nearNoisyFrameBuf);
WebRtc_InitBuffer(aecm->nearCleanFrameBuf);
WebRtc_InitBuffer(aecm->outFrameBuf);
memset(aecm->xBuf_buf, 0, sizeof(aecm->xBuf_buf));
memset(aecm->dBufClean_buf, 0, sizeof(aecm->dBufClean_buf));
memset(aecm->dBufNoisy_buf, 0, sizeof(aecm->dBufNoisy_buf));
memset(aecm->outBuf_buf, 0, sizeof(aecm->outBuf_buf));
aecm->seed = 666;
aecm->totCount = 0;
if (WebRtc_InitDelayEstimatorFarend(aecm->delay_estimator_farend) != 0) {
return -1;
}
if (WebRtc_InitDelayEstimator(aecm->delay_estimator) != 0) {
return -1;
}
// Set far end histories to zero
memset(aecm->far_history, 0, sizeof(uint16_t) * PART_LEN1 * MAX_DELAY);
memset(aecm->far_q_domains, 0, sizeof(int) * MAX_DELAY);
aecm->far_history_pos = MAX_DELAY;
aecm->nlpFlag = 1;
aecm->fixedDelay = -1;
aecm->dfaCleanQDomain = 0;
aecm->dfaCleanQDomainOld = 0;
aecm->dfaNoisyQDomain = 0;
aecm->dfaNoisyQDomainOld = 0;
memset(aecm->nearLogEnergy, 0, sizeof(aecm->nearLogEnergy));
aecm->farLogEnergy = 0;
memset(aecm->echoAdaptLogEnergy, 0, sizeof(aecm->echoAdaptLogEnergy));
memset(aecm->echoStoredLogEnergy, 0, sizeof(aecm->echoStoredLogEnergy));
// Initialize the echo channels with a stored shape.
if (samplingFreq == 8000) {
WebRtcAecm_InitEchoPathCore(aecm, kChannelStored8kHz);
} else {
WebRtcAecm_InitEchoPathCore(aecm, kChannelStored16kHz);
}
memset(aecm->echoFilt, 0, sizeof(aecm->echoFilt));
memset(aecm->nearFilt, 0, sizeof(aecm->nearFilt));
aecm->noiseEstCtr = 0;
aecm->cngMode = AecmTrue;
memset(aecm->noiseEstTooLowCtr, 0, sizeof(aecm->noiseEstTooLowCtr));
memset(aecm->noiseEstTooHighCtr, 0, sizeof(aecm->noiseEstTooHighCtr));
// Shape the initial noise level to an approximate pink noise.
for (i = 0; i < (PART_LEN1 >> 1) - 1; i++) {
aecm->noiseEst[i] = (tmp32 << 8);
tmp16--;
tmp32 -= (int32_t)((tmp16 << 1) + 1);
}
for (; i < PART_LEN1; i++) {
aecm->noiseEst[i] = (tmp32 << 8);
}
aecm->farEnergyMin = WEBRTC_SPL_WORD16_MAX;
aecm->farEnergyMax = WEBRTC_SPL_WORD16_MIN;
aecm->farEnergyMaxMin = 0;
aecm->farEnergyVAD = FAR_ENERGY_MIN; // This prevents false speech detection
// at the beginning.
aecm->farEnergyMSE = 0;
aecm->currentVADValue = 0;
aecm->vadUpdateCount = 0;
aecm->firstVAD = 1;
aecm->startupState = 0;
aecm->supGain = SUPGAIN_DEFAULT;
aecm->supGainOld = SUPGAIN_DEFAULT;
aecm->supGainErrParamA = SUPGAIN_ERROR_PARAM_A;
aecm->supGainErrParamD = SUPGAIN_ERROR_PARAM_D;
aecm->supGainErrParamDiffAB = SUPGAIN_ERROR_PARAM_A - SUPGAIN_ERROR_PARAM_B;
aecm->supGainErrParamDiffBD = SUPGAIN_ERROR_PARAM_B - SUPGAIN_ERROR_PARAM_D;
// Assert a preprocessor definition at compile-time. It's an assumption
// used in assembly code, so check the assembly files before any change.
static_assert(PART_LEN % 16 == 0, "PART_LEN is not a multiple of 16");
// Initialize function pointers.
WebRtcAecm_CalcLinearEnergies = CalcLinearEnergiesC;
WebRtcAecm_StoreAdaptiveChannel = StoreAdaptiveChannelC;
WebRtcAecm_ResetAdaptiveChannel = ResetAdaptiveChannelC;
#if defined(WEBRTC_HAS_NEON)
WebRtcAecm_InitNeon();
#endif
#if defined(MIPS32_LE)
WebRtcAecm_InitMips();
#endif
return 0;
}
// TODO(bjornv): This function is currently not used. Add support for these
// parameters from a higher level
int WebRtcAecm_Control(AecmCore* aecm, int delay, int nlpFlag) {
aecm->nlpFlag = nlpFlag;
aecm->fixedDelay = delay;
return 0;
}
void WebRtcAecm_FreeCore(AecmCore* aecm) {
if (aecm == NULL) {
return;
}
WebRtc_FreeBuffer(aecm->farFrameBuf);
WebRtc_FreeBuffer(aecm->nearNoisyFrameBuf);
WebRtc_FreeBuffer(aecm->nearCleanFrameBuf);
WebRtc_FreeBuffer(aecm->outFrameBuf);
WebRtc_FreeDelayEstimator(aecm->delay_estimator);
WebRtc_FreeDelayEstimatorFarend(aecm->delay_estimator_farend);
WebRtcSpl_FreeRealFFT(aecm->real_fft);
free(aecm);
}
int WebRtcAecm_ProcessFrame(AecmCore* aecm,
const int16_t* farend,
const int16_t* nearendNoisy,
const int16_t* nearendClean,
int16_t* out) {
int16_t outBlock_buf[PART_LEN + 8]; // Align buffer to 8-byte boundary.
int16_t* outBlock = (int16_t*)(((uintptr_t)outBlock_buf + 15) & ~15);
int16_t farFrame[FRAME_LEN];
const int16_t* out_ptr = NULL;
int size = 0;
// Buffer the current frame.
// Fetch an older one corresponding to the delay.
WebRtcAecm_BufferFarFrame(aecm, farend, FRAME_LEN);
WebRtcAecm_FetchFarFrame(aecm, farFrame, FRAME_LEN, aecm->knownDelay);
// Buffer the synchronized far and near frames,
// to pass the smaller blocks individually.
WebRtc_WriteBuffer(aecm->farFrameBuf, farFrame, FRAME_LEN);
WebRtc_WriteBuffer(aecm->nearNoisyFrameBuf, nearendNoisy, FRAME_LEN);
if (nearendClean != NULL) {
WebRtc_WriteBuffer(aecm->nearCleanFrameBuf, nearendClean, FRAME_LEN);
}
// Process as many blocks as possible.
while (WebRtc_available_read(aecm->farFrameBuf) >= PART_LEN) {
int16_t far_block[PART_LEN];
const int16_t* far_block_ptr = NULL;
int16_t near_noisy_block[PART_LEN];
const int16_t* near_noisy_block_ptr = NULL;
WebRtc_ReadBuffer(aecm->farFrameBuf, (void**)&far_block_ptr, far_block,
PART_LEN);
WebRtc_ReadBuffer(aecm->nearNoisyFrameBuf, (void**)&near_noisy_block_ptr,
near_noisy_block, PART_LEN);
if (nearendClean != NULL) {
int16_t near_clean_block[PART_LEN];
const int16_t* near_clean_block_ptr = NULL;
WebRtc_ReadBuffer(aecm->nearCleanFrameBuf, (void**)&near_clean_block_ptr,
near_clean_block, PART_LEN);
if (WebRtcAecm_ProcessBlock(aecm, far_block_ptr, near_noisy_block_ptr,
near_clean_block_ptr, outBlock) == -1) {
return -1;
}
} else {
if (WebRtcAecm_ProcessBlock(aecm, far_block_ptr, near_noisy_block_ptr,
NULL, outBlock) == -1) {
return -1;
}
}
WebRtc_WriteBuffer(aecm->outFrameBuf, outBlock, PART_LEN);
}
// Stuff the out buffer if we have less than a frame to output.
// This should only happen for the first frame.
size = (int)WebRtc_available_read(aecm->outFrameBuf);
if (size < FRAME_LEN) {
WebRtc_MoveReadPtr(aecm->outFrameBuf, size - FRAME_LEN);
}
// Obtain an output frame.
WebRtc_ReadBuffer(aecm->outFrameBuf, (void**)&out_ptr, out, FRAME_LEN);
if (out_ptr != out) {
// ReadBuffer() hasn't copied to |out| in this case.
memcpy(out, out_ptr, FRAME_LEN * sizeof(int16_t));
}
return 0;
}
// WebRtcAecm_AsymFilt(...)
//
// Performs asymmetric filtering.
//
// Inputs:
// - filtOld : Previous filtered value.
// - inVal : New input value.
// - stepSizePos : Step size when we have a positive contribution.
// - stepSizeNeg : Step size when we have a negative contribution.
//
// Output:
//
// Return: - Filtered value.
//
int16_t WebRtcAecm_AsymFilt(const int16_t filtOld,
const int16_t inVal,
const int16_t stepSizePos,
const int16_t stepSizeNeg) {
int16_t retVal;
if ((filtOld == WEBRTC_SPL_WORD16_MAX) | (filtOld == WEBRTC_SPL_WORD16_MIN)) {
return inVal;
}
retVal = filtOld;
if (filtOld > inVal) {
retVal -= (filtOld - inVal) >> stepSizeNeg;
} else {
retVal += (inVal - filtOld) >> stepSizePos;
}
return retVal;
}
// ExtractFractionPart(a, zeros)
//
// returns the fraction part of |a|, with |zeros| number of leading zeros, as an
// int16_t scaled to Q8. There is no sanity check of |a| in the sense that the
// number of zeros match.
static int16_t ExtractFractionPart(uint32_t a, int zeros) {
return (int16_t)(((a << zeros) & 0x7FFFFFFF) >> 23);
}
// Calculates and returns the log of |energy| in Q8. The input |energy| is
// supposed to be in Q(|q_domain|).
static int16_t LogOfEnergyInQ8(uint32_t energy, int q_domain) {
static const int16_t kLogLowValue = PART_LEN_SHIFT << 7;
int16_t log_energy_q8 = kLogLowValue;
if (energy > 0) {
int zeros = WebRtcSpl_NormU32(energy);
int16_t frac = ExtractFractionPart(energy, zeros);
// log2 of |energy| in Q8.
log_energy_q8 += ((31 - zeros) << 8) + frac - (q_domain << 8);
}
return log_energy_q8;
}
// WebRtcAecm_CalcEnergies(...)
//
// This function calculates the log of energies for nearend, farend and
// estimated echoes. There is also an update of energy decision levels, i.e.
// internal VAD.
//
//
// @param aecm [i/o] Handle of the AECM instance.
// @param far_spectrum [in] Pointer to farend spectrum.
// @param far_q [in] Q-domain of farend spectrum.
// @param nearEner [in] Near end energy for current block in
// Q(aecm->dfaQDomain).
// @param echoEst [out] Estimated echo in Q(xfa_q+RESOLUTION_CHANNEL16).
//
void WebRtcAecm_CalcEnergies(AecmCore* aecm,
const uint16_t* far_spectrum,
const int16_t far_q,
const uint32_t nearEner,
int32_t* echoEst) {
// Local variables
uint32_t tmpAdapt = 0;
uint32_t tmpStored = 0;
uint32_t tmpFar = 0;
int i;
int16_t tmp16;
int16_t increase_max_shifts = 4;
int16_t decrease_max_shifts = 11;
int16_t increase_min_shifts = 11;
int16_t decrease_min_shifts = 3;
// Get log of near end energy and store in buffer
// Shift buffer
memmove(aecm->nearLogEnergy + 1, aecm->nearLogEnergy,
sizeof(int16_t) * (MAX_BUF_LEN - 1));
// Logarithm of integrated magnitude spectrum (nearEner)
aecm->nearLogEnergy[0] = LogOfEnergyInQ8(nearEner, aecm->dfaNoisyQDomain);
WebRtcAecm_CalcLinearEnergies(aecm, far_spectrum, echoEst, &tmpFar, &tmpAdapt,
&tmpStored);
// Shift buffers
memmove(aecm->echoAdaptLogEnergy + 1, aecm->echoAdaptLogEnergy,
sizeof(int16_t) * (MAX_BUF_LEN - 1));
memmove(aecm->echoStoredLogEnergy + 1, aecm->echoStoredLogEnergy,
sizeof(int16_t) * (MAX_BUF_LEN - 1));
// Logarithm of delayed far end energy
aecm->farLogEnergy = LogOfEnergyInQ8(tmpFar, far_q);
// Logarithm of estimated echo energy through adapted channel
aecm->echoAdaptLogEnergy[0] =
LogOfEnergyInQ8(tmpAdapt, RESOLUTION_CHANNEL16 + far_q);
// Logarithm of estimated echo energy through stored channel
aecm->echoStoredLogEnergy[0] =
LogOfEnergyInQ8(tmpStored, RESOLUTION_CHANNEL16 + far_q);
// Update farend energy levels (min, max, vad, mse)
if (aecm->farLogEnergy > FAR_ENERGY_MIN) {
if (aecm->startupState == 0) {
increase_max_shifts = 2;
decrease_min_shifts = 2;
increase_min_shifts = 8;
}
aecm->farEnergyMin =
WebRtcAecm_AsymFilt(aecm->farEnergyMin, aecm->farLogEnergy,
increase_min_shifts, decrease_min_shifts);
aecm->farEnergyMax =
WebRtcAecm_AsymFilt(aecm->farEnergyMax, aecm->farLogEnergy,
increase_max_shifts, decrease_max_shifts);
aecm->farEnergyMaxMin = (aecm->farEnergyMax - aecm->farEnergyMin);
// Dynamic VAD region size
tmp16 = 2560 - aecm->farEnergyMin;
if (tmp16 > 0) {
tmp16 = (int16_t)((tmp16 * FAR_ENERGY_VAD_REGION) >> 9);
} else {
tmp16 = 0;
}
tmp16 += FAR_ENERGY_VAD_REGION;
if ((aecm->startupState == 0) | (aecm->vadUpdateCount > 1024)) {
// In startup phase or VAD update halted
aecm->farEnergyVAD = aecm->farEnergyMin + tmp16;
} else {
if (aecm->farEnergyVAD > aecm->farLogEnergy) {
aecm->farEnergyVAD +=
(aecm->farLogEnergy + tmp16 - aecm->farEnergyVAD) >> 6;
aecm->vadUpdateCount = 0;
} else {
aecm->vadUpdateCount++;
}
}
// Put MSE threshold higher than VAD
aecm->farEnergyMSE = aecm->farEnergyVAD + (1 << 8);
}
// Update VAD variables
if (aecm->farLogEnergy > aecm->farEnergyVAD) {
if ((aecm->startupState == 0) | (aecm->farEnergyMaxMin > FAR_ENERGY_DIFF)) {
// We are in startup or have significant dynamics in input speech level
aecm->currentVADValue = 1;
}
} else {
aecm->currentVADValue = 0;
}
if ((aecm->currentVADValue) && (aecm->firstVAD)) {
aecm->firstVAD = 0;
if (aecm->echoAdaptLogEnergy[0] > aecm->nearLogEnergy[0]) {
// The estimated echo has higher energy than the near end signal.
// This means that the initialization was too aggressive. Scale
// down by a factor 8
for (i = 0; i < PART_LEN1; i++) {
aecm->channelAdapt16[i] >>= 3;
}
// Compensate the adapted echo energy level accordingly.
aecm->echoAdaptLogEnergy[0] -= (3 << 8);
aecm->firstVAD = 1;
}
}
}
// WebRtcAecm_CalcStepSize(...)
//
// This function calculates the step size used in channel estimation
//
//
// @param aecm [in] Handle of the AECM instance.
// @param mu [out] (Return value) Stepsize in log2(), i.e. number of
// shifts.
//
//
int16_t WebRtcAecm_CalcStepSize(AecmCore* const aecm) {
int32_t tmp32;
int16_t tmp16;
int16_t mu = MU_MAX;
// Here we calculate the step size mu used in the
// following NLMS based Channel estimation algorithm
if (!aecm->currentVADValue) {
// Far end energy level too low, no channel update
mu = 0;
} else if (aecm->startupState > 0) {
if (aecm->farEnergyMin >= aecm->farEnergyMax) {
mu = MU_MIN;
} else {
tmp16 = (aecm->farLogEnergy - aecm->farEnergyMin);
tmp32 = tmp16 * MU_DIFF;
tmp32 = WebRtcSpl_DivW32W16(tmp32, aecm->farEnergyMaxMin);
mu = MU_MIN - 1 - (int16_t)(tmp32);
// The -1 is an alternative to rounding. This way we get a larger
// stepsize, so we in some sense compensate for truncation in NLMS
}
if (mu < MU_MAX) {
mu = MU_MAX; // Equivalent with maximum step size of 2^-MU_MAX
}
}
return mu;
}
// WebRtcAecm_UpdateChannel(...)
//
// This function performs channel estimation. NLMS and decision on channel
// storage.
//
//
// @param aecm [i/o] Handle of the AECM instance.
// @param far_spectrum [in] Absolute value of the farend signal in Q(far_q)
// @param far_q [in] Q-domain of the farend signal
// @param dfa [in] Absolute value of the nearend signal
// (Q[aecm->dfaQDomain])
// @param mu [in] NLMS step size.
// @param echoEst [i/o] Estimated echo in Q(far_q+RESOLUTION_CHANNEL16).
//
void WebRtcAecm_UpdateChannel(AecmCore* aecm,
const uint16_t* far_spectrum,
const int16_t far_q,
const uint16_t* const dfa,
const int16_t mu,
int32_t* echoEst) {
uint32_t tmpU32no1, tmpU32no2;
int32_t tmp32no1, tmp32no2;
int32_t mseStored;
int32_t mseAdapt;
int i;
int16_t zerosFar, zerosNum, zerosCh, zerosDfa;
int16_t shiftChFar, shiftNum, shift2ResChan;
int16_t tmp16no1;
int16_t xfaQ, dfaQ;
// This is the channel estimation algorithm. It is base on NLMS but has a
// variable step length, which was calculated above.
if (mu) {
for (i = 0; i < PART_LEN1; i++) {
// Determine norm of channel and farend to make sure we don't get overflow
// in multiplication
zerosCh = WebRtcSpl_NormU32(aecm->channelAdapt32[i]);
zerosFar = WebRtcSpl_NormU32((uint32_t)far_spectrum[i]);
if (zerosCh + zerosFar > 31) {
// Multiplication is safe
tmpU32no1 =
WEBRTC_SPL_UMUL_32_16(aecm->channelAdapt32[i], far_spectrum[i]);
shiftChFar = 0;
} else {
// We need to shift down before multiplication
shiftChFar = 32 - zerosCh - zerosFar;
// If zerosCh == zerosFar == 0, shiftChFar is 32. A
// right shift of 32 is undefined. To avoid that, we
// do this check.
tmpU32no1 =
rtc::dchecked_cast<uint32_t>(
shiftChFar >= 32 ? 0 : aecm->channelAdapt32[i] >> shiftChFar) *
far_spectrum[i];
}
// Determine Q-domain of numerator
zerosNum = WebRtcSpl_NormU32(tmpU32no1);
if (dfa[i]) {
zerosDfa = WebRtcSpl_NormU32((uint32_t)dfa[i]);
} else {
zerosDfa = 32;
}
tmp16no1 = zerosDfa - 2 + aecm->dfaNoisyQDomain - RESOLUTION_CHANNEL32 -
far_q + shiftChFar;
if (zerosNum > tmp16no1 + 1) {
xfaQ = tmp16no1;
dfaQ = zerosDfa - 2;
} else {
xfaQ = zerosNum - 2;
dfaQ = RESOLUTION_CHANNEL32 + far_q - aecm->dfaNoisyQDomain -
shiftChFar + xfaQ;
}
// Add in the same Q-domain
tmpU32no1 = WEBRTC_SPL_SHIFT_W32(tmpU32no1, xfaQ);
tmpU32no2 = WEBRTC_SPL_SHIFT_W32((uint32_t)dfa[i], dfaQ);
tmp32no1 = (int32_t)tmpU32no2 - (int32_t)tmpU32no1;
zerosNum = WebRtcSpl_NormW32(tmp32no1);
if ((tmp32no1) && (far_spectrum[i] > (CHANNEL_VAD << far_q))) {
//
// Update is needed
//
// This is what we would like to compute
//
// tmp32no1 = dfa[i] - (aecm->channelAdapt[i] * far_spectrum[i])
// tmp32norm = (i + 1)
// aecm->channelAdapt[i] += (2^mu) * tmp32no1
// / (tmp32norm * far_spectrum[i])
//
// Make sure we don't get overflow in multiplication.
if (zerosNum + zerosFar > 31) {
if (tmp32no1 > 0) {
tmp32no2 =
(int32_t)WEBRTC_SPL_UMUL_32_16(tmp32no1, far_spectrum[i]);
} else {
tmp32no2 =
-(int32_t)WEBRTC_SPL_UMUL_32_16(-tmp32no1, far_spectrum[i]);
}
shiftNum = 0;
} else {
shiftNum = 32 - (zerosNum + zerosFar);
if (tmp32no1 > 0) {
tmp32no2 = (tmp32no1 >> shiftNum) * far_spectrum[i];
} else {
tmp32no2 = -((-tmp32no1 >> shiftNum) * far_spectrum[i]);
}
}
// Normalize with respect to frequency bin
tmp32no2 = WebRtcSpl_DivW32W16(tmp32no2, i + 1);
// Make sure we are in the right Q-domain
shift2ResChan =
shiftNum + shiftChFar - xfaQ - mu - ((30 - zerosFar) << 1);
if (WebRtcSpl_NormW32(tmp32no2) < shift2ResChan) {
tmp32no2 = WEBRTC_SPL_WORD32_MAX;
} else {
tmp32no2 = WEBRTC_SPL_SHIFT_W32(tmp32no2, shift2ResChan);
}
aecm->channelAdapt32[i] =
WebRtcSpl_AddSatW32(aecm->channelAdapt32[i], tmp32no2);
if (aecm->channelAdapt32[i] < 0) {
// We can never have negative channel gain
aecm->channelAdapt32[i] = 0;
}
aecm->channelAdapt16[i] = (int16_t)(aecm->channelAdapt32[i] >> 16);
}
}
}
// END: Adaptive channel update
// Determine if we should store or restore the channel
if ((aecm->startupState == 0) & (aecm->currentVADValue)) {
// During startup we store the channel every block,
// and we recalculate echo estimate
WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst);
} else {
if (aecm->farLogEnergy < aecm->farEnergyMSE) {
aecm->mseChannelCount = 0;
} else {
aecm->mseChannelCount++;
}
// Enough data for validation. Store channel if we can.
if (aecm->mseChannelCount >= (MIN_MSE_COUNT + 10)) {
// We have enough data.
// Calculate MSE of "Adapt" and "Stored" versions.
// It is actually not MSE, but average absolute error.
mseStored = 0;
mseAdapt = 0;
for (i = 0; i < MIN_MSE_COUNT; i++) {
tmp32no1 = ((int32_t)aecm->echoStoredLogEnergy[i] -
(int32_t)aecm->nearLogEnergy[i]);
tmp32no2 = WEBRTC_SPL_ABS_W32(tmp32no1);
mseStored += tmp32no2;
tmp32no1 = ((int32_t)aecm->echoAdaptLogEnergy[i] -
(int32_t)aecm->nearLogEnergy[i]);
tmp32no2 = WEBRTC_SPL_ABS_W32(tmp32no1);
mseAdapt += tmp32no2;
}
if (((mseStored << MSE_RESOLUTION) < (MIN_MSE_DIFF * mseAdapt)) &
((aecm->mseStoredOld << MSE_RESOLUTION) <
(MIN_MSE_DIFF * aecm->mseAdaptOld))) {
// The stored channel has a significantly lower MSE than the adaptive
// one for two consecutive calculations. Reset the adaptive channel.
WebRtcAecm_ResetAdaptiveChannel(aecm);
} else if (((MIN_MSE_DIFF * mseStored) > (mseAdapt << MSE_RESOLUTION)) &
(mseAdapt < aecm->mseThreshold) &
(aecm->mseAdaptOld < aecm->mseThreshold)) {
// The adaptive channel has a significantly lower MSE than the stored
// one. The MSE for the adaptive channel has also been low for two
// consecutive calculations. Store the adaptive channel.
WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst);
// Update threshold
if (aecm->mseThreshold == WEBRTC_SPL_WORD32_MAX) {
aecm->mseThreshold = (mseAdapt + aecm->mseAdaptOld);
} else {
int scaled_threshold = aecm->mseThreshold * 5 / 8;
aecm->mseThreshold += ((mseAdapt - scaled_threshold) * 205) >> 8;
}
}
// Reset counter
aecm->mseChannelCount = 0;
// Store the MSE values.
aecm->mseStoredOld = mseStored;
aecm->mseAdaptOld = mseAdapt;
}
}
// END: Determine if we should store or reset channel estimate.
}
// CalcSuppressionGain(...)
//
// This function calculates the suppression gain that is used in the Wiener
// filter.
//
//
// @param aecm [i/n] Handle of the AECM instance.
// @param supGain [out] (Return value) Suppression gain with which to scale
// the noise
// level (Q14).
//
//
int16_t WebRtcAecm_CalcSuppressionGain(AecmCore* const aecm) {
int32_t tmp32no1;
int16_t supGain = SUPGAIN_DEFAULT;
int16_t tmp16no1;
int16_t dE = 0;
// Determine suppression gain used in the Wiener filter. The gain is based on
// a mix of far end energy and echo estimation error. Adjust for the far end
// signal level. A low signal level indicates no far end signal, hence we set
// the suppression gain to 0
if (!aecm->currentVADValue) {
supGain = 0;
} else {
// Adjust for possible double talk. If we have large variations in
// estimation error we likely have double talk (or poor channel).
tmp16no1 = (aecm->nearLogEnergy[0] - aecm->echoStoredLogEnergy[0] -
ENERGY_DEV_OFFSET);
dE = WEBRTC_SPL_ABS_W16(tmp16no1);
if (dE < ENERGY_DEV_TOL) {
// Likely no double talk. The better estimation, the more we can suppress
// signal. Update counters
if (dE < SUPGAIN_EPC_DT) {
tmp32no1 = aecm->supGainErrParamDiffAB * dE;
tmp32no1 += (SUPGAIN_EPC_DT >> 1);
tmp16no1 = (int16_t)WebRtcSpl_DivW32W16(tmp32no1, SUPGAIN_EPC_DT);
supGain = aecm->supGainErrParamA - tmp16no1;
} else {
tmp32no1 = aecm->supGainErrParamDiffBD * (ENERGY_DEV_TOL - dE);
tmp32no1 += ((ENERGY_DEV_TOL - SUPGAIN_EPC_DT) >> 1);
tmp16no1 = (int16_t)WebRtcSpl_DivW32W16(
tmp32no1, (ENERGY_DEV_TOL - SUPGAIN_EPC_DT));
supGain = aecm->supGainErrParamD + tmp16no1;
}
} else {
// Likely in double talk. Use default value
supGain = aecm->supGainErrParamD;
}
}
if (supGain > aecm->supGainOld) {
tmp16no1 = supGain;
} else {
tmp16no1 = aecm->supGainOld;
}
aecm->supGainOld = supGain;
if (tmp16no1 < aecm->supGain) {
aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
} else {
aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
}
// END: Update suppression gain
return aecm->supGain;
}
void WebRtcAecm_BufferFarFrame(AecmCore* const aecm,
const int16_t* const farend,
const int farLen) {
int writeLen = farLen, writePos = 0;
// Check if the write position must be wrapped
while (aecm->farBufWritePos + writeLen > FAR_BUF_LEN) {
// Write to remaining buffer space before wrapping
writeLen = FAR_BUF_LEN - aecm->farBufWritePos;
memcpy(aecm->farBuf + aecm->farBufWritePos, farend + writePos,
sizeof(int16_t) * writeLen);
aecm->farBufWritePos = 0;
writePos = writeLen;
writeLen = farLen - writeLen;
}
memcpy(aecm->farBuf + aecm->farBufWritePos, farend + writePos,
sizeof(int16_t) * writeLen);
aecm->farBufWritePos += writeLen;
}
void WebRtcAecm_FetchFarFrame(AecmCore* const aecm,
int16_t* const farend,
const int farLen,
const int knownDelay) {
int readLen = farLen;
int readPos = 0;
int delayChange = knownDelay - aecm->lastKnownDelay;
aecm->farBufReadPos -= delayChange;
// Check if delay forces a read position wrap
while (aecm->farBufReadPos < 0) {
aecm->farBufReadPos += FAR_BUF_LEN;
}
while (aecm->farBufReadPos > FAR_BUF_LEN - 1) {
aecm->farBufReadPos -= FAR_BUF_LEN;
}
aecm->lastKnownDelay = knownDelay;
// Check if read position must be wrapped
while (aecm->farBufReadPos + readLen > FAR_BUF_LEN) {
// Read from remaining buffer space before wrapping
readLen = FAR_BUF_LEN - aecm->farBufReadPos;
memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos,
sizeof(int16_t) * readLen);
aecm->farBufReadPos = 0;
readPos = readLen;
readLen = farLen - readLen;
}
memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos,
sizeof(int16_t) * readLen);
aecm->farBufReadPos += readLen;
}
} // namespace webrtc
|
{
"pile_set_name": "Github"
}
|
/* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. */
/******************************************************************************
*
* You may not use the identified files except in compliance with the Apache
* License, Version 2.0 (the "License.")
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NAME
* connectionpool.js
*
* DESCRIPTION
* Shows connection pool usage. Connection pools are recommended
* for applications that use a lot of connections for short periods.
*
* Other connection pool examples are in sessionfixup.js and webappawait.js.
* For a standalone connection example, see connect.js
*
* In some networks forced pool termination may hang unless you have
* 'disable_oob=on' in sqlnet.ora, see
* https://oracle.github.io/node-oracledb/doc/api.html#tnsadmin
*
* In production applications, set poolMin=poolMax (and poolIncrement=0)
*
* This example uses Node 8's async/await syntax.
*
*****************************************************************************/
// If you increase poolMax, you must increase UV_THREADPOOL_SIZE before Node.js
// starts its thread pool. If you set UV_THREADPOOL_SIZE too late, the value is
// ignored and the default size of 4 is used.
// process.env.UV_THREADPOOL_SIZE = 4;
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');
async function init() {
try {
// Create a connection pool which will later be accessed via the
// pool cache as the 'default' pool.
await oracledb.createPool({
user: dbConfig.user,
password: dbConfig.password,
connectString: dbConfig.connectString
// edition: 'ORA$BASE', // used for Edition Based Redefintion
// events: false, // whether to handle Oracle Database FAN and RLB events or support CQN
// externalAuth: false, // whether connections should be established using External Authentication
// homogeneous: true, // all connections in the pool have the same credentials
// poolAlias: 'default', // set an alias to allow access to the pool via a name.
// poolIncrement: 1, // only grow the pool by one connection at a time
// poolMax: 4, // maximum size of the pool. Increase UV_THREADPOOL_SIZE if you increase poolMax
// poolMin: 0, // start with no connections; let the pool shrink completely
// poolPingInterval: 60, // check aliveness of connection if idle in the pool for 60 seconds
// poolTimeout: 60, // terminate connections that are idle in the pool for 60 seconds
// queueMax: 500, // don't allow more than 500 unsatisfied getConnection() calls in the pool queue
// queueTimeout: 60000, // terminate getConnection() calls queued for longer than 60000 milliseconds
// sessionCallback: myFunction, // function invoked for brand new connections or by a connection tag mismatch
// stmtCacheSize: 30, // number of statements that are cached in the statement cache of each connection
// _enableStats: false // record pool usage statistics that can be output with pool._logStats()
});
console.log('Connection pool started');
// Now the pool is running, it can be used
await dostuff();
} catch (err) {
console.error('init() error: ' + err.message);
} finally {
await closePoolAndExit();
}
}
async function dostuff() {
let connection;
try {
// Get a connection from the default pool
connection = await oracledb.getConnection();
const sql = `SELECT sysdate FROM dual WHERE :b = 1`;
const binds = [1];
const options = { outFormat: oracledb.OUT_FORMAT_OBJECT };
const result = await connection.execute(sql, binds, options);
console.log(result);
// oracledb.getPool()._logStats(); // show pool statistics. _enableStats must be true
} catch (err) {
console.error(err);
} finally {
if (connection) {
try {
// Put the connection back in the pool
await connection.close();
} catch (err) {
console.error(err);
}
}
}
}
async function closePoolAndExit() {
console.log('\nTerminating');
try {
// Get the pool from the pool cache and close it when no
// connections are in use, or force it closed after 10 seconds.
// If this hangs, you may need DISABLE_OOB=ON in a sqlnet.ora file.
// This setting should not be needed if both Oracle Client and Oracle
// Database are 19c (or later).
await oracledb.getPool().close(10);
console.log('Pool closed');
process.exit(0);
} catch(err) {
console.error(err.message);
process.exit(1);
}
}
process
.once('SIGTERM', closePoolAndExit)
.once('SIGINT', closePoolAndExit);
init();
|
{
"pile_set_name": "Github"
}
|
// Use explicit /index.js to help browserify negociation in require '/lib/http-proxy' (!)
var ProxyServer = require('./http-proxy/index.js').Server;
/**
* Creates the proxy server.
*
* Examples:
*
* httpProxy.createProxyServer({ .. }, 8000)
* // => '{ web: [Function], ws: [Function] ... }'
*
* @param {Object} Options Config object passed to the proxy
*
* @return {Object} Proxy Proxy object with handlers for `ws` and `web` requests
*
* @api public
*/
function createProxyServer(options) {
/*
* `options` is needed and it must have the following layout:
*
* {
* target : <url string to be parsed with the url module>
* forward: <url string to be parsed with the url module>
* agent : <object to be passed to http(s).request>
* ssl : <object to be passed to https.createServer()>
* ws : <true/false, if you want to proxy websockets>
* xfwd : <true/false, adds x-forward headers>
* secure : <true/false, verify SSL certificate>
* toProxy: <true/false, explicitly specify if we are proxying to another proxy>
* prependPath: <true/false, Default: true - specify whether you want to prepend the target's path to the proxy path>
* ignorePath: <true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request>
* localAddress : <Local interface string to bind for outgoing connections>
* changeOrigin: <true/false, Default: false - changes the origin of the host header to the target URL>
* preserveHeaderKeyCase: <true/false, Default: false - specify whether you want to keep letter case of response header key >
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
* hostRewrite: rewrites the location hostname on (301/302/307/308) redirects, Default: null.
* autoRewrite: rewrites the location host/port on (301/302/307/308) redirects based on requested host/port. Default: false.
* protocolRewrite: rewrites the location protocol on (301/302/307/308) redirects to 'http' or 'https'. Default: null.
* }
*
* NOTE: `options.ws` and `options.ssl` are optional.
* `options.target and `options.forward` cannot be
* both missing
* }
*/
return new ProxyServer(options);
}
ProxyServer.createProxyServer = createProxyServer;
ProxyServer.createServer = createProxyServer;
ProxyServer.createProxy = createProxyServer;
/**
* Export the proxy "Server" as the main export.
*/
module.exports = ProxyServer;
|
{
"pile_set_name": "Github"
}
|
(
function () {
angular
.module("multiSigWeb")
.directive('convertToNumber', function () {
return {
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
ngModel.$parsers.push(function (val) {
return val !== null ? parseInt(val, 10) : null;
});
ngModel.$formatters.push(function (val) {
return val !== null ? '' + val : null;
});
}
};
})
.directive('disabledIfNoAccounts', function (Web3Service) {
return {
link: function (scope, element, attrs) {
scope.$watch(function () {
if (Web3Service.coinbase) {
element.removeAttr('disabled');
}
else {
attrs.$set('disabled', 'disabled');
}
});
}
};
})
.directive('disabledIfNoAccountsOrWalletAvailable', function (Web3Service, Wallet) {
// Disables an element when no accounts are set up
// or a wallet was not created on the current network
return {
link: function (scope, element, attrs) {
scope.$watch(
function () {
return scope.wallet.maxWithdraw;
},
function () {
// Wallet.initParams().then(
// function () {
if (scope.wallet && scope.wallet.isOnChain == true) {
element.removeAttr('disabled');
}
else if (attrs.disabledIfNoAccountsOrWalletAvailable) {
var address = attrs.disabledIfNoAccountsOrWalletAvailable;
Wallet.getOwners(
address,
function (e, owners) {
if (!e && owners.length > 0 && Web3Service.coinbase) {
element.removeAttr('disabled');
}
else {
attrs.$set('disabled', 'disabled');
}
}
).call();
}
else {
scope.$watch(function () {
if (Web3Service.coinbase) {
element.removeAttr('disabled');
}
else {
attrs.$set('disabled', 'disabled');
}
});
}
// }
// );
}
);
}
};
})
.directive('showHideByConnectivity', function (Connection) {
return {
link: function (scope, element, attrs) {
/*
* The HTML is shown by considering the 'showHideByConnectivity'
* attribute and looking up at the Connection.isConnected variable.
* Admitted attributes are 'online|offline'.
*/
scope.$watch(function () {
if (!Connection.isConnected && attrs.showHideByConnectivity == 'online') {
element.css("display", "none");
}
else if (Connection.isConnected && attrs.showHideByConnectivity == 'offline') {
element.css("display", "none");
}
else {
element.css("display", "");
}
});
}
};
})
.directive('showHideByFactoryStatus', function (Web3Service, Connection) {
return {
link: function (scope, element, attrs) {
/*
* The HTML is shown by considering the 'showHideByConnectivity'
* attribute and looking up at the Connection.isConnected variable.
* Admitted attributes are 'online|offline'.
*/
scope.$watch(function () {
return txDefault.walletFactoryAddress;
},
function () {
var address = Object.assign({}, txDefault, JSON.parse(localStorage.getItem("userConfig"))).walletFactoryAddress;
if (address && Web3Service.web3.isAddress(address)) {
Web3Service.web3.eth.getCode(address, function (e, factory) {
if (!Connection.isConnected) {
element.css("display", "none");
}
else if (factory && factory.length > 100) {
if (attrs.showHideByFactoryStatus == 'online') {
element.css("display", "");
}
else {
element.css("display", "none");
}
}
else {
if (attrs.showHideByFactoryStatus == 'offline') {
element.css("display", "");
}
else {
element.css("display", "none");
}
}
});
}
else {
if (attrs.showHideByFactoryStatus == 'online') {
element.css("display", "none");
}
}
});
}
};
})
.directive('valueOrDashByConnectivity', function (Connection) {
return {
link: function (scope, element, attrs) {
/*
* The value is shown by considering the
* Connection.isConnected variable.
*/
scope.$watch(function () {
if (scope.wallet && !scope.wallet.isOnChain) {
element.html("");
}
else if (!Connection.isConnected) {
element.html("-");
}
else {
element.html(attrs.valueOrDashByConnectivity);
}
});
}
};
})
.directive('alertEventDescription', function () {
return {
link: function (scope, element, attrs) {
if (attrs.alertEventDescription == 'Submission') {
element.html('Submission: a new multisig transaction is submitted');
}
else if (attrs.alertEventDescription == 'Confirmation') {
element.html('Confirmation: a multisig transaction is confirmed');
}
else if (attrs.alertEventDescription == 'Revocation') {
element.html('Revocation: a multisig transaction confirmation is revoked');
}
else if (attrs.alertEventDescription == 'Execution') {
element.html('Execution: a multisig transaction is executed successfully');
}
else if (attrs.alertEventDescription == 'Execution Failure') {
element.html('Execution failure: a multisig transaction is executed unsuccessfully');
}
else if (attrs.alertEventDescription == 'Deposit') {
element.html('Deposit: an ether deposit was made');
}
else if (attrs.alertEventDescription == 'Owner Addition') {
element.html('Owner addition: a new multisgi owner was added');
}
else if (attrs.alertEventDescription == 'Owner Removal') {
element.html('Owner removal: a multisig owner was removed');
}
else if (attrs.alertEventDescription == 'Requirement Change') {
element.html('Requirement change: number of required confirmations was changed');
}
else if (attrs.alertEventDescription == 'Daily Limit Change') {
element.html('Daily limit change: amount for daily withdrawal was changed');
}
else {
element.html(attrs.alertEventDescription);
}
}
};
})
.directive('match', function ($parse) {
return {
require: 'ngModel',
link: function (scope, elem, attrs, ctrl) {
scope.$watch(function () {
return $parse(attrs.match)(scope) === ctrl.$modelValue;
}, function (currentValue) {
ctrl.$setValidity('mismatch', currentValue);
});
}
};
})
.directive('providerList', function ($parse) {
return {
restrict: 'E',
template: '<select class="form-control" name="web3-wallet" id="web3-wallet"' +
'ng-options="model.value for model in items track by model.name"' +
'ng-model="selectedItem"' +
'ng-change="changeEvent()"></select>',
scope: {
defaultItem: "=",
changeEvent: "@",
selectedItem: "="
},
replace: true,
link: function (scope, element, attrs) {
// Filter items
scope.items = [];
if (isElectron) {
scope.items.push(
{
name: 'ledger',
value: 'Ledger Wallet',
},
{
name: 'lightwallet',
value: 'Light Wallet',
},
{
name: 'remotenode',
value: 'Remote node',
},
{
name: "trezor",
value: "Trezor"
}
);
}
else {
scope.items.push(
{
name: 'injected',
value: 'Default (MetaMask, Mist, Parity ...)',
},
{
name: 'ledger',
value: 'Ledger Wallet',
},
{
name: 'remotenode',
value: 'Remote node',
},
{
name: "trezor",
value: "Trezor"
}
);
}
if (scope.defaultItem) {
for (var x in scope.items) {
if (scope.items[x].name == scope.defaultItem) {
scope.selectedItem = scope.items[x];
break;
}
}
}
else {
scope.selectedItem = null;
}
scope.changeEvent = function () {
scope.$parent.config.wallet = scope.selectedItem.name;
if (attrs.onChangeFunction !== undefined) {
var func = scope.$parent[attrs.onChangeFunction];
func();
}
};
}
};
})
.directive('editableSelect', function () {
return {
restrict: 'E',
require: '^ngModel',
scope: {
ngModel: '=',
options: '=',
other: '@'
},
replace: true,
templateUrl: function (element, attrs) {
return 'partials/' + attrs.templateUrl;
},
link: function (scope, element, attrs) {
function isDisabled() {
if (scope.ngModel) {
return scope.ngModel.name == scope.other ? false : true;
}
return true;
}
scope.isDisabled = isDisabled();
// Wallet factory contract
if (attrs.type && attrs.type == 'contract-address') {
scope.click = function (option) {
if (option.address == undefined) {
scope.ngModel = { name: option, address: option };
}
else {
scope.ngModel = option;
}
scope.isDisabled = !scope.other || scope.other !== option;
if (!scope.isDisabled) {
element[0].querySelector('.editable-select').focus();
}
};
var unwatch = scope.$watch('ngModel', function (val) {
scope.isDisabled = isDisabled();
if (!scope.isDisabled) {
if (val.address) {
scope.other = { 'name': val.name, 'address': val.address };
}
else {
scope.other = { 'name': val, 'address': val };
}
}
});
scope.$on('$destroy', unwatch);
}
else {
scope.click = function (option) {
if (option.url == undefined) {
scope.ngModel = { name: option, url: option };
}
else {
scope.ngModel = option;
}
scope.isDisabled = !scope.other || scope.other !== option;
if (!scope.isDisabled) {
element[0].querySelector('.editable-select').focus();
}
if (attrs.onChangeFunction !== undefined) {
var func = scope.$parent[attrs.onChangeFunction];
func();
}
};
var unwatch = scope.$watch('ngModel', function (val) {
scope.isDisabled = isDisabled();
if (!scope.isDisabled) {
if (val.url) {
scope.other = { 'name': val.name, 'url': val.url };
}
else {
scope.other = { 'name': val, 'url': val };
}
}
});
scope.$on('$destroy', unwatch);
}
}
};
})
.directive('callFuncOnKeyEnter', function () {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
var keyCode = event.which || event.keyCode;
// If enter key is pressed
if (keyCode === 13 && element.val().length >= attrs.ngMinlength) {
scope.$apply(function () {
// Evaluate the expression
scope.$eval(attrs.callFuncOnKeyEnter);
});
event.preventDefault();
}
});
};
})
.directive('disabledIfInvalidAddress', function (Web3Service) {
// Disables an element until the ng-model passed to
// the directive is valid
return {
link: function (scope, element, attrs) {
scope.ngDisabled = attrs.ngDisabled;
var isAddressValid = false;
var unwatchAddress = scope.$watch(function () {
return attrs.disabledIfInvalidAddress;
},
function () {
// Do more checks
if (attrs.disabledIfInvalidAddress.length < 42) {
isAddressValid = false;
}
// https://web3js.readthedocs.io/en/1.0/web3-utils.html#isaddress
else if (Web3Service.web3.isAddress(attrs.disabledIfInvalidAddress)
|| Web3Service.web3.isAddress(Web3Service.toChecksumAddress(attrs.disabledIfInvalidAddress))) {
// Address valid (0x0........)
isAddressValid = true;
}
else {
isAddressValid = false;
}
// Set form as invalid
if (!isAddressValid) {
scope.form.$invalid = true;
}
}
);
var unwatchForm = scope.$watch(function () {
return scope.form.$invalid;
},
function () {
// Set form as invalid
if (!isAddressValid) {
scope.form.$invalid = true;
}
}
);
scope.$on('$destroy', unwatchAddress);
scope.$on('$destroy', unwatchForm);
}
};
});
}
)();
|
{
"pile_set_name": "Github"
}
|
package skiplist
import (
"math/rand"
"sync"
utils "./utils"
)
const (
kMaxHeight = 12
kBranching = 4
)
type SkipList struct {
maxHeight int
head *Node
comparator utils.Comparator // 比较器 函数
mu sync.RWMutex
}
func New(comp utils.Comparator) *SkipList {
var skiplist SkipList
skiplist.head = newNode(nil, kMaxHeight)
skiplist.maxHeight = 1
skiplist.comparator = comp
return &skiplist
}
func (list *SkipList) Insert(key interface{}) {
list.mu.Lock()
defer list.mu.Unlock()
_, prev := list.findGreaterOrEqual(key)
height := list.randomHeight()
if height > list.maxHeight {
for i := list.maxHeight; i < height; i++ {
prev[i] = list.head
}
list.maxHeight = height
}
x := newNode(key, height)
for i := 0; i < height; i++ {
x.setNext(i, prev[i].getNext(i))
prev[i].setNext(i, x)
}
}
func (list *SkipList) Contains(key interface{}) bool {
list.mu.RLock()
defer list.mu.RUnlock()
x, _ := list.findGreaterOrEqual(key)
if x != nil && list.comparator(x.key, key) == 0 {
return true
}
return false
}
func (list *SkipList) NewIterator() *Iterator {
var it Iterator
it.list = list
return &it
}
func (list *SkipList) randomHeight() int {
height := 1
for height < kMaxHeight && (rand.Intn(kBranching) == 0) {
height++
}
return height
}
func (list *SkipList) keyIsAfterNode(key interface{}, n *Node) bool {
return (n != nil) && (list.comparator(n.key, key) < 0)
}
func (list *SkipList) findGreaterOrEqual(key interface{}) (*Node, [kMaxHeight]*Node) {
var prev [kMaxHeight]*Node
x := list.head
level := list.maxHeight - 1
for true {
next := x.getNext(level)
if list.keyIsAfterNode(key, next) {
x = next
} else {
prev[level] = x
if level == 0 {
return next, prev
} else {
level--
}
}
}
return nil, prev
}
func (list *SkipList) findLessThan(key interface{}) *Node {
x := list.head
level := list.maxHeight - 1
for true {
next := x.getNext(level)
if next == nil || list.comparator(next.key, key) >= 0 {
if level == 0 {
return x
} else {
level--
}
} else {
x = next
}
}
return nil
}
func (list *SkipList) findlast() *Node {
x := list.head
level := list.maxHeight - 1
for true {
next := x.getNext(level)
if next == nil {
if level == 0 {
return x
} else {
level--
}
} else {
x = next
}
}
return nil
}
|
{
"pile_set_name": "Github"
}
|
- name: destroy iri network
docker_network:
name: "{{ iri_net_name }}"
state: absent
force: yes
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNet.OData.Query
{
/// <summary>
/// Represents an <see cref="Attribute"/> that can be placed on a property to specify that
/// the property cannot be used in the $orderby OData query option.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public sealed class NotSortableAttribute : Attribute
{
}
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title></title>
<link rel="Stylesheet" href="../css/analysis.css" />
<script type="text/javascript">
function init() {
if (window.location.hash) {
var parentDiv, nodes, i, helpInfo, helpId, helpInfoArr, helpEnvFilter, envContent, hideEnvClass, hideNodes;
helpInfo = window.location.hash.substring(1);
if(helpInfo.indexOf("-")) {
helpInfoArr = helpInfo.split("-");
helpId = helpInfoArr[0];
helpEnvFilter = helpInfoArr[1];
}
else {
helpId = helpInfo;
}
parentDiv = document.getElementById("topics");
nodes = parentDiv.children;
hideEnvClass = (helpEnvFilter === "OnlineOnly"? "PortalOnly": "OnlineOnly");
if(document.getElementsByClassName) {
hideNodes = document.getElementsByClassName(hideEnvClass);
}
else {
hideNodes = document.querySelectorAll(hideEnvClass);
}
for(i=0; i < nodes.length; i++) {
if(nodes[i].id !== helpId) {
nodes[i].style.display ="none";
}
}
for(i=0; i < hideNodes.length; i++) {
hideNodes[i].style.display ="none";
}
}
}
</script>
</head>
<body onload="init()">
<div id="topics">
<div id="toolDescription" class="largesize">
<h2>Data bijvoegen</h2><p/>
<h2><img src="../images/GUID-8C95EAE0-904A-42C4-8C3D-303E74FD6DD7-web.png" alt="Gegevens bijvoegen workflowdiagram"></h2>
<hr/>
<p>Deze tool voegt data toe aan een bestaande gehoste objectlaag. Data bijvoegen past de originele invoerlaag aan en genereert geen nieuwe uitvoerlaag. U kunt de velden koppelen op basis van de veldnaam en he veldtype of u kunt geavanceerdere matchingmethodes toepassen.
</p>
<p>Hier volgen enkele voorbeelden:
<ul>
<li>U bent werknemer bij een grote verzekeringsmaatschappij die maandelijks een verkoopverslag genereert. Voor uw jaarverslag moeten de maandelijkse gegevens worden verzameld voor analyse. Om een verkoopanalyse te starten, kunt u gebruik maken van Data bijvoegen om uw AnnualReport_2018 laag bij te werken zodra uw maandelijkse cijfers beschikbaar zijn. Aangezien u weet dat uw organisatie elke maand een consistent schema bijhoudt, kunt u de standaardmethode voor veldmapping gebruiken om efficiënt functies toe te voegen op basis van veldnaam en -type.
</li>
<li>Tien milieugroeperingen verzamelen elk honderdduizenden klimaatmetingen binnen hun jurisdictie. Deze organisaties willen hun gegevens verzamelen om regionale en mondiale patronen beter te begrijpen. Elke organisatie bepaalt het schema voor hun dataset. Ze specificeerden elk verschillende veldnamen voor temperatuur- en windsnelheidsdata. Gezien de verschillen in veldnamen tussen datasets, kan veld mapping worden ingezet om te specificeren hoe temperatuur- en windsnelheidsmetingen aan hun respectievelijke velden kunnen worden bijgevoegd.
</li>
</ul>
</p>
</div>
<!--Parameter divs for each param-->
<div id="inputLayer">
<div><h2>Kies laag om aan toe te voegen</h2></div>
<hr/>
<div>
<p>De tabel-, punt-, lijn- of polygoonkenmerken waaraan de gegevens worden toegevoegd.
</p>
<table>
<tr><td colspan="3"><hr size="1" noshade="noshade"></td></tr>
<tr><td valign="baseline"><img src="../images/caution.png"></td><td valign="baseline"><h2>Caution: </h2></td>
<td valign="baseline">
<p>Tijdens het uitvoeren van de tool wordt de laag, waar u aan toegevoegd, gewijzigd. Voordat u verder gaat, moet u controleren of u deze laag wilt wijzigen.
</p>
</td></tr>
<tr><td colspan="3"><hr size="1" noshade="noshade"></td></tr>
</table>
<p>Naast het kiezen van een laag van uw kaart, kunt u kiezen voor <b>Analyselaag kiezen</b> onderaan de keuzelijst om naar uw inhoud voor een gehoste objectlaag te bladeren.
</p>
</div>
</div>
<div id="appendLayer">
<div><h2>Kies laag om toe te voegen</h2></div>
<hr/>
<div>
<p>De tabel-, punt-, lijn- of polygoonkenmerken om aan de invoerlaag toe te voegen.
</p>
<p>Naast het kiezen van een laag van uw kaart, kunt u kiezen voor <b>Analyselaag kiezen</b> onderaan de keuzelijst om in uw inhoud te zoeken naar een big data file share-dataset of objectlaag. U kunt optioneel een filter toepassen op uw invoerlaag of een selectie toepassen op gehoste lagen die aan uw kaart zijn toegevoegd. Filters en selecties worden alleen toegepast voor analyse.
</p>
</div>
</div>
<div id="filter">
<div><h2>Voeg alle objecten toe of definieer een subset (optioneel)</h2></div>
<hr/>
<div>
<p>Geeft aan welke kenmerken moeten worden toegevoegd. Deze parameter is optioneel.
</p>
</div>
</div>
<div id="fieldMapping">
<div><h2>Kies hoe velden toe te voegen (optioneel)</h2></div>
<hr/>
<div>
<p>Specificeert hoe de toevoegingslaagvelden worden toegevoegd aan de invoerlaag. Standaard worden alle overeenstemmende invoervelden en invoervelden toegevoegd. Velden komen overeen als ze dezelfde veldnaam en hetzelfde veldtype hebben. Optioneel kunt u kiezen hoe velden worden gematcht, of Arcade-expressies berekenen om veldwaarden in te vullen.
</p>
<p>U hebt bijvoorbeeld een invoerlaag met <i>field_number</i>, <i>field_string</i>, <i>date_field</i>, <i>unused_field</i> velden en een toevoegingslaag met <i>field_string</i>, <i>field_number</i>, en <i>MY_DATE_FIELD</i> velden.
<ul>
<li>Standaard koppelt de tool <i>field_number</i> in de invoerlaag aan <i>field_number</i> in de toevoegingslaag en <i>field_string</i> in de invoerlaag naar <i>field_string</i> in de toevoegingslaag.
</li>
<li>De invoerlaag <i>date_field</i> en <i>unused_field</i> velden worden standaard ingevuld met waarden van <i>null</i> omdat ze geen overeenkomende laag in de toevoegingslaag hebben.
</li>
<li>U kunt optioneel waardes toevoegen aan velden die standaard niet automatisch gekoppeld zijn. Bijvoorbeeld, <i>date_field</i> in de invoerlaag kan worden gekoppeld aan het toevoegingsveld <i>MY_DATE_FIELD</i>. Gebruik hiervoor het volgkeuzemenu naast <i>date_field</i> in de eerste kolom en selecteer <i>MY_DATE_FIELD</i> uit het volgkeuzemenu in de tweede kolom.
</li>
</ul>
Nog een ander voorbeeld, een invoerlaag heeft numerieke velden <i>value_1</i>, <i>value_2</i>, <i>value_3</i>, and <i>my_Average</i> en een toevoegingslaag heeft numerieke velden <i>value_1</i>, <i>value_2</i> en <i>value_3</i>.
<ul>
<li>Standaard wordt <i>value_1</i>, <i>value_2</i>, and <i>value_3</i> gekoppeld en toegevoegd.
</li>
<li>Naast standaardgedrag kunnen waarden worden berekend voor het <i>my_Average</i> veld. Doe dit met behulp van meerdere velden en wiskundige handelingen door het selecteren van het <b>Expressie</b> volgkeuzemenu in de kolom naast <i>my_Average</i> en het opbouwen van een aangepaste Arcade-expressie, zoals <pre>average($feature["value_1"] + $feature["value_2"] + $feature["value_3"])</pre>.
</li>
</ul>
</p>
</div>
</div>
</div>
</html>
|
{
"pile_set_name": "Github"
}
|
define(function () {
// Polish
var charsWords = ['znak', 'znaki', 'znaków'];
var itemsWords = ['element', 'elementy', 'elementów'];
var pluralWord = function pluralWord(numberOfChars, words) {
if (numberOfChars === 1) {
return words[0];
} else if (numberOfChars > 1 && numberOfChars <= 4) {
return words[1];
} else if (numberOfChars >= 5) {
return words[2];
}
};
return {
errorLoading: function () {
return 'Nie można załadować wyników.';
},
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
return 'Usuń ' + overChars + ' ' + pluralWord(overChars, charsWords);
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
return 'Podaj przynajmniej ' + remainingChars + ' ' +
pluralWord(remainingChars, charsWords);
},
loadingMore: function () {
return 'Trwa ładowanie…';
},
maximumSelected: function (args) {
return 'Możesz zaznaczyć tylko ' + args.maximum + ' ' +
pluralWord(args.maximum, itemsWords);
},
noResults: function () {
return 'Brak wyników';
},
searching: function () {
return 'Trwa wyszukiwanie…';
}
};
});
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.