answer
stringlengths 15
1.25M
|
|---|
@@include('include/header.html',{"name": "list","desc": ""})
<section id="list">
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-list-pure ui-border-tb">
<li class="ui-border-t">
<p><span>1.faycheng </span><span class="date"> 212</span></p>
<h4></h4>
</li>
<li class="ui-border-t">
<p><span>2.faycheng </span><span class="date"> 212</span></p>
<h4></h4>
</li>
<li class="ui-border-t">
<p><span>3.faycheng </span><span class="date"> 212</span></p>
<h4></h4>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-list-text ui-border-tb">
<li class="ui-border-t">
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
</div>
<div class="ui-badge">new</div>
</li>
<li class="ui-border-t">
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
</div>
<div class="ui-badge-muted">new</div>
</li>
<li class="ui-border-t">
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
</div>
<div class="ui-badge-num">123</div>
</li>
<li class="ui-border-t">
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
</div>
<div class="ui-reddot ui-reddot-static"></div>
</li>
<li class="ui-border-t">
<div class="ui-list-info">
<h4></h4>
</div>
<div class="ui-list-action"></div>
</li>
<li class="ui-border-t">
<div class="ui-list-info">
<h4></h4>
</div>
<label class="ui-switch">
<input type="checkbox" />
</label>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-list-text ui-list-link ui-border-tb">
<li class="ui-border-t">
<h4></h4>
<div class="ui-txt-info"></div>
</li>
<li class="ui-border-t">
<h4 class="ui-nowrap"></h4>
<div class="ui-txt-info">198888</div>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-list-one ui-list-link ui-border-tb">
<li class="ui-border-t">
<div class="ui-list-thumb">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap"></h4>
<div class="ui-txt-info"></div>
</div>
</li>
<li class="ui-border-t">
<div class="ui-list-thumb">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap"></h4>
<div class="ui-reddot ui-reddot-static"></div>
</div>
</li>
</ul>
<ul class="ui-list ui-list-one ui-list-link ui-border-tb">
<li>
<div class="ui-list-thumb">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info ui-border-t">
<h4 class="ui-nowrap"></h4>
<div class="ui-txt-info"></div>
</div>
</li>
<li>
<div class="ui-list-thumb">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info ui-border-t">
<h4 class="ui-nowrap"></h4>
<div class="ui-reddot ui-reddot-static"></div>
</div>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc">activejs</p>
<div class="demo-block">
<ul class="ui-list ui-list-link ui-border-tb">
<li class="ui-border-t active">
<div class="ui-list-thumb">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-list-thumb</h4>
</div>
</li>
<li class="ui-border-t">
<div class="ui-list-thumb-s">
<span style="background-image:url(http://placeholder.qiniudn.com/56x56)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-list-thumb-s</h4>
</div>
</li>
<li class="ui-border-t">
<div class="ui-list-icon">
<span style="background-image:url(http://placeholder.qiniudn.com/80x80)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-list-icon icon</h4>
</div>
</li>
<li class="ui-border-t">
<div class="ui-list-icon">
<span style="background-image:url(http://placeholder.qiniudn.com/80x80)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-list-icon icon</h4>
</div>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc">active</p>
<div class="demo-block">
<ul class="ui-list ui-list-text ui-list-active ui-list-cover ui-border-tb">
<li class="ui-border-t">
<p>ui-list-active</p>
</li>
<li class="ui-border-t">
<p>ui-list-cover</p>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-border-tb">
<li class="ui-border-t">
<div class="ui-avatar">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
<p class="ui-nowrap">ui-nowrap</p>
</div>
</li>
<li class="ui-border-t">
<div class="ui-avatar">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
<p class="ui-nowrap">ui-nowrap</p>
</div>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-list-link ui-border-tb">
<li>
<div class="ui-avatar">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info ui-border-t">
<h4 class="ui-nowrap">ui-nowrap</h4>
</div>
</li>
<li>
<div class="ui-avatar">
<span style="background-image:url(http://placeholder.qiniudn.com/100x100)"></span>
</div>
<div class="ui-list-info ui-border-t">
<h4 class="ui-nowrap">ui-nowrap</h4>
<p class="ui-nowrap">ui-nowrap</p>
</div>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-list-function ui-list-link ui-border-tb">
<li class="ui-border-t">
<div class="ui-avatar-s">
<span style="background-image:url(http://placeholder.qiniudn.com/80x80)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
</div>
<div class="ui-btn">PK</div>
</li>
<li class="ui-border-t">
<div class="ui-avatar-s">
<span style="background-image:url(http://placeholder.qiniudn.com/80x80)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
</div>
<div class="ui-btn">PK</div>
</li>
</ul>
</div>
</div>
<div class="demo-item">
<p class="demo-desc"></p>
<div class="demo-block">
<ul class="ui-list ui-list-link ui-border-tb">
<li class="ui-border-t">
<div class="ui-list-img">
<span style="background-image:url(http://placeholder.qiniudn.com/200x136)"></span>
</div>
<div class="ui-list-info">
<h4 class="ui-nowrap">ui-nowrap</h4>
<p class="ui-nowrap">ui-nowrap</p>
</div>
</li>
<li class="ui-border-t">
<div class="ui-list-img">
<span style="background-image:url(http://placeholder.qiniudn.com/200x136)"></span>
</div>
<div class="ui-list-info">
<h4></h4>
</div>
</li>
</ul>
<div class="ui-loading-wrap">
<p></p>
<i class="ui-loading"></i>
</div>
</div>
</div>
</section>
@@include('include/footer.html')
|
> :[jdneo](https://github.com/jdneo)
> :
# OpenGL ES
OpenGL ESView[GLSurfaceView](http:
[GLSurfaceView](http:
activity[GLSurfaceView](http:
##OpenGL ES
OpenGL ES 2.0
xml
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
texture compression
xml
<supports-gl-texture android:name="<API key>" />
<supports-gl-texture android:name="<API key>" />
[OpenGL](http://developer.android.com/guide/topics/graphics/opengl.html#textures)
##OpenGL ESactivity
OpenGL ESactivityacitivity[TextView](http:
[GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)View
java
public class OpenGLES20Activity extends Activity {
private GLSurfaceView mGLView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create a GLSurfaceView instance and set it
// as the ContentView for this Activity.
mGLView = new MyGLSurfaceView(this);
setContentView(mGLView);
}
}
> **Note**OpenGL ES 2.0Android 2.2API Level 8AndroidAPI
##GLSurfaceView
[GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)ViewViewOpenGL ESView[GLSurfaceView.Rendererhttp://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html]()GLSurfaceView[Responding to Touch Events](http://developer.android.com/training/graphics/opengl/environment.html#touch.html)
[GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)acitvity
java
class MyGLSurfaceView extends GLSurfaceView {
public MyGLSurfaceView(Context context){
super(context);
// Set the Renderer for drawing on the GLSurfaceView
setRenderer(new MyRenderer());
}
}
OpenGL ES 2.0[GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)2.0
java
// Create an OpenGL ES 2.0 context
<API key>(2);
> **Note**OpenGL ES 2.0
[GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)[GLSurfaceView.<API key>](http://developer.android.com/reference/android/opengl/GLSurfaceView.html#<API key>)
java
// Render the view only when there is a change in the drawing data
setRenderMode(GLSurfaceView.<API key>);
[GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)[requestRender()](http://developer.android.com/reference/android/opengl/GLSurfaceView.html#requestRender\(\))
[GLSurfaceView.Renderer](http:
* [onSurfaceCreated()](http://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html#onSurfaceCreated\(javax.microedition.khronos.opengles.GL10, javax.microedition.khronos.egl.EGLConfig\))OpenGL ES
* [onDrawFrame()](http://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html#onDrawFrame\(javax.microedition.khronos.opengles.GL10\))
* [onSurfaceChanged()](http://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html#onDrawFrame\(javax.microedition.khronos.opengles.GL10\))
OpenGL ES[GLSurfaceView](http://developer.android.com/reference/android/opengl/GLSurfaceView.html)
java
public class MyGLRenderer implements GLSurfaceView.Renderer {
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
// Set the background frame color
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
public void onDrawFrame(GL10 unused) {
// Redraw background color
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
}
public void onSurfaceChanged(GL10 unused, int width, int height) {
GLES20.glViewport(0, 0, width, height);
}
}
OpenGLOpenGL
> **Note**[GL10](http://developer.android.com/reference/javax/microedition/khronos/opengles/GL10.html)OpenGL ES 2.02.0Android
OpenGL ESOpenGL ES OpenGL
|
import { module, test } from 'qunit';
import {
getComplianceSteps,
complianceSteps,
<API key>,
<API key>,
<API key>,
PurgePolicy,
<API key>,
tagNeedsReview,
<API key>
} from 'wherehows-web/constants';
import complianceDataTypes from 'wherehows-web/mirage/fixtures/<API key>';
import { mockTimeStamps } from 'wherehows-web/tests/helpers/datasets/compliance-policy/<API key>';
import { mockFieldChangeSets } from 'wherehows-web/tests/helpers/datasets/compliance-policy/<API key>';
import { hdfsUrn } from 'wherehows-web/mirage/fixtures/urn';
module('Unit | Constants | dataset compliance', function() {
const <API key> = {
checkSuggestions: false,
<API key>: <API key>
};
test('<API key>', function(assert) {
assert.expect(2);
const mockUrn = hdfsUrn;
const <API key> = {
datasetUrn: mockUrn,
datasetId: null,
complianceType: '',
compliancePurgeNote: '',
complianceEntities: [],
<API key>: null,
confidentiality: null
};
assert.ok(typeof <API key> === 'function', '<API key> is a function');
assert.deepEqual(
<API key>(mockUrn),
<API key>,
'generates policy in expected shape'
);
});
test('tagNeedsReview exists', function(assert) {
assert.ok(typeof tagNeedsReview === 'function', 'tagNeedsReview is a function');
assert.ok(
typeof tagNeedsReview([], <API key>)({}) === 'boolean',
'tagNeedsReview returns a boolean'
);
});
test('tagNeedsReview correctly determines if a fieldChangeSet requires review', function(assert) {
assert.expect(mockFieldChangeSets.length);
mockFieldChangeSets.forEach(changeSet =>
assert.ok(
tagNeedsReview(complianceDataTypes, <API key>)(changeSet) === changeSet.__requiresReview__,
changeSet.__msg__
)
);
});
test('<API key> function should behave as expected', function(assert) {
const [complianceType] = complianceDataTypes;
let result;
assert.equal(typeof <API key>, 'function', '<API key> is a function');
result = <API key>(complianceType);
assert.ok(result.label === complianceType.title, 'title matches the resulting label');
assert.ok(result.value === complianceType.id, 'id matches the resulting value');
});
test('<API key> function should behave as expected', function(assert) {
let results;
assert.equal(typeof <API key>, 'function', '<API key> is a function');
results = <API key>(complianceDataTypes);
assert.ok(Array.isArray(results), '<API key> returns an array');
results.forEach((result, index) => {
assert.ok(result.label === complianceDataTypes[index].title, 'title matches the resulting label');
assert.ok(result.value === complianceDataTypes[index].id, 'id matches the resulting value');
});
});
test('<API key> function correctly determines if a policy is auto-generated', function(assert) {
let result = <API key>();
assert.ok(result === false, 'expected return value of false when no arguments are supplied');
result = <API key>({
complianceType: PurgePolicy.AutoPurge,
complianceEntities: []
});
assert.ok(
result,
'expected return to be truthy when complianceEntities are empty and complianceType is a PurgePolicy'
);
result = <API key>({
complianceType: PurgePolicy.AutoPurge,
complianceEntities: [1]
});
assert.notOk(
result,
'expected return to be falsey when complianceEntities are not empty and complianceType is a PurgePolicy'
);
});
});
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
<meta name="<API key>" content="yes">
<meta name="<API key>" content="black">
<link rel="apple-touch-icon" href="images/ico.png" />
<link rel="<API key>" media="(device-width: 320px) and (device-height: 568px) and (-<API key>: 2)" href="<API key>.html">
<title>RACHETEE</title>
<link rel="stylesheet" href="css/framework7.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/colors/magenta.css">
<link type="text/css" rel="stylesheet" href="css/swipebox.css" />
<link type="text/css" rel="stylesheet" href="css/animations.css" />
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,700,900' rel='stylesheet' type='text/css'>
</head>
<body id="mobile_wrap">
<div class="pages">
<div data-page="projects" class="page no-toolbar no-navbar">
<div class="page-content">
<div class="navbarpages">
<div class="nav_left_logo"><a href="index-2.html"><img src="images/logo.png" alt="" title="" /></a></div>
<div class="nav_right_button">
<a href="#"><img src="images/icons/white/menu.png" alt="" title="" /></a>
<a href="ddmenu.html"><img src="images/icons/white/back.png" alt="" title="" /></a>
</div>
</div>
<div id="pages_maincontent">
<div class="post_single">
<div class="blog_nav">
<a href="#" class="prev_post disabled"><img src="images/prev.png" alt="" title="" /></a>
<a href="ddwk5countdown.html" class="next_post"><img src="images/next.png" alt="" title="" /></a>
</div>
<div class="featured_image">
<img src="images/ddrrcg.png" alt="" title="" />
<div class="post_title_single"><h2>Creuser Profondément.</h2></div>
<div class="post_social">
<a href="#" data-popup=".popup-social" class="open-popup"><img src="images/icons/white/heart.png" alt="" title="" /></a>
</div>
</div>
<div class="page_content">
<div class="entry">
<p style="text-align: right;"><span style="color:#FFFFFF;"><strong><span style="font-size:16px;"><span style="font-family:arial,helvetica,sans-serif;"><span style="background-color:#B22222;">Étude Biblique 67</span></span></span></strong></span></p>
<p style="text-align: center;"><br />
<span style="color:#000000;"><span style="font-size:16px;"><span style="font-family:arial,helvetica,sans-serif;"><u>Thème</u></span></span><br />
<span style="font-size:16px;"><span style="font-family:arial,helvetica,sans-serif;"><strong>Thème : Pourquoi Dieu vous a-t-il choisi? <u>1ère partie</u></strong></span></span></span><br />
</p>
<p style="text-align: justify;"><span style="color:#000000;"><span style="font-size:16px;"><span style="font-family:arial,helvetica,sans-serif;"><u><strong>INTRODUCTION</strong></u></span></span><br />
<span style="font-size:16px;"><span style="font-family:arial,helvetica,sans-serif;">La parole de Dieu dit: "Beaucoup sont appelés mais peu sont élus" - Matthieu 22:14. Gloire a Dieu, car vous êtes l'un des quelques élus: mais pourquoi Dieu vous a-t-il choisi Dieu? Jésus a clairement expliqué dans Jean 15:16, quand il a dit: "Tu ne m'as pas choisi, mais je t'ai choisi et je t'ai ordonné, afin que tu porte des fruits et que tes fruits restent ..."</span></span></span></p>
<p style="text-align: justify;"><span style="color:#000000;"><span style="font-size:16px;"><span style="font-family:arial,helvetica,sans-serif;">1. Dieu qui vous a choisi du ventre de votre mère a un objectif pour le quel il a fait cela. Il veut être glorifié en vous, par vous et pour vous. Il vous a aimé avant même que vous le connaissiez et il est raisonnable que vous répondez à cet amour. C'est la suprême miséricorde de Dieu qui vous a fait ce que vous êtes aujourd'hui, une âme sauvée, son but est que vous soyez un instrument d'honneur pour Lui<br />
<em>Ésaïe 49: 1-3, je, Jean 4:10, 19, Exode 19: 5, Deut. 14: 2 Psalms 78:52, Luc 1:17, Actes 15:14, Romains 9: 11-16, 21.</em><br />
<br />
2. L'une des raisons pour lesquelles Dieu vous choisit est de porter ses fruits. Maintenant, il existe de nombreux types de fruits que Dieu attend de vous. Ceux-ci incluent:<br />
(i) Les fruits digne de la repentance comme preuve de votre éloignement du péché<br />
(ii) Les fruits acceptables pour Dieu, le type de fruit que ceux qui étaient morts avec le Christ et qui ressucité avec lui peuvent porter<br />
(iii) Le fruit du Saint Esprit qui est la bonté, la droiture et la vérité <strong><em>enfin </em></strong><br />
(iv) Les âmes pour Christ,<br />
<em>Matthieu 3: 8-9, Romains 7: 4, Romains 6:22, hébreu 12:11, Matthieu 13: 8, Philippiens 1:11, II Corinthiens 9:10, Philippiens 4:17, Galates 5: 22-23, Ephésiens 5: 9-10.</em><br />
<br />
3. Pour pouvoir porter ses fruits pour Christ, il y a certaines conditions à satisfaire, ces conditions comprennent<br />
(i) en contact perpétuel avec Jésus-Christ qui est l'eau vivante<br />
(ii) En comprenant pleinement Jésus, parce qu'il est le Parole de Dieu<br />
(iii) Etre mort à l'ancienne vie,<br />
(iv) Etre constamment et spirituellement<span style="text-align: justify;"> </span>ciré <strong style="text-align: justify;"><em>enfin</em></strong><br />
(v) Demeurer définitivement en Jésus-Christ le Seigneur<br />
<em>Psaumes 1: 1-3, Matt.13: 23, Jean 1: 1, Jean 12:24, Jean 15: 2, Jean 15: 5, Philippiens 4:13.</em><br />
<br />
4. Il est dangereux de ne pas porter de fruits pour le Seigneur. Plusieurs raisons expliquent cela. Certains d'entre eux sont les faits d'être infructueux et qui est d'ailleur<br />
(i) Un signe de mondanité<br />
(ii) Un signe de mauvaise utilisation des talents<br />
(iii) Déçoit le Maître<br />
(iv) Conduire au jugement Divin et se termine par <br />
(v) L'abadon final<br />
<em>Matthieu 12 : 22, Luc 13: 6, Luc 19:20, Matthieu 3:10, Hébreux 6: 8, Jean 15: 6.</em></span></span></span></p>
<hr />
<p><span style="font-family:trebuchet ms,helvetica,sans-serif;"><span style="font-size:16px;"><span style="color:#000000;"><img alt="logo" src="images/q.png" style="width: 80px; height: 120px; float: left;" /><br />
Veuillez nous envoyer toutes vos questions et contribution par le mail suivant <a class="external" href="mailto:rccgtlwciv@gmail.com?Subject=Bible Study Questions">rccgtlwciv@gmail.com</a> et nous les traiterons cela au cours de notre Etude biblique prochainement...</span></span></span></p>
<hr />
<hr />
<p><span style="color:#000000;"><strong><span style="font-size:16px;"><em>l'Eglise Chretienne Rachetée de Dieu<br />
SANCTUAIRE D'EAUX VIVANTES.<br />
Non loin du Carrefour de la Riviera 2,<br />
Route d’Attoban, Cocody BP 6290 Abidjan 06<br />
République de Cote d'Ivoire.<br />
Phone : +225 40-07-07-76<br />
Email : rccgtlwciv@gmail.com<br />
Site Web : http:
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
|
package client
const (
<API key> = "gkeClusterAddons"
<API key> = "httpLoadBalancing"
<API key> = "<API key>"
<API key> = "networkPolicyConfig"
)
type GKEClusterAddons struct {
HTTPLoadBalancing bool `json:"httpLoadBalancing,omitempty" yaml:"httpLoadBalancing,omitempty"`
<API key> bool `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
NetworkPolicyConfig bool `json:"networkPolicyConfig,omitempty" yaml:"networkPolicyConfig,omitempty"`
}
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_22) on Wed Apr 03 10:03:18 GMT-03:00 2013 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class opennlp.tools.parser.ParseSampleStream (Apache OpenNLP Tools 1.5.3 API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Uses of Class opennlp.tools.parser.ParseSampleStream (Apache OpenNLP Tools 1.5.3 API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../opennlp/tools/parser/ParseSampleStream.html" title="class in opennlp.tools.parser"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?opennlp/tools/parser/class-use/ParseSampleStream.html" target="_top"><B>FRAMES</B></A>
<A HREF="ParseSampleStream.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>opennlp.tools.parser.ParseSampleStream</B></H2>
</CENTER>
No usage of opennlp.tools.parser.ParseSampleStream
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../opennlp/tools/parser/ParseSampleStream.html" title="class in opennlp.tools.parser"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?opennlp/tools/parser/class-use/ParseSampleStream.html" target="_top"><B>FRAMES</B></A>
<A HREF="ParseSampleStream.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright &
</BODY>
</HTML>
|
package org.nutz.dao.util.cri;
import org.nutz.dao.entity.Entity;
import org.nutz.dao.entity.MappingField;
import org.nutz.dao.jdbc.Jdbcs;
import org.nutz.dao.jdbc.ValueAdaptor;
import org.nutz.lang.Strings;
public class SqlValueRange extends <API key> {
private static final long serialVersionUID = <API key>;
protected String sql;
protected Object[] values;
protected int size;
protected SqlValueRange(String name, String sql, Object... values) {
super(name);
this.sql = sql;
this.values = values;
this.size = values.length;
}
public void joinSql(Entity<?> en, StringBuilder sb) {
if (size == 0)
return;
if (not)
sb.append(" NOT ");
sb.append(_fmtcol(en));
String tmp = Strings.dup("?,", size);
sb.append(" IN (");
sb.append(String.format(sql, tmp.substring(0, tmp.length() - 1)));
sb.append(")");
}
public int joinAdaptor(Entity<?> en, ValueAdaptor[] adaptors, int off) {
if (size == 0)
return off;
MappingField mf = _field(en);
ValueAdaptor adaptor = null;
if (mf == null) {
for (Object object : values) {
if (object != null) {
adaptor = Jdbcs.getAdaptorBy(object);
break;
}
}
if (adaptor == null)
adaptor = Jdbcs.Adaptor.asNull;
} else {
adaptor = mf.getAdaptor();
}
for (int i = off; i < off+size; i++) {
adaptors[i] = adaptor;
}
return 0;
}
public int joinParams(Entity<?> en, Object obj, Object[] params, int off) {
for (int i = off; i < off+size; i++) {
params[i] = values[i];
}
return off+size;
}
public int paramCount(Entity<?> en) {
return size;
}
}
|
package jadx.tests.integration.rename;
import java.util.List;
import org.junit.jupiter.api.Test;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
public class <API key> extends IntegrationTest {
public static class TestCls {
List<String> list;
}
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
assertThat(cls).code()
.containsOnlyOnce("List<String> list;");
cls.searchFieldByName("list").getFieldInfo().setAlias("listFieldRenamed");
assertThat(cls).reloadCode(this)
.containsOnlyOnce("List<String> listFieldRenamed;");
}
}
|
<?php
/**
* Generated by <API key> 1.2.0 on 2012-12-12 at 13:17:14.
*/
class <API key> extends <API key> {
/**
* @var AmazonShipmentList
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
resetLog();
$this->object = new AmazonShipmentList('testStore', true, null, __DIR__.'/../../test-config.php');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {
}
public function testSetUseToken(){
$this->assertNull($this->object->setUseToken());
$this->assertNull($this->object->setUseToken(true));
$this->assertNull($this->object->setUseToken(false));
$this->assertFalse($this->object->setUseToken('wrong'));
}
public function testSetStatusFilter(){
$this->assertNull($this->object->setStatusFilter(array('404','808')));
$o = $this->object->getOptions();
$this->assertArrayHasKey('ShipmentStatusList.member.1',$o);
$this->assertEquals('404',$o['ShipmentStatusList.member.1']);
$this->assertArrayHasKey('ShipmentStatusList.member.2',$o);
$this->assertEquals('808',$o['ShipmentStatusList.member.2']);
$this->assertNull($this->object->setStatusFilter('808')); //causes reset
$o2 = $this->object->getOptions();
$this-><API key>('ShipmentStatusList.member.2',$o2);
$this->assertFalse($this->object->setStatusFilter(null));
$this->assertFalse($this->object->setStatusFilter(707));
}
public function testSetIdFilter(){
$this->assertNull($this->object->setIdFilter(array('404','808')));
$o = $this->object->getOptions();
$this->assertArrayHasKey('ShipmentIdList.member.1',$o);
$this->assertEquals('404',$o['ShipmentIdList.member.1']);
$this->assertArrayHasKey('ShipmentIdList.member.2',$o);
$this->assertEquals('808',$o['ShipmentIdList.member.2']);
$this->assertNull($this->object->setIdFilter('808')); //causes reset
$o2 = $this->object->getOptions();
$this-><API key>('ShipmentIdList.member.2',$o2);
$this->assertFalse($this->object->setIdFilter(null));
$this->assertFalse($this->object->setIdFilter(707));
}
/**
* @return array
*/
public function timeProvider() {
return array(
array(null, null), //nothing given, so no change
array(true, true), //not strings or numbers
array('', ''), //strings, but empty
array('-1 min', null), //one set
array(null, '-1 min'), //other set
array('-1 min', '-1 min'), //both set
);
}
/**
* @dataProvider timeProvider
*/
public function testSetTimeLimits($a, $b){
$this->object->setTimeLimits($a,$b);
$o = $this->object->getOptions();
$this->assertArrayHasKey('LastUpdatedAfter',$o);
$this-><API key>('%d-%d-%dT%d:%d:%d%i',$o['LastUpdatedAfter']);
$this->assertArrayHasKey('LastUpdatedBefore',$o);
$this-><API key>('%d-%d-%dT%d:%d:%d%i',$o['LastUpdatedBefore']);
}
public function testResetTimeLimit(){
$this->object->setTimeLimits('-1 min','-1 min');
$o = $this->object->getOptions();
$this->assertArrayHasKey('LastUpdatedAfter',$o);
$this->assertArrayHasKey('LastUpdatedBefore',$o);
$this->object->resetTimeLimits();
$check = $this->object->getOptions();
$this-><API key>('LastUpdatedAfter',$check);
$this-><API key>('LastUpdatedBefore',$check);
}
public function testFetchShipments(){
resetLog();
$this->object->setMock(true,'fetchShipments.xml'); //no token
$this->assertFalse($this->object->fetchShipments()); //no filter yet
$this->object->setStatusFilter('status');
$this->assertNull($this->object->fetchShipments());
$o = $this->object->getOptions();
$this->assertEquals('<API key>',$o['Action']);
$check = parseLog();
$this->assertEquals('Single Mock File set: fetchShipments.xml',$check[1]);
$this->assertEquals('Either status filter or ID filter must be set before requesting a list!',$check[2]);
$this->assertEquals('Fetched Mock File: mock/fetchShipments.xml',$check[3]);
$this->assertFalse($this->object->hasToken());
return $this->object;
}
public function <API key>(){
resetLog();
$this->object->setMock(true,'fetchShipmentsToken.xml'); //no token
//without using token
$this->object->setStatusFilter('status');
$this->assertNull($this->object->fetchShipments());
$check = parseLog();
$this->assertEquals('Single Mock File set: fetchShipmentsToken.xml',$check[1]);
$this->assertEquals('Fetched Mock File: mock/fetchShipmentsToken.xml',$check[2]);
$this->assertTrue($this->object->hasToken());
$o = $this->object->getOptions();
$this->assertEquals('<API key>',$o['Action']);
$r = $this->object->getShipment();
$this->assertArrayHasKey(0,$r);
$this->assertEquals(1,count($r));
$this->assertInternalType('array',$r[0]);
$this-><API key>(1,$r);
}
public function <API key>(){
resetLog();
$this->object->setMock(true,array('fetchShipmentsToken.xml','<API key>.xml'));
//with using token
$this->object->setUseToken();
$this->object->setStatusFilter('status');
$this->assertNull($this->object->fetchShipments());
$check = parseLog();
$this->assertEquals('Mock files array set.',$check[1]);
$this->assertEquals('Fetched Mock File: mock/fetchShipmentsToken.xml',$check[2]);
$this->assertEquals('Recursively fetching more shipments',$check[3]);
$this->assertEquals('Fetched Mock File: mock/<API key>.xml',$check[4]);
$this->assertFalse($this->object->hasToken());
$o = $this->object->getOptions();
$this->assertEquals('<API key>',$o['Action']);
$r = $this->object->getShipment();
$this->assertArrayHasKey(0,$r);
$this->assertArrayHasKey(1,$r);
$this->assertEquals(2,count($r));
$this->assertInternalType('array',$r[0]);
$this->assertInternalType('array',$r[1]);
$this->assertNotEquals($r[0],$r[1]);
}
/**
* @depends testFetchShipments
*/
public function testGetShipmentId($o){
$this->assertEquals('FBA44JV8R',$o->getShipmentId(0));
$this->assertFalse($o->getShipmentId('wrong')); //not number
$this->assertFalse($o->getShipmentId(1.5)); //no decimals
$this->assertFalse($this->object->getShipmentId()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function testGetShipmentName($o){
$this->assertEquals('FBA (11/8/10 5:34 PM)',$o->getShipmentName(0));
$this->assertFalse($o->getShipmentName('wrong')); //not number
$this->assertFalse($o->getShipmentName(1.5)); //no decimals
$this->assertFalse($this->object->getShipmentName()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function testGetAddress($o){
$a = array();
$a['Name'] = 'John Smith';
$a['AddressLine1'] = '2345 3rd Ave';
$a['AddressLine2'] = null;
$a['City'] = 'Seattle';
$a['DistrictOrCounty'] = null;
$a['StateOrProvinceCode'] = 'WA';
$a['CountryCode'] = 'US';
$a['PostalCode'] = '98109';
$this->assertEquals($a,$o->getAddress(0));
$this->assertFalse($o->getAddress('wrong')); //not number
$this->assertFalse($o->getAddress(1.5)); //no decimals
$this->assertFalse($this->object->getAddress()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function <API key>($o){
$this->assertEquals('PHX3',$o-><API key>(0));
$this->assertFalse($o-><API key>('wrong')); //not number
$this->assertFalse($o-><API key>(1.5)); //no decimals
$this->assertFalse($this->object-><API key>()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function <API key>($o){
$this->assertEquals('AMAZON_LABEL',$o->getLabelPrepType(0));
$this->assertFalse($o->getLabelPrepType('wrong')); //not number
$this->assertFalse($o->getLabelPrepType(1.5)); //no decimals
$this->assertFalse($this->object->getLabelPrepType()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function <API key>($o){
$this->assertEquals('CLOSED',$o->getShipmentStatus(0));
$this->assertFalse($o->getShipmentStatus('wrong')); //not number
$this->assertFalse($o->getShipmentStatus(1.5)); //no decimals
$this->assertFalse($this->object->getShipmentStatus()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function <API key>($o){
$this->assertEquals('false',$o->getIfCasesRequired(0));
$this->assertFalse($o->getIfCasesRequired('wrong')); //not number
$this->assertFalse($o->getIfCasesRequired(1.5)); //no decimals
$this->assertFalse($this->object->getIfCasesRequired()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function testGetShipment($o){
$shipment = $o->getShipment(0);
$this->assertInternalType('array',$shipment);
$list = $o->getShipment(null);
$this->assertInternalType('array',$list);
$this->assertArrayHasKey(0,$list);
$this->assertArrayHasKey(1,$list);
$this->assertEquals($shipment,$list[0]);
$default = $o->getShipment();
$this->assertEquals($list,$default);
$x = array();
$x1 = array();
$x1['ShipmentId'] = 'FBA44JV8R';
$x1['ShipmentName'] = 'FBA (11/8/10 5:34 PM)';
$a1 = array();
$a1['Name'] = 'John Smith';
$a1['AddressLine1'] = '2345 3rd Ave';
$a1['AddressLine2'] = null;
$a1['City'] = 'Seattle';
$a1['DistrictOrCounty'] = null;
$a1['StateOrProvinceCode'] = 'WA';
$a1['CountryCode'] = 'US';
$a1['PostalCode'] = '98109';
$x1['ShipFromAddress'] = $a1;
$x1['<API key>'] = 'PHX3';
$x1['LabelPrepType'] = 'AMAZON_LABEL';
$x1['ShipmentStatus'] = 'CLOSED';
$x1['AreCasesRequired'] = 'false';
$x[0] = $x1;
$x2 = array();
$x2['ShipmentId'] = 'FBA4X8YLS';
$x2['ShipmentName'] = 'FBA (1/19/11 4:08 PM)';
$a2 = $a1;
$a2['AddressLine2'] = 'Apt 401';
$a2['DistrictOrCounty'] = 'Box';
$x2['ShipFromAddress'] = $a2;
$x2['<API key>'] = 'PHX6';
$x2['LabelPrepType'] = 'AMAZON_LABEL';
$x2['ShipmentStatus'] = 'WORKING';
$x2['AreCasesRequired'] = 'true';
$x[1] = $x2;
$this->assertEquals($x, $list);
$this->assertFalse($this->object->getShipment()); //not fetched yet for this object
}
/**
* @depends testFetchShipments
*/
public function testFetchItems($o){
$o->setMock(true,array('fetchShipmentItems.xml'));
$x = array();
$x1 = array();
$x1['ShipmentId'] = 'SSF85DGIZZ3OF1';
$x1['SellerSKU'] = 'SampleSKU1';
$x1['QuantityShipped'] = '3';
$x1['QuantityInCase'] = '0';
$x1['QuantityReceived'] = '0';
$x1['<API key>'] = 'B000FADVPQ';
$x[0] = $x1;
$x2 = array();
$x2['ShipmentId'] = 'SSF85DGIZZ3OF1';
$x2['SellerSKU'] = 'SampleSKU2';
$x2['QuantityShipped'] = '10';
$x2['QuantityInCase'] = '0';
$x2['QuantityReceived'] = '0';
$x2['<API key>'] = 'B0011VECH4';
$x[1] = $x2;
$getAll = $o->fetchItems();
$getOne = $o->fetchItems(0);
$this->assertEquals($x, $getAll[0]->getItems());
$this->assertEquals($getAll[0], $getOne);
$this->assertFalse($o->fetchItems('banana')); //not valid index
$this->assertFalse($o->fetchItems(1.5)); //not valid index
$this->assertFalse($this->object->fetchItems()); //not fetched yet for this object
}
}
require_once('helperFunctions.php');
|
<?php
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
/**
*
* @author simon <mahuan@d1web.top>
*/
namespace tests\thinkphp\library\think\cache\driver;
use think\Cache;
abstract class cacheTestCase extends \<API key>
{
/**
*
* @access protected
*/
abstract protected function getCacheInstance();
/**
* tearDown
*/
protected function tearDown()
{
}
/**
*
* @return mixed
* @access public
*/
public function prepare()
{
$cache = $this->getCacheInstance();
$cache->clear();
$cache->set('string_test', 'string_test');
$cache->set('number_test', 11);
$cache->set('array_test', ['array_test' => 'array_test']);
return $cache;
}
/**
*
* @return mixed
* @access public
*/
public function testSet()
{
$cache = $this->getCacheInstance();
$this->assertTrue($cache->set('string_test', 'string_test'));
$this->assertTrue($cache->set('number_test', 11));
$this->assertTrue($cache->set('array_test', ['array_test' => 'array_test']));
}
/**
*
* @return mixed
* @access public
*/
public function testInc()
{
$cache = $this->getCacheInstance();
$this->assertEquals(14, $cache->inc('number_test', 3));
}
/**
*
* @return mixed
* @access public
*/
public function testDec()
{
$cache = $this->getCacheInstance();
$this->assertEquals(8, $cache->dec('number_test', 6));
}
/**
*
* @return mixed
* @access public
*/
public function testGet()
{
$cache = $this->prepare();
$this->assertEquals('string_test', $cache->get('string_test'));
$this->assertEquals(11, $cache->get('number_test'));
$array = $cache->get('array_test');
$this->assertArrayHasKey('array_test', $array);
$this->assertEquals('array_test', $array['array_test']);
$result = $cache->set('no_expire', 1, 0);
$this->assertTrue($result);
}
/**
*
* @return mixed
* @access public
*/
public function testExists()
{
$cache = $this->prepare();
$this->assertNotEmpty($cache->has('string_test'));
$this->assertNotEmpty($cache->has('number_test'));
$this->assertFalse($cache->has('not_exists'));
}
/**
*
* @return mixed
* @access public
*/
public function testGetNonExistent()
{
$cache = $this->getCacheInstance();
$this->assertFalse($cache->get('non_existent_key', false));
}
/**
*
* @return mixed
* @access public
*/
public function <API key>()
{
$cache = $this->getCacheInstance();
$cache->set('null_value', null);
//nullfalse
$this->assertTrue(is_null($cache->get('null_value')));
}
/**
*
* @return mixed
* @access public
*/
public function testExpire()
{
$cache = $this->getCacheInstance();
$this->assertTrue($cache->set('expire_test', 'expire_test', 1));
usleep(600000);
$this->assertEquals('expire_test', $cache->get('expire_test'));
usleep(800000);
$this->assertFalse($cache->get('expire_test'));
}
/**
*
* @return mixed
* @access public
*/
public function testDelete()
{
$cache = $this->prepare();
$this->assertNotNull($cache->rm('number_test'));
$this->assertFalse($cache->get('number_test'));
}
/**
*
* @return mixed
* @access public
*/
public function testPull()
{
$cache = $this->prepare();
$this->assertEquals(11, $cache->pull('number_test'));
$this->assertFalse($cache->get('number_test'));
}
/**
*
* @return mixed
* @access public
*/
public function testClear()
{
$cache = $this->prepare();
$this->assertTrue($cache->clear());
$this->assertFalse($cache->get('number_test'));
}
public function testStaticCall()
{
$this->assertTrue(Cache::set('a', 1));
$this->assertEquals(1, Cache::get('a'));
$this->assertEquals(2, Cache::inc('a'));
$this->assertEquals(4, Cache::inc('a', 2));
$this->assertEquals(4, Cache::get('a'));
$this->assertEquals(3, Cache::dec('a'));
$this->assertEquals(1, Cache::dec('a', 2));
$this->assertEquals(1, Cache::get('a'));
$this->assertNotNull(Cache::rm('a'));
$this->assertNotNull(Cache::clear());
}
}
|
// modification, are permitted provided that the following conditions
// are met:
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// 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 <API key>
#define <API key>
/** \addtogroup vehicle
@{
*/
#include "vehicle/PxVehicleDrive.h"
#include "vehicle/PxVehicleWheels.h"
#include "vehicle/PxVehicleComponents.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
struct PxFilterData;
class PxGeometry;
class PxPhysics;
class PxBatchQuery;
class <API key>;
class PxShape;
class PxMaterial;
class PxRigidDynamic;
/**
\brief The ordering of the wheels of a PxVehicleDriveTank.
@see <API key>, <API key>
*/
struct <API key>
{
enum Enum
{
eFRONT_LEFT=0,
eFRONT_RIGHT,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>
};
};
/**
\brief The control inputs for a PxVehicleDriveTank.
\note The values of <API key> and <API key> determine how much
of the total available drive torque is diverted to the left and right wheels. These entries in the
enumerated list represent the state of the left and right control sticks of a tank. The total available
drive torque available is controlled by eANALOG_INPUT_ACCEL, which represents the state of the acceleration
pedal and controls how much torque will be applied to the engine.
\note To accelerate forwards eANALOG_INPUT_ACCEL must be greater than zero so that torque is applied to drive the
engine, while <API key> and <API key> must also be greater than zero
to divert the available drive torque to the left and wheels. If <API key> > <API key>
the tank will turn to the right. If <API key> > <API key>
the tank will turn to the left.
@see <API key>::setAnalogInput, <API key>::getAnalogInput
*/
struct <API key>
{
enum Enum
{
eANALOG_INPUT_ACCEL=0,
<API key>,
<API key>,
<API key>,
<API key>,
<API key>
};
};
struct <API key>
{
enum Enum
{
eSTANDARD=0,
eSPECIAL
};
};
/**
\brief Data structure with instanced dynamics data and configuration data of a tank.
*/
class PxVehicleDriveTank : public PxVehicleDrive
{
// Changing the data layout of this class breaks the binary serialization format. See comments for
// <API key>. If a modification is required, please adjust the getBinaryMetaData
// function. If the modification is made on a custom branch, please change <API key>
// accordingly.
public:
friend class PxVehicleUpdate;
/**
\brief Allocate a PxVehicleTankDrive instance for a tank with nbWheels
\param[in] nbWheels is the number of wheels on the vehicle.
\note It is assumed that all wheels are driven wheels.
\return The instantiated vehicle.
@see free, setup
*/
static PxVehicleDriveTank* allocate(const PxU32 nbWheels);
/**
\brief Deallocate a PxVehicleDriveTank instance.
@see allocate
*/
void free();
/**
\brief Set up a tank using simulation data for the wheels and drive model.
\param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle.
\param[in] vehActor is a PxRigidDynamic instance that is used to represent the tank in the PhysX SDK.
\param[in] wheelsData describes the configuration of all suspension/tires/wheels of the tank. The tank instance takes a copy of this data.
\param[in] driveData describes the properties of the tank's drive model (gears/engine/clutch/autobox). The tank instance takes a copy of this data.
\param[in] nbDrivenWheels is the number of wheels on the tank.
\note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use <API key>::<API key>.
@see allocate, free, setToRestState, <API key>::<API key>
\note nbDrivenWheels must be an even number
\note The wheels must be arranged according to <API key>; that is,
the even wheels are on the left side of the tank and the odd wheels are on the right side of the tank.
*/
void setup
(PxPhysics* physics, PxRigidDynamic* vehActor,
const <API key>& wheelsData, const <API key>& driveData,
const PxU32 nbDrivenWheels);
/**
\brief Allocate and set up a tank using simulation data for the wheels and drive model.
\param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the tank.
\param[in] vehActor is a PxRigidDynamic instance that is used to represent the tank in the PhysX SDK.
\param[in] wheelsData describes the configuration of all suspension/tires/wheels of the tank. The tank instance takes a copy of this data.
\param[in] driveData describes the properties of the tank's drive model (gears/engine/clutch/differential/autobox). The tank instance takes a copy of this data.
\param[in] nbDrivenWheels is the number of wheels on the tank.
\note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use <API key>::<API key>.
\return The instantiated vehicle.
@see allocate, free, setToRestState, <API key>::<API key>
*/
static PxVehicleDriveTank* create
(PxPhysics* physics, PxRigidDynamic* vehActor,
const <API key>& wheelsData, const <API key>& driveData,
const PxU32 nbDrivenWheels);
/**
\brief Set the control model used by the tank.
\note <API key>: turning achieved by braking on one side, accelerating on the other side.
\note <API key>: turning achieved by accelerating forwards on one side, accelerating backwards on the other side.
\note The default value is <API key>
*/
void setDriveModel(const <API key>::Enum driveModel)
{
mDriveModel=driveModel;
}
/**
\brief Return the control model used by the tank.
*/
<API key>::Enum getDriveModel() const {return mDriveModel;}
/**
\brief Set a vehicle to its rest state. Aside from the rigid body transform, this will set the vehicle and rigid body
to the state they were in immediately after setup or create.
\note Calling setToRestState invalidates the cached raycast hit planes under each wheel meaning that suspension line
raycasts need to be performed at least once with <API key> before calling PxVehicleUpdates.
@see setup, create, <API key>, PxVehicleUpdates
*/
void setToRestState();
/**
\brief Simulation data that models vehicle components
@see setup, create
*/
<API key> mDriveSimData;
private:
bool isValid() const;
/**
\brief Drive model
@see setDriveModel, getDriveModel, <API key>
*/
<API key>::Enum mDriveModel;
PxU32 mPad[3];
//serialization
public:
PxVehicleDriveTank(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags) {}
static PxVehicleDriveTank* createObject(PxU8*& address, <API key>& context);
static void getBinaryMetaData(PxOutputStream& stream);
virtual const char* getConcreteTypeName() const { return "PxVehicleDriveTank"; }
virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDriveTank", name) || PxBase::isKindOf(name); }
protected:
PxVehicleDriveTank();
~PxVehicleDriveTank(){}
//~serialization
};
<API key>(0==(sizeof(PxVehicleDriveTank) & 15));
#if !PX_DOXYGEN
} // namespace physx
#endif
#endif //<API key>
|
// The LLVM Compiler Infrastructure
// This file is distributed under the University of Illinois Open Source
#include "DiagTool.h"
#include "DiagnosticNames.h"
#include "clang/Basic/LLVM.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/<API key>.h"
#include "clang/Frontend/<API key>.h"
#include "clang/Frontend/Utils.h"
#include "llvm/Support/TargetSelect.h"
DEF_DIAGTOOL("show-enabled",
"Show which warnings are enabled for a given command line",
ShowEnabledWarnings)
using namespace clang;
using namespace diagtool;
namespace {
struct PrettyDiag {
StringRef Name;
StringRef Flag;
DiagnosticsEngine::Level Level;
PrettyDiag(StringRef name, StringRef flag, DiagnosticsEngine::Level level)
: Name(name), Flag(flag), Level(level) {}
bool operator<(const PrettyDiag &x) const { return Name < x.Name; }
};
}
static void printUsage() {
llvm::errs() << "Usage: diagtool show-enabled [<flags>] <single-input.c>\n";
}
static char getCharForLevel(DiagnosticsEngine::Level Level) {
switch (Level) {
case DiagnosticsEngine::Ignored: return ' ';
case DiagnosticsEngine::Note: return '-';
case DiagnosticsEngine::Warning: return 'W';
case DiagnosticsEngine::Error: return 'E';
case DiagnosticsEngine::Fatal: return 'F';
}
llvm_unreachable("Unknown diagnostic level");
}
static IntrusiveRefCntPtr<DiagnosticsEngine>
createDiagnostics(unsigned int argc, char **argv) {
IntrusiveRefCntPtr<DiagnosticIDs> DiagIDs(new DiagnosticIDs());
// Buffer diagnostics from argument parsing so that we can output them using a
// well formed diagnostic object.
<API key> *DiagsBuffer = new <API key>;
IntrusiveRefCntPtr<DiagnosticsEngine> InterimDiags(
new DiagnosticsEngine(DiagIDs, DiagsBuffer));
// Try to build a CompilerInvocation.
OwningPtr<CompilerInvocation> Invocation(
<API key>(ArrayRef<const char *>(argv, argc),
InterimDiags));
if (!Invocation)
return NULL;
// Build the diagnostics parser
IntrusiveRefCntPtr<DiagnosticsEngine> FinalDiags =
CompilerInstance::createDiagnostics(Invocation->getDiagnosticOpts(),
argc, argv);
if (!FinalDiags)
return NULL;
// Flush any errors created when initializing everything. This could happen
// for invalid command lines, which will probably give non-sensical results.
DiagsBuffer->FlushDiagnostics(*FinalDiags);
return FinalDiags;
}
int ShowEnabledWarnings::run(unsigned int argc, char **argv, raw_ostream &Out) {
// First check our one flag (--levels).
bool ShouldShowLevels = true;
if (argc > 0) {
StringRef FirstArg(*argv);
if (FirstArg.equals("--no-levels")) {
ShouldShowLevels = false;
--argc;
++argv;
} else if (FirstArg.equals("--levels")) {
ShouldShowLevels = true;
--argc;
++argv;
}
}
// Create the diagnostic engine.
IntrusiveRefCntPtr<DiagnosticsEngine> Diags = createDiagnostics(argc, argv);
if (!Diags) {
printUsage();
return EXIT_FAILURE;
}
// Now we have our diagnostics. Iterate through EVERY diagnostic and see
// which ones are turned on.
// FIXME: It would be very nice to print which flags are turning on which
// diagnostics, but this can be done with a diff.
ArrayRef<DiagnosticRecord> AllDiagnostics = <API key>();
std::vector<PrettyDiag> Active;
for (ArrayRef<DiagnosticRecord>::iterator I = AllDiagnostics.begin(),
E = AllDiagnostics.end();
I != E; ++I) {
unsigned DiagID = I->DiagID;
if (DiagnosticIDs::isBuiltinNote(DiagID))
continue;
if (!DiagnosticIDs::<API key>(DiagID))
continue;
DiagnosticsEngine::Level DiagLevel =
Diags->getDiagnosticLevel(DiagID, SourceLocation());
if (DiagLevel == DiagnosticsEngine::Ignored)
continue;
StringRef WarningOpt = DiagnosticIDs::<API key>(DiagID);
Active.push_back(PrettyDiag(I->getName(), WarningOpt, DiagLevel));
}
// Print them all out.
for (std::vector<PrettyDiag>::const_iterator I = Active.begin(),
E = Active.end(); I != E; ++I) {
if (ShouldShowLevels)
Out << getCharForLevel(I->Level) << " ";
Out << I->Name;
if (!I->Flag.empty())
Out << " [-W" << I->Flag << "]";
Out << '\n';
}
return EXIT_SUCCESS;
}
|
input = """
g(1).
g(2).
g(3).
f(a,b).
f(A,B):- g(A), g(B).
f(a,a).
"""
output = """
{f(1,1), f(1,2), f(1,3), f(2,1), f(2,2), f(2,3), f(3,1), f(3,2), f(3,3), f(a,a), f(a,b), g(1), g(2), g(3)}
"""
|
<?php
$mysql_pool = new \swoole_connpool(\swoole_connpool::<API key>);
$r = $mysql_pool->setConfig([
"host" => "127.0.0.1",
"port" => 3306,
"user" => "root",
"password" => "",
"database" => "test",
"charset" => "utf8mb4",
"hbIntervalTime" => 1,
// hbTimeout
// connectTimeout
]);
assert($r === true);
$mysql_pool->on("hbConstruct", function() {
return [
"method" => "query",
"args" => "select 1",
];
});
$mysql_pool->on("hbCheck", function(\swoole_connpool $pool, $conn, $data) {
echo $data;
swoole_event_exit();
return true;
});
$r = $mysql_pool->createConnPool(1, 1);
assert($r === true);
$timeout = 1000;
$timerId = swoole_timer_after($timeout + 100, function() use(&$got){
assert(false);
swoole_event_exit();
});
$connId = $mysql_pool->get($timeout, function(\swoole_connpool $pool, /*\swoole_client*/$cli) use($timerId) {
swoole_timer_clear($timerId);
if ($cli instanceof \swoole_mysql) {
assert($cli->isConnected());
$pool->release($cli);
} else {
assert(false);
swoole_event_exit();
}
});
assert($connId > 0);
|
// <API key>.h
// <API key>
#import <UIKit/UIKit.h>
@interface <API key> : <API key>
@end
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Xml.Linq;
using EnvDTE80;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Input;
using Microsoft.VisualStudio.ProjectSystem.Properties;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using NuGet.<API key>;
using Roslyn.Hosting.Diagnostics.Waiters;
using Roslyn.Utilities;
using VSLangProj;
using VSLangProj140;
using VSLangProj80;
namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
{
internal class <API key> : InProcComponent
{
private readonly SendKeys_InProc _sendKeys;
private Solution2? _solution;
private string? _fileName;
private static readonly Lazy<IDictionary<string, string>> <API key> = new Lazy<IDictionary<string, string>>(<API key>);
private static readonly Lazy<IDictionary<string, string>> <API key> = new Lazy<IDictionary<string, string>>(<API key>);
private <API key>()
{
_sendKeys = new SendKeys_InProc(VisualStudio_InProc.Create());
}
public static <API key> Create()
=> new <API key>();
private static IDictionary<string, string> <API key>()
{
var localeID = GetDTE().LocaleID;
return new Dictionary<string, string>
{
[<API key>.ClassLibrary] = $@"Windows\{localeID}\ClassLibrary.zip",
[<API key>.ConsoleApplication] = "Microsoft.CSharp.ConsoleApplication",
[<API key>.Website] = "EmptyWeb.zip",
[<API key>.WinFormsApplication] = "WindowsApplication.zip",
[<API key>.WpfApplication] = "WpfApplication.zip",
[<API key>.WebApplication] = "<API key>"
};
}
private static IDictionary<string, string> <API key>()
{
var localeID = GetDTE().LocaleID;
return new Dictionary<string, string>
{
[<API key>.ClassLibrary] = $@"Windows\{localeID}\ClassLibrary.zip",
[<API key>.ConsoleApplication] = "Microsoft.VisualBasic.Windows.ConsoleApplication",
[<API key>.Website] = "EmptyWeb.zip",
[<API key>.WinFormsApplication] = "WindowsApplication.zip",
[<API key>.WpfApplication] = "WpfApplication.zip",
[<API key>.WebApplication] = "<API key>"
};
}
public void <API key>(string assemblyName, string projectName)
{
var project = GetProject(projectName);
var vsproject = ((VSProject)project.Object);
vsproject.References.Add(assemblyName);
}
public void <API key>(string assemblyName, string projectName)
{
var project = GetProject(projectName);
var reference = ((VSProject)project.Object).References.Cast<Reference>().Where(x => x.Name == assemblyName).First();
reference.Remove();
}
public void <API key>(string filePath, string projectName)
{
var project = GetProject(projectName);
var vsProject = (VSProject3)project.Object;
vsProject.AnalyzerReferences.Add(filePath);
}
public void <API key>(string filePath, string projectName)
{
var project = GetProject(projectName);
((VSProject3)project.Object).AnalyzerReferences.Remove(filePath);
}
public void SetLanguageVersion(string projectName, string languageVersion)
{
var project = GetProject(projectName);
var <API key> = (<API key>)project.<API key>.ActiveConfiguration.Object;
<API key>.LanguageVersion = languageVersion;
}
public string DirectoryName => Path.GetDirectoryName(<API key>);
public string <API key>
{
get
{
Contract.ThrowIfNull(_solution);
Contract.ThrowIfNull(_fileName);
var solutionFullName = _solution.FullName;
return string.IsNullOrEmpty(solutionFullName)
? _fileName
: solutionFullName;
}
}
public void CloseSolution(bool saveFirst = false)
=> GetDTE().Solution.Close(saveFirst);
<summary>
Creates and loads a new solution in the host process, optionally saving the existing solution if one exists.
</summary>
public void CreateSolution(string solutionName, bool <API key> = false)
{
var dte = GetDTE();
if (dte.Solution.IsOpen)
{
CloseSolution(<API key>);
}
var solutionPath = IntegrationHelper.CreateTemporaryPath();
var solutionFileName = Path.ChangeExtension(solutionName, ".sln");
IntegrationHelper.<API key>(solutionPath);
Directory.CreateDirectory(solutionPath);
var solution = GetGlobalService<SVsSolution, IVsSolution>();
ErrorHandler.ThrowOnFailure(solution.CreateSolution(solutionPath, solutionFileName, (uint)<API key>.CSF_SILENT));
ErrorHandler.ThrowOnFailure(solution.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.<API key>, null, 0));
_solution = (Solution2)dte.Solution;
_fileName = Path.Combine(solutionPath, solutionFileName);
}
public string[] <API key>(string projectName)
{
var project = GetProject(projectName);
var references = ((VSProject)project.Object).References.Cast<Reference>()
.Where(x => x.SourceProject == null)
.Select(x => x.Name + "," + x.Version + "," + x.PublicKeyToken).ToArray();
return references;
}
public void RenameFile(string projectName, string oldFileName, string newFileName)
{
var project = GetProject(projectName);
var projectDirectory = Path.GetDirectoryName(project.FullName);
VsShellUtilities.RenameDocument(
ServiceProvider.GlobalProvider,
Path.Combine(projectDirectory, oldFileName),
Path.Combine(projectDirectory, newFileName));
}
public void RenameFileViaDTE(string projectName, string oldFileName, string newFileName)
{
var projectItem = GetProjectItem(projectName, oldFileName);
projectItem.Name = newFileName;
}
public void EditProjectFile(string projectName)
{
var solutionExplorer = ((DTE2)GetDTE()).ToolWindows.SolutionExplorer;
solutionExplorer.Parent.Activate();
var rootHierarchyItems = solutionExplorer.UIHierarchyItems.Cast<EnvDTE.UIHierarchyItem>();
var solution = rootHierarchyItems.First();
var <API key> = solution.UIHierarchyItems.Cast<EnvDTE.UIHierarchyItem>();
var project = <API key>.Where(x => x.Name == projectName).FirstOrDefault();
if (project == null)
{
throw new ArgumentException($"Could not find project file, current hierarchy items '{string.Join(", ", rootHierarchyItems.Select(x => x.Name))}'");
}
project.Select(EnvDTE.vsUISelectionType.<API key>);
ExecuteCommand("Project.EditProjectFile");
}
public string[] <API key>(string projectName)
{
var project = GetProject(projectName);
var references = ((VSProject)project.Object).References.Cast<Reference>().Where(x => x.SourceProject != null).Select(x => x.Name).ToArray();
return references;
}
public void CreateSolution(string solutionName, string <API key>)
{
var solutionElement = XElement.Parse(<API key>);
if (solutionElement.Name != "Solution")
{
throw new ArgumentException(nameof(<API key>));
}
CreateSolution(solutionName);
foreach (var projectElement in solutionElement.Elements("Project"))
{
CreateProject(projectElement);
}
foreach (var projectElement in solutionElement.Elements("Project"))
{
var projectReferences = projectElement.Attribute("ProjectReferences")?.Value;
if (projectReferences != null)
{
var projectName = projectElement.Attribute("ProjectName").Value;
foreach (var projectReference in projectReferences.Split(';'))
{
AddProjectReference(projectName, projectReference);
}
}
}
}
private void CreateProject(XElement projectElement)
{
const string language = "Language";
const string name = "ProjectName";
const string template = "ProjectTemplate";
var languageName = projectElement.Attribute(language)?.Value
?? throw new ArgumentException($"You must specify an attribute called '{language}' on a project element.");
var projectName = projectElement.Attribute(name)?.Value
?? throw new ArgumentException($"You must specify an attribute called '{name}' on a project element.");
var projectTemplate = projectElement.Attribute(template)?.Value
?? throw new ArgumentException($"You must specify an attribute called '{template}' on a project element.");
var projectPath = Path.Combine(DirectoryName, projectName);
var projectTemplatePath = <API key>(projectTemplate, ConvertLanguageName(languageName));
Contract.ThrowIfNull(_solution);
_solution.AddFromTemplate(projectTemplatePath, projectPath, projectName, Exclusive: false);
foreach (var documentElement in projectElement.Elements("Document"))
{
var fileName = documentElement.Attribute("FileName").Value;
UpdateOrAddFile(projectName, fileName, contents: documentElement.Value);
}
}
public void AddProjectReference(string projectName, string <API key>)
{
var project = GetProject(projectName);
var projectToReference = GetProject(<API key>);
((VSProject)project.Object).References.AddProject(projectToReference);
}
public void AddPackageReference(string projectName, string packageName, string version)
{
var project = GetProject(projectName);
if (project is <API key> browseObjectContext)
{
var threadingService = browseObjectContext.UnconfiguredProject.ProjectService.Services.ThreadingPolicy;
var result = threadingService.<API key>(async () =>
{
var configuredProject = await browseObjectContext.UnconfiguredProject.<API key>().ConfigureAwait(false);
return await configuredProject!.Services.PackageReferences!.AddAsync(packageName, version).ConfigureAwait(false);
});
}
else
{
throw new <API key>($"'{nameof(AddPackageReference)}' is not supported in project '{projectName}'.");
}
}
public void <API key>(string projectName, string packageName)
{
var project = GetProject(projectName);
if (project is <API key> browseObjectContext)
{
var threadingService = browseObjectContext.UnconfiguredProject.ProjectService.Services.ThreadingPolicy;
threadingService.<API key>(async () =>
{
var configuredProject = await browseObjectContext.UnconfiguredProject.<API key>().ConfigureAwait(false);
await configuredProject!.Services.PackageReferences!.RemoveAsync(packageName).ConfigureAwait(false);
});
}
else
{
throw new <API key>($"'{nameof(<API key>)}' is not supported in project '{projectName}'.");
}
}
public void <API key>(string projectName, string <API key>)
{
var project = GetProject(projectName);
var vsproject = (VSProject)project.Object;
var references = vsproject.References.Cast<Reference>();
var reference = references.Where(x => x.ContainingProject != null && x.Name == <API key>).FirstOrDefault();
if (reference == null)
{
var projectReference = references.Where(x => x.ContainingProject != null).Select(x => x.Name);
throw new ArgumentException($"reference to project {<API key>} not found, references: '{string.Join(", ", projectReference)}'");
}
reference.Remove();
}
public void OpenSolution(string path, bool <API key> = false)
{
var dte = GetDTE();
if (dte.Solution.IsOpen)
{
CloseSolution(<API key>);
}
dte.Solution.Open(path);
_solution = (EnvDTE80.Solution2)dte.Solution;
_fileName = path;
}
private static string ConvertLanguageName(string languageName)
{
const string CSharp = nameof(CSharp);
const string VisualBasic = nameof(VisualBasic);
switch (languageName)
{
case LanguageNames.CSharp:
return CSharp;
case LanguageNames.VisualBasic:
return VisualBasic;
default:
throw new ArgumentException($"{languageName} is not supported.", nameof(languageName));
}
}
public void AddProject(string projectName, string projectTemplate, string languageName)
{
var projectPath = Path.Combine(DirectoryName, projectName);
var projectTemplatePath = <API key>(projectTemplate, ConvertLanguageName(languageName));
Contract.ThrowIfNull(_solution);
_solution.AddFromTemplate(projectTemplatePath, projectPath, projectName, Exclusive: false);
}
public void AddCustomProject(string projectName, string <API key>, string projectFileContent)
{
var projectPath = Path.Combine(DirectoryName, projectName);
Directory.CreateDirectory(projectPath);
var projectFilePath = Path.Combine(projectPath, projectName + <API key>);
File.WriteAllText(projectFilePath, projectFileContent);
Contract.ThrowIfNull(_solution);
_solution.AddFromFile(projectFilePath);
}
// TODO: Adjust language name based on whether we are using a web template
private string <API key>(string projectTemplate, string languageName)
{
Contract.ThrowIfNull(_solution);
if (languageName.Equals("csharp", StringComparison.OrdinalIgnoreCase) &&
<API key>.Value.TryGetValue(projectTemplate, out var <API key>))
{
return _solution.GetProjectTemplate(<API key>, languageName);
}
if (languageName.Equals("visualbasic", StringComparison.OrdinalIgnoreCase) &&
<API key>.Value.TryGetValue(projectTemplate, out var <API key>))
{
return _solution.GetProjectTemplate(<API key>, languageName);
}
return _solution.GetProjectTemplate(projectTemplate, languageName);
}
public void CleanUpOpenSolution()
{
var directoriesToDelete = new List<string>();
var dte = GetDTE();
InvokeOnUIThread(cancellationToken =>
{
if (dte.Solution != null)
{
// Save the full path to each project in the solution. This is so we can
// cleanup any folders after the solution is closed.
foreach (EnvDTE.Project project in dte.Solution.Projects)
{
if (!string.IsNullOrEmpty(project.FullName))
{
directoriesToDelete.Add(Path.GetDirectoryName(project.FullName));
}
}
// Save the full path to the solution. This is so we can cleanup any folders after the solution is closed.
// The solution might be zero-impact and thus has no name, so deal with that
var solutionFullName = dte.Solution.FullName;
if (!string.IsNullOrEmpty(solutionFullName))
{
directoriesToDelete.Add(Path.GetDirectoryName(solutionFullName));
}
}
});
if (dte.Debugger.CurrentMode != EnvDTE.dbgDebugMode.dbgDesignMode)
{
// Close the Find Source window in case it's open.
_sendKeys.Send(VirtualKey.Escape);
dte.Debugger.TerminateAll();
WaitForDesignMode(dte);
}
CloseSolution();
ErrorList_InProc.Create().<API key>(Helper.<API key>);
foreach (var directoryToDelete in directoriesToDelete)
{
IntegrationHelper.<API key>(directoryToDelete);
}
}
private static void WaitForDesignMode(EnvDTE.DTE dte)
{
#if TODO
// This delay was originally added to address test failures in <API key>. When running
// multiple tests in sequence, situations were observed where the Edit and Continue state was not reset:
// 1. Test A runs, starts debugging with Edit and Continue
// 2. Test A completes, and the debugger is terminated
// 3. A new project is created for test B
// 4. Test B attempts to set the text for the document created in step (3), but fails
// Step (4) was causing test failures because the project created for test B remained in a read-only
// state believing a debugger session was active.
// This delay should be replaced with a proper wait condition once the correct one is determined.
var debugService = <API key><<API key>>().Services.GetRequiredService<<API key>>();
using (var <API key> = new <API key>(initialState: false))
{
debugService.<API key> += (_, e) =>
{
if (e.After == DebuggingState.Design)
{
<API key>.Set();
}
};
if (dte.Debugger.CurrentMode == EnvDTE.dbgDebugMode.dbgDesignMode)
{
return;
}
if (!<API key>.Wait(Helper.<API key>))
{
throw new TimeoutException("Failed to enter design mode in a timely manner.");
}
}
#endif
}
private void CloseSolution()
{
var solution = GetGlobalService<SVsSolution, IVsSolution>();
ErrorHandler.ThrowOnFailure(solution.GetProperty((int)__VSPROPID.<API key>, out var isOpen));
if (!(bool)isOpen)
{
return;
}
using (var semaphore = new SemaphoreSlim(1))
using (var solutionEvents = new SolutionEvents(solution))
{
semaphore.Wait();
void <API key>(object sender, EventArgs e) => semaphore.Release();
solutionEvents.AfterCloseSolution += <API key>;
try
{
ErrorHandler.ThrowOnFailure(solution.<API key>((uint)__VSSLNCLOSEOPTIONS.<API key> | (uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave, null, 0));
semaphore.Wait();
}
finally
{
solutionEvents.AfterCloseSolution -= <API key>;
}
}
var waitingService = GetComponentModel().<API key>.GetExportedValue<<API key>>();
waitingService.<API key>(FeatureAttribute.Workspace, <API key>: true);
}
private sealed class SolutionEvents : IVsSolutionEvents, IDisposable
{
private readonly IVsSolution _solution;
private readonly uint _cookie;
public SolutionEvents(IVsSolution solution)
{
_solution = solution;
ErrorHandler.ThrowOnFailure(solution.<API key>(this, out _cookie));
}
public event EventHandler? AfterCloseSolution;
public void Dispose()
{
InvokeOnUIThread(cancellationToken =>
{
ErrorHandler.ThrowOnFailure(_solution.<API key>(_cookie));
});
}
public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
{
return VSConstants.S_OK;
}
public int OnQueryCloseProject(IVsHierarchy pHierarchy, int fRemoving, ref int pfCancel)
{
return VSConstants.S_OK;
}
public int <API key>(IVsHierarchy pHierarchy, int fRemoved)
{
return VSConstants.S_OK;
}
public int OnAfterLoadProject(IVsHierarchy pStubHierarchy, IVsHierarchy pRealHierarchy)
{
return VSConstants.S_OK;
}
public int <API key>(IVsHierarchy pRealHierarchy, ref int pfCancel)
{
return VSConstants.S_OK;
}
public int <API key>(IVsHierarchy pRealHierarchy, IVsHierarchy pStubHierarchy)
{
return VSConstants.S_OK;
}
public int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
{
return VSConstants.S_OK;
}
public int <API key>(object pUnkReserved, ref int pfCancel)
{
return VSConstants.S_OK;
}
public int <API key>(object pUnkReserved)
{
return VSConstants.S_OK;
}
public int <API key>(object pUnkReserved)
{
AfterCloseSolution?.Invoke(this, EventArgs.Empty);
return VSConstants.S_OK;
}
}
private EnvDTE.Project GetProject(string nameOrFileName)
{
Contract.ThrowIfNull(_solution);
return _solution.Projects.OfType<EnvDTE.Project>().First(
p => string.Compare(p.FileName, nameOrFileName, StringComparison.OrdinalIgnoreCase) == 0
|| string.Compare(p.Name, nameOrFileName, StringComparison.OrdinalIgnoreCase) == 0);
}
<summary>
Update the given file if it already exists in the project, otherwise add a new file to the project.
</summary>
<param name="projectName">The project that contains the file.</param>
<param name="fileName">The name of the file to update or add.</param>
<param name="contents">The contents of the file to overwrite if the file already exists or set if the file it created. Empty string is used if null is passed.</param>
<param name="open">Whether to open the file after it has been updated/created.</param>
public void UpdateOrAddFile(string projectName, string fileName, string? contents = null, bool open = false)
{
var project = GetProject(projectName);
if (project.ProjectItems.Cast<EnvDTE.ProjectItem>().Any(x => x.Name == fileName))
{
UpdateFile(projectName, fileName, contents, open);
}
else
{
AddFile(projectName, fileName, contents, open);
}
}
<summary>
Update the given file to have the contents given.
</summary>
<param name="projectName">The project that contains the file.</param>
<param name="fileName">The name of the file to update or add.</param>
<param name="contents">The contents of the file to overwrite. Empty string is used if null is passed.</param>
<param name="open">Whether to open the file after it has been updated.</param>
public void UpdateFile(string projectName, string fileName, string? contents = null, bool open = false)
{
void SetText(string text)
{
InvokeOnUIThread(cancellationToken =>
{
// The active text view might not have finished composing yet, waiting for the application to 'idle'
// means that it is done pumping messages (including WM_PAINT) and the window should return the correct text view
<API key>(Helper.<API key>);
var vsTextManager = GetGlobalService<SVsTextManager, IVsTextManager>();
var hresult = vsTextManager.GetActiveView(fMustHaveFocus: 1, pBuffer: null, ppView: out var vsTextView);
Marshal.ThrowExceptionForHR(hresult);
var activeVsTextView = (IVsUserData)vsTextView;
hresult = activeVsTextView.GetData(Editor_InProc.IWpfTextViewId, out var wpfTextViewHost);
Marshal.ThrowExceptionForHR(hresult);
var view = ((IWpfTextViewHost)wpfTextViewHost).TextView;
var textSnapshot = view.TextSnapshot;
var replacementSpan = new Text.SnapshotSpan(textSnapshot, 0, textSnapshot.Length);
view.TextBuffer.Replace(replacementSpan, text);
});
}
OpenFile(projectName, fileName);
SetText(contents ?? string.Empty);
CloseCodeFile(projectName, fileName, saveFile: true);
if (open)
{
OpenFile(projectName, fileName);
}
}
<summary>
Add new file to project.
</summary>
<param name="projectName">The project that contains the file.</param>
<param name="fileName">The name of the file to add.</param>
<param name="contents">The contents of the file to overwrite. An empty file is create if null is passed.</param>
<param name="open">Whether to open the file after it has been updated.</param>
public void AddFile(string projectName, string fileName, string? contents = null, bool open = false)
{
var project = GetProject(projectName);
var projectDirectory = Path.GetDirectoryName(project.FullName);
var filePath = Path.Combine(projectDirectory, fileName);
var directoryPath = Path.GetDirectoryName(filePath);
Directory.CreateDirectory(directoryPath);
if (contents != null)
{
File.WriteAllText(filePath, contents);
}
else if (!File.Exists(filePath))
{
File.Create(filePath).Dispose();
}
_ = project.ProjectItems.AddFromFile(filePath);
if (open)
{
OpenFile(projectName, fileName);
}
}
<summary>
Adds a new standalone file to the Miscellaneous Files workspace.
</summary>
<param name="fileName">The name of the file to add.</param>
public void AddStandaloneFile(string fileName)
{
string itemTemplate;
var extension = Path.GetExtension(fileName).ToLowerInvariant();
switch (extension)
{
case ".cs":
itemTemplate = @"General\Visual C# Class";
break;
case ".csx":
itemTemplate = @"Script\Visual C# Script";
break;
case ".vb":
itemTemplate = @"General\Visual Basic Class";
break;
case ".txt":
itemTemplate = @"General\Text File";
break;
default:
throw new <API key>($"File type '{extension}' is not yet supported.");
}
GetDTE().ItemOperations.NewFile(itemTemplate, fileName);
}
public void SetFileContents(string projectName, string relativeFilePath, string contents)
{
var project = GetProject(projectName);
var projectPath = Path.GetDirectoryName(project.FullName);
var filePath = Path.Combine(projectPath, relativeFilePath);
File.WriteAllText(filePath, contents);
}
public string GetFileContents(string projectName, string relativeFilePath)
{
var project = GetProject(projectName);
var projectPath = Path.GetDirectoryName(project.FullName);
var filePath = Path.Combine(projectPath, relativeFilePath);
return File.ReadAllText(filePath);
}
public void BuildSolution()
{
var <API key> = <API key>();
<API key>.Clear();
ExecuteCommand(<API key>.Build_BuildSolution);
<API key>();
}
public void <API key>()
{
var <API key> = <API key>();
<API key>.Clear();
}
private EnvDTE.OutputWindowPane <API key>()
{
var dte = (DTE2)GetDTE();
var outputWindow = dte.ToolWindows.OutputWindow;
return outputWindow.OutputWindowPanes.Item("Build");
}
public void <API key>()
{
var buildManager = GetGlobalService<<API key>, <API key>>();
using (var semaphore = new SemaphoreSlim(1))
using (var solutionEvents = new <API key>(buildManager))
{
semaphore.Wait();
void @event(bool succeeded, bool modified, bool canceled) => semaphore.Release();
solutionEvents.<API key> += @event;
try
{
semaphore.Wait(Helper.<API key>);
}
finally
{
solutionEvents.<API key> -= @event;
}
}
}
internal sealed class <API key> : <API key>, <API key>, IDisposable
{
private uint cookie;
private readonly <API key> <API key>;
internal delegate void <API key>(bool succeeded, bool modified, bool canceled);
internal delegate void <API key>(ref bool cancel);
internal delegate void <API key>(ref bool cancel);
internal delegate void <API key>(IVsHierarchy projectHierarchy, IVsCfg projectConfig, int success);
internal delegate void <API key>(IVsHierarchy projectHierarchy, IVsCfg projectConfig);
public event <API key>? <API key>;
public event <API key>? <API key>;
public event <API key>? <API key>;
public event Action? <API key>;
public event Action? <API key>;
public event <API key>? <API key>;
public event <API key>? <API key>;
internal <API key>(<API key> <API key>)
{
this.<API key> = <API key>;
var hresult = <API key>.<API key>(this, out cookie);
if (hresult != 0)
{
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hresult);
}
}
int <API key>.<API key>(ref int pfCancelUpdate)
{
var cancel = false;
<API key>?.Invoke(ref cancel);
if (cancel)
{
pfCancelUpdate = 1;
}
return 0;
}
int <API key>.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand)
{
<API key>?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0);
return 0;
}
int <API key>.<API key>(ref int pfCancelUpdate)
{
return <API key>(ref pfCancelUpdate);
}
int <API key>.<API key>()
{
<API key>?.Invoke();
return 0;
}
int <API key>.<API key>(IVsHierarchy pIVsHierarchy)
{
return <API key>();
}
int <API key>.<API key>(ref int pfCancelUpdate)
{
var cancel = false;
<API key>?.Invoke(ref cancel);
if (cancel)
{
pfCancelUpdate = 1;
}
return 0;
}
int <API key>.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand)
{
<API key>?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0);
return 0;
}
int <API key>.<API key>(ref int pfCancelUpdate)
{
return <API key>(ref pfCancelUpdate);
}
int <API key>.<API key>()
{
<API key>?.Invoke();
return 0;
}
int <API key>.<API key>(IVsHierarchy pIVsHierarchy)
{
return <API key>();
}
int <API key>.<API key>(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
{
<API key>?.Invoke(pHierProj, pCfgProj);
return 0;
}
int <API key>.<API key>(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
{
<API key>?.Invoke(pHierProj, pCfgProj, fSuccess);
return 0;
}
private int <API key>(ref int pfCancelUpdate)
{
var cancel = false;
<API key>?.Invoke(ref cancel);
if (cancel)
{
pfCancelUpdate = 1;
}
return 0;
}
private int <API key>()
{
<API key>?.Invoke();
return 0;
}
void IDisposable.Dispose()
{
<API key> = null;
<API key> = null;
<API key> = null;
<API key> = null;
<API key> = null;
<API key> = null;
<API key> = null;
if (cookie != 0)
{
var tempCookie = cookie;
cookie = 0;
var hresult = <API key>.<API key>(tempCookie);
if (hresult != 0)
{
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hresult);
}
}
}
}
public void <API key>(string projectName, string relativeFilePath)
{
InvokeOnUIThread(cancellationToken =>
{
var filePath = <API key>(projectName, relativeFilePath);
VsShellUtilities.OpenDocument(ServiceProvider.GlobalProvider, filePath, VSConstants.LOGVIEWID.Designer_guid, out _, out _, out var windowFrame, out _);
ErrorHandler.ThrowOnFailure(windowFrame.Show());
});
}
public void OpenFile(string projectName, string relativeFilePath)
{
var filePath = <API key>(projectName, relativeFilePath);
VsShellUtilities.OpenDocument(ServiceProvider.GlobalProvider, filePath, VSConstants.LOGVIEWID.Code_guid, out _, out _, out _, out var view);
// Reliably set focus using <API key>
var textManager = GetGlobalService<SVsTextManager, IVsTextManager>();
ErrorHandler.ThrowOnFailure(view.GetBuffer(out var textLines));
ErrorHandler.ThrowOnFailure(view.GetCaretPos(out var line, out var column));
ErrorHandler.ThrowOnFailure(textManager.<API key>(textLines, VSConstants.LOGVIEWID.Code_guid, line, column, line, column));
}
public void CloseDesignerFile(string projectName, string relativeFilePath, bool saveFile)
{
CloseFile(projectName, relativeFilePath, VSConstants.LOGVIEWID.Designer_guid, saveFile);
}
public void CloseCodeFile(string projectName, string relativeFilePath, bool saveFile)
{
CloseFile(projectName, relativeFilePath, VSConstants.LOGVIEWID.Code_guid, saveFile);
}
private void CloseFile(string projectName, string relativeFilePath, Guid logicalView, bool saveFile)
{
InvokeOnUIThread(cancellationToken =>
{
var filePath = <API key>(projectName, relativeFilePath);
if (!VsShellUtilities.IsDocumentOpen(ServiceProvider.GlobalProvider, filePath, logicalView, out _, out _, out var windowFrame))
{
throw new <API key>($"File '{filePath}' is not open in logical view '{logicalView}'");
}
var frameClose = saveFile ? __FRAMECLOSE.<API key> : __FRAMECLOSE.FRAMECLOSE_NoSave;
ErrorHandler.ThrowOnFailure(windowFrame.CloseFrame((uint)frameClose));
});
}
private EnvDTE.Document GetOpenDocument(string projectName, string relativeFilePath)
{
var filePath = <API key>(projectName, relativeFilePath);
var documents = GetDTE().Documents.Cast<EnvDTE.Document>();
var document = documents.SingleOrDefault(d => d.FullName == filePath);
if (document == null)
{
throw new <API key>($"Open document '{filePath} could not be found. Available documents: {string.Join(", ", documents.Select(x => x.FullName))}.");
}
return document;
}
private EnvDTE.ProjectItem GetProjectItem(string projectName, string relativeFilePath)
{
Contract.ThrowIfNull(_solution);
var projects = _solution.Projects.Cast<EnvDTE.Project>();
var project = projects.FirstOrDefault(x => x.Name == projectName);
if (project == null)
{
throw new <API key>($"Project '{projectName} could not be found. Available projects: {string.Join(", ", projects.Select(x => x.Name))}.");
}
var projectPath = Path.GetDirectoryName(project.FullName);
var fullFilePath = Path.Combine(projectPath, relativeFilePath);
var projectItems = project.ProjectItems.Cast<EnvDTE.ProjectItem>();
var document = projectItems.FirstOrDefault(d => d.get_FileNames(1).Equals(fullFilePath));
if (document == null)
{
throw new <API key>($"File '{fullFilePath}' could not be found. Available files: {string.Join(", ", projectItems.Select(x => x.get_FileNames(1)))}.");
}
return document;
}
public void SaveFile(string projectName, string relativeFilePath)
{
<API key>(GetOpenDocument(projectName, relativeFilePath));
}
private static void <API key>(EnvDTE.Document document)
{
var textDocument = (EnvDTE.TextDocument)document.Object(nameof(EnvDTE.TextDocument));
var <API key> = textDocument.StartPoint.CreateEditPoint().GetText(textDocument.EndPoint);
var fullPath = document.FullName;
document.Save();
if (File.ReadAllText(fullPath) != <API key>)
{
throw new <API key>("The text that we thought we were saving isn't what we saved!");
}
}
private string <API key>(string projectName, string relativeFilePath)
{
Contract.ThrowIfNull(_solution);
var project = _solution.Projects.Cast<EnvDTE.Project>().First(x => x.Name == projectName);
var projectPath = Path.GetDirectoryName(project.FullName);
return Path.Combine(projectPath, relativeFilePath);
}
public void ReloadProject(string projectRelativePath)
{
Contract.ThrowIfNull(_solution);
var solutionPath = Path.GetDirectoryName(_solution.FullName);
var projectPath = Path.Combine(solutionPath, projectRelativePath);
_solution.AddFromFile(projectPath);
}
public bool <API key>(string projectName)
{
using var <API key> = new <API key>(Helper.<API key>);
var <API key> = InvokeOnUIThread(cancellationToken => GetComponentModel().GetExtensions<<API key>>().Single());
var nominateProjectTask = <API key>.<API key>(GetProject(projectName).FullName, <API key>.Token);
nominateProjectTask.Wait(<API key>.Token);
return nominateProjectTask.Result;
}
public void SaveAll()
=> ExecuteCommand(<API key>.File_SaveAll);
public void ShowErrorList()
=> ExecuteCommand(<API key>.View_ErrorList);
public void ShowOutputWindow()
=> ExecuteCommand(<API key>.View_Output);
public void UnloadProject(string projectName)
{
Contract.ThrowIfNull(_solution);
var projects = _solution.Projects;
EnvDTE.Project? project = null;
for (var i = 1; i <= projects.Count; i++)
{
project = projects.Item(i);
if (string.Compare(project.Name, projectName, StringComparison.Ordinal) == 0)
{
break;
}
}
_solution.Remove(project);
}
public void SelectItem(string itemName)
{
var dte = (DTE2)GetDTE();
var solutionExplorer = dte.ToolWindows.SolutionExplorer;
var item = <API key>(solutionExplorer.UIHierarchyItems, itemName);
Contract.ThrowIfNull(item);
item.Select(EnvDTE.vsUISelectionType.<API key>);
solutionExplorer.Parent.Activate();
}
public void SelectItemAtPath(params string[] path)
{
var dte = (DTE2)GetDTE();
var solutionExplorer = dte.ToolWindows.SolutionExplorer;
var item = FindItemAtPath(solutionExplorer.UIHierarchyItems, path);
Contract.ThrowIfNull(item);
item.Select(EnvDTE.vsUISelectionType.<API key>);
solutionExplorer.Parent.Activate();
}
public string[] GetChildrenOfItem(string itemName)
{
var dte = (DTE2)GetDTE();
var solutionExplorer = dte.ToolWindows.SolutionExplorer;
var item = <API key>(solutionExplorer.UIHierarchyItems, itemName);
Contract.ThrowIfNull(item);
return item.UIHierarchyItems
.Cast<EnvDTE.UIHierarchyItem>()
.Select(i => i.Name)
.ToArray();
}
public string[] <API key>(params string[] path)
{
var dte = (DTE2)GetDTE();
var solutionExplorer = dte.ToolWindows.SolutionExplorer;
var item = FindItemAtPath(solutionExplorer.UIHierarchyItems, path);
Contract.ThrowIfNull(item);
return item.UIHierarchyItems
.Cast<EnvDTE.UIHierarchyItem>()
.Select(i => i.Name)
.ToArray();
}
private static EnvDTE.UIHierarchyItem? FindItemAtPath(
EnvDTE.UIHierarchyItems currentItems,
string[] path)
{
EnvDTE.UIHierarchyItem? item = null;
foreach (var name in path)
{
item = currentItems.Cast<EnvDTE.UIHierarchyItem>().FirstOrDefault(i => i.Name == name);
if (item == null)
{
return null;
}
currentItems = item.UIHierarchyItems;
}
return item;
}
private static EnvDTE.UIHierarchyItem? <API key>(
EnvDTE.UIHierarchyItems currentItems,
string itemName)
{
if (currentItems == null)
{
return null;
}
foreach (var item in currentItems.Cast<EnvDTE.UIHierarchyItem>())
{
if (item.Name == itemName)
{
return item;
}
var result = <API key>(item.UIHierarchyItems, itemName);
if (result != null)
{
return result;
}
}
return null;
}
}
}
|
"""Grep dialog for Find in Files functionality.
Inherits from SearchDialogBase for GUI and uses searchengine
to prepare search pattern.
"""
import fnmatch
import os
import sys
from tkinter import StringVar, BooleanVar
from tkinter.ttk import Checkbutton
from idlelib.searchbase import SearchDialogBase
from idlelib import searchengine
# Importing OutputWindow here fails due to import loop
# EditorWindow -> GrepDialop -> OutputWindow -> EditorWindow
def grep(text, io=None, flist=None):
"""Create or find singleton GrepDialog instance.
Args:
text: Text widget that contains the selected text for
default search phrase.
io: iomenu.IOBinding instance with default path to search.
flist: filelist.FileList instance for OutputWindow parent.
"""
root = text._root()
engine = searchengine.get(root)
if not hasattr(engine, "_grepdialog"):
engine._grepdialog = GrepDialog(root, engine, flist)
dialog = engine._grepdialog
searchphrase = text.get("sel.first", "sel.last")
dialog.open(text, searchphrase, io)
class GrepDialog(SearchDialogBase):
"Dialog for searching multiple files."
title = "Find in Files Dialog"
icon = "Grep"
needwrapbutton = 0
def __init__(self, root, engine, flist):
"""Create search dialog for searching for a phrase in the file system.
Uses SearchDialogBase as the basis for the GUI and a
searchengine instance to prepare the search.
Attributes:
globvar: Value of Text Entry widget for path to search.
recvar: Boolean value of Checkbutton widget
for traversing through subdirectories.
"""
SearchDialogBase.__init__(self, root, engine)
self.flist = flist
self.globvar = StringVar(root)
self.recvar = BooleanVar(root)
def open(self, text, searchphrase, io=None):
"Make dialog visible on top of others and ready to use."
SearchDialogBase.open(self, text, searchphrase)
if io:
path = io.filename or ""
else:
path = ""
dir, base = os.path.split(path)
head, tail = os.path.splitext(base)
if not tail:
tail = ".py"
self.globvar.set(os.path.join(dir, "*" + tail))
def create_entries(self):
"Create base entry widgets and add widget for search path."
SearchDialogBase.create_entries(self)
self.globent = self.make_entry("In files:", self.globvar)[0]
def <API key>(self):
"Add check button to recurse down subdirectories."
btn = Checkbutton(
self.make_frame()[0], variable=self.recvar,
text="Recurse down subdirectories")
btn.pack(side="top", fill="both")
def <API key>(self):
"Create base command buttons and add button for search."
SearchDialogBase.<API key>(self)
self.make_button("Search Files", self.default_command, 1)
def default_command(self, event=None):
"""Grep for search pattern in file path. The default command is bound
to <Return>.
If entry values are populated, set OutputWindow as stdout
and perform search. The search dialog is closed automatically
when the search begins.
"""
prog = self.engine.getprog()
if not prog:
return
path = self.globvar.get()
if not path:
self.top.bell()
return
from idlelib.outwin import OutputWindow # leave here!
save = sys.stdout
try:
sys.stdout = OutputWindow(self.flist)
self.grep_it(prog, path)
finally:
sys.stdout = save
def grep_it(self, prog, path):
"""Search for prog within the lines of the files in path.
For the each file in the path directory, open the file and
search each line for the matching pattern. If the pattern is
found, write the file and line information to stdout (which
is an OutputWindow).
"""
dir, base = os.path.split(path)
list = self.findfiles(dir, base, self.recvar.get())
list.sort()
self.close()
pat = self.engine.getpat()
print(f"Searching {pat!r} in {path} ...")
hits = 0
try:
for fn in list:
try:
with open(fn, errors='replace') as f:
for lineno, line in enumerate(f, 1):
if line[-1:] == '\n':
line = line[:-1]
if prog.search(line):
sys.stdout.write(f"{fn}: {lineno}: {line}\n")
hits += 1
except OSError as msg:
print(msg)
print(f"Hits found: {hits}\n(Hint: right-click to open locations.)"
if hits else "No hits.")
except AttributeError:
# Tk window has been closed, OutputWindow.text = None,
# so in OW.write, OW.text.insert fails.
pass
def findfiles(self, dir, base, rec):
"""Return list of files in the dir that match the base pattern.
If rec is True, recursively iterate through subdirectories.
"""
try:
names = os.listdir(dir or os.curdir)
except OSError as msg:
print(msg)
return []
list = []
subdirs = []
for name in names:
fn = os.path.join(dir, name)
if os.path.isdir(fn):
subdirs.append(fn)
else:
if fnmatch.fnmatch(name, base):
list.append(fn)
if rec:
for subdir in subdirs:
list.extend(self.findfiles(subdir, base, rec))
return list
def _grep_dialog(parent): # htest #
from tkinter import Toplevel, Text, SEL, END
from tkinter.ttk import Button
from idlelib.pyshell import PyShellFileList
top = Toplevel(parent)
top.title("Test GrepDialog")
x, y = map(int, parent.geometry().split('+')[1:])
top.geometry(f"+{x}+{y + 175}")
flist = PyShellFileList(top)
text = Text(top, height=5)
text.pack()
def show_grep_dialog():
text.tag_add(SEL, "1.0", END)
grep(text, flist=flist)
text.tag_remove(SEL, "1.0", END)
button = Button(top, text="Show GrepDialog", command=show_grep_dialog)
button.pack()
if __name__ == "__main__":
import unittest
unittest.main('idlelib.idle_test.test_grep', verbosity=2, exit=False)
from idlelib.idle_test.htest import run
run(_grep_dialog)
|
'use strict';
import { react2angular } from 'react2angular';
import { <API key> } from './<API key>';
import { module } from 'angular';
export const <API key> =
'spinnaker.core.instance.loadBalancer.health.directive';
export const name = <API key>; // for backwards compatibility
module(<API key>, []).component(
'<API key>',
react2angular(<API key>, ['loadBalancer', 'ipAddress']),
);
|
// Check that you can cast between different pointers to trait objects
// whose vtable have the same kind (both lengths, or both trait pointers).
trait Foo<T> {
fn foo(&self, _: T) -> u32 { 42 }
}
trait Bar {
fn bar(&self) { println!("Bar!"); }
}
impl<T> Foo<T> for () {}
impl Foo<u32> for u32 { fn foo(&self, _: u32) -> u32 { self+43 } }
impl Bar for () {}
unsafe fn round_trip_and_call<'a>(t: *const (dyn Foo<u32>+'a)) -> u32 {
let foo_e : *const dyn Foo<u16> = t as *const _;
let r_1 = foo_e as *mut dyn Foo<u32>;
(&*r_1).foo(0)
}
struct FooS<T:?Sized>(T);
struct BarS<T:?Sized>(T);
fn foo_to_bar<T:?Sized>(u: *const FooS<T>) -> *const BarS<T> {
u as *const BarS<T>
}
fn main() {
let x = 4u32;
let y : &dyn Foo<u32> = &x;
let fl = unsafe { round_trip_and_call(y as *const dyn Foo<u32>) };
assert_eq!(fl, (43+4));
let s = FooS([0,1,2]);
let u: &FooS<[u32]> = &s;
let u: *const FooS<[u32]> = u;
let bar_ref : *const BarS<[u32]> = foo_to_bar(u);
let z : &BarS<[u32]> = unsafe{&*bar_ref};
assert_eq!(&z.0, &[0,1,2]);
// If validation fails here, that's likely because an immutable suspension is recovered mutably.
}
|
<?php
namespace frontend\rbac;
use Yii;
use yii\rbac\Rule;
/**
* Checks if user_id matches user passed via params
*/
class <API key> extends Rule
{
public $name = 'isAuthor';
public function execute($user, $item, $params)
{
return isset($params['attachment']) ? $params['attachment']->user_id == $user : false;
}
}
|
#include "CommonHeader.h"
#include "SetupPlatform.h"
#define NUMBER_OF_PACKAGES 1
CHAR16 *SocketNames[NUMBER_OF_PACKAGES];
CHAR16 *AssetTags[NUMBER_OF_PACKAGES];
CHAR16 EmptyString[] = L" ";
CHAR16 SocketString[] = L"LGA775";
VOID
<API key> (
VOID
)
{
UINTN Index;
for (Index = 0; Index < NUMBER_OF_PACKAGES; Index++) {
// The String Package of a module is registered together with all IFR packages.
// So we just arbitrarily pick a package GUID that is always installed to get the string.
AssetTags[Index] = EmptyString;
SocketNames[Index] = SocketString;
}
}
|
// shapeless's Lazy implemented in terms of byname implicits
trait Lazy[T] {
val value: T
}
object Lazy {
implicit def apply[T](implicit t: => T): Lazy[T] =
new Lazy[T] {
lazy val value = t
}
def unapply[T](lt: Lazy[T]): Option[T] = Some(lt.value)
}
trait Foo {
type Out
def out: Out
}
object Foo {
type Aux[Out0] = Foo { type Out = Out0 }
implicit val fooInt: Aux[Int] = new Foo { type Out = Int ; def out = 23 }
}
object Test {
def bar[T](t: T)(implicit foo: Lazy[Foo.Aux[T]]): foo.value.Out = foo.value.out
val i = bar(13)
i: Int
}
|
package org.wso2.developerstudio.eclipse.gmf.esb.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.SqlResultMapping;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Sql Result Mapping</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.impl.<API key>#getPropertyName <em>Property Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.impl.<API key>#getColumnId <em>Column Id</em>}</li>
* </ul>
*
* @generated
*/
public class <API key> extends EObjectImpl implements SqlResultMapping {
/**
* The default value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPropertyName()
* @generated
* @ordered
*/
protected static final String <API key> = "<API key>";
/**
* The cached value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPropertyName()
* @generated
* @ordered
*/
protected String propertyName = <API key>;
/**
* The default value of the '{@link #getColumnId() <em>Column Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColumnId()
* @generated
* @ordered
*/
protected static final String COLUMN_ID_EDEFAULT = "<API key>";
/**
* The cached value of the '{@link #getColumnId() <em>Column Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColumnId()
* @generated
* @ordered
*/
protected String columnId = COLUMN_ID_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected <API key>() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EsbPackage.Literals.SQL_RESULT_MAPPING;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPropertyName() {
return propertyName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPropertyName(String newPropertyName) {
String oldPropertyName = propertyName;
propertyName = newPropertyName;
if (<API key>())
eNotify(new ENotificationImpl(this, Notification.SET, EsbPackage.<API key>, oldPropertyName, propertyName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getColumnId() {
return columnId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setColumnId(String newColumnId) {
String oldColumnId = columnId;
columnId = newColumnId;
if (<API key>())
eNotify(new ENotificationImpl(this, Notification.SET, EsbPackage.<API key>, oldColumnId, columnId));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EsbPackage.<API key>:
return getPropertyName();
case EsbPackage.<API key>:
return getColumnId();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EsbPackage.<API key>:
setPropertyName((String)newValue);
return;
case EsbPackage.<API key>:
setColumnId((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EsbPackage.<API key>:
setPropertyName(<API key>);
return;
case EsbPackage.<API key>:
setColumnId(COLUMN_ID_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EsbPackage.<API key>:
return <API key> == null ? propertyName != null : !<API key>.equals(propertyName);
case EsbPackage.<API key>:
return COLUMN_ID_EDEFAULT == null ? columnId != null : !COLUMN_ID_EDEFAULT.equals(columnId);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (propertyName: ");
result.append(propertyName);
result.append(", columnId: ");
result.append(columnId);
result.append(')');
return result.toString();
}
} //<API key>
|
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http:
<body>
<table style="border: 1px solid black;">
<caption/>
<tr>
<th style="border: 1px solid black;">Number </th>
<th style="border: 1px solid black;">Density </th>
<th style="border: 1px solid black;">Number </th>
<th style="border: 1px solid black;">Density </th>
<th style="border: 1px solid black;">Number </th>
<th style="border: 1px solid black;">Density </th>
<th style="border: 1px solid black;">Number </th>
<th style="border: 1px solid black;">Density </th>
</tr>
<tr>
<td style="border: 1px solid black;">NK1r </td>
<td style="border: 1px solid black;">(n = 18) </td>
<td style="border: 1px solid black;">43.6 </td>
<td style="border: 1px solid black;">8.5 </td>
<td style="border: 1px solid black;">3.2 </td>
<td style="border: 1px solid black;">0.6 </td>
<td style="border: 1px solid black;">140.7 </td>
<td style="border: 1px solid black;">26.6 </td>
<td style="border: 1px solid black;">87.7 </td>
<td style="border: 1px solid black;">16.8 </td>
</tr>
<tr>
<td style="border: 1px solid black;">^{+} </td>
<td style="border: 1px solid black;">(14–145) </td>
<td style="border: 1px solid black;">(2.8–24.3) </td>
<td style="border: 1px solid black;">(0–7) </td>
<td style="border: 1px solid black;">(0–1.5) </td>
<td style="border: 1px solid black;">(62–266) </td>
<td style="border: 1px solid black;">(16.7–43.1) </td>
<td style="border: 1px solid black;">(23–137) </td>
<td style="border: 1px solid black;">(9.3–31.8) </td>
</tr>
<tr>
<td style="border: 1px solid black;">NK1r-lacking (n = 20) </td>
<td style="border: 1px solid black;">79.9 </td>
<td style="border: 1px solid black;">31.6 </td>
<td style="border: 1px solid black;">0.2 </td>
<td style="border: 1px solid black;">0.1 </td>
<td style="border: 1px solid black;">7.5 </td>
<td style="border: 1px solid black;">3.1 </td>
<td style="border: 1px solid black;">26.5 </td>
<td style="border: 1px solid black;">9.7 </td>
</tr>
</table>
</body>
</html>
|
package com.cardpay.pccredit.intopieces.model;
import com.wicresoft.jrad.base.database.id.IDType;
import com.wicresoft.jrad.base.database.model.BusinessModel;
import com.wicresoft.jrad.base.database.model.ModelParam;
@ModelParam(table = "<API key>", generator=IDType.assigned)
public class <API key> extends BusinessModel {
private static final long serialVersionUID = -<API key>;
private String sqId;
private String status;
private String sqFlowId;
private String serialNumber;
private String zbUser;
public String getSqId() {
return sqId;
}
public void setSqId(String sqId) {
this.sqId = sqId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSqFlowId() {
return sqFlowId;
}
public void setSqFlowId(String sqFlowId) {
this.sqFlowId = sqFlowId;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getZbUser() {
return zbUser;
}
public void setZbUser(String zbUser) {
this.zbUser = zbUser;
}
}
|
#include <aws/opsworks/model/AssignVolumeRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::OpsWorks::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
AssignVolumeRequest::AssignVolumeRequest() :
<API key>(false),
<API key>(false)
{
}
Aws::String AssignVolumeRequest::SerializePayload() const
{
JsonValue payload;
if(<API key>)
{
payload.WithString("VolumeId", m_volumeId);
}
if(<API key>)
{
payload.WithString("InstanceId", m_instanceId);
}
return payload.View().WriteReadable();
}
Aws::Http::<API key> AssignVolumeRequest::<API key>() const
{
Aws::Http::<API key> headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "OpsWorks_20130218.AssignVolume"));
return headers;
}
|
<?php
return array (
'<strong>Delete</strong> space' => '<strong>Space</strong> löschen',
'Are you sure, that you want to delete this space? All published content will be removed!' => 'Bist Du sicher, dass du diesen Space löschen möchtest? Alle veröffentlichten Inhalte werden entfernt!',
'Delete' => 'Löschen',
'Please provide your password to continue!' => 'Bitte gib dein Passwort ein, um fortzufahren!',
);
|
module.exports = function (config) {
'use strict';
config.set({
basePath: '../../',
captureTimeout: 3e5,
<API key>: 3e5,
<API key>: 3e5,
<API key>: 3,
concurrency: 1,
urlRoot: '/karma',
frameworks: ['mocha', 'chai', 'sinon'],
files: [
'./dist/preview release/earcut.min.js',
'./Tools/DevLoader/BabylonLoader.js',
'./tests/validation/index.css',
'./tests/validation/integration.js',
'./favicon.ico',
{ pattern: 'dist*', watched: false, included: false, served: true },
{ pattern: 'assets*', watched: false, included: false, served: true },
{ pattern: 'tests*', watched: false, included: false, served: true },
{ pattern: 'Playground/scenes*', watched: false, included: false, served: true },
{ pattern: 'Playground/textures*', watched: false, included: false, served: true },
{ pattern: 'Playground/sounds*', watched: false, included: false, served: true },
{ pattern: 'Tools/Config/config.json', watched: false, included: false, served: true },
],
proxies: {
'/': '/base/'
},
port: 1338,
colors: true,
autoWatch: false,
singleRun: false,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
browserStack: {
project: 'Babylon JS Validation Tests',
video: false,
debug: 'true',
timeout: 1200,
build: process.env.TRAVIS_BUILD_NUMBER,
username: process.env.<API key>,
accessKey: process.env.<API key>
},
customLaunchers: {
bs_chrome_win: {
base: 'BrowserStack',
browser: 'Chrome',
browser_version: '63.0',
os: 'Windows',
os_version: '10'
},
bs_edge_win: {
base: 'BrowserStack',
browser: 'Edge',
browser_version: '16.0',
os: 'Windows',
os_version: '10'
},
bs_firefox_win: {
base: 'BrowserStack',
browser: 'Firefox',
browser_version: '57.0',
os: 'Windows',
os_version: '10'
},
bs_chrome_android: {
base: 'BrowserStack',
os: 'Android',
os_version: '8.0',
device: 'Google Pixel',
real_mobile: 'true'
},
bs_safari_ios: {
base: 'BrowserStack',
os: 'ios',
os_version: '10.3',
device: 'iPhone 7',
real_mobile: 'true'
}
},
browsers: ['bs_chrome_android'],
reporters: ['dots', 'BrowserStack'],
singleRun: true
});
};
|
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(<API key>)]
#![allow(non_snake_case)]
extern crate libc;
pub const SOL_PACKET: libc::c_int = 263;
pub const <API key>: libc::c_int = 1;
pub const PACKET_MR_PROMISC: libc::c_int = 1;
// man 7 packet
pub struct packet_mreq {
pub mr_ifindex: libc::c_int,
pub mr_type: libc::c_ushort,
pub mr_alen: libc::c_ushort,
pub mr_address: [libc::c_uchar; 8]
}
|
$.components.register("input-group-file", {
api: function() {
$(document).on("change", ".input-group-file [type=file]", function() {
var $this = $(this);
var $text = $(this).parents('.input-group-file').find('.form-control');
var value = "";
$.each($this[0].files, function(i, file) {
value += file.name + ", ";
});
value = value.substring(0, value.length - 2);
$text.val(value);
});
}
});
|
<!DOCTYPE html>
<html>
<head>
<title>Collection Demo</title>
<script src="../bin/traceur.js"></script>
<script src="../src/bootstrap.js"></script>
</head>
<body>
<p>This example shows how to use element set/get/delete meta operations.
<pre id="out"></pre>
<script>
traceur.options.experimental = true;
</script>
<script type="text/traceur">
function print(s) {
var out = document.getElementById('out');
out.appendChild(document.createTextNode(`${s}\n`));
}
function assertEquals(expected, actual) {
if (expected === actual)
print(`PASS: ${actual}`);
else
print(`FAIL: Expected ${expected}, got ${actual}`);
}
import {elementGet, elementSet, elementDelete, Name} from '@name';
import iterator from '@iter';
var storageName = new Name();
var sizeName = new Name();
var {setProperty, getProperty} = Object;
function getStorage(self) {
return getProperty(self, storageName);
}
function StringMap() {
// Can't use this[storageName] internally because it will invoke the
// traps.
setProperty(this, storageName, Object.create(null));
setProperty(this, sizeName, 0);
}
StringMap.prototype = {
get size() {
return getProperty(this, sizeName);
},
has(name) {
return name in getStorage(this);
},
*keys() {
var storage = getStorage(this);
for (var name in storage) {
yield name;
}
},
*values() {
var storage = getStorage(this);
for (var name in storage) {
yield storage[name];
}
},
*entries() {
var storage = getStorage(this);
for (var name in storage) {
yield [name, storage[name]];
}
}
};
// Traceur does not yet support [] keys in object/class literals.
StringMap.prototype[iterator] = StringMap.prototype.entries;
StringMap.prototype[elementGet] = function(name) {
return getStorage(this)[name];
};
StringMap.prototype[elementDelete] = function(name) {
if (!this.has(name))
return false;
delete getStorage(this)[name];
setProperty(this, sizeName, getProperty(this, sizeName) - 1);
return true;
};
StringMap.prototype[elementSet] = function(name, value) {
if (!this.has(name))
setProperty(this, sizeName, getProperty(this, sizeName) + 1);
getStorage(this)[name] = value;
};
var map = new StringMap;
map['a'] = 1;
assertEquals(1, map['a']);
assertEquals(undefined, map.a);
assertEquals(1, map.size);
map['b'] = 2;
assertEquals(2, map['b']);
assertEquals(2, map.size);
assertEquals(false, map.has('size'));
map['size'] = 'Hello World';
assertEquals('Hello World', map['size']);
assertEquals(3, map.size);
delete map['b'];
assertEquals(undefined, map['b']);
assertEquals(2, map.size);
print('\nTesting iteration');
for (var key of map.keys()) {
print(key);
}
for (var value of map.values()) {
print(value);
}
for (var [key, value] of map.entries()) {
print(`${key} = ${value}`);
}
for (var [key, value] of map) {
print(`${key} = ${value}`);
}
</script>
</body>
</html>
|
<?php
namespace Cake\View\Helper;
use Cake\Utility\Hash;
use Cake\Utility\Inflector;
use Cake\View\Helper;
use Cake\View\StringTemplateTrait;
use Cake\View\View;
class PaginatorHelper extends Helper
{
use StringTemplateTrait;
/**
* List of helpers used by this helper
*
* @var array
*/
public $helpers = ['Url', 'Number', 'Html'];
/**
* Default config for this class
*
* Options: Holds the default options for pagination links
*
* The values that may be specified are:
*
* - `url` Url of the action. See Router::url()
* - `url['sort']` the key that the recordset is sorted.
* - `url['direction']` Direction of the sorting (default: 'asc').
* - `url['page']` Page number to use in links.
* - `model` The name of the model.
* - `escape` Defines if the title field for the link should be escaped (default: true).
*
* Templates: the templates used by this class
*
* @var array
*/
protected $_defaultConfig = [
'options' => [],
'templates' => [
'nextActive' => '<li class="next"><a rel="next" href="{{url}}">{{text}}</a></li>',
'nextDisabled' => '<li class="next disabled"><a href="" onclick="return false;">{{text}}</a></li>',
'prevActive' => '<li class="prev"><a rel="prev" href="{{url}}">{{text}}</a></li>',
'prevDisabled' => '<li class="prev disabled"><a href="" onclick="return false;">{{text}}</a></li>',
'counterRange' => '{{start}} - {{end}} of {{count}}',
'counterPages' => '{{page}} of {{pages}}',
'first' => '<li class="first"><a href="{{url}}">{{text}}</a></li>',
'last' => '<li class="last"><a href="{{url}}">{{text}}</a></li>',
'number' => '<li><a href="{{url}}">{{text}}</a></li>',
'current' => '<li class="active"><a href="">{{text}}</a></li>',
'ellipsis' => '<li class="ellipsis">...</li>',
'sort' => '<a href="{{url}}">{{text}}</a>',
'sortAsc' => '<a class="asc" href="{{url}}">{{text}}</a>',
'sortDesc' => '<a class="desc" href="{{url}}">{{text}}</a>',
'sortAscLocked' => '<a class="asc locked" href="{{url}}">{{text}}</a>',
'sortDescLocked' => '<a class="desc locked" href="{{url}}">{{text}}</a>',
]
];
/**
* Default model of the paged sets
*
* @var string
*/
protected $_defaultModel;
/**
* Constructor. Overridden to merge passed args with URL options.
*
* @param \Cake\View\View $View The View this helper is being attached to.
* @param array $config Configuration settings for the helper.
*/
public function __construct(View $View, array $config = [])
{
parent::__construct($View, $config);
$query = $this->request->query;
unset($query['page'], $query['limit'], $query['sort'], $query['direction']);
$this->config(
'options.url',
array_merge($this->request->params['pass'], ['?' => $query])
);
}
/**
* Gets the current paging parameters from the resultset for the given model
*
* @param string|null $model Optional model name. Uses the default if none is specified.
* @return array The array of paging parameters for the paginated resultset.
*/
public function params($model = null)
{
if (empty($model)) {
$model = $this->defaultModel();
}
if (!isset($this->request->params['paging']) || empty($this->request->params['paging'][$model])) {
return [];
}
return $this->request->params['paging'][$model];
}
/**
* Convenience access to any of the paginator params.
*
* @param string $key Key of the paginator params array to retrieve.
* @param string|null $model Optional model name. Uses the default if none is specified.
* @return mixed Content of the requested param.
*/
public function param($key, $model = null)
{
$params = $this->params($model);
if (!isset($params[$key])) {
return null;
}
return $params[$key];
}
/**
* Sets default options for all pagination links
*
* @param array $options Default options for pagination links.
* See PaginatorHelper::$options for list of keys.
* @return void
*/
public function options(array $options = [])
{
if (!empty($options['paging'])) {
if (!isset($this->request->params['paging'])) {
$this->request->params['paging'] = [];
}
$this->request->params['paging'] = $options['paging'] + $this->request->params['paging'];
unset($options['paging']);
}
$model = $this->defaultModel();
if (!empty($options[$model])) {
if (!isset($this->request->params['paging'][$model])) {
$this->request->params['paging'][$model] = [];
}
$this->request->params['paging'][$model] = $options[$model] + $this->request->params['paging'][$model];
unset($options[$model]);
}
$this->_config['options'] = array_filter($options + $this->_config['options']);
if (empty($this->_config['options']['url'])) {
$this->_config['options']['url'] = [];
}
if (!empty($this->_config['options']['model'])) {
$this->defaultModel($this->_config['options']['model']);
}
}
public function current($model = null)
{
$params = $this->params($model);
if (isset($params['page'])) {
return $params['page'];
}
return 1;
}
public function sortKey($model = null, array $options = [])
{
if (empty($options)) {
$options = $this->params($model);
}
if (!empty($options['sort'])) {
return $options['sort'];
}
return null;
}
public function sortDir($model = null, array $options = [])
{
$dir = null;
if (empty($options)) {
$options = $this->params($model);
}
if (isset($options['direction'])) {
$dir = strtolower($options['direction']);
}
if ($dir === 'desc') {
return 'desc';
}
return 'asc';
}
/**
* Generate an active/inactive link for next/prev methods.
*
* @param string|bool $text The enabled text for the link.
* @param bool $enabled Whether or not the enabled/disabled version should be created.
* @param array $options An array of options from the calling method.
* @param array $templates An array of templates with the 'active' and 'disabled' keys.
* @return string Generated HTML
*/
protected function _toggledLink($text, $enabled, $options, $templates)
{
$template = $templates['active'];
if (!$enabled) {
$text = $options['disabledTitle'];
$template = $templates['disabled'];
}
if (!$enabled && $text === false) {
return '';
}
$text = $options['escape'] ? h($text) : $text;
$templater = $this->templater();
$newTemplates = !empty($options['templates']) ? $options['templates'] : false;
if ($newTemplates) {
$templater->push();
$templateMethod = is_string($options['templates']) ? 'load' : 'add';
$templater->{$templateMethod}($options['templates']);
}
if (!$enabled) {
$out = $templater->format($template, [
'text' => $text,
]);
if ($newTemplates) {
$templater->pop();
}
return $out;
}
$paging = $this->params($options['model']);
$url = array_merge(
$options['url'],
['page' => $paging['page'] + $options['step']]
);
$url = $this->generateUrl($url, $options['model']);
$out = $templater->format($template, [
'url' => $url,
'text' => $text,
]);
if ($newTemplates) {
$templater->pop();
}
return $out;
}
public function prev($title = '<< Previous', array $options = [])
{
$defaults = [
'url' => [],
'model' => $this->defaultModel(),
'disabledTitle' => $title,
'escape' => true,
];
$options += $defaults;
$options['step'] = -1;
$enabled = $this->hasPrev($options['model']);
$templates = [
'active' => 'prevActive',
'disabled' => 'prevDisabled'
];
return $this->_toggledLink($title, $enabled, $options, $templates);
}
public function next($title = 'Next >>', array $options = [])
{
$defaults = [
'url' => [],
'model' => $this->defaultModel(),
'disabledTitle' => $title,
'escape' => true,
];
$options += $defaults;
$options['step'] = 1;
$enabled = $this->hasNext($options['model']);
$templates = [
'active' => 'nextActive',
'disabled' => 'nextDisabled'
];
return $this->_toggledLink($title, $enabled, $options, $templates);
}
public function sort($key, $title = null, array $options = [])
{
$options += ['url' => [], 'model' => null, 'escape' => true];
$url = $options['url'];
unset($options['url']);
if (empty($title)) {
$title = $key;
if (strpos($title, '.') !== false) {
$title = str_replace('.', ' ', $title);
}
$title = __(Inflector::humanize(preg_replace('/_id$/', '', $title)));
}
$defaultDir = isset($options['direction']) ? strtolower($options['direction']) : 'asc';
unset($options['direction']);
$locked = isset($options['lock']) ? $options['lock'] : false;
unset($options['lock']);
$sortKey = $this->sortKey($options['model']);
$defaultModel = $this->defaultModel();
$model = $options['model'] ?: $defaultModel;
list($table, $field) = explode('.', $key . '.');
if (!$field) {
$field = $table;
$table = $model;
}
$isSorted = (
$sortKey === $table . '.' . $field ||
$sortKey === $defaultModel . '.' . $key ||
$table . '.' . $field === $defaultModel . '.' . $sortKey
);
$template = 'sort';
$dir = $defaultDir;
if ($isSorted) {
if ($locked) {
$template = $dir === 'asc' ? 'sortDescLocked' : 'sortAscLocked';
} else {
$dir = $this->sortDir($options['model']) === 'asc' ? 'desc' : 'asc';
$template = $dir === 'asc' ? 'sortDesc' : 'sortAsc';
}
}
if (is_array($title) && array_key_exists($dir, $title)) {
$title = $title[$dir];
}
$url = array_merge(
['sort' => $key, 'direction' => $dir],
$url,
['order' => null]
);
$vars = [
'text' => $options['escape'] ? h($title) : $title,
'url' => $this->generateUrl($url, $options['model']),
];
return $this->templater()->format($template, $vars);
}
public function generateUrl(array $options = [], $model = null, $full = false)
{
$paging = $this->params($model);
$paging += ['page' => null, 'sort' => null, 'direction' => null, 'limit' => null];
$url = [
'page' => $paging['page'],
'limit' => $paging['limit'],
'sort' => $paging['sort'],
'direction' => $paging['direction'],
];
if (!empty($this->_config['options']['url'])) {
$key = implode('.', array_filter(['options.url', Hash::get($paging, 'scope', null)]));
$url = array_merge($url, Hash::get($this->_config, $key, []));
}
$url = array_filter($url, function ($value) {
return ($value || is_numeric($value));
});
$url = array_merge($url, $options);
if (!empty($url['page']) && $url['page'] == 1) {
$url['page'] = false;
}
if (isset($paging['sortDefault'], $paging['directionDefault'], $url['sort'], $url['direction']) &&
$url['sort'] === $paging['sortDefault'] &&
$url['direction'] === $paging['directionDefault']
) {
$url['sort'] = $url['direction'] = null;
}
if (!empty($paging['scope'])) {
$scope = $paging['scope'];
$currentParams = $this->_config['options']['url'];
// Merge existing query parameters in the scope.
if (isset($currentParams['?'][$scope]) && is_array($currentParams['?'][$scope])) {
$url += $currentParams['?'][$scope];
unset($currentParams['?'][$scope]);
}
$url = [$scope => $url] + $currentParams;
if (empty($url[$scope]['page'])) {
unset($url[$scope]['page']);
}
}
return $this->Url->build($url, $full);
}
public function hasPrev($model = null)
{
return $this->_hasPage($model, 'prev');
}
public function hasNext($model = null)
{
return $this->_hasPage($model, 'next');
}
public function hasPage($model = null, $page = 1)
{
if (is_numeric($model)) {
$page = $model;
$model = null;
}
$paging = $this->params($model);
if ($paging === []) {
return false;
}
return $page <= $paging['pageCount'];
}
/**
* Does $model have $page in its range?
*
* @param string $model Model name to get parameters for.
* @param int $page Page number you are checking.
* @return bool Whether model has $page
*/
protected function _hasPage($model, $page)
{
$params = $this->params($model);
return !empty($params) && $params[$page . 'Page'];
}
/**
* Gets or sets the default model of the paged sets
*
* @param string|null $model Model name to set
* @return string|null Model name or null if the pagination isn't initialized.
*/
public function defaultModel($model = null)
{
if ($model !== null) {
$this->_defaultModel = $model;
}
if ($this->_defaultModel) {
return $this->_defaultModel;
}
if (empty($this->request->params['paging'])) {
return null;
}
list($this->_defaultModel) = array_keys($this->request->params['paging']);
return $this->_defaultModel;
}
public function counter($options = [])
{
if (is_string($options)) {
$options = ['format' => $options];
}
$options += [
'model' => $this->defaultModel(),
'format' => 'pages',
];
$paging = $this->params($options['model']);
if (!$paging['pageCount']) {
$paging['pageCount'] = 1;
}
$start = 0;
if ($paging['count'] >= 1) {
$start = (($paging['page'] - 1) * $paging['perPage']) + 1;
}
$end = $start + $paging['perPage'] - 1;
if ($paging['count'] < $end) {
$end = $paging['count'];
}
switch ($options['format']) {
case 'range':
case 'pages':
$template = 'counter' . ucfirst($options['format']);
break;
default:
$template = 'counterCustom';
$this->templater()->add([$template => $options['format']]);
}
$map = array_map([$this->Number, 'format'], [
'page' => $paging['page'],
'pages' => $paging['pageCount'],
'current' => $paging['current'],
'count' => $paging['count'],
'start' => $start,
'end' => $end
]);
$map += [
'model' => strtolower(Inflector::humanize(Inflector::tableize($options['model'])))
];
return $this->templater()->format($template, $map);
}
public function numbers(array $options = [])
{
$defaults = [
'before' => null, 'after' => null, 'model' => $this->defaultModel(),
'modulus' => 8, 'first' => null, 'last' => null, 'url' => []
];
$options += $defaults;
$params = (array)$this->params($options['model']) + ['page' => 1];
if ($params['pageCount'] <= 1) {
return false;
}
$templater = $this->templater();
if (isset($options['templates'])) {
$templater->push();
$method = is_string($options['templates']) ? 'load' : 'add';
$templater->{$method}($options['templates']);
}
if ($options['modulus'] !== false && $params['pageCount'] > $options['modulus']) {
$out = $this->_modulusNumbers($templater, $params, $options);
} else {
$out = $this->_numbers($templater, $params, $options);
}
if (isset($options['templates'])) {
$templater->pop();
}
return $out;
}
/**
* Calculates the start and end for the pagination numbers.
*
* @param array $params Params from the numbers() method.
* @param array $options Options from the numbers() method.
* @return array An array with the start and end numbers.
*/
protected function <API key>($params, $options)
{
$half = (int)($options['modulus'] / 2);
$end = $params['page'] + $half;
if ($end > $params['pageCount']) {
$end = $params['pageCount'];
}
$start = $params['page'] - ($options['modulus'] - ($end - $params['page']));
if ($start <= 1) {
$start = 1;
$end = $params['page'] + ($options['modulus'] - $params['page']) + 1;
}
return [$start, $end];
}
/**
* Formats a number for the paginator number output.
*
* @param \Cake\View\StringTemplate $templater StringTemplate instance.
* @param array $options Options from the numbers() method.
* @return string
*/
protected function _formatNumber($templater, $options)
{
$url = array_merge($options['url'], ['page' => $options['page']]);
$vars = [
'text' => $options['text'],
'url' => $this->generateUrl($url, $options['model']),
];
return $templater->format('number', $vars);
}
/**
* Generates the numbers for the paginator numbers() method.
*
* @param \Cake\View\StringTemplate $templater StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param array $options Options from the numbers() method.
* @return string Markup output.
*/
protected function _modulusNumbers($templater, $params, $options)
{
$out = '';
$ellipsis = $templater->format('ellipsis', []);
list($start, $end) = $this-><API key>($params, $options);
$out .= $this->_firstNumber($ellipsis, $params, $start, $options);
$out .= $options['before'];
for ($i = $start; $i < $params['page']; $i++) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'page' => $i,
'model' => $options['model'],
'url' => $options['url'],
]);
}
$url = array_merge($options['url'], ['page' => $params['page']]);
$out .= $templater->format('current', [
'text' => $params['page'],
'url' => $this->generateUrl($url, $options['model']),
]);
$start = $params['page'] + 1;
for ($i = $start; $i < $end; $i++) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'page' => $i,
'model' => $options['model'],
'url' => $options['url'],
]);
}
if ($end != $params['page']) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'page' => $end,
'model' => $options['model'],
'url' => $options['url'],
]);
}
$out .= $options['after'];
$out .= $this->_lastNumber($ellipsis, $params, $end, $options);
return $out;
}
/**
* Generates the first number for the paginator numbers() method.
*
* @param \Cake\View\StringTemplate $ellipsis StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param int $start Start number.
* @param array $options Options from the numbers() method.
* @return string Markup output.
*/
protected function _firstNumber($ellipsis, $params, $start, $options)
{
$out = '';
$first = is_int($options['first']) ? $options['first'] : 0;
if ($options['first'] && $start > 1) {
$offset = ($start <= $first) ? $start - 1 : $options['first'];
$out .= $this->first($offset, $options);
if ($first < $start - 1) {
$out .= $ellipsis;
}
}
return $out;
}
/**
* Generates the last number for the paginator numbers() method.
*
* @param \Cake\View\StringTemplate $ellipsis StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param int $end End number.
* @param array $options Options from the numbers() method.
* @return string Markup output.
*/
protected function _lastNumber($ellipsis, $params, $end, $options)
{
$out = '';
$last = is_int($options['last']) ? $options['last'] : 0;
if ($options['last'] && $end < $params['pageCount']) {
$offset = ($params['pageCount'] < $end + $last) ? $params['pageCount'] - $end : $options['last'];
if ($offset <= $options['last'] && $params['pageCount'] - $end > $last) {
$out .= $ellipsis;
}
$out .= $this->last($offset, $options);
}
return $out;
}
/**
* Generates the numbers for the paginator numbers() method.
*
* @param \Cake\View\StringTemplate $templater StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param array $options Options from the numbers() method.
* @return string Markup output.
*/
protected function _numbers($templater, $params, $options)
{
$out = '';
$out .= $options['before'];
for ($i = 1; $i <= $params['pageCount']; $i++) {
$url = array_merge($options['url'], ['page' => $i]);
if ($i == $params['page']) {
$out .= $templater->format('current', [
'text' => $params['page'],
'url' => $this->generateUrl($url, $options['model']),
]);
} else {
$vars = [
'text' => $i,
'url' => $this->generateUrl($url, $options['model']),
];
$out .= $templater->format('number', $vars);
}
}
$out .= $options['after'];
return $out;
}
public function first($first = '<< first', array $options = [])
{
$options += [
'url' => [],
'model' => $this->defaultModel(),
'escape' => true
];
$params = $this->params($options['model']);
if ($params['pageCount'] <= 1) {
return false;
}
$out = '';
if (is_int($first) && $params['page'] >= $first) {
for ($i = 1; $i <= $first; $i++) {
$url = array_merge($options['url'], ['page' => $i]);
$out .= $this->templater()->format('number', [
'url' => $this->generateUrl($url, $options['model']),
'text' => $i
]);
}
} elseif ($params['page'] > 1 && is_string($first)) {
$first = $options['escape'] ? h($first) : $first;
$out .= $this->templater()->format('first', [
'url' => $this->generateUrl(['page' => 1], $options['model']),
'text' => $first
]);
}
return $out;
}
public function last($last = 'last >>', array $options = [])
{
$options += [
'model' => $this->defaultModel(),
'escape' => true,
'url' => []
];
$params = $this->params($options['model']);
if ($params['pageCount'] <= 1) {
return false;
}
$out = '';
$lower = (int)$params['pageCount'] - (int)$last + 1;
if (is_int($last) && $params['page'] <= $lower) {
for ($i = $lower; $i <= $params['pageCount']; $i++) {
$url = array_merge($options['url'], ['page' => $i]);
$out .= $this->templater()->format('number', [
'url' => $this->generateUrl($url, $options['model']),
'text' => $i
]);
}
} elseif ($params['page'] < $params['pageCount'] && is_string($last)) {
$last = $options['escape'] ? h($last) : $last;
$out .= $this->templater()->format('last', [
'url' => $this->generateUrl(['page' => $params['pageCount']], $options['model']),
'text' => $last
]);
}
return $out;
}
public function meta(array $options = [])
{
$model = isset($options['model']) ? $options['model'] : null;
$params = $this->params($model);
$links = [];
if ($this->hasPrev()) {
$links[] = $this->Html->templater()->format('css', [
'rel' => 'prev',
'url' => $this->generateUrl(['page' => $params['page'] - 1], null, true)
]);
}
if ($this->hasNext()) {
$links[] = $this->Html->templater()->format('css', [
'rel' => 'next',
'url' => $this->generateUrl(['page' => $params['page'] + 1], null, true)
]);
}
$out = implode($links);
if (empty($options['block'])) {
return $out;
}
if ($options['block'] === true) {
$options['block'] = __FUNCTION__;
}
$this->_View->append($options['block'], $out);
}
/**
* Event listeners.
*
* @return array
*/
public function implementedEvents()
{
return [];
}
}
|
import {
AsyncTestCompleter,
beforeEach,
ddescribe,
describe,
expect,
iit,
inject,
it,
xit,
} from 'angular2/test_lib';
import {Injector, bind, Key} from 'angular2/di';
import {Inject, InjectPromise} from 'angular2/src/di/annotations_impl';
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
class UserList {
}
function fetchUsers() {
return PromiseWrapper.resolve(new UserList());
}
class SynchronousUserList {
}
class UserController {
list:UserList;
constructor(list:UserList) {
this.list = list;
}
}
class AsyncUserController {
userList;
constructor(@InjectPromise(UserList) userList) {
this.userList = userList;
}
}
export function main() {
describe("async injection", function () {
describe("asyncGet", function () {
it('should return a promise', function () {
var injector = Injector.resolveAndCreate([
bind(UserList).toAsyncFactory(fetchUsers)
]);
var p = injector.asyncGet(UserList);
expect(p).toBePromise();
});
it('should return a promise when the binding is sync', function () {
var injector = Injector.resolveAndCreate([
SynchronousUserList
]);
var p = injector.asyncGet(SynchronousUserList);
expect(p).toBePromise();
});
it("should return a promise when the binding is sync (from cache)", function () {
var injector = Injector.resolveAndCreate([
UserList
]);
expect(injector.get(UserList)).toBeAnInstanceOf(UserList);
expect(injector.asyncGet(UserList)).toBePromise();
});
it('should return the injector', inject([AsyncTestCompleter], (async) => {
var injector = Injector.resolveAndCreate([]);
var p = injector.asyncGet(Injector);
p.then(function (injector) {
expect(injector).toBe(injector);
async.done();
});
}));
it('should return a promise when instantiating a sync binding ' +
'with an async dependency', inject([AsyncTestCompleter], (async) => {
var injector = Injector.resolveAndCreate([
bind(UserList).toAsyncFactory(fetchUsers),
UserController
]);
injector.asyncGet(UserController).then(function (userController) {
expect(userController).toBeAnInstanceOf(UserController);
expect(userController.list).toBeAnInstanceOf(UserList);
async.done();
});
}));
it("should create only one instance (async + async)", inject([AsyncTestCompleter], (async) => {
var injector = Injector.resolveAndCreate([
bind(UserList).toAsyncFactory(fetchUsers)
]);
var ul1 = injector.asyncGet(UserList);
var ul2 = injector.asyncGet(UserList);
PromiseWrapper.all([ul1, ul2]).then(function (uls) {
expect(uls[0]).toBe(uls[1]);
async.done();
});
}));
it("should create only one instance (sync + async)", inject([AsyncTestCompleter], (async) => {
var injector = Injector.resolveAndCreate([
UserList
]);
var promise = injector.asyncGet(UserList);
var ul = injector.get(UserList);
expect(promise).toBePromise();
expect(ul).toBeAnInstanceOf(UserList);
promise.then(function (ful) {
expect(ful).toBe(ul);
async.done();
});
}));
it('should show the full path when error happens in a constructor', inject([AsyncTestCompleter], (async) => {
var injector = Injector.resolveAndCreate([
UserController,
bind(UserList).toAsyncFactory(function () {
throw "Broken UserList";
})
]);
var promise = injector.asyncGet(UserController);
PromiseWrapper.then(promise, null, function (e) {
expect(e.message).toContain("Error during instantiation of UserList! (UserController -> UserList)");
async.done();
});
}));
});
describe("get", function () {
it('should throw when instantiating an async binding', function () {
var injector = Injector.resolveAndCreate([
bind(UserList).toAsyncFactory(fetchUsers)
]);
expect(() => injector.get(UserList))
.toThrowError('Cannot instantiate UserList synchronously. It is provided as a promise!');
});
it('should throw when instantiating a sync binding with an async dependency', function () {
var injector = Injector.resolveAndCreate([
bind(UserList).toAsyncFactory(fetchUsers),
UserController
]);
expect(() => injector.get(UserController))
.toThrowError('Cannot instantiate UserList synchronously. It is provided as a promise! (UserController -> UserList)');
});
it('should not throw when instantiating a sync binding with a resolved async dependency',
inject([AsyncTestCompleter], (async) => {
var injector = Injector.resolveAndCreate([
bind(UserList).toAsyncFactory(fetchUsers),
UserController
]);
injector.asyncGet(UserList).then((_) => {
expect(() => { injector.get(UserController); }).not.toThrow();
async.done();
});
}));
it('should resolve synchronously when an async dependency requested as a promise', function () {
var injector = Injector.resolveAndCreate([
bind(UserList).toAsyncFactory(fetchUsers),
AsyncUserController
]);
var controller = injector.get(AsyncUserController);
expect(controller).toBeAnInstanceOf(AsyncUserController);
expect(controller.userList).toBePromise();
});
it('should wrap sync dependencies into promises if required', function () {
var injector = Injector.resolveAndCreate([
bind(UserList).toFactory(() => new UserList()),
AsyncUserController
]);
var controller = injector.get(AsyncUserController);
expect(controller).toBeAnInstanceOf(AsyncUserController);
expect(controller.userList).toBePromise();
});
});
});
}
|
package strategy
import (
"errors"
"fmt"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/golang/glog"
buildapi "github.com/openshift/origin/pkg/build/api"
buildutil "github.com/openshift/origin/pkg/build/util"
)
// CustomBuildStrategy creates a build using a custom builder image.
type CustomBuildStrategy struct {
// Codec is the codec to use for encoding the output pod.
// IMPORTANT: This may break backwards compatibility when
// it changes.
Codec runtime.Codec
}
// CreateBuildPod creates the pod to be used for the Custom build
func (bs *CustomBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod, error) {
data, err := bs.Codec.Encode(build)
if err != nil {
return nil, fmt.Errorf("failed to encode the build: %v", err)
}
strategy := build.Parameters.Strategy.CustomStrategy
containerEnv := []kapi.EnvVar{{Name: "BUILD", Value: string(data)}}
if build.Parameters.Source.Git != nil {
containerEnv = append(containerEnv, kapi.EnvVar{
Name: "SOURCE_REPOSITORY", Value: build.Parameters.Source.Git.URI,
})
}
if strategy == nil || strategy.From == nil || len(strategy.From.Name) == 0 {
return nil, errors.New("CustomBuildStrategy cannot be executed without image")
}
if len(strategy.Env) > 0 {
containerEnv = append(containerEnv, strategy.Env...)
}
if strategy.ExposeDockerSocket {
glog.V(2).Infof("ExposeDockerSocket is enabled for %s build", build.Name)
containerEnv = append(containerEnv, kapi.EnvVar{Name: "DOCKER_SOCKET", Value: dockerSocketPath})
}
privileged := true
pod := &kapi.Pod{
ObjectMeta: kapi.ObjectMeta{
Name: buildutil.GetBuildPodName(build),
Namespace: build.Namespace,
Labels: getPodLabels(build),
},
Spec: kapi.PodSpec{
ServiceAccount: build.Parameters.ServiceAccount,
Containers: []kapi.Container{
{
Name: "custom-build",
Image: strategy.From.Name,
Env: containerEnv,
SecurityContext: &kapi.SecurityContext{
Privileged: &privileged,
},
},
},
RestartPolicy: kapi.RestartPolicyNever,
},
}
if err := setupBuildEnv(build, pod); err != nil {
return nil, err
}
pod.Spec.Containers[0].ImagePullPolicy = kapi.PullIfNotPresent
pod.Spec.Containers[0].Resources = build.Parameters.Resources
if strategy.ExposeDockerSocket {
setupDockerSocket(pod)
setupDockerSecrets(pod, build.Parameters.Output.PushSecret, strategy.PullSecret)
}
setupSourceSecrets(pod, build.Parameters.Source.SourceSecret)
return pod, nil
}
|
package org.glassfish.mvc.bookstore.controller.util;
public class PagingInfo {
private int batchSize = 5;
private int firstItem = 0;
private int itemCount = -1;
public int getBatchSize() {
return batchSize;
}
public int getItemCount() {
return itemCount;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount;
}
public int getFirstItem() {
if (itemCount == -1) {
throw new <API key>("itemCount must be set before invoking getFirstItem method");
}
if (firstItem >= itemCount) {
if (itemCount == 0) {
firstItem = 0;
} else {
int zeroBasedItemCount = itemCount - 1;
double pageDouble = zeroBasedItemCount / batchSize;
int page = (int) Math.floor(pageDouble);
firstItem = page * batchSize;
}
}
return firstItem;
}
public void setFirstItem(int firstItem) {
this.firstItem = firstItem;
}
public int getLastItem() {
getFirstItem();
return firstItem + batchSize > itemCount ? itemCount : firstItem + batchSize;
}
public void nextPage() {
getFirstItem();
if (firstItem + batchSize < itemCount) {
firstItem += batchSize;
}
}
public void previousPage() {
getFirstItem();
firstItem -= batchSize;
if (firstItem < 0) {
firstItem = 0;
}
}
}
|
// The LLVM Compiler Infrastructure
// This file is distributed under the University of Illinois Open Source
// This is an extremely simple MachineInstr-level copy propagation pass.
#include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
using namespace llvm;
#define DEBUG_TYPE "codegen-cp"
STATISTIC(NumDeletes, "Number of dead copies deleted");
namespace {
class <API key> : public MachineFunctionPass {
const TargetRegisterInfo *TRI;
const TargetInstrInfo *TII;
MachineRegisterInfo *MRI;
public:
static char ID; // Pass identification, replacement for typeid
<API key>() : MachineFunctionPass(ID) {
<API key>(*PassRegistry::getPassRegistry());
}
bool <API key>(MachineFunction &MF) override;
private:
typedef SmallVector<unsigned, 4> DestList;
typedef DenseMap<unsigned, DestList> SourceMap;
void <API key>(unsigned Reg,
SourceMap &SrcMap,
DenseMap<unsigned, MachineInstr*> &AvailCopyMap);
bool CopyPropagateBlock(MachineBasicBlock &MBB);
void removeCopy(MachineInstr *MI);
};
}
char <API key>::ID = 0;
char &llvm::<API key> = <API key>::ID;
INITIALIZE_PASS(<API key>, "machine-cp",
"Machine Copy Propagation Pass", false, false)
void
<API key>::<API key>(unsigned Reg,
SourceMap &SrcMap,
DenseMap<unsigned, MachineInstr*> &AvailCopyMap) {
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
SourceMap::iterator SI = SrcMap.find(*AI);
if (SI != SrcMap.end()) {
const DestList& Defs = SI->second;
for (DestList::const_iterator I = Defs.begin(), E = Defs.end();
I != E; ++I) {
unsigned MappedDef = *I;
// Source of copy is no longer available for propagation.
AvailCopyMap.erase(MappedDef);
for (MCSubRegIterator SR(MappedDef, TRI); SR.isValid(); ++SR)
AvailCopyMap.erase(*SR);
}
}
}
}
static bool <API key>(const MachineInstr *CopyMI,
const MachineInstr *MI) {
const MachineBasicBlock *MBB = CopyMI->getParent();
if (MI->getParent() != MBB)
return false;
MachineBasicBlock::const_iterator I = CopyMI;
MachineBasicBlock::const_iterator E = MBB->end();
MachineBasicBlock::const_iterator E2 = MI;
++I;
while (I != E && I != E2) {
if (I-><API key>() || I->isCall() ||
I->isTerminator())
return false;
++I;
}
return true;
}
isNopCopy - Return true if the specified copy is really a nop. That is
if the source of the copy is the same of the definition of the copy that
supplied the source. If the source of the copy is a sub-register than it
must check the sub-indices match. e.g.
ecx = mov eax
al = mov cl
But not
ecx = mov eax
al = mov ch
static bool isNopCopy(MachineInstr *CopyMI, unsigned Def, unsigned Src,
const TargetRegisterInfo *TRI) {
unsigned SrcSrc = CopyMI->getOperand(1).getReg();
if (Def == SrcSrc)
return true;
if (TRI->isSubRegister(SrcSrc, Def)) {
unsigned SrcDef = CopyMI->getOperand(0).getReg();
unsigned SubIdx = TRI->getSubRegIndex(SrcSrc, Def);
if (!SubIdx)
return false;
return SubIdx == TRI->getSubRegIndex(SrcDef, Src);
}
return false;
}
// Remove MI from the function because it has been determined it is dead.
// Turn it into a noop KILL instruction as opposed to removing it to
// maintain imp-use/imp-def chains.
void <API key>::removeCopy(MachineInstr *MI) {
MI->setDesc(TII->get(TargetOpcode::KILL));
}
bool <API key>::CopyPropagateBlock(MachineBasicBlock &MBB) {
SmallSetVector<MachineInstr*, 8> MaybeDeadCopies; // Candidates for deletion
DenseMap<unsigned, MachineInstr*> AvailCopyMap; // Def -> available copies map
DenseMap<unsigned, MachineInstr*> CopyMap; // Def -> copies map
SourceMap SrcMap; // Src -> Def map
DEBUG(dbgs() << "MCP: CopyPropagateBlock " << MBB.getName() << "\n");
bool Changed = false;
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); I != E; ) {
MachineInstr *MI = &*I;
++I;
if (MI->isCopy()) {
unsigned Def = MI->getOperand(0).getReg();
unsigned Src = MI->getOperand(1).getReg();
if (TargetRegisterInfo::isVirtualRegister(Def) ||
TargetRegisterInfo::isVirtualRegister(Src))
report_fatal_error("<API key> should be run after"
" register allocation!");
DenseMap<unsigned, MachineInstr*>::iterator CI = AvailCopyMap.find(Src);
if (CI != AvailCopyMap.end()) {
MachineInstr *CopyMI = CI->second;
if (!MRI->isReserved(Def) &&
(!MRI->isReserved(Src) || <API key>(CopyMI, MI)) &&
isNopCopy(CopyMI, Def, Src, TRI)) {
// The two copies cancel out and the source of the first copy
// hasn't been overridden, eliminate the second one. e.g.
// %ECX<def> = COPY %EAX<kill>
// ... nothing clobbered EAX.
// %EAX<def> = COPY %ECX
// %ECX<def> = COPY %EAX
// Also avoid eliminating a copy from reserved registers unless the
// definition is proven not clobbered. e.g.
// %RSP<def> = COPY %RAX
// CALL
// %RAX<def> = COPY %RSP
DEBUG(dbgs() << "MCP: copy is a NOP, removing: "; MI->dump());
// Clear any kills of Def between CopyMI and MI. This extends the
// live range.
for (MachineBasicBlock::iterator I = CopyMI, E = MI; I != E; ++I)
I->clearRegisterKills(Def, TRI);
removeCopy(MI);
Changed = true;
++NumDeletes;
continue;
}
}
// If Src is defined by a previous copy, it cannot be eliminated.
for (MCRegAliasIterator AI(Src, TRI, true); AI.isValid(); ++AI) {
CI = CopyMap.find(*AI);
if (CI != CopyMap.end()) {
DEBUG(dbgs() << "MCP: Copy is no longer dead: "; CI->second->dump());
MaybeDeadCopies.remove(CI->second);
}
}
DEBUG(dbgs() << "MCP: Copy is a deletion candidate: "; MI->dump());
// Copy is now a candidate for deletion.
MaybeDeadCopies.insert(MI);
// If 'Src' is previously source of another copy, then this earlier copy's
// source is no longer available. e.g.
// %xmm9<def> = copy %xmm2
// %xmm2<def> = copy %xmm0
// %xmm2<def> = copy %xmm9
<API key>(Def, SrcMap, AvailCopyMap);
// Remember Def is defined by the copy.
// ... Make sure to clear the def maps of aliases first.
for (MCRegAliasIterator AI(Def, TRI, false); AI.isValid(); ++AI) {
CopyMap.erase(*AI);
AvailCopyMap.erase(*AI);
}
for (MCSubRegIterator SR(Def, TRI, /*IncludeSelf=*/true); SR.isValid();
++SR) {
CopyMap[*SR] = MI;
AvailCopyMap[*SR] = MI;
}
// Remember source that's copied to Def. Once it's clobbered, then
// it's no longer available for copy propagation.
if (std::find(SrcMap[Src].begin(), SrcMap[Src].end(), Def) ==
SrcMap[Src].end()) {
SrcMap[Src].push_back(Def);
}
continue;
}
// Not a copy.
SmallVector<unsigned, 2> Defs;
int RegMaskOpNum = -1;
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI->getOperand(i);
if (MO.isRegMask())
RegMaskOpNum = i;
if (!MO.isReg())
continue;
unsigned Reg = MO.getReg();
if (!Reg)
continue;
if (TargetRegisterInfo::isVirtualRegister(Reg))
report_fatal_error("<API key> should be run after"
" register allocation!");
if (MO.isDef()) {
Defs.push_back(Reg);
continue;
}
// If 'Reg' is defined by a copy, the copy is no longer a candidate
// for elimination.
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
DenseMap<unsigned, MachineInstr*>::iterator CI = CopyMap.find(*AI);
if (CI != CopyMap.end()) {
DEBUG(dbgs() << "MCP: Copy is used - not dead: "; CI->second->dump());
MaybeDeadCopies.remove(CI->second);
}
}
}
// The instruction has a register mask operand which means that it clobbers
// a large set of registers. It is possible to use the register mask to
// prune the available copies, but treat it like a basic block boundary for
// now.
if (RegMaskOpNum >= 0) {
// Erase any MaybeDeadCopies whose destination register is clobbered.
const MachineOperand &MaskMO = MI->getOperand(RegMaskOpNum);
for (SmallSetVector<MachineInstr*, 8>::iterator
DI = MaybeDeadCopies.begin(), DE = MaybeDeadCopies.end();
DI != DE; ++DI) {
unsigned Reg = (*DI)->getOperand(0).getReg();
if (MRI->isReserved(Reg) || !MaskMO.clobbersPhysReg(Reg))
continue;
DEBUG(dbgs() << "MCP: Removing copy due to regmask clobbering: ";
(*DI)->dump());
removeCopy(*DI);
Changed = true;
++NumDeletes;
}
// Clear all data structures as if we were beginning a new basic block.
MaybeDeadCopies.clear();
AvailCopyMap.clear();
CopyMap.clear();
SrcMap.clear();
continue;
}
for (unsigned i = 0, e = Defs.size(); i != e; ++i) {
unsigned Reg = Defs[i];
// No longer defined by a copy.
for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
CopyMap.erase(*AI);
AvailCopyMap.erase(*AI);
}
// If 'Reg' is previously source of a copy, it is no longer available for
// copy propagation.
<API key>(Reg, SrcMap, AvailCopyMap);
}
}
// If MBB doesn't have successors, delete the copies whose defs are not used.
// If MBB does have successors, then conservative assume the defs are live-out
// since we don't want to trust live-in lists.
if (MBB.succ_empty()) {
for (SmallSetVector<MachineInstr*, 8>::iterator
DI = MaybeDeadCopies.begin(), DE = MaybeDeadCopies.end();
DI != DE; ++DI) {
if (!MRI->isReserved((*DI)->getOperand(0).getReg())) {
removeCopy(*DI);
Changed = true;
++NumDeletes;
}
}
}
return Changed;
}
bool <API key>::<API key>(MachineFunction &MF) {
if (skipOptnoneFunction(*MF.getFunction()))
return false;
bool Changed = false;
TRI = MF.getSubtarget().getRegisterInfo();
TII = MF.getSubtarget().getInstrInfo();
MRI = &MF.getRegInfo();
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
Changed |= CopyPropagateBlock(*I);
return Changed;
}
|
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-<API key>:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg?18741376#fontello') format('svg');
}
}
*/
[class^="iconf-"]:before, [class*=" iconf-"]:before {
font-family: "fontello";
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}
.iconf-down-open:before { content: '\e830'; }
.iconf-wallet:before { content: '\e82f'; }
.iconf-right-open:before { content: '\e833'; }
.iconf-up-open:before { content: '\e831'; }
.iconf-angle-left:before { content: '\e834'; }
.iconf-angle-right:before { content: '\e835'; }
.iconf-angle-up:before { content: '\e836'; }
.iconf-angle-down:before { content: '\e837'; }
.iconf-flight:before { content: '\e861'; }
.iconf-suitcase:before { content: '\e85f'; }
.iconf-road:before { content: '\e860'; }
.iconf-euro:before { content: '\e853'; }
.iconf-pound:before { content: '\e852'; }
.iconf-dollar:before { content: '\e851'; }
.iconf-rupee:before { content: '\e854'; }
.iconf-yen:before { content: '\e855'; }
.iconf-rouble:before { content: '\e856'; }
.iconf-try:before { content: '\e857'; }
.iconf-won:before { content: '\e858'; }
.iconf-bitcoin:before { content: '\e850'; }
.iconf-user:before { content: '\e864'; }
.iconf-users:before { content: '\e863'; }
.iconf-movie-frame:before { content: '\e866'; }
.iconf-videocam:before { content: '\e865'; }
.iconf-ok:before { content: '\e872'; }
.iconf-cancel:before { content: '\e873'; }
.iconf-link:before { content: '\e867'; }
.iconf-attachment:before { content: '\e868'; }
.iconf-pencil2:before { content: '\e87e'; }
.iconf-pen:before { content: '\e87f'; }
.iconf-dialogue-box:before { content: '\e874'; }
.iconf-chat-alt:before { content: '\e87d'; }
.iconf-bell:before { content: '\e875'; }
.iconf-address:before { content: '\e880'; }
.iconf-location:before { content: '\e85e'; }
.iconf-map:before { content: '\e869'; }
.<API key>:before { content: '\e862'; }
.iconf-microphone:before { content: '\e85a'; }
.iconf-clock:before { content: '\e86c'; }
.iconf-wristwatch:before { content: '\e86d'; }
.iconf-stopwatch:before { content: '\e85b'; }
.iconf-bulb:before { content: '\e85d'; }
.iconf-large-monitor:before { content: '\e879'; }
.iconf-laptop:before { content: '\e87a'; }
.iconf-tablet:before { content: '\e87b'; }
.iconf-handy:before { content: '\e87c'; }
.iconf-globe:before { content: '\e86b'; }
.iconf-sun:before { content: '\e870'; }
.iconf-moon:before { content: '\e871'; }
.iconf-plane:before { content: '\e86e'; }
.iconf-lifebuoy:before { content: '\e86f'; }
.iconf-register-key:before { content: '\e86a'; }
.iconf-wine:before { content: '\e876'; }
.iconf-coffee:before { content: '\e877'; }
.iconf-beer:before { content: '\e878'; }
.iconf-delicious:before { content: '\e846'; }
.iconf-paypal:before { content: '\e859'; }
.iconf-eventful:before { content: '\e849'; }
.iconf-gplus:before { content: '\e83c'; }
.iconf-wikipedia:before { content: '\e84d'; }
.iconf-lanyrd:before { content: '\e84a'; }
.iconf-pinterest:before { content: '\e841'; }
.iconf-digg:before { content: '\e844'; }
.iconf-dribbble:before { content: '\e84c'; }
.iconf-flickr:before { content: '\e83f'; }
.iconf-google:before { content: '\e83d'; }
.iconf-left-open:before { content: '\e832'; }
.iconf-meetup:before { content: '\e84b'; }
.iconf-rss:before { content: '\e840'; }
.iconf-skype:before { content: '\e847'; }
.iconf-twitter:before { content: '\e839'; }
.iconf-youtube:before { content: '\e83b'; }
.iconf-vimeo:before { content: '\e83a'; }
.iconf-yahoo:before { content: '\e83e'; }
.iconf-facebook:before { content: '\e838'; }
.iconf-lastfm:before { content: '\e842'; }
.iconf-tumblr:before { content: '\e843'; }
.iconf-wordpress:before { content: '\e84e'; }
.iconf-eventbrite:before { content: '\e848'; }
.iconf-acrobat:before { content: '\e84f'; }
.iconf-email:before { content: '\e884'; }
.iconf-like:before { content: '\e883'; }
.iconf-map-pointer:before { content: '\e85c'; }
.iconf-phone:before { content: '\e881'; }
.iconf-monitor:before { content: '\e882'; }
.iconf-music:before { content: '\e800'; }
.iconf-search:before { content: '\e801'; }
.iconf-mail:before { content: '\e802'; }
.iconf-heart:before { content: '\e803'; }
.iconf-star:before { content: '\e804'; }
.iconf-guy:before { content: '\e805'; }
.iconf-video:before { content: '\e806'; }
.iconf-camera:before { content: '\e807'; }
.iconf-photo:before { content: '\e808'; }
.iconf-attach:before { content: '\e809'; }
.iconf-lock:before { content: '\e80a'; }
.iconf-eye:before { content: '\e80b'; }
.iconf-tag:before { content: '\e80c'; }
.iconf-thumbs-up:before { content: '\e80d'; }
.iconf-pencil:before { content: '\e80e'; }
.iconf-comment:before { content: '\e80f'; }
.iconf-map-location:before { content: '\e810'; }
.iconf-cup:before { content: '\e811'; }
.iconf-trash:before { content: '\e812'; }
.iconf-note:before { content: '\e814'; }
.iconf-cog:before { content: '\e815'; }
.iconf-params:before { content: '\e816'; }
.iconf-calendar:before { content: '\e817'; }
.iconf-sound:before { content: '\e818'; }
.iconf-wirst-watch:before { content: '\e819'; }
.iconf-lightbulb:before { content: '\e81a'; }
.iconf-tv:before { content: '\e81b'; }
.iconf-desktop:before { content: '\e81c'; }
.iconf-mobile:before { content: '\e81d'; }
.iconf-cd:before { content: '\e81e'; }
.iconf-inbox:before { content: '\e81f'; }
.iconf-world:before { content: '\e820'; }
.iconf-cloud:before { content: '\e821'; }
.iconf-paper-plane:before { content: '\e822'; }
.iconf-fire:before { content: '\e823'; }
.<API key>:before { content: '\e824'; }
.iconf-megaphone:before { content: '\e825'; }
.iconf-database:before { content: '\e826'; }
.iconf-key:before { content: '\e827'; }
.iconf-beaker:before { content: '\e828'; }
.iconf-truck:before { content: '\e829'; }
.iconf-money:before { content: '\e82a'; }
.iconf-food:before { content: '\e82b'; }
.iconf-shop:before { content: '\e82c'; }
.iconf-diamond:before { content: '\e82d'; }
.iconf-t-shirt:before { content: '\e82e'; }
.iconf-linkedin:before { content: '\e845'; }
|
<html dir="LTR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
<title>ICommandProcessor.Stop Method</title>
<xml>
</xml>
<link rel="stylesheet" type="text/css" href="MSDN.css" />
</head>
<body id="bodyID" class="dtBODY">
<div id="nsbanner">
<div id="bannerrow1">
<table class="bannerparthead" cellspacing="0">
<tr id="hdr">
<td class="runninghead">An NDoc Documented Class Library</td>
<td class="product">
</td>
</tr>
</table>
</div>
<div id="TitleRow">
<h1 class="dtH1">ICommandProcessor.Stop Method </h1>
</div>
</div>
<div id="nstext">
<p> Ends the current Selenium testing session (normally killing the browser) </p>
<div class="syntax">
<a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/<API key>.htm">void</a> Stop();</div>
<h4 class="dtH4">See Also</h4>
<p>
<a href="Selenium.ICommandProcessor.html">ICommandProcessor Interface</a> | <a href="Selenium.html">Selenium Namespace</a></p>
</div>
</body>
</html>
|
<div class="col-md-12">
<div class="form-group">
<div class="row" ng-repeat="field in $ctrl.fields">
<div class="col-md-4 sm-label-right">
{{::field.label}}
<help-field key="{{::field.helpField}}"></help-field>
</div>
<div class="col-md-{{::field.columns || 8}}">
<input
type="{{::field.type}}"
class="{{::field.inputClasses}}"
ng-model="$ctrl.component.securityContext[field.model]"
/>
</div>
</div>
</div>
<div class="form-group">
<<API key> component="$ctrl.component"></<API key>>
</div>
<div class="form-group">
<<API key> component="$ctrl.component"></<API key>>
</div>
</div>
|
#include "common.h"
#include "sysfunc.h"
#include "trec_eval.h"
#include "functions.h"
#include "trec_format.h"
static int
te_calc_num_ret (const EPI *epi, const REL_INFO *rel_info,
const RESULTS *results, const TREC_MEAS *tm, TREC_EVAL *eval);
/* See trec_eval.h for definition of TREC_MEAS */
TREC_MEAS te_meas_num_ret =
{"num_ret",
" Number of documents retrieved for topic. \n\
May be affected by Judged_docs_only and <API key> command\n\
line parameters (as are most measures).\n\
Summary figure is sum of individual topics, not average.\n",
te_init_meas_s_long,
te_calc_num_ret,
te_acc_meas_s,
<API key>,
<API key>,
<API key>,
NULL, -1};
static int
te_calc_num_ret (const EPI *epi, const REL_INFO *rel_info,
const RESULTS *results, const TREC_MEAS *tm, TREC_EVAL *eval)
{
RES_RELS res_rels;
/* Can't just use results, since epi->only_judged_docs may be set */
if (UNDEF == te_form_res_rels (epi, rel_info, results, &res_rels))
return (UNDEF);
eval->values[tm->eval_index].value = (double) res_rels.num_ret;
return (1);
}
|
package com.cardpay.pccredit.QZBankInterface.service;
import com.cardpay.pccredit.QZBankInterface.client.Client;
import com.cardpay.pccredit.QZBankInterface.constant.Constant;
import com.cardpay.pccredit.QZBankInterface.model.Circle;
import com.cardpay.pccredit.QZBankInterface.model.Credit;
import com.cardpay.pccredit.QZBankInterface.model.ECIF;
import com.dc.eai.data.CompositeData;
import java.util.Date;
import com.wicresoft.jrad.base.database.dao.common.CommonDao;
import com.wicresoft.jrad.base.database.id.IDGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CreditService {
@Autowired
private CommonDao commonDao;
@Autowired
private IESBForCredit iesbForCredit;
@Autowired
private Client client;
@Autowired
private ECIFService ecifService;
/**
*
* @param credit
* @return
*/
public void <API key>(Credit credit) {
CompositeData req = iesbForCredit.<API key>(credit);
CompositeData resp = client.sendMess(req);
boolean res = iesbForCredit.parseEcifResponse(resp);
//creditecif
if(res){
String id = IDGenerator.generateID();
credit.setId(id);
credit.setCreatedTime(new Date());
commonDao.insertObject(credit);
ECIF ecif = ecifService.findEcifByClientNo(credit.getClientNo());
commonDao.updateObject(ecif);
}
}
}
|
#pragma once
#include <aws/medialive/MediaLive_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/medialive/model/ScheduleAction.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace MediaLive
{
namespace Model
{
class AWS_MEDIALIVE_API <API key>
{
public:
<API key>();
<API key>(Aws::Utils::Json::JsonView jsonValue);
<API key>& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* List of actions that have been created in the schedule.
*/
inline const Aws::Vector<ScheduleAction>& GetScheduleActions() const{ return m_scheduleActions; }
/**
* List of actions that have been created in the schedule.
*/
inline bool <API key>() const { return <API key>; }
/**
* List of actions that have been created in the schedule.
*/
inline void SetScheduleActions(const Aws::Vector<ScheduleAction>& value) { <API key> = true; m_scheduleActions = value; }
/**
* List of actions that have been created in the schedule.
*/
inline void SetScheduleActions(Aws::Vector<ScheduleAction>&& value) { <API key> = true; m_scheduleActions = std::move(value); }
/**
* List of actions that have been created in the schedule.
*/
inline <API key>& WithScheduleActions(const Aws::Vector<ScheduleAction>& value) { SetScheduleActions(value); return *this;}
/**
* List of actions that have been created in the schedule.
*/
inline <API key>& WithScheduleActions(Aws::Vector<ScheduleAction>&& value) { SetScheduleActions(std::move(value)); return *this;}
/**
* List of actions that have been created in the schedule.
*/
inline <API key>& AddScheduleActions(const ScheduleAction& value) { <API key> = true; m_scheduleActions.push_back(value); return *this; }
/**
* List of actions that have been created in the schedule.
*/
inline <API key>& AddScheduleActions(ScheduleAction&& value) { <API key> = true; m_scheduleActions.push_back(std::move(value)); return *this; }
private:
Aws::Vector<ScheduleAction> m_scheduleActions;
bool <API key>;
};
} // namespace Model
} // namespace MediaLive
} // namespace Aws
|
#include "ray/stats/metric.h"
namespace ray {
namespace stats {
static void RegisterAsView(opencensus::stats::ViewDescriptor view_descriptor,
const std::vector<opencensus::tags::TagKey> &keys) {
// Register global keys.
for (const auto &tag : ray::stats::StatsConfig::instance().GetGlobalTags()) {
view_descriptor = view_descriptor.add_column(tag.first);
}
// Register custom keys.
for (const auto &key : keys) {
view_descriptor = view_descriptor.add_column(key);
}
opencensus::stats::View view(view_descriptor);
view_descriptor.RegisterForExport();
}
StatsConfig &StatsConfig::instance() {
static StatsConfig instance;
return instance;
}
void StatsConfig::SetGlobalTags(const TagsType &global_tags) {
global_tags_ = global_tags;
}
const TagsType &StatsConfig::GetGlobalTags() const { return global_tags_; }
void StatsConfig::SetIsDisableStats(bool disable_stats) {
is_stats_disabled_ = disable_stats;
}
bool StatsConfig::IsStatsDisabled() const { return is_stats_disabled_; }
void Metric::Record(double value, const TagsType &tags) {
if (StatsConfig::instance().IsStatsDisabled()) {
return;
}
if (measure_ == nullptr) {
measure_.reset(new opencensus::stats::Measure<double>(
opencensus::stats::Measure<double>::Register(name_, description_, unit_)));
RegisterView();
}
// Do record.
TagsType combined_tags(tags);
combined_tags.insert(std::end(combined_tags),
std::begin(StatsConfig::instance().GetGlobalTags()),
std::end(StatsConfig::instance().GetGlobalTags()));
opencensus::stats::Record({{*measure_, value}}, combined_tags);
}
void Gauge::RegisterView() {
opencensus::stats::ViewDescriptor view_descriptor =
opencensus::stats::ViewDescriptor()
.set_name(name_)
.set_description(description_)
.set_measure(name_)
.set_aggregation(opencensus::stats::Aggregation::LastValue());
RegisterAsView(view_descriptor, tag_keys_);
}
void Histogram::RegisterView() {
opencensus::stats::ViewDescriptor view_descriptor =
opencensus::stats::ViewDescriptor()
.set_name(name_)
.set_description(description_)
.set_measure(name_)
.set_aggregation(opencensus::stats::Aggregation::Distribution(
opencensus::stats::BucketBoundaries::Explicit(boundaries_)));
RegisterAsView(view_descriptor, tag_keys_);
}
void Count::RegisterView() {
opencensus::stats::ViewDescriptor view_descriptor =
opencensus::stats::ViewDescriptor()
.set_name(name_)
.set_description(description_)
.set_measure(name_)
.set_aggregation(opencensus::stats::Aggregation::Count());
RegisterAsView(view_descriptor, tag_keys_);
}
void Sum::RegisterView() {
opencensus::stats::ViewDescriptor view_descriptor =
opencensus::stats::ViewDescriptor()
.set_name(name_)
.set_description(description_)
.set_measure(name_)
.set_aggregation(opencensus::stats::Aggregation::Count());
RegisterAsView(view_descriptor, tag_keys_);
}
} // namespace stats
} // namespace ray
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_22) on Wed Apr 03 10:00:57 GMT-03:00 2013 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class opennlp.model.AbstractDataIndexer (Apache OpenNLP Maxent 3.0.3 API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Uses of Class opennlp.model.AbstractDataIndexer (Apache OpenNLP Maxent 3.0.3 API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../opennlp/model/AbstractDataIndexer.html" title="class in opennlp.model"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?opennlp/model/class-use/AbstractDataIndexer.html" target="_top"><B>FRAMES</B></A>
<A HREF="AbstractDataIndexer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>opennlp.model.AbstractDataIndexer</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../opennlp/model/AbstractDataIndexer.html" title="class in opennlp.model">AbstractDataIndexer</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#opennlp.model"><B>opennlp.model</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="opennlp.model"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../opennlp/model/AbstractDataIndexer.html" title="class in opennlp.model">AbstractDataIndexer</A> in <A HREF="../../../opennlp/model/package-summary.html">opennlp.model</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Subclasses of <A HREF="../../../opennlp/model/AbstractDataIndexer.html" title="class in opennlp.model">AbstractDataIndexer</A> in <A HREF="../../../opennlp/model/package-summary.html">opennlp.model</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../opennlp/model/OnePassDataIndexer.html" title="class in opennlp.model">OnePassDataIndexer</A></B></CODE>
<BR>
An indexer for maxent model data which handles cutoffs for uncommon
contextual predicates and provides a unique integer index for each of the
predicates.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../opennlp/model/<API key>.html" title="class in opennlp.model"><API key></A></B></CODE>
<BR>
An indexer for maxent model data which handles cutoffs for uncommon
contextual predicates and provides a unique integer index for each of the
predicates and maintains event values.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../opennlp/model/TwoPassDataIndexer.html" title="class in opennlp.model">TwoPassDataIndexer</A></B></CODE>
<BR>
Collecting event and context counts by making two passes over the events.</TD>
</TR>
</TABLE>
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../opennlp/model/AbstractDataIndexer.html" title="class in opennlp.model"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?opennlp/model/class-use/AbstractDataIndexer.html" target="_top"><B>FRAMES</B></A>
<A HREF="AbstractDataIndexer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright &
</BODY>
</HTML>
|
<div>
<h3></h3>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>10</p>
<p>11</p>
<p>12</p>
<p>13</p>
<p>14</p>
<p>15</p>
<p>16</p>
<p>17</p>
<p>18</p>
<p>19</p>
<p>20</p>
<p>21</p>
<p>22</p>
<p>23</p>
</div>
|
from packetbeat import BaseTest
"""
Tests for HTTP messages with gaps (packet loss) in them.
"""
class Test(BaseTest):
def <API key>(self):
"""
Should recover well from losing a packet in a large
file download.
"""
self.<API key>(
http_ports=[8000],
)
self.run_packetbeat(pcap="gap_in_stream.pcap")
objs = self.read_output()
assert len(objs) == 1
o = objs[0]
assert o["status"] == "OK"
print(o["notes"])
assert len(o["notes"]) == 1
assert o["notes"][0] == "Packet loss while capturing the response"
|
// The LLVM Compiler Infrastructure
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
// class Alloc = allocator<pair<const Key, T>>>
// class unordered_multimap
// iterator begin() {return __table_.begin();}
// iterator end() {return __table_.end();}
// const_iterator begin() const {return __table_.begin();}
// const_iterator end() const {return __table_.end();}
// const_iterator cbegin() const {return __table_.begin();}
// const_iterator cend() const {return __table_.end();}
#include <unordered_map>
#include <string>
#include <cassert>
#include "min_allocator.h"
int main()
{
{
typedef std::unordered_multimap<int, std::string> C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7);
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::iterator i;
i = c.begin();
i->second = "ONE";
assert(i->second == "ONE");
}
{
typedef std::unordered_multimap<int, std::string> C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7);
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
#if __cplusplus >= 201103L
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7);
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::iterator i;
i = c.begin();
i->second = "ONE";
assert(i->second == "ONE");
}
{
typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.bucket_count() >= 7);
assert(c.size() == 6);
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
#endif
#if _LIBCPP_STD_VER > 11
{ // N3644 testing
typedef std::unordered_multimap<int,double> C;
C::iterator ii1{}, ii2{};
C::iterator ii4 = ii1;
C::const_iterator cii{};
assert ( ii1 == ii2 );
assert ( ii1 == ii4 );
assert ( ii1 == cii );
assert ( !(ii1 != ii2 ));
assert ( !(ii1 != cii ));
}
#endif
}
|
var targetObj = {};
assert.sameValue([0, 1, targetObj, 3, 4].indexOf(targetObj, "0x0003"), -1, '[0, 1, targetObj, 3, 4].indexOf(targetObj, "0x0003")');
assert.sameValue([0, 1, 2, targetObj, 4].indexOf(targetObj, "0x0003"), 3, '[0, 1, 2, targetObj, 4].indexOf(targetObj, "0x0003")');
|
package org.apache.commons.net.ssh.transport;
import org.apache.commons.net.ssh.SSHPacket;
import org.apache.commons.net.ssh.util.Constants.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final class Heartbeater extends Thread
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final TransportProtocol trans;
private int interval;
private boolean started;
Heartbeater(TransportProtocol trans)
{
this.trans = trans;
setName("heartbeater");
}
synchronized void setInterval(int interval)
{
this.interval = interval;
if (interval != 0)
{
if (!started)
start();
notify();
}
}
synchronized int getInterval()
{
return interval;
}
@Override
public void run()
{
try
{
while (!Thread.currentThread().isInterrupted())
{
int hi;
synchronized (this)
{
while ((hi = interval) == 0)
wait();
}
if (!started)
started = true;
else if (trans.isRunning())
{
log.info("Sending heartbeat since {} seconds elapsed", hi);
trans.write(new SSHPacket(Message.IGNORE));
}
Thread.sleep(hi * 1000);
}
} catch (Exception e)
{
if (Thread.currentThread().isInterrupted())
{
// We are meant to shut up and draw to a close if interrupted
} else
trans.die(e);
}
log.debug("Stopping");
}
}
|
#pragma once
#include <aws/ecs/ECS_EXPORTS.h>
namespace Aws
{
template<typename RESULT_TYPE>
class <API key>;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace ECS
{
namespace Model
{
class AWS_ECS_API UntagResourceResult
{
public:
UntagResourceResult();
UntagResourceResult(const Aws::<API key><Aws::Utils::Json::JsonValue>& result);
UntagResourceResult& operator=(const Aws::<API key><Aws::Utils::Json::JsonValue>& result);
};
} // namespace Model
} // namespace ECS
} // namespace Aws
|
ALTER TABLE issue ADD COLUMN history longtext;
ALTER TABLE posting ADD COLUMN history longtext;
ALTER TABLE issue DROP COLUMN history;
ALTER TABLE posting DROP COLUMN history;
|
<!-- Override the reveal.js styles -->
<style type="text/css">
.reveal h1 { font-size: 2.00em; -webkit-hyphens: none; -moz-hyphens: none; }
.reveal h2 { font-size: 1.50em; -webkit-hyphens: none; -moz-hyphens: none; }
</style>
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_111) on Thu Aug 18 01:51:14 UTC 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.apache.hadoop.lib.lang (Apache Hadoop Main 2.7.3 API)</title>
<meta name="date" content="2016-08-18">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../../../../../org/apache/hadoop/lib/lang/package-summary.html" target="classFrame">org.apache.hadoop.lib.lang</a></h1>
</body>
</html>
|
// file at the top-level directory of this distribution and at
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[link(name = "numeric",
vers = "0.1")];
#[crate_type = "lib"];
pub trait Trig<T> {
fn sin(&self) -> T;
}
pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }
pub trait Angle<T>: Trig<T> {}
|
#pragma once
#include <aws/chime/Chime_EXPORTS.h>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace Chime
{
namespace Model
{
class AWS_CHIME_API <API key>
{
public:
<API key>();
<API key>(Aws::Utils::Json::JsonView jsonValue);
<API key>& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The number of days for which to retain chat-room messages.</p>
*/
inline int GetRetentionDays() const{ return m_retentionDays; }
/**
* <p>The number of days for which to retain chat-room messages.</p>
*/
inline bool <API key>() const { return <API key>; }
/**
* <p>The number of days for which to retain chat-room messages.</p>
*/
inline void SetRetentionDays(int value) { <API key> = true; m_retentionDays = value; }
/**
* <p>The number of days for which to retain chat-room messages.</p>
*/
inline <API key>& WithRetentionDays(int value) { SetRetentionDays(value); return *this;}
private:
int m_retentionDays;
bool <API key>;
};
} // namespace Model
} // namespace Chime
} // namespace Aws
|
#include <aws/rds/model/<API key>.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/<API key>.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <utility>
using namespace Aws::RDS::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils::Logging;
using namespace Aws::Utils;
using namespace Aws;
<API key>::<API key>()
{
}
<API key>::<API key>(const Aws::<API key><XmlDocument>& result)
{
*this = result;
}
<API key>& <API key>::operator =(const Aws::<API key><XmlDocument>& result)
{
const XmlDocument& xmlDocument = result.GetPayload();
XmlNode rootNode = xmlDocument.GetRootElement();
XmlNode resultNode = rootNode;
if (!rootNode.IsNull() && (rootNode.GetName() != "<API key>"))
{
resultNode = rootNode.FirstChild("<API key>");
}
if(!resultNode.IsNull())
{
XmlNode markerNode = resultNode.FirstChild("Marker");
if(!markerNode.IsNull())
{
m_marker = Aws::Utils::Xml::<API key>(markerNode.GetText());
}
XmlNode <API key> = resultNode.FirstChild("DBClusterBacktracks");
if(!<API key>.IsNull())
{
XmlNode <API key> = <API key>.FirstChild("DBClusterBacktrack");
while(!<API key>.IsNull())
{
<API key>.push_back(<API key>);
<API key> = <API key>.NextNode("DBClusterBacktrack");
}
}
}
if (!rootNode.IsNull()) {
XmlNode <API key> = rootNode.FirstChild("ResponseMetadata");
m_responseMetadata = <API key>;
AWS_LOGSTREAM_DEBUG("Aws::RDS::Model::<API key>", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );
}
return *this;
}
|
package com.yahoo.squidb.test;
import com.yahoo.squidb.annotations.ColumnSpec;
import com.yahoo.squidb.annotations.PrimaryKey;
import com.yahoo.squidb.annotations.TableModelSpec;
@TableModelSpec(className = "Thing", tableName = "things")
public class ThingSpec {
public static final String DEFAULT_FOO = "thing";
public static final int DEFAULT_BAR = 100;
public static final boolean DEFAULT_IS_ALIVE = true;
@PrimaryKey(autoincrement = false)
long id;
@ColumnSpec(defaultValue = DEFAULT_FOO)
String foo;
@ColumnSpec(defaultValue = "100")
int bar;
long baz;
@ColumnSpec(defaultValue = "0.0")
double qux;
@ColumnSpec(defaultValue = "true")
boolean isAlive;
byte[] blob;
}
|
package org.zstack.header.vm;
import org.zstack.header.cluster.ClusterInventory;
import org.zstack.header.configuration.<API key>;
import org.zstack.header.configuration.<API key>;
import org.zstack.header.exception.<API key>;
import org.zstack.header.host.HostInventory;
import org.zstack.header.image.ImageInventory;
import org.zstack.header.query.ExpandedQueries;
import org.zstack.header.query.ExpandedQuery;
import org.zstack.header.rest.APINoSee;
import org.zstack.header.search.Inventory;
import org.zstack.header.search.TypeField;
import org.zstack.header.vm.cdrom.VmCdRomInventory;
import org.zstack.header.volume.VolumeInventory;
import org.zstack.header.volume.VolumeType;
import org.zstack.header.zone.ZoneInventory;
import org.zstack.utils.CollectionUtils;
import org.zstack.utils.function.Function;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* @inventory inventory for vm instance
* @example {
* "inventory": {
* "uuid": "<API key>",
* "name": "TestVm",
* "description": "Test",
* "zoneUuid": "<API key>",
* "clusterUuid": "<API key>",
* "imageUuid": "<API key>",
* "hostUuid": "<API key>",
* "lastHostUuid": "<API key>",
* "<API key>": "<API key>",
* "rootVolumeUuid": "<API key>",
* "type": "UserVm",
* "hypervisorType": "KVM",
* "createDate": "Apr 30, 2014 6:11:47 PM",
* "lastOpDate": "Apr 30, 2014 6:11:47 PM",
* "state": "Running",
* "internalId": 1,
* "vmNics": [
* {
* "uuid": "<API key>",
* "vmInstanceUuid": "<API key>",
* "usedIpUuid": "<API key>",
* "l3NetworkUuid": "<API key>",
* "ip": "10.12.140.148",
* "mac": "fa:f0:08:8c:20:00",
* "netmask": "255.0.0.0",
* "gateway": "10.10.2.1",
* "internalName": "vnic1.0",
* "deviceId": 0,
* "createDate": "Apr 30, 2014 6:11:47 PM",
* "lastOpDate": "Apr 30, 2014 6:11:47 PM"
* },
* {
* "uuid": "<API key>",
* "vmInstanceUuid": "<API key>",
* "usedIpUuid": "<API key>",
* "l3NetworkUuid": "<API key>",
* "ip": "10.4.224.72",
* "mac": "fa:e3:87:b1:71:01",
* "netmask": "255.0.0.0",
* "gateway": "10.0.0.1",
* "internalName": "vnic1.1",
* "deviceId": 1,
* "createDate": "Apr 30, 2014 6:11:47 PM",
* "lastOpDate": "Apr 30, 2014 6:11:47 PM"
* },
* {
* "uuid": "<API key>",
* "vmInstanceUuid": "<API key>",
* "usedIpUuid": "<API key>",
* "l3NetworkUuid": "<API key>",
* "ip": "10.29.42.155",
* "mac": "fa:2d:31:08:da:02",
* "netmask": "255.0.0.0",
* "gateway": "10.20.3.1",
* "internalName": "vnic1.2",
* "deviceId": 2,
* "createDate": "Apr 30, 2014 6:11:47 PM",
* "lastOpDate": "Apr 30, 2014 6:11:47 PM"
* },
* {
* "uuid": "<API key>",
* "vmInstanceUuid": "<API key>",
* "usedIpUuid": "<API key>",
* "l3NetworkUuid": "<API key>",
* "ip": "10.20.206.157",
* "mac": "fa:a3:04:b2:6c:00",
* "netmask": "255.0.0.0",
* "gateway": "10.20.4.1",
* "internalName": "vnic1.0",
* "deviceId": 0,
* "createDate": "Apr 30, 2014 6:11:48 PM",
* "lastOpDate": "Apr 30, 2014 6:11:48 PM"
* }
* ],
* "allVolumes": [
* {
* "uuid": "<API key>",
* "name": "ROOT-for-TestVm",
* "description": "Root volume for VM[uuid:<API key>]",
* "primaryStorageUuid": "<API key>",
* "vmInstanceUuid": "<API key>",
* "rootImageUuid": "<API key>",
* "installPath": "/opt/zstack/nfsprimarystorage/<API key>/rootVolumes/<API key>/<API key>/<API key>.qcow2",
* "type": "Root",
* "hypervisorType": "KVM",
* "size": 32212254720,
* "deviceId": 0,
* "state": "Enabled",
* "status": "Ready",
* "createDate": "Apr 30, 2014 6:11:47 PM",
* "lastOpDate": "Apr 30, 2014 6:11:47 PM",
* "backupStorageRefs": []
* }
* ]
* }
* }
* @since 0.1.0
*/
@Inventory(mappingVOClass = VmInstanceVO.class)
@<API key>
@ExpandedQueries({
@ExpandedQuery(expandedField = "zone", inventoryClass = ZoneInventory.class,
foreignKey = "zoneUuid", <API key> = "uuid"),
@ExpandedQuery(expandedField = "cluster", inventoryClass = ClusterInventory.class,
foreignKey = "clusterUuid", <API key> = "uuid"),
@ExpandedQuery(expandedField = "host", inventoryClass = HostInventory.class,
foreignKey = "hostUuid", <API key> = "uuid"),
@ExpandedQuery(expandedField = "image", inventoryClass = ImageInventory.class,
foreignKey = "imageUuid", <API key> = "uuid"),
@ExpandedQuery(expandedField = "instanceOffering", inventoryClass = <API key>.class,
foreignKey = "<API key>", <API key> = "uuid"),
@ExpandedQuery(expandedField = "rootVolume", inventoryClass = VolumeInventory.class,
foreignKey = "rootVolumeUuid", <API key> = "uuid"),
@ExpandedQuery(expandedField = "vmNics", inventoryClass = VmNicInventory.class,
foreignKey = "uuid", <API key> = "vmInstanceUuid"),
@ExpandedQuery(expandedField = "allVolumes", inventoryClass = VolumeInventory.class,
foreignKey = "uuid", <API key> = "vmInstanceUuid"),
@ExpandedQuery(expandedField = "vmCdRoms", inventoryClass = VmCdRomInventory.class,
foreignKey = "uuid", <API key> = "vmInstanceUuid"),
})
public class VmInstanceInventory implements Serializable, Cloneable {
/**
* @desc vm uuid
*/
private String uuid;
/**
* @desc max length of 255 characters
*/
private String name;
/**
* @desc max length of 2048 characters
* @nullable
*/
private String description;
/**
* @desc uuid of zone this vm is in. See :ref:`ZoneInventory`
*/
private String zoneUuid;
/**
* @desc uuid of cluster this vm is in. See :ref:`ClusterInventory`
*/
private String clusterUuid;
/**
* @desc uuid of image this vm was created from. See :ref:`ImageInventory`
*/
private String imageUuid;
/**
* @desc uuid of host the vm is on. See :ref:`HostInventory`
* @nullable .. note:: this field is null when vm is stopped
*/
private String hostUuid;
/**
* @desc uuid of host the vm was running on last time
* @nullable .. note:: this field is null when vm has not been stopped yet. Once vm gets stopped, this
* field is filled with host uuid it's running on previously
*/
private String lastHostUuid;
/**
* @desc uuid of instance offering the vm was created from. See :ref:`<API key>`
*/
private String <API key>;
/**
* @desc uuid of vm's root volume. See :ref:`VolumeInventory`
*/
private String rootVolumeUuid;
private String platform;
private String architecture;
private String <API key>;
@TypeField
private String type;
/**
* @desc hypervisor type of vm. See hypervisorType of :ref:`ClusterInventory`
*/
private String hypervisorType;
private Long memorySize;
private Integer cpuNum;
private Long cpuSpeed;
private String allocatorStrategy;
/**
* @desc the time this resource gets created
*/
private Timestamp createDate;
/**
* @desc last time this resource gets operated
*/
private Timestamp lastOpDate;
/**
* @desc - Created: the vm is just created in database, having not been started
* - Starting: the vm is starting, having not run on host
* - Running: the vm is running on host
* - Stopping: the vm is stopping, having not stopped on host
* - Stopped: the vm is stopped on host
* - Rebooting: the vm is in middle way of rebooting before running on host again
* - Destroying: the vm is destroying, having not destroyed on host
* - Migrating: the vm is migrating to another host
* - Unknown: zstack cannot track vm state, for example, lost connection to hypervisor agent
* @choices - Created
* - Starting
* - Running
* - Stopping
* - Rebooting
* - Destroying
* - Migrating
* - Unknown
*/
private String state;
/**
* @ignore
*/
@APINoSee
private Long internalId;
/**
* @desc a list of nics the vm has. See :ref:`VmNicInventory`
*/
private List<VmNicInventory> vmNics;
/**
* @desc a list of volumes the vm has, including all types volume.
* See :{@link VolumeInventory}
* See :{@link VolumeType}
*/
private List<VolumeInventory> allVolumes;
private List<VmCdRomInventory> vmCdRoms;
private String guestOsType;
protected VmInstanceInventory(VmInstanceVO vo) {
this.setUuid(vo.getUuid());
this.setName(vo.getName());
this.setDescription(vo.getDescription());
this.setZoneUuid(vo.getZoneUuid());
this.setClusterUuid(vo.getClusterUuid());
this.setImageUuid(vo.getImageUuid());
this.setHostUuid(vo.getHostUuid());
this.setLastHostUuid(vo.getLastHostUuid());
this.<API key>(vo.<API key>());
this.setType(vo.getType());
this.setHypervisorType(vo.getHypervisorType());
this.setCreateDate(vo.getCreateDate());
this.setLastOpDate(vo.getLastOpDate());
this.setState(vo.getState().toString());
this.setRootVolumeUuid(vo.getRootVolumeUuid());
this.setAllVolumes(VolumeInventory.valueOf(vo.getAllVolumes()));
this.setVmNics(VmNicInventory.valueOf(vo.getVmNics()));
this.setVmCdRoms(VmCdRomInventory.valueOf(vo.getVmCdRoms()));
this.setInternalId(vo.getInternalId());
this.<API key>(vo.<API key>());
this.setCpuNum(vo.getCpuNum());
this.setCpuSpeed(vo.getCpuSpeed());
this.setMemorySize(vo.getMemorySize());
this.<API key>(vo.<API key>());
this.setPlatform(vo.getPlatform());
this.setArchitecture(vo.getArchitecture());
this.setGuestOsType(vo.getGuestOsType());
}
public static VmInstanceInventory valueOf(VmInstanceVO vo) {
return new VmInstanceInventory(vo);
}
public static List<VmInstanceInventory> valueOf(Collection<VmInstanceVO> vos) {
List<VmInstanceInventory> invs = new ArrayList<VmInstanceInventory>(vos.size());
for (VmInstanceVO vo : vos) {
invs.add(VmInstanceInventory.valueOf(vo));
}
return invs;
}
public VmInstanceInventory() {
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String <API key>() {
return <API key>;
}
public void <API key>(String <API key>) {
this.<API key> = <API key>;
}
public VmNicInventory findNic(final String l3Uuid) {
return CollectionUtils.find(vmNics, new Function<VmNicInventory, VmNicInventory>() {
@Override
public VmNicInventory call(VmNicInventory arg) {
if (VmNicHelper.isL3AttachedToVmNic(arg, l3Uuid)) {
return arg;
}
return null;
}
});
}
public static VmInstanceInventory copyFrom(VmInstanceInventory origin) {
try {
return (VmInstanceInventory) origin.clone();
} catch (<API key> e) {
throw new <API key>(e);
}
}
public VmInstanceInventory(VmInstanceInventory origin) {
VmInstanceInventory inv;
try {
inv = (VmInstanceInventory) origin.clone();
} catch (<API key> e) {
throw new <API key>(e);
}
this.setClusterUuid(inv.getClusterUuid());
this.setCreateDate(inv.getCreateDate());
this.setDescription(inv.getDescription());
this.setHostUuid(inv.getHostUuid());
this.setHypervisorType(inv.getHypervisorType());
this.setImageUuid(inv.getImageUuid());
this.<API key>(inv.<API key>());
this.setLastHostUuid(inv.getLastHostUuid());
this.setLastOpDate(inv.getLastOpDate());
this.setName(inv.getName());
this.setRootVolumeUuid(inv.getRootVolumeUuid());
this.setState(inv.getState());
this.setType(inv.getType());
this.setUuid(inv.getUuid());
this.setZoneUuid(inv.getZoneUuid());
this.setAllVolumes(inv.getAllVolumes());
this.setVmNics(inv.getVmNics());
this.setInternalId(inv.getInternalId());
this.setCpuNum(inv.getCpuNum());
this.setCpuSpeed(inv.getCpuSpeed());
this.setMemorySize(inv.getMemorySize());
this.<API key>(inv.<API key>());
this.setArchitecture(inv.getArchitecture());
this.setGuestOsType(inv.getGuestOsType());
}
public VolumeInventory getRootVolume() {
for (VolumeInventory v : allVolumes) {
if (v.getUuid().equals(rootVolumeUuid)) {
return v;
}
}
return null;
}
public String <API key>() {
return allocatorStrategy;
}
public void <API key>(String allocatorStrategy) {
this.allocatorStrategy = allocatorStrategy;
}
public Long getMemorySize() {
return memorySize;
}
public void setMemorySize(Long memorySize) {
this.memorySize = memorySize;
}
public Integer getCpuNum() {
return cpuNum;
}
public void setCpuNum(Integer cpuNum) {
this.cpuNum = cpuNum;
}
public Long getCpuSpeed() {
return cpuSpeed;
}
public void setCpuSpeed(Long cpuSpeed) {
this.cpuSpeed = cpuSpeed;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getZoneUuid() {
return zoneUuid;
}
public void setZoneUuid(String zoneUuid) {
this.zoneUuid = zoneUuid;
}
public String getClusterUuid() {
return clusterUuid;
}
public void setClusterUuid(String clusterUuid) {
this.clusterUuid = clusterUuid;
}
public String getImageUuid() {
return imageUuid;
}
public void setImageUuid(String imageUuid) {
this.imageUuid = imageUuid;
}
public String getHostUuid() {
return hostUuid;
}
public void setHostUuid(String hostUuid) {
this.hostUuid = hostUuid;
}
public String getLastHostUuid() {
return lastHostUuid;
}
public void setLastHostUuid(String lastHostUuid) {
this.lastHostUuid = lastHostUuid;
}
public String <API key>() {
return <API key>;
}
public void <API key>(String <API key>) {
this.<API key> = <API key>;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getHypervisorType() {
return hypervisorType;
}
public void setHypervisorType(String hypervisorType) {
this.hypervisorType = hypervisorType;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getRootVolumeUuid() {
return rootVolumeUuid;
}
public void setRootVolumeUuid(String rootVolumeUuid) {
this.rootVolumeUuid = rootVolumeUuid;
}
public List<VmNicInventory> getVmNics() {
return vmNics;
}
public void setVmNics(List<VmNicInventory> vmNics) {
this.vmNics = vmNics;
}
/**
* @return a list of disk the vm using on hypervisor, including root volume and data volume.
* See :{@link VolumeType}
* See :{@link VolumeInventory#isDisk}
*/
public List<VolumeInventory> getAllDiskVolumes() {
return getAllVolumes(VolumeInventory::isDisk);
}
@Deprecated
public List<VolumeInventory> getAllVolumes() {
return allVolumes;
}
public List<VolumeInventory> getAllVolumes(Predicate<VolumeInventory> predicate) {
return allVolumes.stream().filter(predicate).collect(Collectors.toList());
}
public VolumeInventory getVolume(Predicate<VolumeInventory> predicate) {
return allVolumes.stream().filter(predicate).findFirst().orElse(null);
}
public void setAllVolumes(List<VolumeInventory> allVolumes) {
this.allVolumes = allVolumes;
}
public Long getInternalId() {
return internalId;
}
public void setInternalId(Long internalId) {
this.internalId = internalId;
}
public Timestamp getCreateDate() {
return createDate;
}
public void setCreateDate(Timestamp createDate) {
this.createDate = createDate;
}
public Timestamp getLastOpDate() {
return lastOpDate;
}
public void setLastOpDate(Timestamp lastOpDate) {
this.lastOpDate = lastOpDate;
}
public List<VmCdRomInventory> getVmCdRoms() {
return vmCdRoms;
}
public void setVmCdRoms(List<VmCdRomInventory> vmCdRoms) {
this.vmCdRoms = vmCdRoms;
}
public String getArchitecture() {
return architecture;
}
public void setArchitecture(String architecture) {
this.architecture = architecture;
}
public String getGuestOsType() {
return guestOsType;
}
public void setGuestOsType(String guestOsType) {
this.guestOsType = guestOsType;
}
}
|
:host {
display: block;
}
.l-info-table {
border: none;
}
.l-info-table tbody th, .l-info-table td {
color: var(--text-primary);
border-top:1px solid var(--<API key>);
}
.l-info-table tr:nth-child(2n) {
background-color: var(--background-primary);
}
.l-argument-list {
width: 100%;
height: 150px;
overflow: auto;
}
.<API key> {
float: left;
width: 40%;
max-height: 140px;
overflow: auto;
}
.<API key> {
float: left;
width: 60%;
height: 150px;
overflow: auto;
}
.l-server-info-list {
position: relative;
margin-right: 10px;
}
.l-server-info-list li {
height: 30px;
font-size: 12px;
color:var(--text-secondary);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
cursor: pointer;
}
.l-server-info-list li:first-child {
border-top-color: transparent;
}
.l-server-info-list li.active {
background-color: var(--primary);
color: var(--text-knockout);
}
.l-server-info-list li ul {
position: absolute;
right: -250px;
top: 0;
color:var(--text-secondary);
}
.l-server-info-list li ul li {
height: auto;
border-top: none;
}
.l-category {
display: inline-block;
padding: 2px 5px;
font-size: 10px;
color: var(--text-knockout);
font-weight: 600;
cursor: pointer;
}
.l-category.blue {
background-color: var(--primary);
}
.l-sub-table {
display: table-cell;
padding: 16px 19px;
background: var(--background-default);
}
.l-sub-table .table th, .l-sub-table .table td {
padding:14px 10px;
}
.l-sub-table .table td + td {
border-left:1px solid var(--border-primary);
}
.l-sub-table .table tr {
background: var(--background-default);
}
.l-not-same {
color: var(--<API key>) !important;
}
.l-not-same-button {
float: right;
font-size: 14px;
}
|
#btn{
border-radius: 30px;
}
#bgvid {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-o-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background: url(http://video.webmfiles.org/<API key>.webm) no-repeat;
background-size: cover;
}
#his{
border-radius: 30px;
}
#directions{
padding-top: 220px;
}
#directions-input{
margin-bottom: -17px;
}
#pblank{
color: #fff;
font-size: 10px;
margin-left: 10px;
text-align: center;
line-height: 9px;
}
#btn-two{
width: 280px;
margin-left: 10px;
}
#menu-color{
background-color: #00AAEF;
}
#hero-text{
color: #fff;
font-size: 20px;
text-align: center;
}
#hero-text2{
color: #fff;
font-size: 12px;
text-align: center;
}
#btn-bar{
border-radius: 30px;
}
#logoweb{
width: 100px;
}
#map {
width: 100%;
height: 100%;
}
hr{
width: 60px;
box-shadow: #fff;
}
#btn-3{
}
#back-photo{
position: absolute;
top: -20px;
}
#bg-containg{
top:100px;
}
.hero-section{
margin-left: 700px;
}
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_13) on Thu May 08 05:30:44 EDT 2008 -->
<TITLE>
API Help
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="API Help";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H1>
How This API Document Is Organized</H1>
</CENTER>
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3>
Overview</H3>
<BLOCKQUOTE>
<P>
The <A HREF="overview-summary.html">Overview</A> page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.</BLOCKQUOTE>
<H3>
Package</H3>
<BLOCKQUOTE>
<P>
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL>
<LI>Interfaces (italic)<LI>Classes<LI>Enums<LI>Exceptions<LI>Errors<LI>Annotation Types</UL>
</BLOCKQUOTE>
<H3>
Class/Interface</H3>
<BLOCKQUOTE>
<P>
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL>
<LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description
<P>
<LI>Nested Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary
<P>
<LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL>
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE>
</BLOCKQUOTE>
<H3>
Annotation Type</H3>
<BLOCKQUOTE>
<P>
Each annotation type has its own separate page with the following sections:<UL>
<LI>Annotation Type declaration<LI>Annotation Type description<LI>Required Element Summary<LI>Optional Element Summary<LI>Element Detail</UL>
</BLOCKQUOTE>
</BLOCKQUOTE>
<H3>
Enum</H3>
<BLOCKQUOTE>
<P>
Each enum has its own separate page with the following sections:<UL>
<LI>Enum declaration<LI>Enum description<LI>Enum Constant Summary<LI>Enum Constant Detail</UL>
</BLOCKQUOTE>
<H3>
Use</H3>
<BLOCKQUOTE>
Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.</BLOCKQUOTE>
<H3>
Tree (Class Hierarchy)</H3>
<BLOCKQUOTE>
There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL>
<LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL>
</BLOCKQUOTE>
<H3>
Deprecated API</H3>
<BLOCKQUOTE>
The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE>
<H3>
Index</H3>
<BLOCKQUOTE>
The <A HREF="index-files/index-1.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE>
<H3>
Prev/Next</H3>
These links take you to the next or previous class, interface, package, or related page.<H3>
Frames/No Frames</H3>
These links show and hide the HTML frames. All pages are available with or without frames.
<P>
<H3>
Serialized Form</H3>
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
<P>
<H3>
Constant Field Values</H3>
The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.
<P>
<FONT SIZE="-1">
<EM>
This help file applies to API documentation generated using the standard doclet.</EM>
</FONT>
<BR>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
</BODY>
</HTML>
|
package org.rubychina.android.test;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
}
}
|
<html><body>
<h1>Kamaelia.<API key>.<API key></h1>
<h2>class <API key>(Axon.Component.component)</h2>
<h4>Inboxes</h4>
<ul><li> control : Secondary inbox often used for signals. The closest analogy is unix signals
<li> inbox : Default inbox for bulk data. Used in a pipeline much like stdin
</ul>
<h4>Outboxes</h4>
<ul><li> outbox : Default data out outbox, used in a pipeline much like stdout
<li> signal : The default signal based outbox - kinda like stderr, but more for sending singal type signals
</ul>
<h2>Methods defined here</h2>
[[boxright][[include][file=Components/MethodNote.html][croptop=1][crop
bottom=1] ] ]
<h3>__init__(self, label, looptimes)</h3>
<h3>main(self)</h3>
<HR>
<h2> Feedback </h2>
<P>Got a problem with the documentation? Something unclear, could
be clearer? Want to help with improving? Constructive criticism,
preferably in the form of suggested rewording is very welcome.
<P>Please leave the feedback
<a href="http://kamaelia.sourceforge.net/cgi-bin/blog/blog.cgi?rm=addpostcomment&postid=1131454685">
here, in reply to the documentation thread in the Kamaelia blog</a>.
</body></html>
|
import {
get
} from 'lodash';
/**
* @private
* @type {String}
*/
const ES_MODULE_KEY = '__esModule';
export default [
/**
* @example `{ default: ..., __esModule: true }`
* @param {*} value
* @returns {*}
*/
value => value && get(value, ES_MODULE_KEY, true) && value.default,
/**
* @param {*} value
* @returns {*}
*/
value => value
];
|
package org.axonframework.metrics;
import com.codahale.metrics.ConsoleReporter;
import org.axonframework.commandhandling.CommandMessage;
import org.axonframework.commandhandling.<API key>;
import org.axonframework.eventhandling.EventMessage;
import org.axonframework.monitoring.MessageMonitor;
import org.junit.Before;
import org.junit.Test;
import java.io.<API key>;
import java.io.PrintStream;
import static org.axonframework.eventhandling.GenericEventMessage.asEventMessage;
import static org.junit.Assert.assertTrue;
public class <API key> {
private <API key> subject;
@Before
public void setUp() throws Exception {
subject = new <API key>();
}
@Test
public void <API key>() throws Exception {
MessageMonitor<? super EventMessage<?>> monitor1 = subject.<API key>("test1");
MessageMonitor<? super EventMessage<?>> monitor2 = subject.<API key>("test2");
monitor1.onMessageIngested(asEventMessage("test")).reportSuccess();
monitor2.onMessageIngested(asEventMessage("test")).reportSuccess();
<API key> out = new <API key>();
ConsoleReporter.forRegistry(subject.getRegistry()).outputTo(new PrintStream(out)).build().report();
String output = new String(out.toByteArray());
assertTrue(output.contains("test1"));
assertTrue(output.contains("test2"));
}
@Test
public void <API key>() throws Exception {
MessageMonitor<EventMessage<?>> monitor = subject.registerEventBus("eventBus");
monitor.onMessageIngested(asEventMessage("test")).reportSuccess();
<API key> out = new <API key>();
ConsoleReporter.forRegistry(subject.getRegistry()).outputTo(new PrintStream(out)).build().report();
String output = new String(out.toByteArray());
assertTrue(output.contains("eventBus"));
}
@Test
public void <API key>() throws Exception {
MessageMonitor<CommandMessage<?>> monitor = subject.registerCommandBus("commandBus");
monitor.onMessageIngested(new <API key><>("test")).reportSuccess();
<API key> out = new <API key>();
ConsoleReporter.forRegistry(subject.getRegistry()).outputTo(new PrintStream(out)).build().report();
String output = new String(out.toByteArray());
assertTrue(output.contains("commandBus"));
}
}
|
#include <aws/iam/model/PolicyUser.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace IAM
{
namespace Model
{
PolicyUser::PolicyUser() :
<API key>(false),
m_userIdHasBeenSet(false)
{
}
PolicyUser::PolicyUser(const XmlNode& xmlNode) :
<API key>(false),
m_userIdHasBeenSet(false)
{
*this = xmlNode;
}
PolicyUser& PolicyUser::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode userNameNode = resultNode.FirstChild("UserName");
if(!userNameNode.IsNull())
{
m_userName = Aws::Utils::Xml::<API key>(userNameNode.GetText());
<API key> = true;
}
XmlNode userIdNode = resultNode.FirstChild("UserId");
if(!userIdNode.IsNull())
{
m_userId = Aws::Utils::Xml::<API key>(userIdNode.GetText());
m_userIdHasBeenSet = true;
}
}
return *this;
}
void PolicyUser::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(<API key>)
{
oStream << location << index << locationValue << ".UserName=" << StringUtils::URLEncode(m_userName.c_str()) << "&";
}
if(m_userIdHasBeenSet)
{
oStream << location << index << locationValue << ".UserId=" << StringUtils::URLEncode(m_userId.c_str()) << "&";
}
}
void PolicyUser::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(<API key>)
{
oStream << location << ".UserName=" << StringUtils::URLEncode(m_userName.c_str()) << "&";
}
if(m_userIdHasBeenSet)
{
oStream << location << ".UserId=" << StringUtils::URLEncode(m_userId.c_str()) << "&";
}
}
} // namespace Model
} // namespace IAM
} // namespace Aws
|
package com.artemis.annotations;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import com.artemis.EntityFactory;
/**
* Invokes setter on component, instead of invoking fields.
*
* @see EntityFactory
* @see Bind
* @see Sticky
*/
@Retention(SOURCE)
@Target(METHOD)
@Documented
public @interface UseSetter {
String value() default "";
}
|
function callbackfn(val, idx, obj) {
if (idx === 0) {
return val === 5;
} else {
return true;
}
}
var proto = {};
Object.defineProperty(proto, "0", {
get: function () {
return 5;
},
configurable: true
});
var Con = function () { };
Con.prototype = proto;
var child = new Con();
child.length = 2;
Object.defineProperty(child, "0", {
value: 11,
configurable: true
});
child[1] = 12;
assert.sameValue(Array.prototype.every.call(child, callbackfn), false, 'Array.prototype.every.call(child, callbackfn)');
|
# Maintained By: vraj@reciprocitylabs.com
from ggrc import db
from ggrc.models.directive import Directive
from ggrc.models.mixins import CustomAttributable
from ggrc.models.mixins import Described
from ggrc.models.mixins import Hierarchical
from ggrc.models.mixins import Hyperlinked
from ggrc.models.mixins import Noted
from ggrc.models.mixins import Slugged
from ggrc.models.mixins import Stateful
from ggrc.models.mixins import Titled
from ggrc.models.mixins import WithContact
from ggrc.models.mixins import deferred
from ggrc.models.object_document import Documentable
from ggrc.models.object_owner import Ownable
from ggrc.models.object_person import Personable
from ggrc.models.reflection import AttributeInfo
from ggrc.models.relationship import Relatable
from ggrc.models.relationship import Relationship
from ggrc.models.track_object_state import HasObjectState
from ggrc.models.track_object_state import <API key>
class Section(HasObjectState, Hierarchical, Noted, Described, Hyperlinked,
WithContact, Titled, Slugged, Stateful, db.Model,
CustomAttributable, Documentable, Personable,
Ownable, Relatable):
VALID_STATES = [
'Draft',
'Final',
'Effective',
'Ineffective',
'Launched',
'Not Launched',
'In Scope',
'Not in Scope',
'Deprecated',
]
__tablename__ = 'sections'
_table_plural = 'sections'
_title_uniqueness = True
_aliases = {
"url": "Section URL",
"description": "Text of Section",
"directive": {
"display_name": "Policy / Regulation / Standard / Contract",
"type": AttributeInfo.Type.MAPPING,
"filter_by": "<API key>",
}
}
na = deferred(db.Column(db.Boolean, default=False, nullable=False),
'Section')
notes = deferred(db.Column(db.Text), 'Section')
_publish_attrs = [
'na',
'notes',
]
_sanitize_html = ['notes']
_include_links = []
@classmethod
def <API key>(cls, predicate):
types = ["Policy", "Regulation", "Standard", "Contract"]
dst = Relationship.query \
.filter(
(Relationship.source_id == cls.id) &
(Relationship.source_type == cls.__name__) &
(Relationship.destination_type.in_(types))) \
.join(Directive, Directive.id == Relationship.destination_id) \
.filter(predicate(Directive.slug) | predicate(Directive.title)) \
.exists()
src = Relationship.query \
.filter(
(Relationship.destination_id == cls.id) &
(Relationship.destination_type == cls.__name__) &
(Relationship.source_type.in_(types))) \
.join(Directive, Directive.id == Relationship.source_id) \
.filter(predicate(Directive.slug) | predicate(Directive.title)) \
.exists()
return dst | src
<API key>(Section)
|
module ApplicationHelper
def classify( count_or_class, include_class_text = true )
if count_or_class.class == Fixnum
value = ( count_or_class % 2 == 0 ? 'even' : 'odd' )
else
value = count_or_class.to_s.downcase
end
if include_class_text
'class="' << value << '"'
else
value
end
end
end
|
#ifndef SG_IO_LINUX_H
#define SG_IO_LINUX_H
/*
* Version 1.03 [20120914]
*/
/*
* This header file contains linux specific information related to the SCSI
* command pass through in the SCSI generic (sg) driver and the linux
* block layer.
*/
#include "sg_lib.h"
#include "sg_linux_inc.h"
#ifdef __cplusplus
extern "C" {
#endif
/* The following are 'host_status' codes */
#ifndef DID_OK
#define DID_OK 0x00
#endif
#ifndef DID_NO_CONNECT
#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */
#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */
#define DID_TIME_OUT 0x03 /* Timed out for some other reason */
#define DID_BAD_TARGET 0x04 /* Bad target (id?) */
#define DID_ABORT 0x05 /* Told to abort for some other reason */
#define DID_PARITY 0x06 /* Parity error (on SCSI bus) */
#define DID_ERROR 0x07 /* Internal error */
#define DID_RESET 0x08 /* Reset by somebody */
#define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */
#define DID_PASSTHROUGH 0x0a /* Force command past mid-level */
#define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */
#endif
#ifndef DID_IMM_RETRY
#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */
#endif
#ifndef DID_REQUEUE
#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also
* without decrementing the retry count */
#endif
#ifndef <API key>
#define <API key> 0xe
#endif
#ifndef <API key>
#define <API key> 0xf
#endif
#ifndef DID_TARGET_FAILURE
#define DID_TARGET_FAILURE 0x10
#endif
#ifndef DID_NEXUS_FAILURE
#define DID_NEXUS_FAILURE 0x11
#endif
/* These defines are to isolate applications from kernel define changes */
#define SG_LIB_DID_OK DID_OK
#define <API key> DID_NO_CONNECT
#define SG_LIB_DID_BUS_BUSY DID_BUS_BUSY
#define SG_LIB_DID_TIME_OUT DID_TIME_OUT
#define <API key> DID_BAD_TARGET
#define SG_LIB_DID_ABORT DID_ABORT
#define SG_LIB_DID_PARITY DID_PARITY
#define SG_LIB_DID_ERROR DID_ERROR
#define SG_LIB_DID_RESET DID_RESET
#define SG_LIB_DID_BAD_INTR DID_BAD_INTR
#define <API key> DID_PASSTHROUGH
#define <API key> DID_SOFT_ERROR
#define <API key> DID_IMM_RETRY
#define SG_LIB_DID_REQUEUE DID_REQUEUE
#define <API key> <API key>
#define <API key> <API key>
#define <API key> DID_TARGET_FAILURE
#define <API key> DID_NEXUS_FAILURE
/* The following are 'driver_status' codes */
#ifndef DRIVER_OK
#define DRIVER_OK 0x00
#endif
#ifndef DRIVER_BUSY
#define DRIVER_BUSY 0x01
#define DRIVER_SOFT 0x02
#define DRIVER_MEDIA 0x03
#define DRIVER_ERROR 0x04
#define DRIVER_INVALID 0x05
#define DRIVER_TIMEOUT 0x06
#define DRIVER_HARD 0x07
#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */
/* Following "suggests" are "or-ed" with one of previous 8 entries */
#define SUGGEST_RETRY 0x10
#define SUGGEST_ABORT 0x20
#define SUGGEST_REMAP 0x30
#define SUGGEST_DIE 0x40
#define SUGGEST_SENSE 0x80
#define SUGGEST_IS_OK 0xff
#endif
#ifndef DRIVER_MASK
#define DRIVER_MASK 0x0f
#endif
#ifndef SUGGEST_MASK
#define SUGGEST_MASK 0xf0
#endif
/* These defines are to isolate applications from kernel define changes */
#define SG_LIB_DRIVER_OK DRIVER_OK
#define SG_LIB_DRIVER_BUSY DRIVER_BUSY
#define SG_LIB_DRIVER_SOFT DRIVER_SOFT
#define SG_LIB_DRIVER_MEDIA DRIVER_MEDIA
#define SG_LIB_DRIVER_ERROR DRIVER_ERROR
#define <API key> DRIVER_INVALID
#define <API key> DRIVER_TIMEOUT
#define SG_LIB_DRIVER_HARD DRIVER_HARD
#define SG_LIB_DRIVER_SENSE DRIVER_SENSE
#define <API key> SUGGEST_RETRY
#define <API key> SUGGEST_ABORT
#define <API key> SUGGEST_REMAP
#define SG_LIB_SUGGEST_DIE SUGGEST_DIE
#define <API key> SUGGEST_SENSE
#define <API key> SUGGEST_IS_OK
#define SG_LIB_DRIVER_MASK DRIVER_MASK
#define SG_LIB_SUGGEST_MASK SUGGEST_MASK
void <API key>(int masked_status);
void <API key>(int host_status);
void <API key>(int driver_status);
/* sg_chk_n_print() returns 1 quietly if there are no errors/warnings
else it prints errors/warnings (prefixed by 'leadin') to
'sg_warnings_fd' and returns 0. raw_sinfo indicates whether the
raw sense buffer (in ASCII hex) should be printed. */
int sg_chk_n_print(const char * leadin, int masked_status, int host_status,
int driver_status, const unsigned char * sense_buffer,
int sb_len, int raw_sinfo);
/* The following function declaration is for the sg version 3 driver. */
struct sg_io_hdr;
/* sg_chk_n_print3() returns 1 quietly if there are no errors/warnings;
else it prints errors/warnings (prefixed by 'leadin') to
'sg_warnings_fd' and returns 0. */
int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp,
int raw_sinfo);
/* Calls <API key>() after obtaining the sense buffer and
its length from the struct sg_io_hdr pointer. If these cannot be
obtained, 0 is returned. */
int sg_normalize_sense(const struct sg_io_hdr * hp,
struct sg_scsi_sense_hdr * sshp);
int sg_err_category(int masked_status, int host_status, int driver_status,
const unsigned char * sense_buffer, int sb_len);
int sg_err_category_new(int scsi_status, int host_status, int driver_status,
const unsigned char * sense_buffer, int sb_len);
/* The following function declaration is for the sg version 3 driver. */
int sg_err_category3(struct sg_io_hdr * hp);
/* Note about SCSI status codes found in older versions of Linux.
Linux has traditionally used a 1 bit right shifted and masked
version of SCSI standard status codes. Now CHECK_CONDITION
and friends (in <scsi/scsi.h>) are deprecated. */
#ifdef __cplusplus
}
#endif
#endif
|
# Examples
The examples in this directory are applications that can be run on your Mantl
cluster.
In each example directory is a README.md that provides the short and sweet
instructions. Below we go through the examples in more detail and provide more
of an introduction to what is going on.
## Getting a Cluster Up
# Vagrant
Getting the vagrant cluster up and running on your computer is the easiest way
to get a cluster going for the examples. To do this, see Getting Started in the
[README.md](../README.md) at root of this project.
If you have not done so yet, go ahead get vagrant up now. It will take a couple
of minutes and you can read on while you wait.
To run these examples you will need to know:
1. The url for marathon:
Marathon runs on port 8080 or at the /marathon endpoint, and if you look in
[the Vagrant README](../vagrant/README.rst), you will see that your control node
will by default have the IP "192.168.100.101" and your worker will have the IP
"192.168.100.201".
2. User name and password for marathon:
After you have run`./security-setup` in the root of this project, there will be
a file `security.yml`. Inside this file is the line:
<API key>: admin:hardpass
During your run of `./security-setup` you will be asked to set an admin
password:
$ ./security-setup
========== Certificates =============
-> certificate authority
created serial
created index
generated root CA
============= Nginx =================
-> SSL certificate
generated nginx key
generated nginx CSR
generated nginx certificate
nginx certificate is valid
-> admin password
Admin Password:
which is the password used for Marathon.
Other Clusters
If you want to dive right into a cloud cluster go through
[Getting Started](https://docs.mantl.io/en/latest/getting_started/index.html)
at the Documentation site. You can then change the relevant parts of the
following instructions.
Submitting Applications to The Marathon API
While in a terminal, in this examples directory enter:
$ curl -k -X POST -H "Content-Type: application/json" -u "admin:hardpass" -d@"hello-world/hello-world.json" "https://192.168.100.101/marathon/v2/apps"
You should get back something like:
{"id":"/hello-world","cmd":null,"args":null,"user":null,"env":{},"instances":2,"cpus":0.1,"mem":128.0,"disk":0.0,"executor":"","constraints":[],"uris":[],"storeUrls":[],"ports":[0],"requirePorts":false,"backoffFactor":1.15,"container":{"type":"DOCKER","volumes":[],"docker":{"image":"keithchambers/docker-hello-world","network":"BRIDGE","portMappings":[{"containerPort":80,"hostPort":0,"servicePort":0,"protocol":"tcp"}],"privileged":false,"parameters":[],"forcePullImage":false}},"healthChecks":[],"dependencies":[],"upgradeStrategy":{"<API key>":1.0,"maximumOverCapacity":1.0},"labels":{},"<API key>":null,"version":"2015-12-14T05:53:13.140Z","deployments":[{"id":"<API key>"}],"tasks":[],"tasksStaged":0,"tasksRunning":0,"tasksHealthy":0,"tasksUnhealthy":0,"backoffSeconds":1,"<API key>":3600}
If not perhaps you messed up an option. Here is what they do:
Option -k turns off ssl certificate verification. Mantl, by default, uses
self-signed certificates. If you forgot the -k you get this message:
$ curl -X POST -H "Content-Type: application/json" -u "admin:hardpass" -d@"hello-world/hello-world.json" "https://192.168.100.101/marathon/v2/apps"
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
Option -X allows you to specify a HTTP verb other than the default GET. In this
case we want to POST. The following error happens if we forget the -X or the
`-d@"file.json"`, or possibly because you are submiting the command from the
wrong directory (i.e. you should change the path to `file.json`).
$ curl -k -H "Content-Type: application/json" -u "admin:hardpass" -d@"hello-world/hello-world.json" "https://192.168.100.101/marathon/v2/apps"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 400 Bad Content-Type header value: 'application/json '</title>
</head>
<body>
<h2>HTTP ERROR: 400</h2>
<p>Problem accessing /v2/apps. Reason:
<pre> Bad Content-Type header value: 'application/json '</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
Option -H specifies a header argument. In this case we want to set the content type to json. If you leave this off
you will get:
$ curl -k -X POST -u "admin:hardpass" -d@"hello-world/hello-world.json" "https://192.168.100.101/marathon/v2/apps"
curl: (6) Could not resolve host:
{"message":"Unsupported Media Type"}
The Marathon API and the Application JSON
In the curl call we went to the following path `/v2/apps`. This is the API call
for creating and starting new apps.
See [Marathon REST API](https://mesosphere.github.io/marathon/docs/rest-api.html) for further calls. Two handy ones for our purposes are:
## Current Status
From this REST API, get current status with:
curl -k -u "admin:hardpass" "https://192.168.100.101/marathon/v2/apps/hello-world"
which returns a big blob of json. If you want this cleaned up a bit try adding `| python -m json.tool` :
curl -k -u "admin:hardpass" "https://192.168.100.101/marathon/v2/apps/hello-world" | python -m json.tool
That should give you a nicely formated output of the current state of the app.
Notice that we didn't need headers `-H` and the http verb was the default GET,
so we didn't need `-X`. We still needed the -k to get around our self signed ssl
certificate.
## Delete App
From this REST API, the call to destroy the application is:
curl -k -X DELETE -u "admin:hardpass" "https://192.168.100.101/marathon/v2/apps/hello-world"
which is the same as the current status path but with the HTTP DELETE verb
instead of the default GET. If the call is successful you will get something
like:
{"version":"2015-12-14T06:44:37.378Z","deploymentId":"<API key>"}
Now you can check the status again, as per the previous section. It should give
you `{"message":"App '/hello-world' does not exist"}`.
## Where is my Application?
In a browser, go to the IP of one of your vagrant control nodes. (Some browsers,
like Firefox, will outright reject the SSL certificate, so you may need to use
another for this step). This will be the value in your Vagrantfile as described
earlier.

Choose the Marathon "Web UI" button and you should see something like this:

Click on your application, hello-world (if its not there, you probably deleted
it while working through the steps above, but you can just start it again.)
and you should see:

You'll notice that there are two instances. Each one has a line under it in
gray `default:<
these are ports 9061 and 25312.
If there aren't two instances, see step 2 under "Destroy the Vagrant Cluster and
Build on for Minecraft" to add more memory to your VMs.
There are two instances here becasue the hello-world.json file you submitted
specifies for two instances to be created. This is two seperate hello-world
applications, possibly running on different hosts.
If you click on the `worker-001:9061` it will open your browser to
`worker-001:9061` and get a `webpage is not avaiable` error. This is because you
don't have `worker-001` mapped to the Vagrant VM's IP address in your hosts
file. Rather than mess with that, you can just take the port information and add
it to the IP of where we know the Vagrant machine is located. Open the browser
to `<VM-IP>:9061` and you'll see:

Note that it has the container number in it. If you go back and look at
Marathon, you can navigate to the other port and find the other container.
If you look into the json file for [hello world](hello-world/hello-world.json)
you will see that you are submiting a call to create two instances of a docker
image: `"image": "keithchambers/docker-hello-world"`. You can see the the [php code running in this container](https://github.com/keithchambers/docker-hello-world/blob/master/index.php).
## Destroy the Vagrant Cluster and Build on for Minecraft
If you want to use the vagrant cluster for the Minecraft example you have to
make a worker VM with more resources. Minecraft requires 2GB of RAM free for
good performance.
Easy enough! If you have the resources on your computer, you can
1. Destroy your vagrant server. Go to the project root and type:
vagrant destroy
2. Create a `vagrant-config.yml` file in the root directory, and add
worker_memory: 3072
as documented in the [Vagrant README](../vagrant/README.rst).
3. Run
vagrant up
Once your cluster comes up, you can post the application to Marathon like in the
previous example, but with the data option changed to
`-d@"minecraft/minecraft.json"`. If your VMs don't have enough resources, the
app will be stuck "deploying" in the Marathon UI:

Notice the /minecraft app has a Memory(MB) value of 2048, which indicates that
it is requesting 2GB of RAM. This value is from the
[json file you submitted](minecraft/minecraft.json).
To investigate, go back to the Mantl UI and then navigate to the Mesos "Web UI".

You might see that no Minecraft task is running. If you look down the side
you'll see that the "total offered" is 0 and there is some quantity of memory
idle. The request on the Marathon page above is for 2048 MB, there might not be
enough, so Marathon will wait until the requested resources are available.
With the right amount of memory and the Minecraft successfully running, you can
can check the status of the application as described above using the Marathon
API, and near the bottom of the listing there should be a list of tasks. It
should look like this:
"tasks": [
{
"appId": "/minecraft",
"healthCheckResults": [
{
"alive": true,
"consecutiveFailures": 0,
"firstSuccess": "2015-12-14T08:25:32.032Z",
"lastFailure": null,
"lastSuccess": "2015-12-14T08:25:32.032Z",
"taskId": "minecraft.<API key>"
}
],
"host": "default",
"id": "minecraft.<API key>",
"ports": [
9199
],
"stagedAt": "2015-12-14T08:24:36.469Z",
"startedAt": "2015-12-14T08:25:22.424Z",
"version": "2015-12-14T08:24:31.818Z"
}
],
In this example, the task with appId "/minecraft" on host "default" is
listening on port 9199. With that information, you can open your Minecraft
client and connect to `<VM-IP>:<minecraft-port>`. Happy mining!
|
package com.linkedin.thirdeye.function;
import com.google.common.base.Joiner;
import com.google.common.collect.Range;
import com.linkedin.thirdeye.api.AnomalyFunctionSpec;
import com.linkedin.thirdeye.api.AnomalyResult;
import com.linkedin.thirdeye.api.DimensionKey;
import com.linkedin.thirdeye.api.MetricTimeSeries;
import com.linkedin.thirdeye.lib.scanstatistics.ScanStatistics;
import com.linkedin.thirdeye.lib.util.<API key>;
import com.linkedin.thirdeye.lib.util.STLDecomposition;
import org.apache.commons.math3.util.Pair;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class <API key> extends BaseAnomalyFunction {
private static Logger LOGGER = LoggerFactory.getLogger(<API key>.class);
private static final Joiner CSV = Joiner.on(",");
private static final String <API key> = "168";
private static final String <API key> = "0.05";
private static final String <API key> = "1";
private static final String <API key> = "1000";
private static final String <API key> = "1";
private static final String <API key> = "" + TimeUnit.DAYS.toHours(7);
private static final String <API key> = "false";
private static final String <API key> = "0.5";
private static final String <API key> = "168"; // 1 week in hours
private static final String <API key> = "false";
private static final String <API key> = "0.1";
public static final String SEASONAL = "seasonal";
public static final String MAX_WINDOW_LENGTH = "maxWindowLength";
public static final String NUM_SIMULATIONS = "numSimulations";
public static final String MIN_WINDOW_LENGTH = "minWindowLength";
public static final String P_VALUE_THRESHOLD = "pValueThreshold";
public static final String PATTERN = "pattern";
public static final String MIN_INCREMENT = "minIncrement";
public static final String BOOTSTRAP = "bootstrap";
public static final String STL_TREND_BANDWIDTH = "stlTrendBandwidth";
public static final String MONITORING_WINDOW = "monitoringWindow";
public static final String NOT_EQUAL_EPSILON = "notEqualEpsilon";
private int seasonal;
private int maxWindowLength;
private int numSimulations;
private int minWindowLength;
private double pValueThreshold;
private ScanStatistics.Pattern pattern;
private int minIncrement;
private boolean bootstrap;
private double stlTrendBandwidth;
private int monitoringWindow;
private double notEqualEpsilon;
@Override
public void init(AnomalyFunctionSpec spec) throws Exception {
super.init(spec);
Properties props = getProperties();
this.seasonal = Integer.valueOf(props.getProperty(SEASONAL, <API key>));
this.maxWindowLength = Integer.valueOf(props.getProperty(MAX_WINDOW_LENGTH, <API key>));
this.numSimulations = Integer.valueOf(props.getProperty(NUM_SIMULATIONS, <API key>));
this.minWindowLength = Integer.valueOf(props.getProperty(MIN_WINDOW_LENGTH, <API key>));
this.pValueThreshold = Double.valueOf(props.getProperty(P_VALUE_THRESHOLD, <API key>));
this.pattern = ScanStatistics.Pattern.valueOf(props.getProperty(PATTERN));
this.minIncrement = Integer.valueOf(props.getProperty(MIN_INCREMENT, <API key>));
this.bootstrap = Boolean.valueOf(props.getProperty(BOOTSTRAP, <API key>));
this.stlTrendBandwidth = Double.valueOf(props.getProperty(STL_TREND_BANDWIDTH, <API key>));
this.monitoringWindow = Integer.valueOf(props.getProperty(MONITORING_WINDOW, <API key>));
this.notEqualEpsilon = Double.valueOf(props.getProperty(NOT_EQUAL_EPSILON, <API key>));
}
@Override
public List<AnomalyResult> analyze(DimensionKey dimensionKey,
MetricTimeSeries timeSeries,
DateTime windowStart,
DateTime windowEnd,
List<AnomalyResult> knownAnomalies) throws Exception {
long bucketMillis = getSpec().getBucketUnit().toMillis(getSpec().getBucketSize());
String metric = getSpec().getMetric();
// Compute the weight of this time series (average across whole)
double averageValue = 0;
for (Long time : timeSeries.getTimeWindowSet()) {
averageValue += timeSeries.get(time, metric).doubleValue();
}
long numBuckets = (windowEnd.getMillis() - windowStart.getMillis()) / bucketMillis;
averageValue /= numBuckets;
// convert the data to arrays
Pair<long[], double[]> arraysFromSeries = <API key>.toArray(timeSeries, metric, bucketMillis,
null, Double.NaN);
long[] timestamps = arraysFromSeries.getFirst();
double[] observations = arraysFromSeries.getSecond();
<API key>(observations);
// call stl library
double[] <API key> = removeSeasonality(timestamps, observations, seasonal);
int <API key> = (int) ((windowEnd.getMillis() - windowStart.getMillis()) / bucketMillis);
<API key> = Math.min(<API key>, maxWindowLength);
// instantiate model
ScanStatistics scanStatistics = new ScanStatistics(
numSimulations,
minWindowLength,
<API key>,
pValueThreshold,
pattern,
minIncrement,
bootstrap,
notEqualEpsilon);
LOGGER.info("Created {}", scanStatistics);
int totalNumBuckets = <API key>.length;
int numTrain = totalNumBuckets - monitoringWindow;
// set of timestamps with anomalies
Set<Long> anomalousTimestamps = new HashSet<Long>();
for (AnomalyResult ar : knownAnomalies) {
anomalousTimestamps.add(ar.getStartTimeUtc()); // TODO: Shouldn't this be an interval?
}
// partition the data into train and monitoring
double[] trainingData = Arrays.copyOfRange(<API key>, 0, numTrain);
long[] trainingTimestamps = Arrays.copyOfRange(timestamps, 0, numTrain);
double[] <API key> = removeAnomalies(trainingTimestamps, trainingData, anomalousTimestamps);
double[] monitoringData = Arrays.copyOfRange(<API key>, numTrain,
<API key>.length);
double[] monitoringDataOrig = Arrays.copyOfRange(observations, numTrain, observations.length);
long[] <API key> = Arrays.copyOfRange(timestamps, numTrain, <API key>.length);
// get anomalous interval if any
LOGGER.info("detecting anomalies using scan statistics");
long startTime = System.nanoTime();
Range<Integer> anomalousInterval = scanStatistics.getInterval(<API key>, monitoringData);
LOGGER.info("scan statistics took {} seconds", TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startTime));
if (anomalousInterval != null) {
LOGGER.info("found interval : {}", anomalousInterval);
}
// convert interval result to points
List<AnomalyResult> anomalyResults = new ArrayList<AnomalyResult>();
if (anomalousInterval != null) {
anomalyResults = <API key>(
dimensionKey,
monitoringDataOrig,
<API key>,
anomalousInterval,
averageValue);
}
return anomalyResults;
}
/**
* @return
* Only anomaly results for the start and end of the interval.
*/
private List<AnomalyResult> <API key>(
DimensionKey dimensionKey,
double[] monitoringData,
long[] <API key>,
Range<Integer> anomalousInterval,
double averageValue) {
long startTimeUtc = <API key>[anomalousInterval.lowerEndpoint()];
long endTimeUtc = <API key>[anomalousInterval.upperEndpoint() - 1 /* inclusive */];
List<AnomalyResult> anomalyResults = new ArrayList<AnomalyResult>();
Properties startProperties = new Properties();
startProperties.setProperty("anomalyStart", new DateTime(startTimeUtc, DateTimeZone.UTC).toString());
startProperties.setProperty("anomalyEnd", new DateTime(endTimeUtc, DateTimeZone.UTC).toString());
startProperties.setProperty("bound", "START");
AnomalyResult startResult = new AnomalyResult();
startResult.setScore(pValueThreshold); // TODO: is this right?
startResult.setProperties(AnomalyResult.<API key>(startProperties));
startResult.setWeight(averageValue);
startResult.setStartTimeUtc(startTimeUtc);
startResult.setEndTimeUtc(endTimeUtc);
startResult.setCollection(getSpec().getCollection());
startResult.setDimensions(CSV.join(dimensionKey.getDimensionValues()));
startResult.setFunctionId(getSpec().getId());
startResult.setMetric(getSpec().getMetric());
anomalyResults.add(startResult);
return anomalyResults;
}
/**
* @return
* The data with anomalies removed. Timestamps will no longer match this array.
*/
private double[] removeAnomalies(long[] timestamps, double[] data, Set<Long> anomalousTimestamps) {
int collapsedIdx = 0;
double[] <API key> = new double[timestamps.length];
for (int i = 0; i < timestamps.length; i++) {
if (anomalousTimestamps.contains(timestamps[i])) {
continue;
} else {
<API key>[collapsedIdx] = data[i];
collapsedIdx++;
}
}
return Arrays.copyOf(<API key>, collapsedIdx);
}
/**
* @param arr
* The array whose NaN values will be removed
*
* Note, the first data point cannot be a hole by construction from the conversion of MetricTimeSeries with
* (min, max) times.
* (TODO): linear interpolation for missing data later.
*/
public static void <API key>(double[] arr) {
for (int i = 0; i < arr.length; i++) {
if (Double.isNaN(arr[i])) {
double sum = 0.0;
int count = 0;
if (i - 1 >= 0 && !Double.isNaN(arr[i - 1])) {
sum += arr[i - 1];
count++;
}
if (i + 1 < arr.length && !Double.isNaN(arr[i + 1])) {
sum += arr[i + 1];
count++;
}
arr[i] = sum / count;
}
}
}
private double[] removeSeasonality(long[] timestamps, double[] series, int seasonality) {
STLDecomposition.Config config = new STLDecomposition.Config();
config.<API key>(seasonality);
config.<API key>(1);
config.<API key>(15);
/*
* There isn't a particularly good reason to use these exact values other than that the results closely match the
* stl R library results. It would appear than setting these anywhere between [0.5, 1.0} produces similar results.
*/
config.<API key>(0.5);
config.<API key>(stlTrendBandwidth); // default is 0.5
config.setPeriodic(true);
config.<API key>(series.length);
STLDecomposition stl = new STLDecomposition(config);
STLDecomposition.STLResult res = stl.decompose(timestamps, series);
double[] trend = res.getTrend();
double[] remainder = res.getRemainder();
double[] seasonalityRemoved = new double[trend.length];
for (int i = 0; i < trend.length; i++) {
seasonalityRemoved[i] = trend[i] + remainder[i];
}
return seasonalityRemoved;
}
}
|
package org.locationtech.geomesa.index.index.z2.legacy
import org.locationtech.geomesa.curve.{LegacyZ2SFC, Z2SFC}
import org.locationtech.geomesa.index.api.ShardStrategy
import org.locationtech.geomesa.index.api.ShardStrategy.ZShardStrategy
import org.locationtech.geomesa.index.geotools.GeoMesaDataStore
import org.locationtech.geomesa.index.index.LegacyTableNaming
import org.locationtech.geomesa.index.index.z2.legacy.Z2IndexV3.Z2IndexKeySpaceV3
import org.locationtech.geomesa.index.index.z2.legacy.Z2IndexV4.Z2IndexKeySpaceV4
import org.locationtech.geomesa.index.index.z2.{Z2IndexKeySpace, Z2IndexValues}
import org.locationtech.geomesa.utils.index.IndexMode.IndexMode
import org.opengis.feature.simple.SimpleFeatureType
// legacy z curve - no delete checks for old col qualifiers
class Z2IndexV3 protected (ds: GeoMesaDataStore[_], sft: SimpleFeatureType, version: Int, geom: String, mode: IndexMode)
extends Z2IndexV4(ds, sft, version, geom, mode) with LegacyTableNaming[Z2IndexValues, Long] {
import org.locationtech.geomesa.utils.geotools.<API key>.<API key>
def this(ds: GeoMesaDataStore[_], sft: SimpleFeatureType, geom: String, mode: IndexMode) =
this(ds, sft, 3, geom, mode)
override val keySpace: Z2IndexKeySpace =
new Z2IndexKeySpaceV3(sft, sft.<API key>, ZShardStrategy(sft), geom)
}
object Z2IndexV3 {
class Z2IndexKeySpaceV3(sft: SimpleFeatureType,
sharing: Array[Byte],
sharding: ShardStrategy,
geomField: String) extends Z2IndexKeySpaceV4(sft, sharing, sharding, geomField) {
override protected val sfc: Z2SFC = LegacyZ2SFC
}
}
|
package org.jgroups.util;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class Range implements SizeStreamable, Comparable<Range> {
public long low=-1; // first msg to be retransmitted
public long high=-1; // last msg to be retransmitted
/** For externalization */
public Range() {
}
public Range(long low, long high) {
this.low=low; this.high=high;
}
public String toString() {
return "[" + low + " : " + high + ']';
}
public int compareTo(Range other) {
if(low == other.low && high == other.high)
return 0;
return low < other.low? -1 : 1;
}
public int hashCode() {
return (int)low;
}
public boolean equals(Object obj) {
Range other=(Range)obj;
return compareTo(other) == 0;
}
@Override
public void writeTo(DataOutput out) throws IOException {
Bits.writeLongSequence(low, high, out);
}
@Override
public void readFrom(DataInput in) throws IOException {
long[] seqnos={0,0};
Bits.readLongSequence(in, seqnos, 0);
low=seqnos[0];
high=seqnos[1];
}
@Override
public int serializedSize() {
return Bits.size(low, high);
}
}
|
package agent
import (
"bytes"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/hashicorp/consul/agent/consul/autopilot"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/testutil/retry"
)
func <API key>(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("GET", "/v1/operator/raft/configuration", body)
resp := httptest.NewRecorder()
obj, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 200 {
t.Fatalf("bad code: %d", resp.Code)
}
out, ok := obj.(structs.<API key>)
if !ok {
t.Fatalf("unexpected: %T", obj)
}
if len(out.Servers) != 1 ||
!out.Servers[0].Leader ||
!out.Servers[0].Voter {
t.Fatalf("bad: %v", out)
}
}
func <API key>(t *testing.T) {
t.Parallel()
t.Run("", func(t *testing.T) {
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("DELETE", "/v1/operator/raft/peer?address=nope", body)
// If we get this error, it proves we sent the address all the
// way through.
resp := httptest.NewRecorder()
_, err := a.srv.OperatorRaftPeer(resp, req)
if err == nil || !strings.Contains(err.Error(),
"address \"nope\" was not found in the Raft configuration") {
t.Fatalf("err: %v", err)
}
})
t.Run("", func(t *testing.T) {
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("DELETE", "/v1/operator/raft/peer?id=nope", body)
// If we get this error, it proves we sent the ID all the
// way through.
resp := httptest.NewRecorder()
_, err := a.srv.OperatorRaftPeer(resp, req)
if err == nil || !strings.Contains(err.Error(),
"id \"nope\" was not found in the Raft configuration") {
t.Fatalf("err: %v", err)
}
})
}
func <API key>(t *testing.T) {
t.Parallel()
oldKey := "H3/9gBxcKKRf45CaI2DlRg=="
newKey := "<API key>=="
a := NewTestAgent(t.Name(), `
encrypt = "`+oldKey+`"
`)
defer a.Shutdown()
body := bytes.NewBufferString(fmt.Sprintf("{\"Key\":\"%s\"}", newKey))
req, _ := http.NewRequest("POST", "/v1/operator/keyring", body)
resp := httptest.NewRecorder()
_, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %s", err)
}
listResponse, err := a.ListKeys("", 0)
if err != nil {
t.Fatalf("err: %s", err)
}
if len(listResponse.Responses) != 2 {
t.Fatalf("bad: %d", len(listResponse.Responses))
}
for _, response := range listResponse.Responses {
count, ok := response.Keys[newKey]
if !ok {
t.Fatalf("bad: %v", response.Keys)
}
if count != response.NumNodes {
t.Fatalf("bad: %d, %d", count, response.NumNodes)
}
}
}
func <API key>(t *testing.T) {
t.Parallel()
key := "H3/9gBxcKKRf45CaI2DlRg=="
a := NewTestAgent(t.Name(), `
encrypt = "`+key+`"
`)
defer a.Shutdown()
req, _ := http.NewRequest("GET", "/v1/operator/keyring", nil)
resp := httptest.NewRecorder()
r, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
responses, ok := r.([]*structs.KeyringResponse)
if !ok {
t.Fatalf("err: %v", !ok)
}
// Check that we get both a LAN and WAN response, and that they both only
// contain the original key
if len(responses) != 2 {
t.Fatalf("bad: %d", len(responses))
}
// WAN
if len(responses[0].Keys) != 1 {
t.Fatalf("bad: %d", len(responses[0].Keys))
}
if !responses[0].WAN {
t.Fatalf("bad: %v", responses[0].WAN)
}
if _, ok := responses[0].Keys[key]; !ok {
t.Fatalf("bad: %v", ok)
}
// LAN
if len(responses[1].Keys) != 1 {
t.Fatalf("bad: %d", len(responses[1].Keys))
}
if responses[1].WAN {
t.Fatalf("bad: %v", responses[1].WAN)
}
if _, ok := responses[1].Keys[key]; !ok {
t.Fatalf("bad: %v", ok)
}
}
func <API key>(t *testing.T) {
t.Parallel()
key := "H3/9gBxcKKRf45CaI2DlRg=="
tempKey := "<API key>=="
a := NewTestAgent(t.Name(), `
encrypt = "`+key+`"
`)
defer a.Shutdown()
_, err := a.InstallKey(tempKey, "", 0)
if err != nil {
t.Fatalf("err: %v", err)
}
// Make sure the temp key is installed
list, err := a.ListKeys("", 0)
if err != nil {
t.Fatalf("err: %v", err)
}
responses := list.Responses
if len(responses) != 2 {
t.Fatalf("bad: %d", len(responses))
}
for _, response := range responses {
if len(response.Keys) != 2 {
t.Fatalf("bad: %d", len(response.Keys))
}
if _, ok := response.Keys[tempKey]; !ok {
t.Fatalf("bad: %v", ok)
}
}
body := bytes.NewBufferString(fmt.Sprintf("{\"Key\":\"%s\"}", tempKey))
req, _ := http.NewRequest("DELETE", "/v1/operator/keyring", body)
resp := httptest.NewRecorder()
if _, err := a.srv.<API key>(resp, req); err != nil {
t.Fatalf("err: %s", err)
}
// Make sure the temp key has been removed
list, err = a.ListKeys("", 0)
if err != nil {
t.Fatalf("err: %v", err)
}
responses = list.Responses
if len(responses) != 2 {
t.Fatalf("bad: %d", len(responses))
}
for _, response := range responses {
if len(response.Keys) != 1 {
t.Fatalf("bad: %d", len(response.Keys))
}
if _, ok := response.Keys[tempKey]; ok {
t.Fatalf("bad: %v", ok)
}
}
}
func <API key>(t *testing.T) {
t.Parallel()
oldKey := "H3/9gBxcKKRf45CaI2DlRg=="
newKey := "<API key>=="
a := NewTestAgent(t.Name(), `
encrypt = "`+oldKey+`"
`)
defer a.Shutdown()
if _, err := a.InstallKey(newKey, "", 0); err != nil {
t.Fatalf("err: %v", err)
}
body := bytes.NewBufferString(fmt.Sprintf("{\"Key\":\"%s\"}", newKey))
req, _ := http.NewRequest("PUT", "/v1/operator/keyring", body)
resp := httptest.NewRecorder()
_, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %s", err)
}
if _, err := a.RemoveKey(oldKey, "", 0); err != nil {
t.Fatalf("err: %v", err)
}
// Make sure only the new key remains
list, err := a.ListKeys("", 0)
if err != nil {
t.Fatalf("err: %v", err)
}
responses := list.Responses
if len(responses) != 2 {
t.Fatalf("bad: %d", len(responses))
}
for _, response := range responses {
if len(response.Keys) != 1 {
t.Fatalf("bad: %d", len(response.Keys))
}
if _, ok := response.Keys[newKey]; !ok {
t.Fatalf("bad: %v", ok)
}
}
}
func <API key>(t *testing.T) {
t.Parallel()
key := "H3/9gBxcKKRf45CaI2DlRg=="
a := NewTestAgent(t.Name(), `
encrypt = "`+key+`"
`)
defer a.Shutdown()
cases := map[string]string{
"999": "Relay factor must be in range",
"asdf": "Error parsing relay factor",
}
for relayFactor, errString := range cases {
req, _ := http.NewRequest("GET", "/v1/operator/keyring?relay-factor="+relayFactor, nil)
resp := httptest.NewRecorder()
_, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
body := resp.Body.String()
if !strings.Contains(body, errString) {
t.Fatalf("bad: %v", body)
}
}
}
func <API key>(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("GET", "/v1/operator/autopilot/configuration", body)
resp := httptest.NewRecorder()
obj, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 200 {
t.Fatalf("bad code: %d", resp.Code)
}
out, ok := obj.(api.<API key>)
if !ok {
t.Fatalf("unexpected: %T", obj)
}
if !out.CleanupDeadServers {
t.Fatalf("bad: %#v", out)
}
}
func <API key>(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
body := bytes.NewBuffer([]byte(`{"CleanupDeadServers": false}`))
req, _ := http.NewRequest("PUT", "/v1/operator/autopilot/configuration", body)
resp := httptest.NewRecorder()
if _, err := a.srv.<API key>(resp, req); err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 200 {
t.Fatalf("bad code: %d", resp.Code)
}
args := structs.DCSpecificRequest{
Datacenter: "dc1",
}
var reply autopilot.Config
if err := a.RPC("Operator.<API key>", &args, &reply); err != nil {
t.Fatalf("err: %v", err)
}
if reply.CleanupDeadServers {
t.Fatalf("bad: %#v", reply)
}
}
func <API key>(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
body := bytes.NewBuffer([]byte(`{"CleanupDeadServers": false}`))
req, _ := http.NewRequest("PUT", "/v1/operator/autopilot/configuration", body)
resp := httptest.NewRecorder()
if _, err := a.srv.<API key>(resp, req); err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 200 {
t.Fatalf("bad code: %d", resp.Code)
}
args := structs.DCSpecificRequest{
Datacenter: "dc1",
}
var reply autopilot.Config
if err := a.RPC("Operator.<API key>", &args, &reply); err != nil {
t.Fatalf("err: %v", err)
}
if reply.CleanupDeadServers {
t.Fatalf("bad: %#v", reply)
}
// Create a CAS request, bad index
{
buf := bytes.NewBuffer([]byte(`{"CleanupDeadServers": true}`))
req, _ := http.NewRequest("PUT", fmt.Sprintf("/v1/operator/autopilot/configuration?cas=%d", reply.ModifyIndex-1), buf)
resp := httptest.NewRecorder()
obj, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
if res := obj.(bool); res {
t.Fatalf("should NOT work")
}
}
// Create a CAS request, good index
{
buf := bytes.NewBuffer([]byte(`{"CleanupDeadServers": true}`))
req, _ := http.NewRequest("PUT", fmt.Sprintf("/v1/operator/autopilot/configuration?cas=%d", reply.ModifyIndex), buf)
resp := httptest.NewRecorder()
obj, err := a.srv.<API key>(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
if res := obj.(bool); !res {
t.Fatalf("should work")
}
}
// Verify the update
if err := a.RPC("Operator.<API key>", &args, &reply); err != nil {
t.Fatalf("err: %v", err)
}
if !reply.CleanupDeadServers {
t.Fatalf("bad: %#v", reply)
}
}
func <API key>(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), `
raft_protocol = 3
`)
defer a.Shutdown()
body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("GET", "/v1/operator/autopilot/health", body)
retry.Run(t, func(r *retry.R) {
resp := httptest.NewRecorder()
obj, err := a.srv.<API key>(resp, req)
if err != nil {
r.Fatalf("err: %v", err)
}
if resp.Code != 200 {
r.Fatalf("bad code: %d", resp.Code)
}
out, ok := obj.(*api.OperatorHealthReply)
if !ok {
r.Fatalf("unexpected: %T", obj)
}
if len(out.Servers) != 1 ||
!out.Servers[0].Healthy ||
out.Servers[0].Name != a.Config.NodeName ||
out.Servers[0].SerfStatus != "alive" ||
out.FailureTolerance != 0 {
r.Fatalf("bad: %v", out)
}
})
}
func <API key>(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), `
raft_protocol = 3
autopilot {
<API key> = "-1s"
}
`)
defer a.Shutdown()
body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("GET", "/v1/operator/autopilot/health", body)
retry.Run(t, func(r *retry.R) {
resp := httptest.NewRecorder()
obj, err := a.srv.<API key>(resp, req)
if err != nil {
r.Fatalf("err: %v", err)
}
if resp.Code != 429 {
r.Fatalf("bad code: %d", resp.Code)
}
out, ok := obj.(*api.OperatorHealthReply)
if !ok {
r.Fatalf("unexpected: %T", obj)
}
if len(out.Servers) != 1 ||
out.Healthy ||
out.Servers[0].Name != a.Config.NodeName {
r.Fatalf("bad: %#v", out.Servers)
}
})
}
|
package test.testng93;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* This class/interface
*/
public class SingleTestTest {
@BeforeMethod(groups={"group1"})
public void shouldRunBefore() {
System.out.println("Runs before");
}
@Test(groups={"group1"})
public void theFirstActualTest() {
System.out.println("The first actual test");
}
@Test
public void theSecondActualTest() {
System.out.println("The second actual test");
}
}
|
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/retail/v2/common.proto
namespace Google\Cloud\Retail\V2;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* [Product][google.cloud.retail.v2.Product] thumbnail/detail image.
*
* Generated from protobuf message <code>google.cloud.retail.v2.Image</code>
*/
class Image extends \Google\Protobuf\Internal\Message
{
private $uri = '';
/**
* Height of the image in number of pixels.
* This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
* returned.
*
* Generated from protobuf field <code>int32 height = 2;</code>
*/
private $height = 0;
/**
* Width of the image in number of pixels.
* This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
* returned.
*
* Generated from protobuf field <code>int32 width = 3;</code>
*/
private $width = 0;
public function __construct($data = NULL) {
\GPBMetadata\Google\Cloud\Retail\V2\Common::initOnce();
parent::__construct($data);
}
public function getUri()
{
return $this->uri;
}
public function setUri($var)
{
GPBUtil::checkString($var, True);
$this->uri = $var;
return $this;
}
/**
* Height of the image in number of pixels.
* This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
* returned.
*
* Generated from protobuf field <code>int32 height = 2;</code>
* @return int
*/
public function getHeight()
{
return $this->height;
}
/**
* Height of the image in number of pixels.
* This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
* returned.
*
* Generated from protobuf field <code>int32 height = 2;</code>
* @param int $var
* @return $this
*/
public function setHeight($var)
{
GPBUtil::checkInt32($var);
$this->height = $var;
return $this;
}
/**
* Width of the image in number of pixels.
* This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
* returned.
*
* Generated from protobuf field <code>int32 width = 3;</code>
* @return int
*/
public function getWidth()
{
return $this->width;
}
/**
* Width of the image in number of pixels.
* This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
* returned.
*
* Generated from protobuf field <code>int32 width = 3;</code>
* @param int $var
* @return $this
*/
public function setWidth($var)
{
GPBUtil::checkInt32($var);
$this->width = $var;
return $this;
}
}
|
import { Component, Input } from '@angular/core';
@Component({
// tslint:disable-next-line: component-selector
selector: 'input-date',
template: `<input type="date" [value]="date | date:'yyyy-MM-dd'" (change)="date = $event.target.value"
[min]="min" [max]="max">`
})
export class InputDateComponent {
@Input() model: { [key: string]: any };
@Input() property: string;
@Input() min: string;
@Input() max: string;
get date() {
return this.model[this.property];
}
set date(value: string) {
const newDate = new Date(value);
if (!isNaN(newDate.getFullYear())) {
this.model[this.property] = newDate;
}
}
}
|
@import 'https://fonts.googleapis.com/css?family=Montserrat';
@import 'https://fonts.googleapis.com/css?family=Abel';
html,body {
font-family: 'Montserrat', sans-serif;
}
section{
padding: 20px 0;
padding-top:100px;
}
section h1 {
font-size: 40px;
}
section h4.text-center {
font-style: italic;
font-weight: 300;
margin-bottom: 40px;
}
/* navbar*/
.navbar-c{
position: fixed;
z-index: 100;
top: 18px;
width: 100%;
height: 100px;
/*transition: all 0.3s;*/
border:0;
}
.navbar-toggle{
padding: 0;
padding-top: 20px;
margin-right: 40px;
}
.icon-bar {
background-color: #fff;
}
.navbar-c .navbar-header, .navbar-c .navbar-brand{
height: 90px ;
}
.shrink {
position: fixed;
top:0;
height: 80px;
background-color: #000;
border-radius:0;
}
.nav li{
margin-top:0;
height: 80px;
}
.nav li a {
color: #fff;
font-family: 'Montserrat', sans-serif;
font-weight: normal;
line-height: 50px;
text-transform: uppercase;
font-size:14px;
}
.nav li a:hover, .nav li a:focus {
border-bottom: 2px solid #FB0006;
background: none;
color: #FB0006;
transition: all 0.3s;
}
/* Navbar Mobile*/
@media(max-width: 700px)
{
.in ul{
padding: 0;
background: #000;
}
.navbar {
margin-bottom: 0px;
height: 100px;
}
}
/*.shrink .nav li a:hover, .shrink .nav li a:focus {
color: #fff;
} */
.nav-container{
width: 95%;
margin: auto auto;
}
#header{
background-image: url('../../images/general/head.jpg');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
padding: 240px 0 180px;
min-height: 100vh;
}
.header_team{
background-image: url('../../images/general/team.png');
background-size: cover;
height: 500px !important;
padding-top: 150px !important;
}
.header_team h1{
text-transform: uppercase;
font-size: 45px;
}
.header_team h1, .header_team h2 {
color:#fff;
}
#header h1{
text-transform: uppercase;
font-size: 45px;
}
#header h1, #header h2 {
color:#fff;
}
.event-title{
width: 700px;
position: relative;
left: 350px;
}
.btn-default {
background: #FB0006;
color: #fff;
border:none;
border-radius: 2px;
padding: 20px 35px 20px 35px;
font-weight: bolder;
font-size: 15px;
}
.btn-default:focus,
.btn-default:hover,
.btn-default:active.btn-default:focus,
.btn-default:active.btn-default:hover{
background: #e10005;
/*background: none;*/
color: #fff;
/*border: 1px solid #FB0006;*/
transition: all 0.3s;
outline:none;
}
.btn-black {
background: #000;
color: #fff;
border:none;
border-radius: 2px;
padding: 20px 35px 20px 35px;
font-weight: bolder;
font-size: 15px;
}
.btn-black:focus,
.btn-black:hover,
.btn-black:active.btn-black:focus,
.btn-black:active.btn-black:hover{
background: #141414;
/*background: none;*/
color: #fff;
/*border: 1px solid #FB0006;*/
transition: all 0.3s;
}
.nav-btn{
margin-top:20px;
padding: 7px 10px;
}
@media( max-width: 468px ) {
.btn-book {
margin-top: 20px;
}
}
/* Gallery */
.gallery {
background: #F0EFF4;
}
.gallery h1 {
font-size: 35px;
text-transform: uppercase;
}
.speakers-list{
margin-top: 40px;
margin-bottom: 40px;
}
/* Home */
.home{
padding-bottom: 120px;
background: #ECE9E6;
background: -<API key>(to left, #ECE9E6 , #FFFFFF);
background: linear-gradient(to left, #ECE9E6 , #FFFFFF);
}
.home-para{
font-family: 'Abel', sans-serif;
font-size: 17px;
}
/* about TEDx*/
#about{
padding-bottom: 120px;
background: #f85032; /* fallback for old browsers */
background: -<API key>(to left, #f85032 , #e73827); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to left, #f85032 , #e73827); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
.about-head{
font-size: 50px;
color: floralwhite;
}
.about-subhead{
padding-bottom: 50px;
color: floralwhite;
}
.about-para{
color: floralwhite;
line-height: 150%;
font-family: 'Abel', sans-serif;
font-size: 17px;
}
#tedxbvcoe{
padding-top: 120px;
padding-bottom: 120px;
background: #2f2d2d;
/*background: #ECE9E6; */
/*background: -<API key>(to left, #ECE9E6 , #FFFFFF); */
/*background: linear-gradient(to left, #ECE9E6 , #FFFFFF); */
}
#tedxbvcoe h1, #tedxbvcoe h4 {
color: #fff;
}
.theme{
padding-top: 50px;
}
.content{
font-family: 'Abel', sans-serif;
font-size: 19px;
color:#fff;
}
#speakers{
padding-bottom: 120px;
background: #ECE9E6;
background: -<API key>(to left, #ECE9E6 , #FFFFFF);
background: linear-gradient(to left, #ECE9E6 , #FFFFFF);
}
.speak-mainhead{
font-size: 50px;
}
.speak-head{
font-family: 'Abel', sans-serif;
}
.stitle{
color: #141414;
}
/*#tickets{
background: #ECE9E6;
background: -<API key>(to left, #ECE9E6 , #FFFFFF);
background: linear-gradient(to left, #ECE9E6 , #FFFFFF);
height: 100%;
width : 100%;
}*/
/* Team*/
#team{
padding-bottom: 120px;
background: #f85032; /* fallback for old browsers */
background: -<API key>(to left, #f85032 , #e73827); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to left, #f85032 , #e73827); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
.team-head{
font-size: 50px;
color: floralwhite;
}
.team-subhead{
padding-bottom: 50px;
color: floralwhite;
}
.timeline {
list-style: none;
padding: 0;
position: relative;
}
.timeline:before {
top: 0;
bottom: 0;
position: absolute;
content: "";
width: 2px;
background-color: #f1f1f1;
left: 40px;
margin-left: -1.5px;
}
.timeline > li {
margin-bottom: 50px;
position: relative;
min-height: 50px;
}
.timeline > li:before,
.timeline > li:after {
content: " ";
display: table;
}
.timeline > li:after {
clear: both;
}
.timeline > li .timeline-panel {
width: 100%;
float: right;
padding: 0 20px 0 100px;
position: relative;
text-align: left;
}
.timeline > li .timeline-panel:before {
border-left-width: 0;
border-right-width: 15px;
left: -15px;
right: auto;
}
.timeline > li .timeline-panel:after {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
.timeline > li .timeline-image {
left: 0;
margin-left: 0;
width: 80px;
height: 80px;
position: absolute;
z-index: 100;
background-color: #F92E04;
color: white;
border-radius: 100%;
border: 7px solid #f1f1f1;
text-align: center;
}
.timeline > li .timeline-image h4 {
font-size: 10px;
margin-top: 12px;
line-height: 14px;
}
.timeline > li.timeline-inverted > .timeline-panel {
float: right;
text-align: left;
padding: 0 20px 0 100px;
}
.timeline > li.timeline-inverted > .timeline-panel:before {
border-left-width: 0;
border-right-width: 15px;
left: -15px;
right: auto;
}
.timeline > li.timeline-inverted > .timeline-panel:after {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
.timeline > li:last-child {
margin-bottom: 0;
}
.timeline .timeline-heading h4 {
margin-top: 0;
color: inherit;
}
.timeline .timeline-heading{
text-transform: none;
}
.timeline .timeline-body > p,
.timeline .timeline-body > ul {
margin-bottom: 0;
}
@media (min-width: 768px) {
.timeline:before {
left: 50%;
}
.timeline > li {
margin-bottom: 100px;
min-height: 100px;
}
.timeline > li .timeline-panel {
width: 41%;
float: left;
padding: 0 20px 20px 30px;
text-align: right;
}
.timeline > li .timeline-image {
width: 100px;
height: 100px;
left: 50%;
margin-left: -50px;
}
.timeline > li .timeline-image h4 {
font-size: 13px;
margin-top: 16px;
line-height: 18px;
}
.timeline > li.timeline-inverted > .timeline-panel {
float: right;
text-align: left;
padding: 0 30px 20px 20px;
}
}
@media (min-width: 992px) {
.timeline > li {
min-height: 150px;
}
.timeline > li .timeline-panel {
padding: 0 20px 20px;
}
.timeline > li .timeline-image {
width: 150px;
height: 150px;
margin-left: -75px;
}
.timeline > li .timeline-image h4 {
font-size: 18px;
margin-top: 30px;
line-height: 26px;
}
.timeline > li.timeline-inverted > .timeline-panel {
padding: 0 20px 20px;
}
}
@media (min-width: 1200px) {
.timeline > li {
min-height: 170px;
}
.timeline > li .timeline-panel {
padding: 0 20px 20px 100px;
}
.timeline > li .timeline-image {
width: 170px;
height: 170px;
margin-left: -85px;
}
.timeline > li .timeline-image h4 {
margin-top: 40px;
}
.timeline > li.timeline-inverted > .timeline-panel {
padding: 0 100px 20px 20px;
}
}
.utitle{
color: #fff;
}
.utitle > small {
font-size: 1.3rem;
}
/* Footer */
#footer{
background: #141414;
color: white;
padding-top: 15px;
padding-bottom: 15px;
}
.quicklinks{
list-style-type: none;
}
.quicklinks li{
display: inline;
padding-right: 10px;
}
.imagewrap {
position: relative;
}
.imageDescription {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-radius: 50%;
max-width: 390px;
margin: auto auto;
border: 72px solid transparent;
background: rgba(23, 21, 21, 0.72);
color: #fff;
visibility: hidden;
opacity: 0;
-webkit-transition: all 0.2s;
transition: all 0.2s;
padding-top: 50px;
}
.imagewrap:hover .imageDescription {
visibility: visible;
opacity: 1;
}
.heads .col-sm-12 {
margin-top: 20px;
}
a.share-link{
color:white;
font-size: 19px;
margin-right: 2px;
}
a.share-link:hover{
color:#fff;
text-decoration: underline;
}
a.member-link{
color:white;
font-size: 16px;
margin-right: 2px;
}
a.member-link:hover{
color:#fff;
text-decoration: underline;
}
.imgwrap {
position: relative;
}
.imgDescription {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-radius: 50%;
max-width: 150px;
margin: auto auto;
border: 5px solid transparent;
background: rgba(23, 21, 21, 0.72);
color: #fff;
visibility: hidden;
opacity: 0;
-webkit-transition: all 0.2s;
transition: all 0.2s;
padding-top: 50px;
}
.imgwrap:hover .imgDescription {
visibility: visible;
opacity: 1;
}
a{
cursor: pointer;
}
#team-section{
padding-top: 50px;
padding-bottom: 120px;
background: #ECE9E6;
background: -<API key>(to left, #ECE9E6 , #FFFFFF);
background: linear-gradient(to left, #ECE9E6 , #FFFFFF);
}
#team-section .col-md-12 {
margin-bottom: 25px;
}
.team-name{
padding-left: 20px;
padding-bottom: 10px;
}
.team-member{
display: inline-block;
text-align: center;
}
.team-member img{
height: 220px;
margin-left: auto;
margin-right: auto;
}
.social-links a{
display: none;
color: #777;
}
.social-links a:hover{
color: #333;
}
.speaker-image{
width: 100%;
}
@media( max-width: 468px ){
.speaker-image{
width: 80%;
}
}
#venue{
padding: 0;
/*background: url("../../images/general/bvp-2.jpg");*/
/*background-size: cover;*/
/*background-position: center center;*/
/*<API key>: fixed;*/
/*height: 650px !important;*/
padding: 10px 5%;
background: #161616;
}
.s-para{
font-family: 'Abel', sans-serif;
text-align: left;
font-size: 17px;
}
.seemore{
width: 100%;
height: 285px;
background: #f4f4f4;
padding-top: 140px;
padding-left: 10%;
font-size: 23px;
}
.seemore:hover .seemorewrap{
position: absolute;
top:0;
left: 0;
transition: all 0.2s;
cursor: pointer;
width: 100%;
height: 286px;
background: rgba(23, 21, 21, 0.72);
}
#performers {
padding: 0px;
}
#performers .container-fluid {
padding: 0px;
}
#performers .item {
padding: 15px 0px;
}
#performers .item:nth-child(1){
background-color: #333333;
}
#performers .item:nth-child(2){
background-color: rgba(11,10,4,1);
/*background: #000;*/
}
#performers .item:nth-child(3){
background-color: #270001;
}
/*<API key>*/
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
height: 600px;
margin: auto;
}
.carousel-fade .carousel-inner .item {
opacity: 0;
transition-property: opacity;
}
.carousel-fade .carousel-inner .active {
opacity: 1;
}
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
left: 0;
opacity: 0;
z-index: 1;
}
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
opacity: 1;
}
.carousel-fade .carousel-control {
z-index: 2;
}
@media all and (transform-3d),
(-webkit-transform-3d) {
.carousel-fade .carousel-inner > .item.next,
.carousel-fade .carousel-inner > .item.active.right {
opacity: 0;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.carousel-fade .carousel-inner > .item.prev,
.carousel-fade .carousel-inner > .item.active.left {
opacity: 0;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.carousel-fade .carousel-inner > .item.next.left,
.carousel-fade .carousel-inner > .item.prev.right,
.carousel-fade .carousel-inner > .item.active {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
#sponsors p.home-para{
font-size: 22px;
}
.ticketing{
margin-top: 25px;
}
#col-cus{
width: 100%;
}
@media( min-width: 468px){
.col-cus{
width: 20%;
float: left;
padding-left: 10px;
padding-right: 10px;
}
}
#team img {
max-width: 150px;
}
.popover-title{
display: none;
}
|
package be.wegenenverkeer.common.resteasy.exception;
/**
* Exception which can be thrown if authentication or authorization failed.
* <p/>
* Note that from a security point of view, it is better to use {@link NotFoundException} when the trying is not
* authorized to access a particular resource. For a normal user this distinction is not important. For a malignant
* user an {@link AuthException} can be a carrot to find ways to access the resource.
*/
public class AuthException extends <API key> {
/**
* No-arguments constructor.
*/
public AuthException() {
}
/**
* Constructor with message.
*
* @param message message
*/
public AuthException(String message) {
super(message);
}
/**
* Constructor with message and cause.
*
* @param message message
* @param cause cause
*/
public AuthException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructor with cause.
*
* @param cause cause
*/
public AuthException(Throwable cause) {
super(cause);
}
}
|
package com.fsck.k9.mail.transport;
import com.fsck.k9.mail.K9MailLib;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.store.StoreConfig;
import com.fsck.k9.mail.store.webdav.WebDavHttpClient;
import com.fsck.k9.mail.store.webdav.WebDavStore;
import timber.log.Timber;
import java.util.Collections;
public class WebDavTransport extends Transport {
/**
* Decodes a WebDavTransport URI.
*
* <p>
* <b>Note:</b> Everything related to sending messages via WebDAV is handled by
* {@link WebDavStore}. So the transport URI is the same as the store URI.
* </p>
*/
public static ServerSettings decodeUri(String uri) {
return WebDavStore.decodeUri(uri);
}
/**
* Creates a WebDavTransport URI.
*
* <p>
* <b>Note:</b> Everything related to sending messages via WebDAV is handled by
* {@link WebDavStore}. So the transport URI is the same as the store URI.
* </p>
*/
public static String createUri(ServerSettings server) {
return WebDavStore.createUri(server);
}
private WebDavStore store;
public WebDavTransport(StoreConfig storeConfig) throws MessagingException {
store = new WebDavStore(storeConfig, new WebDavHttpClient.<API key>());
if (K9MailLib.isDebug())
Timber.d(">>> New WebDavTransport creation complete");
}
@Override
public void open() throws MessagingException {
if (K9MailLib.isDebug())
Timber.d( ">>> open called on WebDavTransport ");
store.getHttpClient();
}
@Override
public void close() {
}
@Override
public void sendMessage(Message message) throws MessagingException {
store.sendMessages(Collections.singletonList(message));
}
}
|
package chandu0101.scalajs.react.components.demo.routes
import chandu0101.scalajs.react.components.demo.components.reactinfinite.{ReactInfiniteDemo, ReactInfiniteInfo}
import chandu0101.scalajs.react.components.demo.components.reactselect.{ReactSelectDemo, ReactSelectInfo}
import chandu0101.scalajs.react.components.demo.pages.{ReactInfinitePage, ReactSelectPage}
import japgolly.scalajs.react.extra.router2.RouterConfigDsl
object <API key> {
case object Info extends LeftRoute("Info", "info", () => ReactInfiniteInfo())
case object Demo extends LeftRoute("Demo", "demo", () => ReactInfiniteDemo())
val menu : List[LeftRoute] = List(Info,Demo)
val routes = RouterConfigDsl[LeftRoute].buildRule { dsl =>
import dsl._
menu.map(i =>
staticRoute(i.route, i) ~> renderR(r => ReactInfinitePage(i, r))
).reduce(_ | _)
}
}
|
# dmarc2logstash Helm Chart
[dmarc2logstash](https:
## Installing the Chart
To install the chart with the release name `my-release`:
console
helm install --name my-release stable/dmarc2logstash
The command deploys dmarc2logstash on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. The [secrets](#secrets) section lists the required Kubernetes secrets.
## Uninstalling the Chart
To uninstall/delete the my-release deployment:
console
helm delete my-release --purge
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
setting | description | default
dmarc2logstash.image.repository | dmarc2logstash Docker image repository | jertel/dmarc2logstash
dmarc2logstash.image.tag | dmarc2logstash image tag, typically the version, of the Docker image | 1.0.0
dmarc2logstash.image.pullPolicy | dmarc2logstash Kubernetes image pull policy | IfNotPresent
filebeat.image.repository | Elastic filebeat Docker image repository | docker.elastic.co/beats/filebeat
filebeat.image.tag | Elastic filebeat tag, typically the version, of the Docker image | 6.2.1
filebeat.image.pullPolicy | Elastic filebeat Kubernetes image pull policy | IfNotPresent
filebeat.logstash.host | Logstash service host; ex: logstash (this value must be provided) | ""
filebeat.logstash.port | Logstash service port | 5000
filebeat.logstash.sourceType | Logstash source type will allow custom filtering via the Logstash configuration | json-logs
filebeat.logstash.index | Elasticsearch index that will contain the new DMARC data (index will be created on-the-fly if doesn't exist) | dmarc
filebeat.logstash.timeout | Seconds to wait before timing out the connection to logstash | 15
## Secrets
The following <API key> are required to be present in order for this chart to deploy:
variable | required | description
pop3_server | true | The POP3 server hostname or IP address (must support TLS)
pop3_username | true | POP3 account username
pop3_password | true | POP3 account password
Below is a sample secrets.yaml file that can be used as a template. Remember that all secrets must be base64-encoded.
yaml
apiVersion: v1
kind: Secret
metadata:
name: <API key>
type: Opaque
data:
pop3_server: ""
pop3_username: ""
pop3_password: ""
Once you have provided the base64-encoded secret values, apply the file to your Kubernetes cluster as follows:
console
kubectl apply -f secrets.yaml
|
'use strict';
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
var asap = require('asap');
var _waterfall = require('a-sync-waterfall');
var lib = require('./lib');
var compiler = require('./compiler');
var filters = require('./filters');
var _require = require('./loaders'),
FileSystemLoader = _require.FileSystemLoader,
WebLoader = _require.WebLoader,
PrecompiledLoader = _require.PrecompiledLoader;
var tests = require('./tests');
var globals = require('./globals');
var _require2 = require('./object'),
Obj = _require2.Obj,
EmitterObj = _require2.EmitterObj;
var globalRuntime = require('./runtime');
var handleError = globalRuntime.handleError,
Frame = globalRuntime.Frame;
var expressApp = require('./express-app'); // If the user is using the async API, *always* call it
// asynchronously even if the template was synchronous.
function callbackAsap(cb, err, res) {
asap(function () {
cb(err, res);
});
}
/**
* A no-op template, for use with {% include ignore missing %}
*/
var noopTmplSrc = {
type: 'code',
obj: {
root: function root(env, context, frame, runtime, cb) {
try {
cb(null, '');
} catch (e) {
cb(handleError(e, null, null));
}
}
}
};
var Environment =
/*#__PURE__*/
function (_EmitterObj) {
_inheritsLoose(Environment, _EmitterObj);
function Environment() {
return _EmitterObj.apply(this, arguments) || this;
}
var _proto = Environment.prototype;
_proto.init = function init(loaders, opts) {
var _this = this;
// The dev flag determines the trace that'll be shown on errors.
// If set to true, returns the full trace from the error point,
// otherwise will return trace starting from Template.render
// (the full trace from within nunjucks may confuse developers using
// the library)
// defaults to false
opts = this.opts = opts || {};
this.opts.dev = !!opts.dev; // The autoescape flag sets global autoescaping. If true,
// every string variable will be escaped by default.
// If false, strings can be manually escaped using the `escape` filter.
// defaults to true
this.opts.autoescape = opts.autoescape != null ? opts.autoescape : true; // If true, this will make the system throw errors if trying
// to output a null or undefined value
this.opts.throwOnUndefined = !!opts.throwOnUndefined;
this.opts.trimBlocks = !!opts.trimBlocks;
this.opts.lstripBlocks = !!opts.lstripBlocks;
this.loaders = [];
if (!loaders) {
// The filesystem loader is only available server-side
if (FileSystemLoader) {
this.loaders = [new FileSystemLoader('views')];
} else if (WebLoader) {
this.loaders = [new WebLoader('/views')];
}
} else {
this.loaders = lib.isArray(loaders) ? loaders : [loaders];
} // It's easy to use precompiled templates: just include them
// before you configure nunjucks and this will automatically
// pick it up and use it
if (typeof window !== 'undefined' && window.nunjucksPrecompiled) {
this.loaders.unshift(new PrecompiledLoader(window.nunjucksPrecompiled));
}
this._initLoaders();
this.globals = globals();
this.filters = {};
this.tests = {};
this.asyncFilters = [];
this.extensions = {};
this.extensionsList = [];
lib._entries(filters).forEach(function (_ref) {
var name = _ref[0],
filter = _ref[1];
return _this.addFilter(name, filter);
});
lib._entries(tests).forEach(function (_ref2) {
var name = _ref2[0],
test = _ref2[1];
return _this.addTest(name, test);
});
};
_proto._initLoaders = function _initLoaders() {
var _this2 = this;
this.loaders.forEach(function (loader) {
// Caching and cache busting
loader.cache = {};
if (typeof loader.on === 'function') {
loader.on('update', function (name, fullname) {
loader.cache[name] = null;
_this2.emit('update', name, fullname, loader);
});
loader.on('load', function (name, source) {
_this2.emit('load', name, source, loader);
});
}
});
};
_proto.invalidateCache = function invalidateCache() {
this.loaders.forEach(function (loader) {
loader.cache = {};
});
};
_proto.addExtension = function addExtension(name, extension) {
extension.__name = name;
this.extensions[name] = extension;
this.extensionsList.push(extension);
return this;
};
_proto.removeExtension = function removeExtension(name) {
var extension = this.getExtension(name);
if (!extension) {
return;
}
this.extensionsList = lib.without(this.extensionsList, extension);
delete this.extensions[name];
};
_proto.getExtension = function getExtension(name) {
return this.extensions[name];
};
_proto.hasExtension = function hasExtension(name) {
return !!this.extensions[name];
};
_proto.addGlobal = function addGlobal(name, value) {
this.globals[name] = value;
return this;
};
_proto.getGlobal = function getGlobal(name) {
if (typeof this.globals[name] === 'undefined') {
throw new Error('global not found: ' + name);
}
return this.globals[name];
};
_proto.addFilter = function addFilter(name, func, async) {
var wrapped = func;
if (async) {
this.asyncFilters.push(name);
}
this.filters[name] = wrapped;
return this;
};
_proto.getFilter = function getFilter(name) {
if (!this.filters[name]) {
throw new Error('filter not found: ' + name);
}
return this.filters[name];
};
_proto.addTest = function addTest(name, func) {
this.tests[name] = func;
return this;
};
_proto.getTest = function getTest(name) {
if (!this.tests[name]) {
throw new Error('test not found: ' + name);
}
return this.tests[name];
};
_proto.resolveTemplate = function resolveTemplate(loader, parentName, filename) {
var isRelative = loader.isRelative && parentName ? loader.isRelative(filename) : false;
return isRelative && loader.resolve ? loader.resolve(parentName, filename) : filename;
};
_proto.getTemplate = function getTemplate(name, eagerCompile, parentName, ignoreMissing, cb) {
var _this3 = this;
var that = this;
var tmpl = null;
if (name && name.raw) {
// this fixes autoescape for templates referenced in symbols
name = name.raw;
}
if (lib.isFunction(parentName)) {
cb = parentName;
parentName = null;
eagerCompile = eagerCompile || false;
}
if (lib.isFunction(eagerCompile)) {
cb = eagerCompile;
eagerCompile = false;
}
if (name instanceof Template) {
tmpl = name;
} else if (typeof name !== 'string') {
throw new Error('template names must be a string: ' + name);
} else {
for (var i = 0; i < this.loaders.length; i++) {
var loader = this.loaders[i];
tmpl = loader.cache[this.resolveTemplate(loader, parentName, name)];
if (tmpl) {
break;
}
}
}
if (tmpl) {
if (eagerCompile) {
tmpl.compile();
}
if (cb) {
cb(null, tmpl);
return undefined;
} else {
return tmpl;
}
}
var syncResult;
var createTemplate = function createTemplate(err, info) {
if (!info && !err && !ignoreMissing) {
err = new Error('template not found: ' + name);
}
if (err) {
if (cb) {
cb(err);
return;
} else {
throw err;
}
}
var newTmpl;
if (!info) {
newTmpl = new Template(noopTmplSrc, _this3, '', eagerCompile);
} else {
newTmpl = new Template(info.src, _this3, info.path, eagerCompile);
if (!info.noCache) {
info.loader.cache[name] = newTmpl;
}
}
if (cb) {
cb(null, newTmpl);
} else {
syncResult = newTmpl;
}
};
lib.asyncIter(this.loaders, function (loader, i, next, done) {
function handle(err, src) {
if (err) {
done(err);
} else if (src) {
src.loader = loader;
done(null, src);
} else {
next();
}
} // Resolve name relative to parentName
name = that.resolveTemplate(loader, parentName, name);
if (loader.async) {
loader.getSource(name, handle);
} else {
handle(null, loader.getSource(name));
}
}, createTemplate);
return syncResult;
};
_proto.express = function express(app) {
return expressApp(this, app);
};
_proto.render = function render(name, ctx, cb) {
if (lib.isFunction(ctx)) {
cb = ctx;
ctx = null;
} // We support a synchronous API to make it easier to migrate
// existing code to async. This works because if you don't do
// anything async work, the whole thing is actually run
// synchronously.
var syncResult = null;
this.getTemplate(name, function (err, tmpl) {
if (err && cb) {
callbackAsap(cb, err);
} else if (err) {
throw err;
} else {
syncResult = tmpl.render(ctx, cb);
}
});
return syncResult;
};
_proto.renderString = function renderString(src, ctx, opts, cb) {
if (lib.isFunction(opts)) {
cb = opts;
opts = {};
}
opts = opts || {};
var tmpl = new Template(src, this, opts.path);
return tmpl.render(ctx, cb);
};
_proto.waterfall = function waterfall(tasks, callback, forceAsync) {
return _waterfall(tasks, callback, forceAsync);
};
return Environment;
}(EmitterObj);
var Context =
/*#__PURE__*/
function (_Obj) {
_inheritsLoose(Context, _Obj);
function Context() {
return _Obj.apply(this, arguments) || this;
}
var _proto2 = Context.prototype;
_proto2.init = function init(ctx, blocks, env) {
var _this4 = this;
// Has to be tied to an environment so we can tap into its globals.
this.env = env || new Environment(); // Make a duplicate of ctx
this.ctx = lib.extend({}, ctx);
this.blocks = {};
this.exported = [];
lib.keys(blocks).forEach(function (name) {
_this4.addBlock(name, blocks[name]);
});
};
_proto2.lookup = function lookup(name) {
// This is one of the most called functions, so optimize for
// the typical case where the name isn't in the globals
if (name in this.env.globals && !(name in this.ctx)) {
return this.env.globals[name];
} else {
return this.ctx[name];
}
};
_proto2.setVariable = function setVariable(name, val) {
this.ctx[name] = val;
};
_proto2.getVariables = function getVariables() {
return this.ctx;
};
_proto2.addBlock = function addBlock(name, block) {
this.blocks[name] = this.blocks[name] || [];
this.blocks[name].push(block);
return this;
};
_proto2.getBlock = function getBlock(name) {
if (!this.blocks[name]) {
throw new Error('unknown block "' + name + '"');
}
return this.blocks[name][0];
};
_proto2.getSuper = function getSuper(env, name, block, frame, runtime, cb) {
var idx = lib.indexOf(this.blocks[name] || [], block);
var blk = this.blocks[name][idx + 1];
var context = this;
if (idx === -1 || !blk) {
throw new Error('no super block available for "' + name + '"');
}
blk(env, context, frame, runtime, cb);
};
_proto2.addExport = function addExport(name) {
this.exported.push(name);
};
_proto2.getExported = function getExported() {
var _this5 = this;
var exported = {};
this.exported.forEach(function (name) {
exported[name] = _this5.ctx[name];
});
return exported;
};
return Context;
}(Obj);
var Template =
/*#__PURE__*/
function (_Obj2) {
_inheritsLoose(Template, _Obj2);
function Template() {
return _Obj2.apply(this, arguments) || this;
}
var _proto3 = Template.prototype;
_proto3.init = function init(src, env, path, eagerCompile) {
this.env = env || new Environment();
if (lib.isObject(src)) {
switch (src.type) {
case 'code':
this.tmplProps = src.obj;
break;
case 'string':
this.tmplStr = src.obj;
break;
default:
throw new Error("Unexpected template object type " + src.type + "; expected 'code', or 'string'");
}
} else if (lib.isString(src)) {
this.tmplStr = src;
} else {
throw new Error('src must be a string or an object describing the source');
}
this.path = path;
if (eagerCompile) {
try {
this._compile();
} catch (err) {
throw lib._prettifyError(this.path, this.env.opts.dev, err);
}
} else {
this.compiled = false;
}
};
_proto3.render = function render(ctx, parentFrame, cb) {
var _this6 = this;
if (typeof ctx === 'function') {
cb = ctx;
ctx = {};
} else if (typeof parentFrame === 'function') {
cb = parentFrame;
parentFrame = null;
} // If there is a parent frame, we are being called from internal
// code of another template, and the internal system
// depends on the sync/async nature of the parent template
// to be inherited, so force an async callback
var forceAsync = !parentFrame; // Catch compile errors for async rendering
try {
this.compile();
} catch (e) {
var err = lib._prettifyError(this.path, this.env.opts.dev, e);
if (cb) {
return callbackAsap(cb, err);
} else {
throw err;
}
}
var context = new Context(ctx || {}, this.blocks, this.env);
var frame = parentFrame ? parentFrame.push(true) : new Frame();
frame.topLevel = true;
var syncResult = null;
var didError = false;
this.rootRenderFunc(this.env, context, frame, globalRuntime, function (err, res) {
if (didError) {
// prevent multiple calls to cb
if (cb) {
return;
} else {
throw err;
}
}
if (err) {
err = lib._prettifyError(_this6.path, _this6.env.opts.dev, err);
didError = true;
}
if (cb) {
if (forceAsync) {
callbackAsap(cb, err, res);
} else {
cb(err, res);
}
} else {
if (err) {
throw err;
}
syncResult = res;
}
});
return syncResult;
};
_proto3.getExported = function getExported(ctx, parentFrame, cb) {
// eslint-disable-line consistent-return
if (typeof ctx === 'function') {
cb = ctx;
ctx = {};
}
if (typeof parentFrame === 'function') {
cb = parentFrame;
parentFrame = null;
} // Catch compile errors for async rendering
try {
this.compile();
} catch (e) {
if (cb) {
return cb(e);
} else {
throw e;
}
}
var frame = parentFrame ? parentFrame.push() : new Frame();
frame.topLevel = true; // Run the rootRenderFunc to populate the context with exported vars
var context = new Context(ctx || {}, this.blocks, this.env);
this.rootRenderFunc(this.env, context, frame, globalRuntime, function (err) {
if (err) {
cb(err, null);
} else {
cb(null, context.getExported());
}
});
};
_proto3.compile = function compile() {
if (!this.compiled) {
this._compile();
}
};
_proto3._compile = function _compile() {
var props;
if (this.tmplProps) {
props = this.tmplProps;
} else {
var source = compiler.compile(this.tmplStr, this.env.asyncFilters, this.env.extensionsList, this.path, this.env.opts);
var func = new Function(source); // eslint-disable-line no-new-func
props = func();
}
this.blocks = this._getBlocks(props);
this.rootRenderFunc = props.root;
this.compiled = true;
};
_proto3._getBlocks = function _getBlocks(props) {
var blocks = {};
lib.keys(props).forEach(function (k) {
if (k.slice(0, 2) === 'b_') {
blocks[k.slice(2)] = props[k];
}
});
return blocks;
};
return Template;
}(Obj);
module.exports = {
Environment: Environment,
Template: Template
};
|
import concurrent
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures import ThreadPoolExecutor
import math
import os
from scripts.load import put_load
# Each task is a call to `put_load`
def soft_blow(num_tasks=100, use_processes=False):
executor = ProcessPoolExecutor if use_processes else ThreadPoolExecutor
with executor(max_workers=10) as e:
for _ in range(num_tasks):
e.submit(put_load)
# Defining at module level so it can be pickled
def _task_for_proc(num_threads, num_tasks):
print('Executing {} tasks for a process with {} threads'.format(
num_tasks, num_threads))
futrs = []
with ThreadPoolExecutor(max_workers=num_threads) as te:
for _ in range(num_tasks):
fut = te.submit(put_load)
futrs.append(fut)
print('Waiting for futures: {}'.format(os.getpid()))
concurrent.futures.wait(futrs)
def hard_blow():
# Note: This method might perform more tasks then `num_tasks`,
# if the values of `num_tasks`, `num_threads` are chosen such that they
# are not multiples of `num_procs`
# TODO: WIP
num_tasks = 10000
num_procs = 4
threads_per_proc = 10
tasks_per_proc = int(math.ceil(num_tasks / num_procs))
futrs = []
with ProcessPoolExecutor(max_workers=num_procs) as pe:
for _ in range(num_procs):
fut = pe.submit(_task_for_proc, (threads_per_proc, tasks_per_proc))
futrs.append(fut)
print('Waiting for futures: main')
concurrent.futures.wait(futrs)
if __name__ == '__main__':
soft_blow()
|
require 'facter'
Facter.add("defaultgw") do
setcode do
output = %x{ip route show 0.0.0.0/0}.chomp
result = output.split(' ')
result[2]
end
end
|
+++
date = "2016-05-02T12:50:29-05:00"
title = "program"
type = "event"
+++
<hr>
<div class="span-16 last ">If you are new to the Open Space concept you may <a href="/pages/open-space-format">want to read some more details</a>.</div>
<hr />
<hr />
<div class="span-7 append-bottom border">
<div class="span-7 last">
<h4>Monday 2 April</h4>
</div>
<div class="span-2">08:30-09:30</div>
<div class="span-4 last">Registration and Breakfast</div>
<div class="span-2">09:30-09:45</div>
<div class="span-4 append-bottom last">Introduction</div>
<div class="span-2">09:50-10:20</div>
<div class="span-4 box last"><a href="/events/2012-austin/proposals/Security Loves DevOps">Security Loves Devops - James Turnbull</a><br><br><br></div>
<div class="span-2">10:25-10:55</div>
<div class="span-4 box last"><a href="/events/2012-austin/proposals/How%20a%20BigCo%20actually%20got%20some%20innovation%20done/">How a BigCo actually got some innovation done - Michael Coté</a><br><br></div>
<div class="span-2">10:55-11:15</div>
<div class="span-4 append-bottom last">break</div>
<div class="span-2">11:20-12:20</div >
<div class="span-4 box append-bottom last">Provisioning Panel - Meet Juju, Crowbar, Puppet, Chef, Pallet<br>+ discussion</div>
<div class="span-2">12:25-12:30</div> <div class="span-4 append-bottom box last"><strong>Ignite</strong> Prabhakar Gopalan, "Rescuing yourself from corporate insanity"</div>
<div class="span-2">12:30-12:35</div> <div class="span-4 append-bottom box last"><strong>Ignite</strong> Matt Ray, "Spiceweasel, Your Infrastructure as Code Table of Contents"</div>
<div class="span-2">12:35-12:40</div> <div class="span-4 append-bottom box last"><strong>Ignite</strong> Dave Zwieback, "Empowering developers, nurturing generalists, and moving beyond DevOps at scale"</div>
<div class="span-2">12:40-12:45</div> <div class="span-4 append-bottom box last"><strong>Ignite</strong> Patricio Arvizu, "You don't need to pay for your Continuous Integration server."</div>
<div class="span-2">12:45-14:15</div>
<div class="span-4 append-bottom last">Lunch</div>
<div class="span-2">14:15-15:00</div>
<div class="span-4 append-bottom box last"><strong>Opening Open Space</strong></div>
<div class="span-2">15:00-15:45</div>
<div class="span-4 append-bottom box last"><strong>Open Space Slot1</strong></div>
<div class="span-2">15:45-16:30</div>
<div class="span-4 append-bottom box last"><strong>Open Space Slot2</strong></div>
<div class="span-2">16:30-17:00</div>
<div class="span-4 append-bottom last">Break</div>
<div class="span-2">17:00-17:45</div>
<div class="span-4 append-bottom box last"><strong>Open Space Slot 3</strong></div>
<div class="span-2">17:45-18:30</div>
<div class="span-4 append-bottom box last"><strong>Open Space Slot 4</strong></div>
<div class="span-2">18:30-19:00</div>
<div class="span-4 append-bottom box last"><strong>Venue Closing</strong></div>
<div class="span-2">19:00</div>
<div class="span-4 append-bottom box last"><strong>Drinks at Sherlock's</strong> Sponsored by Puppet Labs - <a href="http://maps.google.com/maps?saddr=National+Instruments+Corporation,+North+Mopac+Expressway,+Austin,+TX&daddr=sherlocks&hl=en&sll=30.371459,-97.724504&sspn=0.016291,0.015042&geocode=<API key>%<API key>&oq=National+INst&gl=us&mra=ls&t=m&z=14">Map</a></div>
</div>
<div class="span-7 append-bottom last">
<div class="span-7 last">
<h4>Tuesday 3 April</h4>
</div>
<div class="span-2">09:00-09:30</div>
<div class="span-4 last">Registration and Breakfast</div>
<div class="span-2">09:30-09:40</div>
<div class="span-4 append-bottom last">Kickoff Day 2</div>
<div class="span-2">09:40-10:10</div>
<div class="span-4 box last"><a href="/events/2012-austin/proposals/DevOpsSec/">DevOpsSec - Applying Devops Principles to Application Security at Etsy - Nick Galbreath</a></div>
<div class="span-2">10:15-10:45</div>
<div class="span-4 box last">Continuous Database Integration - Making Your Data Agile - Ryan Lowe, Richard Crowley</a></div>
<div class="span-2">10:45-11:05</div>
<div class="span-4 append-bottom last">break</div>
<div class="span-2">11:10-11:40</div>
<div class="span-4 box last">The story of DevOps at National Instruments - Ernest Mueller, James Wickett, Karthik Gaekwad</a></div>
<div class="span-2">11:45-11:50</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> James Wickett, "Rugged DevOps--bridging security and devops communities and practices"</div>
<div class="span-2">11:50-11:55</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> Karthik Gaekwad, "New Features deployed to production- in 30 days or less!"</div>
<div class="span-2">11:55-12:00</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> Tom Canova, "Just Enough/Just In Time Traceability"</div>
<div class="span-2">12:00-12:05</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> Mike DuVall, "Database Automation at D&B Austin" </div>
<div class="span-2">12:05-12:10</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> slot 5 </div>
<div class="span-2">12:10-12:15</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> slot 6 </div>
<div class="span-2">12:15-12:20</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> slot 7 </div>
<div class="span-2">11:20-12:25</div>
<div class="span-4 append-bottom box last"><strong>Ignite</strong> slot 8 </div>
<div class="span-2">12:25-13:30</div>
<div class="span-4 append-bottom last">Lunch</div>
<div class="span-2">14:00-14:30</div>
<div class="span-4 append-bottom box last"><strong>Re-Opening Open Space</strong></div>
<div class="span-2">14:30-15:15</div>
<div class="span-4 append-bottom box last"><strong>Open Space Slot5</strong></div>
<div class="span-2">15:15-16:00</div>
<div class="span-4 append-bottom box last"><strong>Open Space Slot6</strong></div>
<div class="span-2">16:00-16:30</div>
<div class="span-4 append-bottom last">Break (beer :30)</div>
<div class="span-2">16:30-17:15</div>
<div class="span-4 append-bottom box last"><strong>Open Space Slot 7</strong></div>
<div class="span-2">17:15-18:00</div>
<div class="span-4 append-bottom box last"><strong>Venue Closing</strong></div>
</div>
|
#if CC_Quote // Command must be enabled
#ifndef _Quote_FP_H_
#define _Quote_FP_H_
// Input structure definition
typedef struct {
TPMI_DH_OBJECT signHandle;
TPM2B_DATA qualifyingData;
TPMT_SIG_SCHEME inScheme;
TPML_PCR_SELECTION PCRselect;
} Quote_In;
// Output structure definition
typedef struct {
TPM2B_ATTEST quoted;
TPMT_SIGNATURE signature;
} Quote_Out;
// Response code modifiers
#define RC_Quote_signHandle (TPM_RC_H + TPM_RC_1)
#define <API key> (TPM_RC_P + TPM_RC_1)
#define RC_Quote_inScheme (TPM_RC_P + TPM_RC_2)
#define RC_Quote_PCRselect (TPM_RC_P + TPM_RC_3)
// Function prototype
TPM_RC
TPM2_Quote(
Quote_In *in,
Quote_Out *out
);
#endif // _Quote_FP_H_
#endif // CC_Quote
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Tue Feb 14 08:16:38 UTC 2012 -->
<TITLE>
Uses of Class org.apache.hadoop.mapreduce.server.tasktracker.JVMInfo (Hadoop 1.0.1 API)
</TITLE>
<META NAME="date" CONTENT="2012-02-14">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.mapreduce.server.tasktracker.JVMInfo (Hadoop 1.0.1 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/mapreduce/server/tasktracker//class-useJVMInfo.html" target="_top"><B>FRAMES</B></A>
<A HREF="JVMInfo.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.mapreduce.server.tasktracker.JVMInfo</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.mapred"><B>org.apache.hadoop.mapred</B></A></TD>
<TD>A software framework for easily writing applications which process vast
amounts of data (multi-terabyte data-sets) parallelly on large clusters
(thousands of nodes) built of commodity hardware in a reliable, fault-tolerant
manner. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.mapreduce.server.tasktracker.userlogs"><B>org.apache.hadoop.mapreduce.server.tasktracker.userlogs</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.mapred"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A> in <A HREF="../../../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A> with parameters of type <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>TaskLogsTruncater.</B><B><A HREF="../../../../../../../org/apache/hadoop/mapred/TaskLogsTruncater.html#shouldTruncateLogs(org.apache.hadoop.mapreduce.server.tasktracker.JVMInfo)">shouldTruncateLogs</A></B>(<A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A> lInfo)</CODE>
<BR>
Check the log file sizes generated by the attempts that ran in a
particular JVM</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>TaskLogsTruncater.</B><B><A HREF="../../../../../../../org/apache/hadoop/mapred/TaskLogsTruncater.html#truncateLogs(org.apache.hadoop.mapreduce.server.tasktracker.JVMInfo)">truncateLogs</A></B>(<A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A> lInfo)</CODE>
<BR>
Process the removed task's logs.</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.mapreduce.server.tasktracker.userlogs"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A> in <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/userlogs/package-summary.html">org.apache.hadoop.mapreduce.server.tasktracker.userlogs</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/userlogs/package-summary.html">org.apache.hadoop.mapreduce.server.tasktracker.userlogs</A> that return <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A></CODE></FONT></TD>
<TD><CODE><B>JvmFinishedEvent.</B><B><A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/userlogs/JvmFinishedEvent.html#getJvmInfo()">getJvmInfo</A></B>()</CODE>
<BR>
Get the jvm info.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/userlogs/package-summary.html">org.apache.hadoop.mapreduce.server.tasktracker.userlogs</A> with parameters of type <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/userlogs/JvmFinishedEvent.html#JvmFinishedEvent(org.apache.hadoop.mapreduce.server.tasktracker.JVMInfo)">JvmFinishedEvent</A></B>(<A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker">JVMInfo</A> jvmInfo)</CODE>
<BR>
Create the event to inform that the jvm has finished.</TD>
</TR>
</TABLE>
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/mapreduce/server/tasktracker/JVMInfo.html" title="class in org.apache.hadoop.mapreduce.server.tasktracker"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/mapreduce/server/tasktracker//class-useJVMInfo.html" target="_top"><B>FRAMES</B></A>
<A HREF="JVMInfo.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
|
@font-face {
font-family: 'BAUHS93';
src: url('./BAUHS93.eot');
src: local('BAUHS93'), url('./BAUHS93.woff') format('woff'), url('./BAUHS93.ttf') format('truetype');
}
/* use this class to attach this font to any element i.e. <p class="<API key>">Text with this font applied</p> */
.<API key> {
font-family: 'BAUHS93' !important;
}
/* Font downloaded from FontsForWeb.com */
|
// Contributed by: Mitch Thompson
using UnityEngine;
using UnityEditor;
namespace Spine.Unity.Modules {
public class <API key> : UnityEditor.Editor {
[<API key>(typeof(SkeletonRagdoll.LayerFieldAttribute))]
public class <API key> : PropertyDrawer {
public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {
property.intValue = EditorGUI.LayerField(position, label, property.intValue);
}
}
}
}
|
package org.jetbrains.sbt
package project.settings
import com.intellij.openapi.components._
import com.intellij.openapi.externalSystem.settings.<API key>
import com.intellij.openapi.project.Project
import org.jetbrains.sbt.project.SbtProjectSystem
import scala.beans.BeanProperty
/**
* @author Pavel Fatin
*/
@State(
name = "SbtLocalSettings",
storages = Array(new Storage(StoragePathMacros.WORKSPACE_FILE))
)
class SbtLocalSettings(project: Project)
extends <API key>(SbtProjectSystem.Id, project)
with <API key>[<API key>] {
var sbtSupportSuggested = false
var lastUpdateTimestamp = 0L
def getState: <API key> = {
val state = new <API key>
fillState(state)
state.<API key>(sbtSupportSuggested)
state.<API key>(lastUpdateTimestamp)
state
}
def loadState(state: <API key>) {
super[<API key>].loadState(state)
sbtSupportSuggested = state.<API key>
lastUpdateTimestamp = state.<API key>
}
}
class <API key> extends <API key>.State {
@BeanProperty
var sbtSupportSuggested: Boolean = false
@BeanProperty
var lastUpdateTimestamp: Long = 0
}
object SbtLocalSettings {
def getInstance(project: Project): SbtLocalSettings = ServiceManager.getService(project, classOf[SbtLocalSettings])
}
|
/**
* Nutz-JS Nutz-JS JS
*
* @author zozoh(zozohtnt@gmail.com)
* 2012-10 First created
*/
(function () {
var zUtil = {
getFuncBodyAsStr: function (func) {
var str = func.toString();
var posL = str.indexOf("{");
var re = $.trim(str.substring(posL + 1, str.length - 1));
// Safari
if(re[re.length-1] == ";")
return re.substring(0, re.length-1);
return re;
},
invoke: function (obj, funcName, args, me) {
if (obj) {
var func = obj[funcName];
if (typeof func == 'function') {
func.apply(me || obj, args);
}
}
},
openUrl: function (url, target) {
var html = '<form target="' + (target || '_blank') + '" method="GET"';
html += ' action="' + url + '" style="display:none;">';
html += '</form>';
var jq = $(html).appendTo(document.body);
jq[0].submit();
jq.remove();
},
// POST
postForm: function (url, data) {
var html = '';
html += '<form action="' + url + '" method="POST" style="display:none;">';
for (var nm in data) {
html += '<input type="text" name="' + nm + '" value="' + data[nm] + '">';
}
html += '</form>';
var jq = $(html).appendTo(document.body);
jq[0].submit();
jq.remove();
},
timestamp: function () {
return ((new Date()) + '').replace(/[ :\t*+()-]/g, '').toLowerCase();
},
extend: function (a, b) {
if (_.isObject(a) && _.isObject(b)) {
for (var key in b) {
var av = a[key];
if (_.isArray(av) || _.isFunction(av) || _.isDate(av) || _.isRegExp(av)) {
a[key] = b[key];
} else if (_.isObject(av)) {
this.extend(av, b[key]);
} else {
a[key] = b[key];
}
}
return a;
}
throw "can not extend a:" + a + " by b:" + b;
},
winsz: function () {
if (window.innerWidth) {
return {
width: window.innerWidth,
height: window.innerHeight
};
}
if (document.documentElement) {
return {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
};
}
return {
width: document.body.clientWidth,
height: document.body.clientHeight
};
},
// json : function(obj, fltFunc, tab){
// // toJson
// if(typeof obj == "object"){
// return JSON.stringify(obj, fltFunc, tab);
// // fromJson
// if (!obj) {
// return null;
// return JSON.parse(obj, fltFunc);
toJson: function (obj, fltFunc, tab) {
return JSON.stringify(obj, fltFunc, tab);
},
fromJson: function (str, fltFunc) {
if (!str)
return null;
return JSON.parse(str, fltFunc);
},
// TODO !
scrollBarWidth: function () {
if (!window.SCROLL_BAR_WIDTH) {
var newDivOut = "<div id='div_out' style='position:relative;width:100px;height:100px;overflow-y:scroll;overflow-x:scroll'></div>";
var newDivIn = "<div id='div_in' style='position:absolute;width:100%;height:100%;'></div>";
var scrollWidth = 0;
$('body').append(newDivOut);
$('#div_out').append(newDivIn);
var divOutS = $('#div_out');
var divInS = $('#div_in');
scrollWidth = divOutS.width() - divInS.width();
$('#div_out').remove();
$('#div_in').remove();
window.SCROLL_BAR_WIDTH = scrollWidth;
}
return window.SCROLL_BAR_WIDTH;
},
currentTime: function (date) {
date = date || new Date();
return zUtil.dateToYYMMDD(date) + " " + zUtil.dateToHHMMSS(date);
},
dateToYYMMDD: function (date) {
date = date || new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
return year + "-" + zUtil.alignLeft(month, 2, '0') + "-" + zUtil.alignLeft(day, 2, '0');
},
dateToHHMMSS: function (date) {
date = date || new Date();
var hours = date.getHours()
var minutes = date.getMinutes();
var seconds = date.getSeconds();
return zUtil.alignLeft(hours, 2, '0') + ":" + zUtil.alignLeft(minutes, 2, '0') + ":" + zUtil.alignLeft(seconds, 2, '0');
},
anyToString: function (obj) {
if (_.isUndefined(obj) || _.isNull(obj)) {
return "";
}
if (_.isString(obj)) {
return obj;
}
if (_.isNumber(obj)) {
return "" + obj;
}
if (_.isObject(obj)) {
return zUtil.toJson(obj);
}
// TODO
zUtil.noImplement();
},
alignRight: function (str, length, char) {
str = zUtil.anyToString(str);
if (str.length >= length) {
return str;
}
return str + zUtil.dupString(char, length - str.length);
},
alignLeft: function (str, length, char) {
str = zUtil.anyToString(str);
if (str.length >= length) {
return str;
}
return zUtil.dupString(char, length - str.length) + str;
},
dupString: function (char, num) {
if (!char || num < 1) {
return "";
}
var str = "";
for (var i = 0; i < num; i++) {
str += char;
}
return str;
},
noImplement: function () {
throw new Error("Not implement yet!");
}
};
// log
zUtil.logConf = {
enable: true, // log
trace: false, // trace
showTime: true,
showMS: true
};
zUtil.log = function (log) {
if (zUtil.logConf.enable) {
var logPrefix = "";
if (zUtil.logConf.showTime) {
logPrefix += '
var date = new Date();
logPrefix += zUtil.currentTime(date);
if (zUtil.logConf.showMS) {
logPrefix += "." + date.getMilliseconds();
}
logPrefix += '
}
console.debug(logPrefix + log);
if (zUtil.logConf.trace) {
console.trace();
}
}
};
// NutzUtil
window.$z = zUtil;
if (typeof define === "function" && define.cmd) {
define("zutil", ["underscore"], function () {
return zUtil;
});
}
})();
|
create table ACT_HI_IDENTITYLINK (
ID_ varchar(64) not null,
GROUP_ID_ varchar(255),
TYPE_ varchar(255),
USER_ID_ varchar(255),
TASK_ID_ varchar(64),
CREATE_TIME_ timestamp,
PROC_INST_ID_ varchar(64),
SCOPE_ID_ varchar(255),
SUB_SCOPE_ID_ varchar(255),
SCOPE_TYPE_ varchar(255),
<API key> varchar(255),
primary key (ID_)
);
create index <API key> on ACT_HI_IDENTITYLINK(USER_ID_);
create index <API key> on ACT_HI_IDENTITYLINK(SCOPE_ID_, SCOPE_TYPE_);
create index <API key> on ACT_HI_IDENTITYLINK(SUB_SCOPE_ID_, SCOPE_TYPE_);
create index <API key> on ACT_HI_IDENTITYLINK(<API key>, SCOPE_TYPE_);
|
// +build linux,!<API key>
package main
import (
"os"
"strconv"
"strings"
"time"
ctd "github.com/containerd/containerd"
"github.com/moby/buildkit/cmd/buildkitd/config"
"github.com/moby/buildkit/worker"
"github.com/moby/buildkit/worker/base"
"github.com/moby/buildkit/worker/containerd"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
const (
<API key> = "/run/containerd/containerd.sock"
<API key> = "buildkit"
)
func init() {
defaultConf, _ := defaultConf()
enabledValue := func(b *bool) string {
if b == nil {
return "auto"
}
return strconv.FormatBool(*b)
}
if defaultConf.Workers.Containerd.Address == "" {
defaultConf.Workers.Containerd.Address = <API key>
}
if defaultConf.Workers.Containerd.Namespace == "" {
defaultConf.Workers.Containerd.Namespace = <API key>
}
<API key>(
workerInitializer{
fn: <API key>,
// 1 is less preferred than 0 (runcCtor)
priority: 1,
},
cli.StringFlag{
Name: "containerd-worker",
Usage: "enable containerd workers (true/false/auto)",
Value: enabledValue(defaultConf.Workers.Containerd.Enabled),
},
cli.StringFlag{
Name: "<API key>",
Usage: "containerd socket",
Value: defaultConf.Workers.Containerd.Address,
},
cli.StringSliceFlag{
Name: "<API key>",
Usage: "user-specific annotation labels (com.example.foo=bar)",
},
// TODO: <API key> should be replaced by ability
// to set these from containerd configuration
cli.StringSliceFlag{
Name: "<API key>",
Usage: "override supported platforms for worker",
Hidden: true,
},
cli.StringFlag{
Name: "<API key>",
Usage: "override containerd namespace",
Value: defaultConf.Workers.Containerd.Namespace,
Hidden: true,
},
)
// TODO(AkihiroSuda): allow using multiple snapshotters. should be useful for some applications that does not work with the default overlay snapshotter. e.g. mysql (docker/for-linux
}
func <API key>(c *cli.Context, cfg *config.Config) error {
if cfg.Workers.Containerd.Address == "" {
cfg.Workers.Containerd.Address = <API key>
}
if c.GlobalIsSet("containerd-worker") {
boolOrAuto, err := parseBoolOrAuto(c.GlobalString("containerd-worker"))
if err != nil {
return err
}
cfg.Workers.Containerd.Enabled = boolOrAuto
}
// GlobalBool works for BoolT as well
rootless := c.GlobalBool("rootless")
if rootless {
logrus.Warn("rootless mode is not supported for containerd workers. disabling containerd worker.")
b := false
cfg.Workers.Containerd.Enabled = &b
return nil
}
labels, err := attrMap(c.GlobalStringSlice("<API key>"))
if err != nil {
return err
}
if cfg.Workers.Containerd.Labels == nil {
cfg.Workers.Containerd.Labels = make(map[string]string)
}
for k, v := range labels {
cfg.Workers.Containerd.Labels[k] = v
}
if c.GlobalIsSet("<API key>") {
cfg.Workers.Containerd.Address = c.GlobalString("<API key>")
}
if platforms := c.GlobalStringSlice("<API key>"); len(platforms) != 0 {
cfg.Workers.Containerd.Platforms = platforms
}
if c.GlobalIsSet("<API key>") || cfg.Workers.Containerd.Namespace == "" {
cfg.Workers.Containerd.Namespace = c.GlobalString("<API key>")
}
return nil
}
func <API key>(c *cli.Context, common <API key>) ([]worker.Worker, error) {
if err := <API key>(c, common.config); err != nil {
return nil, err
}
cfg := common.config.Workers.Containerd
if (cfg.Enabled == nil && !<API key>(cfg.Address)) || (cfg.Enabled != nil && !*cfg.Enabled) {
return nil, nil
}
opt, err := containerd.NewWorkerOpt(common.config.Root, cfg.Address, ctd.DefaultSnapshotter, cfg.Namespace, cfg.Labels, ctd.WithTimeout(60*time.Second))
if err != nil {
return nil, err
}
opt.SessionManager = common.sessionManager
opt.GCPolicy = getGCPolicy(cfg.GCPolicy, common.config.Root)
opt.ResolveOptionsFunc = resolverFunc(common.config)
if platformsStr := cfg.Platforms; len(platformsStr) != 0 {
platforms, err := parsePlatforms(platformsStr)
if err != nil {
return nil, errors.Wrap(err, "invalid platforms")
}
opt.Platforms = platforms
}
w, err := base.NewWorker(opt)
if err != nil {
return nil, err
}
return []worker.Worker{w}, nil
}
func <API key>(socket string) bool {
if strings.HasPrefix(socket, "tcp:
// FIXME(AkihiroSuda): prohibit tcp?
return true
}
socketPath := strings.TrimPrefix(socket, "unix:
if _, err := os.Stat(socketPath); os.IsNotExist(err) {
// FIXME(AkihiroSuda): add more conditions
logrus.Warnf("skipping containerd worker, as %q does not exist", socketPath)
return false
}
// TODO: actually dial and call introspection API
return true
}
|
#ifndef <API key>
#define <API key>
#include "include/cef_app.h"
class SimpleApp : public CefApp,
public <API key> {
public:
SimpleApp();
// CefApp methods:
virtual CefRefPtr<<API key>> <API key>()
OVERRIDE { return this; }
// <API key> methods:
virtual void <API key>() OVERRIDE;
private:
// Include the default reference counting implementation.
<API key>(SimpleApp);
};
#endif // <API key>
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace study.Controllers
{
// [Route("api/[controller]")]
// public class LearnerController : Controller
// private readonly studyContext _db1 = new studyContext();
// static List<Ptoken> tokens = new List<Ptoken>();
// class Ptoken
// public string Identity { get; set; }
// public string Token { get; set; }
// // private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// protected override void Dispose(bool disposing)
// if (disposing)
// _db1.Dispose();
// base.Dispose(disposing);
// [Route("GetToken")]
// [HttpGet]
// public GetTokenResponse GetToken(string identity)
// try
// if (string.IsNullOrEmpty(identity))
// return new GetTokenResponse { StatusCode = "100004", Description = "error identity" };
// var theuser = _db1.User.FirstOrDefault(async => async.Identity == identity);
// if (theuser == null)
// return new GetTokenResponse { StatusCode = "100004", Description = "error identity" };
// var toke1n = GetToken();
// var found = false;
// foreach (var a in tokens)
// if (a.Identity == identity)
// a.Token = toke1n;
// found = true;
// break;
// if (!found)
// tokens.Add(new Ptoken { Identity = identity, Token = toke1n });
// return new GetTokenResponse
// Token = toke1n,
// StatusCode = "100000",
// Description = "ok",
// Identity = theuser.Identity,
// Name = theuser.Name,
// Photo = string.IsNullOrEmpty(theuser.Photo) ? string.Empty : theuser.Photo,
// catch (Exception ex)
// // Log.Error("GetLearnerInfo", ex);
// return new GetTokenResponse { StatusCode = "100003", Description = ex.Message };
// [Route("CompleteCourses")]
// [HttpPost]
// public CommonResponse CompleteCourses([FromBody] <API key> inputRequest)
// try
// if (inputRequest == null)
// return new CommonResponse { StatusCode = "100002", Description = "" };
// var found = false;
// var identity = string.Empty;
// foreach (var a in tokens)
// if (a.Token == inputRequest.Token)
// identity = a.Identity;
// found = true;
// break;
// if (!found)
// return new CommonResponse { StatusCode = "100001", Description = "error token" };
// var theuser = _db1.User.FirstOrDefault(async => async.Identity == identity);
// if (theuser == null)
// return new <API key> { StatusCode = "100004", Description = "error identity" };
// theuser.Studycompletedate = DateTime.Now;
// theuser.Studylog += inputRequest.AllRecords + inputRequest.AllStatus;
// _db1.SaveChanges();
// return new CommonResponse
// StatusCode = "100000",
// Description = "ok",
// catch (Exception ex)
// // Log.Error("CompleteCourses", ex);
// return new CommonResponse { StatusCode = "100003", Description = ex.Message };
// [Route("PostStudyStatus")]
// [HttpPost]
// public CommonResponse PostStudyStatus([FromBody] StudyStatusRequest inputRequest)
// try
// if (inputRequest == null)
// return new CommonResponse { StatusCode = "100002", Description = "" };
// var found = false;
// var identity = string.Empty;
// foreach (var a in tokens)
// if (a.Token == inputRequest.Token)
// identity = a.Identity;
// found = true;
// break;
// if (!found)
// return new CommonResponse { StatusCode = "100001", Description = "error token" };
// var theuser = _db1.User.FirstOrDefault(async => async.Identity == identity);
// if (theuser == null)
// return new <API key> { StatusCode = "100004", Description = "error identity" };
// if (theuser.Studystartdate == null)
// theuser.Studystartdate = DateTime.Now;
// Console.WriteLine("startdate,{0}", theuser.Studystartdate);
// theuser.Studylog += JsonConvert.SerializeObject(inputRequest);
// _db1.SaveChanges();
// return new CommonResponse
// StatusCode = "100000",
// Description = "ok",
// catch (Exception ex)
// // Log.Error("PostStudyStatus", ex);
// return new CommonResponse { StatusCode = "100003", Description = ex.Message };
// [Route("GetLearnerInfo")]
// [HttpGet]
// public <API key> GetLearnerInfo(string token)
// try
// if (string.IsNullOrEmpty(token))
// return new <API key> { StatusCode = "100001", Description = "error token" };
// var found = false;
// var identity = string.Empty;
// foreach (var a in tokens)
// if (a.Token ==token)
// identity = a.Identity;
// found = true;
// break;
// if (!found)
// return new <API key> { StatusCode = "100001", Description = "error token" };
// var theuser = _db1.User.FirstOrDefault(async => async.Identity == identity);
// if (theuser == null)
// return new <API key> { StatusCode = "100004", Description = "error identity" };
// return new <API key>
// StatusCode = "100000",
// Description = "ok",
// Identity = theuser.Identity,
// Name = theuser.Name,
// // Photo = new byte[1]
// catch (Exception ex)
// // Log.Error("GetLearnerInfo", ex);
// return new <API key> { StatusCode = "100003", Description = ex.Message };
// private string GetToken()
// var seed = Guid.NewGuid().ToString("N");
// //var token = Convert.ToBase64String(Guid.ToByteArray()).TrimEnd('=');
// return seed;
}
|
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
package com.jcraft.jorbis;
import com.jcraft.jogg.Buffer;
abstract class FuncFloor {
public static FuncFloor[] floor_P = {new Floor0(), new Floor1()};
abstract void pack(Object i, Buffer opb);
abstract Object unpack(Info vi, Buffer opb);
abstract Object look(DspState vd, InfoMode mi, Object i);
abstract void free_info(Object i);
abstract void free_look(Object i);
abstract void free_state(Object vs);
abstract int forward(Block vb, Object i, float[] in, float[] out, Object vs);
abstract Object inverse1(Block vb, Object i, Object memo);
abstract int inverse2(Block vb, Object i, Object memo, float[] out);
}
|
#pragma once
#include <aws/inspector/Inspector_EXPORTS.h>
#include <aws/core/Region.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace Inspector
{
namespace InspectorEndpoint
{
AWS_INSPECTOR_API Aws::String ForRegion(const Aws::String& regionName, bool useDualStack = false);
} // namespace InspectorEndpoint
} // namespace Inspector
} // namespace Aws
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.