text
stringlengths 2
100k
| meta
dict |
---|---|
// docs/update.asciidoc:153
[source, python]
----
resp = client.update(
index="test",
id="1",
body={"script": "ctx._source.new_field = 'value_of_new_field'"},
)
print(resp)
---- | {
"pile_set_name": "Github"
} |
/**
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
*
* http://qunitjs.com
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-testrunner-toolbar label {
display: inline-block;
padding: 0 .5em 0 .1em;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
overflow: hidden;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
#qunit-modulefilter-container {
float: right;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
display: none;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests li a {
padding: 0.5em;
color: #c2ccd1;
text-decoration: none;
}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
}
#qunit-tests li .runtime {
float: right;
font-size: smaller;
}
.qunit-assert-list {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.qunit-collapsed {
display: none;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
padding: 5px;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #3c510c;
background-color: #fff;
border-left: 10px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 10px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail { background-color: #EE5757; }
/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-bottom: 1px solid white;
}
#qunit-testresult .module-name {
font-weight: bold;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
width: 1000px;
height: 1000px;
}
| {
"pile_set_name": "Github"
} |
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM12,11L3,11L3,9h9v2zM12,7L3,7L3,5h9v2z"/>
</vector>
| {
"pile_set_name": "Github"
} |
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Server\Exception;
class BadMethodCallException
extends \BadMethodCallException
implements ExceptionInterface
{}
| {
"pile_set_name": "Github"
} |
638060586258038784 michael jackson 0
638061181823922176 michael jackson 1
638083821364244480 michael jackson 0
638091450132078593 michael jackson 1
638125563790557184 michael jackson 1
638130776727535617 michael jackson 2
638134980862828544 michael jackson 1
638156605448695808 michael jackson 2
638162155250954241 michael jackson 1
638163324752891908 michael jackson 0
638166789302689792 michael jackson 0
638180579662561281 michael jackson 1
638180878594785280 michael jackson 1
638181456225927168 michael jackson 1
638185679948660736 michael jackson 1
638201443044868096 michael jackson 1
638201499118497792 michael jackson 1
638209380983414784 michael jackson 1
638217759826964481 michael jackson 1
638248645104640000 michael jackson 1
638299266876854273 michael jackson 1
638326005803843584 michael jackson 2
638334082850488320 michael jackson 1
638342682117570560 michael jackson 1
638362973837332481 michael jackson 1
638373842138722304 michael jackson 1
638376878168903681 michael jackson 1
638423648492220417 michael jackson 1
638425960111546368 michael jackson 0
638433904131641344 michael jackson 1
638491441988304896 michael jackson 1
638502229779939328 michael jackson -1
638528170455511040 michael jackson 1
638576849354813440 michael jackson 1
638594008437104640 michael jackson 1
638667363353669633 michael jackson 1
638759499260674048 michael jackson 1
638818244434923520 michael jackson 1
638850460653363200 michael jackson 1
638879186698919936 michael jackson 1
638995368026468352 michael jackson 1
639027930790797312 michael jackson 0
639068719524634625 michael jackson 1
639089888684580864 michael jackson 1
639090903169142786 michael jackson 1
639105721896865792 michael jackson 1
639131453649985541 michael jackson 0
639216221825671168 michael jackson 1
639297029189988352 michael jackson 1
639372766198779904 michael jackson 1
639395430472790016 michael jackson 1
639404422204813312 michael jackson 1
639404791827963904 michael jackson 0
639432600885587969 michael jackson 1
639500177116692480 michael jackson 0
639520546552684545 michael jackson 1
639534483352473601 michael jackson 1
639644271847546881 michael jackson 1
639671487310360577 michael jackson 1
639785510177632256 michael jackson 1
639904246582878210 michael jackson 1
639956939066208256 michael jackson 0
640033330285576193 michael jackson 0
640047532370997249 michael jackson 1
640146715182436352 michael jackson 1
640176482954952704 michael jackson 1
640177161035513856 michael jackson 1
640179617660178432 michael jackson 1
640215120191164416 michael jackson 1
640294027594723329 michael jackson 1
640313576633167872 michael jackson 1
640360829062221824 michael jackson 1
640390484704137216 michael jackson 1
640536320402661376 michael jackson 0
640545706525204480 michael jackson 1
640548889410539520 michael jackson 1
640553062290059264 michael jackson 2
640704989363462144 michael jackson 1
640745408810119168 michael jackson 1
640748606958383104 michael jackson 2
640755399042449408 michael jackson 0
640767846121910272 michael jackson 0
640774662033534976 michael jackson 0
640876146003828736 michael jackson 0
640893263134588928 michael jackson 0
640961765208137728 michael jackson 1
640980516871774210 michael jackson 1
641016681234628612 michael jackson 1
641028806795509760 michael jackson 1
641104014172524545 michael jackson 0
641178206863785984 michael jackson 0
641188392407928832 michael jackson 0
641221720326688768 michael jackson 1
641252626802286594 michael jackson 0
641325272181178368 michael jackson 0
641338433663688704 michael jackson 1
641343551620538368 michael jackson 0
641359104229806080 michael jackson 0
641414078519463936 michael jackson 1
641463488037031936 michael jackson 1
620657248138862593 michelle obama 1
620726887162191872 michelle obama 1
620738772179619840 michelle obama 1
621027317045985280 michelle obama 1
621055603524284416 michelle obama -1
621445240298168320 michelle obama 0
621553727334428672 michelle obama -2
621816893649874944 michelle obama 0
622066414308954112 michelle obama 0
622070904265265153 michelle obama 1
622211557213257728 michelle obama 1
622396313456541696 michelle obama -1
622500637259857920 michelle obama 0
622865582702989312 michelle obama 0
623333661035753472 michelle obama 0
623457980931903492 michelle obama -1
623589519019900929 michelle obama 1
623617946603155457 michelle obama 1
623661305367375873 michelle obama 0
623737675103645696 michelle obama 0
623833473355100161 michelle obama 0
623959800716636160 michelle obama 1
624012076281909248 michelle obama 0
624022734792716288 michelle obama 1
624029200371073025 michelle obama 1
624122694691196928 michelle obama 0
624169794883858432 michelle obama 1
624246879493206016 michelle obama 1
624602875654582272 michelle obama 1
624746080446599168 michelle obama -1
624747559102320641 michelle obama 1
625001787460820992 michelle obama 2
625046763297198080 michelle obama 1
625191974753189888 michelle obama 2
625325655161352192 michelle obama 1
625394044512956416 michelle obama 1
625450575140900865 michelle obama 0
625666682263052288 michelle obama 1
625765855142522881 michelle obama 0
625795194819072000 michelle obama -2
625992870026178560 michelle obama 1
626037203047575552 michelle obama 0
626270343397830656 michelle obama 1
626528275741839360 michelle obama 1
626942343363608576 michelle obama 1
626959574986174464 michelle obama 0
627603448981258240 michelle obama 1
627613043703181312 michelle obama 1
628004511420928000 michelle obama 0
628324875627810816 michelle obama 2
628392836715675648 michelle obama 0
628549451188162560 michelle obama 0
628572003939647488 michelle obama -1
628947344793309184 michelle obama -1
629128080619999236 michelle obama 1
629135660478107648 michelle obama 1
629506604103172097 michelle obama 1
629826755851849728 michelle obama 1
630095382018662400 michelle obama 0
630390658721820672 michelle obama 2
630531805246980096 michelle obama -1
630807040634580992 michelle obama 0
630820269850931200 michelle obama 0
631240761619550208 michelle obama -1
631533223529459712 michelle obama 2
631758201663295488 michelle obama -1
632073060791808000 michelle obama 1
632442122822664192 michelle obama 1
632960600923090944 michelle obama 1
633071290581172224 michelle obama 1
633206249300099072 michelle obama 1
633475751887638528 michelle obama 0
633748998436728837 michelle obama 1
633780404777041925 michelle obama 2
634133689216036864 michelle obama 1
634185712884183040 michelle obama 2
634232848522850304 michelle obama 0
634311131797041152 michelle obama -2
634570385128710144 michelle obama -1
634841538959405056 michelle obama 0
635097205272014848 michelle obama 0
635098614558289925 michelle obama 0
635385923363057664 michelle obama -1
635530316438896640 michelle obama 0
635846449561927680 michelle obama -1
636346940272324608 michelle obama 0
636406126972674048 michelle obama 1
637360313499820032 michelle obama 0
637418168508547072 michelle obama -1
637626663086497796 michelle obama 0
638183273630449664 michelle obama 1
638825206325248000 michelle obama 1
639104253886246912 michelle obama 0
639750711107039232 michelle obama 1
639858973391331328 michelle obama 0
640569576246390784 michelle obama 0
640992207995072513 michelle obama -1
641001921957003268 michelle obama 0
641165121734074368 michelle obama 0
641522983811592192 michelle obama 0
633229749804994560 minecraft 1
633416585164656640 minecraft 1
633538664459431936 minecraft 1
633562589956468736 minecraft 1
633702779291344896 minecraft 1
633817258700242944 minecraft 1
633817867687960576 minecraft 1
633852064439926784 minecraft 1
634174882495000576 minecraft 1
634315111155507200 minecraft 1
634348208630693892 minecraft 1
634419216410640384 minecraft 1
634439076221857792 minecraft 0
634451260880650240 minecraft 1
634482190835941377 minecraft 1
634567397232504833 minecraft 1
634676348888457216 minecraft 0
634703846695141376 minecraft 1
634715048695459840 minecraft 1
634954535291719680 minecraft 1
635014594445090816 minecraft 1
635170748894613504 minecraft 0
635180390056108032 minecraft 0
635201663767216128 minecraft 0
635329988389023744 minecraft 1
635333624968122368 minecraft 0
635337032986968064 minecraft 1
635384109972348928 minecraft 1
635510545614041088 minecraft 1
635541283633807360 minecraft 1
635733268931866624 minecraft 0
635871339262410752 minecraft 1
636006404797657092 minecraft 2
636163766091186176 minecraft 2
636338393945763840 minecraft 1
636365473815265280 minecraft 0
636416237073997824 minecraft 1
636439227933306880 minecraft 1
636491515947261952 minecraft -1
636584228319272960 minecraft 2
636586322803748864 minecraft 1
636706815661617152 minecraft 0
637123654908702720 minecraft 1
637200823857061888 minecraft 0
637275722436886528 minecraft 1
637318243271725056 minecraft 1
637369385372532736 minecraft 1
637373856836100100 minecraft 0
637454738410237952 minecraft 1
637463434477608960 minecraft 1
637484872202911744 minecraft 1
637656658240503808 minecraft 1
637667004409778177 minecraft 1
637705823016325120 minecraft 2
637764165336174592 minecraft 1
637775827678195712 minecraft 1
637795598687707136 minecraft 1
637861118392700929 minecraft 0
638026495622017024 minecraft 1
638101685794156544 minecraft 1
638131720181559296 minecraft 1
638222435817537536 minecraft 1
638440610014167040 minecraft 1
638543285888393216 minecraft 1
638858045322338304 minecraft 1
638874086282694657 minecraft 0
639103218442764288 minecraft 0
639208241206005761 minecraft 1
639440025160167424 minecraft 1
639510134117507072 minecraft 1
639625762123845632 minecraft 1
639647815761719296 minecraft 1
639717286761373696 minecraft 1
639760085112233985 minecraft 1
639917891463221248 minecraft 1
639968575021817856 minecraft 1
639974830696202240 minecraft 0
640122136049270784 minecraft 0
640122291892953088 minecraft 0
640153633338687488 minecraft 1
640160732911390720 minecraft 1
640241433505591296 minecraft 1
640371934484672512 minecraft 1
640412683049828352 minecraft 1
640511732956463106 minecraft 2
640602509128691712 minecraft 1
640707748724797442 minecraft 1
640840095554248704 minecraft 1
640849840344309761 minecraft 1
640941619731169280 minecraft 1
641032167091478528 minecraft 1
641325536707497984 minecraft 1
641361460489097220 minecraft 1
641378356244672512 minecraft 1
641390564571783168 minecraft 1
641398525910056962 minecraft 1
641550310083657728 minecraft 1
641578205351137280 minecraft 1
641648977524428800 minecraft 1
641674758573195264 minecraft 1
624129218826207232 monsanto 0
624139816955842560 monsanto 0
624222914104160256 monsanto 0
624381270378835968 monsanto 0
624390778194927616 monsanto -1
624527114474258432 monsanto -2
624593823016992768 monsanto -1
624640210559610880 monsanto -2
624643620595826688 monsanto -1
625097241934458880 monsanto -1
625410507197952000 monsanto -1
625451359437893632 monsanto 0
625673838370652160 monsanto 0
625755687344320512 monsanto 0
625778227743584256 monsanto 0
625798269860466688 monsanto -2
625799922319794176 monsanto -1
626122897329774593 monsanto -1
626350892393066497 monsanto -1
626406116495331329 monsanto 0
626425892357718016 monsanto -1
626513477272764416 monsanto -1
626746837173731328 monsanto -1
627099652333023233 monsanto -1
627889864717897728 monsanto -2
628280563560898560 monsanto 1
628891853144870912 monsanto 0
629019977312395265 monsanto -1
629460810813693952 monsanto 0
629496291190554625 monsanto 0
629507087991615488 monsanto 0
629774527690600448 monsanto -1
629885177578131456 monsanto -1
630064309750599680 monsanto -1
630083241681264640 monsanto -1
630131373219708928 monsanto -1
630355891502460928 monsanto -1
631167230433173504 monsanto -2
631489998437494784 monsanto -1
631621083293200385 monsanto -1
631624366174941185 monsanto -1
631905020305387520 monsanto -1
631911878722088960 monsanto -1
631963959969517571 monsanto 0
632176696070938625 monsanto 1
632351885203079168 monsanto 0
632684227088117760 monsanto -1
632721690066296832 monsanto 0
632735556108206080 monsanto 0
633052277234888704 monsanto 0
633146695677677568 monsanto -1
633161870556327937 monsanto -1
633757377439776770 monsanto 0
634415990470746112 monsanto -1
634437358092357632 monsanto -1
634519654191472640 monsanto 0
634575740009349120 monsanto 0
634759172790296576 monsanto 0
634779796103372800 monsanto 1
635080424197222400 monsanto 0
635255948622331904 monsanto -1
635726373944991744 monsanto -1
635920047328919552 monsanto -1
636103457661915136 monsanto 0
636202034392264704 monsanto 0
636412235909320704 monsanto 0
636450682447355905 monsanto 0
636477983943999488 monsanto 1
636547385766768640 monsanto 1
636569972035190784 monsanto 0
636572450143076353 monsanto 0
636585336567689216 monsanto -1
636611047986589696 monsanto 0
636960750204915712 monsanto -1
637011130947399681 monsanto -1
637071383999021056 monsanto -1
637214753144762368 monsanto -2
637346288292466688 monsanto 0
637791497769775104 monsanto -1
637821766312792064 monsanto 0
638229475059220480 monsanto -1
638267561893888000 monsanto -1
638597651269681152 monsanto -1
639240697934057473 monsanto -1
639274258598748160 monsanto -1
639305285639782400 monsanto -1
639371523300593665 monsanto 1
639496773388664832 monsanto 0
640003610084970496 monsanto 1
640185482941366272 monsanto 0
640237204137095169 monsanto -1
640415870414524417 monsanto 0
640672606803243008 monsanto 0
640865122899075072 monsanto -1
640896627235012609 monsanto -1
640928163867033600 monsanto -1
641089276986298372 monsanto 0
641373543586996224 monsanto 0
641496653405417472 monsanto 0
641614931356463104 monsanto -1
641431353800593409 netflix 1
641431504908873728 netflix 1
641432689308884992 netflix 1
641433532712153088 netflix 1
641435956445335552 netflix 1
641436057083375616 netflix 0
641436329675460608 netflix 1
641437012378042368 netflix 0
641437197455896577 netflix 1
641437601048752128 netflix -1
641437943555620865 netflix 1
641439484119093248 netflix 0
641440884630884352 netflix 1
641441681821278208 netflix 1
641444044187504640 netflix 1
641444085375586304 netflix 0
641447792414621696 netflix 1
641448148980776960 netflix 0
641448858766082048 netflix 1
641449335167787008 netflix -1
641449479435120640 netflix 1
641449893484085248 netflix 1
641450467910897664 netflix 1
641451056635867136 netflix 1
641451426363895808 netflix 1
641451599831760897 netflix 1
641452585812140032 netflix 1
641453454762741760 netflix 1
641453807243776000 netflix 1
641453999481311232 netflix 1
641455799844372480 netflix 1
641456878019448832 netflix 1
641458438510354432 netflix 1
641459080687587329 netflix 1
641459352478580736 netflix 1
641459533420851200 netflix 0
641459913672163329 netflix 1
641459925688840192 netflix 1
641461498422906880 netflix 1
641465553039806464 netflix 0
641468927218847745 netflix 0
641470312748589056 netflix 1
641472833076469760 netflix 1
641473055647133697 netflix 1
641474050221412352 netflix 0
641476480782893056 netflix 1
641476520373043201 netflix -1
641477290975559680 netflix 1
641478202309890048 netflix 1
641478640891379712 netflix 0
641478876200177665 netflix -1
641479298642145280 netflix 1
641480564273340416 netflix 1
641481169771569152 netflix 1
641484648380436480 netflix 1
641484938361966592 netflix 0
641487861733158912 netflix 0
641489626184728580 netflix 1
641492387097915392 netflix 1
641493056810692608 netflix 1
641494399680053248 netflix 0
641497388280999936 netflix 1
641498639031009280 netflix 1
641500310347780096 netflix 1
641501438233829376 netflix 1
641502442165633024 netflix 1
641503646832795648 netflix 1
641505957114159104 netflix 1
641508983979675648 netflix 1
641526524613521408 netflix 0
641527243127287808 netflix 1
641529715661123584 netflix 1
641532034788249600 netflix 1
641536254736211968 netflix 1
641536989670584320 netflix 2
641539230045331456 netflix 1
641540654191939584 netflix 1
641544576134705152 netflix 1
641546502666633216 netflix 1
641569985651937280 netflix 0
641585662441844736 netflix 0
641599818784239616 netflix 1
641600884070313984 netflix 1
641611190213459968 netflix 0
641616897876848640 netflix 1
641618923994128385 netflix 1
641620338279907329 netflix 1
641622310173061120 netflix 1
641623122651820032 netflix 1
641623729991122944 netflix 2
641631658526044160 netflix 0
641633897860739072 netflix 1
641641388719783936 netflix 1
641641908100571136 netflix 1
641651719722639360 netflix 1
641651870511951873 netflix 1
641652382292570113 netflix 1
641653947044896768 netflix 1
641657066755649536 netflix 1
641660757826998272 netflix 1
639468756595572737 nike 0
639470124693630976 nike 0
639474041305309185 nike 1
639486908159148032 nike 1
639503938497196032 nike 0
639535268551335936 nike 0
639551955149258752 nike -1
639561327900364800 nike 1
639636033534095360 nike -1
639650767301931008 nike 0
639653411911258120 nike 0
639682312913813505 nike 0
639723228454256640 nike 1
639739774811639808 nike 1
639787098967568384 nike -2
639807303785553920 nike 1
639839800590237697 nike 0
639843202585903104 nike 0
639850900698345476 nike -1
639863440476012544 nike 1
639865249013886976 nike 2
639873195995074560 nike 1
639876136059686912 nike 0
639877821691768832 nike 1
639915822379626498 nike 1
639936030083145729 nike 1
639940441165725696 nike 0
639963991096324096 nike 0
639976501866287104 nike 1
639985767704498177 nike 1
640009981815836672 nike 1
640034791585382400 nike 0
640164859146076161 nike 1
640254635312328704 nike 0
640272774561464320 nike 1
640282451051446273 nike 0
640326039315484672 nike 0
640345491503378433 nike 0
640383169305296896 nike 0
640463392835260416 nike 0
640495522181083137 nike 0
640507211739975680 nike 1
640584748461633537 nike 1
640593925011435520 nike 1
640594158747545601 nike 1
640613765185187840 nike 1
640646835162513408 nike 1
640685582503550976 nike 1
640689924568584192 nike 0
640706287265669120 nike 0
640765886782177280 nike 1
640782933574438912 nike 1
640850489970569216 nike 1
640853405787942913 nike 1
640906640951246848 nike -1
640906931998076928 nike -1
640916973598167040 nike -1
640934632662429696 nike -1
640943829432991744 nike 0
640944256836870144 nike 1
640993104275836928 nike 1
641019217077215232 nike 1
641043478835798016 nike 0
641065507102310400 nike 0
641072965203980289 nike 1
641098881950969857 nike 0
641101229641306112 nike 0
641145916955561985 nike 1
641148298217172993 nike 1
641196872690855937 nike 1
641208536333189120 nike 1
641235821509648384 nike 0
641287903897714688 nike 1
641311141084459008 nike 1
641312882857222144 nike 1
641345144994684928 nike 0
641354980406890496 nike 1
641409562948595712 nike 0
641410887702740992 nike 1
641412535770578945 nike 1
641414749822033920 nike 1
641417500366737408 nike 1
641420161220771840 nike 0
641426460209713152 nike 1
641429408163598336 nike 1
641432100785266689 nike 1
641449231119708160 nike 0
641457255393660928 nike 0
641474372230774784 nike 0
641477659013222400 nike 1
641503030475550721 nike 0
641561591390015488 nike 0
641595923248746497 nike 1
641603694602096640 nike 1
641606731685044225 nike 1
641621930584444928 nike 1
641623746760077312 nike 1
641625453795651584 nike -1
641634287490584576 nike 1
641652633414037504 nike 1
638507228664872960 nintendo -1
638513299584233472 nintendo 0
638531416612044800 nintendo 0
638552145181175809 nintendo 0
638557623265062912 nintendo 1
638613692452474881 nintendo 1
638626922851733504 nintendo 1
638658797955903488 nintendo 0
638659326505127937 nintendo 1
638694520880807937 nintendo 1
638788243325063168 nintendo 0
638796765924356096 nintendo 1
638826416511971329 nintendo 0
638848557424885760 nintendo -1
638862209725018112 nintendo 0
638864863851319296 nintendo 0
638924569709907968 nintendo 0
638936078783787009 nintendo 0
639025728621678593 nintendo 1
639067369869049856 nintendo 1
639100727726579712 nintendo 1
639135979480215552 nintendo -1
639142132817641472 nintendo 1
639148479407767552 nintendo 1
639172320771375104 nintendo 1
639182742261997569 nintendo 0
639231237232676864 nintendo 0
639243036585775104 nintendo 0
639250666490236928 nintendo 0
639278275903270913 nintendo 1
639280339802718208 nintendo 1
639321147490697216 nintendo 0
639329469677768705 nintendo 1
639350429990555648 nintendo 1
639557222381568000 nintendo 0
639608090275348484 nintendo 0
639739322862710784 nintendo 0
639743879047024640 nintendo 0
639757386371063809 nintendo 0
639798156079665154 nintendo 1
639863360192966657 nintendo 0
639873657800626180 nintendo 0
639898044138418177 nintendo 0
639921099166339072 nintendo 1
639923184578506752 nintendo 0
640012708411129856 nintendo -1
640076801897725956 nintendo 0
640082944564965380 nintendo -1
640206592223379456 nintendo 0
640217598823546880 nintendo 1
640226793316741120 nintendo 1
640256317949652992 nintendo 1
640264929040199680 nintendo 1
640287808217681920 nintendo 0
640310796866715648 nintendo 1
640329598819930112 nintendo 1
640382200295219200 nintendo 0
640411153911287808 nintendo -1
640419831188221952 nintendo 0
640451835057143808 nintendo 1
640523838321725444 nintendo 1
640611419705200641 nintendo 0
640624064198017024 nintendo 1
640688164588363776 nintendo 1
640765992113676288 nintendo 1
640860442219446272 nintendo 1
640872371038064641 nintendo 0
640874788681089024 nintendo 0
640897968590065664 nintendo 1
640906361614794752 nintendo 0
640918660501118977 nintendo 0
640945195018752001 nintendo 1
640966584639483904 nintendo 1
640967457914556416 nintendo 1
641048641449254912 nintendo 1
641062632594649088 nintendo 1
641120477445009408 nintendo 0
641122076527497216 nintendo 1
641207035229511680 nintendo 1
641235551576715264 nintendo 1
641268636410380288 nintendo 1
641295492492738560 nintendo 1
641296016788996096 nintendo 1
641296390883291136 nintendo 1
641303508692672512 nintendo 1
641330259644784642 nintendo 1
641330313671651328 nintendo 1
641360340588978176 nintendo 1
641391703367241728 nintendo 1
641443041102815232 nintendo 1
641457243435761664 nintendo -1
641478977404669952 nintendo 0
641491701429760004 nintendo 1
641501294365159424 nintendo 1
641510591245385728 nintendo 1
641567574191378432 nintendo 0
641608375051132928 nintendo 2
641620856981032960 nintendo 1
641644622393966594 nintendo -1
641653870742142976 nintendo 0
633364047090589696 nokia 1
633401381957836800 nokia -1
633630785195474945 nokia 0
633768533206388736 nokia 0
633855518985973760 nokia 0
633920095421603840 nokia 1
633985521690087424 nokia 1
634048037581651969 nokia 1
634056354664218624 nokia 1
634102068521869312 nokia 2
634253896450490368 nokia 0
634364992326926337 nokia -1
634392723261231105 nokia 0
634453563465465856 nokia -2
634493142587338752 nokia 1
634593408028315648 nokia 1
634633252020555781 nokia 0
634724293952192512 nokia 0
635085238574563328 nokia 0
635169979600474113 nokia 0
635419315064426496 nokia 0
635517361987145728 nokia 1
635699262333054976 nokia 1
635824958661369856 nokia 0
635847561572560896 nokia 0
635951148332093441 nokia 1
636118807765872640 nokia 1
636223744487329792 nokia 1
636232758042488832 nokia 0
636339566513946624 nokia 0
636502545029046273 nokia 1
636551143905099779 nokia 1
636559041620242432 nokia 1
636628270172274688 nokia -1
636699911942094848 nokia 0
636881661267869696 nokia 0
636944017217966081 nokia 0
636954024361725952 nokia 1
636967592725495808 nokia -1
636976903451185152 nokia 1
636995718801174532 nokia 0
637063919077425152 nokia 1
637131148322209792 nokia 1
637181445711245312 nokia 1
637220843169320960 nokia 0
637224535633166336 nokia 0
637284450062176257 nokia 1
637320116296916992 nokia 1
637381008090865665 nokia -1
637460296773140480 nokia 1
637563099944366080 nokia 1
637634209268527104 nokia 0
637679589427421184 nokia 1
638022232799887361 nokia 1
638068331669426176 nokia 1
638164311139942401 nokia 1
638164680481988608 nokia 1
638165309786992642 nokia 1
638292267262976000 nokia 0
638292683102924800 nokia 1
638385702804287489 nokia 1
638444951030890498 nokia 1
638468753731252224 nokia -1
638622052791001088 nokia 1
638655756791861248 nokia 1
638774963655307264 nokia 0
638791548575043585 nokia 0
638890587379343360 nokia 1
638932882732355584 nokia 2
638951897924145152 nokia 0
638965028817797120 nokia 1
638966291819139072 nokia 2
638976726597406720 nokia 1
638979865484595201 nokia 2
639011052336734208 nokia 1
639044904094666752 nokia 1
639047182532902913 nokia 1
639180476532568064 nokia 1
639205344682606593 nokia 1
639344867701747712 nokia 1
639362975954939904 nokia 0
639475106725670912 nokia 0
639493112516050944 nokia 0
639527062240268288 nokia 1
639750226824196096 nokia 0
639820780679864320 nokia 1
639833618794201088 nokia 1
640192484648292352 nokia 1
640274576740601856 nokia -1
640393122808229888 nokia 1
640526249589362688 nokia 0
640891954788724737 nokia 1
640985982867738624 nokia 0
641124229899939841 nokia -1
641224877064654848 nokia 1
641227913606627328 nokia 1
641349488645312512 nokia 1
641478754766864384 nokia 1
641482843307249664 nokia 1
641528678141202432 nokia 0
641115795494424577 obama 0
641129655123185668 obama 1
641141093623558144 obama 1
641154831420276736 obama 0
641169158126747648 obama -1
641171403715297280 obama 0
641185857110577152 obama 0
641193181200015361 obama 0
641202903978393601 obama 0
641210732030222336 obama -1
641212814993043457 obama 2
641213605745065984 obama 0
641214034977628160 obama -1
641217354760908800 obama -1
641227928483725313 obama 1
641241818655531013 obama 0
641242419254550528 obama 0
641251977024815104 obama 1
641257211939942400 obama 0
641258964697546754 obama 1
641263696157650944 obama -1
641265491852529664 obama -1
641273007097294848 obama 0
641281999815118848 obama 0
641285662457643008 obama -1
641288166352252928 obama 1
641291125890908160 obama -1
641292855558950912 obama -1
641305747150741505 obama -1
641306213519654912 obama -1
641308911094661120 obama -1
641311111883685888 obama 0
641311414364307456 obama -1
641311477220163584 obama -1
641318732829167616 obama 0
641328456165380096 obama 0
641332176840167427 obama -1
641337754102566912 obama 0
641339662271811584 obama 0
641344108309512192 obama 0
641345903484276737 obama -1
641346868346122240 obama -1
641350139890634753 obama 0
641357887663550469 obama 0
641364532292521986 obama -1
641369832429125632 obama 0
641374795028951040 obama 1
641382923715936257 obama -1
641384257676447744 obama -1
641388204302598144 obama 1
641402826271367168 obama 0
641403250370023425 obama 0
641408289943777280 obama 1
641408407682052099 obama 0
641408570957824002 obama -1
641410827250065408 obama 1
641411888207650816 obama -1
641413486606721024 obama 0
641414635913125888 obama 1
641417589214871553 obama 1
641419162544279553 obama 0
641420331475955712 obama 0
641421170789584896 obama -1
641422203628691456 obama -1
641423805185949696 obama 1
641425046175641600 obama -1
641430478176841728 obama 1
641439808024281088 obama 0
641440147280674816 obama -1
641441483552387073 obama -1
641443513922510848 obama -1
641448750670589953 obama 0
641452590316814336 obama -1
641452847675113473 obama -1
641455689215315968 obama 0
641457561258979328 obama 1
641458201892777985 obama 0
641495992454393861 obama 1
641496463193731072 obama 0
641496917676060672 obama 2
641499818733338624 obama -2
641501931869990912 obama -1
641518778862469120 obama 1
641527589782163456 obama -1
641530017462120448 obama -1
641541647952547840 obama 0
641559670801367040 obama -1
641572435096113152 obama 0
641585514685071360 obama -1
641588798065876992 obama 1
641607573427236864 obama 0
641607922217160704 obama -1
641614562366615552 obama -1
641615794863013889 obama 1
641615885283794944 obama 0
641624729212682240 obama 0
641630440898600960 obama 0
641634161388875776 obama -1
641645016419536896 obama 0
641649277379432448 obama -1
631693323049177088 oracle 1
631742135356760064 oracle 0
631842057485619200 oracle -1
631851345759313920 oracle -2
631862196817936384 oracle -1
631870358396628996 oracle 1
632003789780705280 oracle 0
632207300514721792 oracle 0
632287441626497024 oracle 0
632297821773955074 oracle -1
632453030533836800 oracle 0
632629959815639041 oracle 0
632656687976062977 oracle 0
632661627033264128 oracle 1
632662727647891456 oracle -1
632679175862755328 oracle 1
632919529811787776 oracle 1
633094789894811648 oracle 0
633156673264332800 oracle 0
633181146503860224 oracle 0
633319537371279360 oracle 0
633419470560559104 oracle 0
633422966768865281 oracle 0
633506378351427584 oracle 0
633646680068521984 oracle 0
633684283106824193 oracle 1
633699293875040256 oracle 1
633743702335209474 oracle 1
633760811400323072 oracle 1
633899915194724352 oracle 1
633976104450043904 oracle 1
634011334603055104 oracle 1
634040784380006400 oracle 1
634315943947173888 oracle 0
634368674695024640 oracle 1
634375488241274880 oracle 0
634407834260779008 oracle 0
634412433268830208 oracle 1
634463903183867904 oracle 1
634493692087259136 oracle 1
634758871588962304 oracle 1
634838845687758848 oracle 0
634971143540097024 oracle 1
635242479596376068 oracle 1
635265103055556608 oracle 0
635313682914783232 oracle 1
635556689987506176 oracle 0
635647761954807808 oracle 0
635699092182536192 oracle 0
635713078991032320 oracle 0
635922207978352640 oracle 0
636023739575074816 oracle 1
636179293589118976 oracle -1
636392093385015296 oracle 0
636528730274443264 oracle 0
636660777991057408 oracle 0
636721819651866624 oracle 0
636904837356081152 oracle 1
636966996802842628 oracle 1
637063578642583552 oracle 1
637116035833815040 oracle 1
637190881070727169 oracle 1
637284425676361728 oracle 1
637597773911691264 oracle 0
637599917687615488 oracle 0
637601276805648384 oracle 1
637730364614537216 oracle 0
637949759781773312 oracle 0
637957399484215296 oracle 1
637958854429515776 oracle 0
637967703672754176 oracle 1
638267994641010690 oracle 1
638821054253694976 oracle 0
638823487293952000 oracle 1
638841199776919552 oracle 1
638847579569135616 oracle 1
638925237153857536 oracle 0
639061211552817152 oracle 0
639108481774022656 oracle 0
639184289905569792 oracle 1
639230557667368960 oracle 0
639249486246604800 oracle 0
639377353903206400 oracle 1
639453580911448064 oracle 1
639459793246269440 oracle 1
639548708166615040 oracle 0
639877117598023680 oracle 0
639909879138791424 oracle -1
639927788862967808 oracle 1
640117779757187072 oracle 0
640144488388759552 oracle 0
640154322978914305 oracle 1
640629592382943232 oracle -1
640645707511128064 oracle 0
640666274427740160 oracle 1
640726829267988481 oracle 1
640896882475200512 oracle 1
641604585270968320 oracle 0
641615685416812544 oracle 1
641633272892526594 oracle 1
635884936143069184 planned parenthood 0
635885612852051968 planned parenthood 0
635931460738920449 planned parenthood 0
635943595661332480 planned parenthood -1
635945880017743872 planned parenthood 0
636008040639148032 planned parenthood 0
636038510982524929 planned parenthood 0
636144468354314240 planned parenthood 0
636163844969070592 planned parenthood 0
636170210232401920 planned parenthood 0
636172881404264448 planned parenthood -1
636201360623427584 planned parenthood -1
636211945700478976 planned parenthood -2
636285375598698497 planned parenthood 0
636333651416879105 planned parenthood -2
636379430336774144 planned parenthood 0
636438396886515712 planned parenthood 0
636583750915215360 planned parenthood 0
636603480715718656 planned parenthood -1
636667049687707649 planned parenthood 0
636674888195960832 planned parenthood -1
636713827862736896 planned parenthood -1
636725841137954816 planned parenthood 1
636727401075077120 planned parenthood 1
636758141389049856 planned parenthood 1
636764945896443904 planned parenthood -1
636925087355170816 planned parenthood 0
636965183814893568 planned parenthood 0
637038773562269696 planned parenthood -2
637051662029463552 planned parenthood -1
637086073299050496 planned parenthood 0
637258001510961152 planned parenthood 0
637305388216524800 planned parenthood -1
637320036248592384 planned parenthood -1
637328456963850240 planned parenthood -1
637351806247522304 planned parenthood 0
637388683004407808 planned parenthood 0
637404977707794432 planned parenthood 0
637529124924321792 planned parenthood 0
637565014338076673 planned parenthood -1
637641239999942657 planned parenthood 0
637658691651682304 planned parenthood -1
637705802095194112 planned parenthood -1
638053408965021696 planned parenthood -2
638344432245276672 planned parenthood 0
638389003151110145 planned parenthood -1
638451699452149760 planned parenthood -1
638470381209174016 planned parenthood 0
638479211263463424 planned parenthood -1
638519370902294530 planned parenthood 1
638640331299405824 planned parenthood -1
638760832822734848 planned parenthood -1
638768064427855872 planned parenthood -1
638856131004243968 planned parenthood 1
638904223212642304 planned parenthood 0
638904316288327680 planned parenthood -1
638904475038654465 planned parenthood -1
638931125428219904 planned parenthood -1
638961808284479488 planned parenthood -1
639051256133255168 planned parenthood -2
639055108936830976 planned parenthood -2
639118270843387904 planned parenthood -1
639213159589507072 planned parenthood -2
639234396814508032 planned parenthood 0
639240002665320448 planned parenthood -2
639315054249279488 planned parenthood 0
639404336506732545 planned parenthood 0
639422350056775681 planned parenthood 1
639443548987912192 planned parenthood -1
639451102291886084 planned parenthood 0
639544264226029568 planned parenthood 1
639591078882971648 planned parenthood 0
639592214868262912 planned parenthood -2
639648980847198208 planned parenthood -1
639775480812408832 planned parenthood -1
639791469293912064 planned parenthood -2
639822276595068928 planned parenthood -1
639883122352500736 planned parenthood 0
639890066291195904 planned parenthood -2
639890137460146180 planned parenthood 0
640123333070200833 planned parenthood 0
640177056119169024 planned parenthood 0
640188972551897088 planned parenthood -1
640281963920658432 planned parenthood -1
640304774697586688 planned parenthood -1
640540480007241728 planned parenthood 0
640594355649146880 planned parenthood 0
640774497075863553 planned parenthood 0
641267197667639297 planned parenthood -1
641304720326328321 planned parenthood 1
641328490432884740 planned parenthood 0
641356738369708033 planned parenthood 1
641367336553984000 planned parenthood 0
641450656583127040 planned parenthood 1
641581327435866112 planned parenthood 1
641587685942009856 planned parenthood 0
641617694652006400 planned parenthood 0
641625870763999232 planned parenthood -1
641635092570488832 planned parenthood 0
641669938588086272 planned parenthood -1
641138999617187840 pope 1
641150602240593920 pope 0
641156889666035712 pope 0
641162416139558913 pope 0
641171086944694272 pope -2
641173711148744704 pope 0
641176871145635840 pope 0
641184028490645504 pope 1
641188082625044480 pope 0
641205630599057408 pope 0
641210593794465792 pope 0
641211344524460032 pope 1
641213495422259200 pope 0
641216724180709376 pope 1
641227698111574016 pope 1
641230963444465664 pope 1
641231945121185792 pope 1
641234323245412352 pope 0
641236186057474048 pope 1
641236215866490880 pope 0
641238799599706112 pope -1
641240062118756352 pope 1
641242251612549120 pope 0
641249773928980480 pope 2
641250877391695872 pope 0
641250940218142720 pope 1
641252712194179072 pope 1
641253026188144640 pope -1
641257580455665664 pope 1
641258093393768448 pope -1
641261535067770880 pope 0
641266192057896960 pope 0
641267403813449729 pope 0
641271370664443904 pope 1
641283483713728512 pope 1
641287967521263617 pope 0
641295790481231872 pope -1
641298193871843328 pope 1
641304560162709504 pope 1
641308763308335104 pope 0
641312094567186436 pope 0
641312870786035716 pope 1
641314853756510208 pope 1
641317664384786436 pope 1
641323092208431104 pope 1
641329554120908800 pope 0
641330968587059201 pope 0
641331355687755776 pope 0
641332059328397313 pope 1
641340308190400512 pope 0
641345098681225216 pope 1
641346625059729408 pope 0
641352993003012097 pope 1
641359485349441537 pope 1
641359984568078336 pope 2
641363235308900356 pope 2
641364803819188227 pope 0
641368717570494464 pope 1
641379710006611968 pope 1
641386039983128576 pope 1
641407191161765892 pope 0
641408123404709889 pope 1
641412525930713088 pope 1
641415505509773312 pope 1
641416305460027392 pope 1
641423528252821504 pope 1
641430091621265409 pope 1
641433386221830144 pope 1
641436136515112961 pope 0
641436903053488128 pope 0
641439816933093380 pope 1
641440505943998464 pope 1
641448032014336000 pope 1
641475702513102848 pope 0
641499788291108864 pope 0
641504331305455616 pope 1
641511801696464896 pope 1
641512160649019392 pope 0
641541239666442240 pope 1
641552481403674624 pope 1
641557033238556672 pope 1
641562494461456384 pope 1
641578663096401921 pope 1
641579926215266304 pope 1
641581847084957696 pope 1
641605895873363968 pope 1
641609830575157248 pope 0
641612134237929472 pope 1
641612799878238208 pope 0
641612833893908480 pope 1
641616155619258368 pope 0
641625265542688768 pope 1
641631024808656896 pope 1
641641970981408768 pope 1
641643033134563328 pope 1
641643922549288960 pope 0
641649333440499712 pope 1
641652726309502976 pope 0
641655938315894784 pope 1
641657524609904640 pope 0
626083470415134721 pride parade 1
626130101478948864 pride parade 1
626380716587266048 pride parade 0
626461225405313024 pride parade 1
626472966235271168 pride parade 1
626510385584177152 pride parade 1
626678338862497792 pride parade 1
626733015495016448 pride parade 1
626751345903558656 pride parade 1
626784786057678849 pride parade 1
626849425940459520 pride parade 1
626864737574326272 pride parade 0
626894920658350080 pride parade 1
626905665563414530 pride parade 1
626928553825734656 pride parade 1
627001918305406976 pride parade 0
627040267166744576 pride parade 1
627104379917737984 pride parade 1
627153671617413120 pride parade 1
627153843147702273 pride parade 0
627181155679358976 pride parade 1
627186040055296000 pride parade 1
627227414918094848 pride parade 1
627264155607674880 pride parade 1
627398469448298496 pride parade 1
627544225278754816 pride parade 1
627559058388709383 pride parade 1
627607112269459456 pride parade 1
627648889244422144 pride parade 1
627682318484832256 pride parade 1
627687854089609217 pride parade 0
627841613394526208 pride parade -1
627843051856203777 pride parade -1
627856829670752256 pride parade 1
627963422181715968 pride parade 1
627992113653792768 pride parade 1
628032626129965056 pride parade 1
628037882523947008 pride parade 1
628540752289730560 pride parade 2
628599397748707329 pride parade 1
628644381738835968 pride parade 0
628670372343189504 pride parade 0
629311671979352064 pride parade 1
629716382553223169 pride parade 0
629721843872698368 pride parade 0
630027162901442560 pride parade 1
630068484341272576 pride parade 1
630082111400214528 pride parade 0
630098835532943360 pride parade 1
630660065654099968 pride parade 1
630808237986717696 pride parade 0
630884316508200960 pride parade 0
632197817000402945 pride parade 0
632610213800083456 pride parade 0
633325501889802240 pride parade 1
633353657648480257 pride parade 1
633665826667761664 pride parade 0
633897691878047744 pride parade 0
634704389513584640 pride parade 1
634900294728609792 pride parade 1
634985670914633728 pride parade 0
635178479227502592 pride parade 0
635184488235053056 pride parade 1
635238468252209152 pride parade 1
635533688340516864 pride parade 1
635543801654865921 pride parade 1
635602757995601920 pride parade 1
636436362099601408 pride parade 0
636491223235170304 pride parade 0
636544055581802496 pride parade 1
636662122190082048 pride parade 1
637050694231416832 pride parade 1
637186895110279168 pride parade 1
637283514472382464 pride parade 1
637331460765163520 pride parade 0
637355250903580676 pride parade 2
637526017398018048 pride parade 2
637681671349780480 pride parade 1
637804121890816000 pride parade 1
637805423702093824 pride parade 1
637922420259713024 pride parade 1
638432105303674881 pride parade 1
638802143638614016 pride parade 1
638810316906758144 pride parade 1
638869964615618560 pride parade 2
639418512986013697 pride parade 1
639494256785096704 pride parade 1
639830845574942720 pride parade 0
639858179665469440 pride parade 1
639906380741132288 pride parade 1
640045188740591616 pride parade 1
640244215524360192 pride parade 1
640286310234636289 pride parade 1
640423627926581248 pride parade 1
640527482110636032 pride parade 1
640561090716282880 pride parade 1
640593705309765632 pride parade 1
640753334127828992 pride parade 0
640903069979537408 pride parade 1
641451130552221696 pride parade 1
624661429245898752 ric flair 1
625102450727501824 ric flair 1
625104359706066944 ric flair 1
625134851721576449 ric flair 1
625333005301628929 ric flair 0
625543145271398400 ric flair 1
626124091486044160 ric flair 1
626128343650467840 ric flair 0
626181036599308288 ric flair 1
626351624307519488 ric flair 1
626516723647315972 ric flair 1
626590571038019584 ric flair 0
626971786249412608 ric flair 1
626993614934175744 ric flair 1
627103165406515200 ric flair 1
627244571269984258 ric flair 0
627254658646568960 ric flair 1
627261917724147712 ric flair 1
627263473903345664 ric flair 1
627268457554444288 ric flair 1
627273292584517632 ric flair 1
627308467150196736 ric flair 1
628772567143190528 ric flair 1
629368536276836354 ric flair 1
630592330144157696 ric flair 1
631299250438205440 ric flair 1
631697205653544960 ric flair 1
632955463361892352 ric flair 1
633330436777902082 ric flair 1
633375409564880896 ric flair 1
633432787068915712 ric flair 0
633462328588148736 ric flair 0
633462370707177472 ric flair 0
633462429146587136 ric flair 1
633462467792928768 ric flair 1
633462635640586240 ric flair 0
633462886703190016 ric flair 0
633463641656832004 ric flair 0
633464447919456256 ric flair 1
633464476227006464 ric flair 0
633464820113641472 ric flair 1
633466691037466624 ric flair 0
633469789264965632 ric flair 0
633477953905537024 ric flair 0
633498667266232320 ric flair 0
633507400549400576 ric flair 1
633513986424619008 ric flair 1
633549773337964545 ric flair 0
633573343027949568 ric flair 0
633598022723760132 ric flair 1
633636321198764032 ric flair 1
633878898418188289 ric flair 0
633889626797801472 ric flair 1
633893654143324160 ric flair 1
633948028362182656 ric flair 0
634028428681875457 ric flair 1
634207912278294530 ric flair 1
634405858114412544 ric flair 0
634451152164274176 ric flair 1
634799024080584704 ric flair 0
635076518847336448 ric flair -1
635175552513634304 ric flair 1
635249738506305536 ric flair 1
635600103001165824 ric flair 1
635617349287182336 ric flair 0
635619068234629121 ric flair 0
635622687893680128 ric flair 0
635622739747938304 ric flair 0
635674639511916545 ric flair 0
635952888557268993 ric flair 1
635995369558700032 ric flair 0
635995703857147906 ric flair 0
635995769204535297 ric flair 0
636006516861083648 ric flair 1
636013500364627969 ric flair 1
636016819300466688 ric flair 1
636027884558159873 ric flair 1
636048847223943168 ric flair 1
636153239298306048 ric flair 1
636266471945932800 ric flair 0
636310021089923074 ric flair 0
636376500925808640 ric flair 1
636564937758916608 ric flair 1
636623813837361153 ric flair 1
636667221452922880 ric flair 2
636731010521153536 ric flair 0
636871042791813120 ric flair 0
637063126693900288 ric flair 0
637084072330797056 ric flair 1
637238331097673728 ric flair 0
637301999650734081 ric flair 1
637635039526715392 ric flair 0
639088763898068992 ric flair 1
639131130801864704 ric flair 1
639554421450518528 ric flair 0
639642857159180288 ric flair 1
639878819982217216 ric flair 1
640316079282225152 ric flair 0
640935299040837632 ric flair 1
640980744521695232 ric flair 1
630955837729538048 rick perry -2
630969108826173440 rick perry -1
630988459763630081 rick perry 0
631046890994315264 rick perry -1
631054914660208642 rick perry 0
631062393204817920 rick perry -1
631074790325948416 rick perry 0
631080764982099968 rick perry 0
631083854342696960 rick perry 0
631093394513629186 rick perry 0
631113266811535360 rick perry -1
631125539474948098 rick perry -2
631126571957526528 rick perry -2
631142584732114944 rick perry -1
631211448304275456 rick perry -1
631236570918584320 rick perry 0
631250425488904192 rick perry -1
631284054147493888 rick perry 0
631443056064135168 rick perry 0
631450098342342660 rick perry 0
631505740537040896 rick perry -1
631547008549912577 rick perry -1
631547938372583424 rick perry -1
631552011897540608 rick perry 0
631558932293656577 rick perry 1
631560895349542912 rick perry -1
631564061424111616 rick perry -1
631566440726953985 rick perry -2
631584542269181952 rick perry -1
631816294602379265 rick perry -1
631869558282915840 rick perry 0
631889459538034688 rick perry 1
631922868675325952 rick perry 0
631979163918864384 rick perry 1
632162719165235200 rick perry 1
632168541114998784 rick perry -1
632284755958956032 rick perry -1
632535550042505216 rick perry -2
632584733625442304 rick perry 1
632584825162059777 rick perry -1
632713738559221760 rick perry 0
632819879465218048 rick perry -1
633147089837424640 rick perry -1
633313021155151872 rick perry -1
633338008918433793 rick perry -1
633443743165616128 rick perry -1
633647867048017920 rick perry -1
633648878168993792 rick perry 0
633700543492435968 rick perry -2
633759343511363584 rick perry 0
633774775542902785 rick perry 1
633821009691414528 rick perry 0
633827960060014592 rick perry 1
633869705967591424 rick perry -2
634000466108678144 rick perry 0
634025917879193600 rick perry -1
634043644832563200 rick perry 0
634054903795585024 rick perry 0
634386634457264128 rick perry -1
634516378268119041 rick perry -1
634582110607642624 rick perry 0
634836715023106048 rick perry 0
635086015103926272 rick perry 1
635126711370272768 rick perry 1
635152091686699008 rick perry -1
635174440410705920 rick perry 1
635228785118347264 rick perry 1
635302461620682752 rick perry 2
635317091524960256 rick perry 1
635511937460146176 rick perry 1
635972220582522880 rick perry 1
636268162774863872 rick perry 0
636525799185752064 rick perry 0
636697201864015872 rick perry 0
636919800850092032 rick perry 1
637053685873246208 rick perry 1
637344525808046080 rick perry 0
637576831374372864 rick perry 0
637635907160424449 rick perry 0
637654185387819008 rick perry -1
637954567020412929 rick perry -1
639095967120162817 rick perry 1
639127327432118273 rick perry 0
639213915885412352 rick perry 0
639228206101434368 rick perry 0
639459343855960064 rick perry 0
639530270203494401 rick perry -1
639611172698787840 rick perry 1
639618101038870528 rick perry 0
639666418162647040 rick perry 0
639671940702208000 rick perry 1
639836926820884480 rick perry 0
639840067171786753 rick perry 2
639851720072294400 rick perry -1
639906245474828289 rick perry -1
640093913273888769 rick perry -1
640302778355548160 rick perry -1
640308536224776192 rick perry 1
641232402598227968 rick perry 1
641479820606615552 rick perry 0
637296081504616449 sarah palin 0
637307138323386368 sarah palin -1
637323305586925568 sarah palin 0
637336924651261952 sarah palin -1
637374348873986048 sarah palin 0
637383248226684928 sarah palin -1
637406432753795072 sarah palin 0
637451800472371201 sarah palin 0
637456987454767105 sarah palin 0
637476796565319680 sarah palin 0
637512960164761601 sarah palin -1
637517766627577857 sarah palin -2
637523206648147968 sarah palin -1
637557910139203584 sarah palin -1
637627074971353088 sarah palin -1
637651707325841408 sarah palin -2
637654451243884544 sarah palin 0
637685251397976064 sarah palin -1
637688304767500288 sarah palin -1
637739147529027584 sarah palin 0
637748076594204672 sarah palin 0
637778540759379968 sarah palin 1
637848111214235648 sarah palin 1
637944190954012672 sarah palin 1
638152579189489664 sarah palin 0
638155625059500032 sarah palin 0
638215268603461632 sarah palin -1
638316929497886720 sarah palin -1
638450291264778240 sarah palin 0
638467454377791488 sarah palin 0
638514104383225857 sarah palin -1
638879132349132801 sarah palin 1
638895394576052224 sarah palin 1
639049337574592512 sarah palin 0
639461839760396288 sarah palin 1
639892003640209410 sarah palin -1
639945279211356160 sarah palin -1
639967442328879105 sarah palin 0
639969093827842048 sarah palin 0
640002631541346304 sarah palin 0
640026183275520000 sarah palin -1
640278522116837376 sarah palin -1
640294637278785536 sarah palin 0
640365968535871489 sarah palin 0
640511154809208832 sarah palin -2
640512199014744064 sarah palin -1
640518872412626944 sarah palin 0
640526445983338497 sarah palin 0
640530992344756224 sarah palin -1
640536744018898944 sarah palin 0
640540228479008768 sarah palin 0
640543467542851584 sarah palin -1
640547594549260288 sarah palin -1
640557580675215360 sarah palin 0
640559245037993984 sarah palin -1
640563059161853952 sarah palin -2
640585083758379012 sarah palin -1
640591357669679104 sarah palin -1
640596060403073029 sarah palin -1
640613361441472513 sarah palin -1
640646935485898752 sarah palin -2
640648943412490240 sarah palin -2
640662208465125376 sarah palin -1
640691495775940608 sarah palin -1
640695245429018624 sarah palin -1
640702440166281216 sarah palin 0
640717115809394688 sarah palin 0
640743005939331073 sarah palin 0
640746323520524288 sarah palin 0
640761809968889856 sarah palin 1
640766599172091904 sarah palin 0
640786774533517312 sarah palin -1
640793086889754624 sarah palin -1
640795901733306368 sarah palin -1
640809645305634816 sarah palin -1
640815884156710912 sarah palin -1
640823599461437440 sarah palin -1
640831813582061569 sarah palin -1
640845564884578304 sarah palin -1
640848405590315008 sarah palin -1
640876806195793920 sarah palin -1
640899655501500416 sarah palin 0
640910366915043328 sarah palin -1
640929313005682688 sarah palin -1
640952814060105732 sarah palin -1
640969544534769664 sarah palin 0
641025333542670336 sarah palin 0
641044014746079232 sarah palin 0
641047727380410368 sarah palin 0
641049345262006272 sarah palin -1
641064723170086912 sarah palin -2
641071260944990209 sarah palin -1
641101803388452865 sarah palin -1
641104702353108992 sarah palin 0
641151175639887872 sarah palin -2
641228106515116032 sarah palin 0
641243881791733760 sarah palin 0
641289540531949569 sarah palin -2
641290077570772992 sarah palin 0
641300961944690688 sarah palin 0
639663874535329793 scotus 0
639783358613090304 scotus 0
639799404963188736 scotus 1
639800231798833152 scotus -1
639813619681591297 scotus -2
639814702919512064 scotus 0
639814785849249792 scotus 0
639827780126023680 scotus 1
639840882250747905 scotus 0
639842069754724352 scotus 1
639846074773966848 scotus 0
639847221429604352 scotus -1
639871330884710400 scotus -1
639877726342615040 scotus 0
639899524287328256 scotus 0
639908441239121920 scotus 0
639920701462417408 scotus 0
639923579715457024 scotus 1
639942159710359552 scotus 0
639955341329887232 scotus -1
639971268490489857 scotus 0
639976673685962752 scotus 0
639996273005715456 scotus 0
640019777906278400 scotus -1
640021067373903872 scotus -1
640050805094117376 scotus -1
640082991725838336 scotus -1
640141373132308480 scotus 0
640144806333841408 scotus 0
640184205087866880 scotus 0
640188751050739713 scotus 0
640191170765787136 scotus -1
640195502542221312 scotus 0
640202097057660928 scotus 0
640211367736139777 scotus 0
640212720181215233 scotus -1
640216083870429184 scotus 0
640221587455766529 scotus 0
640240604631404544 scotus 0
640249970185138176 scotus 1
640266753499656193 scotus -1
640270216287662080 scotus -1
640286568876478465 scotus 0
640292871317360640 scotus 0
640299061501890560 scotus 0
640302029861187584 scotus 1
640307255225679872 scotus 0
640321231003086848 scotus 1
640364470720552960 scotus 1
640378017571840000 scotus 1
640378655299010564 scotus -1
640413326887927808 scotus 0
640423375093927938 scotus 1
640452337081917440 scotus -1
640485746567159809 scotus -1
640522599710261250 scotus -1
640547283952513024 scotus -1
640549180524523520 scotus 0
640567390766436353 scotus 0
640576816646877184 scotus 0
640579947803856896 scotus -1
640587108135084032 scotus -1
640629018480541696 scotus -1
640680528061026304 scotus 0
640682805031104513 scotus -1
640704731300532225 scotus 1
640711651906449408 scotus -1
640727363693756416 scotus 1
640733826705190912 scotus 1
640783423683096576 scotus 0
640858678149578752 scotus 0
640877966658932737 scotus 1
640930214453710849 scotus 0
640972376159723524 scotus 0
640979024832036865 scotus 1
641030697742958593 scotus 0
641058451276230656 scotus -1
641091314533167104 scotus -1
641111532282224640 scotus 0
641214840778821632 scotus 0
641237623994912768 scotus 0
641243291032403968 scotus 0
641301037941411840 scotus 0
641325470051659776 scotus -1
641334469740339201 scotus 0
641338694314491904 scotus -1
641360470864072705 scotus -1
641389088155697153 scotus -1
641405573452447744 scotus -1
641429844367179777 scotus -1
641434395186958341 scotus 0
641438564329353216 scotus 0
641442574738194432 scotus 0
641461009962672129 scotus 0
641517206455648256 scotus 0
641558464356052992 scotus 0
641584242628038660 scotus 0
641616155619258368 scotus 1
641627366666670080 scotus 1
641666293842739200 scotus 1
624345641813192706 seinfeld 0
624355743743905792 seinfeld 1
624783615231139840 seinfeld 1
624932163734085632 seinfeld 1
625473043037560832 seinfeld 1
625499047218950144 seinfeld 1
625530436064669696 seinfeld 1
625801688834772992 seinfeld 1
625858186482855936 seinfeld 2
626213731610009600 seinfeld 1
626459179927085056 seinfeld 1
626557292801052672 seinfeld 1
626852305539846144 seinfeld 0
626867816755499008 seinfeld 0
626909122332483584 seinfeld 1
626934104047656960 seinfeld 0
627279973569662976 seinfeld 1
627362773635215360 seinfeld 0
627854371309490176 seinfeld 1
627913350354108416 seinfeld 0
628313174555672578 seinfeld 0
628656287061032960 seinfeld 1
629312256300290048 seinfeld 1
629416290491330561 seinfeld 1
629468407201599488 seinfeld 1
629481841582579712 seinfeld 1
629501849054228480 seinfeld 1
629577180134158336 seinfeld 1
629736285972885505 seinfeld 2
630062576425115648 seinfeld 0
630225511604596736 seinfeld 1
630450118899019777 seinfeld 1
630770168466178048 seinfeld 0
630771760762195968 seinfeld 0
630784505117159424 seinfeld 0
630944182396416000 seinfeld 0
630964334055665664 seinfeld 0
631180745046757376 seinfeld 1
631283189349093376 seinfeld 1
631561607584325632 seinfeld 1
631622798990024705 seinfeld 1
631685323789963264 seinfeld 1
631865674701369344 seinfeld 0
631920188640886784 seinfeld 0
632006249660321792 seinfeld 1
632207900597989376 seinfeld 1
632411629246808064 seinfeld -1
632458448429559808 seinfeld 0
632707273677127680 seinfeld 1
633477117720723456 seinfeld 0
633775894570516484 seinfeld 1
634597521432571904 seinfeld 1
634717025823256576 seinfeld 1
634869987312861185 seinfeld 1
634875393619562496 seinfeld 1
634894726114770948 seinfeld 0
634975076291469312 seinfeld 1
635291173968564224 seinfeld 1
635419663875215360 seinfeld 0
635624424004186113 seinfeld 1
635949157296013312 seinfeld 1
636041017246912512 seinfeld 1
636150273858228224 seinfeld 1
636322365455081472 seinfeld 1
636404876847656960 seinfeld 1
636605176460255233 seinfeld 1
636730819281747968 seinfeld 1
636923345649307648 seinfeld 1
637019584420147200 seinfeld 1
637055693250543616 seinfeld 1
637091718681071616 seinfeld 1
637411189048262656 seinfeld -1
637552809009807360 seinfeld 0
637737097533747200 seinfeld 1
638156422694469632 seinfeld 1
638180450415079425 seinfeld 0
638230823846678528 seinfeld 1
638839577923465217 seinfeld 1
638919958005612546 seinfeld 0
639089469312864256 seinfeld 2
639145635329896448 seinfeld 1
639220298118787072 seinfeld 1
639233733313331201 seinfeld 1
639263104971481088 seinfeld 1
639277479056642048 seinfeld 1
639820569333002240 seinfeld 1
639908033196376068 seinfeld 1
639998827211132928 seinfeld 1
640066433452347393 seinfeld 1
640407462189867010 seinfeld 1
640557852587917312 seinfeld 1
640729081902841856 seinfeld 1
640767855470882816 seinfeld 1
640944206479933441 seinfeld 1
641171441753432064 seinfeld 1
641195230100852736 seinfeld 1
641289066244247552 seinfeld 1
641409125465894912 seinfeld 0
641424681573048320 seinfeld 1
641426228973563904 seinfeld 1
641431992794386432 serena 1
641431997152411650 serena 1
641432027129061376 serena 1
641432034490122240 serena 1
641432099812175872 serena 0
641432100785266689 serena 1
641432133991538688 serena 1
641432151506878464 serena 1
641432231395770368 serena 1
641432315302907905 serena 1
641432374119669760 serena 1
641432421057957888 serena 0
641432511420203008 serena 1
641432970675425280 serena 1
641433012601643008 serena 0
641433049637351424 serena 1
641433111369240577 serena 0
641433410305695744 serena 1
641433821385203712 serena 2
641433821393625088 serena 2
641433955124666368 serena 1
641434002071666688 serena 1
641434266098905088 serena 1
641434348642676736 serena 1
641434391651201024 serena 0
641435251168944128 serena 0
641435745627033600 serena 2
641436333936914432 serena -1
641436496982110210 serena 0
641436767162232832 serena 1
641436920824901632 serena 1
641436936536760320 serena 1
641436949409042433 serena 1
641438913748422656 serena 0
641439718920617984 serena 2
641439881588277248 serena 0
641440535593488384 serena 1
641441219835523072 serena 2
641441557816676352 serena 1
641442191064330240 serena 1
641442478579515392 serena 1
641443950000148480 serena 1
641444538431766528 serena 1
641445384108290048 serena 1
641446032048451585 serena 1
641446874537332736 serena 2
641447364406841344 serena 1
641448087903424512 serena 1
641448417558953984 serena 1
641449051070857216 serena 0
641451769638309892 serena 0
641457607975145472 serena 0
641462065530576896 serena 1
641469942877974528 serena 1
641472418616217600 serena 1
641477750323322881 serena 1
641484888542089216 serena 1
641485678761615360 serena 1
641487029058973696 serena 0
641489328632238080 serena 1
641490544041066496 serena 0
641493419446112256 serena 0
641495629831663616 serena 1
641496948487376896 serena 0
641500409052426240 serena 1
641506795706429441 serena 0
641508083093508096 serena 0
641509985646694400 serena 0
641510535322689536 serena 0
641512553986723840 serena 0
641519595401150464 serena 1
641531494129905665 serena 1
641543041254199296 serena 1
641545771335188481 serena 0
641552507282542592 serena 1
641553308935700481 serena 1
641554182491742208 serena 1
641560350941409280 serena 1
641567333308366848 serena 0
641570899481616384 serena 1
641578295688097792 serena 1
641580752992358400 serena 0
641587270013751296 serena 1
641591603946225664 serena 1
641598412480122880 serena 2
641608312568483840 serena 1
641612849903730688 serena 0
641620677108334592 serena 1
641623505499475968 serena 1
641623840477589504 serena 2
641624729212682240 serena 1
641627538826002432 serena 1
641629158540505088 serena 1
641633503940059136 serena 0
641635751617105920 serena 2
641648472266022913 serena 1
641658304851279872 serena 1
641666231993548800 serena 1
641668866796490752 serena 1
641671309974470656 serena 1
628128485740007424 snoop dogg 0
628150426156838912 snoop dogg 0
628192370761310208 snoop dogg 1
628228830134669312 snoop dogg 1
628313832226705408 snoop dogg 2
628345809197793280 snoop dogg 1
628391226128093184 snoop dogg 2
628443827330641920 snoop dogg 0
628580310863757312 snoop dogg 0
628663552887406592 snoop dogg 0
629127841519661062 snoop dogg 0
629133839793664001 snoop dogg -1
629475381830094848 snoop dogg 0
629503433855340544 snoop dogg 1
629778625701654528 snoop dogg 1
629790655909339136 snoop dogg 1
629822402537492480 snoop dogg 1
629873683247398912 snoop dogg 1
630198560563200000 snoop dogg 1
630268931756965889 snoop dogg 1
630310358746570753 snoop dogg 1
630649455801339905 snoop dogg 1
630970831988920320 snoop dogg 0
631014099888029696 snoop dogg 1
631498673864753152 snoop dogg 1
631521987257630721 snoop dogg 1
631984939144122368 snoop dogg 1
632183333804474368 snoop dogg 1
632218481753088000 snoop dogg 0
632224183825661953 snoop dogg 1
632245627611541504 snoop dogg 1
632252467435192320 snoop dogg 0
632416918931120128 snoop dogg -1
632488083393351680 snoop dogg 0
632585873792479232 snoop dogg 0
632728860375797760 snoop dogg 1
632729034078703616 snoop dogg 1
633144508243292160 snoop dogg 1
633183389458141184 snoop dogg 1
633468622363455488 snoop dogg 1
634080634940428288 snoop dogg 0
634097433773891584 snoop dogg 1
634182282362929152 snoop dogg 1
634203696872579072 snoop dogg 1
634225763709947904 snoop dogg 0
634441913228201984 snoop dogg 1
634614045543387136 snoop dogg 0
634815504423759872 snoop dogg 0
634820641129009153 snoop dogg 1
634939959879688194 snoop dogg 1
635219071500439553 snoop dogg -2
635285109793492992 snoop dogg 1
635667537120747520 snoop dogg -1
635686970698657792 snoop dogg 0
635705106231488513 snoop dogg 0
635879769578455042 snoop dogg 0
635902209285357569 snoop dogg 1
635922768035491840 snoop dogg 1
636634831967817728 snoop dogg 1
637000642347823104 snoop dogg 1
637392303624065025 snoop dogg 0
637422597639114754 snoop dogg 1
637440566226194432 snoop dogg 0
637517022146990080 snoop dogg 1
637688180976807936 snoop dogg 1
637745017877086208 snoop dogg 2
637830683088416768 snoop dogg 1
638232357632258048 snoop dogg 0
638536568660213760 snoop dogg 1
638679848609816576 snoop dogg 1
638826550331183104 snoop dogg 1
638835281043451904 snoop dogg 0
638842278296047616 snoop dogg 0
638844609305673728 snoop dogg 0
638844818991374336 snoop dogg 0
638850695349800960 snoop dogg -1
638864096041893888 snoop dogg 0
638877048195411968 snoop dogg 0
638882161714704384 snoop dogg 0
638885497318862848 snoop dogg 1
638885983166046209 snoop dogg -1
638891695057317888 snoop dogg 0
639241052650536960 snoop dogg 1
639301319396712448 snoop dogg 1
639610778841018368 snoop dogg 1
639646079567327232 snoop dogg 0
639650213637042176 snoop dogg 0
639798561979273216 snoop dogg 1
639808490249318402 snoop dogg 1
639961590159159296 snoop dogg 1
640393727173861376 snoop dogg 1
640576226340376576 snoop dogg 1
640591485612650498 snoop dogg 1
640893255316566016 snoop dogg 1
640906424290254849 snoop dogg 1
640916034749263872 snoop dogg 1
641037652414742528 snoop dogg 1
641218824579215360 snoop dogg 0
641349309439479808 snoop dogg 1
641648318754516992 snoop dogg 2
| {
"pile_set_name": "Github"
} |
var Transform = require('../transform');
var inherits = require('util').inherits;
// subclass
function MyStream () {
Transform.call(this, {
lowWaterMark: 0,
encoding: 'utf8'
});
}
inherits(MyStream, Transform);
MyStream.prototype._transform = function (chunk, outputFn, callback) {
outputFn(new Buffer(String(chunk).toUpperCase()));
callback();
};
// use it!
var s = new MyStream();
process.stdin.resume();
process.stdin.pipe(s).pipe(process.stdout);
if (process.stdin.setRawMode)
process.stdin.setRawMode(true);
process.stdin.on('data', function (c) {
c = c.toString();
if (c === '\u0003' || c === '\u0004') {
process.stdin.pause();
s.end();
}
if (c === '\r')
process.stdout.write('\n');
});
| {
"pile_set_name": "Github"
} |
/* CSS file placeholder. */
| {
"pile_set_name": "Github"
} |
// Protocol Buffers - Google's data interchange format
// Copyright 2014 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// 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.
#ifndef GOOGLE_PROTOBUF_CASTS_H__
#define GOOGLE_PROTOBUF_CASTS_H__
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/type_traits.h>
namespace google_public {
namespace protobuf {
namespace internal {
// Use implicit_cast as a safe version of static_cast or const_cast
// for upcasting in the type hierarchy (i.e. casting a pointer to Foo
// to a pointer to SuperclassOfFoo or casting a pointer to Foo to
// a const pointer to Foo).
// When you use implicit_cast, the compiler checks that the cast is safe.
// Such explicit implicit_casts are necessary in surprisingly many
// situations where C++ demands an exact type match instead of an
// argument type convertable to a target type.
//
// The From type can be inferred, so the preferred syntax for using
// implicit_cast is the same as for static_cast etc.:
//
// implicit_cast<ToType>(expr)
//
// implicit_cast would have been part of the C++ standard library,
// but the proposal was submitted too late. It will probably make
// its way into the language in the future.
template<typename To, typename From>
inline To implicit_cast(From const &f) {
return f;
}
// When you upcast (that is, cast a pointer from type Foo to type
// SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts
// always succeed. When you downcast (that is, cast a pointer from
// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
// how do you know the pointer is really of type SubclassOfFoo? It
// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
// when you downcast, you should use this macro. In debug mode, we
// use dynamic_cast<> to double-check the downcast is legal (we die
// if it's not). In normal mode, we do the efficient static_cast<>
// instead. Thus, it's important to test in debug mode to make sure
// the cast is legal!
// This is the only place in the code we should use dynamic_cast<>.
// In particular, you SHOULDN'T be using dynamic_cast<> in order to
// do RTTI (eg code like this:
// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
// You should design the code some other way not to need this.
template<typename To, typename From> // use like this: down_cast<T*>(foo);
inline To down_cast(From* f) { // so we only accept pointers
// Ensures that To is a sub-type of From *. This test is here only
// for compile-time type checking, and has no overhead in an
// optimized build at run-time, as it will be optimized away
// completely.
if (false) {
implicit_cast<From*, To>(0);
}
#if !defined(NDEBUG) && !defined(GOOGLE_PROTOBUF_NO_RTTI)
assert(f == NULL || dynamic_cast<To>(f) != NULL); // RTTI: debug mode only!
#endif
return static_cast<To>(f);
}
template<typename To, typename From> // use like this: down_cast<T&>(foo);
inline To down_cast(From& f) {
typedef typename remove_reference<To>::type* ToAsPointer;
// Ensures that To is a sub-type of From *. This test is here only
// for compile-time type checking, and has no overhead in an
// optimized build at run-time, as it will be optimized away
// completely.
if (false) {
implicit_cast<From*, ToAsPointer>(0);
}
#if !defined(NDEBUG) && !defined(GOOGLE_PROTOBUF_NO_RTTI)
// RTTI: debug mode only!
assert(dynamic_cast<ToAsPointer>(&f) != NULL);
#endif
return *static_cast<ToAsPointer>(&f);
}
template<typename To, typename From>
inline To bit_cast(const From& from) {
GOOGLE_COMPILE_ASSERT(sizeof(From) == sizeof(To),
bit_cast_with_different_sizes);
To dest;
memcpy(&dest, &from, sizeof(dest));
return dest;
}
} // namespace internal
// We made these internal so that they would show up as such in the docs,
// but we don't want to stick "internal::" in front of them everywhere.
using internal::implicit_cast;
using internal::down_cast;
using internal::bit_cast;
} // namespace protobuf
} // namespace google
#endif // GOOGLE_PROTOBUF_CASTS_H__
| {
"pile_set_name": "Github"
} |
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2013 Oracle 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://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/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 packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle 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.
*/
// Portions Copyright [2018-2019] [Payara Foundation and/or its affiliates]
/*
* AutoDeployer.java
*
*
* Created on February 19, 2003, 10:21 AM
*/
package org.glassfish.deployment.autodeploy;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.SEVERE;
import java.io.File;
import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.glassfish.api.ActionReport;
import org.glassfish.api.admin.ServerEnvironment;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.logging.annotation.LogMessageInfo;
import org.glassfish.logging.annotation.LogMessagesResourceBundle;
import org.glassfish.logging.annotation.LoggerInfo;
import com.sun.enterprise.util.LocalStringManagerImpl;
/**
* Handles the logic of deploying the module/app to the required destination.</br>
* The destination is specified on the constructor and can be modified by calling setTarget(). The specific directory
* scanner can be set using setDirectoryScanner, default is AutoDeployDirectoryScanner
*
* @author vikas
* @author tjquinn
*/
public class AutoDeployer {
private final static LocalStringManagerImpl localStrings = new LocalStringManagerImpl(AutoDeployer.class);
@LogMessagesResourceBundle
private static final String SHARED_LOGMESSAGE_RESOURCE = "org.glassfish.deployment.LogMessages";
// Reserve this range [NCLS-DEPLOYMENT-02001, NCLS-DEPLOYMENT-04000]
// for message ids used in this deployment autodeploy module
@LoggerInfo(subsystem = "DEPLOYMENT", description = "Deployment logger for autodeploy module", publish = true)
private static final String DEPLOYMENT_LOGGER = "javax.enterprise.system.tools.deployment.autodeploy";
public static final Logger deplLogger = Logger.getLogger(DEPLOYMENT_LOGGER, SHARED_LOGMESSAGE_RESOURCE);
@LogMessageInfo(message = "Exception caught: {0}", cause = "An exception was caught when the application was autodeployed.", action = "See the exception to determine how to fix the error", level = "SEVERE")
private static final String EXCEPTION_CAUGHT = "NCLS-DEPLOYMENT-02025";
@LogMessageInfo(message = "Autoundeploying application: {0}", level = "INFO")
private static final String AUTODEPLOYING_APPLICATION = "NCLS-DEPLOYMENT-02026";
@LogMessageInfo(message = "Selecting file {0} for autodeployment", level = "INFO")
private static final String SELECTING_FILE = "NCLS-DEPLOYMENT-02027";
private static final boolean DEFAULT_RENAME_ON_SUCCESS = true;
private static final boolean DEFAULT_FORCE_DEPLOY = true;
private static final boolean DEFAULT_INCLUDE_SUBDIR = false;
private static final boolean DEFAULT_ENABLED = true;
/*
* Represent the result of attempting autodeployment of a single file. PENDING indicates the file could not be opened as
* an archive, perhaps because the file was still in the process of being copied when the autodeployer tried to work
* with it. PENDING could also mean that the file has changed size since the last time the autodeployer checked it. It's
* then reasonable to think it might grow further, so autodeployer waits until the next time through to check it again.
*/
protected static final int DEPLOY_SUCCESS = 1;
protected static final int DEPLOY_FAILURE = 2;
protected static final int DEPLOY_PENDING = 3;
static final String STATUS_SUBDIR_PATH = ".autodeploystatus";
private Boolean verify;
private Boolean forceDeploy;
private Boolean enabled;
private Boolean jspPreCompilation;
private boolean renameOnSuccess = true;
private String target;
private File directory;
private String virtualServer;
private boolean cancelDeployment;
private AtomicBoolean inProgress = new AtomicBoolean(false);
private ServiceLocator serviceLocator;
private DirectoryScanner directoryScanner;
private AutodeployRetryManager retryManager;
private File domainRoot;
/**
* Creates a new autodeployer.
*
* @param target deployment target for autodeployed applications
* @param directoryPath directory to be scanned for changes
* @param virtualServer the virtual server to which to deploy apps to
* @param serviceLocator hk2 habitat for injection support
* @throws org.glassfish.deployment.autodeploy.AutoDeploymentException
*/
public AutoDeployer(String target, String directoryPath, String virtualServer, ServiceLocator serviceLocator) throws AutoDeploymentException {
this(target, directoryPath, virtualServer, false /* jspPreCompilation */, false /* verifierEnabled */, serviceLocator);
}
/**
* Creates a new instance of AutoDeployer
*
* @param target the deployment target for autodeployed applications
* @param directoryPath the directory to scan
* @param virtualServer the virtual server to deploy to
* @param jspPrecompilationEnabled whether to precompile JSPs
* @param verifierEnabled whether to verify applications during deployment
* @param renameOnSuccess rename the file if deployment is successful
* @param forceDeploy request that forced deployment occur if the app is already deployed
* @param enabled whether apps should be enabled upon auto-deployment
* @param serviceLocator HK2 serviceLocator for use in instantiating properly-init'd DeployCommand and UndeployCommand
* @throws org.glassfish.deployment.autodeploy.AutoDeploymentException
*/
public AutoDeployer(String target, String directoryPath, String virtualServer, boolean jspPrecompilationEnabled, boolean verifierEnabled,
boolean renameOnSuccess, boolean forceDeploy, boolean enabled, ServiceLocator serviceLocator) throws AutoDeploymentException {
setServiceLocator(serviceLocator);
setTarget(target);
setDirectory(directoryPath);
setJspPrecompilationEnabled(jspPrecompilationEnabled);
setVerifierEnabled(verifierEnabled);
setRenameOnSuccess(renameOnSuccess);
setForceDeploy(forceDeploy);
setVirtualServer(virtualServer);
setEnabled(enabled);
setRetryManager(serviceLocator);
}
public AutoDeployer(String target, String directoryPath, String virtualServer, boolean jspPrecompilationEnabled, boolean verifierEnabled,
ServiceLocator serviceLocator) throws AutoDeploymentException {
this(target, directoryPath, virtualServer, jspPrecompilationEnabled, verifierEnabled, DEFAULT_RENAME_ON_SUCCESS, DEFAULT_FORCE_DEPLOY, DEFAULT_ENABLED,
serviceLocator);
}
/**
* Sets the serviceLocator for use in creating DeployCommand and UndeployCommand instances.
*
* @param serviceLocator
*/
public void setServiceLocator(ServiceLocator serviceLocator) {
this.serviceLocator = serviceLocator;
}
/**
* Sets whether or not the precompileJSP option should be requested during autodeployments.
*
* @param setting true if JSPs should be precompiled during autodeployments
*/
public void setJspPrecompilationEnabled(boolean setting) {
jspPreCompilation = setting;
}
/**
* Sets the directory to be scanned by the autodeployer.
*
* @param directoryPath the directory path to scan
* @throws org.glassfish.deployment.autodeploy.AutoDeploymentException
*/
public void setDirectory(String directoryPath) throws AutoDeploymentException {
validateAutodeployDirectory(directoryPath);
this.directory = new File(directoryPath);
}
/**
* Sets whether descriptor verification should be requested during autodeployments.
*
* @param verify true if verification should occur during autodeployments
*/
public void setVerifierEnabled(boolean verify) {
this.verify = verify;
}
/**
* Creates the directories for the specified target, except that if the target is/would be a descendant of the base and
* the base does not exist don't create anything.
* <p>
* This helps avoid a race condition in which the user stops the domain (which apparently reports success long before it
* actually finishes) then deletes the domain. The delete can run before the server has finished stopping. In some
* cases, the autodeployer has run in the meantime and
*
* @param baseDir
* @param dir
* @return true if the directory and all intervening ones were created; false otherwise
*/
boolean mkdirs(File baseDir, File targetDir) {
URI baseURI = baseDir.toURI().normalize();
URI targetURI = targetDir.toURI().normalize();
/*
* Go ahead and create all directories if the target falls outside the base OR if the target falls inside the base and
* the base exists.
*/
if (baseURI.relativize(targetURI).equals(targetURI) || baseDir.exists()) {
return targetDir.mkdirs();
}
/*
* The target would fall inside the base but the base does not exist.
*/
return false;
}
private void validateAutodeployDirectory(String autodeployDirPath) throws AutoDeploymentException {
File autodeployDir = new File(autodeployDirPath);
validateDirectory(autodeployDir);
validateDirectory(new File(autodeployDir, STATUS_SUBDIR_PATH));
}
private synchronized File domainRoot() {
if (domainRoot == null) {
domainRoot = serviceLocator.getService(ServerEnvironment.class).getInstanceRoot();
}
return domainRoot;
}
private void validateDirectory(File dirFile) throws AutoDeploymentException {
if (!dirFile.exists()) {
mkdirs(domainRoot(), dirFile);
} else {
if (!dirFile.isDirectory()) {
throw new AutoDeploymentException(
localStrings.getLocalString("enterprise.deployment.autodeploy.invalid_source_dir", "invalid source directory {0}", dirFile));
}
}
if (!dirFile.canRead()) {
throw new AutoDeploymentException(
localStrings.getLocalString("enterprise.deployment.autodeploy.dir_not_readable", "directory {0} not readable", dirFile));
}
if (!dirFile.canWrite()) {
throw new AutoDeploymentException(
localStrings.getLocalString("enterprise.deployment.autodeploy.dir_not_writeable", "directory {0} not writable", dirFile));
}
}
private void setRenameOnSuccess(boolean rename) {
renameOnSuccess = rename;
}
private void setForceDeploy(boolean force) {
forceDeploy = force;
}
private void setVirtualServer(String vs) {
virtualServer = vs;
}
private void setEnabled(boolean setting) {
enabled = setting;
}
/**
* set DirectoryScanner which will be used for filtering out deployeble component
*
* @param directoryScanner the new directory scanner to use
*/
public void setDirectoryScanner(DirectoryScanner directoryScanner) {
this.directoryScanner = directoryScanner;
}
/**
* set target server where the autual deployment will be done
*
* @param target
*/
public void setTarget(String target) {
this.target = target;
}
/**
* If an archive is successfully autodeployed, file will not be renamed to archive_deployed
*/
public void disableRenameOnSuccess() {
renameOnSuccess = false;
}
/**
* If an archive is successfully autodeployed will be renamed to archive_deployed
*/
public void enableRenameOnSuccess() {
// FIXME - Mahesh
renameOnSuccess = true;
}
/**
* Set whether this AutoDeployer should verify or not.
*
* @param verify whether to verify the app during deployment
*/
public void setVerify(boolean verify) {
this.verify = verify;
}
/**
* Set whether this AutoDeployer should precompile JSPs or not.
*
* @param jspPreCompilation precompilation setting
*/
public void setJspPreCompilation(boolean jspPreCompilation) {
this.jspPreCompilation = jspPreCompilation;
}
/**
* Run through the auto-deployment procedure.
* <p>
* Clients should invoke this method to execute the auto-deployer once with the current configurable settings.
*/
public void run() {
if (directory.exists()) {
run(DEFAULT_INCLUDE_SUBDIR);
} else {
deplLogger.fine("autodeploy directory does not exist");
}
}
public synchronized void run(boolean includeSubdir) {
markInProgress();
try {
deployAll(directory, includeSubdir);
undeployAll(directory, includeSubdir);
} catch (AutoDeploymentException e) {
// print and continue
LogRecord logrecord = new LogRecord(SEVERE, EXCEPTION_CAUGHT);
logrecord.setParameters(new Object[] { e.getMessage() });
logrecord.setThrown(e);
deplLogger.log(logrecord);
} finally {
clearInProgress();
}
}
void init() {
cancelDeployment = false;
}
private void setRetryManager(ServiceLocator serviceLocator) {
retryManager = serviceLocator.getService(AutodeployRetryManager.class);
}
private void markInProgress() {
inProgress.set(true);
}
private void clearInProgress() {
inProgress.set(false);
notifyAll();
}
public synchronized void waitUntilIdle() throws InterruptedException {
while (!inProgress.get()) {
wait();
}
}
/**
* do deployment for all the deployable components in autoDeployDir dir.
*
* @return
*/
private void deployAll(File autoDeployDir, boolean includeSubDir) throws AutoDeploymentException {
// create with default scanner
if (directoryScanner == null) {
directoryScanner = new AutoDeployDirectoryScanner();
}
File[] files = null;
// get me all deployable entities
files = directoryScanner.getAllDeployableModules(autoDeployDir, includeSubDir);
/*
* To support slowly-copied files, the deploy method returns DEPLOY_SUCCESS if the file was successfully autodeployed
* DEPLOY_FAILURE if the file failed to be autodeployed DEPLOY_PENDING if the file needs to be tried again later
*
* The marker files should be updated only if the result is success or failure. So for each file make a separate
* decision about whether to record the result or not based on the result of the deploy method. Note that the boolean is
* initialized to true so that if an exception is thrown, the file's marker files will be updated.
*/
if (files != null && files.length > 0) {
deplLogger.log(Level.FINE, "Deployable files: {0}", Arrays.toString(files));
for (int i = 0; ((i < files.length) && !cancelDeployment); i++) {
boolean okToRecordResult = true;
try {
okToRecordResult = (deploy(files[i], autoDeployDir) != AutodeploymentStatus.PENDING);
} catch (AutoDeploymentException ae) {
// ignore and move to next file
} finally {
if (renameOnSuccess && okToRecordResult) {
deplLogger.log(Level.FINE, "Reporting deployed entity {0}", files[i].getAbsolutePath());
directoryScanner.deployedEntity(autoDeployDir, files[i]);
}
}
}
}
}
/**
* do undeployment for all deleted applications in autoDeployDir dir.
*
* @param autoDeployDir the directory to scan for deleted files
* @param includeSubdir
* @throws org.glassfish.deployment.autodeploy.AutoDeploymentException
*/
public void undeployAll(File autoDeployDir, boolean includeSubdir) throws AutoDeploymentException {
// create with default scanner
if (directoryScanner == null) {
directoryScanner = new AutoDeployDirectoryScanner();
}
File[] apps = null;
// get me all apps
apps = directoryScanner.getAllFilesForUndeployment(autoDeployDir, includeSubdir);
// deploying all applications
if (apps != null) {
for (int i = 0; i < apps.length && !cancelDeployment; i++) {
try {
undeploy(apps[i], getNameFromFilePath(autoDeployDir, apps[i]));
} catch (AutoDeploymentException ae) {
// ignore and move to next file
} finally {
// Mark the application as undeployed both in the case of success & failure.
directoryScanner.undeployedEntity(autoDeployDir, apps[i]);
}
}
}
///////// end for apps
}
private AutodeploymentStatus undeploy(File applicationFile, String name) throws AutoDeploymentException {
AutoUndeploymentOperation autoUndeploymentOperation = AutoUndeploymentOperation.newInstance(serviceLocator, applicationFile, name, target);
deplLogger.log(INFO, AUTODEPLOYING_APPLICATION, name);
return autoUndeploymentOperation.run();
}
/**
* Set cancel flag, which will ensure that only if there is any current deployment is in process, it will be completed
* but the deployer will not do any more deployment.
*
* @param value the cancel setting
*/
public void cancel(boolean value) {
cancelDeployment = value;
}
/**
* get cancel flag value
*
* @return
*/
public boolean isCancelled() {
return cancelDeployment;
}
/**
* Deploy any type of module.
*
* @param deployablefile the file to be deployed
* @param autodeployDir the directory where the file resides (holdover from earlier impl)
* @return status of the deployment attempt: DEPLOY_SUCCESS, DEPLOY_FAILURE, or DEPLOY_PENDING
* @throws AutoDeploymentException if any invoked method throws an exception
*/
protected AutodeploymentStatus deploy(File deployablefile, File autodeployDir) throws AutoDeploymentException {
String file = deployablefile.getAbsolutePath();
if (!retryManager.shouldAttemptDeployment(deployablefile)) {
return AutodeploymentStatus.PENDING;
}
deplLogger.log(INFO, SELECTING_FILE, file);
AutoDeploymentOperation ad = AutoDeploymentOperation.newInstance(serviceLocator, renameOnSuccess, deployablefile, enabled, virtualServer, forceDeploy, verify,
jspPreCompilation, target);
AutodeploymentStatus adStatus = ad.run();
return adStatus;
}
public static String getNameFromFilePath(File autodeployDir, File filePath) { // creating module name as file name
File parent = filePath.getParentFile();
String moduleName = null;
while (!parent.getAbsolutePath().equals(autodeployDir.getAbsolutePath())) {
if (moduleName == null) {
moduleName = parent.getName();
} else {
moduleName = parent.getName() + "_" + moduleName;
}
parent = parent.getParentFile();
}
if (moduleName == null) {
moduleName = filePath.getName();
} else {
moduleName = moduleName + "_" + filePath.getName();
}
int toIndex = moduleName.lastIndexOf('.');
if (toIndex > 0) {
moduleName = moduleName.substring(0, toIndex);
}
return moduleName;
}
public enum AutodeploymentStatus {
SUCCESS(true, ActionReport.ExitCode.SUCCESS, "enterprise.deployment.autodeploy.successfully_autodeployed", "deployment of {0} succeeded",
"enterprise.deployment.autodeploy.successfully_autoundeployed", "undeployment of {0} succeeded"),
FAILURE(false, ActionReport.ExitCode.FAILURE, "enterprise.deployment.autodeploy.autodeploy_failed", "deployment of {0} failed",
"enterprise.deployment.autodeploy.autoundeploy_failed", "undeployment of {0} failed"),
WARNING(true, ActionReport.ExitCode.WARNING, "enterprise.deployment.autodeploy.warning_autodeployed", "deployment of {0} succeeded with warning(s)",
"enterprise.deployment.autodeploy.warning_autoundeployed", "undeployment of {0} succeeded with warning(s)"),
PENDING(true, ActionReport.ExitCode.SUCCESS, "", "", "", "");
;
final boolean status;
final ActionReport.ExitCode exitCode;
final String deploymentMessageKey;
final String undeploymentMessageKey;
final String deploymentDefaultMessage;
final String undeploymentDefaultMessage;
AutodeploymentStatus(boolean status, ActionReport.ExitCode exitCode, String deploymentMessageKey, String deploymentDefaultMessage,
String undeploymentMessageKey, String undeploymentDefaultMessage) {
this.status = status;
this.exitCode = exitCode;
this.deploymentMessageKey = deploymentMessageKey;
this.deploymentDefaultMessage = deploymentDefaultMessage;
this.undeploymentMessageKey = undeploymentMessageKey;
this.undeploymentDefaultMessage = undeploymentDefaultMessage;
}
public static AutodeploymentStatus forExitCode(ActionReport.ExitCode exitCode) {
for (AutodeploymentStatus autodeploymentStatus : AutodeploymentStatus.values()) {
if (autodeploymentStatus.exitCode == exitCode) {
return autodeploymentStatus;
}
}
throw new IllegalArgumentException(exitCode.toString());
}
public ActionReport.ExitCode getExitCode() {
return exitCode;
}
}
}
| {
"pile_set_name": "Github"
} |
require(__dirname).test
( { xml :
"<compileClassesResponse>"+
"<result>"+
"<bodyCrc>653724009</bodyCrc>"+
"<column>-1</column>"+
"<id>01pG0000002KoSUIA0</id>"+
"<line>-1</line>"+
"<name>CalendarController</name>"+
"<success>true</success>"+
"</result>"+
"</compileClassesResponse>"
, expect :
[ [ "opentag", { name: "COMPILECLASSESRESPONSE", attributes: {}, isSelfClosing: false } ]
, [ "opentag", { name : "RESULT", attributes: {}, isSelfClosing: false } ]
, [ "opentag", { name: "BODYCRC", attributes: {}, isSelfClosing: false } ]
, [ "text", "653724009" ]
, [ "closetag", "BODYCRC" ]
, [ "opentag", { name: "COLUMN", attributes: {}, isSelfClosing: false } ]
, [ "text", "-1" ]
, [ "closetag", "COLUMN" ]
, [ "opentag", { name: "ID", attributes: {}, isSelfClosing: false } ]
, [ "text", "01pG0000002KoSUIA0" ]
, [ "closetag", "ID" ]
, [ "opentag", {name: "LINE", attributes: {}, isSelfClosing: false } ]
, [ "text", "-1" ]
, [ "closetag", "LINE" ]
, [ "opentag", {name: "NAME", attributes: {}, isSelfClosing: false } ]
, [ "text", "CalendarController" ]
, [ "closetag", "NAME" ]
, [ "opentag", {name: "SUCCESS", attributes: {}, isSelfClosing: false } ]
, [ "text", "true" ]
, [ "closetag", "SUCCESS" ]
, [ "closetag", "RESULT" ]
, [ "closetag", "COMPILECLASSESRESPONSE" ]
]
, strict : false
, opt : {}
}
)
| {
"pile_set_name": "Github"
} |
{
"images": {
"icon-large": "https://downloads.mesosphere.com/assets/universe/000/gestalt-framework-icon-large.png",
"icon-medium": "https://downloads.mesosphere.com/assets/universe/000/gestalt-framework-icon-medium.png",
"icon-small": "https://downloads.mesosphere.com/assets/universe/000/gestalt-framework-icon-small.png"
},
"assets": {
"container": {
"docker": {
"gestalt-dcos": "galacticfog/gestalt-dcos:latest",
"api-gateway": "galacticfog/gestalt-api-gateway:dcos-latest",
"api-proxy": "galacticfog/gestalt-api-proxy:dcos-latest",
"data": "galacticfog/gestalt-data:dcos-latest",
"kong": "galacticfog/kong:dcos-latest",
"lambda": "galacticfog/gestalt-lambda:dcos-latest",
"meta": "galacticfog/gestalt-meta:dcos-latest",
"policy": "galacticfog/gestalt-policy:dcos-latest",
"rabbit": "galacticfog/rabbit:dcos-latest",
"security": "galacticfog/gestalt-security:dcos-latest",
"ui": "galacticfog/gestalt-ui:dcos-latest",
"lambda-ruby-executor": "galacticfog/lambda-ruby-executor:dcos-latest",
"lambda-javascript-executor": "galacticfog/lambda-javascript-executor:dcos-latest",
"lambda-golang-executor": "galacticfog/lambda-golang-executor:dcos-latest",
"lambda-python-executor": "galacticfog/lambda-python-executor:dcos-latest",
"lambda-java-executor": "galacticfog/lambda-java-executor:dcos-latest",
"lambda-dotnet-executor": "galacticfog/lambda-dotnet-executor:dcos-latest"
}
},
"uris": {}
}
}
| {
"pile_set_name": "Github"
} |
---
title: Forward and Backward for Inference and Learning
---
# Forward and Backward
The forward and backward passes are the essential computations of a [Net](net_layer_blob.html).
<img src="fig/forward_backward.png" alt="Forward and Backward" width="480">
Let's consider a simple logistic regression classifier.
The **forward** pass computes the output given the input for inference.
In forward Caffe composes the computation of each layer to compute the "function" represented by the model.
This pass goes from bottom to top.
<img src="fig/forward.jpg" alt="Forward pass" width="320">
The data $$x$$ is passed through an inner product layer for $$g(x)$$ then through a softmax for $$h(g(x))$$ and softmax loss to give $$f_W(x)$$.
The **backward** pass computes the gradient given the loss for learning.
In backward Caffe reverse-composes the gradient of each layer to compute the gradient of the whole model by automatic differentiation.
This is back-propagation.
This pass goes from top to bottom.
<img src="fig/backward.jpg" alt="Backward pass" width="320">
The backward pass begins with the loss and computes the gradient with respect to the output $$\frac{\partial f_W}{\partial h}$$. The gradient with respect to the rest of the model is computed layer-by-layer through the chain rule. Layers with parameters, like the `INNER_PRODUCT` layer, compute the gradient with respect to their parameters $$\frac{\partial f_W}{\partial W_{\text{ip}}}$$ during the backward step.
These computations follow immediately from defining the model: Caffe plans and carries out the forward and backward passes for you.
- The `Net::Forward()` and `Net::Backward()` methods carry out the respective passes while `Layer::Forward()` and `Layer::Backward()` compute each step.
- Every layer type has `forward_{cpu,gpu}()` and `backward_{cpu,gpu}` methods to compute its steps according to the mode of computation. A layer may only implement CPU or GPU mode due to constraints or convenience.
The [Solver](solver.html) optimizes a model by first calling forward to yield the output and loss, then calling backward to generate the gradient of the model, and then incorporating the gradient into a weight update that attempts to minimize the loss. Division of labor between the Solver, Net, and Layer keep Caffe modular and open to development.
For the details of the forward and backward steps of Caffe's layer types, refer to the [layer catalogue](layers.html).
| {
"pile_set_name": "Github"
} |
{
"name": "pygments-css",
"version": "1.0.0",
"description": "CSS stylesheets for pygments",
"repository": {
"type": "git",
"url": "git+https://github.com/richleland/pygments-css.git"
},
"keywords": ["pygments", "css", "highlighting"],
"license": "UNLICENSE",
"bugs": {
"url": "https://github.com/richleland/pygments-css/issues"
},
"homepage": "https://github.com/richleland/pygments-css#readme"
}
| {
"pile_set_name": "Github"
} |
#N canvas 49 106 299 349 10;
#X obj 51 39 inlet;
#X obj 116 39 inlet;
#X obj 116 89 * 12;
#X text 36 286 1993-2004 by Karlheinz
Essl;
#X text 36 303 vs. 1.1.1;
#X obj 51 150 +;
#X obj 51 211 outlet;
#X msg 128 230 pitch higher than 127!;
#X obj 128 204 sel 1;
#X obj 128 176 > 127;
#X obj 85 120 int;
#X floatatom 136 116 0 0 0 0 - - -;
#X obj 128 254 print :pitch2note;
#X obj 116 63 i \$1;
#X obj 51 89 t f b b;
#X obj 51 173 t a a;
#X connect 0 0 14 0;
#X connect 1 0 13 0;
#X connect 2 0 10 1;
#X connect 2 0 11 0;
#X connect 5 0 15 0;
#X connect 7 0 12 0;
#X connect 8 0 7 0;
#X connect 9 0 8 0;
#X connect 10 0 5 1;
#X connect 13 0 2 0;
#X connect 14 0 5 0;
#X connect 14 1 10 0;
#X connect 14 2 13 0;
#X connect 15 0 6 0;
#X connect 15 1 9 0;
| {
"pile_set_name": "Github"
} |
{#- source: http://www.apache.org/licenses/LICENSE-2.0 #}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
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.
| {
"pile_set_name": "Github"
} |
{
"name": "Apache MapReduce",
"description": "MapReduce is a programming model for processing large data sets with a parallel, distributed algorithm on a cluster. Apache MapReduce was derived from Google MapReduce: Simplified Data Processing on Large Clusters paper. The current Apache MapReduce version is built over Apache YARN Framework. YARN stands for “Yet-Another-Resource-Negotiator”. It is a new framework that facilitates writing arbitrary distributed processing frameworks and applications. YARN’s execution model is more generic than the earlier MapReduce implementation. YARN can run applications that do not follow the MapReduce model, unlike the original Apache Hadoop MapReduce (also called MR1). Hadoop YARN is an attempt to take Apache Hadoop beyond MapReduce for data-processing.",
"abstract": "programming model for processing large data sets with a parallel, distributed algorithm on a cluster",
"category": "Distributed Programming",
"tags": [
],
"links": [
{
"text": "Apache MapReduce",
"url": "http://wiki.apache.org/hadoop/MapReduce/"
},
{
"text": "Google MapReduce paper",
"url": "http://research.google.com/archive/mapreduce.html"
},
{
"text": "Writing YARN applications",
"url": "http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/WritingYarnApplications.html"
}
]
} | {
"pile_set_name": "Github"
} |
@import '~@/scss/GlobalVariables';
@media all and (min-width: calc(#{$mobile-width} + 1px)) and (max-width: $tablet-width) {
.modal-container {
padding: 20px;
}
.modal-large-text {
font-weight: 400;
max-width: 330px;
display: inline-block;
}
.bootstrap-modal .content-container {
margin-bottom: 0;
}
.modal-mew-connect {
.content-container-1 {
margin: -20px -40px 0;
padding: 0 25px;
.hd-derivation {
align-items: center;
display: flex;
.dropdown-button-container {
margin-left: auto;
}
}
.derivation-brands {
font-size: 12px;
padding: 15px 0;
text-align: left;
}
} // .content-container-1
.content-container-2 {
background-color: $background-color-1;
margin: 0 -40px;
margin-bottom: 30px;
padding: 0;
.address-nav {
padding: 10px 0;
text-align: center;
span {
cursor: pointer;
padding: 2px 10px;
}
}
.address-block-container {
.block-title {
padding: 15px 25px;
}
.address-data:nth-child(even) {
background-color: $background-color-white;
}
.address-block {
color: $text-color-3;
display: grid;
grid-column-gap: 15px;
grid-template-columns: 35px 3fr 2fr 35px;
padding: 8px 25px;
&.table-header {
background-color: $background-color-4;
color: $text-base-color;
font-weight: 600;
}
&.selected {
color: $text-color-6;
font-weight: 500;
}
li {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
}
} // @media all and (min-width: calc(#{$mobile-width} + 1px)) and (max-width: $tablet-width)
.appstore-button-container {
.links-container {
display: flex;
justify-content: center;
}
}
| {
"pile_set_name": "Github"
} |
// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic
// This file tests the clang extension which allows initializing the components
// of a complex number individually using an initialization list. Basically,
// if you have an explicit init list for a complex number that contains two
// initializers, this extension kicks in to turn it into component-wise
// initialization.
//
// See also the testcase for the C version of this extension in
// test/Sema/complex-init-list.c.
// Basic testcase
// (No pedantic warning is necessary because _Complex is not part of C++.)
_Complex float valid1 = { 1.0f, 2.0f };
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.iotcloud.v20180614.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class UploadFirmwareRequest extends AbstractModel{
/**
* 产品ID
*/
@SerializedName("ProductID")
@Expose
private String ProductID;
/**
* 固件版本号
*/
@SerializedName("FirmwareVersion")
@Expose
private String FirmwareVersion;
/**
* 固件的MD5值
*/
@SerializedName("Md5sum")
@Expose
private String Md5sum;
/**
* 固件的大小
*/
@SerializedName("FileSize")
@Expose
private Long FileSize;
/**
* 固件名称
*/
@SerializedName("FirmwareName")
@Expose
private String FirmwareName;
/**
* 固件描述
*/
@SerializedName("FirmwareDescription")
@Expose
private String FirmwareDescription;
/**
* Get 产品ID
* @return ProductID 产品ID
*/
public String getProductID() {
return this.ProductID;
}
/**
* Set 产品ID
* @param ProductID 产品ID
*/
public void setProductID(String ProductID) {
this.ProductID = ProductID;
}
/**
* Get 固件版本号
* @return FirmwareVersion 固件版本号
*/
public String getFirmwareVersion() {
return this.FirmwareVersion;
}
/**
* Set 固件版本号
* @param FirmwareVersion 固件版本号
*/
public void setFirmwareVersion(String FirmwareVersion) {
this.FirmwareVersion = FirmwareVersion;
}
/**
* Get 固件的MD5值
* @return Md5sum 固件的MD5值
*/
public String getMd5sum() {
return this.Md5sum;
}
/**
* Set 固件的MD5值
* @param Md5sum 固件的MD5值
*/
public void setMd5sum(String Md5sum) {
this.Md5sum = Md5sum;
}
/**
* Get 固件的大小
* @return FileSize 固件的大小
*/
public Long getFileSize() {
return this.FileSize;
}
/**
* Set 固件的大小
* @param FileSize 固件的大小
*/
public void setFileSize(Long FileSize) {
this.FileSize = FileSize;
}
/**
* Get 固件名称
* @return FirmwareName 固件名称
*/
public String getFirmwareName() {
return this.FirmwareName;
}
/**
* Set 固件名称
* @param FirmwareName 固件名称
*/
public void setFirmwareName(String FirmwareName) {
this.FirmwareName = FirmwareName;
}
/**
* Get 固件描述
* @return FirmwareDescription 固件描述
*/
public String getFirmwareDescription() {
return this.FirmwareDescription;
}
/**
* Set 固件描述
* @param FirmwareDescription 固件描述
*/
public void setFirmwareDescription(String FirmwareDescription) {
this.FirmwareDescription = FirmwareDescription;
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "ProductID", this.ProductID);
this.setParamSimple(map, prefix + "FirmwareVersion", this.FirmwareVersion);
this.setParamSimple(map, prefix + "Md5sum", this.Md5sum);
this.setParamSimple(map, prefix + "FileSize", this.FileSize);
this.setParamSimple(map, prefix + "FirmwareName", this.FirmwareName);
this.setParamSimple(map, prefix + "FirmwareDescription", this.FirmwareDescription);
}
}
| {
"pile_set_name": "Github"
} |
/* Copyright unknown. Code by Laurent de Soras <[email protected]>.
* This file is licensed under the WTFPL v2 license.
* http://www.wtfpl.net/about/
*/
#ifndef __FASTLOG_H__
#define __FASTLOG_H__
#include <math.h> /* for HUGE_VAL */
static inline float fast_log2(float val)
{
/* don't use reinterpret_cast<> because that prevents this
from being used by pure C code (for example, GnomeCanvasItems)
*/
union {
float f;
int i;
} t;
t.f = val;
int* const exp_ptr = &t.i;
int x = *exp_ptr;
const int log_2 = ((x >> 23) & 255) - 128;
x &= ~(255 << 23);
x += 127 << 23;
*exp_ptr = x;
val = ((-1.0f / 3) * t.f + 2) * t.f - 2.0f / 3;
return val + log_2;
}
static inline float fast_log(const float val)
{
return fast_log2(val) * 0.69314718f;
}
static inline float fast_log10(const float val)
{
return fast_log2(val) / 3.312500f;
}
static inline float minus_infinity() { return -HUGE_VAL; }
#endif
| {
"pile_set_name": "Github"
} |
<?php
namespace Faker\Provider\nl_NL;
class Internet extends \Faker\Provider\Internet
{
protected static $freeEmailDomain = array('gmail.com', 'hotmail.nl', 'live.nl', 'yahoo.nl');
protected static $tld = array('com', 'com', 'com', 'net', 'org', 'nl', 'nl', 'nl');
}
| {
"pile_set_name": "Github"
} |
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs defs_freebsd.go
package socket
type iovec struct {
Base *byte
Len uint64
}
type msghdr struct {
Name *byte
Namelen uint32
Pad_cgo_0 [4]byte
Iov *iovec
Iovlen int32
Pad_cgo_1 [4]byte
Control *byte
Controllen uint32
Flags int32
}
type cmsghdr struct {
Len uint32
Level int32
Type int32
}
type sockaddrInet struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type sockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
const (
sizeofIovec = 0x10
sizeofMsghdr = 0x30
sizeofCmsghdr = 0xc
sizeofSockaddrInet = 0x10
sizeofSockaddrInet6 = 0x1c
)
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains utility functions and classes that help the
// implementation, and management of the Callback objects.
#ifndef BASE_CALLBACK_INTERNAL_H_
#define BASE_CALLBACK_INTERNAL_H_
#include "base/base_export.h"
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
namespace base {
struct FakeBindState;
namespace internal {
class BindStateBase;
class FinallyExecutorCommon;
class ThenAndCatchExecutorCommon;
template <typename ReturnType>
class PostTaskExecutor;
template <typename Functor, typename... BoundArgs>
struct BindState;
class CallbackBase;
class CallbackBaseCopyable;
struct BindStateBaseRefCountTraits {
static void Destruct(const BindStateBase*);
};
template <typename T>
using PassingType = std::conditional_t<std::is_scalar<T>::value, T, T&&>;
// BindStateBase is used to provide an opaque handle that the Callback
// class can use to represent a function object with bound arguments. It
// behaves as an existential type that is used by a corresponding
// DoInvoke function to perform the function execution. This allows
// us to shield the Callback class from the types of the bound argument via
// "type erasure."
// At the base level, the only task is to add reference counting data. Avoid
// using or inheriting any virtual functions. Creating a vtable for every
// BindState template instantiation results in a lot of bloat. Its only task is
// to call the destructor which can be done with a function pointer.
class BASE_EXPORT BindStateBase
: public RefCountedThreadSafe<BindStateBase, BindStateBaseRefCountTraits> {
public:
REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE();
enum CancellationQueryMode {
IS_CANCELLED,
MAYBE_VALID,
};
using InvokeFuncStorage = void(*)();
private:
BindStateBase(InvokeFuncStorage polymorphic_invoke,
void (*destructor)(const BindStateBase*));
BindStateBase(InvokeFuncStorage polymorphic_invoke,
void (*destructor)(const BindStateBase*),
bool (*query_cancellation_traits)(const BindStateBase*,
CancellationQueryMode mode));
~BindStateBase() = default;
friend struct BindStateBaseRefCountTraits;
friend class RefCountedThreadSafe<BindStateBase, BindStateBaseRefCountTraits>;
friend class CallbackBase;
friend class CallbackBaseCopyable;
// Whitelist subclasses that access the destructor of BindStateBase.
template <typename Functor, typename... BoundArgs>
friend struct BindState;
friend struct ::base::FakeBindState;
bool IsCancelled() const {
return query_cancellation_traits_(this, IS_CANCELLED);
}
bool MaybeValid() const {
return query_cancellation_traits_(this, MAYBE_VALID);
}
// In C++, it is safe to cast function pointers to function pointers of
// another type. It is not okay to use void*. We create a InvokeFuncStorage
// that that can store our function pointer, and then cast it back to
// the original type on usage.
InvokeFuncStorage polymorphic_invoke_;
// Pointer to a function that will properly destroy |this|.
void (*destructor_)(const BindStateBase*);
bool (*query_cancellation_traits_)(const BindStateBase*,
CancellationQueryMode mode);
DISALLOW_COPY_AND_ASSIGN(BindStateBase);
};
// Holds the Callback methods that don't require specialization to reduce
// template bloat.
// CallbackBase<MoveOnly> is a direct base class of MoveOnly callbacks, and
// CallbackBase<Copyable> uses CallbackBase<MoveOnly> for its implementation.
class BASE_EXPORT CallbackBase {
public:
inline CallbackBase(CallbackBase&& c) noexcept;
CallbackBase& operator=(CallbackBase&& c) noexcept;
explicit CallbackBase(const CallbackBaseCopyable& c);
CallbackBase& operator=(const CallbackBaseCopyable& c);
explicit CallbackBase(CallbackBaseCopyable&& c) noexcept;
CallbackBase& operator=(CallbackBaseCopyable&& c) noexcept;
// Returns true if Callback is null (doesn't refer to anything).
bool is_null() const { return !bind_state_; }
explicit operator bool() const { return !is_null(); }
// Returns true if the callback invocation will be nop due to an cancellation.
// It's invalid to call this on uninitialized callback.
//
// Must be called on the Callback's destination sequence.
bool IsCancelled() const;
// If this returns false, the callback invocation will be a nop due to a
// cancellation. This may(!) still return true, even on a cancelled callback.
//
// This function is thread-safe.
bool MaybeValid() const;
// Returns the Callback into an uninitialized state.
void Reset();
protected:
friend class FinallyExecutorCommon;
friend class ThenAndCatchExecutorCommon;
template <typename ReturnType>
friend class PostTaskExecutor;
using InvokeFuncStorage = BindStateBase::InvokeFuncStorage;
// Returns true if this callback equals |other|. |other| may be null.
bool EqualsInternal(const CallbackBase& other) const;
constexpr inline CallbackBase();
// Allow initializing of |bind_state_| via the constructor to avoid default
// initialization of the scoped_refptr.
explicit inline CallbackBase(BindStateBase* bind_state);
InvokeFuncStorage polymorphic_invoke() const {
return bind_state_->polymorphic_invoke_;
}
// Force the destructor to be instantiated inside this translation unit so
// that our subclasses will not get inlined versions. Avoids more template
// bloat.
~CallbackBase();
scoped_refptr<BindStateBase> bind_state_;
};
constexpr CallbackBase::CallbackBase() = default;
CallbackBase::CallbackBase(CallbackBase&&) noexcept = default;
CallbackBase::CallbackBase(BindStateBase* bind_state)
: bind_state_(AdoptRef(bind_state)) {}
// CallbackBase<Copyable> is a direct base class of Copyable Callbacks.
class BASE_EXPORT CallbackBaseCopyable : public CallbackBase {
public:
CallbackBaseCopyable(const CallbackBaseCopyable& c);
CallbackBaseCopyable(CallbackBaseCopyable&& c) noexcept = default;
CallbackBaseCopyable& operator=(const CallbackBaseCopyable& c);
CallbackBaseCopyable& operator=(CallbackBaseCopyable&& c) noexcept;
protected:
constexpr CallbackBaseCopyable() = default;
explicit CallbackBaseCopyable(BindStateBase* bind_state)
: CallbackBase(bind_state) {}
~CallbackBaseCopyable() = default;
};
} // namespace internal
} // namespace base
#endif // BASE_CALLBACK_INTERNAL_H_
| {
"pile_set_name": "Github"
} |
function g = squeeze(f)
%SQUEEZE Squeeze a SEPARABLEAPPROX to one variable, if possible.
% G = squeeze(F) returns a SEPARABLEAPPROX if F depends on x and y. If F
% depends only on the x-variable a row CHEBFUN is returned and if it
% depends on just the y-variable a column CHEBFUN is returned.
% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.
if ( isempty(f) ) % Check for an empty SEPARABLEAPPROX.
g = chebfun(); % Return an empty CHEBFUN because we are squeezing.
return
end
% Get the low rank representation for f.
[cols, D, rows] = cdr(f);
dom = f.domain;
if ( rank(f) == 1 )
% If f is of rank 1, then it may be a function of just one variable:
% Simplify rows and cols:
cols = simplify(cols, [], 'globaltol');
rows = simplify(rows, [], 'globaltol');
if ( length(cols) == 1 )
% If cols are constant then function of x.
g = mean(cols) * D * rows.';
newdomain = dom(1:2);
elseif ( length(rows) == 1 )
g = cols * D * mean(rows);
newdomain = dom(3:4);
else
g = f;
end
if ( isa(g, 'double') )
g = chebfun(g, newdomain);
end
else
g = f;
end
if ( isa(g, 'chebfun') )
g = simplify(g, [], 'globaltol');
end
end | {
"pile_set_name": "Github"
} |
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.sip.ipaccesscontrollist.IpAddress;
public class Example {
/// Find your Account Sid and Token at twilio.com/user/account
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
public static final String AUTH_TOKEN = "your_auth_token";
public static void main(String[] args) {
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
IpAddress.deleter("AL32a3c49700934481addd5ce1659f04d2", "IP32a3c49700934481addd5ce1659f04d2")
.delete();
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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.
*/
#include <thrift/compiler/generate/t_generator.h>
using namespace std;
namespace apache {
namespace thrift {
namespace compiler {
void t_generator_registry::register_generator(t_generator_factory* factory) {
gen_map_t& the_map = get_generator_map();
if (the_map.find(factory->get_short_name()) != the_map.end()) {
failure(
"Duplicate generators for language \"%s\"!\n",
factory->get_short_name().c_str());
}
the_map[factory->get_short_name()] = factory;
}
t_generator* t_generator_registry::get_generator(
t_program* program,
t_generation_context context,
const string& options) {
string::size_type colon = options.find(':');
string language = options.substr(0, colon);
map<string, string> parsed_options;
if (colon != string::npos) {
string::size_type pos = colon + 1;
while (pos != string::npos && pos < options.size()) {
string::size_type next_pos = options.find(',', pos);
string option = options.substr(pos, next_pos - pos);
pos = ((next_pos == string::npos) ? next_pos : next_pos + 1);
string::size_type separator = option.find('=');
string key, value;
if (separator == string::npos) {
key = option;
value = "";
} else {
key = option.substr(0, separator);
value = option.substr(separator + 1);
}
parsed_options[key] = value;
}
}
gen_map_t& the_map = get_generator_map();
gen_map_t::iterator iter = the_map.find(language);
if (iter == the_map.end()) {
return nullptr;
}
return iter->second->get_generator(program, context, parsed_options, options);
}
t_generator_registry::gen_map_t& t_generator_registry::get_generator_map() {
// http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12
static gen_map_t* the_map = new gen_map_t();
return *the_map;
}
t_generator_factory::t_generator_factory(
const std::string& short_name,
const std::string& long_name,
const std::string& documentation)
: short_name_(short_name),
long_name_(long_name),
documentation_(documentation) {
t_generator_registry::register_generator(this);
}
} // namespace compiler
} // namespace thrift
} // namespace apache
| {
"pile_set_name": "Github"
} |
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's 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.
//
// * The name of the copyright holders 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 Intel Corporation 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.
//
//M*/
#ifndef __OPENCV_VIDEOSTAB_RING_BUFFER_HPP__
#define __OPENCV_VIDEOSTAB_RING_BUFFER_HPP__
#include <vector>
#include "opencv2/imgproc.hpp"
namespace cv
{
namespace videostab
{
template <typename T> inline T& at(int idx, std::vector<T> &items)
{
return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
}
template <typename T> inline const T& at(int idx, const std::vector<T> &items)
{
return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
}
} // namespace videostab
} // namespace cv
#endif
| {
"pile_set_name": "Github"
} |
module( "ajax", {
setup: function() {
var jsonpCallback = this.jsonpCallback = jQuery.ajaxSettings.jsonpCallback;
jQuery.ajaxSettings.jsonpCallback = function() {
var callback = jsonpCallback.apply( this, arguments );
Globals.register( callback );
return callback;
};
},
teardown: function() {
jQuery( document ).off( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError ajaxSuccess" );
moduleTeardown.apply( this, arguments );
}
});
(function() {
if ( !jQuery.ajax || ( isLocal && !hasPHP ) ) {
return;
}
function addGlobalEvents( expected ) {
return function() {
expected = expected || "";
jQuery( document ).on( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError ajaxSuccess", function( e ) {
ok( expected.indexOf(e.type) !== -1, e.type );
});
};
}
//----------- jQuery.ajax()
testIframeWithCallback( "XMLHttpRequest - Attempt to block tests because of dangling XHR requests (IE)", "ajax/unreleasedXHR.html", function() {
expect( 1 );
ok( true, "done" );
});
ajaxTest( "jQuery.ajax() - success callbacks", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
url: url("data/name.html"),
beforeSend: function() {
ok( true, "beforeSend" );
},
success: function() {
ok( true, "success" );
},
complete: function() {
ok( true, "complete");
}
});
ajaxTest( "jQuery.ajax() - success callbacks - (url, options) syntax", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
create: function( options ) {
return jQuery.ajax( url("data/name.html"), options );
},
beforeSend: function() {
ok( true, "beforeSend" );
},
success: function() {
ok( true, "success" );
},
complete: function() {
ok( true, "complete" );
}
});
ajaxTest( "jQuery.ajax() - success callbacks (late binding)", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
url: url("data/name.html"),
beforeSend: function() {
ok( true, "beforeSend" );
},
success: true,
afterSend: function( request ) {
request.complete(function() {
ok( true, "complete" );
}).success(function() {
ok( true, "success" );
}).error(function() {
ok( false, "error" );
});
}
});
ajaxTest( "jQuery.ajax() - success callbacks (oncomplete binding)", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"),
url: url("data/name.html"),
beforeSend: function() {
ok( true, "beforeSend" );
},
success: true,
complete: function( xhr ) {
xhr.complete(function() {
ok( true, "complete" );
}).success(function() {
ok( true, "success" );
}).error(function() {
ok( false, "error" );
});
}
});
ajaxTest( "jQuery.ajax() - error callbacks", 8, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError"),
url: url("data/name.php?wait=5"),
beforeSend: function() {
ok( true, "beforeSend" );
},
afterSend: function( request ) {
request.abort();
},
error: function() {
ok( true, "error" );
},
complete: function() {
ok( true, "complete" );
}
});
ajaxTest( "jQuery.ajax() - textStatus and errorThrown values", 4, [
{
url: url("data/name.php?wait=5"),
error: function( _, textStatus, errorThrown ) {
strictEqual( textStatus, "abort", "textStatus is 'abort' for abort" );
strictEqual( errorThrown, "abort", "errorThrown is 'abort' for abort" );
},
afterSend: function( request ) {
request.abort();
}
},
{
url: url("data/name.php?wait=5"),
error: function( _, textStatus, errorThrown ) {
strictEqual( textStatus, "mystatus", "textStatus is 'mystatus' for abort('mystatus')" );
strictEqual( errorThrown, "mystatus", "errorThrown is 'mystatus' for abort('mystatus')" );
},
afterSend: function( request ) {
request.abort("mystatus");
}
}
]);
ajaxTest( "jQuery.ajax() - responseText on error", 1, {
url: url("data/errorWithText.php"),
error: function( xhr ) {
strictEqual( xhr.responseText, "plain text message", "Test jqXHR.responseText is filled for HTTP errors" );
}
});
asyncTest( "jQuery.ajax() - retry with jQuery.ajax( this )", 2, function() {
var previousUrl,
firstTime = true;
jQuery.ajax({
url: url("data/errorWithText.php"),
error: function() {
if ( firstTime ) {
firstTime = false;
jQuery.ajax( this );
} else {
ok ( true, "Test retrying with jQuery.ajax(this) works" );
jQuery.ajax({
url: url("data/errorWithText.php"),
data: {
"x": 1
},
beforeSend: function() {
if ( !previousUrl ) {
previousUrl = this.url;
} else {
strictEqual( this.url, previousUrl, "url parameters are not re-appended" );
start();
return false;
}
},
error: function() {
jQuery.ajax( this );
}
});
}
}
});
});
ajaxTest( "jQuery.ajax() - headers", 4, {
setup: function() {
jQuery( document ).ajaxSend(function( evt, xhr ) {
xhr.setRequestHeader( "ajax-send", "test" );
});
},
url: url("data/headers.php?keys=siMPle_SometHing-elsE_OthEr_ajax-send"),
headers: {
"siMPle": "value",
"SometHing-elsE": "other value",
"OthEr": "something else"
},
success: function( data, _, xhr ) {
var i, emptyHeader,
requestHeaders = jQuery.extend( this.headers, {
"ajax-send": "test"
}),
tmp = [];
for ( i in requestHeaders ) {
tmp.push( i, ": ", requestHeaders[ i ], "\n" );
}
tmp = tmp.join("");
strictEqual( data, tmp, "Headers were sent" );
strictEqual( xhr.getResponseHeader("Sample-Header"), "Hello World", "Sample header received" );
emptyHeader = xhr.getResponseHeader("Empty-Header");
if ( emptyHeader === null ) {
ok( true, "Firefox doesn't support empty headers" );
} else {
strictEqual( emptyHeader, "", "Empty header received" );
}
strictEqual( xhr.getResponseHeader("Sample-Header2"), "Hello World 2", "Second sample header received" );
}
});
ajaxTest( "jQuery.ajax() - Accept header", 1, {
url: url("data/headers.php?keys=accept"),
headers: {
Accept: "very wrong accept value"
},
beforeSend: function( xhr ) {
xhr.setRequestHeader("Accept", "*/*");
},
success: function( data ) {
strictEqual( data, "accept: */*\n", "Test Accept header is set to last value provided" );
}
});
ajaxTest( "jQuery.ajax() - contentType", 2, [
{
url: url("data/headers.php?keys=content-type"),
contentType: "test",
success: function( data ) {
strictEqual( data, "content-type: test\n", "Test content-type is sent when options.contentType is set" );
}
},
{
url: url("data/headers.php?keys=content-type"),
contentType: false,
success: function( data ) {
strictEqual( data, "content-type: \n", "Test content-type is not sent when options.contentType===false" );
}
}
]);
ajaxTest( "jQuery.ajax() - protocol-less urls", 1, {
url: "//somedomain.com",
beforeSend: function( xhr, settings ) {
equal( settings.url, location.protocol + "//somedomain.com", "Make sure that the protocol is added." );
return false;
},
error: true
});
ajaxTest( "jQuery.ajax() - hash", 3, [
{
url: "data/name.html#foo",
beforeSend: function( xhr, settings ) {
equal( settings.url, "data/name.html", "Make sure that the URL is trimmed." );
return false;
},
error: true
},
{
url: "data/name.html?abc#foo",
beforeSend: function( xhr, settings ) {
equal( settings.url, "data/name.html?abc", "Make sure that the URL is trimmed." );
return false;
},
error: true
},
{
url: "data/name.html?abc#foo",
data: {
"test": 123
},
beforeSend: function( xhr, settings ) {
equal( settings.url, "data/name.html?abc&test=123", "Make sure that the URL is trimmed." );
return false;
},
error: true
}
]);
ajaxTest( "jQuery.ajax() - cross-domain detection", 7, function() {
function request( url, title, crossDomainOrOptions ) {
return jQuery.extend( {
dataType: "jsonp",
url: url,
beforeSend: function( _, s ) {
ok( crossDomainOrOptions === false ? !s.crossDomain : s.crossDomain, title );
return false;
},
error: true
}, crossDomainOrOptions );
}
var loc = document.location,
samePort = loc.port || ( loc.protocol === "http:" ? 80 : 443 ),
otherPort = loc.port === 666 ? 667 : 666,
otherProtocol = loc.protocol === "http:" ? "https:" : "http:";
return [
request(
loc.protocol + "//" + loc.host + ":" + samePort,
"Test matching ports are not detected as cross-domain",
false
),
request(
otherProtocol + "//" + loc.host,
"Test different protocols are detected as cross-domain"
),
request(
"app:/path",
"Adobe AIR app:/ URL detected as cross-domain"
),
request(
loc.protocol + "//example.invalid:" + ( loc.port || 80 ),
"Test different hostnames are detected as cross-domain"
),
request(
loc.protocol + "//" + loc.hostname + ":" + otherPort,
"Test different ports are detected as cross-domain"
),
request(
"about:blank",
"Test about:blank is detected as cross-domain"
),
request(
loc.protocol + "//" + loc.host,
"Test forced crossDomain is detected as cross-domain",
{
crossDomain: true
}
)
];
});
ajaxTest( "jQuery.ajax() - abort", 9, {
setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxError ajaxComplete"),
url: url("data/name.php?wait=5"),
beforeSend: function() {
ok( true, "beforeSend" );
},
afterSend: function( xhr ) {
strictEqual( xhr.readyState, 1, "XHR readyState indicates successful dispatch" );
xhr.abort();
strictEqual( xhr.readyState, 0, "XHR readyState indicates successful abortion" );
},
error: true,
complete: function() {
ok( true, "complete" );
}
});
ajaxTest( "jQuery.ajax() - events with context", 12, function() {
var context = document.createElement("div");
function event( e ) {
equal( this, context, e.type );
}
function callback( msg ) {
return function() {
equal( this, context, "context is preserved on callback " + msg );
};
}
return {
setup: function() {
jQuery( context ).appendTo("#foo")
.ajaxSend( event )
.ajaxComplete( event )
.ajaxError( event )
.ajaxSuccess( event );
},
requests: [{
url: url("data/name.html"),
context: context,
beforeSend: callback("beforeSend"),
success: callback("success"),
complete: callback("complete")
}, {
url: url("data/404.html"),
context: context,
beforeSend: callback("beforeSend"),
error: callback("error"),
complete: callback("complete")
}]
};
});
ajaxTest( "jQuery.ajax() - events without context", 3, function() {
function nocallback( msg ) {
return function() {
equal( typeof this.url, "string", "context is settings on callback " + msg );
};
}
return {
url: url("data/404.html"),
beforeSend: nocallback("beforeSend"),
error: nocallback("error"),
complete: nocallback("complete")
};
});
ajaxTest( "jQuery.ajax() - context modification", 1, {
url: url("data/name.html"),
context: {},
beforeSend: function() {
this.test = "foo";
},
afterSend: function() {
strictEqual( this.context.test, "foo", "Make sure the original object is maintained." );
},
success: true
});
ajaxTest( "jQuery.ajax() - context modification through ajaxSetup", 3, function() {
var obj = {};
return {
setup: function() {
jQuery.ajaxSetup({
context: obj
});
strictEqual( jQuery.ajaxSettings.context, obj, "Make sure the context is properly set in ajaxSettings." );
},
requests: [{
url: url("data/name.html"),
success: function() {
strictEqual( this, obj, "Make sure the original object is maintained." );
}
}, {
url: url("data/name.html"),
context: {},
success: function() {
ok( this !== obj, "Make sure overriding context is possible." );
}
}]
};
});
ajaxTest( "jQuery.ajax() - disabled globals", 3, {
setup: addGlobalEvents(""),
global: false,
url: url("data/name.html"),
beforeSend: function() {
ok( true, "beforeSend" );
},
success: function() {
ok( true, "success" );
},
complete: function() {
ok( true, "complete" );
}
});
ajaxTest( "jQuery.ajax() - xml: non-namespace elements inside namespaced elements", 3, {
url: url("data/with_fries.xml"),
dataType: "xml",
success: function( resp ) {
equal( jQuery( "properties", resp ).length, 1, "properties in responseXML" );
equal( jQuery( "jsconf", resp ).length, 1, "jsconf in responseXML" );
equal( jQuery( "thing", resp ).length, 2, "things in responseXML" );
}
});
ajaxTest( "jQuery.ajax() - xml: non-namespace elements inside namespaced elements (over JSONP)", 3, {
url: url("data/with_fries_over_jsonp.php"),
dataType: "jsonp xml",
success: function( resp ) {
equal( jQuery( "properties", resp ).length, 1, "properties in responseXML" );
equal( jQuery( "jsconf", resp ).length, 1, "jsconf in responseXML" );
equal( jQuery( "thing", resp ).length, 2, "things in responseXML" );
}
});
ajaxTest( "jQuery.ajax() - HEAD requests", 2, [
{
url: url("data/name.html"),
type: "HEAD",
success: function( data, status, xhr ) {
ok( /Date/i.test( xhr.getAllResponseHeaders() ), "No Date in HEAD response" );
}
},
{
url: url("data/name.html"),
data: {
"whip_it": "good"
},
type: "HEAD",
success: function( data, status, xhr ) {
ok( /Date/i.test( xhr.getAllResponseHeaders() ), "No Date in HEAD response with data" );
}
}
]);
ajaxTest( "jQuery.ajax() - beforeSend", 1, {
url: url("data/name.html"),
beforeSend: function() {
this.check = true;
},
success: function() {
ok( this.check, "check beforeSend was executed" );
}
});
ajaxTest( "jQuery.ajax() - beforeSend, cancel request manually", 2, {
create: function() {
return jQuery.ajax({
url: url("data/name.html"),
beforeSend: function( xhr ) {
ok( true, "beforeSend got called, canceling" );
xhr.abort();
},
success: function() {
ok( false, "request didn't get canceled" );
},
complete: function() {
ok( false, "request didn't get canceled" );
},
error: function() {
ok( false, "request didn't get canceled" );
}
});
},
fail: function( _, reason ) {
strictEqual( reason, "canceled", "canceled request must fail with 'canceled' status text" );
}
});
ajaxTest( "jQuery.ajax() - dataType html", 5, {
setup: function() {
Globals.register("testFoo");
Globals.register("testBar");
},
dataType: "html",
url: url("data/test.html"),
success: function( data ) {
ok( data.match( /^html text/ ), "Check content for datatype html" );
jQuery("#ap").html( data );
strictEqual( window["testFoo"], "foo", "Check if script was evaluated for datatype html" );
strictEqual( window["testBar"], "bar", "Check if script src was evaluated for datatype html" );
}
});
ajaxTest( "jQuery.ajax() - synchronous request", 1, {
url: url("data/json_obj.js"),
dataType: "text",
async: false,
success: true,
afterSend: function( xhr ) {
ok( /^\{ "data"/.test( xhr.responseText ), "check returned text" );
}
});
ajaxTest( "jQuery.ajax() - synchronous request with callbacks", 2, {
url: url("data/json_obj.js"),
async: false,
dataType: "text",
success: true,
afterSend: function( xhr ) {
var result;
xhr.done(function( data ) {
ok( true, "success callback executed" );
result = data;
});
ok( /^\{ "data"/.test( result ), "check returned text" );
}
});
asyncTest( "jQuery.ajax(), jQuery.get[Script|JSON](), jQuery.post(), pass-through request object", 8, function() {
var target = "data/name.html",
successCount = 0,
errorCount = 0,
errorEx = "",
success = function() {
successCount++;
};
jQuery( document ).on( "ajaxError.passthru", function( e, xml ) {
errorCount++;
errorEx += ": " + xml.status;
});
jQuery( document ).one( "ajaxStop", function() {
equal( successCount, 5, "Check all ajax calls successful" );
equal( errorCount, 0, "Check no ajax errors (status" + errorEx + ")" );
jQuery( document ).off("ajaxError.passthru");
start();
});
Globals.register("testBar");
ok( jQuery.get( url(target), success ), "get" );
ok( jQuery.post( url(target), success ), "post" );
ok( jQuery.getScript( url("data/test.js"), success ), "script" );
ok( jQuery.getJSON( url("data/json_obj.js"), success ), "json" );
ok( jQuery.ajax({
url: url( target ),
success: success
}), "generic" );
});
ajaxTest( "jQuery.ajax() - cache", 12, function() {
var re = /_=(.*?)(&|$)/g;
function request( url, title ) {
return {
url: url,
cache: false,
beforeSend: function() {
var parameter, tmp;
while(( tmp = re.exec( this.url ) )) {
strictEqual( parameter, undefined, title + ": only one 'no-cache' parameter" );
parameter = tmp[ 1 ];
notStrictEqual( parameter, "tobereplaced555", title + ": parameter (if it was there) was replaced" );
}
return false;
},
error: true
};
}
return [
request(
"data/text.php",
"no parameter"
),
request(
"data/text.php?pizza=true",
"1 parameter"
),
request(
"data/text.php?_=tobereplaced555",
"_= parameter"
),
request(
"data/text.php?pizza=true&_=tobereplaced555",
"1 parameter and _="
),
request(
"data/text.php?_=tobereplaced555&tv=false",
"_= and 1 parameter"
),
request(
"data/text.php?name=David&_=tobereplaced555&washere=true",
"2 parameters surrounding _="
)
];
});
jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) {
ajaxTest( "jQuery.ajax() - JSONP - Query String (?n)" + label, 4, [
{
url: "data/jsonp.php?callback=?",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
ok( data.data, "JSON results returned (GET, url callback)" );
}
},
{
url: "data/jsonp.php?callback=??",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
ok( data.data, "JSON results returned (GET, url context-free callback)" );
}
},
{
url: "data/jsonp.php/??",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
ok( data.data, "JSON results returned (GET, REST-like)" );
}
},
{
url: "data/jsonp.php/???json=1",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
strictEqual( jQuery.type( data ), "array", "JSON results returned (GET, REST-like with param)" );
}
}
]);
ajaxTest( "jQuery.ajax() - JSONP - Explicit callback param" + label, 9, {
setup: function() {
Globals.register("functionToCleanUp");
Globals.register("XXX");
Globals.register("jsonpResults");
window["jsonpResults"] = function( data ) {
ok( data["data"], "JSON results returned (GET, custom callback function)" );
};
},
requests: [{
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
jsonp: "callback",
success: function( data ) {
ok( data["data"], "JSON results returned (GET, data obj callback)" );
}
}, {
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
jsonpCallback: "jsonpResults",
success: function( data ) {
ok( data.data, "JSON results returned (GET, custom callback name)" );
}
}, {
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
jsonpCallback: "functionToCleanUp",
success: function( data ) {
ok( data["data"], "JSON results returned (GET, custom callback name to be cleaned up)" );
strictEqual( window["functionToCleanUp"], undefined, "Callback was removed (GET, custom callback name to be cleaned up)" );
var xhr;
jQuery.ajax({
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
jsonpCallback: "functionToCleanUp",
beforeSend: function( jqXHR ) {
xhr = jqXHR;
return false;
}
});
xhr.fail(function() {
ok( true, "Ajax error JSON (GET, custom callback name to be cleaned up)" );
strictEqual( window["functionToCleanUp"], undefined, "Callback was removed after early abort (GET, custom callback name to be cleaned up)" );
});
}
}, {
url: "data/jsonp.php?callback=XXX",
dataType: "jsonp",
jsonp: false,
jsonpCallback: "XXX",
crossDomain: crossDomain,
beforeSend: function() {
ok( /^data\/jsonp.php\?callback=XXX&_=\d+$/.test( this.url ), "The URL wasn't messed with (GET, custom callback name with no url manipulation)" );
},
success: function( data ) {
ok( data["data"], "JSON results returned (GET, custom callback name with no url manipulation)" );
}
}]
});
ajaxTest( "jQuery.ajax() - JSONP - Callback in data" + label, 2, [
{
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
data: "callback=?",
success: function( data ) {
ok( data.data, "JSON results returned (GET, data callback)" );
}
},
{
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
data: "callback=??",
success: function( data ) {
ok( data.data, "JSON results returned (GET, data context-free callback)" );
}
}
]);
ajaxTest( "jQuery.ajax() - JSONP - POST" + label, 3, [
{
type: "POST",
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
ok( data["data"], "JSON results returned (POST, no callback)" );
}
},
{
type: "POST",
url: "data/jsonp.php",
data: "callback=?",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
ok( data["data"], "JSON results returned (POST, data callback)" );
}
},
{
type: "POST",
url: "data/jsonp.php",
jsonp: "callback",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
ok( data["data"], "JSON results returned (POST, data obj callback)" );
}
}
]);
ajaxTest( "jQuery.ajax() - JSONP" + label, 3, [
{
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
success: function( data ) {
ok( data.data, "JSON results returned (GET, no callback)" );
}
},
{
create: function( options ) {
var request = jQuery.ajax( options ),
promise = request.then(function( data ) {
ok( data.data, "first request: JSON results returned (GET, no callback)" );
request = jQuery.ajax( this ).done(function( data ) {
ok( data.data, "this re-used: JSON results returned (GET, no callback)" );
});
promise.abort = request.abort;
return request;
});
promise.abort = request.abort;
return promise;
},
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
success: true
}
]);
});
ajaxTest( "jQuery.ajax() - script, Remote", 2, {
setup: function() {
Globals.register("testBar");
},
url: window.location.href.replace( /[^\/]*$/, "" ) + "data/test.js",
dataType: "script",
success: function() {
strictEqual( window["testBar"], "bar", "Script results returned (GET, no callback)" );
}
});
ajaxTest( "jQuery.ajax() - script, Remote with POST", 3, {
setup: function() {
Globals.register("testBar");
},
url: window.location.href.replace( /[^\/]*$/, "" ) + "data/test.js",
type: "POST",
dataType: "script",
success: function( data, status ) {
strictEqual( window["testBar"], "bar", "Script results returned (POST, no callback)" );
strictEqual( status, "success", "Script results returned (POST, no callback)" );
}
});
ajaxTest( "jQuery.ajax() - script, Remote with scheme-less URL", 2, {
setup: function() {
Globals.register("testBar");
},
url: window.location.href.replace( /[^\/]*$/, "" ).replace( /^.*?\/\//, "//" ) + "data/test.js",
dataType: "script",
success: function() {
strictEqual( window["testBar"], "bar", "Script results returned (GET, no callback)" );
}
});
ajaxTest( "jQuery.ajax() - malformed JSON", 2, {
url: "data/badjson.js",
dataType: "json",
error: function( xhr, msg, detailedMsg ) {
strictEqual( msg, "parsererror", "A parse error occurred." );
ok( /(invalid|error|exception)/i.test( detailedMsg ), "Detailed parsererror message provided" );
}
});
ajaxTest( "jQuery.ajax() - script by content-type", 2, [
{
url: "data/script.php",
data: {
"header": "script"
},
success: true
},
{
url: "data/script.php",
data: {
"header": "ecma"
},
success: true
}
]);
ajaxTest( "jQuery.ajax() - JSON by content-type", 5, {
url: "data/json.php",
data: {
"header": "json",
"json": "array"
},
success: function( json ) {
ok( json.length >= 2, "Check length" );
strictEqual( json[ 0 ]["name"], "John", "Check JSON: first, name" );
strictEqual( json[ 0 ]["age"], 21, "Check JSON: first, age" );
strictEqual( json[ 1 ]["name"], "Peter", "Check JSON: second, name" );
strictEqual( json[ 1 ]["age"], 25, "Check JSON: second, age" );
}
});
ajaxTest( "jQuery.ajax() - JSON by content-type disabled with options", 6, {
url: url("data/json.php"),
data: {
"header": "json",
"json": "array"
},
contents: {
"json": false
},
success: function( text ) {
strictEqual( typeof text, "string", "json wasn't auto-determined" );
var json = jQuery.parseJSON( text );
ok( json.length >= 2, "Check length");
strictEqual( json[ 0 ]["name"], "John", "Check JSON: first, name" );
strictEqual( json[ 0 ]["age"], 21, "Check JSON: first, age" );
strictEqual( json[ 1 ]["name"], "Peter", "Check JSON: second, name" );
strictEqual( json[ 1 ]["age"], 25, "Check JSON: second, age" );
}
});
ajaxTest( "jQuery.ajax() - simple get", 1, {
type: "GET",
url: url("data/name.php?name=foo"),
success: function( msg ) {
strictEqual( msg, "bar", "Check for GET" );
}
});
ajaxTest( "jQuery.ajax() - simple post", 1, {
type: "POST",
url: url("data/name.php"),
data: "name=peter",
success: function( msg ) {
strictEqual( msg, "pan", "Check for POST" );
}
});
ajaxTest( "jQuery.ajax() - data option - empty bodies for non-GET requests", 1, {
url: "data/echoData.php",
data: undefined,
type: "post",
success: function( result ) {
strictEqual( result, "" );
}
});
var ifModifiedNow = new Date();
jQuery.each(
/* jQuery.each arguments start */
{
" (cache)": true,
" (no cache)": false
},
function( label, cache ) {
// Support: Opera 12.0
// In Opera 12.0, XHR doesn't notify 304 back to the user properly
var opera = window.opera && window.opera.version();
jQuery.each(
{
"If-Modified-Since": "if_modified_since.php",
"Etag": "etag.php"
},
function( type, url ) {
url = "data/" + url + "?ts=" + ifModifiedNow++;
asyncTest( "jQuery.ajax() - " + type + " support" + label, 4, function() {
jQuery.ajax({
url: url,
ifModified: true,
cache: cache,
success: function( _, status ) {
strictEqual( status, "success", "Initial status is 'success'" );
jQuery.ajax({
url: url,
ifModified: true,
cache: cache,
success: function( data, status, jqXHR ) {
if ( status === "success" && opera === "12.00" ) {
strictEqual( status, "success", "Opera 12.0: Following status is 'success'" );
strictEqual( jqXHR.status, 200, "Opera 12.0: XHR status is 200, not 304" );
strictEqual( data, "", "Opera 12.0: response body is empty" );
} else {
strictEqual( status, "notmodified", "Following status is 'notmodified'" );
strictEqual( jqXHR.status, 304, "XHR status is 304" );
equal( data, null, "no response body is given" );
}
},
complete: function() {
start();
}
});
}
});
});
}
);
}
/* jQuery.each arguments end */
);
ajaxTest( "jQuery.ajax() - failing cross-domain (non-existing)", 1, {
// see RFC 2606
url: "http://example.invalid",
error: function( xhr, _, e ) {
ok( true, "file not found: " + xhr.status + " => " + e );
}
});
ajaxTest( "jQuery.ajax() - failing cross-domain", 1, {
url: "http://" + externalHost,
error: function( xhr, _, e ) {
ok( true, "access denied: " + xhr.status + " => " + e );
}
});
ajaxTest( "jQuery.ajax() - atom+xml", 1, {
url: url("data/atom+xml.php"),
success: function() {
ok( true, "success" );
}
});
asyncTest( "jQuery.ajax() - statusText", 3, function() {
jQuery.ajax( url("data/statusText.php?status=200&text=Hello") ).done(function( _, statusText, jqXHR ) {
strictEqual( statusText, "success", "callback status text ok for success" );
ok( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" );
jQuery.ajax( url("data/statusText.php?status=404&text=World") ).fail(function( jqXHR, statusText ) {
strictEqual( statusText, "error", "callback status text ok for error" );
start();
});
});
});
asyncTest( "jQuery.ajax() - statusCode", 20, function() {
var count = 12;
function countComplete() {
if ( ! --count ) {
start();
}
}
function createStatusCodes( name, isSuccess ) {
name = "Test " + name + " " + ( isSuccess ? "success" : "error" );
return {
200: function() {
ok( isSuccess, name );
},
404: function() {
ok( !isSuccess, name );
}
};
}
jQuery.each(
/* jQuery.each arguments start */
{
"data/name.html": true,
"data/someFileThatDoesNotExist.html": false
},
function( uri, isSuccess ) {
jQuery.ajax( url(uri), {
statusCode: createStatusCodes( "in options", isSuccess ),
complete: countComplete
});
jQuery.ajax( url(uri), {
complete: countComplete
}).statusCode( createStatusCodes("immediately with method", isSuccess) );
jQuery.ajax( url(uri), {
complete: function( jqXHR ) {
jqXHR.statusCode( createStatusCodes("on complete", isSuccess) );
countComplete();
}
});
jQuery.ajax( url(uri), {
complete: function( jqXHR ) {
setTimeout(function() {
jqXHR.statusCode( createStatusCodes("very late binding", isSuccess) );
countComplete();
}, 100 );
}
});
jQuery.ajax( url(uri), {
statusCode: createStatusCodes( "all (options)", isSuccess ),
complete: function( jqXHR ) {
jqXHR.statusCode( createStatusCodes("all (on complete)", isSuccess) );
setTimeout(function() {
jqXHR.statusCode( createStatusCodes("all (very late binding)", isSuccess) );
countComplete();
}, 100 );
}
}).statusCode( createStatusCodes("all (immediately with method)", isSuccess) );
var testString = "";
jQuery.ajax( url(uri), {
success: function( a, b, jqXHR ) {
ok( isSuccess, "success" );
var statusCode = {};
statusCode[ jqXHR.status ] = function() {
testString += "B";
};
jqXHR.statusCode( statusCode );
testString += "A";
},
error: function( jqXHR ) {
ok( !isSuccess, "error" );
var statusCode = {};
statusCode[ jqXHR.status ] = function() {
testString += "B";
};
jqXHR.statusCode( statusCode );
testString += "A";
},
complete: function() {
strictEqual(
testString,
"AB",
"Test statusCode callbacks are ordered like " + ( isSuccess ? "success" : "error" ) + " callbacks"
);
countComplete();
}
});
}
/* jQuery.each arguments end*/
);
});
ajaxTest( "jQuery.ajax() - transitive conversions", 8, [
{
url: url("data/json.php"),
converters: {
"json myJson": function( data ) {
ok( true, "converter called" );
return data;
}
},
dataType: "myJson",
success: function() {
ok( true, "Transitive conversion worked" );
strictEqual( this.dataTypes[ 0 ], "text", "response was retrieved as text" );
strictEqual( this.dataTypes[ 1 ], "myjson", "request expected myjson dataType" );
}
},
{
url: url("data/json.php"),
converters: {
"json myJson": function( data ) {
ok( true, "converter called (*)" );
return data;
}
},
contents: false, /* headers are wrong so we ignore them */
dataType: "* myJson",
success: function() {
ok( true, "Transitive conversion worked (*)" );
strictEqual( this.dataTypes[ 0 ], "text", "response was retrieved as text (*)" );
strictEqual( this.dataTypes[ 1 ], "myjson", "request expected myjson dataType (*)" );
}
}
]);
ajaxTest( "jQuery.ajax() - overrideMimeType", 2, [
{
url: url("data/json.php"),
beforeSend: function( xhr ) {
xhr.overrideMimeType( "application/json" );
},
success: function( json ) {
ok( json.data, "Mimetype overridden using beforeSend" );
}
},
{
url: url("data/json.php"),
mimeType: "application/json",
success: function( json ) {
ok( json.data, "Mimetype overridden using mimeType option" );
}
}
]);
ajaxTest( "jQuery.ajax() - empty json gets to error callback instead of success callback.", 1, {
url: url("data/echoData.php"),
error: function( _, __, error ) {
equal( typeof error === "object", true, "Didn't get back error object for empty json response" );
},
dataType: "json"
});
ajaxTest( "#2688 - jQuery.ajax() - beforeSend, cancel request", 2, {
create: function() {
return jQuery.ajax({
url: url("data/name.html"),
beforeSend: function() {
ok( true, "beforeSend got called, canceling" );
return false;
},
success: function() {
ok( false, "request didn't get canceled" );
},
complete: function() {
ok( false, "request didn't get canceled" );
},
error: function() {
ok( false, "request didn't get canceled" );
}
});
},
fail: function( _, reason ) {
strictEqual( reason, "canceled", "canceled request must fail with 'canceled' status text" );
}
});
ajaxTest( "#2806 - jQuery.ajax() - data option - evaluate function values", 1, {
url: "data/echoQuery.php",
data: {
key: function() {
return "value";
}
},
success: function( result ) {
strictEqual( result, "key=value" );
}
});
test( "#7531 - jQuery.ajax() - Location object as url", 1, function () {
var xhr,
success = false;
try {
xhr = jQuery.ajax({
url: window.location
});
success = true;
xhr.abort();
} catch (e) {
}
ok( success, "document.location did not generate exception" );
});
jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) {
ajaxTest( "#7578 - jQuery.ajax() - JSONP - default for cache option" + label, 1, {
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
beforeSend: function() {
strictEqual( this.cache, false, "cache must be false on JSON request" );
return false;
},
error: true
});
});
ajaxTest( "#8107 - jQuery.ajax() - multiple method signatures introduced in 1.5", 4, [
{
create: function() {
return jQuery.ajax();
},
done: function() {
ok( true, "With no arguments" );
}
},
{
create: function() {
return jQuery.ajax("data/name.html");
},
done: function() {
ok( true, "With only string URL argument" );
}
},
{
create: function() {
return jQuery.ajax( "data/name.html", {});
},
done: function() {
ok( true, "With string URL param and map" );
}
},
{
create: function( options ) {
return jQuery.ajax( options );
},
url: "data/name.html",
success: function() {
ok( true, "With only map" );
}
}
]);
jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) {
ajaxTest( "#8205 - jQuery.ajax() - JSONP - re-use callbacks name" + label, 2, {
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
beforeSend: function( jqXHR, s ) {
s.callback = s.jsonpCallback;
},
success: function() {
var previous = this;
strictEqual( previous.jsonpCallback, undefined, "jsonpCallback option is set back to default in callbacks" );
jQuery.ajax({
url: "data/jsonp.php",
dataType: "jsonp",
crossDomain: crossDomain,
beforeSend: function() {
strictEqual( this.jsonpCallback, previous.callback, "JSONP callback name is re-used" );
return false;
}
});
}
});
});
test( "#9887 - jQuery.ajax() - Context with circular references (#9887)", 2, function () {
var success = false,
context = {};
context.field = context;
try {
jQuery.ajax( "non-existing", {
context: context,
beforeSend: function() {
ok( this === context, "context was not deep extended" );
return false;
}
});
success = true;
} catch ( e ) {
console.log( e );
}
ok( success, "context with circular reference did not generate an exception" );
});
jQuery.each( [ "as argument", "in settings object" ], function( inSetting, title ) {
function request( url, test ) {
return {
create: function() {
return jQuery.ajax( inSetting ? { url: url } : url );
},
done: function() {
ok( true, ( test || url ) + " " + title );
}
};
}
ajaxTest( "#10093 - jQuery.ajax() - falsy url " + title, 4, [
request( "", "empty string" ),
request( false ),
request( null ),
request( undefined )
]);
});
ajaxTest( "#11151 - jQuery.ajax() - parse error body", 2, {
url: url("data/errorWithJSON.php"),
dataFilter: function( string ) {
ok( false, "dataFilter called" );
return string;
},
error: function( jqXHR ) {
strictEqual( jqXHR.responseText, "{ \"code\": 40, \"message\": \"Bad Request\" }", "Error body properly set" );
deepEqual( jqXHR.responseJSON, { code: 40, message: "Bad Request" }, "Error body properly parsed" );
}
});
ajaxTest( "#11426 - jQuery.ajax() - loading binary data shouldn't throw an exception in IE", 1, {
url: url("data/1x1.jpg"),
success: function( data ) {
ok( data === undefined || /JFIF/.test( data ), "success callback reached" );
}
});
asyncTest( "#11743 - jQuery.ajax() - script, throws exception", 1, function() {
var onerror = window.onerror;
window.onerror = function() {
ok( true, "Exception thrown" );
window.onerror = onerror;
start();
};
jQuery.ajax({
url: "data/badjson.js",
dataType: "script",
throws: true,
// Global events get confused by the exception
global: false,
success: function() {
ok( false, "Success." );
},
error: function() {
ok( false, "Error." );
}
});
});
jQuery.each( [ "method", "type" ], function( _, globalOption ) {
function request( option ) {
var options = {
url: url("data/echoData.php"),
data: "hello",
success: function( msg ) {
strictEqual( msg, "hello", "Check for POST (no override)" );
}
};
if ( option ) {
options[ option ] = "GET";
options.success = function( msg ) {
strictEqual( msg, "", "Check for no POST (overriding with " + option + ")" );
};
}
return options;
}
ajaxTest( "#12004 - jQuery.ajax() - method is an alias of type - " + globalOption + " set globally", 3, {
setup: function() {
var options = {};
options[ globalOption ] = "POST";
jQuery.ajaxSetup( options );
},
requests: [
request("type"),
request("method"),
request()
]
});
});
ajaxTest( "#13276 - jQuery.ajax() - compatibility between XML documents from ajax requests and parsed string", 1, {
url: "data/dashboard.xml",
dataType: "xml",
success: function( ajaxXML ) {
var parsedXML = jQuery( jQuery.parseXML("<tab title=\"Added\">blibli</tab>") ).find("tab");
ajaxXML = jQuery( ajaxXML );
try {
ajaxXML.find("infowindowtab").append( parsedXML );
} catch( e ) {
strictEqual( e, undefined, "error" );
return;
}
strictEqual( ajaxXML.find("tab").length, 3, "Parsed node was added properly" );
}
});
ajaxTest( "#13292 - jQuery.ajax() - converter is bypassed for 204 requests", 3, {
url: "data/nocontent.php",
dataType: "testing",
converters: {
"* testing": function() {
throw "converter was called";
}
},
success: function( data, status, jqXHR ) {
strictEqual( jqXHR.status, 204, "status code is 204" );
strictEqual( status, "nocontent", "status text is 'nocontent'" );
strictEqual( data, undefined, "data is undefined" );
},
error: function( _, status, error ) {
ok( false, "error" );
strictEqual( status, "parsererror", "Parser Error" );
strictEqual( error, "converter was called", "Converter was called" );
}
});
ajaxTest( "#13388 - jQuery.ajax() - responseXML", 3, {
url: url("data/with_fries.xml"),
dataType: "xml",
success: function( resp, _, jqXHR ) {
notStrictEqual( resp, undefined, "XML document exists" );
ok( "responseXML" in jqXHR, "jqXHR.responseXML exists" );
strictEqual( resp, jqXHR.responseXML, "jqXHR.responseXML is set correctly" );
}
});
ajaxTest( "#13922 - jQuery.ajax() - converter is bypassed for HEAD requests", 3, {
url: "data/json.php",
method: "HEAD",
data: {
header: "yes"
},
converters: {
"text json": function() {
throw "converter was called";
}
},
success: function( data, status ) {
ok( true, "success" );
strictEqual( status, "nocontent", "data is undefined" );
strictEqual( data, undefined, "data is undefined" );
},
error: function( _, status, error ) {
ok( false, "error" );
strictEqual( status, "parsererror", "Parser Error" );
strictEqual( error, "converter was called", "Converter was called" );
}
} );
//----------- jQuery.ajaxPrefilter()
ajaxTest( "jQuery.ajaxPrefilter() - abort", 1, {
setup: function() {
jQuery.ajaxPrefilter(function( options, _, jqXHR ) {
if ( options.abortInPrefilter ) {
jqXHR.abort();
}
});
},
abortInPrefilter: true,
error: function() {
ok( false, "error callback called" );
},
fail: function( _, reason ) {
strictEqual( reason, "canceled", "Request aborted by the prefilter must fail with 'canceled' status text" );
}
});
//----------- jQuery.ajaxSetup()
asyncTest( "jQuery.ajaxSetup()", 1, function() {
jQuery.ajaxSetup({
url: url("data/name.php?name=foo"),
success: function( msg ) {
strictEqual( msg, "bar", "Check for GET" );
start();
}
});
jQuery.ajax();
});
asyncTest( "jQuery.ajaxSetup({ timeout: Number }) - with global timeout", 2, function() {
var passed = 0,
pass = function() {
ok( passed++ < 2, "Error callback executed" );
if ( passed === 2 ) {
jQuery( document ).off("ajaxError.setupTest");
start();
}
},
fail = function( a, b ) {
ok( false, "Check for timeout failed " + a + " " + b );
start();
};
jQuery( document ).on( "ajaxError.setupTest", pass );
jQuery.ajaxSetup({
timeout: 1000
});
jQuery.ajax({
type: "GET",
url: url("data/name.php?wait=5"),
error: pass,
success: fail
});
});
asyncTest( "jQuery.ajaxSetup({ timeout: Number }) with localtimeout", 1, function() {
jQuery.ajaxSetup({
timeout: 50
});
jQuery.ajax({
type: "GET",
timeout: 15000,
url: url("data/name.php?wait=1"),
error: function() {
ok( false, "Check for local timeout failed" );
start();
},
success: function() {
ok( true, "Check for local timeout" );
start();
}
});
});
//----------- jQuery.domManip()
test( "#11264 - jQuery.domManip() - no side effect because of ajaxSetup or global events", 1, function() {
jQuery.ajaxSetup({
type: "POST"
});
jQuery( document ).on( "ajaxStart ajaxStop", function() {
ok( false, "Global event triggered" );
});
jQuery("#qunit-fixture").append("<script src='data/evalScript.php'></script>");
jQuery( document ).off("ajaxStart ajaxStop");
});
asyncTest( "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, function() {
jQuery("#qunit-fixture").load( "data/cleanScript.html", start );
});
//----------- jQuery.get()
asyncTest( "jQuery.get( String, Hash, Function ) - parse xml and use text() on nodes", 2, function() {
jQuery.get( url("data/dashboard.xml"), function( xml ) {
var content = [];
jQuery( "tab", xml ).each(function() {
content.push( jQuery( this ).text() );
});
strictEqual( content[ 0 ], "blabla", "Check first tab" );
strictEqual( content[ 1 ], "blublu", "Check second tab" );
start();
});
});
asyncTest( "#8277 - jQuery.get( String, Function ) - data in ajaxSettings", 1, function() {
jQuery.ajaxSetup({
data: "helloworld"
});
jQuery.get( url("data/echoQuery.php"), function( data ) {
ok( /helloworld$/.test( data ), "Data from ajaxSettings was used" );
start();
});
});
//----------- jQuery.getJSON()
asyncTest( "jQuery.getJSON( String, Hash, Function ) - JSON array", 5, function() {
jQuery.getJSON(
url("data/json.php"),
{
"json": "array"
},
function( json ) {
ok( json.length >= 2, "Check length" );
strictEqual( json[ 0 ]["name"], "John", "Check JSON: first, name" );
strictEqual( json[ 0 ]["age"], 21, "Check JSON: first, age" );
strictEqual( json[ 1 ]["name"], "Peter", "Check JSON: second, name" );
strictEqual( json[ 1 ]["age"], 25, "Check JSON: second, age" );
start();
}
);
});
asyncTest( "jQuery.getJSON( String, Function ) - JSON object", 2, function() {
jQuery.getJSON( url("data/json.php"), function( json ) {
if ( json && json["data"] ) {
strictEqual( json["data"]["lang"], "en", "Check JSON: lang" );
strictEqual( json["data"].length, 25, "Check JSON: length" );
start();
}
});
});
asyncTest( "jQuery.getJSON( String, Function ) - JSON object with absolute url to local content", 2, function() {
jQuery.getJSON( url( window.location.href.replace( /[^\/]*$/, "" ) + "data/json.php" ), function( json ) {
strictEqual( json.data.lang, "en", "Check JSON: lang" );
strictEqual( json.data.length, 25, "Check JSON: length" );
start();
});
});
//----------- jQuery.getScript()
asyncTest( "jQuery.getScript( String, Function ) - with callback", 2, function() {
Globals.register("testBar");
jQuery.getScript( url("data/test.js"), function() {
strictEqual( window["testBar"], "bar", "Check if script was evaluated" );
start();
});
});
asyncTest( "jQuery.getScript( String, Function ) - no callback", 1, function() {
Globals.register("testBar");
jQuery.getScript( url("data/test.js") ).done( start );
});
asyncTest( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function() {
Globals.register("testBar");
jQuery.getScript( url("data/test.js"), function( data, _, jqXHR ) {
strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script" );
start();
});
});
//----------- jQuery.fn.load()
// check if load can be called with only url
asyncTest( "jQuery.fn.load( String )", 2, function() {
jQuery.ajaxSetup({
beforeSend: function() {
strictEqual( this.type, "GET", "no data means GET request" );
}
});
jQuery("#first").load( "data/name.html", start );
});
asyncTest( "jQuery.fn.load() - 404 error callbacks", 6, function() {
addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError")();
jQuery( document ).ajaxStop( start );
jQuery("<div/>").load( "data/404.html", function() {
ok( true, "complete" );
});
});
// check if load can be called with url and null data
asyncTest( "jQuery.fn.load( String, null )", 2, function() {
jQuery.ajaxSetup({
beforeSend: function() {
strictEqual( this.type, "GET", "no data means GET request" );
}
});
jQuery("#first").load( "data/name.html", null, start );
});
// check if load can be called with url and undefined data
asyncTest( "jQuery.fn.load( String, undefined )", 2, function() {
jQuery.ajaxSetup({
beforeSend: function() {
strictEqual( this.type, "GET", "no data means GET request" );
}
});
jQuery("#first").load( "data/name.html", undefined, start );
});
// check if load can be called with only url
asyncTest( "jQuery.fn.load( URL_SELECTOR )", 1, function() {
jQuery("#first").load( "data/test3.html div.user", function() {
strictEqual( jQuery( this ).children("div").length, 2, "Verify that specific elements were injected" );
start();
});
});
asyncTest( "jQuery.fn.load( String, Function ) - simple: inject text into DOM", 2, function() {
jQuery("#first").load( url("data/name.html"), function() {
ok( /^ERROR/.test(jQuery("#first").text()), "Check if content was injected into the DOM" );
start();
});
});
asyncTest( "jQuery.fn.load( String, Function ) - check scripts", 7, function() {
var verifyEvaluation = function() {
strictEqual( window["testBar"], "bar", "Check if script src was evaluated after load" );
strictEqual( jQuery("#ap").html(), "bar", "Check if script evaluation has modified DOM");
start();
};
Globals.register("testFoo");
Globals.register("testBar");
jQuery("#first").load( url("data/test.html"), function() {
ok( jQuery("#first").html().match( /^html text/ ), "Check content after loading html" );
strictEqual( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM" );
strictEqual( window["testFoo"], "foo", "Check if script was evaluated after load" );
setTimeout( verifyEvaluation, 600 );
});
});
asyncTest( "jQuery.fn.load( String, Function ) - check file with only a script tag", 3, function() {
Globals.register("testFoo");
jQuery("#first").load( url("data/test2.html"), function() {
strictEqual( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM");
strictEqual( window["testFoo"], "foo", "Check if script was evaluated after load" );
start();
});
});
asyncTest( "jQuery.fn.load( String, Function ) - dataFilter in ajaxSettings", 2, function() {
jQuery.ajaxSetup({
dataFilter: function() {
return "Hello World";
}
});
jQuery("<div/>").load( url("data/name.html"), function( responseText ) {
strictEqual( jQuery( this ).html(), "Hello World", "Test div was filled with filtered data" );
strictEqual( responseText, "Hello World", "Test callback receives filtered data" );
start();
});
});
asyncTest( "jQuery.fn.load( String, Object, Function )", 2, function() {
jQuery("<div />").load( url("data/params_html.php"), {
"foo": 3,
"bar": "ok"
}, function() {
var $post = jQuery( this ).find("#post");
strictEqual( $post.find("#foo").text(), "3", "Check if a hash of data is passed correctly" );
strictEqual( $post.find("#bar").text(), "ok", "Check if a hash of data is passed correctly" );
start();
});
});
asyncTest( "jQuery.fn.load( String, String, Function )", 2, function() {
jQuery("<div />").load( url("data/params_html.php"), "foo=3&bar=ok", function() {
var $get = jQuery( this ).find("#get");
strictEqual( $get.find("#foo").text(), "3", "Check if a string of data is passed correctly" );
strictEqual( $get.find("#bar").text(), "ok", "Check if a of data is passed correctly" );
start();
});
});
asyncTest( "jQuery.fn.load() - callbacks get the correct parameters", 8, function() {
var completeArgs = {};
jQuery.ajaxSetup({
success: function( _, status, jqXHR ) {
completeArgs[ this.url ] = [ jqXHR.responseText, status, jqXHR ];
},
error: function( jqXHR, status ) {
completeArgs[ this.url ] = [ jqXHR.responseText, status, jqXHR ];
}
});
jQuery.when.apply(
jQuery,
jQuery.map([
{
type: "success",
url: "data/echoQuery.php?arg=pop"
},
{
type: "error",
url: "data/404.php"
}
],
function( options ) {
return jQuery.Deferred(function( defer ) {
jQuery("#foo").load( options.url, function() {
var args = arguments;
strictEqual( completeArgs[ options.url ].length, args.length, "same number of arguments (" + options.type + ")" );
jQuery.each( completeArgs[ options.url ], function( i, value ) {
strictEqual( args[ i ], value, "argument #" + i + " is the same (" + options.type + ")" );
});
defer.resolve();
});
});
})
).always( start );
});
asyncTest( "#2046 - jQuery.fn.load( String, Function ) with ajaxSetup on dataType json", 1, function() {
jQuery.ajaxSetup({
dataType: "json"
});
jQuery( document ).ajaxComplete(function( e, xml, s ) {
strictEqual( s.dataType, "html", "Verify the load() dataType was html" );
jQuery( document ).off("ajaxComplete");
start();
});
jQuery("#first").load("data/test3.html");
});
asyncTest( "#10524 - jQuery.fn.load() - data specified in ajaxSettings is merged in", 1, function() {
var data = {
"baz": 1
};
jQuery.ajaxSetup({
data: {
"foo": "bar"
}
});
jQuery("#foo").load( "data/echoQuery.php", data );
jQuery( document ).ajaxComplete(function( event, jqXHR, options ) {
ok( ~options.data.indexOf("foo=bar"), "Data from ajaxSettings was used" );
start();
});
});
//----------- jQuery.post()
asyncTest( "jQuery.post() - data", 3, function() {
jQuery.when(
jQuery.post(
url("data/name.php"),
{
xml: "5-2",
length: 3
},
function( xml ) {
jQuery( "math", xml ).each(function() {
strictEqual( jQuery( "calculation", this ).text(), "5-2", "Check for XML" );
strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" );
});
}
),
jQuery.ajax({
url: url("data/echoData.php"),
type: "POST",
data: {
"test": {
"length": 7,
"foo": "bar"
}
},
success: function( data ) {
strictEqual( data, "test%5Blength%5D=7&test%5Bfoo%5D=bar", "Check if a sub-object with a length param is serialized correctly" );
}
})
).always( start );
});
asyncTest( "jQuery.post( String, Hash, Function ) - simple with xml", 4, function() {
jQuery.when(
jQuery.post(
url("data/name.php"),
{
"xml": "5-2"
},
function( xml ) {
jQuery( "math", xml ).each(function() {
strictEqual( jQuery( "calculation", this ).text(), "5-2", "Check for XML" );
strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" );
});
}
),
jQuery.post( url("data/name.php?xml=5-2"), {}, function( xml ) {
jQuery( "math", xml ).each(function() {
strictEqual( jQuery( "calculation", this ).text(), "5-2", "Check for XML" );
strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" );
});
})
).always( start );
});
//----------- jQuery.active
test( "jQuery.active", 1, function() {
ok( jQuery.active === 0, "ajax active counter should be zero: " + jQuery.active );
});
})();
| {
"pile_set_name": "Github"
} |
virtual_hosts:
- name: local_service
domains:
- '*'
routes:
- match:
prefix: /
headers:
- name: test_header
exact_match: test
route:
cluster: local_service_with_headers
- match:
prefix: /
headers:
- name: test_header_multiple1
exact_match: test1
- name: test_header_multiple2
exact_match: test2
route:
cluster: local_service_with_multiple_headers
- match:
prefix: /
headers:
- name: test_header_presence
route:
cluster: local_service_with_empty_headers
- match:
prefix: /
headers:
- name: test_header_pattern
safe_regex_match:
google_re2: {}
regex: ^user=test-\d+$
route:
cluster: local_service_with_header_pattern_set_regex
- match:
prefix: /
headers:
- name: test_header_pattern
exact_match: ^customer=test-\d+$
route:
cluster: local_service_with_header_pattern_unset_regex
- match:
prefix: /
grpc: {}
headers:
- name: test_header
exact_match: some_value
route:
cluster: local_service_with_grpc_and_other_header
- match:
prefix: /
grpc: {}
route:
cluster: local_service_with_grpc
- match:
prefix: /
route:
cluster: local_service_without_headers
| {
"pile_set_name": "Github"
} |
Example 2
=========
Same as the first example, but now using Unity's test fixture to group tests
together. Using the test fixture also makes writing test runners much easier. | {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name='TestModel',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=100)),
],
bases=(models.Model,),
),
]
| {
"pile_set_name": "Github"
} |
<meta charset='UTF-8'>
<meta http-equiv='X-UA-Compatible' content='IE=Edge'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application.css' %>
<%= stylesheet_link_tag params[:controller], media: 'all' %>
<%= favicon_link_tag 'favicon.ico' %>
<%= javascript_tag "const AUTH_TOKEN = document.querySelector('[name=\"csrf-token\"]').content;" if protect_against_forgery?%>
| {
"pile_set_name": "Github"
} |
// Copyright 2010 The draw2d Authors. All rights reserved.
// created: 13/12/2010 by Laurent Le Goff
package drawing
// Transformer apply the Matrix transformation tr
type Transformer struct {
Tr Matrix
Flattener Flattener
}
// MoveTo implements the path builder interface.
func (t Transformer) MoveTo(x, y float64) {
u := x*t.Tr[0] + y*t.Tr[2] + t.Tr[4]
v := x*t.Tr[1] + y*t.Tr[3] + t.Tr[5]
t.Flattener.MoveTo(u, v)
}
// LineTo implements the path builder interface.
func (t Transformer) LineTo(x, y float64) {
u := x*t.Tr[0] + y*t.Tr[2] + t.Tr[4]
v := x*t.Tr[1] + y*t.Tr[3] + t.Tr[5]
t.Flattener.LineTo(u, v)
}
// LineJoin implements the path builder interface.
func (t Transformer) LineJoin() {
t.Flattener.LineJoin()
}
// Close implements the path builder interface.
func (t Transformer) Close() {
t.Flattener.Close()
}
// End implements the path builder interface.
func (t Transformer) End() {
t.Flattener.End()
}
| {
"pile_set_name": "Github"
} |
(function($) {
$.extend($.summernote.lang, {
'da-DK': {
font: {
bold: 'Fed',
italic: 'Kursiv',
underline: 'Understreget',
clear: 'Fjern formatering',
height: 'Højde',
name: 'Skrifttype',
strikethrough: 'Gennemstreget',
subscript: 'Sænket skrift',
superscript: 'Hævet skrift',
size: 'Skriftstørrelse'
},
image: {
image: 'Billede',
insert: 'Indsæt billede',
resizeFull: 'Original størrelse',
resizeHalf: 'Halv størrelse',
resizeQuarter: 'Kvart størrelse',
floatLeft: 'Venstrestillet',
floatRight: 'Højrestillet',
floatNone: 'Fjern formatering',
shapeRounded: 'Form: Runde kanter',
shapeCircle: 'Form: Cirkel',
shapeThumbnail: 'Form: Miniature',
shapeNone: 'Form: Ingen',
dragImageHere: 'Træk billede hertil',
dropImage: 'Slip billede',
selectFromFiles: 'Vælg billed-fil',
maximumFileSize: 'Maks fil størrelse',
maximumFileSizeError: 'Filen er større end maks tilladte fil størrelse!',
url: 'Billede URL',
remove: 'Fjern billede',
original: 'Original'
},
video: {
video: 'Video',
videoLink: 'Video Link',
insert: 'Indsæt Video',
url: 'Video URL?',
providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)'
},
link: {
link: 'Link',
insert: 'Indsæt link',
unlink: 'Fjern link',
edit: 'Rediger',
textToDisplay: 'Visningstekst',
url: 'Hvor skal linket pege hen?',
openInNewWindow: 'Åbn i nyt vindue'
},
table: {
table: 'Tabel',
addRowAbove: 'Add row above',
addRowBelow: 'Add row below',
addColLeft: 'Add column left',
addColRight: 'Add column right',
delRow: 'Delete row',
delCol: 'Delete column',
delTable: 'Delete table'
},
hr: {
insert: 'Indsæt horisontal linje'
},
style: {
style: 'Stil',
p: 'p',
blockquote: 'Citat',
pre: 'Kode',
h1: 'Overskrift 1',
h2: 'Overskrift 2',
h3: 'Overskrift 3',
h4: 'Overskrift 4',
h5: 'Overskrift 5',
h6: 'Overskrift 6'
},
lists: {
unordered: 'Punktopstillet liste',
ordered: 'Nummereret liste'
},
options: {
help: 'Hjælp',
fullscreen: 'Fuld skærm',
codeview: 'HTML-Visning'
},
paragraph: {
paragraph: 'Afsnit',
outdent: 'Formindsk indryk',
indent: 'Forøg indryk',
left: 'Venstrestillet',
center: 'Centreret',
right: 'Højrestillet',
justify: 'Blokjuster'
},
color: {
recent: 'Nyligt valgt farve',
more: 'Flere farver',
background: 'Baggrund',
foreground: 'Forgrund',
transparent: 'Transparent',
setTransparent: 'Sæt transparent',
reset: 'Nulstil',
resetToDefault: 'Gendan standardindstillinger'
},
shortcut: {
shortcuts: 'Genveje',
close: 'Luk',
textFormatting: 'Tekstformatering',
action: 'Handling',
paragraphFormatting: 'Afsnitsformatering',
documentStyle: 'Dokumentstil',
extraKeys: 'Extra keys'
},
help: {
'insertParagraph': 'Insert Paragraph',
'undo': 'Undoes the last command',
'redo': 'Redoes the last command',
'tab': 'Tab',
'untab': 'Untab',
'bold': 'Set a bold style',
'italic': 'Set a italic style',
'underline': 'Set a underline style',
'strikethrough': 'Set a strikethrough style',
'removeFormat': 'Clean a style',
'justifyLeft': 'Set left align',
'justifyCenter': 'Set center align',
'justifyRight': 'Set right align',
'justifyFull': 'Set full align',
'insertUnorderedList': 'Toggle unordered list',
'insertOrderedList': 'Toggle ordered list',
'outdent': 'Outdent on current paragraph',
'indent': 'Indent on current paragraph',
'formatPara': 'Change current block\'s format as a paragraph(P tag)',
'formatH1': 'Change current block\'s format as H1',
'formatH2': 'Change current block\'s format as H2',
'formatH3': 'Change current block\'s format as H3',
'formatH4': 'Change current block\'s format as H4',
'formatH5': 'Change current block\'s format as H5',
'formatH6': 'Change current block\'s format as H6',
'insertHorizontalRule': 'Insert horizontal rule',
'linkDialog.show': 'Show Link Dialog'
},
history: {
undo: 'Fortryd',
redo: 'Annuller fortryd'
},
specialChar: {
specialChar: 'SPECIAL CHARACTERS',
select: 'Select Special characters'
}
}
});
})(jQuery);
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2014, the Railo Company Ltd.
* Copyright (c) 2015, Lucee Assosication Switzerland
*
* 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/>.
*
*/
package lucee.runtime.util;
import java.util.Date;
import lucee.runtime.exp.PageException;
/**
* class to compare objects and primitive value types
*/
public interface Operation {
/**
* compares two Objects
*
* @param left
* @param right
* @return different of objects as int
* @throws PageException
*/
public int compare(Object left, Object right) throws PageException;
/**
* compares an Object with a String
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(Object left, String right) throws PageException;
/**
* compares an Object with a double
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(Object left, double right) throws PageException;
/**
* compares an Object with a boolean
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(Object left, boolean right) throws PageException;
/**
* compares an Object with a Date
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(Object left, Date right) throws PageException;
/**
* compares a String with an Object
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(String left, Object right) throws PageException;
/**
* compares a String with a String
*
* @param left
* @param right
* @return difference as int
*/
public int compare(String left, String right);
/**
* compares a String with a double
*
* @param left
* @param right
* @return difference as int
*/
public int compare(String left, double right);
/**
* compares a String with a boolean
*
* @param left
* @param right
* @return difference as int
*/
public int compare(String left, boolean right);
/**
* compares a String with a Date
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(String left, Date right) throws PageException;
/**
* compares a double with an Object
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(double left, Object right) throws PageException;
/**
* compares a double with a String
*
* @param left
* @param right
* @return difference as int
*/
public int compare(double left, String right);
/**
* compares a double with a double
*
* @param left
* @param right
* @return difference as int
*/
public int compare(double left, double right);
/**
* compares a double with a boolean
*
* @param left
* @param right
* @return difference as int
*/
public int compare(double left, boolean right);
/**
* compares a double with a Date
*
* @param left
* @param right
* @return difference as int
*/
public int compare(double left, Date right);
/**
* compares a boolean with an Object
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(boolean left, Object right) throws PageException;
/**
* compares a boolean with a double
*
* @param left
* @param right
* @return difference as int
*/
public int compare(boolean left, double right);
/**
* compares a boolean with a double
*
* @param left
* @param right
* @return difference as int
*/
public int compare(boolean left, String right);
/**
* compares a boolean with a boolean
*
* @param left
* @param right
* @return difference as int
*/
public int compare(boolean left, boolean right);
/**
* compares a boolean with a Date
*
* @param left
* @param right
* @return difference as int
*/
public int compare(boolean left, Date right);
/**
* compares a Date with an Object
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(Date left, Object right) throws PageException;
/**
* compares a Date with a String
*
* @param left
* @param right
* @return difference as int
* @throws PageException
*/
public int compare(Date left, String right) throws PageException;
/**
* compares a Date with a double
*
* @param left
* @param right
* @return difference as int
*/
public int compare(Date left, double right);
/**
* compares a Date with a boolean
*
* @param left
* @param right
* @return difference as int
*/
public int compare(Date left, boolean right);
/**
* compares a Date with a Date
*
* @param left
* @param right
* @return difference as int
*/
public int compare(Date left, Date right);
/**
* Method to compare to different values, return true of objects are same otherwise false
*
* @param left left value to compare
* @param right right value to compare
* @param caseSensitive check case sensitive or not
* @return is same or not
* @throws PageException
*/
public boolean equals(Object left, Object right, boolean caseSensitive) throws PageException;
public boolean equalsComplexEL(Object left, Object right, boolean caseSensitive, boolean checkOnlyPublicAppearance);
public boolean equalsComplex(Object left, Object right, boolean caseSensitive, boolean checkOnlyPublicAppearance) throws PageException;
/**
* check if left is inside right
*
* @param left string to check
* @param right substring to find in string
* @return return if substring has been found
* @throws PageException
*/
public boolean ct(Object left, Object right) throws PageException;
/**
* Equivalence: Return True if both operands are True or both are False. The EQV operator is the
* opposite of the XOR operator. For example, True EQV True is True, but True EQV False is False.
*
* @param left value to check
* @param right value to check
* @return result of operation
* @throws PageException
*/
public boolean eqv(Object left, Object right) throws PageException;
/**
* Implication: The statement A IMP B is the equivalent of the logical statement "If A Then B." A
* IMP B is False only if A is True and B is False. It is True in all other cases.
*
* @param left value to check
* @param right value to check
* @return result
* @throws PageException
*/
public boolean imp(Object left, Object right) throws PageException;
/**
* check if left is not inside right
*
* @param left string to check
* @param right substring to find in string
* @return return if substring NOT has been found
* @throws PageException
*/
public boolean nct(Object left, Object right) throws PageException;
/**
* calculate the exponent of the left value
*
* @param left value to get exponent from
* @param right exponent count
* @return return exponent value
* @throws PageException
*/
public double exponent(Object left, Object right) throws PageException;
/**
* concat to Strings
*
* @param left
* @param right
* @return concatenated String
*/
public String concat(String left, String right);
/**
* plus operation
*
* @param left
* @param right
* @return result of the operations
*/
public double plus(double left, double right);
/**
* minus operation
*
* @param left
* @param right
* @return result of the operations
*/
public double minus(double left, double right);
/**
* modulus operation
*
* @param left
* @param right
* @return result of the operations
*/
public double modulus(double left, double right);
/**
* divide operation
*
* @param left
* @param right
* @return result of the operations
*/
public double divide(double left, double right);
/**
* multiply operation
*
* @param left
* @param right
* @return result of the operations
*/
public double multiply(double left, double right);
} | {
"pile_set_name": "Github"
} |
;;;;;; SRFI 43: Vector library -*- Scheme -*-
;;;
;;; $Id$
;;;
;;; Taylor Campbell wrote this code; he places it in the public domain.
;;; Will Clinger [wdc] made some corrections, also in the public domain.
;;; --------------------
;;; Exported procedure index
;;;
;;; * Constructors
;;; make-vector vector
;;; vector-unfold vector-unfold-right
;;; vector-copy vector-reverse-copy
;;; vector-append vector-concatenate
;;;
;;; * Predicates
;;; vector?
;;; vector-empty?
;;; vector=
;;;
;;; * Selectors
;;; vector-ref
;;; vector-length
;;;
;;; * Iteration
;;; vector-fold vector-fold-right
;;; vector-map vector-map!
;;; vector-for-each
;;; vector-count
;;;
;;; * Searching
;;; vector-index vector-skip
;;; vector-index-right vector-skip-right
;;; vector-binary-search
;;; vector-any vector-every
;;;
;;; * Mutators
;;; vector-set!
;;; vector-swap!
;;; vector-fill!
;;; vector-reverse!
;;; vector-copy! vector-reverse-copy!
;;; vector-reverse!
;;;
;;; * Conversion
;;; vector->list reverse-vector->list
;;; list->vector reverse-list->vector
;;; --------------------
;;; Commentary on efficiency of the code
;;; This code is somewhat tuned for efficiency. There are several
;;; internal routines that can be optimized greatly to greatly improve
;;; the performance of much of the library. These internal procedures
;;; are already carefully tuned for performance, and lambda-lifted by
;;; hand. Some other routines are lambda-lifted by hand, but only the
;;; loops are lambda-lifted, and only if some routine has two possible
;;; loops -- a fast path and an n-ary case --, whereas _all_ of the
;;; internal routines' loops are lambda-lifted so as to never cons a
;;; closure in their body (VECTOR-PARSE-START+END doesn't have a loop),
;;; even in Scheme systems that perform no loop optimization (which is
;;; most of them, unfortunately).
;;;
;;; Fast paths are provided for common cases in most of the loops in
;;; this library.
;;;
;;; All calls to primitive vector operations are protected by a prior
;;; type check; they can be safely converted to use unsafe equivalents
;;; of the operations, if available. Ideally, the compiler should be
;;; able to determine this, but the state of Scheme compilers today is
;;; not a happy one.
;;;
;;; Efficiency of the actual algorithms is a rather mundane point to
;;; mention; vector operations are rarely beyond being straightforward.
;;; --------------------
;;; Utilities
;;; SRFI 8, too trivial to put in the dependencies list.
(define-syntax receive
(syntax-rules ()
((receive ?formals ?producer ?body1 ?body2 ...)
(call-with-values (lambda () ?producer)
(lambda ?formals ?body1 ?body2 ...)))))
;;; Not the best LET*-OPTIONALS, but not the worst, either. Use Olin's
;;; if it's available to you.
(define-syntax let*-optionals
(syntax-rules ()
((let*-optionals (?x ...) ((?var ?default) ...) ?body1 ?body2 ...)
(let ((args (?x ...)))
(let*-optionals args ((?var ?default) ...) ?body1 ?body2 ...)))
((let*-optionals ?args ((?var ?default) ...) ?body1 ?body2 ...)
(let*-optionals:aux ?args ?args ((?var ?default) ...)
?body1 ?body2 ...))))
(define-syntax let*-optionals:aux
(syntax-rules ()
((aux ?orig-args-var ?args-var () ?body1 ?body2 ...)
(if (null? ?args-var)
(let () ?body1 ?body2 ...)
(error "too many arguments" (length ?orig-args-var)
?orig-args-var)))
((aux ?orig-args-var ?args-var
((?var ?default) ?more ...)
?body1 ?body2 ...)
(if (null? ?args-var)
(let* ((?var ?default) ?more ...) ?body1 ?body2 ...)
(let ((?var (car ?args-var))
(new-args (cdr ?args-var)))
(let*-optionals:aux ?orig-args-var new-args
(?more ...)
?body1 ?body2 ...))))))
(define (nonneg-int? x)
(and (integer? x)
(not (negative? x))))
(define (between? x y z)
(and (< x y)
(<= y z)))
(define (unspecified-value) (if #f #f))
;++ This should be implemented more efficiently. It shouldn't cons a
;++ closure, and the cons cells used in the loops when using this could
;++ be reused.
(define (vectors-ref vectors i)
(map (lambda (v) (vector-ref v i)) vectors))
;;; --------------------
;;; Error checking
;;; Error signalling (not checking) is done in a way that tries to be
;;; as helpful to the person who gets the debugging prompt as possible.
;;; That said, error _checking_ tries to be as unredundant as possible.
;;; I don't use any sort of general condition mechanism; I use simply
;;; SRFI 23's ERROR, even in cases where it might be better to use such
;;; a general condition mechanism. Fix that when porting this to a
;;; Scheme implementation that has its own condition system.
;;; In argument checks, upon receiving an invalid argument, the checker
;;; procedure recursively calls itself, but in one of the arguments to
;;; itself is a call to ERROR; this mechanism is used in the hopes that
;;; the user may be thrown into a debugger prompt, proceed with another
;;; value, and let it be checked again.
;;; Type checking is pretty basic, but easily factored out and replaced
;;; with whatever your implementation's preferred type checking method
;;; is. I doubt there will be many other methods of index checking,
;;; though the index checkers might be better implemented natively.
;;; (CHECK-TYPE <type-predicate?> <value> <callee>) -> value
;;; Ensure that VALUE satisfies TYPE-PREDICATE?; if not, signal an
;;; error stating that VALUE did not satisfy TYPE-PREDICATE?, showing
;;; that this happened while calling CALLEE. Return VALUE if no
;;; error was signalled.
(define (check-type pred? value callee)
(if (pred? value)
value
;; Recur: when (or if) the user gets a debugger prompt, he can
;; proceed where the call to ERROR was with the correct value.
(check-type pred?
(error "erroneous value"
(list pred? value)
`(while calling ,callee))
callee)))
;;; (CHECK-INDEX <vector> <index> <callee>) -> index
;;; Ensure that INDEX is a valid index into VECTOR; if not, signal an
;;; error stating that it is not and that this happened in a call to
;;; CALLEE. Return INDEX when it is valid. (Note that this does NOT
;;; check that VECTOR is indeed a vector.)
(define (check-index vec index callee)
(let ((index (check-type integer? index callee)))
(cond ((< index 0)
(check-index vec
(error "vector index too low"
index
`(into vector ,vec)
`(while calling ,callee))
callee))
((>= index (vector-length vec))
(check-index vec
(error "vector index too high"
index
`(into vector ,vec)
`(while calling ,callee))
callee))
(else index))))
;;; (CHECK-INDICES <vector>
;;; <start> <start-name>
;;; <end> <end-name>
;;; <caller>) -> [start end]
;;; Ensure that START and END are valid bounds of a range within
;;; VECTOR; if not, signal an error stating that they are not, with
;;; the message being informative about what the argument names were
;;; called -- by using START-NAME & END-NAME --, and that it occurred
;;; while calling CALLEE. Also ensure that VEC is in fact a vector.
;;; Returns no useful value.
(define (check-indices vec start start-name end end-name callee)
(let ((lose (lambda things
(apply error "vector range out of bounds"
(append things
`(vector was ,vec)
`(,start-name was ,start)
`(,end-name was ,end)
`(while calling ,callee)))))
(start (check-type integer? start callee))
(end (check-type integer? end callee)))
(cond ((> start end)
;; I'm not sure how well this will work. The intent is that
;; the programmer tells the debugger to proceed with both a
;; new START & a new END by returning multiple values
;; somewhere.
(receive (new-start new-end)
(lose `(,end-name < ,start-name))
(check-indices vec
new-start start-name
new-end end-name
callee)))
((< start 0)
(check-indices vec
(lose `(,start-name < 0))
start-name
end end-name
callee))
((>= start (vector-length vec))
(check-indices vec
(lose `(,start-name > len)
`(len was ,(vector-length vec)))
start-name
end end-name
callee))
((> end (vector-length vec))
(check-indices vec
start start-name
(lose `(,end-name > len)
`(len was ,(vector-length vec)))
end-name
callee))
(else
(values start end)))))
;;; --------------------
;;; Internal routines
;;; These should all be integrated, native, or otherwise optimized --
;;; they're used a _lot_ --. All of the loops and LETs inside loops
;;; are lambda-lifted by hand, just so as not to cons closures in the
;;; loops. (If your compiler can do better than that if they're not
;;; lambda-lifted, then lambda-drop (?) them.)
;;; (VECTOR-PARSE-START+END <vector> <arguments>
;;; <start-name> <end-name>
;;; <callee>)
;;; -> [start end]
;;; Return two values, composing a valid range within VECTOR, as
;;; extracted from ARGUMENTS or defaulted from VECTOR -- 0 for START
;;; and the length of VECTOR for END --; START-NAME and END-NAME are
;;; purely for error checking.
(define (vector-parse-start+end vec args start-name end-name callee)
(let ((len (vector-length vec)))
(cond ((null? args)
(values 0 len))
((null? (cdr args))
(check-indices vec
(car args) start-name
len end-name
callee))
((null? (cddr args))
(check-indices vec
(car args) start-name
(cadr args) end-name
callee))
(else
(error "too many arguments"
`(extra args were ,(cddr args))
`(while calling ,callee))))))
(define-syntax let-vector-start+end
(syntax-rules ()
((let-vector-start+end ?callee ?vec ?args (?start ?end)
?body1 ?body2 ...)
(let ((?vec (check-type vector? ?vec ?callee)))
(receive (?start ?end)
(vector-parse-start+end ?vec ?args '?start '?end
?callee)
?body1 ?body2 ...)))))
;;; (%SMALLEST-LENGTH <vector-list> <default-length> <callee>)
;;; -> exact, nonnegative integer
;;; Compute the smallest length of VECTOR-LIST. DEFAULT-LENGTH is
;;; the length that is returned if VECTOR-LIST is empty. Common use
;;; of this is in n-ary vector routines:
;;; (define (f vec . vectors)
;;; (let ((vec (check-type vector? vec f)))
;;; ...(%smallest-length vectors (vector-length vec) f)...))
;;; %SMALLEST-LENGTH takes care of the type checking -- which is what
;;; the CALLEE argument is for --; thus, the design is tuned for
;;; avoiding redundant type checks.
(define %smallest-length
(letrec ((loop (lambda (vector-list length callee)
(if (null? vector-list)
length
(loop (cdr vector-list)
(min (vector-length
(check-type vector?
(car vector-list)
callee))
length)
callee)))))
loop))
;;; (%VECTOR-COPY! <target> <tstart> <source> <sstart> <send>)
;;; Copy elements at locations SSTART to SEND from SOURCE to TARGET,
;;; starting at TSTART in TARGET.
;;;
;;; Optimize this! Probably with some combination of:
;;; - Force it to be integrated.
;;; - Let it use unsafe vector element dereferencing routines: bounds
;;; checking already happens outside of it. (Or use a compiler
;;; that figures this out, but Olin Shivers' PhD thesis seems to
;;; have been largely ignored in actual implementations...)
;;; - Implement it natively as a VM primitive: the VM can undoubtedly
;;; perform much faster than it can make Scheme perform, even with
;;; bounds checking.
;;; - Implement it in assembly: you _want_ the fine control that
;;; assembly can give you for this.
;;; I already lambda-lift it by hand, but you should be able to make it
;;; even better than that.
(define %vector-copy!
(letrec ((loop/l->r (lambda (target source send i j)
(cond ((< i send)
(vector-set! target j
(vector-ref source i))
(loop/l->r target source send
(+ i 1) (+ j 1))))))
(loop/r->l (lambda (target source sstart i j)
(cond ((>= i sstart)
(vector-set! target j
(vector-ref source i))
(loop/r->l target source sstart
(- i 1) (- j 1)))))))
(lambda (target tstart source sstart send)
(if (> sstart tstart) ; Make sure we don't copy over
; ourselves.
(loop/l->r target source send sstart tstart)
(loop/r->l target source sstart (- send 1)
(+ -1 tstart send (- sstart)))))))
;;; (%VECTOR-REVERSE-COPY! <target> <tstart> <source> <sstart> <send>)
;;; Copy elements from SSTART to SEND from SOURCE to TARGET, in the
;;; reverse order.
(define %vector-reverse-copy!
(letrec ((loop (lambda (target source sstart i j)
(cond ((>= i sstart)
(vector-set! target j (vector-ref source i))
(loop target source sstart
(- i 1)
(+ j 1)))))))
(lambda (target tstart source sstart send)
(loop target source sstart
(- send 1)
tstart))))
;;; (%VECTOR-REVERSE! <vector>)
(define %vector-reverse!
(letrec ((loop (lambda (vec i j)
(cond ((<= i j)
(let ((v (vector-ref vec i)))
(vector-set! vec i (vector-ref vec j))
(vector-set! vec j v)
(loop vec (+ i 1) (- j 1))))))))
(lambda (vec start end)
(loop vec start (- end 1)))))
;;; (%VECTOR-FOLD1 <kons> <knil> <vector>) -> knil'
;;; (KONS <index> <knil> <elt>) -> knil'
(define %vector-fold1
(letrec ((loop (lambda (kons knil len vec i)
(if (= i len)
knil
(loop kons
(kons i knil (vector-ref vec i))
len vec (+ i 1))))))
(lambda (kons knil len vec)
(loop kons knil len vec 0))))
;;; (%VECTOR-FOLD2+ <kons> <knil> <vector> ...) -> knil'
;;; (KONS <index> <knil> <elt> ...) -> knil'
(define %vector-fold2+
(letrec ((loop (lambda (kons knil len vectors i)
(if (= i len)
knil
(loop kons
(apply kons i knil
(vectors-ref vectors i))
len vectors (+ i 1))))))
(lambda (kons knil len vectors)
(loop kons knil len vectors 0))))
;;; (%VECTOR-MAP! <f> <target> <length> <vector>) -> target
;;; (F <index> <elt>) -> elt'
(define %vector-map1!
(letrec ((loop (lambda (f target vec i)
(if (zero? i)
target
(let ((j (- i 1)))
(vector-set! target j
(f j (vector-ref vec j)))
(loop f target vec j))))))
(lambda (f target vec len)
(loop f target vec len))))
;;; (%VECTOR-MAP2+! <f> <target> <vectors> <len>) -> target
;;; (F <index> <elt> ...) -> elt'
(define %vector-map2+!
(letrec ((loop (lambda (f target vectors i)
(if (zero? i)
target
(let ((j (- i 1)))
(vector-set! target j
(apply f j (vectors-ref vectors j)))
(loop f target vectors j))))))
(lambda (f target vectors len)
(loop f target vectors len))))
;;;;;;;;;;;;;;;;;;;;;;;; ***** vector-lib ***** ;;;;;;;;;;;;;;;;;;;;;;;
;;; --------------------
;;; Constructors
;;; (MAKE-VECTOR <size> [<fill>]) -> vector
;;; [R5RS] Create a vector of length LENGTH. If FILL is present,
;;; initialize each slot in the vector with it; if not, the vector's
;;; initial contents are unspecified.
;;; [Larceny] (define make-vector make-vector)
;;; (VECTOR <elt> ...) -> vector
;;; [R5RS] Create a vector containing ELEMENT ..., in order.
;;; [Larceny] (define vector vector)
;;; This ought to be able to be implemented much more efficiently -- if
;;; we have the number of arguments available to us, we can create the
;;; vector without using LENGTH to determine the number of elements it
;;; should have.
;(define (vector . elements) (list->vector elements))
;;; (VECTOR-UNFOLD <f> <length> <initial-seed> ...) -> vector
;;; (F <index> <seed> ...) -> [elt seed' ...]
;;; The fundamental vector constructor. Creates a vector whose
;;; length is LENGTH and iterates across each index K between 0 and
;;; LENGTH, applying F at each iteration to the current index and the
;;; current seeds to receive N+1 values: first, the element to put in
;;; the Kth slot and then N new seeds for the next iteration.
(define vector-unfold
(letrec ((tabulate! ; Special zero-seed case.
(lambda (f vec i len)
(cond ((< i len)
(vector-set! vec i (f i))
(tabulate! f vec (+ i 1) len)))))
(unfold1! ; Fast path for one seed.
(lambda (f vec i len seed)
(if (< i len)
(receive (elt new-seed)
(f i seed)
(vector-set! vec i elt)
(unfold1! f vec (+ i 1) len new-seed)))))
(unfold2+! ; Slower variant for N seeds.
(lambda (f vec i len seeds)
(if (< i len)
(receive (elt . new-seeds)
(apply f i seeds)
(vector-set! vec i elt)
(unfold2+! f vec (+ i 1) len new-seeds))))))
(lambda (f len . initial-seeds)
(let ((f (check-type procedure? f vector-unfold))
(len (check-type nonneg-int? len vector-unfold)))
(let ((vec (make-vector len)))
(cond ((null? initial-seeds)
(tabulate! f vec 0 len))
((null? (cdr initial-seeds))
(unfold1! f vec 0 len (car initial-seeds)))
(else
(unfold2+! f vec 0 len initial-seeds)))
vec)))))
;;; (VECTOR-UNFOLD-RIGHT <f> <length> <initial-seed> ...) -> vector
;;; (F <seed> ...) -> [seed' ...]
;;; Like VECTOR-UNFOLD, but it generates elements from LENGTH to 0
;;; (still exclusive with LENGTH and inclusive with 0), not 0 to
;;; LENGTH as with VECTOR-UNFOLD.
(define vector-unfold-right
(letrec ((tabulate!
(lambda (f vec i)
(cond ((>= i 0)
(vector-set! vec i (f i))
(tabulate! f vec (- i 1))))))
(unfold1!
(lambda (f vec i seed)
(if (>= i 0)
(receive (elt new-seed)
(f i seed)
(vector-set! vec i elt)
(unfold1! f vec (- i 1) new-seed)))))
(unfold2+!
(lambda (f vec i seeds)
(if (>= i 0)
(receive (elt . new-seeds)
(apply f i seeds)
(vector-set! vec i elt)
(unfold2+! f vec (- i 1) new-seeds))))))
(lambda (f len . initial-seeds)
(let ((f (check-type procedure? f vector-unfold-right))
(len (check-type nonneg-int? len vector-unfold-right)))
(let ((vec (make-vector len))
(i (- len 1)))
(cond ((null? initial-seeds)
(tabulate! f vec i))
((null? (cdr initial-seeds))
(unfold1! f vec i (car initial-seeds)))
(else
(unfold2+! f vec i initial-seeds)))
vec)))))
;;; (VECTOR-COPY <vector> [<start> <end> <fill>]) -> vector
;;; Create a newly allocated vector containing the elements from the
;;; range [START,END) in VECTOR. START defaults to 0; END defaults
;;; to the length of VECTOR. END may be greater than the length of
;;; VECTOR, in which case the vector is enlarged; if FILL is passed,
;;; the new locations from which there is no respective element in
;;; VECTOR are filled with FILL.
(define (vector-copy vec . args)
(let ((vec (check-type vector? vec vector-copy)))
;; We can't use LET-VECTOR-START+END, because we have one more
;; argument, and we want finer control, too.
;;
;; Olin's implementation of LET*-OPTIONALS would prove useful here:
;; the built-in argument-checks-as-you-go-along produces almost
;; _exactly_ the same code as VECTOR-COPY:PARSE-ARGS.
(receive (start end fill)
(vector-copy:parse-args vec args)
(let ((new-vector (make-vector (- end start) fill)))
(%vector-copy! new-vector 0
vec start
(if (> end (vector-length vec))
(vector-length vec)
end))
new-vector))))
;;; Auxiliary for VECTOR-COPY.
;;; [wdc] Corrected to allow 0 <= start <= (vector-length vec).
(define (vector-copy:parse-args vec args)
(define (parse-args start end n fill)
(let ((start (check-type nonneg-int? start vector-copy))
(end (check-type nonneg-int? end vector-copy)))
(cond ((and (<= 0 start end)
(<= start n))
(values start end fill))
(else
(error "illegal arguments"
`(while calling ,vector-copy)
`(start was ,start)
`(end was ,end)
`(vector was ,vec))))))
(let ((n (vector-length vec)))
(cond ((null? args)
(parse-args 0 n n (unspecified-value)))
((null? (cdr args))
(parse-args (car args) n n (unspecified-value)))
((null? (cddr args))
(parse-args (car args) (cadr args) n (unspecified-value)))
((null? (cdddr args))
(parse-args (car args) (cadr args) n (caddr args)))
(else
(error "too many arguments"
vector-copy
(cdddr args))))))
;;; (VECTOR-REVERSE-COPY <vector> [<start> <end>]) -> vector
;;; Create a newly allocated vector whose elements are the reversed
;;; sequence of elements between START and END in VECTOR. START's
;;; default is 0; END's default is the length of VECTOR.
(define (vector-reverse-copy vec . maybe-start+end)
(let-vector-start+end vector-reverse-copy vec maybe-start+end
(start end)
(let ((new (make-vector (- end start))))
(%vector-reverse-copy! new 0 vec start end)
new)))
;;; (VECTOR-APPEND <vector> ...) -> vector
;;; Append VECTOR ... into a newly allocated vector and return that
;;; new vector.
(define (vector-append . vectors)
(vector-concatenate:aux vectors vector-append))
;;; (VECTOR-CONCATENATE <vector-list>) -> vector
;;; Concatenate the vectors in VECTOR-LIST. This is equivalent to
;;; (apply vector-append VECTOR-LIST)
;;; but VECTOR-APPEND tends to be implemented in terms of
;;; VECTOR-CONCATENATE, and some Schemes bork when the list to apply
;;; a function to is too long.
;;;
;;; Actually, they're both implemented in terms of an internal routine.
(define (vector-concatenate vector-list)
(vector-concatenate:aux vector-list vector-concatenate))
;;; Auxiliary for VECTOR-APPEND and VECTOR-CONCATENATE
(define vector-concatenate:aux
(letrec ((compute-length
(lambda (vectors len callee)
(if (null? vectors)
len
(let ((vec (check-type vector? (car vectors)
callee)))
(compute-length (cdr vectors)
(+ (vector-length vec) len)
callee)))))
(concatenate!
(lambda (vectors target to)
(if (null? vectors)
target
(let* ((vec1 (car vectors))
(len (vector-length vec1)))
(%vector-copy! target to vec1 0 len)
(concatenate! (cdr vectors) target
(+ to len)))))))
(lambda (vectors callee)
(cond ((null? vectors) ;+++
(make-vector 0))
((null? (cdr vectors)) ;+++
;; Blech, we still have to allocate a new one.
(let* ((vec (check-type vector? (car vectors) callee))
(len (vector-length vec))
(new (make-vector len)))
(%vector-copy! new 0 vec 0 len)
new))
(else
(let ((new-vector
(make-vector (compute-length vectors 0 callee))))
(concatenate! vectors new-vector 0)
new-vector))))))
;;; --------------------
;;; Predicates
;;; (VECTOR? <value>) -> boolean
;;; [R5RS] Return #T if VALUE is a vector and #F if not.
;;; [Larceny] (define vector? vector?)
;;; (VECTOR-EMPTY? <vector>) -> boolean
;;; Return #T if VECTOR has zero elements in it, i.e. VECTOR's length
;;; is 0, and #F if not.
(define (vector-empty? vec)
(let ((vec (check-type vector? vec vector-empty?)))
(zero? (vector-length vec))))
;;; (VECTOR= <elt=?> <vector> ...) -> boolean
;;; (ELT=? <value> <value>) -> boolean
;;; Determine vector equality generalized across element comparators.
;;; Vectors A and B are equal iff their lengths are the same and for
;;; each respective elements E_a and E_b (element=? E_a E_b) returns
;;; a true value. ELT=? is always applied to two arguments. Element
;;; comparison must be consistent wtih EQ?; that is, if (eq? E_a E_b)
;;; results in a true value, then (ELEMENT=? E_a E_b) must result in a
;;; true value. This may be exploited to avoid multiple unnecessary
;;; element comparisons. (This implementation does, but does not deal
;;; with the situation that ELEMENT=? is EQ? to avoid more unnecessary
;;; comparisons, but I believe this optimization is probably fairly
;;; insignificant.)
;;;
;;; If the number of vector arguments is zero or one, then #T is
;;; automatically returned. If there are N vector arguments,
;;; VECTOR_1 VECTOR_2 ... VECTOR_N, then VECTOR_1 & VECTOR_2 are
;;; compared; if they are equal, the vectors VECTOR_2 ... VECTOR_N
;;; are compared. The precise order in which ELT=? is applied is not
;;; specified.
(define (vector= elt=? . vectors)
(let ((elt=? (check-type procedure? elt=? vector=)))
(cond ((null? vectors)
#t)
((null? (cdr vectors))
(check-type vector? (car vectors) vector=)
#t)
(else
(let loop ((vecs vectors))
(let ((vec1 (check-type vector? (car vecs) vector=))
(vec2+ (cdr vecs)))
(or (null? vec2+)
(and (binary-vector= elt=? vec1 (car vec2+))
(loop vec2+)))))))))
(define (binary-vector= elt=? vector-a vector-b)
(or (eq? vector-a vector-b) ;+++
(let ((length-a (vector-length vector-a))
(length-b (vector-length vector-b)))
(letrec ((loop (lambda (i)
(or (= i length-a)
(and (< i length-b)
(test (vector-ref vector-a i)
(vector-ref vector-b i)
i)))))
(test (lambda (elt-a elt-b i)
(and (or (eq? elt-a elt-b) ;+++
(elt=? elt-a elt-b))
(loop (+ i 1))))))
(and (= length-a length-b)
(loop 0))))))
;;; --------------------
;;; Selectors
;;; (VECTOR-REF <vector> <index>) -> value
;;; [R5RS] Return the value that the location in VECTOR at INDEX is
;;; mapped to in the store.
;;; [Larceny] (define vector-ref vector-ref)
;;; (VECTOR-LENGTH <vector>) -> exact, nonnegative integer
;;; [R5RS] Return the length of VECTOR.
;;; [Larceny] (define vector-length vector-length)
;;; --------------------
;;; Iteration
;;; (VECTOR-FOLD <kons> <initial-knil> <vector> ...) -> knil
;;; (KONS <knil> <elt> ...) -> knil' ; N vectors -> N+1 args
;;; The fundamental vector iterator. KONS is iterated over each
;;; index in all of the vectors in parallel, stopping at the end of
;;; the shortest; KONS is applied to an argument list of (list I
;;; STATE (vector-ref VEC I) ...), where STATE is the current state
;;; value -- the state value begins with KNIL and becomes whatever
;;; KONS returned at the respective iteration --, and I is the
;;; current index in the iteration. The iteration is strictly left-
;;; to-right.
;;; (vector-fold KONS KNIL (vector E_1 E_2 ... E_N))
;;; <=>
;;; (KONS (... (KONS (KONS KNIL E_1) E_2) ... E_N-1) E_N)
(define (vector-fold kons knil vec . vectors)
(let ((kons (check-type procedure? kons vector-fold))
(vec (check-type vector? vec vector-fold)))
(if (null? vectors)
(%vector-fold1 kons knil (vector-length vec) vec)
(%vector-fold2+ kons knil
(%smallest-length vectors
(vector-length vec)
vector-fold)
(cons vec vectors)))))
;;; (VECTOR-FOLD-RIGHT <kons> <initial-knil> <vector> ...) -> knil
;;; (KONS <knil> <elt> ...) -> knil' ; N vectors => N+1 args
;;; The fundamental vector recursor. Iterates in parallel across
;;; VECTOR ... right to left, applying KONS to the elements and the
;;; current state value; the state value becomes what KONS returns
;;; at each next iteration. KNIL is the initial state value.
;;; (vector-fold-right KONS KNIL (vector E_1 E_2 ... E_N))
;;; <=>
;;; (KONS (... (KONS (KONS KNIL E_N) E_N-1) ... E_2) E_1)
;;;
;;; Not implemented in terms of a more primitive operations that might
;;; called %VECTOR-FOLD-RIGHT due to the fact that it wouldn't be very
;;; useful elsewhere.
(define vector-fold-right
(letrec ((loop1 (lambda (kons knil vec i)
(if (negative? i)
knil
(loop1 kons (kons i knil (vector-ref vec i))
vec
(- i 1)))))
(loop2+ (lambda (kons knil vectors i)
(if (negative? i)
knil
(loop2+ kons
(apply kons i knil
(vectors-ref vectors i))
vectors
(- i 1))))))
(lambda (kons knil vec . vectors)
(let ((kons (check-type procedure? kons vector-fold-right))
(vec (check-type vector? vec vector-fold-right)))
(if (null? vectors)
(loop1 kons knil vec (- (vector-length vec) 1))
(loop2+ kons knil (cons vec vectors)
(- (%smallest-length vectors
(vector-length vec)
vector-fold-right)
1)))))))
;;; (VECTOR-MAP <f> <vector> ...) -> vector
;;; (F <elt> ...) -> value ; N vectors -> N args
;;; Constructs a new vector of the shortest length of the vector
;;; arguments. Each element at index I of the new vector is mapped
;;; from the old vectors by (F I (vector-ref VECTOR I) ...). The
;;; dynamic order of application of F is unspecified.
(define (vector-map f vec . vectors)
(let ((f (check-type procedure? f vector-map))
(vec (check-type vector? vec vector-map)))
(if (null? vectors)
(let ((len (vector-length vec)))
(%vector-map1! f (make-vector len) vec len))
(let ((len (%smallest-length vectors
(vector-length vec)
vector-map)))
(%vector-map2+! f (make-vector len) (cons vec vectors)
len)))))
;;; (VECTOR-MAP! <f> <vector> ...) -> unspecified
;;; (F <elt> ...) -> element' ; N vectors -> N args
;;; Similar to VECTOR-MAP, but rather than mapping the new elements
;;; into a new vector, the new mapped elements are destructively
;;; inserted into the first vector. Again, the dynamic order of
;;; application of F is unspecified, so it is dangerous for F to
;;; manipulate the first VECTOR.
(define (vector-map! f vec . vectors)
(let ((f (check-type procedure? f vector-map!))
(vec (check-type vector? vec vector-map!)))
(if (null? vectors)
(%vector-map1! f vec vec (vector-length vec))
(%vector-map2+! f vec (cons vec vectors)
(%smallest-length vectors
(vector-length vec)
vector-map!)))
(unspecified-value)))
;;; (VECTOR-FOR-EACH <f> <vector> ...) -> unspecified
;;; (F <elt> ...) ; N vectors -> N args
;;; Simple vector iterator: applies F to each index in the range [0,
;;; LENGTH), where LENGTH is the length of the smallest vector
;;; argument passed, and the respective element at that index. In
;;; contrast with VECTOR-MAP, F is reliably applied to each
;;; subsequent elements, starting at index 0 from left to right, in
;;; the vectors.
(define vector-for-each
(letrec ((for-each1
(lambda (f vec i len)
(cond ((< i len)
(f i (vector-ref vec i))
(for-each1 f vec (+ i 1) len)))))
(for-each2+
(lambda (f vecs i len)
(cond ((< i len)
(apply f i (vectors-ref vecs i))
(for-each2+ f vecs (+ i 1) len))))))
(lambda (f vec . vectors)
(let ((f (check-type procedure? f vector-for-each))
(vec (check-type vector? vec vector-for-each)))
(if (null? vectors)
(for-each1 f vec 0 (vector-length vec))
(for-each2+ f (cons vec vectors) 0
(%smallest-length vectors
(vector-length vec)
vector-for-each)))))))
;;; (VECTOR-COUNT <predicate?> <vector> ...)
;;; -> exact, nonnegative integer
;;; (PREDICATE? <index> <value> ...) ; N vectors -> N+1 args
;;; PREDICATE? is applied element-wise to the elements of VECTOR ...,
;;; and a count is tallied of the number of elements for which a
;;; true value is produced by PREDICATE?. This count is returned.
(define (vector-count pred? vec . vectors)
(let ((pred? (check-type procedure? pred? vector-count))
(vec (check-type vector? vec vector-count)))
(if (null? vectors)
(%vector-fold1 (lambda (index count elt)
(if (pred? index elt)
(+ count 1)
count))
0
(vector-length vec)
vec)
(%vector-fold2+ (lambda (index count . elts)
(if (apply pred? index elts)
(+ count 1)
count))
0
(%smallest-length vectors
(vector-length vec)
vector-count)
(cons vec vectors)))))
;;; --------------------
;;; Searching
;;; (VECTOR-INDEX <predicate?> <vector> ...)
;;; -> exact, nonnegative integer or #F
;;; (PREDICATE? <elt> ...) -> boolean ; N vectors -> N args
;;; Search left-to-right across VECTOR ... in parallel, returning the
;;; index of the first set of values VALUE ... such that (PREDICATE?
;;; VALUE ...) returns a true value; if no such set of elements is
;;; reached, return #F.
(define (vector-index pred? vec . vectors)
(vector-index/skip pred? vec vectors vector-index))
;;; (VECTOR-SKIP <predicate?> <vector> ...)
;;; -> exact, nonnegative integer or #F
;;; (PREDICATE? <elt> ...) -> boolean ; N vectors -> N args
;;; (vector-index (lambda elts (not (apply PREDICATE? elts)))
;;; VECTOR ...)
;;; Like VECTOR-INDEX, but find the index of the first set of values
;;; that do _not_ satisfy PREDICATE?.
(define (vector-skip pred? vec . vectors)
(vector-index/skip (lambda elts (not (apply pred? elts)))
vec vectors
vector-skip))
;;; Auxiliary for VECTOR-INDEX & VECTOR-SKIP
(define vector-index/skip
(letrec ((loop1 (lambda (pred? vec len i)
(cond ((= i len) #f)
((pred? (vector-ref vec i)) i)
(else (loop1 pred? vec len (+ i 1))))))
(loop2+ (lambda (pred? vectors len i)
(cond ((= i len) #f)
((apply pred? (vectors-ref vectors i)) i)
(else (loop2+ pred? vectors len
(+ i 1)))))))
(lambda (pred? vec vectors callee)
(let ((pred? (check-type procedure? pred? callee))
(vec (check-type vector? vec callee)))
(if (null? vectors)
(loop1 pred? vec (vector-length vec) 0)
(loop2+ pred? (cons vec vectors)
(%smallest-length vectors
(vector-length vec)
callee)
0))))))
;;; (VECTOR-INDEX-RIGHT <predicate?> <vector> ...)
;;; -> exact, nonnegative integer or #F
;;; (PREDICATE? <elt> ...) -> boolean ; N vectors -> N args
;;; Right-to-left variant of VECTOR-INDEX.
(define (vector-index-right pred? vec . vectors)
(vector-index/skip-right pred? vec vectors vector-index-right))
;;; (VECTOR-SKIP-RIGHT <predicate?> <vector> ...)
;;; -> exact, nonnegative integer or #F
;;; (PREDICATE? <elt> ...) -> boolean ; N vectors -> N args
;;; Right-to-left variant of VECTOR-SKIP.
(define (vector-skip-right pred? vec . vectors)
(vector-index/skip-right (lambda elts (not (apply pred? elts)))
vec vectors
vector-index-right))
(define vector-index/skip-right
(letrec ((loop1 (lambda (pred? vec i)
(cond ((negative? i) #f)
((pred? (vector-ref vec i)) i)
(else (loop1 pred? vec (- i 1))))))
(loop2+ (lambda (pred? vectors i)
(cond ((negative? i) #f)
((apply pred? (vectors-ref vectors i)) i)
(else (loop2+ pred? vectors (- i 1)))))))
(lambda (pred? vec vectors callee)
(let ((pred? (check-type procedure? pred? callee))
(vec (check-type vector? vec callee)))
(if (null? vectors)
(loop1 pred? vec (- (vector-length vec) 1))
(loop2+ pred? (cons vec vectors)
(- (%smallest-length vectors
(vector-length vec)
callee)
1)))))))
;;; (VECTOR-BINARY-SEARCH <vector> <value> <cmp> [<start> <end>])
;;; -> exact, nonnegative integer or #F
;;; (CMP <value1> <value2>) -> integer
;;; positive -> VALUE1 > VALUE2
;;; zero -> VALUE1 = VALUE2
;;; negative -> VALUE1 < VALUE2
;;; Perform a binary search through VECTOR for VALUE, comparing each
;;; element to VALUE with CMP.
(define (vector-binary-search vec value cmp . maybe-start+end)
(let ((cmp (check-type procedure? cmp vector-binary-search)))
(let-vector-start+end vector-binary-search vec maybe-start+end
(start end)
(let loop ((start start) (end end) (j #f))
(let ((i (quotient (+ start end) 2)))
(if (or (= start end) (and j (= i j)))
#f
(let ((comparison
(check-type integer?
(cmp (vector-ref vec i) value)
`(,cmp for ,vector-binary-search))))
(cond ((zero? comparison) i)
((positive? comparison) (loop start i i))
(else (loop i end i))))))))))
;;; (VECTOR-ANY <pred?> <vector> ...) -> value
;;; Apply PRED? to each parallel element in each VECTOR ...; if PRED?
;;; should ever return a true value, immediately stop and return that
;;; value; otherwise, when the shortest vector runs out, return #F.
;;; The iteration and order of application of PRED? across elements
;;; is of the vectors is strictly left-to-right.
(define vector-any
(letrec ((loop1 (lambda (pred? vec i len len-1)
(and (not (= i len))
(if (= i len-1)
(pred? (vector-ref vec i))
(or (pred? (vector-ref vec i))
(loop1 pred? vec (+ i 1)
len len-1))))))
(loop2+ (lambda (pred? vectors i len len-1)
(and (not (= i len))
(if (= i len-1)
(apply pred? (vectors-ref vectors i))
(or (apply pred? (vectors-ref vectors i))
(loop2+ pred? vectors (+ i 1)
len len-1)))))))
(lambda (pred? vec . vectors)
(let ((pred? (check-type procedure? pred? vector-any))
(vec (check-type vector? vec vector-any)))
(if (null? vectors)
(let ((len (vector-length vec)))
(loop1 pred? vec 0 len (- len 1)))
(let ((len (%smallest-length vectors
(vector-length vec)
vector-any)))
(loop2+ pred? (cons vec vectors) 0 len (- len 1))))))))
;;; (VECTOR-EVERY <pred?> <vector> ...) -> value
;;; Apply PRED? to each parallel value in each VECTOR ...; if PRED?
;;; should ever return #F, immediately stop and return #F; otherwise,
;;; if PRED? should return a true value for each element, stopping at
;;; the end of the shortest vector, return the last value that PRED?
;;; returned. In the case that there is an empty vector, return #T.
;;; The iteration and order of application of PRED? across elements
;;; is of the vectors is strictly left-to-right.
(define vector-every
(letrec ((loop1 (lambda (pred? vec i len len-1)
(or (= i len)
(if (= i len-1)
(pred? (vector-ref vec i))
(and (pred? (vector-ref vec i))
(loop1 pred? vec (+ i 1)
len len-1))))))
(loop2+ (lambda (pred? vectors i len len-1)
(or (= i len)
(if (= i len-1)
(apply pred? (vectors-ref vectors i))
(and (apply pred? (vectors-ref vectors i))
(loop2+ pred? vectors (+ i 1)
len len-1)))))))
(lambda (pred? vec . vectors)
(let ((pred? (check-type procedure? pred? vector-every))
(vec (check-type vector? vec vector-every)))
(if (null? vectors)
(let ((len (vector-length vec)))
(loop1 pred? vec 0 len (- len 1)))
(let ((len (%smallest-length vectors
(vector-length vec)
vector-every)))
(loop2+ pred? (cons vec vectors) 0 len (- len 1))))))))
;;; --------------------
;;; Mutators
;;; (VECTOR-SET! <vector> <index> <value>) -> unspecified
;;; [R5RS] Assign the location at INDEX in VECTOR to VALUE.
;;; [Larceny] (define vector-set! vector-set!)
;;; (VECTOR-SWAP! <vector> <index1> <index2>) -> unspecified
;;; Swap the values in the locations at INDEX1 and INDEX2.
(define (vector-swap! vec i j)
(let ((vec (check-type vector? vec vector-swap!)))
(let ((i (check-index vec i vector-swap!))
(j (check-index vec j vector-swap!)))
(let ((x (vector-ref vec i)))
(vector-set! vec i (vector-ref vec j))
(vector-set! vec j x)))))
;;; (VECTOR-FILL! <vector> <value> [<start> <end>]) -> unspecified
;;; [R5RS+] Fill the locations in VECTOR between START, whose default
;;; is 0, and END, whose default is the length of VECTOR, with VALUE.
;;;
;;; This one can probably be made really fast natively.
(define vector-fill!
(let ((%vector-fill! vector-fill!)) ; Take the native one, under
; the assumption that it's
; faster, so we can use it if
; there are no optional
; arguments.
(lambda (vec value . maybe-start+end)
(if (null? maybe-start+end)
(%vector-fill! vec value) ;+++
(let-vector-start+end vector-fill! vec maybe-start+end
(start end)
(do ((i start (+ i 1)))
((= i end))
(vector-set! vec i value)))))))
;;; (VECTOR-COPY! <target> <tstart> <source> [<sstart> <send>])
;;; -> unspecified
;;; Copy the values in the locations in [SSTART,SEND) from SOURCE to
;;; to TARGET, starting at TSTART in TARGET.
;;; [wdc] Corrected to allow 0 <= sstart <= send <= (vector-length source).
(define (vector-copy! target tstart source . maybe-sstart+send)
(define (doit! sstart send source-length)
(let ((tstart (check-type nonneg-int? tstart vector-copy!))
(sstart (check-type nonneg-int? sstart vector-copy!))
(send (check-type nonneg-int? send vector-copy!)))
(cond ((and (<= 0 sstart send source-length)
(<= (+ tstart (- send sstart)) (vector-length target)))
(%vector-copy! target tstart source sstart send))
(else
(error "illegal arguments"
`(while calling ,vector-copy!)
`(target was ,target)
`(target-length was ,(vector-length target))
`(tstart was ,tstart)
`(source was ,source)
`(source-length was ,source-length)
`(sstart was ,sstart)
`(send was ,send))))))
(let ((n (vector-length source)))
(cond ((null? maybe-sstart+send)
(doit! 0 n n))
((null? (cdr maybe-sstart+send))
(doit! (car maybe-sstart+send) n n))
((null? (cddr maybe-sstart+send))
(doit! (car maybe-sstart+send) (cadr maybe-sstart+send) n))
(else
(error "too many arguments"
vector-copy!
(cddr maybe-sstart+send))))))
;;; (VECTOR-REVERSE-COPY! <target> <tstart> <source> [<sstart> <send>])
;;; [wdc] Corrected to allow 0 <= sstart <= send <= (vector-length source).
(define (vector-reverse-copy! target tstart source . maybe-sstart+send)
(define (doit! sstart send source-length)
(let ((tstart (check-type nonneg-int? tstart vector-reverse-copy!))
(sstart (check-type nonneg-int? sstart vector-reverse-copy!))
(send (check-type nonneg-int? send vector-reverse-copy!)))
(cond ((and (eq? target source)
(or (between? sstart tstart send)
(between? tstart sstart
(+ tstart (- send sstart)))))
(error "vector range for self-copying overlaps"
vector-reverse-copy!
`(vector was ,target)
`(tstart was ,tstart)
`(sstart was ,sstart)
`(send was ,send)))
((and (<= 0 sstart send source-length)
(<= (+ tstart (- send sstart)) (vector-length target)))
(%vector-reverse-copy! target tstart source sstart send))
(else
(error "illegal arguments"
`(while calling ,vector-reverse-copy!)
`(target was ,target)
`(target-length was ,(vector-length target))
`(tstart was ,tstart)
`(source was ,source)
`(source-length was ,source-length)
`(sstart was ,sstart)
`(send was ,send))))))
(let ((n (vector-length source)))
(cond ((null? maybe-sstart+send)
(doit! 0 n n))
((null? (cdr maybe-sstart+send))
(doit! (car maybe-sstart+send) n n))
((null? (cddr maybe-sstart+send))
(doit! (car maybe-sstart+send) (cadr maybe-sstart+send) n))
(else
(error "too many arguments"
vector-reverse-copy!
(cddr maybe-sstart+send))))))
;;; (VECTOR-REVERSE! <vector> [<start> <end>]) -> unspecified
;;; Destructively reverse the contents of the sequence of locations
;;; in VECTOR between START, whose default is 0, and END, whose
;;; default is the length of VECTOR.
(define (vector-reverse! vec . start+end)
(let-vector-start+end vector-reverse! vec start+end
(start end)
(%vector-reverse! vec start end)))
;;; --------------------
;;; Conversion
;;; (VECTOR->LIST <vector> [<start> <end>]) -> list
;;; [R5RS+] Produce a list containing the elements in the locations
;;; between START, whose default is 0, and END, whose default is the
;;; length of VECTOR, from VECTOR.
(define vector->list
(let ((%vector->list vector->list))
(lambda (vec . maybe-start+end)
(if (null? maybe-start+end) ; Oughta use CASE-LAMBDA.
(%vector->list vec) ;+++
(let-vector-start+end vector->list vec maybe-start+end
(start end)
;(unfold (lambda (i) ; No SRFI 1.
; (< i start))
; (lambda (i) (vector-ref vec i))
; (lambda (i) (- i 1))
; (- end 1))
(do ((i (- end 1) (- i 1))
(result '() (cons (vector-ref vec i) result)))
((< i start) result)))))))
;;; (REVERSE-VECTOR->LIST <vector> [<start> <end>]) -> list
;;; Produce a list containing the elements in the locations between
;;; START, whose default is 0, and END, whose default is the length
;;; of VECTOR, from VECTOR, in reverse order.
(define (reverse-vector->list vec . maybe-start+end)
(let-vector-start+end reverse-vector->list vec maybe-start+end
(start end)
;(unfold (lambda (i) (= i end)) ; No SRFI 1.
; (lambda (i) (vector-ref vec i))
; (lambda (i) (+ i 1))
; start)
(do ((i start (+ i 1))
(result '() (cons (vector-ref vec i) result)))
((= i end) result))))
;;; (LIST->VECTOR <list> [<start> <end>]) -> vector
;;; [R5RS+] Produce a vector containing the elements in LIST, which
;;; must be a proper list, between START, whose default is 0, & END,
;;; whose default is the length of LIST. It is suggested that if the
;;; length of LIST is known in advance, the START and END arguments
;;; be passed, so that LIST->VECTOR need not call LENGTH to determine
;;; the the length.
;;;
;;; This implementation diverges on circular lists, unless LENGTH fails
;;; and causes - to fail as well. Given a LENGTH* that computes the
;;; length of a list's cycle, this wouldn't diverge, and would work
;;; great for circular lists.
(define list->vector
(let ((%list->vector list->vector))
(lambda (lst . maybe-start+end)
;; Checking the type of a proper list is expensive, so we do it
;; amortizedly, or let %LIST->VECTOR or LIST-TAIL do it.
(if (null? maybe-start+end) ; Oughta use CASE-LAMBDA.
(%list->vector lst) ;+++
;; We can't use LET-VECTOR-START+END, because we're using the
;; bounds of a _list_, not a vector.
(let*-optionals maybe-start+end
((start 0)
(end (length lst))) ; Ugh -- LENGTH
(let ((start (check-type nonneg-int? start list->vector))
(end (check-type nonneg-int? end list->vector)))
((lambda (f)
(vector-unfold f (- end start) (list-tail lst start)))
(lambda (index l)
(cond ((null? l)
(error "list was too short"
`(list was ,lst)
`(attempted end was ,end)
`(while calling ,list->vector)))
((pair? l)
(values (car l) (cdr l)))
(else
;; Make this look as much like what CHECK-TYPE
;; would report as possible.
(error "erroneous value"
;; We want SRFI 1's PROPER-LIST?, but it
;; would be a waste to link all of SRFI
;; 1 to this module for only the single
;; function PROPER-LIST?.
(list list? lst)
`(while calling
,list->vector))))))))))))
;;; (REVERSE-LIST->VECTOR <list> [<start> <end>]) -> vector
;;; Produce a vector containing the elements in LIST, which must be a
;;; proper list, between START, whose default is 0, and END, whose
;;; default is the length of LIST, in reverse order. It is suggested
;;; that if the length of LIST is known in advance, the START and END
;;; arguments be passed, so that REVERSE-LIST->VECTOR need not call
;;; LENGTH to determine the the length.
;;;
;;; This also diverges on circular lists unless, again, LENGTH returns
;;; something that makes - bork.
(define (reverse-list->vector lst . maybe-start+end)
(let*-optionals maybe-start+end
((start 0)
(end (length lst))) ; Ugh -- LENGTH
(let ((start (check-type nonneg-int? start reverse-list->vector))
(end (check-type nonneg-int? end reverse-list->vector)))
((lambda (f)
(vector-unfold-right f (- end start) (list-tail lst start)))
(lambda (index l)
(cond ((null? l)
(error "list too short"
`(list was ,lst)
`(attempted end was ,end)
`(while calling ,reverse-list->vector)))
((pair? l)
(values (car l) (cdr l)))
(else
(error "erroneous value"
(list list? lst)
`(while calling ,reverse-list->vector)))))))))
| {
"pile_set_name": "Github"
} |
<<entering SECCOMP mode>>
Hello, world
| {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Catalog\Model\ProductLink\Data;
/**
* Criteria for finding lists.
*/
interface ListCriteriaInterface
{
/**
* Links belong to this product.
*
* @return string
*/
public function getBelongsToProductSku(): string;
/**
* Limit links by type (in).
*
* @return string[]|null
*/
public function getLinkTypes(): ?array;
}
| {
"pile_set_name": "Github"
} |
module.exports = function ({ addUtilities }) {
addUtilities({
'@keyframes spin': {
'from': { 'transform': 'rotate(0deg)' },
'to': { 'transform': 'rotate(360deg)' },
}
})
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>ScanResultListener (LibBlinkID API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ScanResultListener (LibBlinkID API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/microblink/view/recognition/RecognizerRunnerView.html" title="class in com.microblink.view.recognition"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/microblink/view/recognition/ScanResultListener.html" target="_top">Frames</a></li>
<li><a href="ScanResultListener.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.microblink.view.recognition</div>
<h2 title="Interface ScanResultListener" class="title">Interface ScanResultListener</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../../../com/microblink/view/recognition/ParcelableScanResultListener.html" title="interface in com.microblink.view.recognition">ParcelableScanResultListener</a>, <a href="../../../../com/microblink/fragment/overlay/ScanningOverlay.html" title="interface in com.microblink.fragment.overlay">ScanningOverlay</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../com/microblink/fragment/overlay/BaseOverlayController.html" title="class in com.microblink.fragment.overlay">BaseOverlayController</a>, <a href="../../../../com/microblink/fragment/overlay/blinkid/BlinkIdOverlayController.html" title="class in com.microblink.fragment.overlay.blinkid">BlinkIdOverlayController</a>, <a href="../../../../com/microblink/fragment/RecognizerRunnerFragment.html" title="class in com.microblink.fragment">RecognizerRunnerFragment</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">ScanResultListener</span></pre>
<div class="block">Listener that will be notified when recognition is done.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/microblink/view/recognition/ScanResultListener.html#onScanningDone-RecognitionSuccessType-">onScanningDone</a></span>(RecognitionSuccessType recognitionSuccessType)</code>
<div class="block">This method is called when recognition is done.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="onScanningDone-RecognitionSuccessType-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>onScanningDone</h4>
<pre>@WorkerThread
void onScanningDone(@NonNull
RecognitionSuccessType recognitionSuccessType)</pre>
<div class="block">This method is called when recognition is done.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>recognitionSuccessType</code> - indicates the success type of recognition</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/microblink/view/recognition/RecognizerRunnerView.html" title="class in com.microblink.view.recognition"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/microblink/view/recognition/ScanResultListener.html" target="_top">Frames</a></li>
<li><a href="ScanResultListener.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
package org.alloytools.util.table;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class TableTest {
@Test
public void testUnfilledTable() {
Table t = new Table(1, 1, 0);
assertEquals("" + "┌─┐\n" + "│ │\n" + "└─┘\n" + "", t.toString());
}
@Test
public void testEmptyTable() {
Table t = new Table(0, 0, 0);
assertEquals("" + "☒" + "", t.toString());
}
@Test
public void testSimpleTable() {
Table t = new Table(2, 2, 0);
t.set(0, 0, "0x0");
t.set(0, 1, "0x1");
t.set(1, 0, "1x0");
t.set(1, 1, "1x1");
assertEquals("" + "┌───┬───┐\n" + "│0x0│0x1│\n" + "├───┼───┤\n" + "│1x0│1x1│\n" + "└───┴───┘\n" + "", t.toString());
}
@Test
public void testTableWithUnequalColumns() {
Table t = new Table(2, 2, 0);
t.set(0, 0, "0x0xxxx");
t.set(0, 1, "0x1");
t.set(1, 0, "1x0");
t.set(1, 1, "1x1yyyyyyyyyyyyyyyyyyy");
assertEquals("" + "┌───────┬──────────────────────┐\n" + "│0x0xxxx│0x1 │\n" + "├───────┼──────────────────────┤\n" + "│1x0 │1x1yyyyyyyyyyyyyyyyyyy│\n" + "└───────┴──────────────────────┘\n" + "", t.toString());
}
@Test
public void testTableWithUnequalRows() {
Table t = new Table(2, 2, 0);
t.set(0, 0, "0x0\n0x0");
t.set(0, 1, "0x1");
t.set(1, 0, "1x0");
t.set(1, 1, "1x1");
assertEquals("" + "┌───┬───┐\n" + "│0x0│0x1│\n" + "│0x0│ │\n" + "├───┼───┤\n" + "│1x0│1x1│\n" + "└───┴───┘\n" + "", t.toString());
}
@Test
public void testNestedTable() {
Table t1 = new Table(2, 2, 0);
t1.set(0, 0, "0x0/1");
t1.set(0, 1, "0x1/1");
t1.set(1, 1, "1x1/1");
Table t2 = new Table(2, 2, 0);
t2.set(0, 1, "0x1/2");
t2.set(1, 0, "1x0/2");
t2.set(1, 1, "1x1/2");
Table t3 = new Table(2, 2, 0);
t3.set(0, 0, "0x0/3");
t3.set(0, 1, "0x1/3");
t3.set(1, 0, "1x0/3");
t3.set(1, 1, "1x1/3");
t1.set(1, 0, t2);
t2.set(0, 0, t3);
assertEquals("" + "┌─────────────────┬─────┐\n" + "│0x0/1 │0x1/1│\n" + "├─────┬─────┬─────┼─────┤\n" + "│0x0/3│0x1/3│0x1/2│1x1/1│\n" + "├─────┼─────┤ │ │\n" + "│1x0/3│1x1/3│ │ │\n" + "├─────┴─────┼─────┤ │\n" + "│1x0/2 │1x1/2│ │\n" + "└───────────┴─────┴─────┘\n" + "", t1.toString());
}
@Test
public void testNestedTableWithTopBold() {
Table t1 = new Table(2, 2, 0);
t1.setBold();
t1.set(0, 0, "0x0/1");
t1.set(0, 1, "0x1/1");
t1.set(1, 1, "1x1/1");
Table t2 = new Table(2, 2, 0);
t2.set(0, 1, "0x1/2");
t2.set(1, 0, "1x0/2");
t2.set(1, 1, "1x1/2");
Table t3 = new Table(2, 2, 0);
t3.set(0, 0, "0x0/3");
t3.set(0, 1, "0x1/3");
t3.set(1, 0, "1x0/3");
t3.set(1, 1, "1x1/3");
t1.set(1, 0, t2);
t2.set(0, 0, t3);
assertEquals("" + "┏━━━━━━━━━━━━━━━━━┯━━━━━┓\n" + "┃0x0/1 │0x1/1┃\n" + "┠─────┬─────┬─────┼─────┨\n" + "┃0x0/3│0x1/3│0x1/2│1x1/1┃\n" + "┠─────┼─────┤ │ ┃\n" + "┃1x0/3│1x1/3│ │ ┃\n" + "┠─────┴─────┼─────┤ ┃\n" + "┃1x0/2 │1x1/2│ ┃\n" + "┗━━━━━━━━━━━┷━━━━━┷━━━━━┛\n" + "", t1.toString());
}
}
| {
"pile_set_name": "Github"
} |
glsl.entryPointRename.vert
ERROR: Source entry point must be "main"
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 20
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "foo" 13
Source GLSL 460
Name 4 "foo"
Name 11 "gl_PerVertex"
MemberName 11(gl_PerVertex) 0 "gl_Position"
MemberName 11(gl_PerVertex) 1 "gl_PointSize"
MemberName 11(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 11(gl_PerVertex) 3 "gl_CullDistance"
Name 13 ""
MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 11(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 11(gl_PerVertex) Block
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeInt 32 0
9: 8(int) Constant 1
10: TypeArray 6(float) 9
11(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 10 10
12: TypePointer Output 11(gl_PerVertex)
13: 12(ptr) Variable Output
14: TypeInt 32 1
15: 14(int) Constant 0
16: 6(float) Constant 1065353216
17: 7(fvec4) ConstantComposite 16 16 16 16
18: TypePointer Output 7(fvec4)
4(foo): 2 Function None 3
5: Label
19: 18(ptr) AccessChain 13 15
Store 19 17
Return
FunctionEnd
| {
"pile_set_name": "Github"
} |
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# 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.
# ----------------------------------------------------------------------------------
<#
.Synopsis
Lists all of the available Time Series Insights related operations.
.Description
Lists all of the available Time Series Insights related operations.
.Example
PS C:\> {{ Add code here }}
{{ Add output here }}
.Example
PS C:\> {{ Add code here }}
{{ Add output here }}
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20200515.IOperation
.Link
https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/get-aztimeseriesinsightsoperation
#>
function Get-AzTimeSeriesInsightsOperation {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20200515.IOperation])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
param(
[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
${DefaultProfile},
[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},
[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},
[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},
[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},
[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},
[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
)
begin {
try {
$outBuffer = $null
if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
$PSBoundParameters['OutBuffer'] = 1
}
$parameterSet = $PSCmdlet.ParameterSetName
$mapping = @{
List = 'Az.TimeSeriesInsights.private\Get-AzTimeSeriesInsightsOperation_List';
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd @PSBoundParameters}
$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
$steppablePipeline.Begin($PSCmdlet)
} catch {
throw
}
}
process {
try {
$steppablePipeline.Process($_)
} catch {
throw
}
}
end {
try {
$steppablePipeline.End()
} catch {
throw
}
}
}
| {
"pile_set_name": "Github"
} |
@startuml cluster-admission-machinedeployment-controller
start;
:MachineDeployment controller;
repeat
:MachineDeployment controller enqueues a Reconcile call;
:List all MachineSets in namespace;
repeat
if (MachineSet matches MachineDeployment's selector) then (yes)
if (MachineSet Owned by this MachineDeployment) then (yes)
#LightBlue:Add to List;
elseif (Not Owned By Any MachineDeployment) then (yes)
:Adopt MachineSet;
#LightBlue:Add to List;
endif
endif
repeat while (More MachineSets) then (yes)
if (Paused) then (yes)
#LightBlue:Update status and exit;
else
if (RollingUpdate Deployment Strategy) then (yes)
:Select newest MachineSet;
if (Too Many replicas) then (yes)
#LightBlue:Scale machineSet down;
elseif (Not Enough Replicas)
#LightBlue:Create new replicas;
endif
if (Old MachineSet Replicas are Unhealthy) then (yes)
#LightBlue:Cleanup Unhealthy Replicas;
elseif (New MachineSets Replicas available) then (yes)
#LightBlue:Scale MachineSet down;
endif
else (no)
#Pink:Unknown strategy;
endif
endif
repeat while (More updates to MachineDeployments) then (yes)
stop;
@enduml
| {
"pile_set_name": "Github"
} |
/// The guild's premium tier, depends on the amount of users boosting the guild currently
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[non_exhaustive]
pub enum PremiumTier {
/// No tier, considered None
Tier0,
Tier1,
Tier2,
Tier3,
}
enum_number!(
PremiumTier {
Tier0,
Tier1,
Tier2,
Tier3,
}
);
impl PremiumTier {
pub fn num(self) -> u64 {
match self {
PremiumTier::Tier0 => 0,
PremiumTier::Tier1 => 1,
PremiumTier::Tier2 => 2,
PremiumTier::Tier3 => 3,
}
}
}
impl Default for PremiumTier {
fn default() -> Self {
PremiumTier::Tier0
}
}
| {
"pile_set_name": "Github"
} |
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
int ret;
char buf [1024] = "Ooops";
ret = sscanf ("static char Term_bits[] = {", "static char %s = {", buf);
printf ("ret: %d, name: %s\n", ret, buf);
if (ret != 1 || strcmp (buf, "Term_bits[]") != 0)
abort ();
return 0;
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2010-2017 Zipline Games, Inc. All Rights Reserved.
// http://getmoai.com
#ifndef ZL_GFX_H
#define ZL_GFX_H
#include <zl-gfx/pch.h>
//================================================================//
// gfx
//================================================================//
//----------------------------------------------------------------//
//extern void zglBegin ();
//extern void zglEnd ();
//extern void zglFinalize ();
//extern void zglInitialize ();
//----------------------------------------------------------------//
//extern void zglActiveTexture ( u32 textureUnit );
//extern void zglBlendFunc ( u32 sourceFactor, u32 destFactor );
//extern void zglBlendMode ( u32 mode );
//extern void zglClear ( u32 mask );
//extern void zglClearColor ( float r, float g, float b, float a );
//extern void zglColor ( float r, float g, float b, float a );
//extern void zglCullFace ( u32 mode );
//extern void zglDeleteBuffer ( u32 buffer );
//extern void zglDeleteFramebuffer ( u32 buffer );
//extern void zglDeleteProgram ( u32 program );
//extern void zglDeleteRenderbuffer ( u32 buffer );
//extern void zglDeleteShader ( u32 shader );
//extern void zglDeleteTexture ( u32 texture );
//extern void zglDepthFunc ( u32 depthFunc );
//extern void zglDepthMask ( bool flag );
//extern void zglDisable ( u32 cap );
//extern void zglDrawArrays ( u32 primType, u32 first, u32 count );
//extern void zglDrawElements ( u32 primType, u32 count, u32 indexType, const void* indices );
//extern void zglEnable ( u32 cap );
//extern void zglFlush ();
//extern u32 zglGetCap ( u32 cap );
//extern u32 zglGetError ();
//extern cc8* zglGetErrorString ( u32 error );
//extern cc8* zglGetString ( u32 stringID );
//extern void zglLineWidth ( float width );
//extern void zglReadPixels ( s32 x, s32 y, u32 width, u32 height, void* data );
//extern void zglScissor ( s32 x, s32 y, u32 w, u32 h );
//extern void zglViewport ( s32 x, s32 y, u32 w, u32 h );
//----------------------------------------------------------------//
//extern void zglDisableClientState ( u32 cap );
//extern void zglDisableVertexAttribArray ( u32 index );
//extern void zglVertexAttribPointer ( u32 index, u32 size, u32 type, bool normalized, u32 stride, const void* pointer );
//extern void zglEnableClientState ( u32 cap );
//extern void zglEnableVertexAttribArray ( u32 index );
//----------------------------------------------------------------//
//extern void zglAttachShader ( u32 program, u32 shader );
//extern void zglBindAttribLocation ( u32 program, u32 index, cc8* name );
//extern void zglCompileShader ( u32 shader );
//extern u32 zglCreateProgram ();
//extern u32 zglCreateShader ( u32 shaderType );
//extern void zglGetProgramInfoLog ( u32 program, u32 maxLength, u32* length, char* log );
//extern void zglGetProgramiv ( u32 program, u32 name, s32* params );
//extern void zglGetShaderInfoLog ( u32 shader, u32 maxLength, u32* length, char* log );
//extern void zglGetShaderiv ( u32 shader, u32 name, s32* params );
//extern u32 zglGetUniformLocation ( u32 program, cc8* name );
//extern void zglLinkProgram ( u32 program );
//extern void zglShaderSource ( u32 shader, u32 count, const char** string, const s32* length );
//extern void zglValidateProgram ( u32 program );
//extern void zglUniform1f ( u32 location, float v0 );
//extern void zglUniform1i ( u32 location, s32 v0 );
//extern void zglUniform4fv ( u32 location, u32 count, const float* value );
//extern void zglUniformMatrix3fv ( u32 location, u32 count, bool transpose, const float* value );
//extern void zglUniformMatrix4fv ( u32 location, u32 count, bool transpose, const float* value );
//extern void zglUseProgram ( u32 program );
//----------------------------------------------------------------//
//extern void zglBindTexture ( u32 texID );
//extern void zglCompressedTexImage2D ( u32 level, u32 internalFormat, u32 width, u32 height, u32 imageSize, const void* data );
//extern u32 zglCreateTexture ();
//extern void zglTexEnvi ( u32 pname, s32 param );
//extern void zglTexImage2D ( u32 level, u32 internalFormat, u32 width, u32 height, u32 format, u32 type, const void* data );
//extern void zglTexParameteri ( u32 pname, s32 param );
//extern void zglTexSubImage2D ( u32 level, s32 xOffset, s32 yOffset, u32 width, u32 height, u32 format, u32 type, const void* data );
//----------------------------------------------------------------//
//extern void zglBindFramebuffer ( u32 target, u32 frameBuffer );
//extern void zglBindRenderbuffer ( u32 renderbuffer );
//extern u32 zglCheckFramebufferStatus ( u32 target );
//extern u32 zglCreateFramebuffer ();
//extern u32 zglCreateRenderbuffer ();
//extern void zglFramebufferRenderbuffer ( u32 target, u32 attachment, u32 renderbuffer );
//extern void zglFramebufferTexture2D ( u32 target, u32 attachment, u32 texture, s32 level );
//extern u32 zglGetCurrentFramebuffer ();
//extern void zglRenderbufferStorage ( u32 internalFormat, u32 width, u32 height );
//----------------------------------------------------------------//
//extern void zglBindBuffer ( u32 target, u32 buffer );
//extern void zglBufferData ( u32 target, u32 size, const void* data, u32 usage );
//extern void zglBufferSubData ( u32 target, u32 offset, u32 size, const void* data );
//extern u32 zglCreateBuffer ();
//extern void* zglMapBuffer ( u32 target );
//extern void zglUnmapBuffer ( u32 target );
//----------------------------------------------------------------//
//extern void zglBindVertexArray ( u32 vertexArrayID );
//extern u32 zglCreateVertexArray ();
//extern void zglDeleteVertexArray ( u32 vertexArrayID );
#endif
| {
"pile_set_name": "Github"
} |
//重新加载appDetail页面
function reloadAppStatPage(appId){
location.href = "/admin/app/index.do?appId=" + appId + "&tabTag=app_stat";
}
function appConfigChange(appId, instanceId){
var appConfigKey = document.getElementById("appConfigKey");
if(appConfigKey.value == ""){
alert("配置项不能为空");
appConfigKey.focus();
return false;
}
var appConfigValue = document.getElementById("appConfigValue");
if(appConfigValue.value == ""){
alert("配置值不能为空");
appConfigValue.focus();
return false;
}
var appConfigReason = document.getElementById("appConfigReason");
if(appConfigReason.value == ""){
alert("配置原因不能为空");
appConfigReason.focus();
return false;
}
var appConfigChangeBtn = document.getElementById("appConfigChangeBtn");
appConfigChangeBtn.disabled = true;
$.post(
'/admin/app/changeAppConfig.do',
{
appId: appId,
instanceId: instanceId,
appConfigKey: appConfigKey.value,
appConfigValue: appConfigValue.value,
appConfigReason: appConfigReason.value
},
function(data){
if(data==1){
alert("申请成功,请在邮件中关注申请状况.");
$("#appConfigChangeInfo").html("<div class='alert alert-error' ><button class='close' data-dismiss='alert'>×</button><strong>Success!</strong>更新成功,窗口会自动关闭</div>");
setTimeout("$('appConfigChangeModal').modal('hide');reloadAppStatPage("+appId+");",1000);
}else{
appConfigChangeBtn.disabled = false;
$("#appConfigChangeInfo").html("<div class='alert alert-error' ><button class='close' data-dismiss='alert'>×</button><strong>Error!</strong>更新失败!</div>");
}
}
);
}
//申请应用扩容
function appScaleApply(appId){
var applyMemSize = document.getElementById("applyMemSize");
if(applyMemSize.value == ""){
alert("请填写要扩容的容量!");
applyMemSize.focus();
return false;
}
var appScaleReason = document.getElementById("appScaleReason");
if(appScaleReason.value == ""){
alert("请填写申请扩容的原因!");
appScaleReason.focus();
return false;
}
var appScaleApplyBtn = document.getElementById("appScaleApplyBtn");
appScaleApplyBtn.disabled = true;
$.post(
'/admin/app/scale.do',
{
appId: appId,
applyMemSize: applyMemSize.value,
appScaleReason: appScaleReason.value
},
function(data){
if(data==1){
alert("申请成功,请在邮件中关注申请状况.");
$("#appScaleApplyInfo").html("<div class='alert alert-error' ><button class='close' data-dismiss='alert'>×</button><strong>Success!</strong>更新成功,窗口会自动关闭</div>");
setTimeout("$('appScaleApplyModal').modal('hide');reloadAppStatPage("+appId+");",1000);
}else{
appScaleApplyBtn.disabled = false;
$("#appScaleApplyInfo").html("<div class='alert alert-error' ><button class='close' data-dismiss='alert'>×</button><strong>Error!</strong>更新失败!</div>");
}
}
);
} | {
"pile_set_name": "Github"
} |
#!/usr/bin/env ruby
require File.expand_path(File.join("..", "..", "support", "fake_github"), File.dirname(__FILE__))
FakeGithub.new(ARGV).run!
| {
"pile_set_name": "Github"
} |
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#include "winerror.h"
| {
"pile_set_name": "Github"
} |
(*
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*)
theory ArchSetup
imports
"CLib.CTranslationNICTA"
begin
abbreviation (input)
"(arch_load_machine_word
(load_word32 :: word32 mem_read)
(load_word64 :: word64 mem_read)
:: machine_word mem_read)
\<equiv> load_word32"
abbreviation (input)
"(arch_store_machine_word
(store_word32 :: word32 mem_upd)
(store_word64 :: word64 mem_upd)
:: machine_word mem_upd)
\<equiv> store_word32"
abbreviation (input)
"(arch_machine_word_constructor
(from_word32 :: word32 \<Rightarrow> 'a)
(from_word64 :: word64 \<Rightarrow> 'a)
:: machine_word \<Rightarrow> 'a)
\<equiv> from_word32"
end
| {
"pile_set_name": "Github"
} |
var KeyboardInput = pc.createScript('keyboardInput');
// initialize code called once per entity
KeyboardInput.prototype.initialize = function() {
this.orbitCamera = this.entity.script.orbitCamera;
};
KeyboardInput.prototype.postInitialize = function() {
if (this.orbitCamera) {
this.startDistance = this.orbitCamera.distance;
this.startYaw = this.orbitCamera.yaw;
this.startPitch = this.orbitCamera.pitch;
this.startPivotPosition = this.orbitCamera.pivotPoint.clone();
}
};
// update code called every frame
KeyboardInput.prototype.update = function(dt) {
if (this.orbitCamera) {
if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
this.orbitCamera.reset(this.startYaw, this.startPitch, this.startDistance);
this.orbitCamera.pivotPoint = this.startPivotPosition;
}
}
};
var MouseInput = pc.createScript('mouseInput');
MouseInput.attributes.add('orbitSensitivity', {
type: 'number',
default: 0.3,
title: 'Orbit Sensitivity',
description: 'How fast the camera moves around the orbit. Higher is faster'
});
MouseInput.attributes.add('distanceSensitivity', {
type: 'number',
default: 0.15,
title: 'Distance Sensitivity',
description: 'How fast the camera moves in and out. Higher is faster'
});
// initialize code called once per entity
MouseInput.prototype.initialize = function() {
this.orbitCamera = this.entity.script.orbitCamera;
if (this.orbitCamera) {
var self = this;
var onMouseOut = function (e) {
self.onMouseOut(e);
};
this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.onMouseDown, this);
this.app.mouse.on(pc.EVENT_MOUSEUP, this.onMouseUp, this);
this.app.mouse.on(pc.EVENT_MOUSEMOVE, this.onMouseMove, this);
this.app.mouse.on(pc.EVENT_MOUSEWHEEL, this.onMouseWheel, this);
// Listen to when the mouse travels out of the window
window.addEventListener('mouseout', onMouseOut, false);
// Remove the listeners so if this entity is destroyed
this.on('destroy', function() {
this.app.mouse.off(pc.EVENT_MOUSEDOWN, this.onMouseDown, this);
this.app.mouse.off(pc.EVENT_MOUSEUP, this.onMouseUp, this);
this.app.mouse.off(pc.EVENT_MOUSEMOVE, this.onMouseMove, this);
this.app.mouse.off(pc.EVENT_MOUSEWHEEL, this.onMouseWheel, this);
window.removeEventListener('mouseout', onMouseOut, false);
});
}
// Disabling the context menu stops the browser displaying a menu when
// you right-click the page
this.app.mouse.disableContextMenu();
this.lookButtonDown = false;
this.panButtonDown = false;
this.lastPoint = new pc.Vec2();
};
MouseInput.fromWorldPoint = new pc.Vec3();
MouseInput.toWorldPoint = new pc.Vec3();
MouseInput.worldDiff = new pc.Vec3();
MouseInput.prototype.pan = function(screenPoint) {
var fromWorldPoint = MouseInput.fromWorldPoint;
var toWorldPoint = MouseInput.toWorldPoint;
var worldDiff = MouseInput.worldDiff;
// For panning to work at any zoom level, we use screen point to world projection
// to work out how far we need to pan the pivotEntity in world space
var camera = this.entity.camera;
var distance = this.orbitCamera.distance;
camera.screenToWorld(screenPoint.x, screenPoint.y, distance, fromWorldPoint);
camera.screenToWorld(this.lastPoint.x, this.lastPoint.y, distance, toWorldPoint);
worldDiff.sub2(toWorldPoint, fromWorldPoint);
this.orbitCamera.pivotPoint.add(worldDiff);
};
MouseInput.prototype.onMouseDown = function (event) {
switch (event.button) {
case pc.MOUSEBUTTON_LEFT: {
this.lookButtonDown = true;
} break;
case pc.MOUSEBUTTON_MIDDLE:
case pc.MOUSEBUTTON_RIGHT: {
this.panButtonDown = true;
} break;
}
};
MouseInput.prototype.onMouseUp = function (event) {
switch (event.button) {
case pc.MOUSEBUTTON_LEFT: {
this.lookButtonDown = false;
} break;
case pc.MOUSEBUTTON_MIDDLE:
case pc.MOUSEBUTTON_RIGHT: {
this.panButtonDown = false;
} break;
}
};
MouseInput.prototype.onMouseMove = function (event) {
var mouse = pc.app.mouse;
if (this.lookButtonDown) {
this.orbitCamera.pitch -= event.dy * this.orbitSensitivity;
this.orbitCamera.yaw -= event.dx * this.orbitSensitivity;
} else if (this.panButtonDown) {
this.pan(event);
}
this.lastPoint.set(event.x, event.y);
};
MouseInput.prototype.onMouseWheel = function (event) {
this.orbitCamera.distance -= event.wheel * this.distanceSensitivity * (this.orbitCamera.distance * 0.1);
event.event.preventDefault();
};
MouseInput.prototype.onMouseOut = function (event) {
this.lookButtonDown = false;
this.panButtonDown = false;
};
var TouchInput = pc.createScript('touchInput');
TouchInput.attributes.add('orbitSensitivity', {
type: 'number',
default: 0.4,
title: 'Orbit Sensitivity',
description: 'How fast the camera moves around the orbit. Higher is faster'
});
TouchInput.attributes.add('distanceSensitivity', {
type: 'number',
default: 0.2,
title: 'Distance Sensitivity',
description: 'How fast the camera moves in and out. Higher is faster'
});
// initialize code called once per entity
TouchInput.prototype.initialize = function() {
this.orbitCamera = this.entity.script.orbitCamera;
// Store the position of the touch so we can calculate the distance moved
this.lastTouchPoint = new pc.Vec2();
this.lastPinchMidPoint = new pc.Vec2();
this.lastPinchDistance = 0;
if (this.orbitCamera && this.app.touch) {
// Use the same callback for the touchStart, touchEnd and touchCancel events as they
// all do the same thing which is to deal the possible multiple touches to the screen
this.app.touch.on(pc.EVENT_TOUCHSTART, this.onTouchStartEndCancel, this);
this.app.touch.on(pc.EVENT_TOUCHEND, this.onTouchStartEndCancel, this);
this.app.touch.on(pc.EVENT_TOUCHCANCEL, this.onTouchStartEndCancel, this);
this.app.touch.on(pc.EVENT_TOUCHMOVE, this.onTouchMove, this);
this.on('destroy', function() {
this.app.touch.off(pc.EVENT_TOUCHSTART, this.onTouchStartEndCancel, this);
this.app.touch.off(pc.EVENT_TOUCHEND, this.onTouchStartEndCancel, this);
this.app.touch.off(pc.EVENT_TOUCHCANCEL, this.onTouchStartEndCancel, this);
this.app.touch.off(pc.EVENT_TOUCHMOVE, this.onTouchMove, this);
});
}
};
TouchInput.prototype.getPinchDistance = function (pointA, pointB) {
// Return the distance between the two points
var dx = pointA.x - pointB.x;
var dy = pointA.y - pointB.y;
return Math.sqrt((dx * dx) + (dy * dy));
};
TouchInput.prototype.calcMidPoint = function (pointA, pointB, result) {
result.set(pointB.x - pointA.x, pointB.y - pointA.y);
result.scale(0.5);
result.x += pointA.x;
result.y += pointA.y;
};
TouchInput.prototype.onTouchStartEndCancel = function(event) {
// We only care about the first touch for camera rotation. As the user touches the screen,
// we stored the current touch position
var touches = event.touches;
if (touches.length == 1) {
this.lastTouchPoint.set(touches[0].x, touches[0].y);
} else if (touches.length == 2) {
// If there are 2 touches on the screen, then set the pinch distance
this.lastPinchDistance = this.getPinchDistance(touches[0], touches[1]);
this.calcMidPoint(touches[0], touches[1], this.lastPinchMidPoint);
}
};
TouchInput.fromWorldPoint = new pc.Vec3();
TouchInput.toWorldPoint = new pc.Vec3();
TouchInput.worldDiff = new pc.Vec3();
TouchInput.prototype.pan = function(midPoint) {
var fromWorldPoint = TouchInput.fromWorldPoint;
var toWorldPoint = TouchInput.toWorldPoint;
var worldDiff = TouchInput.worldDiff;
// For panning to work at any zoom level, we use screen point to world projection
// to work out how far we need to pan the pivotEntity in world space
var camera = this.entity.camera;
var distance = this.orbitCamera.distance;
camera.screenToWorld(midPoint.x, midPoint.y, distance, fromWorldPoint);
camera.screenToWorld(this.lastPinchMidPoint.x, this.lastPinchMidPoint.y, distance, toWorldPoint);
worldDiff.sub2(toWorldPoint, fromWorldPoint);
this.orbitCamera.pivotPoint.add(worldDiff);
};
TouchInput.pinchMidPoint = new pc.Vec2();
TouchInput.prototype.onTouchMove = function(event) {
var pinchMidPoint = TouchInput.pinchMidPoint;
// We only care about the first touch for camera rotation. Work out the difference moved since the last event
// and use that to update the camera target position
var touches = event.touches;
if (touches.length == 1) {
var touch = touches[0];
this.orbitCamera.pitch -= (touch.y - this.lastTouchPoint.y) * this.orbitSensitivity;
this.orbitCamera.yaw -= (touch.x - this.lastTouchPoint.x) * this.orbitSensitivity;
this.lastTouchPoint.set(touch.x, touch.y);
} else if (touches.length == 2) {
// Calculate the difference in pinch distance since the last event
var currentPinchDistance = this.getPinchDistance(touches[0], touches[1]);
var diffInPinchDistance = currentPinchDistance - this.lastPinchDistance;
this.lastPinchDistance = currentPinchDistance;
this.orbitCamera.distance -= (diffInPinchDistance * this.distanceSensitivity * 0.1) * (this.orbitCamera.distance * 0.1);
// Calculate pan difference
this.calcMidPoint(touches[0], touches[1], pinchMidPoint);
this.pan(pinchMidPoint);
this.lastPinchMidPoint.copy(pinchMidPoint);
}
};
var OrbitCamera = pc.createScript('orbitCamera');
OrbitCamera.attributes.add('distanceMax', {type: 'number', default: 0, title: 'Distance Max', description: 'Setting this at 0 will give an infinite distance limit'});
OrbitCamera.attributes.add('distanceMin', {type: 'number', default: 0, title: 'Distance Min'});
OrbitCamera.attributes.add('pitchAngleMax', {type: 'number', default: 90, title: 'Pitch Angle Max (degrees)'});
OrbitCamera.attributes.add('pitchAngleMin', {type: 'number', default: -90, title: 'Pitch Angle Min (degrees)'});
OrbitCamera.attributes.add('inertiaFactor', {
type: 'number',
default: 0,
title: 'Inertia Factor',
description: 'Higher value means that the camera will continue moving after the user has stopped dragging. 0 is fully responsive.'
});
OrbitCamera.attributes.add('focusEntity', {
type: 'entity',
title: 'Focus Entity',
description: 'Entity for the camera to focus on. If blank, then the camera will use the whole scene'
});
OrbitCamera.attributes.add('frameOnStart', {
type: 'boolean',
default: false,
title: 'Frame on Start',
description: 'Frames the entity or scene at the start of the application."'
});
// Property to get and set the distance between the pivot point and camera
// Clamped between this.distanceMin and this.distanceMax
Object.defineProperty(OrbitCamera.prototype, "distance", {
get: function() {
return this._targetDistance;
},
set: function(value) {
this._targetDistance = this._clampDistance(value);
}
});
// Property to get and set the pitch of the camera around the pivot point (degrees)
// Clamped between this.pitchAngleMin and this.pitchAngleMax
// When set at 0, the camera angle is flat, looking along the horizon
Object.defineProperty(OrbitCamera.prototype, "pitch", {
get: function() {
return this._targetPitch;
},
set: function(value) {
this._targetPitch = this._clampPitchAngle(value);
}
});
// Property to get and set the yaw of the camera around the pivot point (degrees)
Object.defineProperty(OrbitCamera.prototype, "yaw", {
get: function() {
return this._targetYaw;
},
set: function(value) {
this._targetYaw = value;
// Ensure that the yaw takes the shortest route by making sure that
// the difference between the targetYaw and the actual is 180 degrees
// in either direction
var diff = this._targetYaw - this._yaw;
var reminder = diff % 360;
if (reminder > 180) {
this._targetYaw = this._yaw - (360 - reminder);
} else if (reminder < -180) {
this._targetYaw = this._yaw + (360 + reminder);
} else {
this._targetYaw = this._yaw + reminder;
}
}
});
// Property to get and set the world position of the pivot point that the camera orbits around
Object.defineProperty(OrbitCamera.prototype, "pivotPoint", {
get: function() {
return this._pivotPoint;
},
set: function(value) {
this._pivotPoint.copy(value);
}
});
// Moves the camera to look at an entity and all its children so they are all in the view
OrbitCamera.prototype.focus = function (focusEntity) {
// Calculate an bounding box that encompasses all the models to frame in the camera view
this._buildAabb(focusEntity, 0);
var halfExtents = this._modelsAabb.halfExtents;
var distance = Math.max(halfExtents.x, Math.max(halfExtents.y, halfExtents.z));
distance = (distance / Math.tan(0.5 * this.entity.camera.fov * pc.math.DEG_TO_RAD));
distance = (distance * 2);
this.distance = distance;
if (this.entity.camera) {
this.entity.camera.nearClip = distance * 0.002;
this.entity.camera.farClip = distance * 5;
}
this._removeInertia();
this._pivotPoint.copy(this._modelsAabb.center);
};
OrbitCamera.distanceBetween = new pc.Vec3();
// Set the camera position to a world position and look at a world position
// Useful if you have multiple viewing angles to swap between in a scene
OrbitCamera.prototype.resetAndLookAtPoint = function (resetPoint, lookAtPoint) {
this.pivotPoint.copy(lookAtPoint);
this.entity.setPosition(resetPoint);
this.entity.lookAt(lookAtPoint);
var distance = OrbitCamera.distanceBetween;
distance.sub2(lookAtPoint, resetPoint);
this.distance = distance.length();
this.pivotPoint.copy(lookAtPoint);
var cameraQuat = this.entity.getRotation();
this.yaw = this._calcYaw(cameraQuat);
this.pitch = this._calcPitch(cameraQuat, this.yaw);
this._removeInertia();
this._updatePosition();
};
// Set camera position to a world position and look at an entity in the scene
// Useful if you have multiple models to swap between in a scene
OrbitCamera.prototype.resetAndLookAtEntity = function (resetPoint, entity) {
this._buildAabb(entity, 0);
this.resetAndLookAtPoint(resetPoint, this._modelsAabb.center);
};
// Set the camera at a specific, yaw, pitch and distance without inertia (instant cut)
OrbitCamera.prototype.reset = function (yaw, pitch, distance) {
this.pitch = pitch;
this.yaw = yaw;
this.distance = distance;
this._removeInertia();
};
/////////////////////////////////////////////////////////////////////////////////////////////
// Private methods
OrbitCamera.prototype.initialize = function () {
var self = this;
var onWindowResize = function () {
self._checkAspectRatio();
};
window.addEventListener('resize', onWindowResize, false);
this._checkAspectRatio();
// Find all the models in the scene that are under the focused entity
this._modelsAabb = new pc.BoundingBox();
this._buildAabb(this.focusEntity || this.app.root, 0);
this.entity.lookAt(this._modelsAabb.center);
this._pivotPoint = new pc.Vec3();
this._pivotPoint.copy(this._modelsAabb.center);
// Calculate the camera euler angle rotation around x and y axes
// This allows us to place the camera at a particular rotation to begin with in the scene
var cameraQuat = this.entity.getRotation();
// Preset the camera
this._yaw = this._calcYaw(cameraQuat);
this._pitch = this._clampPitchAngle(this._calcPitch(cameraQuat, this._yaw));
this.entity.setLocalEulerAngles(this._pitch, this._yaw, 0);
this._distance = 0;
this._targetYaw = this._yaw;
this._targetPitch = this._pitch;
// If we have ticked focus on start, then attempt to position the camera where it frames
// the focused entity and move the pivot point to entity's position otherwise, set the distance
// to be between the camera position in the scene and the pivot point
if (this.frameOnStart) {
this.focus(this.focusEntity || this.app.root);
} else {
var distanceBetween = new pc.Vec3();
distanceBetween.sub2(this.entity.getPosition(), this._pivotPoint);
this._distance = this._clampDistance(distanceBetween.length());
}
this._targetDistance = this._distance;
// Reapply the clamps if they are changed in the editor
this.on('attr:distanceMin', function (value, prev) {
this._targetDistance = this._clampDistance(this._distance);
});
this.on('attr:distanceMax', function (value, prev) {
this._targetDistance = this._clampDistance(this._distance);
});
this.on('attr:pitchAngleMin', function (value, prev) {
this._targetPitch = this._clampPitchAngle(this._pitch);
});
this.on('attr:pitchAngleMax', function (value, prev) {
this._targetPitch = this._clampPitchAngle(this._pitch);
});
// Focus on the entity if we change the focus entity
this.on('attr:focusEntity', function (value, prev) {
if (this.frameOnStart) {
this.focus(value || this.app.root);
} else {
this.resetAndLookAtEntity(this.entity.getPosition(), value || this.app.root);
}
});
this.on('attr:frameOnStart', function (value, prev) {
if (value) {
this.focus(this.focusEntity || this.app.root);
}
});
this.on('destroy', function() {
window.removeEventListener('resize', onWindowResize, false);
});
};
OrbitCamera.prototype.update = function(dt) {
// Add inertia, if any
var t = this.inertiaFactor === 0 ? 1 : Math.min(dt / this.inertiaFactor, 1);
this._distance = pc.math.lerp(this._distance, this._targetDistance, t);
this._yaw = pc.math.lerp(this._yaw, this._targetYaw, t);
this._pitch = pc.math.lerp(this._pitch, this._targetPitch, t);
this._updatePosition();
};
OrbitCamera.prototype._updatePosition = function () {
// Work out the camera position based on the pivot point, pitch, yaw and distance
this.entity.setLocalPosition(0,0,0);
this.entity.setLocalEulerAngles(this._pitch, this._yaw, 0);
var position = this.entity.getPosition();
position.copy(this.entity.forward);
position.scale(-this._distance);
position.add(this.pivotPoint);
this.entity.setPosition(position);
};
OrbitCamera.prototype._removeInertia = function () {
this._yaw = this._targetYaw;
this._pitch = this._targetPitch;
this._distance = this._targetDistance;
};
OrbitCamera.prototype._checkAspectRatio = function () {
var height = this.app.graphicsDevice.height;
var width = this.app.graphicsDevice.width;
// Match the axis of FOV to match the aspect ratio of the canvas so
// the focused entities is always in frame
this.entity.camera.horizontalFov = height > width;
};
OrbitCamera.prototype._buildAabb = function (entity, modelsAdded) {
var i = 0;
if (entity.model) {
var mi = entity.model.meshInstances;
for (i = 0; i < mi.length; i++) {
if (modelsAdded === 0) {
this._modelsAabb.copy(mi[i].aabb);
} else {
this._modelsAabb.add(mi[i].aabb);
}
modelsAdded += 1;
}
}
for (i = 0; i < entity.children.length; ++i) {
modelsAdded += this._buildAabb(entity.children[i], modelsAdded);
}
return modelsAdded;
};
OrbitCamera.prototype._calcYaw = function (quat) {
var transformedForward = new pc.Vec3();
quat.transformVector(pc.Vec3.FORWARD, transformedForward);
return Math.atan2(-transformedForward.x, -transformedForward.z) * pc.math.RAD_TO_DEG;
};
OrbitCamera.prototype._clampDistance = function (distance) {
if (this.distanceMax > 0) {
return pc.math.clamp(distance, this.distanceMin, this.distanceMax);
} else {
return Math.max(distance, this.distanceMin);
}
};
OrbitCamera.prototype._clampPitchAngle = function (pitch) {
// Negative due as the pitch is inversed since the camera is orbiting the entity
return pc.math.clamp(pitch, -this.pitchAngleMax, -this.pitchAngleMin);
};
OrbitCamera.quatWithoutYaw = new pc.Quat();
OrbitCamera.yawOffset = new pc.Quat();
OrbitCamera.prototype._calcPitch = function(quat, yaw) {
var quatWithoutYaw = OrbitCamera.quatWithoutYaw;
var yawOffset = OrbitCamera.yawOffset;
yawOffset.setFromEulerAngles(0, -yaw, 0);
quatWithoutYaw.mul2(yawOffset, quat);
var transformedForward = new pc.Vec3();
quatWithoutYaw.transformVector(pc.Vec3.FORWARD, transformedForward);
return Math.atan2(transformedForward.y, -transformedForward.z) * pc.math.RAD_TO_DEG;
}; | {
"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 http://mozilla.org/MPL/2.0/. */
// @flow
import { SymbolStore } from '../../profile-logic/symbol-store';
import { SymbolsNotFoundError } from '../../profile-logic/errors';
import { TextDecoder } from 'util';
import exampleSymbolTable from '../fixtures/example-symbol-table';
import fakeIndexedDB from 'fake-indexeddb';
import FDBKeyRange from 'fake-indexeddb/lib/FDBKeyRange';
import { FakeSymbolStore } from '../fixtures/fake-symbol-store';
import { ensureExists } from '../../utils/flow';
describe('SymbolStore', function() {
let symbolProvider, symbolStore;
function deleteDatabase() {
return new Promise((resolve, reject) => {
const req = fakeIndexedDB.deleteDatabase(
'profiler-async-storage-symbol-tables'
);
req.onsuccess = () => resolve();
req.onerror = () => reject(req.error);
});
}
beforeAll(function() {
// The SymbolStore requires IndexedDB, otherwise symbolication will be skipped.
window.indexedDB = fakeIndexedDB;
window.IDBKeyRange = FDBKeyRange;
window.TextDecoder = TextDecoder;
});
afterAll(function() {
delete window.indexedDB;
delete window.IDBKeyRange;
delete window.TextDecoder;
symbolStore = null;
});
afterEach(async function() {
if (symbolStore) {
await symbolStore.closeDb().catch(() => {});
}
await deleteDatabase();
});
it('should only request symbols from the symbol provider once per library', async function() {
symbolProvider = {
requestSymbolsFromServer: jest.fn(requests =>
requests.map(request => {
expect(request.lib.breakpadId).not.toBe('');
return Promise.reject(
new Error('this example only supports symbol tables')
);
})
),
requestSymbolTableFromAddon: jest.fn(() =>
Promise.resolve(exampleSymbolTable)
),
};
symbolStore = new SymbolStore('profiler-async-storage', symbolProvider);
expect(symbolProvider.requestSymbolTableFromAddon).not.toHaveBeenCalled();
const lib1 = { debugName: 'firefox', breakpadId: 'dont-care' };
let secondAndThirdSymbol = new Map();
const errorCallback = jest.fn((_request, _error) => {});
await symbolStore.getSymbols(
[{ lib: lib1, addresses: new Set([0xf01, 0x1a50]) }],
(request, results) => {
secondAndThirdSymbol = results;
},
errorCallback
);
expect(symbolProvider.requestSymbolsFromServer).toHaveBeenCalledTimes(1);
expect(symbolProvider.requestSymbolTableFromAddon).toHaveBeenCalledTimes(1);
expect(errorCallback).not.toHaveBeenCalled();
expect(secondAndThirdSymbol.get(0xf01)).toEqual({
name: 'second symbol',
functionOffset: 1,
});
expect(secondAndThirdSymbol.get(0x1a50)).toEqual({
name: 'third symbol',
functionOffset: 0x50,
});
const lib2 = { debugName: 'firefox2', breakpadId: 'dont-care2' };
let firstAndLastSymbol = new Map();
await symbolStore.getSymbols(
[{ lib: lib2, addresses: new Set([0x33, 0x2000]) }],
(request, results) => {
firstAndLastSymbol = results;
},
errorCallback
);
expect(symbolProvider.requestSymbolsFromServer).toHaveBeenCalledTimes(2);
expect(symbolProvider.requestSymbolTableFromAddon).toHaveBeenCalledTimes(2);
expect(errorCallback).not.toHaveBeenCalled();
expect(firstAndLastSymbol.get(0x33)).toEqual({
name: 'first symbol',
functionOffset: 0x33,
});
expect(firstAndLastSymbol.get(0x2000)).toEqual({
name: 'last symbol',
functionOffset: 0,
});
const libWithEmptyBreakpadId = {
debugName: 'dalvik-jit-code-cache',
breakpadId: '',
};
await symbolStore.getSymbols(
[{ lib: libWithEmptyBreakpadId, addresses: new Set([0x33, 0x2000]) }],
(_request, _results) => {},
errorCallback
);
expect(symbolProvider.requestSymbolsFromServer).toHaveBeenCalledTimes(2);
expect(symbolProvider.requestSymbolTableFromAddon).toHaveBeenCalledTimes(2);
// Empty breakpadIds should result in an error.
expect(errorCallback).toHaveBeenCalledWith(
expect.objectContaining({
lib: { breakpadId: '', debugName: 'dalvik-jit-code-cache' },
}),
expect.objectContaining({
message: expect.stringContaining('Invalid debugName or breakpadId'),
})
);
});
it('should persist in DB', async function() {
symbolProvider = {
requestSymbolsFromServer: jest.fn(requests =>
requests.map(() =>
Promise.reject(new Error('this example only supports symbol tables'))
)
),
requestSymbolTableFromAddon: jest.fn(() =>
Promise.resolve(exampleSymbolTable)
),
};
symbolStore = new SymbolStore('profiler-async-storage', symbolProvider);
const lib = { debugName: 'firefox', breakpadId: 'dont-care' };
const errorCallback = jest.fn((_request, _error) => {});
await symbolStore.getSymbols(
[{ lib: lib, addresses: new Set([0]) }],
(_request, _results) => {},
errorCallback
);
expect(errorCallback).not.toHaveBeenCalled();
// Using another symbol store simulates a page reload
// Due to https://github.com/dumbmatter/fakeIndexedDB/issues/22 we need to
// take care to sequence the DB open requests.
await symbolStore.closeDb().catch(() => {});
symbolStore = new SymbolStore('profiler-async-storage', symbolProvider);
await symbolStore.getSymbols(
[{ lib: lib, addresses: new Set([0x1]) }],
(_request, _results) => {},
errorCallback
);
expect(symbolProvider.requestSymbolTableFromAddon).toHaveBeenCalledTimes(1);
expect(errorCallback).not.toHaveBeenCalled();
});
it('should call requestSymbolsFromServer first', async function() {
const symbolTable = new Map([
[0, 'first symbol'],
[0xf00, 'second symbol'],
[0x1a00, 'third symbol'],
[0x2000, 'last symbol'],
]);
const fakeSymbolStore = new FakeSymbolStore(
new Map([['available-for-addresses', symbolTable]])
);
let symbolsForAddressesRequestCount = 0;
symbolProvider = {
requestSymbolsFromServer: jest.fn(requests => {
symbolsForAddressesRequestCount += requests.length;
return requests.map(
request =>
new Promise((resolve, reject) => {
fakeSymbolStore.getSymbols(
[request],
(_request, results) => resolve(results),
(_request, error) => reject(error)
);
})
);
}),
requestSymbolTableFromAddon: jest
.fn()
.mockResolvedValue(exampleSymbolTable),
};
symbolStore = new SymbolStore('profiler-async-storage', symbolProvider);
const lib1 = {
debugName: 'available-for-addresses',
breakpadId: 'dont-care',
};
const lib2 = {
debugName: 'available-as-entire-symboltable-only',
breakpadId: 'dont-care',
};
const symbolsPerLibrary = new Map();
const errorCallback = jest.fn((_request, _error) => {});
await symbolStore.getSymbols(
[
{ lib: lib1, addresses: new Set([0xf01, 0x1a50]) },
{ lib: lib2, addresses: new Set([0x33, 0x2000]) },
],
(request, results) => {
symbolsPerLibrary.set(request.lib, results);
},
errorCallback
);
// Both requests should have been coalesced into one call to
// requestSymbolsFromServer.
expect(symbolProvider.requestSymbolsFromServer).toHaveBeenCalledTimes(1);
expect(symbolsForAddressesRequestCount).toEqual(2);
expect(errorCallback).not.toHaveBeenCalled();
// requestSymbolsFromServer should have failed for lib2, so
// requestSymbolTableFromAddon should have been called for it, once.
expect(symbolProvider.requestSymbolTableFromAddon).toHaveBeenCalledTimes(1);
const lib1Symbols = ensureExists(symbolsPerLibrary.get(lib1));
const lib2Symbols = ensureExists(symbolsPerLibrary.get(lib2));
expect(lib1Symbols.get(0xf01)).toEqual({
name: 'second symbol',
functionOffset: 1,
});
expect(lib1Symbols.get(0x1a50)).toEqual({
name: 'third symbol',
functionOffset: 0x50,
});
expect(lib2Symbols.get(0x33)).toEqual({
name: 'first symbol',
functionOffset: 0x33,
});
expect(lib2Symbols.get(0x2000)).toEqual({
name: 'last symbol',
functionOffset: 0,
});
// Using another symbol store simulates a page reload
// Due to https://github.com/dumbmatter/fakeIndexedDB/issues/22 we need to
// take care to sequence the DB open requests.
const symbolStore2 = new SymbolStore(
'profiler-async-storage',
symbolProvider
);
await symbolStore2.getSymbols(
[
{ lib: lib1, addresses: new Set([0xf01, 0x1a50]) },
{ lib: lib2, addresses: new Set([0x33, 0x2000]) },
],
(_request, _results) => {},
errorCallback
);
// The symbolStore should already have a cached symbol table for lib2 now,
// so requestSymbolsFromServer should only have been called for one request.
expect(symbolProvider.requestSymbolsFromServer).toHaveBeenCalledTimes(2);
expect(symbolsForAddressesRequestCount).toEqual(3);
expect(errorCallback).not.toHaveBeenCalled();
// requestSymbolsFromServer should have succeeded for that one request,
// so requestSymbolTableFromAddon should not have been called again.
expect(symbolProvider.requestSymbolTableFromAddon).toHaveBeenCalledTimes(1);
});
it('should should report the right errors', async function() {
const libs = [
{
debugName: 'available-from-both-server-and-addon',
breakpadId: 'dont-care',
},
{
debugName: 'available-from-server',
breakpadId: 'dont-care',
},
{
debugName: 'available-from-addon',
breakpadId: 'dont-care',
},
{
debugName: 'available-from-neither',
breakpadId: 'dont-care',
},
{
debugName: 'empty-breakpadid',
breakpadId: '',
},
{
debugName: '',
breakpadId: 'empty-debugname',
},
];
const symbolTable = new Map([
[0, 'first symbol'],
[0xf00, 'second symbol'],
[0x1a00, 'third symbol'],
[0x2000, 'last symbol'],
]);
const fakeSymbolStore = new FakeSymbolStore(
new Map([
['available-from-both-server-and-addon', symbolTable],
['available-from-server', symbolTable],
])
);
symbolProvider = {
requestSymbolsFromServer: requests => {
return requests.map(request => {
const { debugName, breakpadId } = request.lib;
expect(debugName).not.toEqual('');
expect(breakpadId).not.toEqual('');
return new Promise((resolve, reject) => {
fakeSymbolStore.getSymbols(
[request],
(_request, results) => resolve(results),
(_request, error) => reject(error)
);
});
});
},
requestSymbolTableFromAddon: async ({ debugName, breakpadId }) => {
expect(debugName).not.toEqual('');
expect(breakpadId).not.toEqual('');
if (
debugName === 'available-from-addon' ||
debugName === 'available-from-both-server-and-addon'
) {
return exampleSymbolTable;
}
throw new Error('The add-on does not have symbols for this library.');
},
};
symbolStore = new SymbolStore('profiler-async-storage', symbolProvider);
const addresses = new Set([0xf01, 0x1a50]);
const succeededLibs = new Set();
const failedLibs = new Map();
await symbolStore.getSymbols(
libs.map(lib => ({ lib, addresses })),
(request, _results) => {
succeededLibs.add(request.lib);
},
(request, error) => {
failedLibs.set(request.lib.debugName, error);
}
);
// If symbols are available from at least one source, symbolication for that
// library should be successful and no error should be returned.
expect(succeededLibs).toEqual(
new Set([
expect.objectContaining({ debugName: 'available-from-addon' }),
expect.objectContaining({ debugName: 'available-from-server' }),
expect.objectContaining({
debugName: 'available-from-both-server-and-addon',
}),
])
);
// Empty debugNames or breakpadIds should cause errors. And if symbols are
// not available from any source, all errors along the way should be included
// in the reported error.
expect(failedLibs.size).toBe(3);
expect(failedLibs.get('empty-breakpadid')).toEqual(
expect.objectContaining({
message: expect.stringContaining('Invalid debugName or breakpadId'),
})
);
expect(failedLibs.get('')).toEqual(
expect.objectContaining({
message: expect.stringContaining('Invalid debugName or breakpadId'),
})
);
// For error objects, Jest's deep equality checks only check the message.
expect(failedLibs.get('available-from-neither')).toEqual(
new SymbolsNotFoundError(
'Could not obtain symbols for available-from-neither/dont-care.\n' +
' - Error: symbol table not found\n' +
' - Error: The add-on does not have symbols for this library.',
{
debugName: 'available-from-neither',
breakpadId: 'dont-care',
}
)
);
});
});
| {
"pile_set_name": "Github"
} |
/*
*
* Copyright (C) 2002, OFFIS
*
* This software and supporting documentation were developed by
*
* Kuratorium OFFIS e.V.
* Healthcare Information and Communication Systems
* Escherweg 2
* D-26121 Oldenburg, Germany
*
* THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY
* REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR
* FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR
* ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
* PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
*
* Module: ofstd
*
* Author: Marco Eichelberg
*
* Purpose: general purpose 32-bit CRC in C++
* Code is based on the CRC32 implementation (C)1986 Gary S. Brown
*
*/
#include "osconfig.h" /* make sure OS specific configuration is included first */
#include "ofcrc32.h"
void OFCRC32::addBlock(const void *ptr, unsigned long size)
{
const unsigned char *p=(const unsigned char *)ptr;
for (unsigned long i=0; i<size; i++)
value = crctab[(value^p[i]) & 0xff] ^ (value >> 8);
}
unsigned int OFCRC32::compute(const void *ptr, unsigned long size)
{
OFCRC32 crc;
crc.addBlock(ptr, size);
return crc.getCRC32();
}
const unsigned int OFCRC32::crctab[256] =
{
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
| {
"pile_set_name": "Github"
} |
package org.apereo.cas.ticket.serialization.serializers;
import org.apereo.cas.ticket.TicketGrantingTicketImpl;
import org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer;
/**
* This is {@link TicketGrantingTicketStringSerializer}.
*
* @author Misagh Moayyed
* @since 6.1.0
*/
public class TicketGrantingTicketStringSerializer extends AbstractJacksonBackedStringSerializer<TicketGrantingTicketImpl> {
private static final long serialVersionUID = 1527874389457723545L;
public TicketGrantingTicketStringSerializer() {
super(MINIMAL_PRETTY_PRINTER);
}
@Override
public Class<TicketGrantingTicketImpl> getTypeToSerialize() {
return TicketGrantingTicketImpl.class;
}
}
| {
"pile_set_name": "Github"
} |
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = ""
styles = {
# No corresponding class for the following:
#Text: "", # class: ''
Whitespace: "underline #f8f8f8", # class: 'w'
Error: "#a40000 border:#ef2929", # class: 'err'
Other: "#000000", # class 'x'
Comment: "italic #8f5902", # class: 'c'
Comment.Preproc: "noitalic", # class: 'cp'
Keyword: "bold #004461", # class: 'k'
Keyword.Constant: "bold #004461", # class: 'kc'
Keyword.Declaration: "bold #004461", # class: 'kd'
Keyword.Namespace: "bold #004461", # class: 'kn'
Keyword.Pseudo: "bold #004461", # class: 'kp'
Keyword.Reserved: "bold #004461", # class: 'kr'
Keyword.Type: "bold #004461", # class: 'kt'
Operator: "#582800", # class: 'o'
Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
# because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables.
Name: "#000000", # class: 'n'
Name.Attribute: "#c4a000", # class: 'na' - to be revised
Name.Builtin: "#004461", # class: 'nb'
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
Name.Class: "#000000", # class: 'nc' - to be revised
Name.Constant: "#000000", # class: 'no' - to be revised
Name.Decorator: "#888", # class: 'nd' - to be revised
Name.Entity: "#ce5c00", # class: 'ni'
Name.Exception: "bold #cc0000", # class: 'ne'
Name.Function: "#000000", # class: 'nf'
Name.Property: "#000000", # class: 'py'
Name.Label: "#f57900", # class: 'nl'
Name.Namespace: "#000000", # class: 'nn' - to be revised
Name.Other: "#000000", # class: 'nx'
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
Name.Variable: "#000000", # class: 'nv' - to be revised
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
Number: "#990000", # class: 'm'
Literal: "#000000", # class: 'l'
Literal.Date: "#000000", # class: 'ld'
String: "#4e9a06", # class: 's'
String.Backtick: "#4e9a06", # class: 'sb'
String.Char: "#4e9a06", # class: 'sc'
String.Doc: "italic #8f5902", # class: 'sd' - like a comment
String.Double: "#4e9a06", # class: 's2'
String.Escape: "#4e9a06", # class: 'se'
String.Heredoc: "#4e9a06", # class: 'sh'
String.Interpol: "#4e9a06", # class: 'si'
String.Other: "#4e9a06", # class: 'sx'
String.Regex: "#4e9a06", # class: 'sr'
String.Single: "#4e9a06", # class: 's1'
String.Symbol: "#4e9a06", # class: 'ss'
Generic: "#000000", # class: 'g'
Generic.Deleted: "#a40000", # class: 'gd'
Generic.Emph: "italic #000000", # class: 'ge'
Generic.Error: "#ef2929", # class: 'gr'
Generic.Heading: "bold #000080", # class: 'gh'
Generic.Inserted: "#00A000", # class: 'gi'
Generic.Output: "#888", # class: 'go'
Generic.Prompt: "#745334", # class: 'gp'
Generic.Strong: "bold #000000", # class: 'gs'
Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Traceback: "bold #a40000", # class: 'gt'
}
| {
"pile_set_name": "Github"
} |
tvheadend: remove -Werror from CFLAGS
Signed-off-by: Vicente Olivert Riera <[email protected]>
--- tvheadend-2b649954346aa2e9c81834d500a25c528f31f829/Makefile.orig 2013-11-28 15:52:52.284041848 +0000
+++ tvheadend-2b649954346aa2e9c81834d500a25c528f31f829/Makefile 2013-11-28 15:53:03.715220194 +0000
@@ -27,7 +27,7 @@ PROG := $(BUILDDIR)/tvheadend
# Common compiler flags
#
-CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations
+CFLAGS += -Wall -Wwrite-strings -Wno-deprecated-declarations
CFLAGS += -Wmissing-prototypes -fms-extensions
CFLAGS += -g -funsigned-char -O2
CFLAGS += -D_FILE_OFFSET_BITS=64
| {
"pile_set_name": "Github"
} |
# Dale
[Previous](./3-1-cerrno.md) | [Next](./3-3-clocale.md)
## 3.2 cfloat
### Details
Module: cfloat
### Description
Provides the following floating-point macro constants:
* FLT-RADIX
* FLT-ROUNDS
* FLT-DIG
* FLT-EPSILON
* FLT-MANT-DIG
* FLT-MAX
* FLT-MAX-EXP
* FLT-MIN
* FLT-MIN-EXP
* DBL-DIG
* DBL-EPSILON
* DBL-MANT-DIG
* DBL-MAX
* DBL-MAX-EXP
* DBL-MIN
* DBL-MIN-EXP
* LDBL-DIG
* LDBL-EPSILON
* LDBL-MANT-DIG
* LDBL-MAX
* LDBL-MAX-EXP
* LDBL-MIN
* LDBL-MIN-EXP
[Previous](./3-1-cerrno.md) | [Next](./3-3-clocale.md)
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 2c760cb7073c57e44959f36cbed8ed39
timeCreated: 1486510400
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
{"text": ["$", "sre", "for", "exports", "and", "oil", ",", "you", "can't", "beat", "texas", "URL"], "created_at": "Sun Feb 23 22:03:19 +0000 2014", "user_id_str": "2340653396"}
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Filename: target_core_iblock.c
*
* This file contains the Storage Engine <-> Linux BlockIO transport
* specific functions.
*
* Copyright (c) 2003, 2004, 2005 PyX Technologies, Inc.
* Copyright (c) 2005, 2006, 2007 SBE, Inc.
* Copyright (c) 2007-2010 Rising Tide Systems
* Copyright (c) 2008-2010 Linux-iSCSI.org
*
* Nicholas A. Bellinger <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
******************************************************************************/
#include <linux/string.h>
#include <linux/parser.h>
#include <linux/timer.h>
#include <linux/fs.h>
#include <linux/blkdev.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/bio.h>
#include <linux/genhd.h>
#include <linux/file.h>
#include <linux/module.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <target/target_core_base.h>
#include <target/target_core_backend.h>
#include "target_core_iblock.h"
#define IBLOCK_MAX_BIO_PER_TASK 32 /* max # of bios to submit at a time */
#define IBLOCK_BIO_POOL_SIZE 128
static struct se_subsystem_api iblock_template;
static void iblock_bio_done(struct bio *, int);
/* iblock_attach_hba(): (Part of se_subsystem_api_t template)
*
*
*/
static int iblock_attach_hba(struct se_hba *hba, u32 host_id)
{
pr_debug("CORE_HBA[%d] - TCM iBlock HBA Driver %s on"
" Generic Target Core Stack %s\n", hba->hba_id,
IBLOCK_VERSION, TARGET_CORE_MOD_VERSION);
return 0;
}
static void iblock_detach_hba(struct se_hba *hba)
{
}
static void *iblock_allocate_virtdevice(struct se_hba *hba, const char *name)
{
struct iblock_dev *ib_dev = NULL;
ib_dev = kzalloc(sizeof(struct iblock_dev), GFP_KERNEL);
if (!ib_dev) {
pr_err("Unable to allocate struct iblock_dev\n");
return NULL;
}
pr_debug( "IBLOCK: Allocated ib_dev for %s\n", name);
return ib_dev;
}
static struct se_device *iblock_create_virtdevice(
struct se_hba *hba,
struct se_subsystem_dev *se_dev,
void *p)
{
struct iblock_dev *ib_dev = p;
struct se_device *dev;
struct se_dev_limits dev_limits;
struct block_device *bd = NULL;
struct request_queue *q;
struct queue_limits *limits;
u32 dev_flags = 0;
int ret = -EINVAL;
if (!ib_dev) {
pr_err("Unable to locate struct iblock_dev parameter\n");
return ERR_PTR(ret);
}
memset(&dev_limits, 0, sizeof(struct se_dev_limits));
ib_dev->ibd_bio_set = bioset_create(IBLOCK_BIO_POOL_SIZE, 0);
if (!ib_dev->ibd_bio_set) {
pr_err("IBLOCK: Unable to create bioset()\n");
return ERR_PTR(-ENOMEM);
}
pr_debug("IBLOCK: Created bio_set()\n");
/*
* iblock_check_configfs_dev_params() ensures that ib_dev->ibd_udev_path
* must already have been set in order for echo 1 > $HBA/$DEV/enable to run.
*/
pr_debug( "IBLOCK: Claiming struct block_device: %s\n",
ib_dev->ibd_udev_path);
bd = blkdev_get_by_path(ib_dev->ibd_udev_path,
FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev);
if (IS_ERR(bd)) {
ret = PTR_ERR(bd);
goto failed;
}
/*
* Setup the local scope queue_limits from struct request_queue->limits
* to pass into transport_add_device_to_core_hba() as struct se_dev_limits.
*/
q = bdev_get_queue(bd);
limits = &dev_limits.limits;
limits->logical_block_size = bdev_logical_block_size(bd);
limits->max_hw_sectors = UINT_MAX;
limits->max_sectors = UINT_MAX;
dev_limits.hw_queue_depth = q->nr_requests;
dev_limits.queue_depth = q->nr_requests;
ib_dev->ibd_bd = bd;
dev = transport_add_device_to_core_hba(hba,
&iblock_template, se_dev, dev_flags, ib_dev,
&dev_limits, "IBLOCK", IBLOCK_VERSION);
if (!dev)
goto failed;
/*
* Check if the underlying struct block_device request_queue supports
* the QUEUE_FLAG_DISCARD bit for UNMAP/WRITE_SAME in SCSI + TRIM
* in ATA and we need to set TPE=1
*/
if (blk_queue_discard(q)) {
dev->se_sub_dev->se_dev_attrib.max_unmap_lba_count =
q->limits.max_discard_sectors;
/*
* Currently hardcoded to 1 in Linux/SCSI code..
*/
dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count = 1;
dev->se_sub_dev->se_dev_attrib.unmap_granularity =
q->limits.discard_granularity >> 9;
dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment =
q->limits.discard_alignment;
pr_debug("IBLOCK: BLOCK Discard support available,"
" disabled by default\n");
}
if (blk_queue_nonrot(q))
dev->se_sub_dev->se_dev_attrib.is_nonrot = 1;
return dev;
failed:
if (ib_dev->ibd_bio_set) {
bioset_free(ib_dev->ibd_bio_set);
ib_dev->ibd_bio_set = NULL;
}
ib_dev->ibd_bd = NULL;
return ERR_PTR(ret);
}
static void iblock_free_device(void *p)
{
struct iblock_dev *ib_dev = p;
if (ib_dev->ibd_bd != NULL)
blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL);
if (ib_dev->ibd_bio_set != NULL)
bioset_free(ib_dev->ibd_bio_set);
kfree(ib_dev);
}
static inline struct iblock_req *IBLOCK_REQ(struct se_task *task)
{
return container_of(task, struct iblock_req, ib_task);
}
static struct se_task *
iblock_alloc_task(unsigned char *cdb)
{
struct iblock_req *ib_req;
ib_req = kzalloc(sizeof(struct iblock_req), GFP_KERNEL);
if (!ib_req) {
pr_err("Unable to allocate memory for struct iblock_req\n");
return NULL;
}
atomic_set(&ib_req->pending, 1);
return &ib_req->ib_task;
}
static unsigned long long iblock_emulate_read_cap_with_block_size(
struct se_device *dev,
struct block_device *bd,
struct request_queue *q)
{
unsigned long long blocks_long = (div_u64(i_size_read(bd->bd_inode),
bdev_logical_block_size(bd)) - 1);
u32 block_size = bdev_logical_block_size(bd);
if (block_size == dev->se_sub_dev->se_dev_attrib.block_size)
return blocks_long;
switch (block_size) {
case 4096:
switch (dev->se_sub_dev->se_dev_attrib.block_size) {
case 2048:
blocks_long <<= 1;
break;
case 1024:
blocks_long <<= 2;
break;
case 512:
blocks_long <<= 3;
default:
break;
}
break;
case 2048:
switch (dev->se_sub_dev->se_dev_attrib.block_size) {
case 4096:
blocks_long >>= 1;
break;
case 1024:
blocks_long <<= 1;
break;
case 512:
blocks_long <<= 2;
break;
default:
break;
}
break;
case 1024:
switch (dev->se_sub_dev->se_dev_attrib.block_size) {
case 4096:
blocks_long >>= 2;
break;
case 2048:
blocks_long >>= 1;
break;
case 512:
blocks_long <<= 1;
break;
default:
break;
}
break;
case 512:
switch (dev->se_sub_dev->se_dev_attrib.block_size) {
case 4096:
blocks_long >>= 3;
break;
case 2048:
blocks_long >>= 2;
break;
case 1024:
blocks_long >>= 1;
break;
default:
break;
}
break;
default:
break;
}
return blocks_long;
}
static void iblock_end_io_flush(struct bio *bio, int err)
{
struct se_cmd *cmd = bio->bi_private;
if (err)
pr_err("IBLOCK: cache flush failed: %d\n", err);
if (cmd)
transport_complete_sync_cache(cmd, err == 0);
bio_put(bio);
}
/*
* Implement SYCHRONIZE CACHE. Note that we can't handle lba ranges and must
* always flush the whole cache.
*/
static void iblock_emulate_sync_cache(struct se_task *task)
{
struct se_cmd *cmd = task->task_se_cmd;
struct iblock_dev *ib_dev = cmd->se_dev->dev_ptr;
int immed = (cmd->t_task_cdb[1] & 0x2);
struct bio *bio;
/*
* If the Immediate bit is set, queue up the GOOD response
* for this SYNCHRONIZE_CACHE op.
*/
if (immed)
transport_complete_sync_cache(cmd, 1);
bio = bio_alloc(GFP_KERNEL, 0);
bio->bi_end_io = iblock_end_io_flush;
bio->bi_bdev = ib_dev->ibd_bd;
if (!immed)
bio->bi_private = cmd;
submit_bio(WRITE_FLUSH, bio);
}
static int iblock_do_discard(struct se_device *dev, sector_t lba, u32 range)
{
struct iblock_dev *ibd = dev->dev_ptr;
struct block_device *bd = ibd->ibd_bd;
int barrier = 0;
return blkdev_issue_discard(bd, lba, range, GFP_KERNEL, barrier);
}
static void iblock_free_task(struct se_task *task)
{
kfree(IBLOCK_REQ(task));
}
enum {
Opt_udev_path, Opt_force, Opt_err
};
static match_table_t tokens = {
{Opt_udev_path, "udev_path=%s"},
{Opt_force, "force=%d"},
{Opt_err, NULL}
};
static ssize_t iblock_set_configfs_dev_params(struct se_hba *hba,
struct se_subsystem_dev *se_dev,
const char *page, ssize_t count)
{
struct iblock_dev *ib_dev = se_dev->se_dev_su_ptr;
char *orig, *ptr, *arg_p, *opts;
substring_t args[MAX_OPT_ARGS];
int ret = 0, token;
opts = kstrdup(page, GFP_KERNEL);
if (!opts)
return -ENOMEM;
orig = opts;
while ((ptr = strsep(&opts, ",\n")) != NULL) {
if (!*ptr)
continue;
token = match_token(ptr, tokens, args);
switch (token) {
case Opt_udev_path:
if (ib_dev->ibd_bd) {
pr_err("Unable to set udev_path= while"
" ib_dev->ibd_bd exists\n");
ret = -EEXIST;
goto out;
}
arg_p = match_strdup(&args[0]);
if (!arg_p) {
ret = -ENOMEM;
break;
}
snprintf(ib_dev->ibd_udev_path, SE_UDEV_PATH_LEN,
"%s", arg_p);
kfree(arg_p);
pr_debug("IBLOCK: Referencing UDEV path: %s\n",
ib_dev->ibd_udev_path);
ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH;
break;
case Opt_force:
break;
default:
break;
}
}
out:
kfree(orig);
return (!ret) ? count : ret;
}
static ssize_t iblock_check_configfs_dev_params(
struct se_hba *hba,
struct se_subsystem_dev *se_dev)
{
struct iblock_dev *ibd = se_dev->se_dev_su_ptr;
if (!(ibd->ibd_flags & IBDF_HAS_UDEV_PATH)) {
pr_err("Missing udev_path= parameters for IBLOCK\n");
return -EINVAL;
}
return 0;
}
static ssize_t iblock_show_configfs_dev_params(
struct se_hba *hba,
struct se_subsystem_dev *se_dev,
char *b)
{
struct iblock_dev *ibd = se_dev->se_dev_su_ptr;
struct block_device *bd = ibd->ibd_bd;
char buf[BDEVNAME_SIZE];
ssize_t bl = 0;
if (bd)
bl += sprintf(b + bl, "iBlock device: %s",
bdevname(bd, buf));
if (ibd->ibd_flags & IBDF_HAS_UDEV_PATH) {
bl += sprintf(b + bl, " UDEV PATH: %s\n",
ibd->ibd_udev_path);
} else
bl += sprintf(b + bl, "\n");
bl += sprintf(b + bl, " ");
if (bd) {
bl += sprintf(b + bl, "Major: %d Minor: %d %s\n",
MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ?
"" : (bd->bd_holder == ibd) ?
"CLAIMED: IBLOCK" : "CLAIMED: OS");
} else {
bl += sprintf(b + bl, "Major: 0 Minor: 0\n");
}
return bl;
}
static void iblock_bio_destructor(struct bio *bio)
{
struct se_task *task = bio->bi_private;
struct iblock_dev *ib_dev = task->task_se_cmd->se_dev->dev_ptr;
bio_free(bio, ib_dev->ibd_bio_set);
}
static struct bio *
iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num)
{
struct iblock_dev *ib_dev = task->task_se_cmd->se_dev->dev_ptr;
struct iblock_req *ib_req = IBLOCK_REQ(task);
struct bio *bio;
/*
* Only allocate as many vector entries as the bio code allows us to,
* we'll loop later on until we have handled the whole request.
*/
if (sg_num > BIO_MAX_PAGES)
sg_num = BIO_MAX_PAGES;
bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set);
if (!bio) {
pr_err("Unable to allocate memory for bio\n");
return NULL;
}
pr_debug("Allocated bio: %p task_sg_nents: %u using ibd_bio_set:"
" %p\n", bio, task->task_sg_nents, ib_dev->ibd_bio_set);
pr_debug("Allocated bio: %p task_size: %u\n", bio, task->task_size);
bio->bi_bdev = ib_dev->ibd_bd;
bio->bi_private = task;
bio->bi_destructor = iblock_bio_destructor;
bio->bi_end_io = &iblock_bio_done;
bio->bi_sector = lba;
atomic_inc(&ib_req->pending);
pr_debug("Set bio->bi_sector: %llu\n", (unsigned long long)bio->bi_sector);
pr_debug("Set ib_req->pending: %d\n", atomic_read(&ib_req->pending));
return bio;
}
static void iblock_submit_bios(struct bio_list *list, int rw)
{
struct blk_plug plug;
struct bio *bio;
blk_start_plug(&plug);
while ((bio = bio_list_pop(list)))
submit_bio(rw, bio);
blk_finish_plug(&plug);
}
static int iblock_do_task(struct se_task *task)
{
struct se_cmd *cmd = task->task_se_cmd;
struct se_device *dev = cmd->se_dev;
struct iblock_req *ibr = IBLOCK_REQ(task);
struct bio *bio;
struct bio_list list;
struct scatterlist *sg;
u32 i, sg_num = task->task_sg_nents;
sector_t block_lba;
unsigned bio_cnt;
int rw;
if (task->task_data_direction == DMA_TO_DEVICE) {
/*
* Force data to disk if we pretend to not have a volatile
* write cache, or the initiator set the Force Unit Access bit.
*/
if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache == 0 ||
(dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 &&
(cmd->se_cmd_flags & SCF_FUA)))
rw = WRITE_FUA;
else
rw = WRITE;
} else {
rw = READ;
}
/*
* Do starting conversion up from non 512-byte blocksize with
* struct se_task SCSI blocksize into Linux/Block 512 units for BIO.
*/
if (dev->se_sub_dev->se_dev_attrib.block_size == 4096)
block_lba = (task->task_lba << 3);
else if (dev->se_sub_dev->se_dev_attrib.block_size == 2048)
block_lba = (task->task_lba << 2);
else if (dev->se_sub_dev->se_dev_attrib.block_size == 1024)
block_lba = (task->task_lba << 1);
else if (dev->se_sub_dev->se_dev_attrib.block_size == 512)
block_lba = task->task_lba;
else {
pr_err("Unsupported SCSI -> BLOCK LBA conversion:"
" %u\n", dev->se_sub_dev->se_dev_attrib.block_size);
cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOSYS;
}
bio = iblock_get_bio(task, block_lba, sg_num);
if (!bio) {
cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOMEM;
}
bio_list_init(&list);
bio_list_add(&list, bio);
bio_cnt = 1;
for_each_sg(task->task_sg, sg, task->task_sg_nents, i) {
/*
* XXX: if the length the device accepts is shorter than the
* length of the S/G list entry this will cause and
* endless loop. Better hope no driver uses huge pages.
*/
while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
!= sg->length) {
if (bio_cnt >= IBLOCK_MAX_BIO_PER_TASK) {
iblock_submit_bios(&list, rw);
bio_cnt = 0;
}
bio = iblock_get_bio(task, block_lba, sg_num);
if (!bio)
goto fail;
bio_list_add(&list, bio);
bio_cnt++;
}
/* Always in 512 byte units for Linux/Block */
block_lba += sg->length >> IBLOCK_LBA_SHIFT;
sg_num--;
}
iblock_submit_bios(&list, rw);
if (atomic_dec_and_test(&ibr->pending)) {
transport_complete_task(task,
!atomic_read(&ibr->ib_bio_err_cnt));
}
return 0;
fail:
while ((bio = bio_list_pop(&list)))
bio_put(bio);
cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
return -ENOMEM;
}
static u32 iblock_get_device_rev(struct se_device *dev)
{
return SCSI_SPC_2; /* Returns SPC-3 in Initiator Data */
}
static u32 iblock_get_device_type(struct se_device *dev)
{
return TYPE_DISK;
}
static sector_t iblock_get_blocks(struct se_device *dev)
{
struct iblock_dev *ibd = dev->dev_ptr;
struct block_device *bd = ibd->ibd_bd;
struct request_queue *q = bdev_get_queue(bd);
return iblock_emulate_read_cap_with_block_size(dev, bd, q);
}
static void iblock_bio_done(struct bio *bio, int err)
{
struct se_task *task = bio->bi_private;
struct iblock_req *ibr = IBLOCK_REQ(task);
/*
* Set -EIO if !BIO_UPTODATE and the passed is still err=0
*/
if (!test_bit(BIO_UPTODATE, &bio->bi_flags) && !err)
err = -EIO;
if (err != 0) {
pr_err("test_bit(BIO_UPTODATE) failed for bio: %p,"
" err: %d\n", bio, err);
/*
* Bump the ib_bio_err_cnt and release bio.
*/
atomic_inc(&ibr->ib_bio_err_cnt);
smp_mb__after_atomic_inc();
}
bio_put(bio);
if (!atomic_dec_and_test(&ibr->pending))
return;
pr_debug("done[%p] bio: %p task_lba: %llu bio_lba: %llu err=%d\n",
task, bio, task->task_lba,
(unsigned long long)bio->bi_sector, err);
transport_complete_task(task, !atomic_read(&ibr->ib_bio_err_cnt));
}
static struct se_subsystem_api iblock_template = {
.name = "iblock",
.owner = THIS_MODULE,
.transport_type = TRANSPORT_PLUGIN_VHBA_PDEV,
.write_cache_emulated = 1,
.fua_write_emulated = 1,
.attach_hba = iblock_attach_hba,
.detach_hba = iblock_detach_hba,
.allocate_virtdevice = iblock_allocate_virtdevice,
.create_virtdevice = iblock_create_virtdevice,
.free_device = iblock_free_device,
.alloc_task = iblock_alloc_task,
.do_task = iblock_do_task,
.do_discard = iblock_do_discard,
.do_sync_cache = iblock_emulate_sync_cache,
.free_task = iblock_free_task,
.check_configfs_dev_params = iblock_check_configfs_dev_params,
.set_configfs_dev_params = iblock_set_configfs_dev_params,
.show_configfs_dev_params = iblock_show_configfs_dev_params,
.get_device_rev = iblock_get_device_rev,
.get_device_type = iblock_get_device_type,
.get_blocks = iblock_get_blocks,
};
static int __init iblock_module_init(void)
{
return transport_subsystem_register(&iblock_template);
}
static void iblock_module_exit(void)
{
transport_subsystem_release(&iblock_template);
}
MODULE_DESCRIPTION("TCM IBLOCK subsystem plugin");
MODULE_AUTHOR("[email protected]");
MODULE_LICENSE("GPL");
module_init(iblock_module_init);
module_exit(iblock_module_exit);
| {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2003 Hartmut Kaiser
http://spirit.sourceforge.net/
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_SELECT_IPP
#define BOOST_SPIRIT_SELECT_IPP
#include <boost/spirit/home/classic/core/parser.hpp>
#include <boost/spirit/home/classic/core/composite/composite.hpp>
#include <boost/spirit/home/classic/meta/as_parser.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
///////////////////////////////////////////////////////////////////////////////
namespace impl {
///////////////////////////////////////////////////////////////////////////////
template <typename ParserT>
struct as_embedded_parser : public as_parser<ParserT>
{
typedef typename as_parser<ParserT>::type::derived_t::embed_t type;
};
///////////////////////////////////////////////////////////////////////////////
// no implementation here to catch unknown BehaviourT template arguments
template <typename ResultT, typename BehaviourT>
struct select_match_gen;
// implementation for the select_default_no_fail behaviour
template <typename ResultT>
struct select_match_gen<ResultT, select_default_no_fail> {
template <typename ScannerT>
static ResultT
do_ (ScannerT const &scan)
{
return scan.create_match(0, -1, scan.first, scan.first);
}
};
// implementation for the select_default_fail behaviour
template <typename ResultT>
struct select_match_gen<ResultT, select_default_fail> {
template <typename ScannerT>
static ResultT
do_ (ScannerT const &scan)
{
return scan.no_match();
}
};
///////////////////////////////////////////////////////////////////////////////
template <int N, typename ResultT, typename TupleT, typename BehaviourT>
struct parse_tuple_element {
BOOST_STATIC_CONSTANT(int, index = (TupleT::length - N));
template <typename ScannerT>
static ResultT
do_(TupleT const &t, ScannerT const &scan)
{
typedef typename ::phoenix::tuple_element<index, TupleT>::type parser_t;
typedef typename ScannerT::iterator_t iterator_t;
typedef typename parser_result<parser_t, ScannerT>::type result_t;
iterator_t save(scan.first);
result_t result(t[::phoenix::tuple_index<index>()].parse(scan));
if (result) {
return scan.create_match(result.length(), TupleT::length - N,
save, scan.first);
}
scan.first = save; // reset the input stream
return parse_tuple_element<N-1, ResultT, TupleT, BehaviourT>::
do_(t, scan);
}
};
template <typename ResultT, typename TupleT, typename BehaviourT>
struct parse_tuple_element<1, ResultT, TupleT, BehaviourT> {
BOOST_STATIC_CONSTANT(int, index = (TupleT::length - 1));
template <typename ScannerT>
static ResultT
do_(TupleT const &t, ScannerT const &scan)
{
typedef typename ::phoenix::tuple_element<index, TupleT>::type parser_t;
typedef typename ScannerT::iterator_t iterator_t;
typedef typename parser_result<parser_t, ScannerT>::type result_t;
iterator_t save(scan.first);
result_t result(t[::phoenix::tuple_index<index>()].parse(scan));
if (result) {
return scan.create_match(result.length(), TupleT::length - 1,
save, scan.first);
}
scan.first = save; // reset the input stream
return select_match_gen<ResultT, BehaviourT>::do_(scan);
}
};
///////////////////////////////////////////////////////////////////////////////
} // namespace impl
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace boost::spirit
#endif // BOOST_SPIRIT_SELECT_IPP
| {
"pile_set_name": "Github"
} |
# language: ru
@IgnoreOnCIMainBuild
Функционал: Тестовая фича, проверяющая работу снятия скриншотов
Сценарий: Этот сценарий содержит ошибку во втором шаге
Когда без ошибок выполнился первый шаг
И при выполнении второго шага возникла ошибка
И этот шаг даже не будет выполнятся | {
"pile_set_name": "Github"
} |
#import "Expecta.h"
EXPMatcherInterface(endWith, (id expected));
| {
"pile_set_name": "Github"
} |
{
"url": "${url}",
"search": "${url.search}",
"query": "${url.query}",
"queryValue": "${url.query.name}",
"host": "${url.host}",
"hostname": "${url.hostname}",
"path": "${url.path}",
"pathname": "${url.pathname}",
"reqId": "${reqId}",
"now": ${now},
"method": "${method}",
"xff": "${reqHeaders.x-forwarded-for}",
"other": "${reqHeaders.other}",
"cookie": "${reqCookie}",
"cookieValue": "${reqCookie.cookieName}",
"clientIp": "${clientIp}",
"statusCode": "${statusCode}",
"serverIp": "${serverIp}",
"resHeaderValue": "${resHeaders.x-res-header-name}",
"resCookieValue": "${resCookie.res_cookie_name}"
} | {
"pile_set_name": "Github"
} |
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang("devtools","ar",{title:"معلومات العنصر",dialogName:"إسم نافذة الحوار",tabName:"إسم التبويب",elementId:"إسم العنصر",elementType:"نوع العنصر"}); | {
"pile_set_name": "Github"
} |
{
"rules": {
"align": [true,
"parameters",
"statements"
],
"arrow-parens": true,
"class-name": true,
"curly": true,
"eofline": true,
"indent": [true, "spaces", 4],
"label-position": true,
"max-line-length": [false, 160],
"no-arg": true,
"no-bitwise": true,
"no-console": [true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-consecutive-blank-lines": true,
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
"no-null-keyword": false,
"no-string-literal": false,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-var-keyword": true,
"one-line": [true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"one-variable-per-declaration": true,
"quotemark": [true, "single", "avoid-escape"],
"radix": false,
"semicolon": true,
"trailing-comma": [false, { "multiline": "never", "singleline": "never" }],
"variable-name": [true,
"allow-leading-underscore",
"ban-keywords"
],
"whitespace": [true,
"check-branch",
"check-decl",
"check-operator",
"check-separator"
]
}
}
| {
"pile_set_name": "Github"
} |
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/tips.css">
</head>
<body>
<h1>SecondSmartCompletionChain(第二次智能补全链式) <a href='https://www.pingfangx.com/xx/translation/feedback?from=tips'>[汉化反馈]</a></h1>
<p>调用智能类型补全后,按下相同的快捷方式,将搜索具有预期类型的链式表达式。</p>
<p class="image"><img src="images/chain_after.png"></p>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?php namespace Zizaco\Confide;
use Mockery as m;
use PHPUnit_Framework_TestCase;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ControllerCommandTest extends PHPUnit_Framework_TestCase
{
/**
* ConfideRepository instance
*
* @var Zizaco\Confide\ConfideRepository
*/
protected $repo;
/**
* Calls Mockery::close
*/
public function tearDown()
{
m::close();
}
public function testSouldGetOptions()
{
/*
|------------------------------------------------------------
| Set
|------------------------------------------------------------
*/
$config = m::mock('Config');
$app = ['config'=>$config];
$command = m::mock('Zizaco\Confide\ControllerCommand', [$app]);
$options = [
['name', null, InputOption::VALUE_OPTIONAL, 'Name of the controller.', 'Users'],
['--restful', '-r', InputOption::VALUE_NONE, 'Generate RESTful controller.'],
['username', null, InputOption::VALUE_NONE, 'Includes username as a required parameter.']
];
/*
|------------------------------------------------------------
| Assertion
|------------------------------------------------------------
*/
$this->assertEquals($options, $command->getOptions());
}
public function testSouldFire()
{
/*
|------------------------------------------------------------
| Set
|------------------------------------------------------------
*/
$config = m::mock('Config');
$app = ['config'=>$config];
$command = m::mock('Zizaco\Confide\ControllerCommand', [$app]);
$command->shouldAllowMockingProtectedMethods();
$viewVars = [
'class' => "UsersController",
'namespace' => "The\\Namespace",
'model' => "User",
'restful' => true,
'includeUsername' => true
];
/*
|------------------------------------------------------------
| Expectation
|------------------------------------------------------------
*/
$command->shouldReceive('getControllerName')
->once()->with('The\\Namespace\\Users')
->andReturn('UsersController');
$command->shouldReceive('getNamespace')
->once()->with('The\\Namespace\\Users')
->andReturn('The\\Namespace');
$config->shouldReceive('get')
->once()->with('auth.model')
->andReturn('User');
$command->shouldReceive('option')
->twice()->with('name')
->andReturn('The\\Namespace\\Users');
$command->shouldReceive('option')
->once()->with('restful')
->andReturn(true);
$command->shouldReceive('option')
->once()->with('username')
->andReturn(true);
$command->shouldReceive('fire')
->passthru();
$command->shouldReceive('line', 'info', 'comment', 'confirm')
->andReturn(true);
$command->shouldReceive('generateFile')
->once()->with(
'controllers/The/Namespace/UsersController.php',
'generators.controller',
$viewVars
)
->andReturn(true);
$command->shouldReceive('generateFile')
->once()->with(
'models/UserRepository.php',
'generators.repository',
$viewVars
)
->andReturn(true);
/*
|------------------------------------------------------------
| Assertion
|------------------------------------------------------------
*/
$command->fire();
}
public function testSouldGetControlerName()
{
/*
|------------------------------------------------------------
| Set
|------------------------------------------------------------
*/
$app = [];
$command = m::mock('Zizaco\Confide\ControllerCommand', [$app]);
$command->shouldAllowMockingProtectedMethods();
/*
|------------------------------------------------------------
| Expectation
|------------------------------------------------------------
*/
$command->shouldReceive('getControllerName')
->passthru();
/*
|------------------------------------------------------------
| Assertion
|------------------------------------------------------------
*/
$this->assertEquals(
'UsersController',
$command->getControllerName('Users')
);
$this->assertEquals(
'UsersController',
$command->getControllerName('UsersController')
);
$this->assertEquals(
'SomethingController',
$command->getControllerName('Some\Namespace\Something')
);
$this->assertEquals(
'CamelCaseController',
$command->getControllerName('Some\Thing\CamelCase')
);
}
public function testSouldGetNamespace()
{
/*
|------------------------------------------------------------
| Set
|------------------------------------------------------------
*/
$app = [];
$command = m::mock('Zizaco\Confide\ControllerCommand', [$app]);
$command->shouldAllowMockingProtectedMethods();
/*
|------------------------------------------------------------
| Expectation
|------------------------------------------------------------
*/
$command->shouldReceive('getNamespace')
->passthru();
/*
|------------------------------------------------------------
| Assertion
|------------------------------------------------------------
*/
$this->assertEquals(
'Some\Namespace',
$command->getNamespace('Some\Namespace\Something')
);
$this->assertEquals(
'Some\Thing',
$command->getNamespace('Some\Thing\Resource')
);
$this->assertEquals(
'',
$command->getNamespace('Users')
);
}
}
| {
"pile_set_name": "Github"
} |
package if;
$VERSION = '0.05';
sub work {
my $method = shift() ? 'import' : 'unimport';
die "Too few arguments to `use if' (some code returning an empty list in list context?)"
unless @_ >= 2;
return unless shift; # CONDITION
my $p = $_[0]; # PACKAGE
(my $file = "$p.pm") =~ s!::!/!g;
require $file; # Works even if $_[0] is a keyword (like open)
my $m = $p->can($method);
goto &$m if $m;
}
sub import { shift; unshift @_, 1; goto &work }
sub unimport { shift; unshift @_, 0; goto &work }
1;
__END__
=head1 NAME
if - C<use> a Perl module if a condition holds
=head1 SYNOPSIS
use if CONDITION, MODULE => ARGUMENTS;
=head1 DESCRIPTION
The construct
use if CONDITION, MODULE => ARGUMENTS;
has no effect unless C<CONDITION> is true. In this case the effect is
the same as of
use MODULE ARGUMENTS;
Above C<< => >> provides necessary quoting of C<MODULE>. If not used (e.g.,
no ARGUMENTS to give), you'd better quote C<MODULE> yourselves.
=head1 BUGS
The current implementation does not allow specification of the
required version of the module.
=head1 AUTHOR
Ilya Zakharevich L<mailto:[email protected]>.
=cut
| {
"pile_set_name": "Github"
} |
---
title: Policy CSPs supported by HoloLens (1st gen) Development Edition
description: Policy CSPs supported by HoloLens (1st gen) Development Edition
ms.reviewer:
manager: dansimp
ms.author: dansimp
ms.topic: article
ms.prod: w10
ms.technology: windows
author: manikadhiman
ms.localizationpriority: medium
ms.date: 07/18/2019
---
# Policy CSPs supported by HoloLens (1st gen) Development Edition
> [!div class="op_single_selector"]
>
> - [HoloLens 2](policy-csps-supported-by-hololens2.md)
> - [HoloLens (1st gen) Commercial Suite](policy-csps-supported-by-hololens-1st-gen-commercial-suite.md)
> - [HoloLens (1st gen) Development Edition](policy-csps-supported-by-hololens-1st-gen-development-edition.md)
>
- [Accounts/AllowMicrosoftAccountConnection](policy-csp-accounts.md#accounts-allowmicrosoftaccountconnection)
- [ApplicationManagement/AllowAppStoreAutoUpdate](policy-csp-applicationmanagement.md#applicationmanagement-allowappstoreautoupdate)
- [ApplicationManagement/AllowDeveloperUnlock](policy-csp-applicationmanagement.md#applicationmanagement-allowdeveloperunlock)
- [ApplicationManagement/AllowAllTrustedApps](policy-csp-applicationmanagement.md#applicationmanagement-allowalltrustedapps)
- [Authentication/AllowFastReconnect](policy-csp-authentication.md#authentication-allowfastreconnect)
- [Bluetooth/AllowAdvertising](policy-csp-bluetooth.md#bluetooth-allowadvertising)
- [Bluetooth/AllowDiscoverableMode](policy-csp-bluetooth.md#bluetooth-allowdiscoverablemode)
- [Bluetooth/LocalDeviceName](policy-csp-bluetooth.md#bluetooth-localdevicename)
- [Browser/AllowDoNotTrack](policy-csp-browser.md#browser-allowdonottrack)
- [Browser/AllowPasswordManager](policy-csp-browser.md#browser-allowpasswordmanager)
- [Browser/AllowPopups](policy-csp-browser.md#browser-allowpopups)
- [Browser/AllowSearchSuggestionsinAddressBar](policy-csp-browser.md#browser-allowsearchsuggestionsinaddressbar)
- [Browser/AllowSmartScreen](policy-csp-browser.md#browser-allowsmartscreen)
- [Browser/AllowCookies](policy-csp-browser.md#browser-allowcookies)
- [Connectivity/AllowBluetooth](policy-csp-connectivity.md#connectivity-allowbluetooth)
- [Connectivity/AllowUSBConnection](policy-csp-connectivity.md#connectivity-allowusbconnection)
- [DeviceLock/AllowSimpleDevicePassword](policy-csp-devicelock.md#devicelock-allowsimpledevicepassword)
- [DeviceLock/MaxDevicePasswordFailedAttempts](policy-csp-devicelock.md#devicelock-maxdevicepasswordfailedattempts)
- [DeviceLock/MaxInactivityTimeDeviceLock](policy-csp-devicelock.md#devicelock-maxinactivitytimedevicelock)
- [DeviceLock/MinDevicePasswordLength](policy-csp-devicelock.md#devicelock-mindevicepasswordlength)
- [DeviceLock/DevicePasswordHistory](policy-csp-devicelock.md#devicelock-devicepasswordhistory)
- [DeviceLock/AlphanumericDevicePasswordRequired](policy-csp-devicelock.md#devicelock-alphanumericdevicepasswordrequired)
- [DeviceLock/MinDevicePasswordComplexCharacters](policy-csp-devicelock.md#devicelock-mindevicepasswordcomplexcharacters)
- [DeviceLock/AllowIdleReturnWithoutPassword](policy-csp-devicelock.md#devicelock-allowidlereturnwithoutpassword)
- [DeviceLock/DevicePasswordEnabled](policy-csp-devicelock.md#devicelock-devicepasswordenabled)
- [Experience/AllowCortana](policy-csp-experience.md#experience-allowcortana)
- [Privacy/AllowInputPersonalization](policy-csp-privacy.md#privacy-allowinputpersonalization)
- [Search/AllowSearchToUseLocation](policy-csp-search.md#search-allowsearchtouselocation)
- [Security/RequireDeviceEncryption](policy-csp-security.md#security-requiredeviceencryption)
- [Settings/AllowDateTime](policy-csp-settings.md#settings-allowdatetime)
- [Settings/AllowVPN](policy-csp-settings.md#settings-allowvpn)
- [Speech/AllowSpeechModelUpdate](policy-csp-speech.md#speech-allowspeechmodelupdate)
- [System/AllowTelemetry](policy-csp-system.md#system-allowtelemetry)
- [System/AllowLocation](policy-csp-system.md#system-allowlocation)
- [Update/AllowAutoUpdate](policy-csp-update.md#update-allowautoupdate)
- [Update/AllowUpdateService](policy-csp-update.md#update-allowupdateservice)
- [Update/RequireUpdateApproval](policy-csp-update.md#update-requireupdateapproval)
- [Update/ScheduledInstallDay](policy-csp-update.md#update-scheduledinstallday)
- [Update/ScheduledInstallTime](policy-csp-update.md#update-scheduledinstalltime)
- [Update/UpdateServiceUrl](policy-csp-update.md#update-updateserviceurl)
- [Update/RequireDeferUpgrade](policy-csp-update.md#update-requiredeferupgrade)
- [Wifi/AllowManualWiFiConfiguration](policy-csp-wifi.md#wifi-allowmanualwificonfiguration)
## Related topics
[Policy CSP](policy-configuration-service-provider.md)
| {
"pile_set_name": "Github"
} |
package play.data.validation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import net.sf.oval.configuration.annotation.Constraint;
/**
* This field must be greater than.
* Message key: validation.min
* $1: field name
* $2: reference value
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Constraint(checkWith = MinCheck.class)
public @interface Min {
String message() default MinCheck.mes;
double value();
}
| {
"pile_set_name": "Github"
} |
<keyframes>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:00:000</time>
<value>0.149999976</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:10:413</time>
<value>0.199999988</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:17:679</time>
<value>0.274999976</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:19:748</time>
<value>0.600000024</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:21:023</time>
<value>0.699999988</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:22:712</time>
<value>0.274999976</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:24:032</time>
<value>0.250000000</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:32:977</time>
<value>0.074999988</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:39:200</time>
<value>0.425000012</value>
</key>
<key>
<easefunc>0</easefunc>
<easetype>0</easetype>
<time>00:00:44:854</time>
<value>0.149999976</value>
</key>
</keyframes>
| {
"pile_set_name": "Github"
} |
package dns
import (
"encoding/base32"
"encoding/base64"
"encoding/binary"
"encoding/hex"
"net"
"strings"
)
// helper functions called from the generated zmsg.go
// These function are named after the tag to help pack/unpack, if there is no tag it is the name
// of the type they pack/unpack (string, int, etc). We prefix all with unpackData or packData, so packDataA or
// packDataDomainName.
func unpackDataA(msg []byte, off int) (net.IP, int, error) {
if off+net.IPv4len > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking a"}
}
a := append(make(net.IP, 0, net.IPv4len), msg[off:off+net.IPv4len]...)
off += net.IPv4len
return a, off, nil
}
func packDataA(a net.IP, msg []byte, off int) (int, error) {
switch len(a) {
case net.IPv4len, net.IPv6len:
// It must be a slice of 4, even if it is 16, we encode only the first 4
if off+net.IPv4len > len(msg) {
return len(msg), &Error{err: "overflow packing a"}
}
copy(msg[off:], a.To4())
off += net.IPv4len
case 0:
// Allowed, for dynamic updates.
default:
return len(msg), &Error{err: "overflow packing a"}
}
return off, nil
}
func unpackDataAAAA(msg []byte, off int) (net.IP, int, error) {
if off+net.IPv6len > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking aaaa"}
}
aaaa := append(make(net.IP, 0, net.IPv6len), msg[off:off+net.IPv6len]...)
off += net.IPv6len
return aaaa, off, nil
}
func packDataAAAA(aaaa net.IP, msg []byte, off int) (int, error) {
switch len(aaaa) {
case net.IPv6len:
if off+net.IPv6len > len(msg) {
return len(msg), &Error{err: "overflow packing aaaa"}
}
copy(msg[off:], aaaa)
off += net.IPv6len
case 0:
// Allowed, dynamic updates.
default:
return len(msg), &Error{err: "overflow packing aaaa"}
}
return off, nil
}
// unpackHeader unpacks an RR header, returning the offset to the end of the header and a
// re-sliced msg according to the expected length of the RR.
func unpackHeader(msg []byte, off int) (rr RR_Header, off1 int, truncmsg []byte, err error) {
hdr := RR_Header{}
if off == len(msg) {
return hdr, off, msg, nil
}
hdr.Name, off, err = UnpackDomainName(msg, off)
if err != nil {
return hdr, len(msg), msg, err
}
hdr.Rrtype, off, err = unpackUint16(msg, off)
if err != nil {
return hdr, len(msg), msg, err
}
hdr.Class, off, err = unpackUint16(msg, off)
if err != nil {
return hdr, len(msg), msg, err
}
hdr.Ttl, off, err = unpackUint32(msg, off)
if err != nil {
return hdr, len(msg), msg, err
}
hdr.Rdlength, off, err = unpackUint16(msg, off)
if err != nil {
return hdr, len(msg), msg, err
}
msg, err = truncateMsgFromRdlength(msg, off, hdr.Rdlength)
return hdr, off, msg, err
}
// packHeader packs an RR header, returning the offset to the end of the header.
// See PackDomainName for documentation about the compression.
func (hdr RR_Header) packHeader(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
if off == len(msg) {
return off, nil
}
off, err := packDomainName(hdr.Name, msg, off, compression, compress)
if err != nil {
return len(msg), err
}
off, err = packUint16(hdr.Rrtype, msg, off)
if err != nil {
return len(msg), err
}
off, err = packUint16(hdr.Class, msg, off)
if err != nil {
return len(msg), err
}
off, err = packUint32(hdr.Ttl, msg, off)
if err != nil {
return len(msg), err
}
off, err = packUint16(0, msg, off) // The RDLENGTH field will be set later in packRR.
if err != nil {
return len(msg), err
}
return off, nil
}
// helper helper functions.
// truncateMsgFromRdLength truncates msg to match the expected length of the RR.
// Returns an error if msg is smaller than the expected size.
func truncateMsgFromRdlength(msg []byte, off int, rdlength uint16) (truncmsg []byte, err error) {
lenrd := off + int(rdlength)
if lenrd > len(msg) {
return msg, &Error{err: "overflowing header size"}
}
return msg[:lenrd], nil
}
var base32HexNoPadEncoding = base32.HexEncoding.WithPadding(base32.NoPadding)
func fromBase32(s []byte) (buf []byte, err error) {
for i, b := range s {
if b >= 'a' && b <= 'z' {
s[i] = b - 32
}
}
buflen := base32HexNoPadEncoding.DecodedLen(len(s))
buf = make([]byte, buflen)
n, err := base32HexNoPadEncoding.Decode(buf, s)
buf = buf[:n]
return
}
func toBase32(b []byte) string {
return base32HexNoPadEncoding.EncodeToString(b)
}
func fromBase64(s []byte) (buf []byte, err error) {
buflen := base64.StdEncoding.DecodedLen(len(s))
buf = make([]byte, buflen)
n, err := base64.StdEncoding.Decode(buf, s)
buf = buf[:n]
return
}
func toBase64(b []byte) string { return base64.StdEncoding.EncodeToString(b) }
// dynamicUpdate returns true if the Rdlength is zero.
func noRdata(h RR_Header) bool { return h.Rdlength == 0 }
func unpackUint8(msg []byte, off int) (i uint8, off1 int, err error) {
if off+1 > len(msg) {
return 0, len(msg), &Error{err: "overflow unpacking uint8"}
}
return msg[off], off + 1, nil
}
func packUint8(i uint8, msg []byte, off int) (off1 int, err error) {
if off+1 > len(msg) {
return len(msg), &Error{err: "overflow packing uint8"}
}
msg[off] = i
return off + 1, nil
}
func unpackUint16(msg []byte, off int) (i uint16, off1 int, err error) {
if off+2 > len(msg) {
return 0, len(msg), &Error{err: "overflow unpacking uint16"}
}
return binary.BigEndian.Uint16(msg[off:]), off + 2, nil
}
func packUint16(i uint16, msg []byte, off int) (off1 int, err error) {
if off+2 > len(msg) {
return len(msg), &Error{err: "overflow packing uint16"}
}
binary.BigEndian.PutUint16(msg[off:], i)
return off + 2, nil
}
func unpackUint32(msg []byte, off int) (i uint32, off1 int, err error) {
if off+4 > len(msg) {
return 0, len(msg), &Error{err: "overflow unpacking uint32"}
}
return binary.BigEndian.Uint32(msg[off:]), off + 4, nil
}
func packUint32(i uint32, msg []byte, off int) (off1 int, err error) {
if off+4 > len(msg) {
return len(msg), &Error{err: "overflow packing uint32"}
}
binary.BigEndian.PutUint32(msg[off:], i)
return off + 4, nil
}
func unpackUint48(msg []byte, off int) (i uint64, off1 int, err error) {
if off+6 > len(msg) {
return 0, len(msg), &Error{err: "overflow unpacking uint64 as uint48"}
}
// Used in TSIG where the last 48 bits are occupied, so for now, assume a uint48 (6 bytes)
i = uint64(msg[off])<<40 | uint64(msg[off+1])<<32 | uint64(msg[off+2])<<24 | uint64(msg[off+3])<<16 |
uint64(msg[off+4])<<8 | uint64(msg[off+5])
off += 6
return i, off, nil
}
func packUint48(i uint64, msg []byte, off int) (off1 int, err error) {
if off+6 > len(msg) {
return len(msg), &Error{err: "overflow packing uint64 as uint48"}
}
msg[off] = byte(i >> 40)
msg[off+1] = byte(i >> 32)
msg[off+2] = byte(i >> 24)
msg[off+3] = byte(i >> 16)
msg[off+4] = byte(i >> 8)
msg[off+5] = byte(i)
off += 6
return off, nil
}
func unpackUint64(msg []byte, off int) (i uint64, off1 int, err error) {
if off+8 > len(msg) {
return 0, len(msg), &Error{err: "overflow unpacking uint64"}
}
return binary.BigEndian.Uint64(msg[off:]), off + 8, nil
}
func packUint64(i uint64, msg []byte, off int) (off1 int, err error) {
if off+8 > len(msg) {
return len(msg), &Error{err: "overflow packing uint64"}
}
binary.BigEndian.PutUint64(msg[off:], i)
off += 8
return off, nil
}
func unpackString(msg []byte, off int) (string, int, error) {
if off+1 > len(msg) {
return "", off, &Error{err: "overflow unpacking txt"}
}
l := int(msg[off])
off++
if off+l > len(msg) {
return "", off, &Error{err: "overflow unpacking txt"}
}
var s strings.Builder
consumed := 0
for i, b := range msg[off : off+l] {
switch {
case b == '"' || b == '\\':
if consumed == 0 {
s.Grow(l * 2)
}
s.Write(msg[off+consumed : off+i])
s.WriteByte('\\')
s.WriteByte(b)
consumed = i + 1
case b < ' ' || b > '~': // unprintable
if consumed == 0 {
s.Grow(l * 2)
}
s.Write(msg[off+consumed : off+i])
s.WriteString(escapeByte(b))
consumed = i + 1
}
}
if consumed == 0 { // no escaping needed
return string(msg[off : off+l]), off + l, nil
}
s.Write(msg[off+consumed : off+l])
return s.String(), off + l, nil
}
func packString(s string, msg []byte, off int) (int, error) {
txtTmp := make([]byte, 256*4+1)
off, err := packTxtString(s, msg, off, txtTmp)
if err != nil {
return len(msg), err
}
return off, nil
}
func unpackStringBase32(msg []byte, off, end int) (string, int, error) {
if end > len(msg) {
return "", len(msg), &Error{err: "overflow unpacking base32"}
}
s := toBase32(msg[off:end])
return s, end, nil
}
func packStringBase32(s string, msg []byte, off int) (int, error) {
b32, err := fromBase32([]byte(s))
if err != nil {
return len(msg), err
}
if off+len(b32) > len(msg) {
return len(msg), &Error{err: "overflow packing base32"}
}
copy(msg[off:off+len(b32)], b32)
off += len(b32)
return off, nil
}
func unpackStringBase64(msg []byte, off, end int) (string, int, error) {
// Rest of the RR is base64 encoded value, so we don't need an explicit length
// to be set. Thus far all RR's that have base64 encoded fields have those as their
// last one. What we do need is the end of the RR!
if end > len(msg) {
return "", len(msg), &Error{err: "overflow unpacking base64"}
}
s := toBase64(msg[off:end])
return s, end, nil
}
func packStringBase64(s string, msg []byte, off int) (int, error) {
b64, err := fromBase64([]byte(s))
if err != nil {
return len(msg), err
}
if off+len(b64) > len(msg) {
return len(msg), &Error{err: "overflow packing base64"}
}
copy(msg[off:off+len(b64)], b64)
off += len(b64)
return off, nil
}
func unpackStringHex(msg []byte, off, end int) (string, int, error) {
// Rest of the RR is hex encoded value, so we don't need an explicit length
// to be set. NSEC and TSIG have hex fields with a length field.
// What we do need is the end of the RR!
if end > len(msg) {
return "", len(msg), &Error{err: "overflow unpacking hex"}
}
s := hex.EncodeToString(msg[off:end])
return s, end, nil
}
func packStringHex(s string, msg []byte, off int) (int, error) {
h, err := hex.DecodeString(s)
if err != nil {
return len(msg), err
}
if off+len(h) > len(msg) {
return len(msg), &Error{err: "overflow packing hex"}
}
copy(msg[off:off+len(h)], h)
off += len(h)
return off, nil
}
func unpackStringAny(msg []byte, off, end int) (string, int, error) {
if end > len(msg) {
return "", len(msg), &Error{err: "overflow unpacking anything"}
}
return string(msg[off:end]), end, nil
}
func packStringAny(s string, msg []byte, off int) (int, error) {
if off+len(s) > len(msg) {
return len(msg), &Error{err: "overflow packing anything"}
}
copy(msg[off:off+len(s)], s)
off += len(s)
return off, nil
}
func unpackStringTxt(msg []byte, off int) ([]string, int, error) {
txt, off, err := unpackTxt(msg, off)
if err != nil {
return nil, len(msg), err
}
return txt, off, nil
}
func packStringTxt(s []string, msg []byte, off int) (int, error) {
txtTmp := make([]byte, 256*4+1) // If the whole string consists out of \DDD we need this many.
off, err := packTxt(s, msg, off, txtTmp)
if err != nil {
return len(msg), err
}
return off, nil
}
func unpackDataOpt(msg []byte, off int) ([]EDNS0, int, error) {
var edns []EDNS0
Option:
var code uint16
if off+4 > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking opt"}
}
code = binary.BigEndian.Uint16(msg[off:])
off += 2
optlen := binary.BigEndian.Uint16(msg[off:])
off += 2
if off+int(optlen) > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking opt"}
}
e := makeDataOpt(code)
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
return nil, len(msg), err
}
edns = append(edns, e)
off += int(optlen)
if off < len(msg) {
goto Option
}
return edns, off, nil
}
func makeDataOpt(code uint16) EDNS0 {
switch code {
case EDNS0NSID:
return new(EDNS0_NSID)
case EDNS0SUBNET:
return new(EDNS0_SUBNET)
case EDNS0COOKIE:
return new(EDNS0_COOKIE)
case EDNS0EXPIRE:
return new(EDNS0_EXPIRE)
case EDNS0UL:
return new(EDNS0_UL)
case EDNS0LLQ:
return new(EDNS0_LLQ)
case EDNS0DAU:
return new(EDNS0_DAU)
case EDNS0DHU:
return new(EDNS0_DHU)
case EDNS0N3U:
return new(EDNS0_N3U)
case EDNS0PADDING:
return new(EDNS0_PADDING)
default:
e := new(EDNS0_LOCAL)
e.Code = code
return e
}
}
func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) {
for _, el := range options {
b, err := el.pack()
if err != nil || off+4 > len(msg) {
return len(msg), &Error{err: "overflow packing opt"}
}
binary.BigEndian.PutUint16(msg[off:], el.Option()) // Option code
binary.BigEndian.PutUint16(msg[off+2:], uint16(len(b))) // Length
off += 4
if off+len(b) > len(msg) {
return len(msg), &Error{err: "overflow packing opt"}
}
// Actual data
copy(msg[off:off+len(b)], b)
off += len(b)
}
return off, nil
}
func unpackStringOctet(msg []byte, off int) (string, int, error) {
s := string(msg[off:])
return s, len(msg), nil
}
func packStringOctet(s string, msg []byte, off int) (int, error) {
txtTmp := make([]byte, 256*4+1)
off, err := packOctetString(s, msg, off, txtTmp)
if err != nil {
return len(msg), err
}
return off, nil
}
func unpackDataNsec(msg []byte, off int) ([]uint16, int, error) {
var nsec []uint16
length, window, lastwindow := 0, 0, -1
for off < len(msg) {
if off+2 > len(msg) {
return nsec, len(msg), &Error{err: "overflow unpacking nsecx"}
}
window = int(msg[off])
length = int(msg[off+1])
off += 2
if window <= lastwindow {
// RFC 4034: Blocks are present in the NSEC RR RDATA in
// increasing numerical order.
return nsec, len(msg), &Error{err: "out of order NSEC block"}
}
if length == 0 {
// RFC 4034: Blocks with no types present MUST NOT be included.
return nsec, len(msg), &Error{err: "empty NSEC block"}
}
if length > 32 {
return nsec, len(msg), &Error{err: "NSEC block too long"}
}
if off+length > len(msg) {
return nsec, len(msg), &Error{err: "overflowing NSEC block"}
}
// Walk the bytes in the window and extract the type bits
for j, b := range msg[off : off+length] {
// Check the bits one by one, and set the type
if b&0x80 == 0x80 {
nsec = append(nsec, uint16(window*256+j*8+0))
}
if b&0x40 == 0x40 {
nsec = append(nsec, uint16(window*256+j*8+1))
}
if b&0x20 == 0x20 {
nsec = append(nsec, uint16(window*256+j*8+2))
}
if b&0x10 == 0x10 {
nsec = append(nsec, uint16(window*256+j*8+3))
}
if b&0x8 == 0x8 {
nsec = append(nsec, uint16(window*256+j*8+4))
}
if b&0x4 == 0x4 {
nsec = append(nsec, uint16(window*256+j*8+5))
}
if b&0x2 == 0x2 {
nsec = append(nsec, uint16(window*256+j*8+6))
}
if b&0x1 == 0x1 {
nsec = append(nsec, uint16(window*256+j*8+7))
}
}
off += length
lastwindow = window
}
return nsec, off, nil
}
// typeBitMapLen is a helper function which computes the "maximum" length of
// a the NSEC Type BitMap field.
func typeBitMapLen(bitmap []uint16) int {
var l int
var lastwindow, lastlength uint16
for _, t := range bitmap {
window := t / 256
length := (t-window*256)/8 + 1
if window > lastwindow && lastlength != 0 { // New window, jump to the new offset
l += int(lastlength) + 2
lastlength = 0
}
if window < lastwindow || length < lastlength {
// packDataNsec would return Error{err: "nsec bits out of order"} here, but
// when computing the length, we want do be liberal.
continue
}
lastwindow, lastlength = window, length
}
l += int(lastlength) + 2
return l
}
func packDataNsec(bitmap []uint16, msg []byte, off int) (int, error) {
if len(bitmap) == 0 {
return off, nil
}
var lastwindow, lastlength uint16
for _, t := range bitmap {
window := t / 256
length := (t-window*256)/8 + 1
if window > lastwindow && lastlength != 0 { // New window, jump to the new offset
off += int(lastlength) + 2
lastlength = 0
}
if window < lastwindow || length < lastlength {
return len(msg), &Error{err: "nsec bits out of order"}
}
if off+2+int(length) > len(msg) {
return len(msg), &Error{err: "overflow packing nsec"}
}
// Setting the window #
msg[off] = byte(window)
// Setting the octets length
msg[off+1] = byte(length)
// Setting the bit value for the type in the right octet
msg[off+1+int(length)] |= byte(1 << (7 - t%8))
lastwindow, lastlength = window, length
}
off += int(lastlength) + 2
return off, nil
}
func unpackDataDomainNames(msg []byte, off, end int) ([]string, int, error) {
var (
servers []string
s string
err error
)
if end > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking domain names"}
}
for off < end {
s, off, err = UnpackDomainName(msg, off)
if err != nil {
return servers, len(msg), err
}
servers = append(servers, s)
}
return servers, off, nil
}
func packDataDomainNames(names []string, msg []byte, off int, compression compressionMap, compress bool) (int, error) {
var err error
for _, name := range names {
off, err = packDomainName(name, msg, off, compression, compress)
if err != nil {
return len(msg), err
}
}
return off, nil
}
func packDataApl(data []APLPrefix, msg []byte, off int) (int, error) {
var err error
for i := range data {
off, err = packDataAplPrefix(&data[i], msg, off)
if err != nil {
return len(msg), err
}
}
return off, nil
}
func packDataAplPrefix(p *APLPrefix, msg []byte, off int) (int, error) {
if len(p.Network.IP) != len(p.Network.Mask) {
return len(msg), &Error{err: "address and mask lengths don't match"}
}
var err error
prefix, _ := p.Network.Mask.Size()
addr := p.Network.IP.Mask(p.Network.Mask)[:(prefix+7)/8]
switch len(p.Network.IP) {
case net.IPv4len:
off, err = packUint16(1, msg, off)
case net.IPv6len:
off, err = packUint16(2, msg, off)
default:
err = &Error{err: "unrecognized address family"}
}
if err != nil {
return len(msg), err
}
off, err = packUint8(uint8(prefix), msg, off)
if err != nil {
return len(msg), err
}
var n uint8
if p.Negation {
n = 0x80
}
adflen := uint8(len(addr)) & 0x7f
off, err = packUint8(n|adflen, msg, off)
if err != nil {
return len(msg), err
}
if off+len(addr) > len(msg) {
return len(msg), &Error{err: "overflow packing APL prefix"}
}
off += copy(msg[off:], addr)
return off, nil
}
func unpackDataApl(msg []byte, off int) ([]APLPrefix, int, error) {
var result []APLPrefix
for off < len(msg) {
prefix, end, err := unpackDataAplPrefix(msg, off)
if err != nil {
return nil, len(msg), err
}
off = end
result = append(result, prefix)
}
return result, off, nil
}
func unpackDataAplPrefix(msg []byte, off int) (APLPrefix, int, error) {
family, off, err := unpackUint16(msg, off)
if err != nil {
return APLPrefix{}, len(msg), &Error{err: "overflow unpacking APL prefix"}
}
prefix, off, err := unpackUint8(msg, off)
if err != nil {
return APLPrefix{}, len(msg), &Error{err: "overflow unpacking APL prefix"}
}
nlen, off, err := unpackUint8(msg, off)
if err != nil {
return APLPrefix{}, len(msg), &Error{err: "overflow unpacking APL prefix"}
}
var ip []byte
switch family {
case 1:
ip = make([]byte, net.IPv4len)
case 2:
ip = make([]byte, net.IPv6len)
default:
return APLPrefix{}, len(msg), &Error{err: "unrecognized APL address family"}
}
if int(prefix) > 8*len(ip) {
return APLPrefix{}, len(msg), &Error{err: "APL prefix too long"}
}
afdlen := int(nlen & 0x7f)
if afdlen > len(ip) {
return APLPrefix{}, len(msg), &Error{err: "APL length too long"}
}
if off+afdlen > len(msg) {
return APLPrefix{}, len(msg), &Error{err: "overflow unpacking APL address"}
}
off += copy(ip, msg[off:off+afdlen])
if afdlen > 0 {
last := ip[afdlen-1]
if last == 0 {
return APLPrefix{}, len(msg), &Error{err: "extra APL address bits"}
}
}
ipnet := net.IPNet{
IP: ip,
Mask: net.CIDRMask(int(prefix), 8*len(ip)),
}
network := ipnet.IP.Mask(ipnet.Mask)
if !network.Equal(ipnet.IP) {
return APLPrefix{}, len(msg), &Error{err: "invalid APL address length"}
}
return APLPrefix{
Negation: (nlen & 0x80) != 0,
Network: ipnet,
}, off, nil
}
| {
"pile_set_name": "Github"
} |
//==============================================================================
//
// OvenMediaEngine
//
// Created by getroot
// Copyright (c) 2018 AirenSoft. All rights reserved.
//
//
//==============================================================================
#pragma once
#include "sdp_base.h"
#include "common_attr.h"
#include "payload_attr.h"
class SessionDescription;
class MediaDescription : public SdpBase, public CommonAttr
{
public:
enum class MediaType
{
Unknown,
Video,
Audio,
Application
};
enum class Direction
{
Unknown,
SendRecv,
RecvOnly,
SendOnly,
Inactive
};
enum class SetupType
{
Unknown,
Active,
Passive,
ActPass
};
explicit MediaDescription(const std::shared_ptr<SessionDescription> &session_description);
virtual ~MediaDescription();
bool FromString(const ov::String &desc) override;
// m=video 9 UDP/TLS/RTP/SAVPF 97
void SetMediaType(MediaType type);
bool SetMediaType(const ov::String &type);
const MediaType GetMediaType() const;
void SetPort(uint16_t port);
uint16_t GetPort() const;
void UseDtls(bool flag);
bool IsUseDtls() const;
void AddPayload(const std::shared_ptr<PayloadAttr> &payload);
std::shared_ptr<const PayloadAttr> GetPayload(uint8_t id) const;
std::shared_ptr<PayloadAttr> GetPayload(uint8_t id);
std::shared_ptr<const PayloadAttr> GetFirstPayload() const;
// a=rtcp-mux
void UseRtcpMux(bool flag = true);
bool IsUseRtcpMux() const;
// a=sendonly
void SetDirection(Direction dir);
bool SetDirection(const ov::String &dir);
const Direction GetDirection() const;
// a=mid:video
void SetMid(const ov::String &mid);
const ov::String &GetMid() const;
// a=setup:actpass
void SetSetup(SetupType type);
bool SetSetup(const ov::String &type);
// c=IN IP4 0.0.0.0
void SetConnection(uint8_t version, const ov::String &ip);
// a=framerate:29.97
void SetFramerate(float framerate);
const float GetFramerate() const;
// a=rtpmap:96 VP8/50000
bool AddRtpmap(uint8_t payload_type, const ov::String &codec, uint32_t rate,
const ov::String ¶meters);
// a=rtcp-fb:96 nack pli
bool EnableRtcpFb(uint8_t id, const ov::String &type, bool on);
void EnableRtcpFb(uint8_t id, const PayloadAttr::RtcpFbType &type, bool on);
// a=ssrc:2064629418 cname:{b2266c86-259f-4853-8662-ea94cf0835a3}
void SetCname(uint32_t ssrc, const ov::String &cname);
uint32_t GetSsrc() const;
ov::String GetCname() const;
private:
bool UpdateData(ov::String &sdp) override;
bool ParsingMediaLine(char type, std::string content);
MediaType _media_type = MediaType::Unknown;
ov::String _media_type_str = "UNKNOWN";
uint16_t _port = 9;
bool _use_dtls_flag = false;
ov::String _protocol;
bool _use_rtcpmux_flag = false;
Direction _direction = Direction::Unknown;
ov::String _direction_str = "UNKNOWN";
ov::String _mid;
SetupType _setup = SetupType::Unknown;
ov::String _setup_str = "UNKNOWN";
uint8_t _connection_ip_version = 4;
ov::String _connection_ip = "0.0.0.0";
float _framerate = 0.0f;
uint32_t _ssrc = 0;
ov::String _cname;
std::shared_ptr<SessionDescription> _session_description;
std::vector<std::shared_ptr<PayloadAttr>> _payload_list;
};
| {
"pile_set_name": "Github"
} |
import { Component, Input } from '@angular/core';
import { Passenger } from '../../models/passenger.interface';
@Component({
selector: 'passenger-count',
template: `
<div>
<h3>Airline Passengers!</h3>
<div>
Total checked in: {{ checkedInCount() }}/{{ items?.length }}
</div>
</div>
`
})
export class PassengerCountComponent {
@Input()
items: Passenger[];
checkedInCount(): number {
if (!this.items) return;
return this.items.filter((passenger: Passenger) => passenger.checkedIn).length;
}
} | {
"pile_set_name": "Github"
} |
// Copyright 2019 Roman Perepelitsa.
//
// This file is part of GitStatus.
//
// GitStatus 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.
//
// GitStatus 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 GitStatus. If not, see <https://www.gnu.org/licenses/>.
#ifndef ROMKATV_GITSTATUS_LOGGING_H_
#define ROMKATV_GITSTATUS_LOGGING_H_
#include <cstdlib>
#include <memory>
#include <ostream>
#include <sstream>
#define LOG(severity) LOG_I(severity)
#define LOG_I(severity) \
(::gitstatus::severity < ::gitstatus::g_min_log_level) \
? static_cast<void>(0) \
: ::gitstatus::internal_logging::Assignable() = \
::gitstatus::internal_logging::LogStream<::gitstatus::severity>(__FILE__, __LINE__, \
::gitstatus::severity) \
.ref()
namespace gitstatus {
enum LogLevel {
DEBUG,
INFO,
WARN,
ERROR,
FATAL,
};
const char* LogLevelStr(LogLevel lvl);
bool ParseLogLevel(const char* s, LogLevel& lvl);
extern LogLevel g_min_log_level;
namespace internal_logging {
struct Assignable {
template <class T>
void operator=(const T&) const {}
};
class LogStreamBase {
public:
LogStreamBase(const char* file, int line, LogLevel lvl);
LogStreamBase& ref() { return *this; }
std::ostream& strm() { return *strm_; }
int stashed_errno() const { return errno_; }
protected:
void Flush();
private:
int errno_;
const char* file_;
int line_;
const char* lvl_;
std::unique_ptr<std::ostringstream> strm_;
};
template <LogLevel>
class LogStream : public LogStreamBase {
public:
using LogStreamBase::LogStreamBase;
~LogStream() { this->Flush(); }
};
template <>
class LogStream<FATAL> : public LogStreamBase {
public:
using LogStreamBase::LogStreamBase;
~LogStream() __attribute__((noreturn)) {
this->Flush();
std::abort();
}
};
template <class T>
LogStreamBase& operator<<(LogStreamBase& strm, const T& val) {
strm.strm() << val;
return strm;
}
inline LogStreamBase& operator<<(LogStreamBase& strm, std::ostream& (*manip)(std::ostream&)) {
strm.strm() << manip;
return strm;
}
struct Errno {
int err;
};
std::ostream& operator<<(std::ostream& strm, Errno e);
struct StashedErrno {};
inline LogStreamBase& operator<<(LogStreamBase& strm, StashedErrno) {
return strm << Errno{strm.stashed_errno()};
}
} // namespace internal_logging
inline internal_logging::Errno Errno(int err) { return {err}; }
inline internal_logging::StashedErrno Errno() { return {}; }
} // namespace gitstatus
#endif // ROMKATV_GITSTATUS_LOGGING_H_
| {
"pile_set_name": "Github"
} |
/*
* Copyright © 2014 - 2020 Leipzig University (Database Research 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 org.gradoop.flink.io.impl.edgelist;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple4;
import org.apache.flink.api.java.utils.DataSetUtils;
import org.gradoop.flink.io.impl.edgelist.functions.CreateImportEdge;
import org.gradoop.flink.io.impl.edgelist.functions.CreateLabeledImportVertex;
import org.gradoop.flink.io.impl.graph.GraphDataSource;
import org.gradoop.flink.io.impl.graph.tuples.ImportEdge;
import org.gradoop.flink.io.impl.graph.tuples.ImportVertex;
import org.gradoop.flink.model.impl.epgm.GraphCollection;
import org.gradoop.flink.model.impl.epgm.LogicalGraph;
import org.gradoop.flink.model.impl.operators.combination.ReduceCombination;
import org.gradoop.flink.util.GradoopFlinkConfig;
import java.io.IOException;
/**
* Data source to create a {@link LogicalGraph} from an edge list. Vertices are annotated with a
* string label/value, e.g.
*
* 0 EN 1 ZH
* 2 DE 0 EN
*
* The example line denotes an edge between two vertices:
* First edge:
* source: with id = 0 and vertex value "EN" and
* target: with id = 1 and vertex value "ZH".
*
* Second edge:
* source: with id = 2 and vertex value "DE" and
* target: with id = 0 and vertex value "EN".
*
* This data source implementation will create a logical graph based on the specified edge list. The
* resulting vertices will have a user-defined property that stores the label/value. The type of
* that value will be string.
*/
public class VertexLabeledEdgeListDataSource extends EdgeListDataSource {
/**
* property key which should be used for storing the property information
*/
private String propertyKey;
/**
* Creates a new data source. Paths can be local (file://) or HDFS (hdfs://).
*
* @param edgeListPath Path to edge list file
* @param tokenSeparator Separator token
* @param propertyKey Property key for storing the vertex value
* @param config Gradoop Flink configuration
*/
public VertexLabeledEdgeListDataSource(String edgeListPath, String tokenSeparator,
String propertyKey,
GradoopFlinkConfig config) {
super(edgeListPath, tokenSeparator, config);
this.propertyKey = propertyKey;
}
@Override
public LogicalGraph getLogicalGraph() throws IOException {
return getGraphCollection().reduce(new ReduceCombination<>());
}
@Override
public GraphCollection getGraphCollection() throws IOException {
ExecutionEnvironment env = getConfig().getExecutionEnvironment();
//--------------------------------------------------------------------------
// generate tuple that contains all information
//--------------------------------------------------------------------------
DataSet<Tuple4<Long, String, Long, String>> lineTuples = env
.readCsvFile(getEdgeListPath())
.fieldDelimiter(getTokenSeparator())
.types(Long.class, String.class, Long.class, String.class);
//--------------------------------------------------------------------------
// generate vertices
//--------------------------------------------------------------------------
DataSet<ImportVertex<Long>> importVertices = lineTuples
.<Tuple2<Long, String>>project(0, 1)
.union(lineTuples.project(2, 3))
.distinct(0)
.map(new CreateLabeledImportVertex<>(propertyKey));
//--------------------------------------------------------------------------
// generate edges
//--------------------------------------------------------------------------
DataSet<ImportEdge<Long>> importEdges = DataSetUtils
.zipWithUniqueId(lineTuples.<Tuple2<Long, Long>>project(0, 2))
.map(new CreateImportEdge<>());
//--------------------------------------------------------------------------
// create graph data source
//--------------------------------------------------------------------------
return new GraphDataSource<>(importVertices, importEdges, getConfig())
.getGraphCollection();
}
}
| {
"pile_set_name": "Github"
} |
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// Generated using tools/cldr/cldr-to-icu/build-icu-data.xml
es_PY{
%%Parent{"es_419"}
Currencies{
PYG{
"Gs.",
"guaraní paraguayo",
}
}
}
| {
"pile_set_name": "Github"
} |
op {
graph_op_name: "Reshape"
in_arg {
name: "shape"
description: <<END
Defines the shape of the output tensor.
END
}
summary: "Reshapes a tensor."
description: <<END
Given `tensor`, this operation returns a tensor that has the same values
as `tensor` with shape `shape`.
If one component of `shape` is the special value -1, the size of that dimension
is computed so that the total size remains constant. In particular, a `shape`
of `[-1]` flattens into 1-D. At most one component of `shape` can be -1.
If `shape` is 1-D or higher, then the operation returns a tensor with shape
`shape` filled with the values of `tensor`. In this case, the number of elements
implied by `shape` must be the same as the number of elements in `tensor`.
For example:
```
# tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9]
# tensor 't' has shape [9]
reshape(t, [3, 3]) ==> [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
# tensor 't' is [[[1, 1], [2, 2]],
# [[3, 3], [4, 4]]]
# tensor 't' has shape [2, 2, 2]
reshape(t, [2, 4]) ==> [[1, 1, 2, 2],
[3, 3, 4, 4]]
# tensor 't' is [[[1, 1, 1],
# [2, 2, 2]],
# [[3, 3, 3],
# [4, 4, 4]],
# [[5, 5, 5],
# [6, 6, 6]]]
# tensor 't' has shape [3, 2, 3]
# pass '[-1]' to flatten 't'
reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]
# -1 can also be used to infer the shape
# -1 is inferred to be 9:
reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3],
[4, 4, 4, 5, 5, 5, 6, 6, 6]]
# -1 is inferred to be 2:
reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3],
[4, 4, 4, 5, 5, 5, 6, 6, 6]]
# -1 is inferred to be 3:
reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1],
[2, 2, 2],
[3, 3, 3]],
[[4, 4, 4],
[5, 5, 5],
[6, 6, 6]]]
# tensor 't' is [7]
# shape `[]` reshapes to a scalar
reshape(t, []) ==> 7
```
END
}
| {
"pile_set_name": "Github"
} |
function load_activity(feedurl, divid) {
let container = document.getElementById(divid);
$.ajax({
url: "https://cors-anywhere.herokuapp.com/" + feedurl
})
.done(function(data){
let x2js = new X2JS();
let result = x2js.xml_str2json(data.documentElement.outerHTML);
let loaded = 0;
let nb_display = 8;
if (result==null) return;
for (let i = 0; i < result.feed.entry.length; i++) {
let entry = result.feed.entry[i];
if (entry.title.indexOf("git commit") !== -1)
continue;
loaded += 1;
if (loaded > nb_display)
break;
let div = document.createElement("p");
let link = document.createElement("a");
let d = new Date(entry.published);
let data = '[' + d.toLocaleDateString() + '] ' + entry.title;
let text = document.createTextNode(data);
link.appendChild(text);
link.title = entry.title;
link.href = entry.link._href;
div.appendChild(link);
container.appendChild(div);
}
let empty = nb_display - loaded;
for (let i = 0; i < empty; i++) {
container.appendChild(document.createElement("p"));
}
});
}
function google_analytics() {
let _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-21761074-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
let ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
let s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
}
function showTooltip(elem, msg) {
elem.setAttribute('class', 'btn tooltipped tooltipped-s');
elem.setAttribute('aria-label', msg);
}
let clipboard = new Clipboard('.btn');
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
clipboard.on('success', function(e) {
e.clearSelection();
$(e.trigger).tooltip('show');
});
$(function() {
$('a[href*=\\#]:not([href=\\#])').click(function() {
if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
let target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
jQuery(document).ready(function($) {
let url = window.location.href;
// Get the basename of the URL
url = url.split(/[\\/]/).pop();
$('.nav a[href="/' + url + '"]').parent().addClass('active');
load_activity("http://buildroot-busybox.2317881.n4.nabble.com/Buildroot-busybox-ft2.xml", "mailing-list-activity");
load_activity("http://git.buildroot.org/buildroot/atom/?h=master", "commit-activity");
$('#slides').html('<iframe src="https://docs.google.com/gview?url=http://bootlin.com/doc/training/buildroot/buildroot-slides.pdf&embedded=true" style="position:absolute; width:100%; height:100%; top:0; left:0;" frameborder="0"></iframe>')
});
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
Release 2.3.0
</title>
</head>
<body bgcolor="#ffffff">
<h1>Release 2.3.0</h1>
<p>
The following changes were made in this release:
</p>
<h2>Significant changes:</h2>
<h3>ZAP ‘lite’ version</h3>
For this release we are providing a <i>‘lite’</i> version of ZAP in addition to the <i>‘full’</i> version.
This contains exactly the same core code, but it just includes fewer default add-ons.
Of course, you can download all of the ‘missing’ add-ons from the ZAP marketplace to ‘upgrade’ the lite version to a full one.<br>
The <i>‘lite’</i> version is aimed at people new to security who need less initial functionality which will hopefully be easier to get started with. It will also be suitable for people looking for a smaller download or those wishing to customize exactly which add-ons they install.
<h3>Support for client-side (browser) events</h3>
You can now view, intercept, manipulate, resend and fuzz <b>client-side events</b>. This includes postMessages, so you can now detect DOM based XSS vulnerabilities in postMessages. This is the first phase in a series of planned changes to support the testing of AJAX and HTML5 applications even more effectively.
<h3>Enhanced authentication support</h3>
ZAP's support for authentication has been completely revamped to easily handle complex types of <b>authentication methods and scenarios</b>. Support has also been added for user-defined scripts which allow you to handle custom authentication schemes. In addition, now ZAP understands and allows you to configure <b>web applications' Users</b> so various actions throughout ZAP can be performed from the point of view of defined users. To get started, check out the new <i>Authentication</i> and <i>Users</i> panels in the Session Properties for each of the defined Contexts.
<h3>Support for non standard apps</h3>
This release includes support for <b>‘single page’ applications</b> and <b>non standard key-value separators</b>. You can now control these settings via the new <i>Structure</i> panel in the Session Properties.
<h3>New Input Vectors including user-defined scripts</h3>
ZAP supports new options for defining the <b>input vectors</b> i.e. the elements of a request that ZAP will attack. The new options are available in the <i>Active Scan Input Vectors</i> panel of the Options. Support has also been added for defining custom scripts that define new input vectors.
<h3>Scan policy - fine grained control</h3>
The scan policy now has a <b>fine grained control</b>, allowing you to tweak individual scanner rules. You can also define, load and save scan policies, allowing you to maintain a set of policies that work well in different circumstances.<br>
In addition, by default ZAP will not now scan well-known service parameters (e.g. __VIEWSTATE) speeding up the overall scanning process. This is completely user configurable, allowing you to specify exactly which parameters ZAP should ignore.
<h3>Advanced Active Scan dialog</h3>
A new <i>'Advanced Active Scan'</i> dialog allows you to specify exactly how you want the active scanner to function. It allows you to specify <b>‘custom vectors’</b> that explicitly define which strings you want to attack. It also supports the option to scan as any of the Users you have defined for the application under test. Start an <i>Advanced Active Scan</i> via the <i>Tools</i> menu or via the <i>Attack</i> section of the right click popup menu.
<h3>Extended command line options</h3>
You can now run ZAP ‘inline’ i.e. <b>without starting the ZAP UI or a daemon</b>. In this mode you can run simple attacks or run scripts which can access all of the ZAP functionality. You can also now override any of the options defined in the configuration file via command line parameters.
<h3>More API support</h3>
The API has been extended to support even more of the ZAP functionality.
<h3>Internationalized help file</h3>
The help file has been internationalized and is in the process of being translated into many other languages via <a href="https://crowdin.net/project/owasp-zap-help">https://crowdin.net/project/owasp-zap-help</a>. If you use ZAP in one of the many languages we support, then the help files will include all of the available translations for that language while defaulting back to English for phrases that have not yet been translated.<br>
Languages with a significant amount of translated help pages include:
<ul>
<li>Bosnian</li>
<li>French</li>
<li>Japanese</li>
<li>Spanish</li>
</ul>
<h3>Keyboard shortcuts</h3>
All menu items can now be invoked via keyboard shortcuts. Defaults are defined for virtually all cases, but you can configure your own preferences in the <i>Keyboard</i> panel of the Options.
<h3>New UI options</h3>
There is a new option to change the display so that the selected tab takes up the <b>full screen</b>. This is useful when using ZAP on small screens.
There is also an option to <b>toggle the visibility of the tab names</b> on an off to further conserve space.
<p>Most of the UI lists have also been converted to tables, which allow you to change column widths and define exactly which columns are displayed, and how the tables are sorted.</p>
<h3>More functionality moved to add-ons</h3>
More of the core functionality has been moved into add-ons which allows us to deliver updates dynamically via the ZAP Marketplace rather than requiring new full releases.<br>
This includes the language packs, so translations made to the ZAP UI via https://crowdin.net/project/owasp-zap can be downloaded within ZAP or even automatically installed.
<h3>New and improved active and passive scanning rules</h3>
Many of the release quality active and passive scanning rules have been improved. There are new alpha and beta quality rules and many rules have been promoted from alpha to beta and from beta to release quality.
<h3>Other miscellaneous changes and additions</h3>
<ul>
<li>A new option to stop individual scan rules without stopping the whole scan</li>
<li>A new toolbar button that allows you to quickly and easily record Zest scripts.</li>
<li>A new group for sharing ZAP scripts (<a href="https://groups.google.com/group/zaproxy-scripts">https://groups.google.com/group/zaproxy-scripts</a>) has been created.</li>
<li>The ability to spider applications based on source control metadata (SVN and Git) exposed via a web server</li>
<li>The ability to force breaks from within Proxy scripts</li>
</ul>
<h2>Full list of changes:</h2>
<ul>
<li>Issue 122 : ProxyThread logging timeout readings with incorrect message (URL) </li>
<li>Issue 207 : Enhancement: Hotkeys </li>
<li>Issue 362 : Allow Alerts lists to be filtered by selection in Sites pane </li>
<li>Issue 399 : zap.sh directory handling </li>
<li>Issue 412 : Enable unsafe SSL/TLS renegotiation option not saved </li>
<li>Issue 416 : Normalise how multiple related options are managed throughout ZAP and enhance the usability of some options Usability </li>
<li>Issue 485 : Make language packs into add-ons </li>
<li>Issue 503 : Change the footer tabs to display the data with tables instead of lists Usability </li>
<li>Issue 572 : Change the generate_root_ca property to a function in the Python API </li>
<li>Issue 575 : Return the list of alerts in the Python API instead of a dictionary with one entry </li>
<li>Issue 585 : Proxy - "502 Bad Gateway" errors responded as "504 Gateway Timeout" </li>
<li>Issue 589 : Move Reveal extension to ZAP extensions project </li>
<li>Issue 590 : Forced Browse uses wrong scheme when "attacking" a site accessed over a secure connection (HTTPS) on a non-default port </li>
<li>Issue 591 : Available sites/hosts (in the footer panels) disappear when mode changed to "Safe" </li>
<li>Issue 595 : Spider fails to start (footer panel) with a site accessed over a secure connection (HTTPS) on a non-default port </li>
<li>Issue 606 : Disable the "Start" scan button when the "--Select Site--" option is selected </li>
<li>Issue 607 : Manual requested sites shown as scanned in the footer panels when selected in the "Sites" tab </li>
<li>Issue 609 : Provide a common interface to query the state and access the data (HttpMessage and HistoryReference) displayed in the tabs </li>
<li>Issue 613 : Move Save Raw HttpMessage extension to ZAP extensions project </li>
<li>Issue 619 : Move Forced Browse extension to ZAP extensions project </li>
<li>Issue 620 : Move Forced Browse files to ZAP extensions project </li>
<li>Issue 783 : shutdown should be a method in the python zap.core api </li>
<li>Issue 788 : Update Java for Mac release </li>
<li>Issue 793 : Authentication / SessionManagement Methods dynamic loading in APIs not reliable </li>
<li>Issue 799 : Add HttpAuthentication as an Authentication Method </li>
<li>Issue 803 : Patch for /trunk/src/help/zaphelp/zaphelp/credits.html </li>
<li>Issue 804 : Add Support for various types of Authentication for a Context </li>
<li>Issue 805 : Add Support for various types of Session Management for a Context </li>
<li>Issue 806 : Add Support for webapp Users </li>
<li>Issue 807 : Error while loading ZAP when Quick Start Tab is closed </li>
<li>Issue 816 : Add right-click Copy/Paste & Find options in the Encode/Decode/Hash dialog </li>
<li>Issue 817 : Python API doesn't handle "other" operations correctly </li>
<li>Issue 822 : Java API: ApiResponseSet.getAttributes() not working </li>
<li>Issue 825 : Old version of Rhino included in lib directory </li>
<li>Issue 827 : Default session tokens are not lower cased when added through options dialogue </li>
<li>Issue 828 : NullPointerException while accessing HttpSessions API view "sessionTokens" when a site doesn't exist or doesn't have tokens </li>
<li>Issue 829 : JSONException while calling an API view without the required parameter(s) </li>
<li>Issue 830 : Java Client API doesn't encode query parameters when sending requests to ZAP API </li>
<li>Issue 832 : Http Sessions tab should be cleared when a new session is created </li>
<li>Issue 837 : Update, always, the HTTP request sent/forward by ZAP's proxy </li>
<li>Issue 838 : Search API - Add search views that return HTTP messages </li>
<li>Issue 839 : Search API - Add search views that return messages in HTTP Archive format </li>
<li>Issue 840 : Core API - Allow to get the messages in HTTP Archive format </li>
<li>Issue 841 : NullPointerException after sending a manual HTTP request with ExtensionHistory disabled </li>
<li>Issue 842 : NullPointerException while active scanning with ExtensionAntiCSRF disabled </li>
<li>Issue 843 : NullPointerException after sending/proxying a HTTP request with ExtensionAntiCSRF disabled </li>
<li>Issue 844 : NullPointerException while invoking the "Scan policy" dialogue with ExtensionPassiveScan disabled </li>
<li>Issue 845 : AbstractPanel added twice to TabbedPanel2 in ExtensionLoader#addTabPanel </li>
<li>Issue 846 : NullPointerException while active scanning with ExtensionScript disabled </li>
<li>Issue 849 : NullPointerException while authenticating with ExtensionHistory disabled </li>
<li>Issue 852 : Search API - URL views return the same URL several times </li>
<li>Issue 853 : Core API - Allow to get the number of alerts </li>
<li>Issue 854 : Core API - Allow to get the number of messages </li>
<li>Issue 855 : Core API - Allow to get a message by ID </li>
<li>Issue 856 : Core API - Allow to get an alert by ID </li>
<li>Issue 857 : Core API - "alerts" view might return unexpected alerts when pagination is used </li>
<li>Issue 858 : Core API - "messages" view might return unexpected messages when pagination is used </li>
<li>Issue 859 : PScan API - Allow to enable/disable the passive scan </li>
<li>Issue 860 : PScan API - Allow to list/get the passive scanners </li>
<li>Issue 861 : PScan API - Allow to enable/disable all the passive scanners </li>
<li>Issue 862 : PScan API - Allow to enable/disable a given passive scanner </li>
<li>Issue 863 : AScan API - Allow to list/get the active scanners </li>
<li>Issue 864 : AScan API - Allow to enable/disable all the active scanners </li>
<li>Issue 865 : AScan API - Allow to enable/disable a given active scanner </li>
<li>Issue 866 : Alert keeps HttpMessage longer than needed when HistoryReference is set/available </li>
<li>Issue 867 : HttpMessage#getFormParams should return an empty TreeSet if the request body is not "x-www-form-urlencoded" </li>
<li>Issue 868 : Core API - "messages" view shouldn't return internal/temporary messages </li>
<li>Issue 869 : Differentiate proxied requests from (ZAP) user requests </li>
<li>Issue 870 : Change the MainToolbarPanel's expand buttons to use ButtonGroup and Action </li>
<li>Issue 871 : Title not updated when session name is changed through the main tool bar button "Session Properties..." </li>
<li>Issue 872 : Core API - Allow to send a manual request </li>
<li>Issue 873 : Core API - Allow to send a manual request in HAR format </li>
<li>Issue 874 : Change BreakPanelToolbarFactory to use Actions </li>
<li>Issue 875 : Remove i18n directory </li>
<li>Issue 876 : Deprecate FuzzerPanel#PANEL_NAME </li>
<li>Issue 877 : ExtensionPopupMenuItem#isEnableForComponent called twice on some pop up menus each time is shown using the MainPopupMenu </li>
<li>Issue 878 : ExtensionPopupMenuItem#getMenuIndex() as no effect in MainPopupMenu </li>
<li>Issue 879 : Pop up menu "Spider Context..." is enabled even if ExtensionSpider is disabled </li>
<li>Issue 880 : Remember last selected directory when adding custom fuzz files </li>
<li>Issue 881 : Fail immediately if zapdb.script file is not found </li>
<li>Issue 882 : Remove "Copy" pop up menu item shown in the "Forced Browse" tab </li>
<li>Issue 884 : Plug-n-Hack phase 2 </li>
<li>Issue 885 : API - Actions' response not shown when using HTML format </li>
<li>Issue 886 : Main pop up menu invoked twice on some components </li>
<li>Issue 887 : Scanners' pause button with inconsistent selection/enabled state </li>
<li>Issue 888 : Search API - URL views might return unexpected URLs when pagination is used </li>
<li>Issue 889 : JSONException while calling an API "other" without the required parameter(s) </li>
<li>Issue 890 : Allow to clear "Output" tab </li>
<li>Issue 891 : Target build "generate-javadocs" should apply SVN mime-type property to all generated files </li>
<li>Issue 892 : Cache of response body length in HistoryReference might not be correct </li>
<li>Issue 896 : PnH: Flag any fuzz attacks that hit the DOM XSS oracle </li>
<li>Issue 897 : Add a JToggleButton that allows to set a tool tip text based on button's state </li>
<li>Issue 898 : Replace all toggle buttons that set a tool tip text based on button's state with ZapToggleButton </li>
<li>Issue 899 : Remove "manual" update of toggle buttons' icon based on button's state </li>
<li>Issue 900 : IllegalArgumentException when invoking the main pop up menu with menus or super menus with high menu index </li>
<li>Issue 901 : Pop up menu "succeed" separator is not added when using sub-menu in MainPopupMenu </li>
<li>Issue 902 : Change all ExtensionAdaptor#hook(ExtensionHook) overriding methods to call the base implementation </li>
<li>Issue 903 : Change options' thread sliders to use the same component </li>
<li>Issue 904 : Add a button group that allows to deselect the selected button </li>
<li>Issue 905 : Incorrect link in "Break tab" help pages </li>
<li>Issue 910 : Forced User cannot be changed </li>
<li>Issue 911 : AScan API - Change the "scanners" view to include the state of the active scanner </li>
<li>Issue 912 : PScan API - Change the "scanners" view to include the state of the passive scanner </li>
<li>Issue 913 : AScan API - Allow to list/get the active scanner policies </li>
<li>Issue 914 : AScan API - Allow to set the active scanner policies enabled </li>
<li>Issue 915 : Dynamically filter history based on selection in the sites window </li>
<li>Issue 919 : Allow vulnerabilities.xml to be localized IdealFirstBug </li>
<li>Issue 920 : Add include/exclude url patterns to history filter </li>
<li>Issue 921 : PnH2: open as monitored url </li>
<li>Issue 923 : Allow individual rule thresholds and strengths to be set via GUI </li>
<li>Issue 925 : HTML report issues </li>
<li>Issue 929 : AScan API - Allow to set the attack strength and alert threshold of active scanner policies and active scanners </li>
<li>Issue 930 : AScan API - Allow to list/get the active scanners by policy ID </li>
<li>Issue 931 : Allow extensions to pick up command line args in GUI mode </li>
<li>Issue 932 : Allow scripts to be specified on the command line </li>
<li>Issue 933 : Automatically determine install dir </li>
<li>Issue 934 : Handle files on the command line via extension </li>
<li>Issue 935 : Improve the identification of Java version </li>
<li>Issue 939 : ZAP should accept SSL connections on non-standard ports automatically </li>
<li>Issue 947 : Spider fails on URLs with illegal characters </li>
<li>Issue 950 : Cope with add-ons containing files copied directly into the plugins directory </li>
<li>Issue 951 : TLS' versions 1.1 and 1.2 not enabled by default </li>
<li>Issue 954 : Changes to certain fields in the GUI are not saved after clicking OK/Proceed </li>
<li>Issue 955 : keyboard focus lost when large body found </li>
<li>Issue 956 : Copy URLs doesn't copy multiple </li>
<li>Issue 957 : Reference for alert "X-Content-Type-Options header missing" </li>
<li>Issue 963 : Add-on added to blocklist if it cant be deleted on update </li>
<li>Issue 965 : Support 'single page' apps and 'non standard' parameter separators </li>
<li>Issue 966 : Quickstart command line option </li>
<li>Issue 967 : InvalidParameterException while updating the "Script Console" add-on </li>
<li>Issue 968 : Allow to choose the enabled SSL/TLS protocols </li>
<li>Issue 969 : Proxy - Do not include the response body when answering unsuccessful HEAD requests </li>
<li>Issue 970 : Body of DELETE requests should be sent/forward </li>
<li>Issue 974 : Scan URL path elements </li>
<li>Issue 975 : Inverse Search Fuzz Results Buggy </li>
<li>Issue 976 : Spider Context Attack causes spidering outside of context </li>
<li>Issue 979 : Sites and Alerts trees can get corrupted </li>
<li>Issue 981 : Internationalize help file </li>
<li>Issue 982 : API key </li>
<li>Issue 986 : New ScanProgress dialog implementation and plugin skipping functionality </li>
<li>Issue 987 : Allow arbitrary config file values to be set via the command line </li>
<li>Issue 988 : ZAP Help crashes before starting </li>
<li>Issue 989 : Add a right click option "Add user" on an HTTP session </li>
<li>Issue 991 : Add-on/Scan rule review request - Persistent XSS </li>
<li>Issue 996 : Ensure all dialogs close when the escape key is pressed </li>
<li>Issue 997 : Session.open complains about improper use of addPath </li>
<li>Issue 998 : Silly regexp search kills ZAP </li>
<li>Issue 999 : History loaded in wrong order </li>
<li>Issue 1002 : Add support for Authentication via Scripts </li>
<li>Issue 1003 : XXE Vulnerability Testing Plugin </li>
<li>Issue 1004 : Source Code disclosure using Git meta-data </li>
<li>Issue 1005 : Source Code disclosure using Subversion meta-data </li>
<li>Issue 1006 : Spidering of web applications using using Git meta-data </li>
<li>Issue 1007 : Spidering of web applications using using Subversion (SVN) meta-data </li>
<li>Issue 1010 : Allow to sort fuzz results </li>
<li>Issue 1012 : Encode / Decode dialog - support HTML and JavaScript encoding IdealFirstBug </li>
<li>Issue 1016 : HTML encoding display issue in credits.html </li>
<li>Issue 1017 : Proxy set to 0.0.0.0 causes incorrect PAC file to be generated </li>
<li>Issue 1018 : Give AbstractAppParamPlugin implementations access to the parameter type </li>
<li>Issue 1019 : ZAP startup with bad JAVA_HOME shows confusing error message </li>
<li>Issue 1020 : Duplicate "Body: Table" plug-able view on Request/Break tabs </li>
<li>Issue 1021 : OutOutOfMemoryError while running the active scanner </li>
<li>Issue 1022 : Proxy - Allow to override a proxied message </li>
<li>Issue 1023 : Script Console - Run/Stop buttons with inconsistent state </li>
<li>Issue 1024 : Large Response view is shown even if a response body is not present </li>
<li>Issue 1025 : NullPointerException while pressing a key with "Script Console" text areas selected </li>
<li>Issue 1030 : Load and save scan policies </li>
<li>Issue 1031 : Adding Parameter Exclusion capabilities to the Active Scanner </li>
<li>Issue 1032 : Add API support for Script Based Authentication </li>
<li>Issue 1033 : org.zaproxy.clientapi.core.Alert does not override equals() method </li>
<li>Issue 1037 : JSON RPC parameters are not set correctly </li>
<li>Issue 1039 : Improve External Redirect plugin Accuracy </li>
<li>Issue 1041 : Active Scan plugins don't start if the site is local to 127.0.0.1 </li>
<li>Issue 1042 : Having significant issues opening a previous session</li>
<li>Issue 1043 : Custom active scan dialog </li>
<li>Issue 1044 : Forced User Mode is not persisted across Session saves/loads </li>
<li>Issue 1046 : The getHttpCookies() method in the HttpResponseHeader does not properly set the domain </li>
<li>Issue 1047 : Backup Files not detected by Zap </li>
<li>Issue 1049 : Fast multiple pattern search component </li>
<li>Issue 1050 : Scripting based Input Vectors </li>
<li>Issue 1051 : Zap can bound services to all network interfaces </li>
<li>Issue 1052 : Callback API for active scan plugins </li>
<li>Issue 1053 : String similarity and LCS algorithm component </li>
<li>Issue 1055 : Load extensions before plugins </li>
<li>Issue 1057 : Add a Extension.postInstall() method for post install actions </li>
<li>Issue 1059 : Add Jython support for Script-Based Authentication </li>
<li>Issue 1060 : Add JRuby support for Script-Based Authentication </li>
<li>Issue 1061 : Select proper Script Type, Engine and Template when creating new script </li>
<li>Issue 1063 : Option to decode add gzipped content (was handle compression for scripts) </li>
<li>Issue 1065 : Rename ExtensionScripts to ExtensionScriptsConsole Maintainability </li>
<li>Issue 1066 : Add support for quickly setting Script Based Authentication from scripts UI </li>
<li>Issue 1068 : Zap does not detect source code in responses </li>
<li>Issue 1069 : Support .-: in Zest variable names </li>
<li>Issue 1071 : Using Zest-Script "Replace in response-body" delivers wrong Content-Length header. </li>
<li>Issue 1072 : SQLDataException: data exception: string data, right truncation </li>
<li>Issue 1074 : Add option to only display output from the displayed script </li>
<li>Issue 1075 : Change TableHistory to delete records in batches Performance </li>
<li>Issue 1076 : Change active scanner to not delete the temporary messages generated Performance </li>
<li>Issue 1077 : Change (HTTP) fuzzer to not delete the temporary messages generated Performance </li>
<li>Issue 1078 : Change ExtensionBreak to fallback to base message type breakpoint manager implementation </li>
<li>Issue 1079 : Remove misplaced main pop up menu separators </li>
<li>Issue 1080 : User Guide HTML pages incorrectly relying on the platform default encoding </li>
<li>Issue 1081 : ExtensionPopupMenu should "notify" child ExtensionPopupMenu (and ExtensionPopupMenuItem) when the pop up is invoked </li>
<li>Issue 1082 : Search URL matches highlighted in incorrect position </li>
<li>Issue 1083 : Deprecate the method ExtensionPopupMenuItem#isSuperMenu() </li>
<li>Issue 1084 : NullPointerException while selecting a node in the "Sites" tab </li>
<li>Issue 1085 : Do not add/remove pop up menu items through the method View#getPopupMenu() </li>
<li>Issue 1086 : Allow to dynamically add/remove passive scanners </li>
<li>Issue 1087 : Change extensions to dynamically add passive scanners </li>
<li>Issue 1088 : Deprecate the method ExtensionPopupMenu#prepareShow </li>
<li>Issue 1089 : Change ExtensionPopupMenu to honour the extension pop up methods </li>
<li>Issue 1090 : Do not add pop up menus if target extension is not enabled </li>
<li>Issue 1091 : CoreAPI - Do not get the IDs of temporary history records </li>
<li>Issue 1092 : SearchThread - Do not get the IDs of discarded messages </li>
<li>Issue 1093 : Add an HTTP request body view that warns of large body </li>
<li>Issue 1094 : Change ExtensionManualRequestEditor to only add view components if in GUI mode </li>
<li>Issue 1095 : Replace main pop up sub menus with ExtensionPopupMenu when appropriate </li>
<li>Issue 1096 : AddOnLoader calls incorrect notify method after uninstalling add-on files </li>
<li>Issue 1097 : Move "Run applications" (invoke) extension to zap-extensions project </li>
<li>Issue 1098 : Move AJAX Spider help pages to "Ajax Spider" add-on (and update them) </li>
<li>Issue 1099 : Allow to annotate option methods as ignored for ZAP API </li>
<li>Issue 1100 : Annotate option methods that shouldn't be exposed in the ZAP API </li>
<li>Issue 1101 : Change passive scanners to expose its IDs </li>
<li>Issue 1102 : Ajax Spider - Replace ajax spider proxy with core proxy </li>
<li>Issue 1103 : Script Console - Allow to clear output even if "clear on run" is enabled </li>
<li>Issue 1104 : Replace all toggle buttons that set a tool tip text based on button's state with ZapToggleButton (add-ons) </li>
<li>Issue 1105 : Remove "manual" update of toggle buttons' icon based on button's state (add-ons) </li>
<li>Issue 1106 : HistoryList's mapping of history ID to list indexes not updated when history entry is deleted </li>
<li>Issue 1110 : Spider API - Unable to set how parameters are handled using API </li>
<li>Issue 1111 : Check for Updates on startup gets (automatically) disabled when accessing the "Options" dialogue </li>
<li>Issue 1112 : Change ZAP (core) to support new add-on dir structure </li>
<li>Issue 1113 : Change add-on dir structure (help and resources) </li>
<li>Issue 1118 : Alerts Tab can get out of sync</li>
<li>Issue 1119 : Spider doesn't detect multiple forms on the same URL</li>
<li>Issue 1120 : Uninstall add-on fails if rules use message bundle in uninstall </li>
<li>Issue 1121 : Scan progress dialog can cause UI freezes </li>
<li>Issue 1122 : Add-on additional info </li>
<li>Issue 1125 : Can't re-import jython script as a proxy script </li>
<li>Issue 1126 : Bugs in breakpoint filters </li>
<li>Issue 1127 : Feature request: Allow scripts to generate breaks </li>
<li>Issue 1131 : Support Zest Intercept actions in add-on </li>
<li>Issue 1132 : HttpSender ignores the "Send single cookie request header" option </li>
<li>Issue 1134 : Passive Scan Rule regexes not validated </li>
<li>Issue 1135 : Marketplace tab cant be updated if cfu runs on start</li>
<li>Issue 1137 : ZAP locks up when deleting nodes</li>
<li>Issue 1138 : Passive Scan Rule changes not saved</li>
<li>Issue 1145 : Cookie parsing error if a comma is used</li>
</ul>
<h2>See also</h2>
<table>
<tr><td> </td><td>
<a href="../intro.html">Introduction</a></td><td>the introduction to ZAP</td></tr>
<tr><td> </td><td>
<a href="releases.html">Releases</a></td><td>the full set of releases</td></tr>
<tr><td> </td><td>
<a href="../credits.html">Credits</a></td><td>the people and groups who have made this release possible</td></tr>
</table>
</body>
</html>
| {
"pile_set_name": "Github"
} |
;!/usr/bin/makensis
; This NSIS script creates an installer for QEMU on Windows.
; Copyright (C) 2006-2012 Stefan Weil
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 2 of the License, or
; (at your option) version 3 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, see <http://www.gnu.org/licenses/>.
; NSIS_WIN32_MAKENSIS
!define PRODUCT "QEMU"
!define URL "http://www.qemu-project.org/"
!define UNINST_EXE "$INSTDIR\qemu-uninstall.exe"
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
!ifndef BINDIR
!define BINDIR nsis.tmp
!endif
!ifndef SRCDIR
!define SRCDIR .
!endif
!ifndef OUTFILE
!define OUTFILE "qemu-setup.exe"
!endif
; Optionally install documentation.
!ifndef CONFIG_DOCUMENTATION
!define CONFIG_DOCUMENTATION
!endif
; Use maximum compression.
SetCompressor /SOLID lzma
!include "MUI2.nsh"
; The name of the installer.
Name "QEMU"
; The file to write
OutFile "${OUTFILE}"
; The default installation directory.
!ifdef W64
InstallDir $PROGRAMFILES64\qemu
!else
InstallDir $PROGRAMFILES\qemu
!endif
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
!ifdef W64
InstallDirRegKey HKLM "Software\qemu64" "Install_Dir"
!else
InstallDirRegKey HKLM "Software\qemu32" "Install_Dir"
!endif
; Request administrator privileges for Windows Vista.
RequestExecutionLevel admin
;--------------------------------
; Interface Settings.
;!define MUI_HEADERIMAGE "qemu-nsis.bmp"
; !define MUI_SPECIALBITMAP "qemu.bmp"
!define MUI_ICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
!define MUI_UNICON "${SRCDIR}\pc-bios\qemu-nsis.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${SRCDIR}\pc-bios\qemu-nsis.bmp"
; !define MUI_HEADERIMAGE_BITMAP "qemu-install.bmp"
; !define MUI_HEADERIMAGE_UNBITMAP "qemu-uninstall.bmp"
; !define MUI_COMPONENTSPAGE_SMALLDESC
; !define MUI_WELCOMEPAGE_TEXT "Insert text here.$\r$\n$\r$\n$\r$\n$_CLICK"
;--------------------------------
; Pages.
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_LINK "Visit the QEMU Wiki online!"
!define MUI_FINISHPAGE_LINK_LOCATION "${URL}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
; Languages.
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
;--------------------------------
; The stuff to install.
Section "${PRODUCT} (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath "$INSTDIR"
File "${SRCDIR}\Changelog"
File "${SRCDIR}\COPYING"
File "${SRCDIR}\COPYING.LIB"
File "${SRCDIR}\README"
File "${SRCDIR}\VERSION"
File "${BINDIR}\*.bmp"
File "${BINDIR}\*.bin"
File "${BINDIR}\*.dtb"
File "${BINDIR}\*.rom"
File "${BINDIR}\openbios-*"
File /r "${BINDIR}\keymaps"
!ifdef CONFIG_GTK
File /r "${BINDIR}\share"
!endif
!ifdef W64
SetRegView 64
!endif
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\${PRODUCT} "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "QEMU"
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"${UNINST_EXE}"'
WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
WriteUninstaller "qemu-uninstall.exe"
SectionEnd
Section "Tools" SectionTools
SetOutPath "$INSTDIR"
File "${BINDIR}\qemu-img.exe"
File "${BINDIR}\qemu-io.exe"
SectionEnd
SectionGroup "System Emulations" SectionSystem
!include "${BINDIR}\system-emulations.nsh"
SectionGroupEnd
!ifdef DLLDIR
Section "Libraries (DLL)" SectionDll
SetOutPath "$INSTDIR"
File "${DLLDIR}\*.dll"
SectionEnd
!endif
!ifdef CONFIG_DOCUMENTATION
Section "Documentation" SectionDoc
SetOutPath "$INSTDIR"
File "${BINDIR}\qemu-doc.html"
File "${BINDIR}\qemu-tech.html"
CreateDirectory "$SMPROGRAMS\${PRODUCT}"
CreateShortCut "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk" "$INSTDIR\qemu-doc.html" "" "$INSTDIR\qemu-doc.html" 0
CreateShortCut "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk" "$INSTDIR\qemu-tech.html" "" "$INSTDIR\qemu-tech.html" 0
SectionEnd
!endif
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts" SectionMenu
CreateDirectory "$SMPROGRAMS\${PRODUCT}"
CreateShortCut "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
!ifdef W64
SetRegView 64
!endif
DeleteRegKey HKLM "${UNINST_KEY}"
DeleteRegKey HKLM SOFTWARE\${PRODUCT}
; Remove shortcuts, if any
Delete "$SMPROGRAMS\${PRODUCT}\User Documentation.lnk"
Delete "$SMPROGRAMS\${PRODUCT}\Technical Documentation.lnk"
Delete "$SMPROGRAMS\${PRODUCT}\Uninstall.lnk"
RMDir "$SMPROGRAMS\${PRODUCT}"
; Remove files and directories used
Delete "$INSTDIR\Changelog"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\COPYING.LIB"
Delete "$INSTDIR\README"
Delete "$INSTDIR\VERSION"
Delete "$INSTDIR\*.bmp"
Delete "$INSTDIR\*.bin"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.dtb"
Delete "$INSTDIR\*.rom"
Delete "$INSTDIR\openbios-*"
Delete "$INSTDIR\qemu-img.exe"
Delete "$INSTDIR\qemu-io.exe"
Delete "$INSTDIR\qemu.exe"
Delete "$INSTDIR\qemu-system-*.exe"
Delete "$INSTDIR\qemu-doc.html"
Delete "$INSTDIR\qemu-tech.html"
RMDir /r "$INSTDIR\keymaps"
RMDir /r "$INSTDIR\share"
; Remove generated files
Delete "$INSTDIR\stderr.txt"
Delete "$INSTDIR\stdout.txt"
; Remove uninstaller
Delete "${UNINST_EXE}"
RMDir "$INSTDIR"
SectionEnd
;--------------------------------
; Descriptions (mouse-over).
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SectionSystem} "System emulation."
!insertmacro MUI_DESCRIPTION_TEXT ${Section_alpha} "Alpha system emulation."
!insertmacro MUI_DESCRIPTION_TEXT ${Section_alphaw} "Alpha system emulation (GUI)."
!insertmacro MUI_DESCRIPTION_TEXT ${Section_i386} "PC i386 system emulation."
!insertmacro MUI_DESCRIPTION_TEXT ${Section_i386w} "PC i386 system emulation (GUI)."
!insertmacro MUI_DESCRIPTION_TEXT ${SectionTools} "Tools."
!ifdef DLLDIR
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDll} "Runtime Libraries (DLL)."
!endif
!ifdef CONFIG_DOCUMENTATION
!insertmacro MUI_DESCRIPTION_TEXT ${SectionDoc} "Documentation."
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SectionMenu} "Menu entries."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
; Functions.
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
| {
"pile_set_name": "Github"
} |
# Azerbaijani translations for com.github.muriloventuroso.easyssh package.
# Copyright (C) 2018 THE com.github.muriloventuroso.easyssh'S COPYRIGHT HOLDER
# This file is distributed under the same license as the com.github.muriloventuroso.easyssh package.
# Automatically generated, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: com.github.muriloventuroso.easyssh\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-06-16 11:01-0300\n"
"PO-Revision-Date: 2018-04-23 15:43-0300\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: az\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/MainWindow.vala:104
msgid "EasySSH"
msgstr ""
#: src/MainWindow.vala:543
msgid "Copy"
msgstr ""
#: src/MainWindow.vala:544
msgid "Paste"
msgstr ""
#: src/MainWindow.vala:545
msgid "Select All"
msgstr ""
#: src/MainWindow.vala:546
msgid "Show in File Browser"
msgstr ""
#: src/Views/SourceListView.vala:36 src/Views/SourceListView.vala:75
#: src/Widgets/Connection.vala:62
msgid "Edit"
msgstr ""
#: src/Views/SourceListView.vala:42 src/Views/SourceListView.vala:81
msgid "Duplicate"
msgstr ""
#: src/Views/SourceListView.vala:48 src/Views/SourceListView.vala:87
#: src/Views/SourceListView.vala:1401 src/Views/SourceListView.vala:1403
#: src/Views/SourceListView.vala:1420 src/Views/SourceListView.vala:1422
#: src/Views/SourceListView.vala:1437 src/Views/SourceListView.vala:1439
#: src/Widgets/ConnectionEditor.vala:383 src/Widgets/Connection.vala:66
msgid "Remove"
msgstr ""
#: src/Views/SourceListView.vala:154
msgid "Hosts"
msgstr ""
#: src/Views/SourceListView.vala:156
msgid "Accounts"
msgstr ""
#: src/Views/SourceListView.vala:578
msgid "Please enter the password to unlock the data file"
msgstr ""
#: src/Views/SourceListView.vala:580
msgid "Please enter the password to lock the data file"
msgstr ""
#: src/Views/SourceListView.vala:582
msgid "Password"
msgstr ""
#: src/Views/SourceListView.vala:589 src/Widgets/ConnectionEditor.vala:157
msgid "Cancel"
msgstr ""
#: src/Views/SourceListView.vala:592
msgid "Send"
msgstr ""
#: src/Views/SourceListView.vala:1401
msgid ""
"Are you sure you want to remove this connection and all associated data?"
msgstr ""
#: src/Views/SourceListView.vala:1420
msgid "Are you sure you want to remove this account and all associated data?"
msgstr ""
#: src/Views/SourceListView.vala:1437
msgid "Are you sure you want to remove this bookmark?"
msgstr ""
#: src/Widgets/TerminalBox.vala:224
msgid "Connection Error. Retry?"
msgstr ""
#: src/Widgets/TerminalBox.vala:226 src/Widgets/TerminalBox.vala:272
msgid "No"
msgstr ""
#: src/Widgets/TerminalBox.vala:229 src/Widgets/TerminalBox.vala:275
msgid "Yes"
msgstr ""
#: src/Widgets/TerminalBox.vala:245
msgid "Connection Error."
msgstr ""
#: src/Widgets/TerminalBox.vala:247 src/Widgets/Preferences.vala:173
msgid "Close"
msgstr ""
#: src/Widgets/TerminalBox.vala:250
msgid "Ok"
msgstr ""
#: src/Widgets/TerminalBox.vala:253
msgid "Retry"
msgstr ""
#: src/Widgets/TerminalBox.vala:270
msgid "Fingerprint"
msgstr ""
#: src/Widgets/Welcome.vala:25
msgid "SSH Connection Manager"
msgstr ""
#: src/Widgets/Welcome.vala:26 src/Widgets/ConnectionEditor.vala:190
msgid "Add Connection"
msgstr ""
#: src/Widgets/Welcome.vala:26
msgid "Start by adding an SSH connection to EasySSH"
msgstr ""
#: src/Widgets/HeaderBar.vala:41
msgid "Create a new connection"
msgstr ""
#: src/Widgets/HeaderBar.vala:46
msgid "Local connection"
msgstr ""
#: src/Widgets/HeaderBar.vala:59 src/Widgets/BookmarksPopover.vala:103
msgid "Bookmarks"
msgstr ""
#: src/Widgets/HeaderBar.vala:61 src/Widgets/Preferences.vala:35
msgid "Preferences"
msgstr ""
#: src/Widgets/HeaderBar.vala:63
msgid "Close All Connections"
msgstr ""
#: src/Widgets/HeaderBar.vala:73
msgid "Menu"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:80
msgid "Set Credentials"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:84
msgid "Choose Account"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:106 src/Widgets/ConnectionEditor.vala:220
msgid "Password:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:150
msgid "Select Identity File"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:151
msgid "Change Password to Identity File"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:153
msgid "Save"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:159 src/Widgets/ConnectionEditor.vala:330
msgid "Advanced"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:175
msgid "Username:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:193
msgid "Edit Connection"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:195
msgid "Duplicate Connection"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:200 src/Widgets/BookmarksPopover.vala:123
msgid "Name:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:203
msgid "Group:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:205
msgid "Host:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:207
msgid "Port:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:216
msgid "Identity File:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:229
msgid "SSH Config:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:337 src/Widgets/Preferences.vala:145
msgid "Terminal Background Color:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:346 src/Widgets/Preferences.vala:148
msgid "Terminal Font:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:372
msgid "Extra Arguments:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:393
msgid "Forwarded Ports:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:396
msgid "Add new forwarded port"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:398
msgid "Source Port:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:401
msgid "Destination:"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:406
msgid "Local"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:409
msgid "Remote"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:415
msgid "Add Tunnel"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:437 src/Widgets/Preferences.vala:159
msgid "Appearance"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:438
msgid "Tunnels"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:439
msgid "Other"
msgstr ""
#: src/Widgets/ConnectionEditor.vala:499
msgid "Name is already taken"
msgstr ""
#: src/Widgets/Connection.vala:59
msgid "Connect"
msgstr ""
#: src/Widgets/Preferences.vala:42
msgid "Restart to apply changes"
msgstr ""
#: src/Widgets/Preferences.vala:48
msgid "Select Hosts Configuration Folder…"
msgstr ""
#: src/Widgets/Preferences.vala:83
msgid "0 to disable. -1 to unlimited"
msgstr ""
#: src/Widgets/Preferences.vala:121
msgid "Hosts Configuration Folder:"
msgstr ""
#: src/Widgets/Preferences.vala:124
msgid "Scrollback lines:"
msgstr ""
#: src/Widgets/Preferences.vala:128
msgid "Restore Opened Hosts:"
msgstr ""
#: src/Widgets/Preferences.vala:131
msgid "Sync SSH Config:"
msgstr ""
#: src/Widgets/Preferences.vala:134
msgid "Audible Bell:"
msgstr ""
#: src/Widgets/Preferences.vala:138
msgid "Encrypt data:"
msgstr ""
#: src/Widgets/Preferences.vala:151
msgid "Use Dark Theme:"
msgstr ""
#: src/Widgets/Preferences.vala:158
msgid "General"
msgstr ""
#: src/Widgets/TerminalWidget.vala:31
msgid "Terminal"
msgstr ""
#: src/Widgets/BookmarksPopover.vala:51
msgid "Search for bookmarks"
msgstr ""
#: src/Widgets/BookmarksPopover.vala:55
msgid "Create a new bookmark"
msgstr ""
#: src/Widgets/BookmarksPopover.vala:68
msgid "Run"
msgstr ""
#: src/Widgets/BookmarksPopover.vala:72
msgid "Delete"
msgstr ""
#: src/Widgets/BookmarksPopover.vala:92 src/Widgets/BookmarksPopover.vala:110
msgid "Add Bookmark"
msgstr ""
#: src/Widgets/BookmarksPopover.vala:125
msgid "Command:"
msgstr ""
#: src/Widgets/BookmarksPopover.vala:237 src/Widgets/BookmarksPopover.vala:241
msgid "Default"
msgstr ""
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env node
/*
Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
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.
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 <COPYRIGHT HOLDER> 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.
*/
/*jslint sloppy:true plusplus:true node:true rhino:true */
/*global phantom:true */
var fs, system, esprima, options, fnames, count;
if (typeof esprima === 'undefined') {
// PhantomJS can only require() relative files
if (typeof phantom === 'object') {
fs = require('fs');
system = require('system');
esprima = require('./esprima');
} else if (typeof require === 'function') {
fs = require('fs');
esprima = require('esprima');
} else if (typeof load === 'function') {
try {
load('esprima.js');
} catch (e) {
load('../esprima.js');
}
}
}
// Shims to Node.js objects when running under PhantomJS 1.7+.
if (typeof phantom === 'object') {
fs.readFileSync = fs.read;
process = {
argv: [].slice.call(system.args),
exit: phantom.exit
};
process.argv.unshift('phantomjs');
}
// Shims to Node.js objects when running under Rhino.
if (typeof console === 'undefined' && typeof process === 'undefined') {
console = { log: print };
fs = { readFileSync: readFile };
process = { argv: arguments, exit: quit };
process.argv.unshift('esvalidate.js');
process.argv.unshift('rhino');
}
function showUsage() {
console.log('Usage:');
console.log(' esvalidate [options] file.js');
console.log();
console.log('Available options:');
console.log();
console.log(' --format=type Set the report format, plain (default) or junit');
console.log(' -v, --version Print program version');
console.log();
process.exit(1);
}
if (process.argv.length <= 2) {
showUsage();
}
options = {
format: 'plain'
};
fnames = [];
process.argv.splice(2).forEach(function (entry) {
if (entry === '-h' || entry === '--help') {
showUsage();
} else if (entry === '-v' || entry === '--version') {
console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
console.log();
process.exit(0);
} else if (entry.slice(0, 9) === '--format=') {
options.format = entry.slice(9);
if (options.format !== 'plain' && options.format !== 'junit') {
console.log('Error: unknown report format ' + options.format + '.');
process.exit(1);
}
} else if (entry.slice(0, 2) === '--') {
console.log('Error: unknown option ' + entry + '.');
process.exit(1);
} else {
fnames.push(entry);
}
});
if (fnames.length === 0) {
console.log('Error: no input file.');
process.exit(1);
}
if (options.format === 'junit') {
console.log('<?xml version="1.0" encoding="UTF-8"?>');
console.log('<testsuites>');
}
count = 0;
fnames.forEach(function (fname) {
var content, timestamp, syntax, name;
try {
content = fs.readFileSync(fname, 'utf-8');
if (content[0] === '#' && content[1] === '!') {
content = '//' + content.substr(2, content.length);
}
timestamp = Date.now();
syntax = esprima.parse(content, { tolerant: true });
if (options.format === 'junit') {
name = fname;
if (name.lastIndexOf('/') >= 0) {
name = name.slice(name.lastIndexOf('/') + 1);
}
console.log('<testsuite name="' + fname + '" errors="0" ' +
' failures="' + syntax.errors.length + '" ' +
' tests="' + syntax.errors.length + '" ' +
' time="' + Math.round((Date.now() - timestamp) / 1000) +
'">');
syntax.errors.forEach(function (error) {
var msg = error.message;
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
' time="0">');
console.log(' <error type="SyntaxError" message="' + error.message + '">' +
error.message + '(' + name + ':' + error.lineNumber + ')' +
'</error>');
console.log(' </testcase>');
});
console.log('</testsuite>');
} else if (options.format === 'plain') {
syntax.errors.forEach(function (error) {
var msg = error.message;
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
msg = fname + ':' + error.lineNumber + ': ' + msg;
console.log(msg);
++count;
});
}
} catch (e) {
++count;
if (options.format === 'junit') {
console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
console.log(' <error type="ParseError" message="' + e.message + '">' +
e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
')</error>');
console.log(' </testcase>');
console.log('</testsuite>');
} else {
console.log('Error: ' + e.message);
}
}
});
if (options.format === 'junit') {
console.log('</testsuites>');
}
if (count > 0) {
process.exit(1);
}
if (count === 0 && typeof phantom === 'object') {
process.exit(0);
}
| {
"pile_set_name": "Github"
} |
<?php
namespace Guzzle\Service\Command;
use Guzzle\Common\Exception\InvalidArgumentException;
use Guzzle\Common\Exception\UnexpectedValueException;
use Guzzle\Http\Message\RequestInterface;
/**
* A ClosureCommand is a command that allows dynamic commands to be created at runtime using a closure to prepare the
* request. A closure key and \Closure value must be passed to the command in the constructor. The closure must
* accept the command object as an argument.
*/
class ClosureCommand extends AbstractCommand
{
/**
* {@inheritdoc}
* @throws InvalidArgumentException if a closure was not passed
*/
protected function init()
{
if (!$this['closure']) {
throw new InvalidArgumentException('A closure must be passed in the parameters array');
}
}
/**
* {@inheritdoc}
* @throws UnexpectedValueException If the closure does not return a request
*/
protected function build()
{
$closure = $this['closure'];
/** @var $closure \Closure */
$this->request = $closure($this, $this->operation);
if (!$this->request || !$this->request instanceof RequestInterface) {
throw new UnexpectedValueException('Closure command did not return a RequestInterface object');
}
}
}
| {
"pile_set_name": "Github"
} |
<?php
declare(strict_types=1);
namespace DI\Definition\Resolver;
use DI\Definition\Definition;
use DI\Definition\Exception\InvalidDefinition;
use DI\Definition\ObjectDefinition;
use DI\Definition\ObjectDefinition\PropertyInjection;
use DI\DependencyException;
use DI\Proxy\ProxyFactory;
use Exception;
use ProxyManager\Proxy\LazyLoadingInterface;
use Psr\Container\NotFoundExceptionInterface;
use ReflectionClass;
use ReflectionProperty;
/**
* Create objects based on an object definition.
*
* @since 4.0
* @author Matthieu Napoli <[email protected]>
*/
class ObjectCreator implements DefinitionResolver
{
/**
* @var ProxyFactory
*/
private $proxyFactory;
/**
* @var ParameterResolver
*/
private $parameterResolver;
/**
* @var DefinitionResolver
*/
private $definitionResolver;
/**
* @param DefinitionResolver $definitionResolver Used to resolve nested definitions.
* @param ProxyFactory $proxyFactory Used to create proxies for lazy injections.
*/
public function __construct(
DefinitionResolver $definitionResolver,
ProxyFactory $proxyFactory
) {
$this->definitionResolver = $definitionResolver;
$this->proxyFactory = $proxyFactory;
$this->parameterResolver = new ParameterResolver($definitionResolver);
}
/**
* Resolve a class definition to a value.
*
* This will create a new instance of the class using the injections points defined.
*
* @param ObjectDefinition $definition
*
* @return object|null
*/
public function resolve(Definition $definition, array $parameters = [])
{
// Lazy?
if ($definition->isLazy()) {
return $this->createProxy($definition, $parameters);
}
return $this->createInstance($definition, $parameters);
}
/**
* The definition is not resolvable if the class is not instantiable (interface or abstract)
* or if the class doesn't exist.
*
* @param ObjectDefinition $definition
*/
public function isResolvable(Definition $definition, array $parameters = []) : bool
{
return $definition->isInstantiable();
}
/**
* Returns a proxy instance.
*/
private function createProxy(ObjectDefinition $definition, array $parameters) : LazyLoadingInterface
{
/** @noinspection PhpUnusedParameterInspection */
$proxy = $this->proxyFactory->createProxy(
$definition->getClassName(),
function (& $wrappedObject, $proxy, $method, $params, & $initializer) use ($definition, $parameters) {
$wrappedObject = $this->createInstance($definition, $parameters);
$initializer = null; // turning off further lazy initialization
return true;
}
);
return $proxy;
}
/**
* Creates an instance of the class and injects dependencies..
*
* @param array $parameters Optional parameters to use to create the instance.
*
* @throws InvalidDefinition
* @throws DependencyException
* @return object
*/
private function createInstance(ObjectDefinition $definition, array $parameters)
{
// Check that the class is instantiable
if (! $definition->isInstantiable()) {
// Check that the class exists
if (! $definition->classExists()) {
throw InvalidDefinition::create($definition, sprintf(
'Entry "%s" cannot be resolved: the class doesn\'t exist',
$definition->getName()
));
}
throw InvalidDefinition::create($definition, sprintf(
'Entry "%s" cannot be resolved: the class is not instantiable',
$definition->getName()
));
}
$classname = $definition->getClassName();
$classReflection = new ReflectionClass($classname);
$constructorInjection = $definition->getConstructorInjection();
try {
$args = $this->parameterResolver->resolveParameters(
$constructorInjection,
$classReflection->getConstructor(),
$parameters
);
$object = new $classname(...$args);
$this->injectMethodsAndProperties($object, $definition);
} catch (NotFoundExceptionInterface $e) {
throw new DependencyException(sprintf(
'Error while injecting dependencies into %s: %s',
$classReflection->getName(),
$e->getMessage()
), 0, $e);
} catch (InvalidDefinition $e) {
throw InvalidDefinition::create($definition, sprintf(
'Entry "%s" cannot be resolved: %s',
$definition->getName(),
$e->getMessage()
));
}
return $object;
}
protected function injectMethodsAndProperties($object, ObjectDefinition $objectDefinition)
{
// Property injections
foreach ($objectDefinition->getPropertyInjections() as $propertyInjection) {
$this->injectProperty($object, $propertyInjection);
}
// Method injections
foreach ($objectDefinition->getMethodInjections() as $methodInjection) {
$methodReflection = new \ReflectionMethod($object, $methodInjection->getMethodName());
$args = $this->parameterResolver->resolveParameters($methodInjection, $methodReflection);
$methodReflection->invokeArgs($object, $args);
}
}
/**
* Inject dependencies into properties.
*
* @param object $object Object to inject dependencies into
* @param PropertyInjection $propertyInjection Property injection definition
*
* @throws DependencyException
* @throws InvalidDefinition
*/
private function injectProperty($object, PropertyInjection $propertyInjection)
{
$propertyName = $propertyInjection->getPropertyName();
$value = $propertyInjection->getValue();
if ($value instanceof Definition) {
try {
$value = $this->definitionResolver->resolve($value);
} catch (DependencyException $e) {
throw $e;
} catch (Exception $e) {
throw new DependencyException(sprintf(
'Error while injecting in %s::%s. %s',
get_class($object),
$propertyName,
$e->getMessage()
), 0, $e);
}
}
self::setPrivatePropertyValue($propertyInjection->getClassName(), $object, $propertyName, $value);
}
public static function setPrivatePropertyValue(string $className = null, $object, string $propertyName, $propertyValue)
{
$className = $className ?: get_class($object);
$property = new ReflectionProperty($className, $propertyName);
if (! $property->isPublic()) {
$property->setAccessible(true);
}
$property->setValue($object, $propertyValue);
}
}
| {
"pile_set_name": "Github"
} |
package org.hisp.dhis.option;
/*
* Copyright (c) 2004-2020, University of Oslo
* All rights reserved.
*
* 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 the HISP project 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.
*/
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.ValueType;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* @author Lars Helge Overland
*/
public class OptionServiceTest
extends DhisSpringTest
{
@Autowired
private OptionService optionService;
private List<Option> options = new ArrayList<>();
private OptionSet optionSetA = new OptionSet( "OptionSetA", ValueType.TEXT );
private OptionSet optionSetB = new OptionSet( "OptionSetB", ValueType.TEXT );
private OptionSet optionSetC = new OptionSet( "OptionSetC", ValueType.TEXT );
private OptionGroup optionGroupA;
private OptionGroup optionGroupB;
private OptionGroup optionGroupC;
private OptionGroupSet optionGroupSetA;
private OptionGroupSet optionGroupSetB;
private OptionGroupSet optionGroupSetC;
private Option option1;
private Option option2;
private Option option3;
private Option option4;
@Override
public void setUpTest()
{
option1 = new Option( "OptA1", "OptA1" );
option2 = new Option( "OptA2", "OptA2" );
option3 = new Option( "OptB1", "OptB1" );
option4 = new Option( "OptB2", "OptB2" );
options.add( option1 );
options.add( option2 );
options.add( option3 );
options.add( option4 );
optionSetA.setOptions( options );
optionSetB.setOptions( options );
optionGroupA = new OptionGroup( "OptionGroupA" );
optionGroupA.setShortName( "ShortNameA" );
optionGroupB = new OptionGroup( "OptionGroupB" );
optionGroupB.setShortName( "ShortNameB" );
optionGroupC = new OptionGroup( "OptionGroupC" );
optionGroupC.setShortName( "ShortNameC" );
optionGroupSetA = new OptionGroupSet( "OptionGroupSetA" );
optionGroupSetB = new OptionGroupSet( "OptionGroupSetB" );
optionGroupSetC = new OptionGroupSet( "OptionGroupSetC" );
}
@Test
public void testSaveGet()
{
long idA = optionService.saveOptionSet( optionSetA );
long idB = optionService.saveOptionSet( optionSetB );
long idC = optionService.saveOptionSet( optionSetC );
OptionSet actualA = optionService.getOptionSet( idA );
OptionSet actualB = optionService.getOptionSet( idB );
OptionSet actualC = optionService.getOptionSet( idC );
assertEquals( optionSetA, actualA );
assertEquals( optionSetB, actualB );
assertEquals( optionSetC, actualC );
assertEquals( 4, optionSetA.getOptions().size() );
assertEquals( 4, optionSetB.getOptions().size() );
assertEquals( 0, optionSetC.getOptions().size() );
assertTrue( optionSetA.getOptions().contains( option1 ) );
assertTrue( optionSetA.getOptions().contains( option2 ) );
assertTrue( optionSetA.getOptions().contains( option3 ) );
assertTrue( optionSetA.getOptions().contains( option4 ) );
}
@Test
public void testGetList()
{
long idA = optionService.saveOptionSet( optionSetA );
List<Option> options = optionService.getOptions( idA, "OptA", 10 );
assertEquals( 2, options.size() );
options = optionService.getOptions( idA, "OptA1", 10 );
assertEquals( 1, options.size() );
options = optionService.getOptions( idA, "OptA1", null );
assertEquals( 1, options.size() );
options = optionService.getOptions( idA, "Opt", null );
assertEquals( 4, options.size() );
options = optionService.getOptions( idA, "Opt", 3 );
assertEquals( 3, options.size() );
}
// -------------------------------------------------------------------------
// OptionGroup
// -------------------------------------------------------------------------
@Test
public void testAddGetOptionGroup()
{
optionGroupA.getMembers().add( option1 );
optionGroupA.getMembers().add( option2 );
optionGroupB.getMembers().add( option3 );
long idA = optionService.saveOptionGroup( optionGroupA );
long idB = optionService.saveOptionGroup( optionGroupB );
long idC = optionService.saveOptionGroup( optionGroupC );
assertEquals( optionGroupA, optionService.getOptionGroup( idA ) );
assertEquals( optionGroupB, optionService.getOptionGroup( idB ) );
assertEquals( optionGroupC, optionService.getOptionGroup( idC ) );
assertEquals( 2, optionService.getOptionGroup( idA ).getMembers().size() );
assertEquals( 1, optionService.getOptionGroup( idB ).getMembers().size() );
assertEquals( 0, optionService.getOptionGroup( idC ).getMembers().size() );
}
// -------------------------------------------------------------------------
// OptionGroupSet
// -------------------------------------------------------------------------
@Test
public void testAddGetOptionGroupSet()
{
optionGroupA.getMembers().add( option1 );
optionGroupA.getMembers().add( option2 );
optionGroupB.getMembers().add( option3 );
optionService.saveOptionGroup( optionGroupA );
optionService.saveOptionGroup( optionGroupB );
optionService.saveOptionGroup( optionGroupC );
optionGroupSetA.getMembers().add( optionGroupA );
optionGroupSetA.getMembers().add( optionGroupB );
optionGroupSetB.getMembers().add( optionGroupC );
long idA = optionService.saveOptionGroupSet( optionGroupSetA );
long idB = optionService.saveOptionGroupSet( optionGroupSetB );
long idC = optionService.saveOptionGroupSet( optionGroupSetC );
assertEquals( optionGroupSetA, optionService.getOptionGroupSet( idA ) );
assertEquals( optionGroupSetB, optionService.getOptionGroupSet( idB ) );
assertEquals( optionGroupSetC, optionService.getOptionGroupSet( idC ) );
assertEquals( 2, optionService.getOptionGroupSet( idA ).getMembers().size() );
assertEquals( 1, optionService.getOptionGroupSet( idB ).getMembers().size() );
assertEquals( 0, optionService.getOptionGroupSet( idC ).getMembers().size() );
}
}
| {
"pile_set_name": "Github"
} |
Clazz.declarePackage ("java.util.zip");
Clazz.load (["JU.CRC32"], "java.util.zip.CRC32", null, function () {
c$ = Clazz.declareType (java.util.zip, "CRC32", JU.CRC32);
});
| {
"pile_set_name": "Github"
} |
## DBsubject(Calculus - single variable)
## DBchapter(Applications of integration)
## DBsection(Other physics and engineering applications)
## Institution(W.H.Freeman)
## Author(Justask)
## MLT(LinearDensityRod)
## Level(4)
## TitleText1('Calculus: Early Transcendentals')
## AuthorText1('Rogawski')
## EditionText1('2')
## Section1('6.2')
## Problem1('26')
## KEYWORDS('calculus', 'integrals', 'integration', 'volume', 'density', 'mass')
DOCUMENT();
# Load whatever macros you need for the problem
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGgraphmacros.pl",
"freemanMacros.pl",
"PGcourse.pl"
);
## Do NOT show partial correct answers
$showPartialCorrectAnswers = 0;
TEXT(beginproblem());
$l=random(1,5,1);
BEGIN_TEXT
\{ textbook_ref_exact("Rogawski ET 2e", "6.2","26") \}$BR
Find the total mass of a $l-m rod whose linear density function is \(\rho(x) = 1 + 0.5 \sin(\pi x)\) kg/m for \(0 \le x \le $l\).
Your answer must include units.
$PAR
\(M=\)\{ans_rule()\}
END_TEXT
$m=$l-cos($PI*$l)/$PI*0.5+0.5/$PI;
ANS(num_cmp($m, units => 'kg'));
SOLUTION(EV3(<<'END_SOLUTION'));
$PAR
$SOL
The total mass \(M\) of the rod, in kg's, is
\[
\begin{array}{ll}
M & = \int_0^{$l}\rho(x)dx\cr
&=\int_0^{$l}(1+.5\sin(\pi x))dx\cr
&=\left.\left(x-.5\frac{\cos \pi x}{\pi}\right)\right|_0^{$l}\cr
&=\{($l % 2==0)?$l:"$l+\frac{1}{\pi}"\}
\end{array}
\]
Thus, \(M=$m\) kg.
END_SOLUTION
ENDDOCUMENT();
| {
"pile_set_name": "Github"
} |
/*jslint browser: true, devel: true, node: true, ass: true, nomen: true, unparam: true, indent: 4 */
/**
* @license
* Copyright (c) 2015 The ExpandJS authors. All rights reserved.
* This code may only be used under the BSD style license found at https://expandjs.github.io/LICENSE.txt
* The complete set of authors may be found at https://expandjs.github.io/AUTHORS.txt
* The complete set of contributors may be found at https://expandjs.github.io/CONTRIBUTORS.txt
*/
(function () {
"use strict";
var _ = require('lodash'),
assertArgument = require('../assert/assertArgument'),
toArray = require('../caster/toArray');
/**
* Gets all but the first element of `array`.
*
* ```js
* XP.rest([1, 2, 3]);
* // => [2, 3]
* ```
*
* @function rest
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
*/
module.exports = function rest(array) {
assertArgument(array = toArray(array), 1, 'Arrayable');
return _.rest(array);
};
}()); | {
"pile_set_name": "Github"
} |
/*
Copyright 2016 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.
*/
package sysctl
import (
"strings"
)
// Namespace represents a kernel namespace name.
type Namespace string
const (
// the Linux IPC namespace
IpcNamespace = Namespace("ipc")
// the network namespace
NetNamespace = Namespace("net")
// the zero value if no namespace is known
UnknownNamespace = Namespace("")
)
var namespaces = map[string]Namespace{
"kernel.sem": IpcNamespace,
}
var prefixNamespaces = map[string]Namespace{
"kernel.shm": IpcNamespace,
"kernel.msg": IpcNamespace,
"fs.mqueue.": IpcNamespace,
"net.": NetNamespace,
}
// NamespacedBy returns the namespace of the Linux kernel for a sysctl, or
// UnknownNamespace if the sysctl is not known to be namespaced.
func NamespacedBy(val string) Namespace {
if ns, found := namespaces[val]; found {
return ns
}
for p, ns := range prefixNamespaces {
if strings.HasPrefix(val, p) {
return ns
}
}
return UnknownNamespace
}
| {
"pile_set_name": "Github"
} |
Matrix<float,2,3> m = Matrix<float,2,3>::Random();
Matrix2f y = Matrix2f::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the matrix y:" << endl << y << endl;
Matrix<float,3,2> x = m.fullPivLu().solve(y);
if((m*x).isApprox(y))
{
cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
}
else
cout << "The equation mx=y does not have any solution." << endl;
| {
"pile_set_name": "Github"
} |
extension APIScope {
/// https://vk.com/dev/fave
public enum Fave: APIMethod {
case addGroup(Parameters)
case addLink(Parameters)
case addUser(Parameters)
case getLinks(Parameters)
case getMarketItems(Parameters)
case getPhotos(Parameters)
case getPosts(Parameters)
case getUsers(Parameters)
case getVideos(Parameters)
case removeGroup(Parameters)
case removeLink(Parameters)
case removeUser(Parameters)
}
}
| {
"pile_set_name": "Github"
} |
CONFIG_PPC=y
CONFIG_SYS_TEXT_BASE=0xEFF40000
CONFIG_ENV_SIZE=0x2000
CONFIG_ENV_SECT_SIZE=0x20000
CONFIG_MPC85xx=y
CONFIG_TARGET_T2081QDS=y
CONFIG_FIT=y
CONFIG_FIT_VERBOSE=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_OF_STDOUT_VIA_ALIAS=y
CONFIG_BOOTDELAY=10
CONFIG_BOARD_EARLY_INIT_R=y
CONFIG_HUSH_PARSER=y
CONFIG_CMD_IMLS=y
CONFIG_CMD_GREPENV=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_SF=y
CONFIG_CMD_USB=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_MII=y
CONFIG_CMD_PING=y
CONFIG_MP=y
CONFIG_CMD_EXT2=y
CONFIG_CMD_FAT=y
CONFIG_CMD_MTDPARTS=y
CONFIG_MTDIDS_DEFAULT="nor0=fe8000000.nor,nand0=fff800000.flash,spi0=spife110000.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=fe8000000.nor:1m(uboot),5m(kernel),128k(dtb),96m(fs),-(user);fff800000.flash:1m(uboot),5m(kernel),128k(dtb),96m(fs),-(user);spife110000.0:1m(uboot),5m(kernel),128k(dtb),-(user)"
CONFIG_ENV_IS_IN_FLASH=y
CONFIG_ENV_ADDR=0xEFF20000
CONFIG_FSL_CAAM=y
CONFIG_FSL_ESDHC=y
CONFIG_MTD=y
CONFIG_MTD_NOR_FLASH=y
CONFIG_FLASH_CFI_DRIVER=y
CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
CONFIG_FLASH_CFI_MTD=y
CONFIG_SYS_FLASH_CFI=y
CONFIG_SPI_FLASH=y
CONFIG_SF_DEFAULT_MODE=0
CONFIG_SF_DEFAULT_SPEED=10000000
CONFIG_SPI_FLASH_EON=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_SST=y
CONFIG_PHYLIB=y
CONFIG_PHY_AQUANTIA=y
CONFIG_E1000=y
CONFIG_FMAN_ENET=y
CONFIG_MII=y
CONFIG_SYS_QE_FMAN_FW_IN_NOR=y
CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_FSL_ESPI=y
CONFIG_USB=y
CONFIG_USB_STORAGE=y
CONFIG_OF_LIBFDT=y
| {
"pile_set_name": "Github"
} |
{
"short": "id",
"long": "Indonesian",
"createdBy": "galuhsahid"
}
| {
"pile_set_name": "Github"
} |
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
if( DEM_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" )
endif()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_7ZIP_PPMD_SUPPPORT" )
set( LZMA_FILES
C/7zArcIn.c
C/7zBuf.c
C/7zCrc.c
C/7zCrcOpt.c
C/7zDec.c
C/7zStream.c
C/Bcj2.c
C/Bra.c
C/Bra86.c
C/BraIA64.c
C/CpuArch.c
C/Delta.c
C/LzFind.c
C/Lzma2Dec.c
C/LzmaDec.c
C/LzmaEnc.c
C/Ppmd7.c
C/Ppmd7Dec.c )
if( WIN32 )
set( LZMA_FILES ${LZMA_FILES} C/LzFindMt.c C/Threads.c )
else()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_7ZIP_ST" )
endif()
add_library( lzma STATIC ${LZMA_FILES} )
target_link_libraries( lzma )
| {
"pile_set_name": "Github"
} |
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ConnectorMBean.java,v 1.4 2002/05/02 02:03:15 amyroh Exp $
* $Revision: 1.4 $
* $Date: 2002/05/02 02:03:15 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software 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.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [email protected].
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
* ITS 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 software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.catalina.mbeans;
import java.lang.reflect.Method;
import javax.management.MBeanException;
import javax.management.RuntimeOperationsException;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
* <code>org.apache.coyote.tomcat4.CoyoteConnector</code> component.</p>
*
* @author Amy Roh
* @version $Revision: 1.4 $ $Date: 2002/05/02 02:03:15 $
*/
public class ConnectorMBean extends ClassNameMBean {
// ----------------------------------------------------------- Constructors
/**
* Construct a <code>ModelMBean</code> with default
* <code>ModelMBeanInfo</code> information.
*
* @exception MBeanException if the initializer of an object
* throws an exception
* @exception RuntimeOperationsException if an IllegalArgumentException
* occurs
*/
public ConnectorMBean()
throws MBeanException, RuntimeOperationsException {
super();
}
// ------------------------------------------------------------- Attributes
// ------------------------------------------------------------- Operations
/**
* Return Client authentication info
*
* @exception Exception if an MBean cannot be created or registered
*/
public boolean getClientAuth()
throws Exception {
Object clientAuthObj = null;
Class coyoteConnectorCls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
if (coyoteConnectorCls.isInstance(this.resource)) {
// get factory
Method meth1 = coyoteConnectorCls.getMethod("getFactory", null);
Object factory = meth1.invoke(this.resource, null);
Class coyoteServerSocketFactoryCls = Class.forName("org.apache.coyote.tomcat4.CoyoteServerSocketFactory");
if (coyoteServerSocketFactoryCls.isInstance(factory)) {
// get clientAuth
Method meth2 = coyoteServerSocketFactoryCls.getMethod("getClientAuth", null);
clientAuthObj = meth2.invoke(factory, null);
}
}
if (clientAuthObj instanceof Boolean) {
return ((Boolean)clientAuthObj).booleanValue();
} else return false;
}
/**
* Set Client authentication info
*
* @exception Exception if an MBean cannot be created or registered
*/
public void setClientAuth(boolean clientAuth)
throws Exception {
Class coyoteConnectorCls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
if (coyoteConnectorCls.isInstance(this.resource)) {
// get factory
Method meth1 = coyoteConnectorCls.getMethod("getFactory", null);
Object factory = meth1.invoke(this.resource, null);
Class coyoteServerSocketFactoryCls = Class.forName("org.apache.coyote.tomcat4.CoyoteServerSocketFactory");
if (coyoteServerSocketFactoryCls.isInstance(factory)) {
// set clientAuth
Class partypes2 [] = new Class[1];
partypes2[0] = Boolean.TYPE;
Method meth2 = coyoteServerSocketFactoryCls.getMethod("setClientAuth", partypes2);
Object arglist2[] = new Object[1];
arglist2[0] = new Boolean(clientAuth);
meth2.invoke(factory, arglist2);
}
}
}
/**
* Return keystoreFile
*
* @exception Exception if an MBean cannot be created or registered
*/
public String getKeystoreFile()
throws Exception {
Object keystoreFileObj = null;
Class coyoteConnectorCls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
if (coyoteConnectorCls.isInstance(this.resource)) {
// get keystoreFile
Method meth1 = coyoteConnectorCls.getMethod("getFactory", null);
Object factory = meth1.invoke(this.resource, null);
Class coyoteServerSocketFactoryCls = Class.forName("org.apache.coyote.tomcat4.CoyoteServerSocketFactory");
if (coyoteServerSocketFactoryCls.isInstance(factory)) {
// get keystoreFile
Method meth2 = coyoteServerSocketFactoryCls.getMethod("getKeystoreFile", null);
keystoreFileObj = meth2.invoke(factory, null);
}
}
if (keystoreFileObj == null) {
return null;
} else {
return keystoreFileObj.toString();
}
}
/**
* Set keystoreFile
*
* @exception Exception if an MBean cannot be created or registered
*/
public void setKeystoreFile(String keystoreFile)
throws Exception {
if (keystoreFile == null) {
keystoreFile = "";
}
Class coyoteConnectorCls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
if (coyoteConnectorCls.isInstance(this.resource)) {
// get factory
Method meth1 = coyoteConnectorCls.getMethod("getFactory", null);
Object factory = meth1.invoke(this.resource, null);
Class coyoteServerSocketFactoryCls = Class.forName("org.apache.coyote.tomcat4.CoyoteServerSocketFactory");
if (coyoteServerSocketFactoryCls.isInstance(factory)) {
// set keystoreFile
Class partypes2 [] = new Class[1];
String str = new String();
partypes2[0] = str.getClass();
Method meth2 = coyoteServerSocketFactoryCls.getMethod("setKeystoreFile", partypes2);
Object arglist2[] = new Object[1];
arglist2[0] = keystoreFile;
meth2.invoke(factory, arglist2);
}
}
}
/**
* Return keystorePass
*
* @exception Exception if an MBean cannot be created or registered
*/
public String getKeystorePass()
throws Exception {
Object keystorePassObj = null;
Class coyoteConnectorCls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
if (coyoteConnectorCls.isInstance(this.resource)) {
// get factory
Method meth1 = coyoteConnectorCls.getMethod("getFactory", null);
Object factory = meth1.invoke(this.resource, null);
Class coyoteServerSocketFactoryCls = Class.forName("org.apache.coyote.tomcat4.CoyoteServerSocketFactory");
if (coyoteServerSocketFactoryCls.isInstance(factory)) {
// get keystorePass
Method meth2 = coyoteServerSocketFactoryCls.getMethod("getKeystorePass", null);
keystorePassObj = meth2.invoke(factory, null);
}
}
if (keystorePassObj == null) {
return null;
} else {
return keystorePassObj.toString();
}
}
/**
* Set keystorePass
*
* @exception Exception if an MBean cannot be created or registered
*/
public void setKeystorePass(String keystorePass)
throws Exception {
if (keystorePass == null) {
keystorePass = "";
}
Class coyoteConnectorCls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
if (coyoteConnectorCls.isInstance(this.resource)) {
// get factory
Method meth1 = coyoteConnectorCls.getMethod("getFactory", null);
Object factory = meth1.invoke(this.resource, null);
Class coyoteServerSocketFactoryCls = Class.forName("org.apache.coyote.tomcat4.CoyoteServerSocketFactory");
if (coyoteServerSocketFactoryCls.isInstance(factory)) {
// set keystorePass
Class partypes2 [] = new Class[1];
String str = new String();
partypes2[0] = str.getClass();
Method meth2 = coyoteServerSocketFactoryCls.getMethod("setKeystorePass", partypes2);
Object arglist2[] = new Object[1];
arglist2[0] = keystorePass;
meth2.invoke(factory, arglist2);
}
}
}
}
| {
"pile_set_name": "Github"
} |
msgid ""
msgstr ""
"Project-Id-Version: ehforwarderbot\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-25 14:13+0800\n"
"PO-Revision-Date: 2020-01-31 08:56\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Turkish\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Crowdin-Project: ehforwarderbot\n"
"X-Crowdin-Language: tr\n"
"X-Crowdin-File: /ehForwarderBot/docs/_build/locale/guide/slave.pot\n"
"Language: tr_TR\n"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:2
#: aa19f8f651de417e93ba53a0a458c913
msgid "Slave channels"
msgstr "Bağımlı kanallar"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:4
#: 9141745beca1483ca7050b74e8a9aa6a
msgid "Slave channel is more like a wrap over an API of IM, it encloses messages from the IM into appropriate objects and deliver it to the master channel."
msgstr "Bağımlı kanal, IM'nin API'si üzerindeki bir pakete benziyor, IM'den gelen iletileri uygun nesnelere ekler ve onu ana kanala teslim eder."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:8
#: c2bc0744d1bd4ab0ba5d1ffa620fba45
msgid "Although we suggest that slave channel should match with an IM platform, but you may try to model it for anything that can deliver information as messages, and has a limited list of end-points to deliver messages to and from as chats."
msgstr "Bağımlı kanalın bir IM platformuyla eşleşmesi gerektiğini önermemize rağmen, bilgileri mesaj olarak iletebilen her şey için modellemeyi deneyebilirsiniz, ve sohbetlere ve sohbetlerden mesaj iletmek için son noktaların sınırlı bir listesine sahiptir."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:14
#: 6b44ab973c63402ebdcde5a34f64c6e2
msgid "In most of the cases, slave channels SHOULD be identified as one single user from the IM platform, instead of a bot. You should only use a bot for slave channels when:"
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:19
#: 753e52aa8dc8442082977071c237977f
msgid "the IM platform puts no difference between a user and a bot, or"
msgstr "IM platformu kullanıcı ve bot arasında fark etmez, veya"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:21
#: f2201b7d329d48a6952bc466f8157d89
msgid "bots on the IM platform can do exactly same things, if not more, as a user, and bots can be created easier than user account."
msgstr "iM platformundaki botlar, aynı şeyleri bir kullanıcı olarak yapabilir, eğer daha fazla değilse, bir kullanıcı olarak, botlar kullanıcı hesabından daha kolay oluşturulabilir."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:28
#: f050e708017447a2a1fd779d078fed03
msgid "Additional features"
msgstr "Ek özellikler"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:30
#: 1517b7e46b3a4643b3055a520f3b52cd
msgid "Slave channels can offer more functions than what EFB requires, such as creating groups, search for friends, etc, via *additional features*."
msgstr "Bağımlı kanallar, EFB'nin ihtiyaç duyduğu grup oluşturma, arkadaş arama vb. gibi *ek özellikler* yoluyla daha fazla işlev sunabilir."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:34
#: 98fb752dfe3d4ddbb0e9465b7c3a8a45
msgid "Such features are accessed by the user in a CLI-like style. An “additional feature” method MUST only take one string parameter aside from ``self``, and wrap it with :meth:`~ehforwarderbot.utils.extra` decorator. The ``extra`` decorator takes 2 arguments: ``name`` -- a short name of the feature, and ``desc`` -- a description of the feature with its usage."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:42
#: cfa47070ea444dcf84a5b9fe0f98d950
msgid "``desc`` SHOULD describe what the feature does and how to use it. It's more like the help text for an CLI program. Since method of invoking the feature depends on the implementation of the master channel, you SHOULD use ``\"{function_name}\"`` as its name in ``desc``, and master channel will replace it with respective name depend on their implementation."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:50
#: 386c4021c38a479b88ade458830220f9
msgid "The method MUST in the end return a string, which will be shown to the user as its result, or ``None`` to notify the master channel there will be further interaction happen. Depending on the functionality of the feature, it may be just a simple success message, or a long chunk of results."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:56
#: 17f2e44300284e89b6587b9227c59457
msgid "The callable MUST NOT raise any exception to its caller. Any exceptions occurred within should be ``expect``\\ ed and processed."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:60
#: a09a3be4f2df4c1bb2cd190da6a37b33
msgid "Callable name of such methods has a more strict standard than a normal Python 3 identifier name, for compatibility reason. An additional feature callable name MUST:"
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:64
#: bed3759dae02481496a2d896d29dafde
msgid "be case sensitive"
msgstr "büyük/küçük harfe duyarlı"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:65
#: 17e297b6a9584d0ea94e061e88ffbc04
msgid "include only upper and lower-case letters, digits, and underscore."
msgstr "yalnız büyük ve küçük harfler, rakamlar ve altçizgi içerir."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:66
#: bae6e4ec65e140a5950d5e5ea367520f
msgid "does not start with a digit."
msgstr "bir basamakla başlamaz."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:67
#: 78b5249209ec4f82ac8d1468898bcd8e
msgid "be in a length between 1 and 20 inclusive"
msgstr "1 ve 20 arasında bir uzunlukta olmalı"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:68
#: f3c7a42bae3c4198a9f0ed60c8103cf6
msgid "*be as short and concise as possible, but keep understandable*"
msgstr "*mümkün olduğunca kısa ve öz olun, fakat anlaşılabilir tutun*"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:70
#: 6713976667034a539ef08eb59c7e494a
msgid "It can be expressed in a regular expression as::"
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:72
#: c8d9de1e0fae432ba23ccf755b7ebfb5
msgid "^[A-Za-z][A-Za-z0-9_]{0,19}$"
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:74
#: 00b78f21fb0d485c863cbbb1396fdf67
msgid "An example is as follows:"
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:76
#: bc1a82662e6743769cf4552258efc171
msgid "@extra(name=\"Echo\",\n"
" desc=\"Return back the same string from input.\\n\"\n"
" \"Usage:\\n\"\n"
" \" {function_name} text\")\n"
"def echo(self, arguments: str = \"\") -> str:\n"
" return arguments"
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:86
#: a24281d89238495ba02c4ab9862bea6a
msgid "Message commands"
msgstr "Mesaj komutları"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:88
#: 3316dccdc9a4468281e3c446fc99aa52
msgid "Message commands are usually sent by slave channels so that users can respond to certain messages that has specific required actions."
msgstr "Mesaj komutları genellikle bağımlı kanallar tarafından gönderilir, böylece kullanıcılar gerekli eylemlere sahip mesajlara cevap verebilir."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:92
#: 2f1cd77bdf0341a9b7e942032594bf68
msgid "Possible cases when message commands could be useful:"
msgstr "Mesaj komutlarının yararlı olabileceği olası durumlar:"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:94
#: dcbba54e79ab44e58e321ad666455688
msgid "Add as friends when a contact card is received."
msgstr "Bir kartvizit alındığında arkadaş olarak ekleyin."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:95
#: 5488aaf76dcd45f8a184dee5dd73f9bd
msgid "Accept or decline when a friend request is received."
msgstr "Arkadaş talebi alındığında kabul veya reddedin."
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:96
#: 27fe380822c64bfe9a3e204806d0d464
msgid "Vote to a voting message."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:98
#: 0df8cb0b9d474996a97cc278ebbb6509
msgid "A message can be attached with a ``list`` of commands, in which each of them has:"
msgstr "Bir mesaj, her biri aşağıdakileri içeren bir ``liste`` komutuyla eklenebilir:"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:101
#: 6f68e32255664408aa2d31a243ac20fd
msgid "a human-friendly name,"
msgstr "insan dostu bir isim,"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:102
#: fa695cae1f0a4868a0954b1f22726404
msgid "a callable name,"
msgstr "çağrılabilir bir isim,"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:103
#: 9e285b5ad1b149f9a842f4570103fd57
msgid "a ``list`` of positional arguments (``*args``), and"
msgstr "konumsal argümanlardan oluşan bir ``list``(`` * args``), ve"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:104
#: 424ffa6034ff467da5176e0e05e2ec7b
msgid "a ``dict`` of keyword arguments (``**kwargs``)"
msgstr "anahtar kelime argümanlarından oluşan bir ``dict``(``**kwargs``)"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:106
#: e1f4b466f023484a82d60a32a820642b
msgid "When the User clicked the button, the corresponding method of your channel will be called with provided arguments."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:109
#: 7a80a80cfcf049f7b48ba23625c0bf69
msgid "Note that all such methods MUST return a ``str`` as a respond to the action from user, and they MUST NOT raise any exception to its caller. Any exceptions occurred within MUST be ``expect``\\ ed and processed."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:116
#: e1146bb7ea514097b21642a89c53703d
msgid "Message delivery"
msgstr "Mesaj teslimi"
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:118
#: 1139361a082b4d97882f908af0dc1c7b
msgid "Slave channels SHOULD deliver all messages that the IM provides, including what the User sent outside of this channel. But it SHOULD NOT deliver message sent from the master channel again back to the master channel as a new message."
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:125
#: 528df8ce319643f299fa46de2b23bcd3
msgid "Implementation details"
msgstr ""
#: /Users/blueset/Codebase/ehForwarderBot/docs/guide/slave.rst:127
#: 12b934b4756c483986b867d3cf230553
msgid "See :class:`.SlaveChannel`."
msgstr ""
| {
"pile_set_name": "Github"
} |
package com.myimooc.thread.daemon;
/**
* Java stack
*
* @author ZhangCheng on 2017-07-08
*/
public class Jstack {
/*
2017-07-08 23:49:46
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode):
"Thread-0" #10 daemon prio=5 os_prio=0 tid=0x000000001d209800 nid=0x2e00 waiting on condition [0x000000001dd2f000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at DaemonThread.writeToFile(DaemonThread.java:39)
at DaemonThread.run(DaemonThread.java:19)
at java.lang.Thread.run(Thread.java:745)
Locked ownable synchronizers:
- None
"Service Thread" #9 daemon prio=9 os_prio=0 tid=0x000000001d1b9800 nid=0x2480 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"C1 CompilerThread2" #8 daemon prio=9 os_prio=2 tid=0x000000001d13b000 nid=0x2078 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"C2 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x000000001be2d800 nid=0x24f4 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x000000001bddf000 nid=0x2f64 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x000000001bdde000 nid=0x1c1c waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x000000001bdc8800 nid=0x247c runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x000000001bdba800 nid=0x1f10 in Object.wait() [0x000000001d12f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000076b108ee0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
- locked <0x000000076b108ee0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
Locked ownable synchronizers:
- None
"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x00000000027a2800 nid=0x2214 in Object.wait() [0x000000001d02f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000076b106b50> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x000000076b106b50> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
Locked ownable synchronizers:
- None
"main" #1 prio=5 os_prio=0 tid=0x000000000099d800 nid=0xf2c runnable [0x000000000228e000]
java.lang.Thread.State: RUNNABLE
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:255)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
- locked <0x000000076b159560> (a java.io.BufferedInputStream)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
- locked <0x000000076b1b9ce8> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:100)
at java.util.Scanner.readInput(Scanner.java:804)
at java.util.Scanner.next(Scanner.java:1369)
at DaemonThreadDemo.main(DaemonThreadDemo.java:22)
Locked ownable synchronizers:
- None
"VM Thread" os_prio=2 tid=0x000000001bd98000 nid=0x2998 runnable
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00000000026c6800 nid=0x11b0 runnable
"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00000000026c8000 nid=0x26a4 runnable
"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00000000026c9800 nid=0x2d6c runnable
"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x00000000026cb000 nid=0xab0 runnable
"VM Periodic Task Thread" os_prio=2 tid=0x000000001d1f3000 nid=0x2b08 waiting on condition
JNI global references: 6
*/
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.