repo_name
stringlengths 5
89
| path
stringlengths 4
310
| size
stringlengths 1
7
| content
stringlengths 4
1.04M
| license
stringclasses 15
values |
---|---|---|---|---|
fredyw/leetcode | src/main/java/leetcode/Problem804.java | 799 | package leetcode;
import java.util.HashSet;
import java.util.Set;
/**
* https://leetcode.com/problems/unique-morse-code-words/
*/
public class Problem804 {
public int uniqueMorseRepresentations(String[] words) {
String[] morse = new String[]{
".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..",
"--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-",
"-.--", "--.."};
Set<String> set = new HashSet<>();
for (String word : words) {
StringBuilder sb = new StringBuilder();
for (char c : word.toCharArray()) {
sb.append(morse[c - 'a']);
}
set.add(sb.toString());
}
return set.size();
}
}
| mit |
nagadomi/animeface-2009 | nvxs/CLAPACK/TESTING/LIN/srqt02.c | 6800 | #include "f2c.h"
#include "blaswrap.h"
/* Common Block Declarations */
struct {
char srnamt[6];
} srnamc_;
#define srnamc_1 srnamc_
/* Table of constant values */
static real c_b4 = -1e10f;
static real c_b10 = 0.f;
static real c_b15 = -1.f;
static real c_b16 = 1.f;
/* Subroutine */ int srqt02_(integer *m, integer *n, integer *k, real *a,
real *af, real *q, real *r__, integer *lda, real *tau, real *work,
integer *lwork, real *rwork, real *result)
{
/* System generated locals */
integer a_dim1, a_offset, af_dim1, af_offset, q_dim1, q_offset, r_dim1,
r_offset, i__1, i__2;
/* Builtin functions */
/* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
/* Local variables */
real eps;
integer info;
real resid;
extern /* Subroutine */ int sgemm_(char *, char *, integer *, integer *,
integer *, real *, real *, integer *, real *, integer *, real *,
real *, integer *);
real anorm;
extern /* Subroutine */ int ssyrk_(char *, char *, integer *, integer *,
real *, real *, integer *, real *, real *, integer *);
extern doublereal slamch_(char *), slange_(char *, integer *,
integer *, real *, integer *, real *);
extern /* Subroutine */ int slacpy_(char *, integer *, integer *, real *,
integer *, real *, integer *), slaset_(char *, integer *,
integer *, real *, real *, real *, integer *);
extern doublereal slansy_(char *, char *, integer *, real *, integer *,
real *);
extern /* Subroutine */ int sorgrq_(integer *, integer *, integer *, real
*, integer *, real *, real *, integer *, integer *);
/* -- LAPACK test routine (version 3.1) -- */
/* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
/* November 2006 */
/* .. Scalar Arguments .. */
/* .. */
/* .. Array Arguments .. */
/* .. */
/* Purpose */
/* ======= */
/* SRQT02 tests SORGRQ, which generates an m-by-n matrix Q with */
/* orthonornmal rows that is defined as the product of k elementary */
/* reflectors. */
/* Given the RQ factorization of an m-by-n matrix A, SRQT02 generates */
/* the orthogonal matrix Q defined by the factorization of the last k */
/* rows of A; it compares R(m-k+1:m,n-m+1:n) with */
/* A(m-k+1:m,1:n)*Q(n-m+1:n,1:n)', and checks that the rows of Q are */
/* orthonormal. */
/* Arguments */
/* ========= */
/* M (input) INTEGER */
/* The number of rows of the matrix Q to be generated. M >= 0. */
/* N (input) INTEGER */
/* The number of columns of the matrix Q to be generated. */
/* N >= M >= 0. */
/* K (input) INTEGER */
/* The number of elementary reflectors whose product defines the */
/* matrix Q. M >= K >= 0. */
/* A (input) REAL array, dimension (LDA,N) */
/* The m-by-n matrix A which was factorized by SRQT01. */
/* AF (input) REAL array, dimension (LDA,N) */
/* Details of the RQ factorization of A, as returned by SGERQF. */
/* See SGERQF for further details. */
/* Q (workspace) REAL array, dimension (LDA,N) */
/* R (workspace) REAL array, dimension (LDA,M) */
/* LDA (input) INTEGER */
/* The leading dimension of the arrays A, AF, Q and L. LDA >= N. */
/* TAU (input) REAL array, dimension (M) */
/* The scalar factors of the elementary reflectors corresponding */
/* to the RQ factorization in AF. */
/* WORK (workspace) REAL array, dimension (LWORK) */
/* LWORK (input) INTEGER */
/* The dimension of the array WORK. */
/* RWORK (workspace) REAL array, dimension (M) */
/* RESULT (output) REAL array, dimension (2) */
/* The test ratios: */
/* RESULT(1) = norm( R - A*Q' ) / ( N * norm(A) * EPS ) */
/* RESULT(2) = norm( I - Q*Q' ) / ( N * EPS ) */
/* ===================================================================== */
/* .. Parameters .. */
/* .. */
/* .. Local Scalars .. */
/* .. */
/* .. External Functions .. */
/* .. */
/* .. External Subroutines .. */
/* .. */
/* .. Intrinsic Functions .. */
/* .. */
/* .. Scalars in Common .. */
/* .. */
/* .. Common blocks .. */
/* .. */
/* .. Executable Statements .. */
/* Quick return if possible */
/* Parameter adjustments */
r_dim1 = *lda;
r_offset = 1 + r_dim1;
r__ -= r_offset;
q_dim1 = *lda;
q_offset = 1 + q_dim1;
q -= q_offset;
af_dim1 = *lda;
af_offset = 1 + af_dim1;
af -= af_offset;
a_dim1 = *lda;
a_offset = 1 + a_dim1;
a -= a_offset;
--tau;
--work;
--rwork;
--result;
/* Function Body */
if (*m == 0 || *n == 0 || *k == 0) {
result[1] = 0.f;
result[2] = 0.f;
return 0;
}
eps = slamch_("Epsilon");
/* Copy the last k rows of the factorization to the array Q */
slaset_("Full", m, n, &c_b4, &c_b4, &q[q_offset], lda);
if (*k < *n) {
i__1 = *n - *k;
slacpy_("Full", k, &i__1, &af[*m - *k + 1 + af_dim1], lda, &q[*m - *k
+ 1 + q_dim1], lda);
}
if (*k > 1) {
i__1 = *k - 1;
i__2 = *k - 1;
slacpy_("Lower", &i__1, &i__2, &af[*m - *k + 2 + (*n - *k + 1) *
af_dim1], lda, &q[*m - *k + 2 + (*n - *k + 1) * q_dim1], lda);
}
/* Generate the last n rows of the matrix Q */
s_copy(srnamc_1.srnamt, "SORGRQ", (ftnlen)6, (ftnlen)6);
sorgrq_(m, n, k, &q[q_offset], lda, &tau[*m - *k + 1], &work[1], lwork, &
info);
/* Copy R(m-k+1:m,n-m+1:n) */
slaset_("Full", k, m, &c_b10, &c_b10, &r__[*m - *k + 1 + (*n - *m + 1) *
r_dim1], lda);
slacpy_("Upper", k, k, &af[*m - *k + 1 + (*n - *k + 1) * af_dim1], lda, &
r__[*m - *k + 1 + (*n - *k + 1) * r_dim1], lda);
/* Compute R(m-k+1:m,n-m+1:n) - A(m-k+1:m,1:n) * Q(n-m+1:n,1:n)' */
sgemm_("No transpose", "Transpose", k, m, n, &c_b15, &a[*m - *k + 1 +
a_dim1], lda, &q[q_offset], lda, &c_b16, &r__[*m - *k + 1 + (*n -
*m + 1) * r_dim1], lda);
/* Compute norm( R - A*Q' ) / ( N * norm(A) * EPS ) . */
anorm = slange_("1", k, n, &a[*m - *k + 1 + a_dim1], lda, &rwork[1]);
resid = slange_("1", k, m, &r__[*m - *k + 1 + (*n - *m + 1) * r_dim1],
lda, &rwork[1]);
if (anorm > 0.f) {
result[1] = resid / (real) max(1,*n) / anorm / eps;
} else {
result[1] = 0.f;
}
/* Compute I - Q*Q' */
slaset_("Full", m, m, &c_b10, &c_b16, &r__[r_offset], lda);
ssyrk_("Upper", "No transpose", m, n, &c_b15, &q[q_offset], lda, &c_b16, &
r__[r_offset], lda);
/* Compute norm( I - Q*Q' ) / ( N * EPS ) . */
resid = slansy_("1", "Upper", m, &r__[r_offset], lda, &rwork[1]);
result[2] = resid / (real) max(1,*n) / eps;
return 0;
/* End of SRQT02 */
} /* srqt02_ */
| mit |
xdien/Sua-anh | README.md | 10 | # Sua-anh
| mit |
fuzzbomb/accessibility-demos | ms-high-contrast-media-query.html | 1848 | <!DOCTYPE html>
<html lang="en">
<head>
<title>MS High Contrast Media Query Test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@media all and (-ms-high-contrast) {
.mshc:after {
content: ' MATCHED';
}
}
@media all and (-ms-high-contrast: none) {
.mshc-none:after {
content: ' MATCHED';
}
}
@media all and (-ms-high-contrast: active) {
.mshc-active:after {
content: ' MATCHED';
}
}
@media all and (-ms-high-contrast: white-on-black) {
.mshc-white-on-black:after {
content: ' MATCHED';
}
}
@media all and (-ms-high-contrast: black-on-white) {
.mshc-black-on-white:after {
content: ' MATCHED';
}
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.mshc-none-or-active:after {
content: ' MATCHED';
}
}
</style>
</head>
<body>
<main role="main">
<h1>MS High Contrast Media Query Test</h1>
<p>A test page for various ways to use the <code>-ms-high-contrast</code> media query.</p>
<p class="mshc"><code>@media all and (-ms-high-contrast)</code></p>
<p class="mshc-none"><code>@media all and (-ms-high-contrast: none)</code></p>
<p class="mshc-active"><code>@media all and (-ms-high-contrast: active)</code></p>
<p class="mshc-white-on-black"><code>@media all and (-ms-high-contrast: white-on-black)</code></p>
<p class="mshc-black-on-white"><code>@media all and (-ms-high-contrast: black-on-white)</code></p>
<p class="mshc-none-or-active"><code>@media all and (-ms-high-contrast: none), (-ms-high-contrast: active)</code></p>
</main>
</body>
</html>
| mit |
hongjianqiang/Reading-Notes | 深入浅出NodeJS/demo/EventProxy实现前端模块加载/js/eventproxy.js | 18203 | /*global define*/
!(function (name, definition) {
// Check define
var hasDefine = typeof define === 'function',
// Check exports
hasExports = typeof module !== 'undefined' && module.exports;
if (hasDefine) {
// AMD Module or CMD Module
define('eventproxy_debug', function () {return function () {};});
define(['eventproxy_debug'], definition);
} else if (hasExports) {
// Node.js Module
module.exports = definition(require('debug')('eventproxy'));
} else {
// Assign to common namespaces or simply the global object (window)
this[name] = definition();
}
})('EventProxy', function (debug) {
debug = debug || function () {};
/*!
* refs
*/
var SLICE = Array.prototype.slice;
var CONCAT = Array.prototype.concat;
var ALL_EVENT = '__all__';
/**
* EventProxy. An implementation of task/event based asynchronous pattern.
* A module that can be mixed in to *any object* in order to provide it with custom events.
* You may `bind` or `unbind` a callback function to an event;
* `trigger`-ing an event fires all callbacks in succession.
* Examples:
* ```js
* var render = function (template, resources) {};
* var proxy = new EventProxy();
* proxy.assign("template", "l10n", render);
* proxy.trigger("template", template);
* proxy.trigger("l10n", resources);
* ```
*/
var EventProxy = function () {
if (!(this instanceof EventProxy)) {
return new EventProxy();
}
this._callbacks = {};
this._fired = {};
this._events = {};
};
/**
* Bind an event, specified by a string name, `ev`, to a `callback` function.
* Passing __ALL_EVENT__ will bind the callback to all events fired.
* Examples:
* ```js
* var proxy = new EventProxy();
* proxy.addListener("template", function (event) {
* // TODO
* });
* ```
* @param {String} eventname Event name.
* @param {Function} callback Callback.
*/
EventProxy.prototype.addListener = function (ev, callback) {
debug('Add listener for %s', ev);
this._callbacks[ev] = this._callbacks[ev] || [];
this._callbacks[ev].push(callback);
return this;
};
/**
* `addListener` alias, `bind`
*/
EventProxy.prototype.bind = EventProxy.prototype.addListener;
/**
* `addListener` alias, `on`
*/
EventProxy.prototype.on = EventProxy.prototype.addListener;
/**
* `addListener` alias, `subscribe`
*/
EventProxy.prototype.subscribe = EventProxy.prototype.addListener;
/**
* Bind an event, but put the callback into head of all callbacks.
* @param {String} eventname Event name.
* @param {Function} callback Callback.
*/
EventProxy.prototype.headbind = function (ev, callback) {
debug('Add listener for %s', ev);
this._callbacks[ev] = this._callbacks[ev] || [];
this._callbacks[ev].unshift(callback);
return this;
};
/**
* Remove one or many callbacks.
*
* - If `callback` is null, removes all callbacks for the event.
* - If `eventname` is null, removes all bound callbacks for all events.
* @param {String} eventname Event name.
* @param {Function} callback Callback.
*/
EventProxy.prototype.removeListener = function (eventname, callback) {
var calls = this._callbacks;
if (!eventname) {
debug('Remove all listeners');
this._callbacks = {};
} else {
if (!callback) {
debug('Remove all listeners of %s', eventname);
calls[eventname] = [];
} else {
var list = calls[eventname];
if (list) {
var l = list.length;
for (var i = 0; i < l; i++) {
if (callback === list[i]) {
debug('Remove a listener of %s', eventname);
list[i] = null;
}
}
}
}
}
return this;
};
/**
* `removeListener` alias, unbind
*/
EventProxy.prototype.unbind = EventProxy.prototype.removeListener;
/**
* Remove all listeners. It equals unbind()
* Just add this API for as same as Event.Emitter.
* @param {String} event Event name.
*/
EventProxy.prototype.removeAllListeners = function (event) {
return this.unbind(event);
};
/**
* Bind the ALL_EVENT event
*/
EventProxy.prototype.bindForAll = function (callback) {
this.bind(ALL_EVENT, callback);
};
/**
* Unbind the ALL_EVENT event
*/
EventProxy.prototype.unbindForAll = function (callback) {
this.unbind(ALL_EVENT, callback);
};
/**
* Trigger an event, firing all bound callbacks. Callbacks are passed the
* same arguments as `trigger` is, apart from the event name.
* Listening for `"all"` passes the true event name as the first argument.
* @param {String} eventname Event name
* @param {Mix} data Pass in data
*/
EventProxy.prototype.trigger = function (eventname, data) {
var list, ev, callback, i, l;
var both = 2;
var calls = this._callbacks;
debug('Emit event %s with data %j', eventname, data);
while (both--) {
ev = both ? eventname : ALL_EVENT;
list = calls[ev];
if (list) {
for (i = 0, l = list.length; i < l; i++) {
if (!(callback = list[i])) {
list.splice(i, 1);
i--;
l--;
} else {
var args = [];
var start = both ? 1 : 0;
for (var j = start; j < arguments.length; j++) {
args.push(arguments[j]);
}
callback.apply(this, args);
}
}
}
}
return this;
};
/**
* `trigger` alias
*/
EventProxy.prototype.emit = function(eventname, data) {
this._events[eventname] = data;
this.trigger.apply(this, [eventname, data]);
};
/**
* `trigger` alias
*/
EventProxy.prototype.fire = EventProxy.prototype.trigger;
/**
* Bind an event like the bind method, but will remove the listener after it was fired.
* @param {String} ev Event name
* @param {Function} callback Callback
*/
EventProxy.prototype.once = function (ev, callback) {
var self = this;
var wrapper = function () {
callback.apply(self, arguments);
self.unbind(ev, wrapper);
};
this.bind(ev, wrapper);
return this;
};
var later = (typeof setImmediate !== 'undefined' && setImmediate) ||
(typeof process !== 'undefined' && process.nextTick) || function (fn) {
setTimeout(fn, 0);
};
/**
* emitLater
* make emit async
*/
EventProxy.prototype.emitLater = function () {
var self = this;
var args = arguments;
later(function () {
self.trigger.apply(self, args);
});
};
/**
* Bind an event, and trigger it immediately.
* @param {String} ev Event name.
* @param {Function} callback Callback.
* @param {Mix} data The data that will be passed to calback as arguments.
*/
EventProxy.prototype.immediate = function (ev, callback, data) {
this.bind(ev, callback);
this.trigger(ev, data);
return this;
};
/**
* `immediate` alias
*/
EventProxy.prototype.asap = EventProxy.prototype.immediate;
var _assign = function (eventname1, eventname2, cb, once) {
var proxy = this;
var argsLength = arguments.length;
var times = 0;
var flag = {};
// Check the arguments length.
if (argsLength < 3) {
return this;
}
var events = SLICE.call(arguments, 0, -2);
var callback = arguments[argsLength - 2];
var isOnce = arguments[argsLength - 1];
// Check the callback type.
if (typeof callback !== "function") {
return this;
}
debug('Assign listener for events %j, once is %s', events, !!isOnce);
var bind = function (key) {
var method = isOnce ? "once" : "bind";
proxy[method](key, function (data) {
proxy._fired[key] = proxy._fired[key] || {};
proxy._fired[key].data = data;
if (!flag[key]) {
flag[key] = true;
times++;
}
});
};
var length = events.length;
for (var index = 0; index < length; index++) {
bind(events[index]);
}
var _all = function (event) {
if (times < length) {
return;
}
if (!flag[event]) {
return;
}
var data = [];
for (var index = 0; index < length; index++) {
data.push(proxy._fired[events[index]].data);
}
if (isOnce) {
proxy.unbindForAll(_all);
}
debug('Events %j all emited with data %j', events, data);
callback.apply(null, data);
};
proxy.bindForAll(_all);
};
/**
* Assign some events, after all events were fired, the callback will be executed once.
*
* Examples:
* ```js
* proxy.all(ev1, ev2, callback);
* proxy.all([ev1, ev2], callback);
* proxy.all(ev1, [ev2, ev3], callback);
* ```
* @param {String} eventname1 First event name.
* @param {String} eventname2 Second event name.
* @param {Function} callback Callback, that will be called after predefined events were fired.
*/
EventProxy.prototype.all = function (eventname1, eventname2, callback) {
var args = CONCAT.apply([], arguments);
args.push(true);
_assign.apply(this, args);
for (var k in this._events) {
this.emit.apply(this, [k, this._events[k]]);
}
return this;
};
/**
* `all` alias
*/
EventProxy.prototype.assign = EventProxy.prototype.all;
/**
* Assign the only one 'error' event handler.
* @param {Function(err)} callback
*/
EventProxy.prototype.fail = function (callback) {
var that = this;
that.once('error', function () {
that.unbind();
// put all arguments to the error handler
// fail(function(err, args1, args2, ...){})
callback.apply(null, arguments);
});
return this;
};
/**
* A shortcut of ep#emit('error', err)
*/
EventProxy.prototype.throw = function () {
var that = this;
that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
};
/**
* Assign some events, after all events were fired, the callback will be executed first time.
* Then any event that predefined be fired again, the callback will executed with the newest data.
* Examples:
* ```js
* proxy.tail(ev1, ev2, callback);
* proxy.tail([ev1, ev2], callback);
* proxy.tail(ev1, [ev2, ev3], callback);
* ```
* @param {String} eventname1 First event name.
* @param {String} eventname2 Second event name.
* @param {Function} callback Callback, that will be called after predefined events were fired.
*/
EventProxy.prototype.tail = function () {
var args = CONCAT.apply([], arguments);
args.push(false);
_assign.apply(this, args);
return this;
};
/**
* `tail` alias, assignAll
*/
EventProxy.prototype.assignAll = EventProxy.prototype.tail;
/**
* `tail` alias, assignAlways
*/
EventProxy.prototype.assignAlways = EventProxy.prototype.tail;
/**
* The callback will be executed after the event be fired N times.
* @param {String} eventname Event name.
* @param {Number} times N times.
* @param {Function} callback Callback, that will be called after event was fired N times.
*/
EventProxy.prototype.after = function (eventname, times, callback) {
if (times === 0) {
callback.call(null, []);
return this;
}
var proxy = this,
firedData = [];
this._after = this._after || {};
var group = eventname + '_group';
this._after[group] = {
index: 0,
results: []
};
debug('After emit %s times, event %s\'s listenner will execute', times, eventname);
var all = function (name, data) {
if (name === eventname) {
times--;
firedData.push(data);
if (times < 1) {
debug('Event %s was emit %s, and execute the listenner', eventname, times);
proxy.unbindForAll(all);
callback.apply(null, [firedData]);
}
}
if (name === group) {
times--;
proxy._after[group].results[data.index] = data.result;
if (times < 1) {
debug('Event %s was emit %s, and execute the listenner', eventname, times);
proxy.unbindForAll(all);
callback.call(null, proxy._after[group].results);
}
}
};
proxy.bindForAll(all);
return this;
};
/**
* The `after` method's helper. Use it will return ordered results.
* If you need manipulate result, you need callback
* Examples:
* ```js
* var ep = new EventProxy();
* ep.after('file', files.length, function (list) {
* // Ordered results
* });
* for (var i = 0; i < files.length; i++) {
* fs.readFile(files[i], 'utf-8', ep.group('file'));
* }
* ```
* @param {String} eventname Event name, shoule keep consistent with `after`.
* @param {Function} callback Callback function, should return the final result.
*/
EventProxy.prototype.group = function (eventname, callback) {
var that = this;
var group = eventname + '_group';
var index = that._after[group].index;
that._after[group].index++;
return function (err, data) {
if (err) {
// put all arguments to the error handler
return that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
}
that.emit(group, {
index: index,
// callback(err, args1, args2, ...)
result: callback ? callback.apply(null, SLICE.call(arguments, 1)) : data
});
};
};
/**
* The callback will be executed after any registered event was fired. It only executed once.
* @param {String} eventname1 Event name.
* @param {String} eventname2 Event name.
* @param {Function} callback The callback will get a map that has data and eventname attributes.
*/
EventProxy.prototype.any = function () {
var proxy = this,
callback = arguments[arguments.length - 1],
events = SLICE.call(arguments, 0, -1),
_eventname = events.join("_");
debug('Add listenner for Any of events %j emit', events);
proxy.once(_eventname, callback);
var _bind = function (key) {
proxy.bind(key, function (data) {
debug('One of events %j emited, execute the listenner');
proxy.trigger(_eventname, {"data": data, eventName: key});
});
};
for (var index = 0; index < events.length; index++) {
_bind(events[index]);
}
};
/**
* The callback will be executed when the event name not equals with assigned event.
* @param {String} eventname Event name.
* @param {Function} callback Callback.
*/
EventProxy.prototype.not = function (eventname, callback) {
var proxy = this;
debug('Add listenner for not event %s', eventname);
proxy.bindForAll(function (name, data) {
if (name !== eventname) {
debug('listenner execute of event %s emit, but not event %s.', name, eventname);
callback(data);
}
});
};
/**
* Success callback wrapper, will handler err for you.
*
* ```js
* fs.readFile('foo.txt', ep.done('content'));
*
* // equal to =>
*
* fs.readFile('foo.txt', function (err, content) {
* if (err) {
* return ep.emit('error', err);
* }
* ep.emit('content', content);
* });
* ```
*
* ```js
* fs.readFile('foo.txt', ep.done('content', function (content) {
* return content.trim();
* }));
*
* // equal to =>
*
* fs.readFile('foo.txt', function (err, content) {
* if (err) {
* return ep.emit('error', err);
* }
* ep.emit('content', content.trim());
* });
* ```
* @param {Function|String} handler, success callback or event name will be emit after callback.
* @return {Function}
*/
EventProxy.prototype.done = function (handler, callback) {
var that = this;
return function (err, data) {
if (err) {
// put all arguments to the error handler
return that.emit.apply(that, ['error'].concat(SLICE.call(arguments)));
}
// callback(err, args1, args2, ...)
var args = SLICE.call(arguments, 1);
if (typeof handler === 'string') {
// getAsync(query, ep.done('query'));
// or
// getAsync(query, ep.done('query', function (data) {
// return data.trim();
// }));
if (callback) {
// only replace the args when it really return a result
return that.emit(handler, callback.apply(null, args));
} else {
// put all arguments to the done handler
//ep.done('some');
//ep.on('some', function(args1, args2, ...){});
return that.emit.apply(that, [handler].concat(args));
}
}
// speed improve for mostly case: `callback(err, data)`
if (arguments.length <= 2) {
return handler(data);
}
// callback(err, args1, args2, ...)
handler.apply(null, args);
};
};
/**
* make done async
* @return {Function} delay done
*/
EventProxy.prototype.doneLater = function (handler, callback) {
var _doneHandler = this.done(handler, callback);
return function (err, data) {
var args = arguments;
later(function () {
_doneHandler.apply(null, args);
});
};
};
/**
* Create a new EventProxy
* Examples:
* ```js
* var ep = EventProxy.create();
* ep.assign('user', 'articles', function(user, articles) {
* // do something...
* });
* // or one line ways: Create EventProxy and Assign
* var ep = EventProxy.create('user', 'articles', function(user, articles) {
* // do something...
* });
* ```
* @return {EventProxy} EventProxy instance
*/
EventProxy.create = function () {
var ep = new EventProxy();
var args = CONCAT.apply([], arguments);
if (args.length) {
var errorHandler = args[args.length - 1];
var callback = args[args.length - 2];
if (typeof errorHandler === 'function' && typeof callback === 'function') {
args.pop();
ep.fail(errorHandler);
}
ep.assign.apply(ep, args);
}
return ep;
};
// Backwards compatibility
EventProxy.EventProxy = EventProxy;
return EventProxy;
});
var eventProxy = new EventProxy(); | mit |
Warframe-Community-Developers/warframe-worldstate-parser | .github/ISSUE_TEMPLATE/Bug_report.md | 163 | ---
name: Bug report
about: Create a report to help us improve
---
**Summary (short):**
---
**Description:**
---
**If issue, Reproduction:**
---
**Evidence:**
| mit |
ntrampe/FanFactory | fan/ntt/ntt_core/CCChangeScaleWithoutPositionChangeCenter.h | 1404 | /*
* Copyright (c) 2013 Nicholas Trampe
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#import <Foundation/Foundation.h>
#import "cocos2d.h"
@interface CCChangeScaleWithoutPositionChangeCenter : CCActionInstant <NSCopying>
{
CGPoint newScale;
}
+(id) actionWithScale: (CGPoint) scale;
-(id) initWithScale:(CGPoint) scale;
-(void) startWithTarget:(id)aTarget;
@end
| mit |
jsperts/workshop_unterlagen | angularjs/examples/14-Routing_2/app/main.component.js | 1710 | class Main {
constructor($scope, $route, $window) {
this.current = $route.current;
$scope.$on('$locationChangeStart', (event, newUrl, oldUrl) => {
this.locationStatus = 'Location change start';
this.oldUrl = oldUrl;
this.newUrl = newUrl;
});
$scope.$on('$routeChangeStart', (event, next, current) => {
this.current = current;
this.next = next;
this.status = 'Route change start';
});
$scope.$on('$locationChangeSuccess', (event, newUrl, oldUrl) => {
this.locationStatus = 'Location change success';
this.oldUrl = oldUrl;
this.newUrl = newUrl;
});
$scope.$on('$routeChangeSuccess', (event, current, previous) => {
this.current = current;
this.previous = previous;
this.status = 'Route change success';
});
$scope.$on('$routeChangeError', (event, current, previous, rejection) => {
this.current = current;
this.previous = previous;
this.status = `Route change failed: ${rejection}`;
});
}
}
Main.$inject = ['$scope', '$route', '$window'];
const component = {
template: `
<a href="#!/comp1?name=comp1">Component 1</a> <a href="#!/comp2?name=comp2">Component 2</a>
<div>Route status: {{$ctrl.status}}</div>
<div>
<pre>Previous: {{$ctrl.previous.params.name}}</pre>
<pre>Current: {{$ctrl.current.params.name}}</pre>
<pre>Next: {{$ctrl.next.params.name}}</pre>
</div>
<div>Location status: {{$ctrl.locationStatus}}</div>
<div>
<pre>Old Url: {{$ctrl.oldUrl}}</pre>
<pre>New Url: {{$ctrl.newUrl}}</pre>
</div>
<ng-view></ng-view>
`,
controller: Main
};
export default component;
export const name = 'myApp';
| mit |
ICJIA/icjia-tvpp | statamic/core/Extend/Management/ModifierLoader.php | 1357 | <?php
namespace Statamic\Extend\Management;
use Statamic\API\Str;
use Statamic\Exceptions\ResourceNotFoundException;
class ModifierLoader
{
public function load($modifier)
{
// An addon may contain multiple modifiers. You may specify a "secondary" modifier by delimiting with a dot.
// For example, "{{ var | bacon.bits }}" would reference the "BitsModifier" in the "Bacon" addon.
if (Str::contains($modifier, '.')) {
list($addon, $name) = explode('.', $modifier);
} else {
$addon = $name = $modifier;
}
$name = Str::studly($name);
$addon = Str::studly($addon);
$root = "Statamic\\Addons\\$addon";
// Modifiers may be stored in the root of the addon directory, named using YourAddonModifier.php or
// secondary ones may be named SecondaryModifier.php. Classes in the root will take precedence.
if (class_exists($rootClass = "{$root}\\{$name}Modifier")) {
return app($rootClass);
}
// Alternatively, modifiers may be placed in a "Modifiers" namespace.
if (class_exists($namespacedClass = "{$root}\\Modifiers\\{$name}Modifier")) {
return app($namespacedClass);
}
throw new ResourceNotFoundException("Could not find files to load the `{$modifier}` modifier.");
}
}
| mit |
Nazi-Nigger/Ms-CRM-2016-Controls | Ms-CRM-2016-Controls/Ms-CRM-2016-Controls Resources/Javascript/Intellisense Files/Lead Form - Information.js | 41290 | /// <reference path="Xrm.js" />
var EntityLogicalName = "lead";
var Form_9886ead0_4fcc_4747_9a18_08e7a9a6de71_Properties = {
address1_city: "address1_city",
address1_country: "address1_country",
address1_line1: "address1_line1",
address1_line2: "address1_line2",
address1_line3: "address1_line3",
address1_postalcode: "address1_postalcode",
address1_stateorprovince: "address1_stateorprovince",
campaignid: "campaignid",
companyname: "companyname",
description: "description",
donotbulkemail: "donotbulkemail",
donotemail: "donotemail",
donotfax: "donotfax",
donotphone: "donotphone",
donotpostalmail: "donotpostalmail",
donotsendmm: "donotsendmm",
emailaddress1: "emailaddress1",
fax: "fax",
firstname: "firstname",
industrycode: "industrycode",
jobtitle: "jobtitle",
lastname: "lastname",
lastusedincampaign: "lastusedincampaign",
leadqualitycode: "leadqualitycode",
leadsourcecode: "leadsourcecode",
mobilephone: "mobilephone",
numberofemployees: "numberofemployees",
ownerid: "ownerid",
pager: "pager",
preferredcontactmethodcode: "preferredcontactmethodcode",
revenue: "revenue",
salutation: "salutation",
sic: "sic",
statuscode: "statuscode",
subject: "subject",
telephone1: "telephone1",
telephone2: "telephone2",
telephone3: "telephone3",
transactioncurrencyid: "transactioncurrencyid",
websiteurl: "websiteurl"
};
var Form_9886ead0_4fcc_4747_9a18_08e7a9a6de71_Controls = {
address1_city: "address1_city",
address1_country: "address1_country",
address1_line1: "address1_line1",
address1_line2: "address1_line2",
address1_line3: "address1_line3",
address1_postalcode: "address1_postalcode",
address1_stateorprovince: "address1_stateorprovince",
campaignid: "campaignid",
companyname: "companyname",
description: "description",
donotbulkemail: "donotbulkemail",
donotemail: "donotemail",
donotfax: "donotfax",
donotphone: "donotphone",
donotpostalmail: "donotpostalmail",
donotsendmm: "donotsendmm",
emailaddress1: "emailaddress1",
fax: "fax",
firstname: "firstname",
header_leadqualitycode: "header_leadqualitycode",
header_leadsourcecode: "header_leadsourcecode",
header_ownerid: "header_ownerid",
industrycode: "industrycode",
jobtitle: "jobtitle",
lastname: "lastname",
lastusedincampaign: "lastusedincampaign",
leadactivitiesgrid: "leadactivitiesgrid",
leadqualitycode: "leadqualitycode",
leadsourcecode: "leadsourcecode",
mobilephone: "mobilephone",
notescontrol: "notescontrol",
numberofemployees: "numberofemployees",
ownerid: "ownerid",
pager: "pager",
preferredcontactmethodcode: "preferredcontactmethodcode",
revenue: "revenue",
salutation: "salutation",
sic: "sic",
statuscode: "statuscode",
subject: "subject",
telephone1: "telephone1",
telephone2: "telephone2",
telephone3: "telephone3",
transactioncurrencyid: "transactioncurrencyid",
WebResource_RecordWall: "WebResource_RecordWall",
websiteurl: "websiteurl"
};
var pageData = {
"Event": "none",
"SaveMode": 1,
"EventSource": null,
"AuthenticationHeader": "",
"CurrentTheme": "Default",
"OrgLcid": 1033,
"OrgUniqueName": "",
"QueryStringParameters": {
"_gridType": "4",
"etc": "4",
"id": "",
"pagemode": "iframe",
"preloadcache": "1344548892170",
"rskey": "141637534"
},
"ServerUrl": "",
"UserId": "",
"UserLcid": 1033,
"UserRoles": [""],
"isOutlookClient": false,
"isOutlookOnline": true,
"DataXml": "",
"EntityName": "lead",
"Id": "",
"IsDirty": false,
"CurrentControl": "",
"CurrentForm": null,
"Forms": [],
"FormType": 2,
"ViewPortHeight": 558,
"ViewPortWidth": 1231,
"Attributes": [{
"Name": "address1_city",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 80,
"Controls": [{
"Name": "address1_city"
}]
},
{
"Name": "address1_country",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 80,
"Controls": [{
"Name": "address1_country"
}]
},
{
"Name": "address1_line1",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 250,
"Controls": [{
"Name": "address1_line1"
}]
},
{
"Name": "address1_line2",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 250,
"Controls": [{
"Name": "address1_line2"
}]
},
{
"Name": "address1_line3",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 250,
"Controls": [{
"Name": "address1_line3"
}]
},
{
"Name": "address1_postalcode",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 20,
"Controls": [{
"Name": "address1_postalcode"
}]
},
{
"Name": "address1_stateorprovince",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 50,
"Controls": [{
"Name": "address1_stateorprovince"
}]
},
{
"Name": "campaignid",
"Value": [{
"entityType": "Unknown",
"id": "{27ACAE0A-5D79-E111-BBD3-2657AEB3167B}",
"name": "Temp"
}],
"Type": "lookup",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"Controls": [{
"Name": "campaignid"
}]
},
{
"Name": "companyname",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 100,
"Controls": [{
"Name": "companyname"
}]
},
{
"Name": "description",
"Value": "",
"Type": "memo",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 2000,
"Controls": [{
"Name": "description"
}]
},
{
"Name": "donotbulkemail",
"Value": null,
"Type": "boolean",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": null,
"Controls": [{
"Name": "donotbulkemail"
}]
},
{
"Name": "donotemail",
"Value": null,
"Type": "boolean",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": null,
"Controls": [{
"Name": "donotemail"
}]
},
{
"Name": "donotfax",
"Value": null,
"Type": "boolean",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": null,
"Controls": [{
"Name": "donotfax"
}]
},
{
"Name": "donotphone",
"Value": null,
"Type": "boolean",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": null,
"Controls": [{
"Name": "donotphone"
}]
},
{
"Name": "donotpostalmail",
"Value": null,
"Type": "boolean",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": null,
"Controls": [{
"Name": "donotpostalmail"
}]
},
{
"Name": "donotsendmm",
"Value": null,
"Type": "boolean",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": null,
"Controls": [{
"Name": "donotsendmm"
}]
},
{
"Name": "emailaddress1",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 100,
"Controls": [{
"Name": "emailaddress1"
}]
},
{
"Name": "fax",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 50,
"Controls": [{
"Name": "fax"
}]
},
{
"Name": "firstname",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 50,
"Controls": [{
"Name": "firstname"
}]
},
{
"Name": "industrycode",
"Value": null,
"Type": "optionset",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": 930650000,
"Options": [{
"text": "Accounting",
"value": 1
},
{
"text": "Agriculture and Non-petrol Natural Resource Extraction",
"value": 2
},
{
"text": "Broadcasting Printing and Publishing",
"value": 3
},
{
"text": "Brokers",
"value": 4
},
{
"text": "Building Supply Retail",
"value": 5
},
{
"text": "Business Services",
"value": 6
},
{
"text": "Consulting",
"value": 7
},
{
"text": "Consumer Services",
"value": 8
},
{
"text": "Design, Direction and Creative Management",
"value": 9
},
{
"text": "Distributors, Dispatchers and Processors",
"value": 10
},
{
"text": "Doctor's Offices and Clinics",
"value": 11
},
{
"text": "Durable Manufacturing",
"value": 12
},
{
"text": "Eating and Drinking Places",
"value": 13
},
{
"text": "Entertainment Retail",
"value": 14
},
{
"text": "Equipment Rental and Leasing",
"value": 15
},
{
"text": "Financial",
"value": 16
},
{
"text": "Food and Tobacco Processing",
"value": 17
},
{
"text": "Inbound Capital Intensive Processing",
"value": 18
},
{
"text": "Inbound Repair and Services",
"value": 19
},
{
"text": "Insurance",
"value": 20
},
{
"text": "Legal Services",
"value": 21
},
{
"text": "Non-Durable Merchandise Retail",
"value": 22
},
{
"text": "Outbound Consumer Service",
"value": 23
},
{
"text": "Petrochemical Extraction and Distribution",
"value": 24
},
{
"text": "Service Retail",
"value": 25
},
{
"text": "SIG Affiliations",
"value": 26
},
{
"text": "Social Services",
"value": 27
},
{
"text": "Special Outbound Trade Contractors",
"value": 28
},
{
"text": "Specialty Realty",
"value": 29
},
{
"text": "Transportation",
"value": 30
},
{
"text": "Utility Creation and Distribution",
"value": 31
},
{
"text": "Vehicle Retail",
"value": 32
},
{
"text": "Wholesale",
"value": 33
}],
"SelectedOption": {
"option": "Accounting",
"value": 1
},
"Text": "Accounting",
"Controls": [{
"Name": "industrycode"
}]
},
{
"Name": "jobtitle",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 100,
"Controls": [{
"Name": "jobtitle"
}]
},
{
"Name": "lastname",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 50,
"Controls": [{
"Name": "lastname"
}]
},
{
"Name": "lastusedincampaign",
"Value": null,
"Type": "datetime",
"Format": "date",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": false
},
"Controls": [{
"Name": "lastusedincampaign"
}]
},
{
"Name": "leadqualitycode",
"Value": null,
"Type": "optionset",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": 930650000,
"Options": [{
"text": "Hot",
"value": 1
},
{
"text": "Warm",
"value": 2
},
{
"text": "Cold",
"value": 3
}],
"SelectedOption": {
"option": "Hot",
"value": 1
},
"Text": "Hot",
"Controls": [{
"Name": "header_leadqualitycode"
},
{
"Name": "leadqualitycode"
}]
},
{
"Name": "leadsourcecode",
"Value": null,
"Type": "optionset",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": 930650000,
"Options": [{
"text": "Advertisement",
"value": 1
},
{
"text": "Employee Referral",
"value": 2
},
{
"text": "External Referral",
"value": 3
},
{
"text": "Partner",
"value": 4
},
{
"text": "Public Relations",
"value": 5
},
{
"text": "Seminar",
"value": 6
},
{
"text": "Trade Show",
"value": 7
},
{
"text": "Web",
"value": 8
},
{
"text": "Word of Mouth",
"value": 9
},
{
"text": "Other",
"value": 10
}],
"SelectedOption": {
"option": "Advertisement",
"value": 1
},
"Text": "Advertisement",
"Controls": [{
"Name": "header_leadsourcecode"
},
{
"Name": "leadsourcecode"
}]
},
{
"Name": "mobilephone",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 20,
"Controls": [{
"Name": "mobilephone"
}]
},
{
"Name": "numberofemployees",
"Value": null,
"Type": "integer",
"Format": "none",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"Max": 1000000,
"Min": 0,
"Precision": 0,
"Controls": [{
"Name": "numberofemployees"
}]
},
{
"Name": "ownerid",
"Value": [{
"entityType": "Unknown",
"id": "{27ACAE0A-5D79-E111-BBD3-2657AEB3167B}",
"name": "Temp"
}],
"Type": "lookup",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"Controls": [{
"Name": "header_ownerid"
},
{
"Name": "ownerid"
}]
},
{
"Name": "pager",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 20,
"Controls": [{
"Name": "pager"
}]
},
{
"Name": "preferredcontactmethodcode",
"Value": null,
"Type": "optionset",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": 930650000,
"Options": [{
"text": "Any",
"value": 1
},
{
"text": "Email",
"value": 2
},
{
"text": "Phone",
"value": 3
},
{
"text": "Fax",
"value": 4
},
{
"text": "Mail",
"value": 5
}],
"SelectedOption": {
"option": "Any",
"value": 1
},
"Text": "Any",
"Controls": [{
"Name": "preferredcontactmethodcode"
}]
},
{
"Name": "revenue",
"Value": null,
"Type": "double",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"Max": 100000000000000,
"Min": 0,
"Precision": 2,
"Controls": [{
"Name": "revenue"
}]
},
{
"Name": "salutation",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 100,
"Controls": [{
"Name": "salutation"
}]
},
{
"Name": "sic",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 20,
"Controls": [{
"Name": "sic"
}]
},
{
"Name": "statuscode",
"Value": null,
"Type": "optionset",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"InitialValue": 930650000,
"Options": [{
"text": "New",
"value": 1
},
{
"text": "Contacted",
"value": 2
},
{
"text": "Qualified",
"value": 3
},
{
"text": "Lost",
"value": 4
},
{
"text": "Cannot Contact",
"value": 5
},
{
"text": "No Longer Interested",
"value": 6
},
{
"text": "Canceled",
"value": 7
}],
"SelectedOption": {
"option": "New",
"value": 1
},
"Text": "New",
"Controls": [{
"Name": "statuscode"
}]
},
{
"Name": "subject",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 300,
"Controls": [{
"Name": "subject"
}]
},
{
"Name": "telephone1",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 50,
"Controls": [{
"Name": "telephone1"
}]
},
{
"Name": "telephone2",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 50,
"Controls": [{
"Name": "telephone2"
}]
},
{
"Name": "telephone3",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 50,
"Controls": [{
"Name": "telephone3"
}]
},
{
"Name": "transactioncurrencyid",
"Value": [{
"entityType": "Unknown",
"id": "{27ACAE0A-5D79-E111-BBD3-2657AEB3167B}",
"name": "Temp"
}],
"Type": "lookup",
"Format": null,
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"Controls": [{
"Name": "transactioncurrencyid"
}]
},
{
"Name": "websiteurl",
"Value": "",
"Type": "string",
"Format": "text",
"IsDirty": false,
"RequiredLevel": "none",
"SubmitMode": "dirty",
"UserPrivilege": {
"canRead": true,
"canUpdate": true,
"canCreate": true
},
"MaxLength": 200,
"Controls": [{
"Name": "websiteurl"
}]
}],
"AttributesLength": 40,
"Controls": [{
"Name": "address1_city",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "City",
"Attribute": "address1_city"
},
{
"Name": "address1_country",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Country/Region",
"Attribute": "address1_country"
},
{
"Name": "address1_line1",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Street 1",
"Attribute": "address1_line1"
},
{
"Name": "address1_line2",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Street 2",
"Attribute": "address1_line2"
},
{
"Name": "address1_line3",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Street 3",
"Attribute": "address1_line3"
},
{
"Name": "address1_postalcode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "ZIP/Postal Code",
"Attribute": "address1_postalcode"
},
{
"Name": "address1_stateorprovince",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "State/Province",
"Attribute": "address1_stateorprovince"
},
{
"Name": "campaignid",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Source Campaign",
"Attribute": "campaignid"
},
{
"Name": "companyname",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Company Name",
"Attribute": "companyname"
},
{
"Name": "description",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Description",
"Attribute": "description"
},
{
"Name": "donotbulkemail",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Bulk Email",
"Attribute": "donotbulkemail"
},
{
"Name": "donotemail",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Email",
"Attribute": "donotemail"
},
{
"Name": "donotfax",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Fax",
"Attribute": "donotfax"
},
{
"Name": "donotphone",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Phone",
"Attribute": "donotphone"
},
{
"Name": "donotpostalmail",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Mail",
"Attribute": "donotpostalmail"
},
{
"Name": "donotsendmm",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Marketing Material",
"Attribute": "donotsendmm"
},
{
"Name": "emailaddress1",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Email",
"Attribute": "emailaddress1"
},
{
"Name": "fax",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Fax",
"Attribute": "fax"
},
{
"Name": "firstname",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "First Name",
"Attribute": "firstname"
},
{
"Name": "header_leadqualitycode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Rating",
"Attribute": "leadqualitycode"
},
{
"Name": "header_leadsourcecode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Lead Source",
"Attribute": "leadsourcecode"
},
{
"Name": "header_ownerid",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Owner",
"Attribute": "ownerid"
},
{
"Name": "industrycode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Industry",
"Attribute": "industrycode"
},
{
"Name": "jobtitle",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Job Title",
"Attribute": "jobtitle"
},
{
"Name": "lastname",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Last Name",
"Attribute": "lastname"
},
{
"Name": "lastusedincampaign",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Last Campaign Date",
"Attribute": "lastusedincampaign"
},
{
"Name": "leadqualitycode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Rating",
"Attribute": "leadqualitycode"
},
{
"Name": "leadsourcecode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Lead Source",
"Attribute": "leadsourcecode"
},
{
"Name": "mobilephone",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Mobile Phone",
"Attribute": "mobilephone"
},
{
"Name": "numberofemployees",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "No. of Employees",
"Attribute": "numberofemployees"
},
{
"Name": "ownerid",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Owner",
"Attribute": "ownerid"
},
{
"Name": "pager",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Pager",
"Attribute": "pager"
},
{
"Name": "preferredcontactmethodcode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Preferred",
"Attribute": "preferredcontactmethodcode"
},
{
"Name": "revenue",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Annual Revenue",
"Attribute": "revenue"
},
{
"Name": "salutation",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Salutation",
"Attribute": "salutation"
},
{
"Name": "sic",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "SIC Code",
"Attribute": "sic"
},
{
"Name": "statuscode",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Status Reason",
"Attribute": "statuscode"
},
{
"Name": "subject",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Topic",
"Attribute": "subject"
},
{
"Name": "telephone1",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Business Phone",
"Attribute": "telephone1"
},
{
"Name": "telephone2",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Home Phone",
"Attribute": "telephone2"
},
{
"Name": "telephone3",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Other Phone",
"Attribute": "telephone3"
},
{
"Name": "transactioncurrencyid",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Currency",
"Attribute": "transactioncurrencyid"
},
{
"Name": "websiteurl",
"Type": "standard",
"Disabled": false,
"Visible": true,
"Label": "Website",
"Attribute": "websiteurl"
}],
"ControlsLength": 43,
"Navigation": [{
"Id": "navActivities",
"Key": "navActivities",
"Label": "",
"Visible": true
},
{
"Id": "navActivityHistory",
"Key": "navActivityHistory",
"Label": "",
"Visible": true
}],
"Tabs": [{
"Label": "What's New",
"Name": "tab_recordwall",
"DisplayState": "expanded",
"Visible": true,
"Sections": [{
"Label": "Section",
"Name": "tab_recordwall_section_1",
"Visible": true,
"Controls": [{
"Name": "WebResource_RecordWall"
}]
}]
},
{
"Label": "General",
"Name": "general",
"DisplayState": "expanded",
"Visible": true,
"Sections": [{
"Label": "Name",
"Name": "name",
"Visible": true,
"Controls": [{
"Name": "subject"
},
{
"Name": "salutation"
},
{
"Name": "telephone1"
},
{
"Name": "firstname"
},
{
"Name": "telephone2"
},
{
"Name": "lastname"
},
{
"Name": "mobilephone"
},
{
"Name": "jobtitle"
},
{
"Name": "fax"
},
{
"Name": "companyname"
},
{
"Name": "telephone3"
},
{
"Name": "websiteurl"
},
{
"Name": "pager"
},
{
"Name": "emailaddress1"
}]
},
{
"Label": "Address",
"Name": "address",
"Visible": true,
"Controls": [{
"Name": "address1_line1"
},
{
"Name": "address1_stateorprovince"
},
{
"Name": "address1_line2"
},
{
"Name": "address1_postalcode"
},
{
"Name": "address1_line3"
},
{
"Name": "address1_country"
},
{
"Name": "address1_city"
}]
},
{
"Label": "Description",
"Name": "description",
"Visible": true,
"Controls": [{
"Name": "description"
}]
}]
},
{
"Label": "Details",
"Name": "details",
"DisplayState": "expanded",
"Visible": true,
"Sections": [{
"Label": "Lead Information",
"Name": "lead information",
"Visible": true,
"Controls": [{
"Name": "leadsourcecode"
},
{
"Name": "leadqualitycode"
}]
},
{
"Label": "Company Information",
"Name": "company information",
"Visible": true,
"Controls": [{
"Name": "industrycode"
},
{
"Name": "transactioncurrencyid"
},
{
"Name": "sic"
},
{
"Name": "revenue"
},
{
"Name": "numberofemployees"
}]
}]
},
{
"Label": "Notes & Activities",
"Name": "notes and activities",
"DisplayState": "expanded",
"Visible": true,
"Sections": [{
"Label": "Activities",
"Name": "activities",
"Visible": true,
"Controls": [{
"Name": "leadactivitiesgrid"
}]
},
{
"Label": "Notes",
"Name": "notes",
"Visible": true,
"Controls": [{
"Name": "notescontrol"
}]
}]
},
{
"Label": "Preferences",
"Name": "administration",
"DisplayState": "expanded",
"Visible": true,
"Sections": [{
"Label": "Internal Information",
"Name": "internal information",
"Visible": true,
"Controls": [{
"Name": "ownerid"
},
{
"Name": "statuscode"
}]
},
{
"Label": "Contact Methods",
"Name": "contact methods",
"Visible": true,
"Controls": [{
"Name": "preferredcontactmethodcode"
},
{
"Name": "donotemail"
},
{
"Name": "donotbulkemail"
},
{
"Name": "donotphone"
},
{
"Name": "donotfax"
},
{
"Name": "donotpostalmail"
}]
},
{
"Label": "Marketing Information",
"Name": "marketing information",
"Visible": true,
"Controls": [{
"Name": "campaignid"
},
{
"Name": "lastusedincampaign"
},
{
"Name": "donotsendmm"
}]
}]
}]
};
var Xrm = new _xrm(pageData); | mit |
darling0825/CustomControl | CustomControl/CustomView/BCCollectionView/BCCollectionView.h | 2944 | // Created by Pieter Omvlee on 24/11/2010.
// Copyright 2010 Bohemian Coding. All rights reserved.
#import <Cocoa/Cocoa.h>
#import "BCCollectionViewDelegate.h"
#ifndef BCArray
#define BCArray(args...) [NSArray arrayWithObjects:args, nil]
#endif
@class BCCollectionViewLayoutManager;
@interface BCCollectionView : NSView
{
IBOutlet id<BCCollectionViewDelegate> delegate;
BCCollectionViewLayoutManager *layoutManager;
NSArray *contentArray;
NSArray *groups;
NSMutableArray *reusableViewControllers;
NSMutableDictionary *visibleViewControllers;
NSMutableIndexSet *selectionIndexes;
NSMutableDictionary *visibleGroupViewControllers;
NSColor *backgroundColor;
NSUInteger numberOfPreRenderedRows;
@private
NSPoint mouseDownLocation;
NSPoint mouseDraggedLocation;
NSRect previousFrameBounds;
NSUInteger lastSelectionIndex;
NSIndexSet *originalSelectionIndexes;
NSInteger dragHoverIndex;
BOOL isDragging;
BOOL firstDrag;
BOOL selectionChangedDisabled;
NSString *zoomValueObserverKey;
CGFloat lastPinchMagnification;
NSString *accumulatedKeyStrokes;
}
@property (nonatomic, assign) id<BCCollectionViewDelegate> delegate;
@property (nonatomic, retain) NSColor *backgroundColor;
@property (nonatomic) NSUInteger numberOfPreRenderedRows;
//private
@property (nonatomic, copy) NSIndexSet *originalSelectionIndexes;
@property (nonatomic, copy) NSArray *contentArray, *groups;
@property (nonatomic, copy) NSString *zoomValueObserverKey, *accumulatedKeyStrokes;
@property (readonly) NSArray *visibleViewControllerArray;
@property (readonly) BCCollectionViewLayoutManager *layoutManager;
//designated way to load BCCollectionView
- (void)reloadDataWithItems:(NSArray *)newContent emptyCaches:(BOOL)shouldEmptyCaches;
- (void)reloadDataWithItems:(NSArray *)newContent groups:(NSArray *)newGroups emptyCaches:(BOOL)shouldEmptyCaches;
- (void)reloadDataWithItems:(NSArray *)newContent groups:(NSArray *)newGroups emptyCaches:(BOOL)shouldEmptyCaches completionBlock:(dispatch_block_t)completionBlock;
//Managing Selections
- (void)selectItemAtIndex:(NSUInteger)index;
- (void)selectItemAtIndex:(NSUInteger)index inBulk:(BOOL)bulk;
- (void)selectItemsAtIndexes:(NSIndexSet *)indexes;
- (void)deselectItemAtIndex:(NSUInteger)index;
- (void)deselectItemsAtIndexes:(NSIndexSet *)indexes;
- (void)deselectAllItems;
- (NSIndexSet *)selectionIndexes;
//Basic Cell Information
- (NSSize)cellSize;
- (NSUInteger)groupHeaderHeight;
- (NSRange)rangeOfVisibleItems;
- (NSRange)rangeOfVisibleItemsWithOverflow;
- (NSIndexSet *)indexesOfItemsInRect:(NSRect)aRect;
- (NSIndexSet *)indexesOfItemContentRectsInRect:(NSRect)aRect;
//Querying ViewControllers
- (NSIndexSet *)indexesOfViewControllers;
- (NSIndexSet *)indexesOfInvisibleViewControllers;
- (NSViewController *)viewControllerForItemAtIndex:(NSUInteger)index;
- (void)softReloadDataWithCompletionBlock:(dispatch_block_t)block;
@end
| mit |
PiotrDabkowski/pyjsparser | tests/pass/756e3fe0ef87b136.js | 104 | function a() {
b();
c();
return d();
}
function e() {
b();
c();
throw new f();
} | mit |
ekarulf/pymp | src/pymp/dispatcher.py | 11009 | import functools
import time
import traceback
from multiprocessing.util import Finalize
from threading import Event, RLock, Thread, current_thread
from pymp import logger, trace_function
from pymp.messages import DispatcherState, Request, Response, ProxyHandle, generate_id
from collections import deque
class State(object):
INIT, STARTUP, RUNNING, SHUTDOWN, TERMINATED = range(5)
class Dispatcher(object):
PREFIX = '#'
EXPOSED = '_dispatch_'
SPIN_TIME = 0.01
_dispatch_ = ['del_proxy', 'new_proxy']
@trace_function
def __init__(self, conn):
self._state = State.INIT
self._lock = RLock() # protects internal methods
self._queue = deque()
self._pending = dict() # id => Event or Response
self._provided_classes = dict() # string => (Class, callable)
self._consumed_classes = dict() # Class => Class
self._objects = dict()
self._thread = Thread(target=self._run, args=(conn,))
self._thread.daemon = True
self._thread.start()
# We register with multiprocessing to prevent bugs related to the
# order of execution of atexit functions & multiprocessing's join's
Finalize(self, self._atexit, exitpriority=100)
def get_state(self):
return self._state
def set_state(self, state):
with self._lock:
if state > self.state:
self._state = state
self._queue.append(DispatcherState(state)) # head of line
logger.info("Changing state to %d" % state)
elif state == self.state:
pass
else:
raise ValueError('Invalid state progression')
state = property(get_state, set_state)
@trace_function
def _atexit(self):
self.shutdown()
@trace_function
def __del__(self):
if self.alive():
self.shutdown()
self._thread.join()
self._objects.clear()
@trace_function
def provide(self, proxy_class, generator=None, name=None):
"""
Registers a class that will be provided by this dispatcher
If present, a generator will be used in lieu of using a the provided
class's default constructor.
"""
if not name:
name = proxy_class.__name__
with self._lock:
if name in self._provided_classes:
raise NameError("The name '%s' is already in use" % name)
self._provided_classes[name] = (proxy_class, generator)
@trace_function
def consume(self, name, proxy_client=None):
if hasattr(name, '__name__'):
name = name.__name__
with self._lock:
if hasattr(self, name):
raise NameError("The name '%s' is already in use" % name)
self._consumed_classes[name] = proxy_client or Proxy
def create_instance(*args, **kwargs):
new_proxy_args = (name, args, kwargs)
return self.call('#new_proxy', new_proxy_args)
setattr(self, name, create_instance)
def alive(self):
return self.state in (State.STARTUP, State.RUNNING, State.SHUTDOWN)
@trace_function
def call(self, function, args=[], kwargs={}, proxy_id=None, wait=True):
# Step 1: Send Request
request = Request(generate_id(), proxy_id, function, args, kwargs)
if wait:
event = Event()
with self._lock:
self._pending[request.id] = event
self._queue.appendleft(request)
# Step 2: Wait for Response
if wait:
event.wait()
else:
return
# Step 3: Process Response
with self._lock:
response = self._pending.pop(request.id, None)
if not isinstance(response, Response):
raise RuntimeError('Dispatcher stored invalid response')
elif response.exception:
raise response.exception
elif isinstance(response.return_value, ProxyHandle):
proxy_handle = response.return_value
try:
proxy_class = self._consumed_classes[proxy_handle.obj_type]
except KeyError:
logger.info("Recieved proxy_class for unexpected type %s" % proxy_handle.obj_type)
else:
return proxy_class(self, proxy_handle.id, proxy_handle.exposed)
else:
return response.return_value
@trace_function
def start(self):
if self.state is State.INIT:
self.state = State.STARTUP
if self.state is State.STARTUP:
while self.state is State.STARTUP:
time.sleep(self.SPIN_TIME)
@trace_function
def shutdown(self):
if self.state in (State.INIT, State.STARTUP, State.RUNNING):
self.state = State.SHUTDOWN
@trace_function
def _run(self, conn):
while self.state is State.INIT:
time.sleep(self.SPIN_TIME) # wait for the constructor to catch up
while self.state in (State.STARTUP, State.RUNNING):
self._write_once(conn)
self._read_once(conn, timeout=self.SPIN_TIME)
while len(self._queue) > 0:
self._write_once(conn) # send shutdown message if needed
self.state = State.TERMINATED
conn.close()
@trace_function
def join(self):
self._thread.join()
@trace_function
def new_proxy(self, name, args, kwargs):
with self._lock:
if name not in self._provided_classes:
raise NameError("%s does not name a provided class" % name)
source_class, generator = self._provided_classes[name]
if not generator:
generator = source_class
obj = generator(*args, **kwargs)
obj_id = id(obj)
obj_store, refcount = self._objects.get(obj_id, (obj, 0))
assert obj is obj_store, "Different objects returned for the same key"
self._objects[obj_id] = (obj, refcount + 1)
exposed = self._exposed_functions(obj)
return ProxyHandle(obj_id, name, exposed)
@trace_function
def del_proxy(self, proxy_id):
"""
Called by clients to signify when they no longer need a proxy
See: DefaultProxy.__del__
"""
with self._lock:
obj, refcount = self._objects.get(proxy_id, (None, 0))
if refcount <= 0:
logger.warn("Error destructing object %s, not found" % str(proxy_id))
elif refcount == 1:
del self._objects[proxy_id]
else:
self._objects[proxy_id] = (obj, refcount - 1)
def _write_once(self, conn):
if not self.alive():
return
try:
msg = self._queue.pop()
except IndexError:
return
try:
if isinstance(msg, DispatcherState) or self.state is State.RUNNING:
conn.send(msg)
else:
logger.info("Skipping outgoing message %s" % repr(msg))
except IOError:
self.state = State.TERMINATED
except Exception as exception:
# Most likely a PicklingError
if hasattr(msg, 'id'):
response = Response(msg.id, exception, None)
self._process_response(response)
def _read_once(self, conn, timeout=0):
if not self.alive() or not conn.poll(timeout):
return
try:
msg = conn.recv()
except EOFError:
self.state = State.TERMINATED
if isinstance(msg, Request) and self.state is State.RUNNING:
response = self._process_request(msg)
if response:
self._queue.appendleft(response)
elif isinstance(msg, Response) and self.state is State.RUNNING:
self._process_response(msg)
elif isinstance(msg, DispatcherState):
if self.state is State.STARTUP and msg.state is State.STARTUP:
self.state = State.RUNNING
elif msg.state is State.SHUTDOWN:
self.state = msg.state
else:
logger.info("Skipping incoming message %s" % repr(msg))
return True
@trace_function
def _exposed_functions(self, obj):
exposed = getattr(obj, self.EXPOSED, None)
if exposed is None:
exposed = []
for name in dir(obj): # TODO: Not use dir
attribute = getattr(obj, name)
if callable(attribute) and not name.startswith('_'):
exposed.append(name)
setattr(obj, self.EXPOSED, exposed)
return exposed
@trace_function
def _callmethod(self, obj, fname, args, kwargs):
if fname in self._exposed_functions(obj):
function = getattr(obj, fname)
return function(*args, **kwargs)
else:
raise AttributeError("%s does not have an exposed method %s" % (repr(obj), fname))
@trace_function
def _process_request(self, request):
exception = None
fname = request.function
if fname.startswith(self.PREFIX):
obj = self # invoke methods on dispatcher
fname = fname[1:] # strip prefix
else:
with self._lock:
try:
obj, refcount = self._objects[request.proxy_id]
except KeyError:
exception = RuntimeError("No object found")
return Response(request.id, exception, None)
try:
value = self._callmethod(obj, fname, request.args, request.kwargs)
except Exception as exception:
logger.error("Exception thrown while processing response\nRemote " + traceback.format_exc())
return Response(request.id, exception, None)
else:
return Response(request.id, None, value)
@trace_function
def _process_response(self, response):
with self._lock:
event = self._pending.pop(response.id, None)
if hasattr(event, 'set'):
self._pending[response.id] = response
event.set()
class Proxy(object):
@trace_function
def __init__(self, dispatcher, proxy_id, exposed):
self._dispatcher = dispatcher
self._proxy_id = proxy_id
self._exposed = exposed
for name in exposed:
func = functools.partial(self._callmethod, name)
func.__name__ = name
setattr(self, name, func)
@trace_function
def _callmethod(self, name, *args, **kwargs):
return self._dispatcher.call(name, args, kwargs, proxy_id=self._proxy_id)
@trace_function
def __del__(self):
self._dispatcher.call('#del_proxy', (self._proxy_id,), wait=False)
| mit |
nusedutech/coursemology.org | app/assets/javascripts/textext/textext.core.js | 44768 | /**
* jQuery TextExt Plugin
* http://textextjs.com
*
* @version 1.3.1
* @copyright Copyright (C) 2011 Alex Gorbatchev. All rights reserved.
* @license MIT License
*/
(function($, undefined)
{
/**
* TextExt is the main core class which by itself doesn't provide any functionality
* that is user facing, however it has the underlying mechanics to bring all the
* plugins together under one roof and make them work with each other or on their
* own.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt
*/
function TextExt() {};
/**
* ItemManager is used to seamlessly convert between string that come from the user input to whatever
* the format the item data is being passed around in. It's used by all plugins that in one way or
* another operate with items, such as Tags, Filter, Autocomplete and Suggestions. Default implementation
* works with `String` type.
*
* Each instance of `TextExt` creates a new instance of default implementation of `ItemManager`
* unless `itemManager` option was set to another implementation.
*
* To satisfy requirements of managing items of type other than a `String`, different implementation
* if `ItemManager` should be supplied.
*
* If you wish to bring your own implementation, you need to create a new class and implement all the
* methods that `ItemManager` has. After, you need to supply your pass via the `itemManager` option during
* initialization like so:
*
* $('#input').textext({
* itemManager : CustomItemManager
* })
*
* @author agorbatchev
* @date 2011/08/19
* @id ItemManager
*/
function ItemManager() {};
/**
* TextExtPlugin is a base class for all plugins. It provides common methods which are reused
* by majority of plugins.
*
* All plugins must register themselves by calling the `$.fn.textext.addPlugin(name, constructor)`
* function while providing plugin name and constructor. The plugin name is the same name that user
* will identify the plugin in the `plugins` option when initializing TextExt component and constructor
* function will create a new instance of the plugin. *Without registering, the core won't
* be able to see the plugin.*
*
* <span class="new label version">new in 1.2.0</span> You can get instance of each plugin from the core
* via associated function with the same name as the plugin. For example:
*
* $('#input').textext()[0].tags()
* $('#input').textext()[0].autocomplete()
* ...
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin
*/
function TextExtPlugin() {};
var stringify = (JSON || {}).stringify,
slice = Array.prototype.slice,
p,
UNDEFINED = 'undefined',
/**
* TextExt provides a way to pass in the options to configure the core as well as
* each plugin that is being currently used. The jQuery exposed plugin `$().textext()`
* function takes a hash object with key/value set of options. For example:
*
* $('textarea').textext({
* enabled: true
* })
*
* There are multiple ways of passing in the options:
*
* 1. Options could be nested multiple levels deep and accessed using all lowercased, dot
* separated style, eg `foo.bar.world`. The manual is using this style for clarity and
* consistency. For example:
*
* {
* item: {
* manager: ...
* },
*
* html: {
* wrap: ...
* },
*
* autocomplete: {
* enabled: ...,
* dropdown: {
* position: ...
* }
* }
* }
*
* 2. Options could be specified using camel cased names in a flat key/value fashion like so:
*
* {
* itemManager: ...,
* htmlWrap: ...,
* autocompleteEnabled: ...,
* autocompleteDropdownPosition: ...
* }
*
* 3. Finally, options could be specified in mixed style. It's important to understand that
* for each dot separated name, its alternative in camel case is also checked for, eg for
* `foo.bar.world` it's alternatives could be `fooBarWorld`, `foo.barWorld` or `fooBar.world`,
* which translates to `{ foo: { bar: { world: ... } } }`, `{ fooBarWorld: ... }`,
* `{ foo : { barWorld : ... } }` or `{ fooBar: { world: ... } }` respectively. For example:
*
* {
* itemManager : ...,
* htmlWrap: ...,
* autocomplete: {
* enabled: ...,
* dropdownPosition: ...
* }
* }
*
* Mixed case is used through out the code, wherever it seems appropriate. However in the code, all option
* names are specified in the dot notation because it works both ways where as camel case is not
* being converted to its alternative dot notation.
*
* @author agorbatchev
* @date 2011/08/17
* @id TextExt.options
*/
/**
* Default instance of `ItemManager` which takes `String` type as default for tags.
*
* @name item.manager
* @default ItemManager
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.options.item.manager
*/
OPT_ITEM_MANAGER = 'item.manager',
/**
* List of plugins that should be used with the current instance of TextExt. The list could be
* specified as array of strings or as comma or space separated string.
*
* @name plugins
* @default []
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.options.plugins
*/
OPT_PLUGINS = 'plugins',
/**
* TextExt allows for overriding of virtually any method that the core or any of its plugins
* use. This could be accomplished through the use of the `ext` option.
*
* It's possible to specifically target the core or any plugin, as well as overwrite all the
* desired methods everywhere.
*
* 1. Targeting the core:
*
* ext: {
* core: {
* trigger: function()
* {
* console.log('TextExt.trigger', arguments);
* $.fn.textext.TextExt.prototype.trigger.apply(this, arguments);
* }
* }
* }
*
* 2. Targeting individual plugins:
*
* ext: {
* tags: {
* addTags: function(tags)
* {
* console.log('TextExtTags.addTags', tags);
* $.fn.textext.TextExtTags.prototype.addTags.apply(this, arguments);
* }
* }
* }
*
* 3. Targeting `ItemManager` instance:
*
* ext: {
* itemManager: {
* stringToItem: function(str)
* {
* console.log('ItemManager.stringToItem', str);
* return $.fn.textext.ItemManager.prototype.stringToItem.apply(this, arguments);
* }
* }
* }
*
* 4. And finally, in edge cases you can extend everything at once:
*
* ext: {
* '*': {
* fooBar: function() {}
* }
* }
*
* @name ext
* @default {}
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.options.ext
*/
OPT_EXT = 'ext',
/**
* HTML source that is used to generate elements necessary for the core and all other
* plugins to function.
*
* @name html.wrap
* @default '<div class="text-core"><div class="text-wrap"/></div>'
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.options.html.wrap
*/
OPT_HTML_WRAP = 'html.wrap',
/**
* HTML source that is used to generate hidden input value of which will be submitted
* with the HTML form.
*
* @name html.hidden
* @default '<input type="hidden" />'
* @author agorbatchev
* @date 2011/08/20
* @id TextExt.options.html.hidden
*/
OPT_HTML_HIDDEN = 'html.hidden',
/**
* Hash table of key codes and key names for which special events will be created
* by the core. For each entry a `[name]KeyDown`, `[name]KeyUp` and `[name]KeyPress` events
* will be triggered along side with `anyKeyUp` and `anyKeyDown` events for every
* key stroke.
*
* Here's a list of default keys:
*
* {
* 8 : 'backspace',
* 9 : 'tab',
* 13 : 'enter!',
* 27 : 'escape!',
* 37 : 'left',
* 38 : 'up!',
* 39 : 'right',
* 40 : 'down!',
* 46 : 'delete',
* 108 : 'numpadEnter'
* }
*
* Please note the `!` at the end of some keys. This tells the core that by default
* this keypress will be trapped and not passed on to the text input.
*
* @name keys
* @default { ... }
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.options.keys
*/
OPT_KEYS = 'keys',
/**
* The core triggers or reacts to the following events.
*
* @author agorbatchev
* @date 2011/08/17
* @id TextExt.events
*/
/**
* Core triggers `preInvalidate` event before the dimensions of padding on the text input
* are set.
*
* @name preInvalidate
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.preInvalidate
*/
EVENT_PRE_INVALIDATE = 'preInvalidate',
/**
* Core triggers `postInvalidate` event after the dimensions of padding on the text input
* are set.
*
* @name postInvalidate
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.postInvalidate
*/
EVENT_POST_INVALIDATE = 'postInvalidate',
/**
* Core triggers `getFormData` on every key press to collect data that will be populated
* into the hidden input that will be submitted with the HTML form and data that will
* be displayed in the input field that user is currently interacting with.
*
* All plugins that wish to affect how the data is presented or sent must react to
* `getFormData` and populate the data in the following format:
*
* {
* input : {String},
* form : {Object}
* }
*
* The data key must be a numeric weight which will be used to determine which data
* ends up being used. Data with the highest numerical weight gets the priority. This
* allows plugins to set the final data regardless of their initialization order, which
* otherwise would be impossible.
*
* For example, the Tags and Autocomplete plugins have to work side by side and Tags
* plugin must get priority on setting the data. Therefore the Tags plugin sets data
* with the weight 200 where as the Autocomplete plugin sets data with the weight 100.
*
* Here's an example of a typical `getFormData` handler:
*
* TextExtPlugin.prototype.onGetFormData = function(e, data, keyCode)
* {
* data[100] = self.formDataObject('input value', 'form value');
* };
*
* Core also reacts to the `getFormData` and updates hidden input with data which will be
* submitted with the HTML form.
*
* @name getFormData
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.getFormData
*/
EVENT_GET_FORM_DATA = 'getFormData',
/**
* Core triggers and reacts to the `setFormData` event to update the actual value in the
* hidden input that will be submitted with the HTML form. Second argument can be value
* of any type and by default it will be JSON serialized with `TextExt.serializeData()`
* function.
*
* @name setFormData
* @author agorbatchev
* @date 2011/08/22
* @id TextExt.events.setFormData
*/
EVENT_SET_FORM_DATA = 'setFormData',
/**
* Core triggers and reacts to the `setInputData` event to update the actual value in the
* text input that user is interacting with. Second argument must be of a `String` type
* the value of which will be set into the text input.
*
* @name setInputData
* @author agorbatchev
* @date 2011/08/22
* @id TextExt.events.setInputData
*/
EVENT_SET_INPUT_DATA = 'setInputData',
/**
* Core triggers `postInit` event to let plugins run code after all plugins have been
* created and initialized. This is a good place to set some kind of global values before
* somebody gets to use them. This is not the right place to expect all plugins to finish
* their initialization.
*
* @name postInit
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.postInit
*/
EVENT_POST_INIT = 'postInit',
/**
* Core triggers `ready` event after all global configuration and prepearation has been
* done and the TextExt component is ready for use. Event handlers should expect all
* values to be set and the plugins to be in the final state.
*
* @name ready
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.ready
*/
EVENT_READY = 'ready',
/**
* Core triggers `anyKeyUp` event for every key up event triggered within the component.
*
* @name anyKeyUp
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.anyKeyUp
*/
/**
* Core triggers `anyKeyDown` event for every key down event triggered within the component.
*
* @name anyKeyDown
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.anyKeyDown
*/
/**
* Core triggers `[name]KeyUp` event for every key specifid in the `keys` option that is
* triggered within the component.
*
* @name [name]KeyUp
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.[name]KeyUp
*/
/**
* Core triggers `[name]KeyDown` event for every key specified in the `keys` option that is
* triggered within the component.
*
* @name [name]KeyDown
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.[name]KeyDown
*/
/**
* Core triggers `[name]KeyPress` event for every key specified in the `keys` option that is
* triggered within the component.
*
* @name [name]KeyPress
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.events.[name]KeyPress
*/
DEFAULT_OPTS = {
itemManager : ItemManager,
plugins : [],
ext : {},
html : {
wrap : '<div class="text-core"><div class="text-wrap"/></div>',
hidden : '<input type="hidden" />'
},
keys : {
8 : 'backspace',
9 : 'tab',
13 : 'enter!',
27 : 'escape!',
37 : 'left',
38 : 'up!',
39 : 'right',
40 : 'down!',
46 : 'delete',
108 : 'numpadEnter'
}
}
;
// Freak out if there's no JSON.stringify function found
if(!stringify)
throw new Error('JSON.stringify() not found');
/**
* Returns object property by name where name is dot-separated and object is multiple levels deep.
* @param target Object Source object.
* @param name String Dot separated property name, ie `foo.bar.world`
* @id core.getProperty
*/
function getProperty(source, name)
{
if(typeof(name) === 'string')
name = name.split('.');
var fullCamelCaseName = name.join('.').replace(/\.(\w)/g, function(match, letter) { return letter.toUpperCase() }),
nestedName = name.shift(),
result
;
if(typeof(result = source[fullCamelCaseName]) != UNDEFINED)
result = result;
else if(typeof(result = source[nestedName]) != UNDEFINED && name.length > 0)
result = getProperty(result, name);
// name.length here should be zero
return result;
};
/**
* Hooks up specified events in the scope of the current object.
* @author agorbatchev
* @date 2011/08/09
*/
function hookupEvents()
{
var args = slice.apply(arguments),
self = this,
target = args.length === 1 ? self : args.shift(),
event
;
args = args[0] || {};
function bind(event, handler)
{
target.bind(event, function()
{
// apply handler to our PLUGIN object, not the target
return handler.apply(self, arguments);
});
}
for(event in args)
bind(event, args[event]);
};
function formDataObject(input, form)
{
return { 'input' : input, 'form' : form };
};
//--------------------------------------------------------------------------------
// ItemManager core component
p = ItemManager.prototype;
/**
* Initialization method called by the core during instantiation.
*
* @signature ItemManager.init(core)
*
* @param core {TextExt} Instance of the TextExt core class.
*
* @author agorbatchev
* @date 2011/08/19
* @id ItemManager.init
*/
p.init = function(core)
{
};
/**
* Filters out items from the list that don't match the query and returns remaining items. Default
* implementation checks if the item starts with the query.
*
* @signature ItemManager.filter(list, query)
*
* @param list {Array} List of items. Default implementation works with strings.
* @param query {String} Query string.
*
* @author agorbatchev
* @date 2011/08/19
* @id ItemManager.filter
*/
p.filter = function(list, query)
{
var result = [],
i, item
;
for(i = 0; i < list.length; i++)
{
item = list[i];
if(this.itemContains(item, query))
result.push(item);
}
return result;
};
/**
* Returns `true` if specified item contains another string, `false` otherwise. In the default implementation
* `String.indexOf()` is used to check if item string begins with the needle string.
*
* @signature ItemManager.itemContains(item, needle)
*
* @param item {Object} Item to check. Default implementation works with strings.
* @param needle {String} Search string to be found within the item.
*
* @author agorbatchev
* @date 2011/08/19
* @id ItemManager.itemContains
*/
p.itemContains = function(item, needle)
{
return this.itemToString(item).toLowerCase().indexOf(needle.toLowerCase()) == 0;
};
/**
* Converts specified string to item. Because default implemenation works with string, input string
* is simply returned back. To use custom objects, different implementation of this method could
* return something like `{ name : {String} }`.
*
* @signature ItemManager.stringToItem(str)
*
* @param str {String} Input string.
*
* @author agorbatchev
* @date 2011/08/19
* @id ItemManager.stringToItem
*/
p.stringToItem = function(str)
{
return str;
};
/**
* Converts specified item to string. Because default implemenation works with string, input string
* is simply returned back. To use custom objects, different implementation of this method could
* for example return `name` field of `{ name : {String} }`.
*
* @signature ItemManager.itemToString(item)
*
* @param item {Object} Input item to be converted to string.
*
* @author agorbatchev
* @date 2011/08/19
* @id ItemManager.itemToString
*/
p.itemToString = function(item)
{
return item;
};
/**
* Returns `true` if both items are equal, `false` otherwise. Because default implemenation works with
* string, input items are compared as strings. To use custom objects, different implementation of this
* method could for example compare `name` fields of `{ name : {String} }` type object.
*
* @signature ItemManager.compareItems(item1, item2)
*
* @param item1 {Object} First item.
* @param item2 {Object} Second item.
*
* @author agorbatchev
* @date 2011/08/19
* @id ItemManager.compareItems
*/
p.compareItems = function(item1, item2)
{
return item1 == item2;
};
//--------------------------------------------------------------------------------
// TextExt core component
p = TextExt.prototype;
/**
* Initializes current component instance with work with the supplied text input and options.
*
* @signature TextExt.init(input, opts)
*
* @param input {HTMLElement} Text input.
* @param opts {Object} Options.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.init
*/
p.init = function(input, opts)
{
var self = this,
hiddenInput,
itemManager,
container
;
self._defaults = $.extend({}, DEFAULT_OPTS);
self._opts = opts || {};
self._plugins = {};
self._itemManager = itemManager = new (self.opts(OPT_ITEM_MANAGER))();
input = $(input);
container = $(self.opts(OPT_HTML_WRAP));
hiddenInput = $(self.opts(OPT_HTML_HIDDEN));
input
.wrap(container)
.keydown(function(e) { return self.onKeyDown(e) })
.keyup(function(e) { return self.onKeyUp(e) })
.data('textext', self)
;
// keep references to html elements using jQuery.data() to avoid circular references
$(self).data({
'hiddenInput' : hiddenInput,
'wrapElement' : input.parents('.text-wrap').first(),
'input' : input
});
// set the name of the hidden input to the text input's name
hiddenInput.attr('name', input.attr('name'));
// remove name attribute from the text input
input.attr('name', null);
// add hidden input to the DOM
hiddenInput.insertAfter(input);
$.extend(true, itemManager, self.opts(OPT_EXT + '.item.manager'));
$.extend(true, self, self.opts(OPT_EXT + '.*'), self.opts(OPT_EXT + '.core'));
self.originalWidth = input.outerWidth();
self.invalidateBounds();
itemManager.init(self);
self.initPatches();
self.initPlugins(self.opts(OPT_PLUGINS), $.fn.textext.plugins);
self.on({
setFormData : self.onSetFormData,
getFormData : self.onGetFormData,
setInputData : self.onSetInputData,
anyKeyUp : self.onAnyKeyUp
});
self.trigger(EVENT_POST_INIT);
self.trigger(EVENT_READY);
self.getFormData(0);
};
/**
* Initialized all installed patches against current instance. The patches are initialized based on their
* initialization priority which is returned by each patch's `initPriority()` method. Priority
* is a `Number` where patches with higher value gets their `init()` method called before patches
* with lower priority value.
*
* This facilitates initializing of patches in certain order to insure proper dependencies
* regardless of which order they are loaded.
*
* By default all patches have the same priority - zero, which means they will be initialized
* in rorder they are loaded, that is unless `initPriority()` is overriden.
*
* @signature TextExt.initPatches()
*
* @author agorbatchev
* @date 2011/10/11
* @id TextExt.initPatches
*/
p.initPatches = function()
{
var list = [],
source = $.fn.textext.patches,
name
;
for(name in source)
list.push(name);
this.initPlugins(list, source);
};
/**
* Creates and initializes all specified plugins. The plugins are initialized based on their
* initialization priority which is returned by each plugin's `initPriority()` method. Priority
* is a `Number` where plugins with higher value gets their `init()` method called before plugins
* with lower priority value.
*
* This facilitates initializing of plugins in certain order to insure proper dependencies
* regardless of which order user enters them in the `plugins` option field.
*
* By default all plugins have the same priority - zero, which means they will be initialized
* in the same order as entered by the user.
*
* @signature TextExt.initPlugins(plugins)
*
* @param plugins {Array} List of plugin names to initialize.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.initPlugins
*/
p.initPlugins = function(plugins, source)
{
var self = this,
ext, name, plugin, initList = [], i
;
if(typeof(plugins) == 'string')
plugins = plugins.split(/\s*,\s*|\s+/g);
for(i = 0; i < plugins.length; i++)
{
name = plugins[i];
plugin = source[name];
if(plugin)
{
self._plugins[name] = plugin = new plugin();
self[name] = (function(plugin) {
return function(){ return plugin; }
})(plugin);
initList.push(plugin);
$.extend(true, plugin, self.opts(OPT_EXT + '.*'), self.opts(OPT_EXT + '.' + name));
}
}
// sort plugins based on their priority values
initList.sort(function(p1, p2)
{
p1 = p1.initPriority();
p2 = p2.initPriority();
return p1 === p2
? 0
: p1 < p2 ? 1 : -1
;
});
for(i = 0; i < initList.length; i++)
initList[i].init(self);
};
/**
* Returns true if specified plugin is was instantiated for the current instance of core.
*
* @signature TextExt.hasPlugin(name)
*
* @param name {String} Name of the plugin to check.
*
* @author agorbatchev
* @date 2011/12/28
* @id TextExt.hasPlugin
* @version 1.1
*/
p.hasPlugin = function(name)
{
return !!this._plugins[name];
};
/**
* Allows to add multiple event handlers which will be execued in the scope of the current object.
*
* @signature TextExt.on([target], handlers)
*
* @param target {Object} **Optional**. Target object which has traditional `bind(event, handler)` method.
* Handler function will still be executed in the current object's scope.
* @param handlers {Object} Key/value pairs of event names and handlers, eg `{ event: handler }`.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.on
*/
p.on = hookupEvents;
/**
* Binds an event handler to the input box that user interacts with.
*
* @signature TextExt.bind(event, handler)
*
* @param event {String} Event name.
* @param handler {Function} Event handler.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.bind
*/
p.bind = function(event, handler)
{
this.input().bind(event, handler);
};
/**
* Triggers an event on the input box that user interacts with. All core events are originated here.
*
* @signature TextExt.trigger(event, ...args)
*
* @param event {String} Name of the event to trigger.
* @param ...args All remaining arguments will be passed to the event handler.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.trigger
*/
p.trigger = function()
{
var args = arguments;
this.input().trigger(args[0], slice.call(args, 1));
};
/**
* Returns instance of `itemManager` that is used by the component.
*
* @signature TextExt.itemManager()
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.itemManager
*/
p.itemManager = function()
{
return this._itemManager;
};
/**
* Returns jQuery input element with which user is interacting with.
*
* @signature TextExt.input()
*
* @author agorbatchev
* @date 2011/08/10
* @id TextExt.input
*/
p.input = function()
{
return $(this).data('input');
};
/**
* Returns option value for the specified option by name. If the value isn't found in the user
* provided options, it will try looking for default value.
*
* @signature TextExt.opts(name)
*
* @param name {String} Option name as described in the options.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.opts
*/
p.opts = function(name)
{
var result = getProperty(this._opts, name);
return typeof(result) == 'undefined' ? getProperty(this._defaults, name) : result;
};
/**
* Returns HTML element that was created from the `html.wrap` option. This is the top level HTML
* container for the text input with which user is interacting with.
*
* @signature TextExt.wrapElement()
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.wrapElement
*/
p.wrapElement = function()
{
return $(this).data('wrapElement');
};
/**
* Updates container to match dimensions of the text input. Triggers `preInvalidate` and `postInvalidate`
* events.
*
* @signature TextExt.invalidateBounds()
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.invalidateBounds
*/
p.invalidateBounds = function()
{
var self = this,
input = self.input(),
wrap = self.wrapElement(),
container = wrap.parent(),
width = '100%',
height = '30px'
;
self.trigger(EVENT_PRE_INVALIDATE);
height = '30px';
// using css() method instead of width() and height() here because they don't seem to do the right thing in jQuery 1.8.x
// https://github.com/alexgorbatchev/jquery-textext/issues/74
input.css({ 'width' : width });
wrap.css({ 'width' : width, 'height' : height });
container.css({ 'height' : height });
self.trigger(EVENT_POST_INVALIDATE);
};
/**
* Focuses user input on the text box.
*
* @signature TextExt.focusInput()
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.focusInput
*/
p.focusInput = function()
{
this.input()[0].focus();
};
/**
* Serializes data for to be set into the hidden input field and which will be submitted
* with the HTML form.
*
* By default simple JSON serialization is used. It's expected that `JSON.stringify`
* method would be available either through built in class in most modern browsers
* or through JSON2 library.
*
* @signature TextExt.serializeData(data)
*
* @param data {Object} Data to serialize.
*
* @author agorbatchev
* @date 2011/08/09
* @id TextExt.serializeData
*/
p.serializeData = stringify;
/**
* Returns the hidden input HTML element which will be submitted with the HTML form.
*
* @signature TextExt.hiddenInput()
*
* @author agorbatchev
* @date 2011/08/09
* @id TextExt.hiddenInput
*/
p.hiddenInput = function(value)
{
return $(this).data('hiddenInput');
};
/**
* Abstracted functionality to trigger an event and get the data with maximum weight set by all
* the event handlers. This functionality is used for the `getFormData` event.
*
* @signature TextExt.getWeightedEventResponse(event, args)
*
* @param event {String} Event name.
* @param args {Object} Argument to be passed with the event.
*
* @author agorbatchev
* @date 2011/08/22
* @id TextExt.getWeightedEventResponse
*/
p.getWeightedEventResponse = function(event, args)
{
var self = this,
data = {},
maxWeight = 0
;
self.trigger(event, data, args);
for(var weight in data)
maxWeight = Math.max(maxWeight, weight);
return data[maxWeight];
};
/**
* Triggers the `getFormData` event to get all the plugins to return their data.
*
* After the data is returned, triggers `setFormData` and `setInputData` to update appopriate values.
*
* @signature TextExt.getFormData(keyCode)
*
* @param keyCode {Number} Key code number which has triggered this update. It's impotant to pass
* this value to the plugins because they might return different values based on the key that was
* pressed. For example, the Tags plugin returns an empty string for the `input` value if the enter
* key was pressed, otherwise it returns whatever is currently in the text input.
*
* @author agorbatchev
* @date 2011/08/22
* @id TextExt.getFormData
*/
p.getFormData = function(keyCode)
{
var self = this,
data = self.getWeightedEventResponse(EVENT_GET_FORM_DATA, keyCode || 0)
;
self.trigger(EVENT_SET_FORM_DATA , data['form']);
self.trigger(EVENT_SET_INPUT_DATA , data['input']);
};
//--------------------------------------------------------------------------------
// Event handlers
/**
* Reacts to the `anyKeyUp` event and triggers the `getFormData` to change data that will be submitted
* with the form. Default behaviour is that everything that is typed in will be JSON serialized, so
* the end result will be a JSON string.
*
* @signature TextExt.onAnyKeyUp(e)
*
* @param e {Object} jQuery event.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.onAnyKeyUp
*/
p.onAnyKeyUp = function(e, keyCode)
{
this.getFormData(keyCode);
};
/**
* Reacts to the `setInputData` event and populates the input text field that user is currently
* interacting with.
*
* @signature TextExt.onSetInputData(e, data)
*
* @param e {Event} jQuery event.
* @param data {String} Value to be set.
*
* @author agorbatchev
* @date 2011/08/22
* @id TextExt.onSetInputData
*/
p.onSetInputData = function(e, data)
{
this.input().val(data);
};
/**
* Reacts to the `setFormData` event and populates the hidden input with will be submitted with
* the HTML form. The value will be serialized with `serializeData()` method.
*
* @signature TextExt.onSetFormData(e, data)
*
* @param e {Event} jQuery event.
* @param data {Object} Data that will be set.
*
* @author agorbatchev
* @date 2011/08/22
* @id TextExt.onSetFormData
*/
p.onSetFormData = function(e, data)
{
var self = this;
self.hiddenInput().val(self.serializeData(data));
};
/**
* Reacts to `getFormData` event triggered by the core. At the bare minimum the core will tell
* itself to use the current value in the text input as the data to be submitted with the HTML
* form.
*
* @signature TextExt.onGetFormData(e, data)
*
* @param e {Event} jQuery event.
*
* @author agorbatchev
* @date 2011/08/09
* @id TextExt.onGetFormData
*/
p.onGetFormData = function(e, data)
{
var val = this.input().val();
data[0] = formDataObject(val, val);
};
//--------------------------------------------------------------------------------
// User mouse/keyboard input
/**
* Triggers `[name]KeyUp` and `[name]KeyPress` for every keystroke as described in the events.
*
* @signature TextExt.onKeyUp(e)
*
* @param e {Object} jQuery event.
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.onKeyUp
*/
/**
* Triggers `[name]KeyDown` for every keystroke as described in the events.
*
* @signature TextExt.onKeyDown(e)
*
* @param e {Object} jQuery event.
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.onKeyDown
*/
$(['Down', 'Up']).each(function()
{
var type = this.toString();
p['onKey' + type] = function(e)
{
var self = this,
keyName = self.opts(OPT_KEYS)[e.keyCode],
defaultResult = true
;
if(keyName)
{
defaultResult = keyName.substr(-1) != '!';
keyName = keyName.replace('!', '');
self.trigger(keyName + 'Key' + type);
// manual *KeyPress event fimplementation for the function keys like Enter, Backspace, etc.
if(type == 'Up' && self._lastKeyDown == e.keyCode)
{
self._lastKeyDown = null;
self.trigger(keyName + 'KeyPress');
}
if(type == 'Down')
self._lastKeyDown = e.keyCode;
}
self.trigger('anyKey' + type, e.keyCode);
return defaultResult;
};
});
//--------------------------------------------------------------------------------
// Plugin Base
p = TextExtPlugin.prototype;
/**
* Allows to add multiple event handlers which will be execued in the scope of the current object.
*
* @signature TextExt.on([target], handlers)
*
* @param target {Object} **Optional**. Target object which has traditional `bind(event, handler)` method.
* Handler function will still be executed in the current object's scope.
* @param handlers {Object} Key/value pairs of event names and handlers, eg `{ event: handler }`.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.on
*/
p.on = hookupEvents;
/**
* Returns the hash object that `getFormData` triggered by the core expects.
*
* @signature TextExtPlugin.formDataObject(input, form)
*
* @param input {String} Value that will go into the text input that user is interacting with.
* @param form {Object} Value that will be serialized and put into the hidden that will be submitted
* with the HTML form.
*
* @author agorbatchev
* @date 2011/08/22
* @id TextExtPlugin.formDataObject
*/
p.formDataObject = formDataObject;
/**
* Initialization method called by the core during plugin instantiation. This method must be implemented
* by each plugin individually.
*
* @signature TextExtPlugin.init(core)
*
* @param core {TextExt} Instance of the TextExt core class.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.init
*/
p.init = function(core) { throw new Error('Not implemented') };
/**
* Initialization method wich should be called by the plugin during the `init()` call.
*
* @signature TextExtPlugin.baseInit(core, defaults)
*
* @param core {TextExt} Instance of the TextExt core class.
* @param defaults {Object} Default plugin options. These will be checked if desired value wasn't
* found in the options supplied by the user.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.baseInit
*/
p.baseInit = function(core, defaults)
{
var self = this;
core._defaults = $.extend(true, core._defaults, defaults);
self._core = core;
self._timers = {};
};
/**
* Allows starting of multiple timeout calls. Each time this method is called with the same
* timer name, the timer is reset. This functionality is useful in cases where an action needs
* to occur only after a certain period of inactivity. For example, making an AJAX call after
* user stoped typing for 1 second.
*
* @signature TextExtPlugin.startTimer(name, delay, callback)
*
* @param name {String} Timer name.
* @param delay {Number} Delay in seconds.
* @param callback {Function} Callback function.
*
* @author agorbatchev
* @date 2011/08/25
* @id TextExtPlugin.startTimer
*/
p.startTimer = function(name, delay, callback)
{
var self = this;
self.stopTimer(name);
self._timers[name] = setTimeout(
function()
{
delete self._timers[name];
callback.apply(self);
},
delay * 1000
);
};
/**
* Stops the timer by name without resetting it.
*
* @signature TextExtPlugin.stopTimer(name)
*
* @param name {String} Timer name.
*
* @author agorbatchev
* @date 2011/08/25
* @id TextExtPlugin.stopTimer
*/
p.stopTimer = function(name)
{
clearTimeout(this._timers[name]);
};
/**
* Returns instance of the `TextExt` to which current instance of the plugin is attached to.
*
* @signature TextExtPlugin.core()
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.core
*/
p.core = function()
{
return this._core;
};
/**
* Shortcut to the core's `opts()` method. Returns option value.
*
* @signature TextExtPlugin.opts(name)
*
* @param name {String} Option name as described in the options.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.opts
*/
p.opts = function(name)
{
return this.core().opts(name);
};
/**
* Shortcut to the core's `itemManager()` method. Returns instance of the `ItemManger` that is
* currently in use.
*
* @signature TextExtPlugin.itemManager()
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.itemManager
*/
p.itemManager = function()
{
return this.core().itemManager();
};
/**
* Shortcut to the core's `input()` method. Returns instance of the HTML element that represents
* current text input.
*
* @signature TextExtPlugin.input()
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.input
*/
p.input = function()
{
return this.core().input();
};
/**
* Shortcut to the commonly used `this.input().val()` call to get or set value of the text input.
*
* @signature TextExtPlugin.val(value)
*
* @param value {String} Optional value. If specified, the value will be set, otherwise it will be
* returned.
*
* @author agorbatchev
* @date 2011/08/20
* @id TextExtPlugin.val
*/
p.val = function(value)
{
var input = this.input();
if(typeof(value) === UNDEFINED)
return input.val();
else
input.val(value);
};
/**
* Shortcut to the core's `trigger()` method. Triggers specified event with arguments on the
* component core.
*
* @signature TextExtPlugin.trigger(event, ...args)
*
* @param event {String} Name of the event to trigger.
* @param ...args All remaining arguments will be passed to the event handler.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExtPlugin.trigger
*/
p.trigger = function()
{
var core = this.core();
core.trigger.apply(core, arguments);
};
/**
* Shortcut to the core's `bind()` method. Binds specified handler to the event.
*
* @signature TextExtPlugin.bind(event, handler)
*
* @param event {String} Event name.
* @param handler {Function} Event handler.
*
* @author agorbatchev
* @date 2011/08/20
* @id TextExtPlugin.bind
*/
p.bind = function(event, handler)
{
this.core().bind(event, handler);
};
/**
* Returns initialization priority for this plugin. If current plugin depends upon some other plugin
* to be initialized before or after, priority needs to be adjusted accordingly. Plugins with higher
* priority initialize before plugins with lower priority.
*
* Default initialization priority is `0`.
*
* @signature TextExtPlugin.initPriority()
*
* @author agorbatchev
* @date 2011/08/22
* @id TextExtPlugin.initPriority
*/
p.initPriority = function()
{
return 0;
};
//--------------------------------------------------------------------------------
// jQuery Integration
/**
* TextExt integrates as a jQuery plugin available through the `$(selector).textext(opts)` call. If
* `opts` argument is passed, then a new instance of `TextExt` will be created for all the inputs
* that match the `selector`. If `opts` wasn't passed and TextExt was already intantiated for
* inputs that match the `selector`, array of `TextExt` instances will be returned instead.
*
* // will create a new instance of `TextExt` for all elements that match `.sample`
* $('.sample').textext({ ... });
*
* // will return array of all `TextExt` instances
* var list = $('.sample').textext();
*
* The following properties are also exposed through the jQuery `$.fn.textext`:
*
* * `TextExt` -- `TextExt` class.
* * `TextExtPlugin` -- `TextExtPlugin` class.
* * `ItemManager` -- `ItemManager` class.
* * `plugins` -- Key/value table of all registered plugins.
* * `addPlugin(name, constructor)` -- All plugins should register themselves using this function.
*
* @author agorbatchev
* @date 2011/08/19
* @id TextExt.jquery
*/
var cssInjected = false;
var textext = $.fn.textext = function(opts)
{
var css;
if(!cssInjected && (css = $.fn.textext.css) != null)
{
$('head').append('<style>' + css + '</style>');
cssInjected = true;
}
return this.map(function()
{
var self = $(this);
if(opts == null)
return self.data('textext');
var instance = new TextExt();
instance.init(self, opts);
self.data('textext', instance);
return instance.input()[0];
});
};
/**
* This static function registers a new plugin which makes it available through the `plugins` option
* to the end user. The name specified here is the name the end user would put in the `plugins` option
* to add this plugin to a new instance of TextExt.
*
* @signature $.fn.textext.addPlugin(name, constructor)
*
* @param name {String} Name of the plugin.
* @param constructor {Function} Plugin constructor.
*
* @author agorbatchev
* @date 2011/10/11
* @id TextExt.addPlugin
*/
textext.addPlugin = function(name, constructor)
{
textext.plugins[name] = constructor;
constructor.prototype = new textext.TextExtPlugin();
};
/**
* This static function registers a new patch which is added to each instance of TextExt. If you are
* adding a new patch, make sure to call this method.
*
* @signature $.fn.textext.addPatch(name, constructor)
*
* @param name {String} Name of the patch.
* @param constructor {Function} Patch constructor.
*
* @author agorbatchev
* @date 2011/10/11
* @id TextExt.addPatch
*/
textext.addPatch = function(name, constructor)
{
textext.patches[name] = constructor;
constructor.prototype = new textext.TextExtPlugin();
};
textext.TextExt = TextExt;
textext.TextExtPlugin = TextExtPlugin;
textext.ItemManager = ItemManager;
textext.plugins = {};
textext.patches = {};
})(jQuery);
(function($)
{
function TextExtIE9Patches() {};
$.fn.textext.TextExtIE9Patches = TextExtIE9Patches;
$.fn.textext.addPatch('ie9',TextExtIE9Patches);
var p = TextExtIE9Patches.prototype;
p.init = function(core)
{
if(navigator.userAgent.indexOf('MSIE 9') == -1)
return;
var self = this;
core.on({ postInvalidate : self.onPostInvalidate });
};
p.onPostInvalidate = function()
{
var self = this,
input = self.input(),
val = input.val()
;
// agorbatchev :: IE9 doesn't seem to update the padding if box-sizing is on until the
// text box value changes, so forcing this change seems to do the trick of updating
// IE's padding visually.
input.val(Math.random());
input.val(val);
};
})(jQuery);
| mit |
xcloudcoin/XCloudcoin | src/qt/locale/bitcoin_kk_KZ.ts | 108490 | <?xml version="1.0" ?><!DOCTYPE TS><TS language="kk_KZ" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About XCloudcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>XCloudcoin</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The XCloudcoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Адресті немесе белгіні өзгерту үшін екі рет шертіңіз</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Жаңа адрес енгізу</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Таңдаған адресті тізімнен жою</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-46"/>
<source>These are your XCloudcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a XCloudcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Verify a message to ensure it was signed with a specified XCloudcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>Жою</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Үтірмен бөлінген текст (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>таңба</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Адрес</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(таңбасыз)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Құпия сөзді енгізу</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Жаңа құпия сөзі</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Жаңа құпия сөзді қайта енгізу</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+35"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Әмиянға жаңа қүпия сөзді енгізіңіз.<br/><b>10 немесе одан әрі кездейсоқ белгілерді</b>, әлде <b>сегіз немесе одан әрі сөздерді</b>құпия сөзіңізде пайдалану өтінеміз.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Әмиянді шифрлау</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Бұл операциясы бойынша сіздің әмиянізді қоршаудан шығару үшін әмиянның құпия сөзі керек</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Әмиянізді қоршаудан шығару</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Бұл операциясы бойынша сіздің әмиянізді шифрлап тастау үшін әмиянның құпия сөзі керек</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Әмиянізді шифрлап тастау</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Құпия сөзді өзгерту</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-58"/>
<source>XCloudcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+282"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>Synchronizing with network...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-319"/>
<source>&Overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>&Receive coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-7"/>
<source>&Send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show information about XCloudcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+259"/>
<source>~%n block(s) remaining</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-256"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Send coins to a XCloudcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Modify configuration options for XCloudcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-202"/>
<source>XCloudcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+180"/>
<source>&About XCloudcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>&File</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Tabs toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Actions toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+9"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+60"/>
<source>XCloudcoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+75"/>
<source>%n active connection(s) to XCloudcoin network</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+40"/>
<source>Downloaded %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+413"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-403"/>
<source>%n second(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="-312"/>
<source>About XCloudcoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about XCloudcoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+297"/>
<source>%n minute(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Up to date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Catching up...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Last received block was generated %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid XCloudcoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+76"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+109"/>
<source>A fatal error occurred. XCloudcoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+90"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+551"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Адрес</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-515"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+155"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(таңбасыз)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid XCloudcoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+420"/>
<location line="+12"/>
<source>XCloudcoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start XCloudcoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start XCloudcoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Detach databases at shutdown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the XCloudcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the XCloudcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting XCloudcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show XCloudcoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Whether to show coin control features or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+55"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+149"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting XCloudcoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+231"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the XCloudcoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-160"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-107"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Total:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-108"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+113"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+348"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the XCloudcoin-Qt help message to get a list with possible XCloudcoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>XCloudcoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>XCloudcoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the XCloudcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-33"/>
<source>Welcome to the XCloudcoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+86"/>
<location line="+86"/>
<location line="+32"/>
<source>0.00 hack</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-191"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>123.456 hack</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-173"/>
<source>Enter a XCloudcoin address (e.g. XCloudcoinfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+86"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>WARNING: Invalid XCloudcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(таңбасыз)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<location filename="../sendcoinsentry.cpp" line="+25"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to send the payment to (e.g. XCloudcoinfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a XCloudcoin address (e.g. XCloudcoinfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. XCloudcoinfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this XCloudcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. XCloudcoinfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified XCloudcoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a XCloudcoin address (e.g. XCloudcoinfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter XCloudcoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+19"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-211"/>
<source>, has not been successfully broadcast yet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>unknown</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+226"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Адрес</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+190"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+55"/>
<location line="+16"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+144"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Үтірмен бөлінген файл (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>таңба</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Адрес</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+206"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>XCloudcoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or XCloudcoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: XCloudcoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: XCloudcoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong XCloudcoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=XCloudcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "XCloudcoin Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. XCloudcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-98"/>
<source>XCloudcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of XCloudcoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart XCloudcoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. XCloudcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | mit |
stivalet/PHP-Vulnerability-test-suite | Injection/CWE_91/safe/CWE_91__backticks__CAST-cast_int_sort_of__ID_at-sprintf_%s_simple_quote.php | 1355 | <?php
/*
Safe sample
input : backticks interpretation, reading the file /tmp/tainted.txt
sanitize : cast via + = 0
construction : use of sprintf via a %s with simple quote
*/
/*Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.*/
$tainted = `cat /tmp/tainted.txt`;
$tainted += 0 ;
$query = sprintf("//User[@id='%s']", $tainted);
$xml = simplexml_load_file("users.xml");//file load
echo "query : ". $query ."<br /><br />" ;
$res=$xml->xpath($query);//execution
print_r($res);
echo "<br />" ;
?> | mit |
kiranps/kiranps.github.io | about.md | 298 | ---
layout: page
title: About me
---
Hi! I'm Kiran PS, I've been developing applications for the web using mostly React, Ruby On Rails.
You can find me on [Github](https://github.com/kiranps), [Twitter](https://twitter.com/pskirann), [Linkedin](https://www.linkedin.com/in/kiran-p-s-69a3b45b/)
| mit |
felixonmars/tldr | pages/common/code.md | 298 | # code
> Visual Studio Code.
- Open VS Code:
`code`
- Open the current directory in VS Code:
`code .`
- Open a file or directory in VS Code:
`code {{path/to/file_or_folder}}`
- Open a file or directory in the currently open VS Code window:
`code --reuse-window {{path/to/file_or_folder}}`
| mit |
adrianhall/node-stuff | node-static/public/config.js | 783 | System.config({
"baseURL": "/",
"transpiler": "babel",
"babelOptions": {
"optional": [
"runtime"
]
},
"paths": {
"*": "*.js",
"github:*": "jspm_packages/github/*.js",
"npm:*": "jspm_packages/npm/*.js"
}
});
System.config({
"map": {
"babel": "npm:[email protected]",
"babel-runtime": "npm:[email protected]",
"core-js": "npm:[email protected]",
"github:jspm/[email protected]": {
"process": "npm:[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"fs": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
}
}
});
| mit |
croberts22/railgun | railgun.rb | 1112 | # Railgun
#
# Author: Corey Roberts
# Description: An extension to the MyAnimeList API.
# Version: 0.1
require_relative 'models/resource'
require_relative 'models/person'
require_relative 'models/anime'
require_relative 'models/character'
require_relative 'models/manga'
require_relative 'models/review'
require_relative 'models/user'
require_relative 'services/mal_network_service'
require_relative 'utilities/logger'
module Railgun
# Current API version.
API_VERSION = '1.1'
# Raised when there are any network errors.
class NetworkError < StandardError
attr_accessor :original_exception
def initialize(message, original_exception = nil)
@message = message
@original_exception = original_exception
super(message)
end
def to_s; @message; end
end
# Raised when a resource cannot be found.
class NotFoundError < StandardError
attr_accessor :original_exception
def initialize(message, original_exception = nil)
@message = message
@original_exception = original_exception
super(message)
end
def to_s; @message; end
end
end | mit |
yvoyer/php-kata | lib/Domain/DTO/StartedKata.php | 909 | <?php
/**
* This file is part of the phpkata project.
*
* (c) Yannick Voyer (http://github.com/yvoyer)
*/
namespace Star\Kata\Domain\DTO;
use Star\Kata\Domain\Kata;
use Star\Kata\Domain\Objective\Objective;
/**
* @author Yannick Voyer (http://github.com/yvoyer)
*/
class StartedKata
{
/**
* @var Kata
*/
private $wrappedKata;
/**
* @var Objective
*/
private $objective;
/**
* @param Kata $kata
* @param Objective $objective
*/
public function __construct(Kata $kata, Objective $objective)
{
$this->wrappedKata = $kata;
$this->objective = $objective;
}
/**
* @return string
*/
public function getName()
{
return $this->wrappedKata->name();
}
/**
* @return string
*/
public function getDescription()
{
return $this->objective->description();
}
}
| mit |
vnguyen94/react-commute | src/components/LanePieChart.js | 992 | import React, { Component } from 'react';
import { PieChart } from 'react-d3';
export default class LanePieChart extends Component {
constructor(props) {
super(props);
this.processLaneData = this.processLaneData.bind(this);
}
processLaneData(lanes) {
let lanesArr = [];
let totalTaken = 0;
Object.keys(lanes).forEach(laneNum => {
totalTaken += lanes[laneNum];
lanesArr.push({
label: laneNum,
value: lanes[laneNum]
});
})
// stringify to whole percentages
lanesArr.map(lane => {
lane.value = Math.round((lane.value / totalTaken) * 100);
});
return lanesArr;
}
render() {
const { lanes } = this.props;
const topLanes = this.processLaneData(lanes);
return (
<PieChart
data={topLanes}
width={400}
height={400}
radius={100}
innerRadius={10}
sectorBorderColor="white"
title="Most Frequently Taken Lanes"
/>
);
}
} | mit |
shoerob/BumbleTales | Tools/CRCompilerLibrary/INodeCompiler.h | 1963 | #pragma once
#include<fstream>
#include<vector>
#include "..\..\Engines\Utility\BinaryWriter.h"
#include "..\..\Engines\Utility\Guid.h"
namespace CR
{
namespace Compiler
{
//! This will actually compile the data from the xml file into its binary equivalent.
/*!
Implement this interface for each compiler that you need. Usually one for each handler and corresponding
xml tag. Your handler will be responsible for creating these.
*/
class INodeCompiler
{
public:
INodeCompiler(void);
INodeCompiler(const std::wstring &_name,const std::wstring &_guid);
virtual ~INodeCompiler(void);
//! This must never be called by/from a plugin. it is an internal compiler use only function
void AddChild(INodeCompiler* child);
//! This must never be called by/from a plugin. it is an internal compiler use only function
void Compile(CR::Utility::BinaryWriter &writer);
//user functions
//! Should return the name that will be used in your game to get to this data
/*!
The reader used in game treats its records in a tree fashion according the xml.
If your compiler is for a section then just return the name of the section here.
Or return the name of the resource.
*/
virtual CR::Utility::Guid& Index() {return guid;}
virtual void Index(const std::wstring _id) {guid.Set(_id);}
virtual std::wstring& Name() {return name;}
virtual void Name(const std::wstring& _name) {name = _name;}
//! This is called when the actual data needs to be compiled. Your should write out all data to the provided writer.
virtual void CompileData(CR::Utility::BinaryWriter &writer) {};
INodeCompiler* Parent() const {return m_parent;}
void Parent(INodeCompiler *_parent) {m_parent = _parent;}
protected:
std::vector<INodeCompiler*> children;
std::wstring name;
CR::Utility::Guid guid;
INodeCompiler *m_parent;
};
}
}
| mit |
capitalist/model_mill | spec/dummy/db/migrate/20110125024703_create_some_tables.rb | 472 | class CreateSomeTables < ActiveRecord::Migration
def self.up
create_table :users, :force => true do |t|
t.string :first_name
t.string :last_name
t.string :email, :null => false
t.timestamps
end
create_table :widgets, :force => true do |t|
t.integer :quantity, :default => 0
t.string :color
t.references :user
t.timestamps
end
end
def self.down
drop_table :widgets
drop_table :users
end
end
| mit |
launchly/launchly-my-orders | README.md | 383 | my-orders
=========
This is a reference implementation of a "My Orders" centre for launch.ly. The idea is that a person can log in and check the status of their order.
## Requirements
- [Bootstrap 3](http://getbootstrap.com)
- [JQuery](http://jquery.org)
## Usage
Create a screen snippet with an address pattern of ^my-orders$ and use the supplied html and javascript snippets. | mit |
rreusser/PyAUNetReceive | samples/ascii_levels.py | 332 | import numpy as np
from pyaunetreceive import AUNetReceive
def process_audio_data(data):
lr = np.fromstring(data,dtype=np.int16)
l = lr[::2]
r = lr[1::2]
var = np.var(l) + np.var(r)
print '*'*int(var/1000000)
netrecv = AUNetReceive( host='127.0.0.1', port=52800 )
netrecv.onrecv( process_audio_data )
netrecv.listen()
| mit |
qudou/xmlplus | example/api/08-others/03/index.js | 283 | xmlplus("xp", function (xp, $_, t) {
$_().imports({
Example: {
xml: "<Target id='example'/>",
fun: function (sys, items, opts) {
console.log(sys.example.namespace()); // //xp
}
},
Target: {}
});
}); | mit |
yogeshsaroya/new-cdnjs | ajax/libs/camanjs/1.1.0/caman.js | 130 | version https://git-lfs.github.com/spec/v1
oid sha256:353adff7db40f0bcd1a9217094c82d32023b43660ddb4029251de5878a78ec7d
size 47011
| mit |
yogeshsaroya/new-cdnjs | ajax/libs/gsap/1.10.1/TimelineMax.min.js | 130 | version https://git-lfs.github.com/spec/v1
oid sha256:37c9b3f1666039b8941eb7b030763ede4715b01300ccae910283084b48cd122b
size 16984
| mit |
clabroche/MediaStream | src/modules/welcome/router.js | 699 | function Router ($stateProvider, $urlRouterProvider, $httpProvider) {
$stateProvider.state({
name: 'welcome',
url: '/',
views: {
'navbar@welcome': {
parent: 'welcome',
templateUrl: 'views/_navbar.html',
controller: 'NavbarCtrl'
},
'modal@welcome': {
parent: 'welcome',
templateUrl: 'views/_modal.html',
controller: 'NavbarCtrl'
},
'welcome@welcome': {
parent: 'welcome',
templateUrl: 'src/modules/welcome/welcome.html'
},
'': {
abstract: true,
templateUrl: 'views/home.html',
controller: 'WelcomeController'
}
}
});
}
module.exports = Router;
| mit |
ancap-ch/from-en | ar-SA/Universally Preferable Behaviour/p00_ch02_intro.md | 25159 | ## المقدمة
لأجيال لا تعد ولا تحصى، عاش البشر في نوع من الأنانية والجهل الذي فرضه الذات: الارض كانت مسطحة، والشمس والقمر والنجوم تدور حولها، أسلافه سنحت له بالتكلم معها حتى بعد الممات، والرعد كان غضب الآلهة.
إن الخروج من هذا الرحم النرجسي من التفسير الذاتي يتطلب عمل آلاف السنين ويكلف حياة الملايين. كان الجهد المطلوب لربط وجهة نظرنا من * التجربة الإدراكية * إلى * المنطق المفاهيمي * مرعبة، مبهجة، مشوشة للغاية وخطيرة للغاية. فهم أن العالم لم يكن ما * شعرت به *، أو * يبدو لك *، كان ولا يزال أعظم انجاز ذكاءنا. * الحقيقة * من الواقع تحولت إلى أن تكون في نظر العقل، وليس من الجسد.
العالم يبدو مسطح. . الشمس والقمر يبدون بنفس الحجم؛ هم ليسوا كذالك. يبدو أن النجوم تتحرك حول الأرض. لا يفعلون. إن معرفة الحقيقة تتطلب أن نرى العالم من خارج حواسنا وهذا لا يعني رفض حواسنا، بل امتثالا محكما للأدلة الحقيقية * للحواس، وهي ليست أن العالم مسطح، ولكن هذا الأمر ، والطاقة والقوانين المادية متسقة. عندما نترك صخرة من يدنا، فإنها تقع هذه هي * الحقيقه * دليل على الحواس، وليس أن الأرض ثابتة وغير متحركة. فكرة أن العالم غير متحرك هو افتراض غير صحيح يتناقض مع الأدلة المباشرة من حواسنا، وهو أن كل شيء يقع. إذا سقط كل شيء، فإن العالم لا يمكن أن يكون ثابت وغير متحرك.
هذه هي الحقائق الصغيرة اليومية. أن الصخور تقع، الدخان يرتفع، النار ساخنة والشمس والقمر مدوران. وإذا بقينا ملتزمين التزاما صارما وصارما بهذه "الحقائق الصغيرة"، يمكننا في الوقت المناسب أن نستخلص الحقائق الفيزيائية العظيمة التي توفر لنا هذه المعرفة والقوة الرهيبة.
بين الحقائق الصغيرة والحقائق العظيمة، ومع ذلك، الأوهام هي التي أعمتنا في الفيزياء والأخلاق.
في الفيزياء، لا يمكن أن تتعارض الحقائق العظيمة مع الحقائق الصغيرة. لا "نظرية ميدانية موحدة" يمكن أن تتناقض بشكل صحيح لدينا تجربة الشعور المباشر من سقوط الصخور أو اللهب المتصاعد. أعظم نظرية رياضية لا يمكن أن تكون صحيحة إذا تم تطبيقها وإرجاع تغيير غير صحيح في اعداد الخروج.
تاريخيا، ومع ذلك، بين الحقائق الصغيرة الخاصة بنا والحقائق العظيمة تكمن ما سأطلق عليه "منطقة فارغة".
### منطقة "لا شيء"
إننا نقول لأطفالنا ألا يكمل بعضهم بعضا، ونعتقد أن العنف خطأ في المجرد، كقاعدة أخلاقية عامة. "الحقيقة الصغيرة" هي: * لا لكم *. "الحقيقة العظيمة" هي: * العنف خطأ *.
ومع ذلك، هناك في عقولنا كيان وهمي يسمى "الله"، وهذا الكيان يعتبر أخلاقيا تماما. ولسوء الطالع فإن هذا الكيان ينتهك باستمرار وبشكل صارخ المرسوم القائل بأن "العنف غير صحيح" من خلال غرق العالم، وإيصال النفوس إلى الجحيم على الرغم من معرفتهم الكاملة ب "قراراتهم"، وفرض عقوبات على الاغتصاب والقتل والسرقة والاعتداء وغيرها من الأعمال التي ندينها كما الشر تماما في أي فرد.
وبالتالي لدينا القليل من الحقيقة (* لا لكم *) والحقيقة العظيمة (* العنف هو خطأ *) ولكن في الوسط، لدينا هذا "منطقة فارغة" * حيث العكس تماما حيث الحقيقة الصغرى والعضمى تعتبر حقائق صحيحة تماما *.
تاريخيا، يمكننا أن نرى نفس التناقض في الفيزياء. لا توجد دوائر كاملة في تجربتنا المباشرة، ولكن بسبب الاعتقاد في الله، كل حركة الكواكب يجب أن تكون "دائرة مثالية" فرضية خلفت علم الفلك لقرون. وبالمثل، إذا رجل ادار رأسه، فإنه لا يعتقد بشكل معقول أن العالم كله يدور حوله وانه سوف يضع هذا بسعادة ليس فقط لانه "حقيقته العضيمة"، ولكن ك * الحقيقة العظيمة *، أو مبدأ عالمي . ولكن بالنسبة لمعظم تاريخ البشرية، كان يعتقد أن النجوم والكواكب تدور حول الأرض، بدلا من أن الأرض تدور. هنا مرة أخرى يمكننا أن نرى "منطقة خالية" بين خبرة الشعور المباشر والمبدأ العالمي، حيث تعتبر المبادئ معاكسة تماما لأن تكون صالحة تماما.
لا رجل عاقل يختبر الله مباشرة. في حياته اليومية، وقال انه يقبل تماما أن * الدي لا يمكن أن ينظر إليه غير موجود *. لا رجل معقول يجفل في كل مرة يأخذ خطوة، خوفا من جدار غير مرئي قد يكون منع طريقه. أعظم تجريدات العلم تدعم نهجه.
على العكس من ذلك، في "منطقة خالية" من الدين، * العكس تماما * من كل الحقائق الصغيرة والحقائق العظيمة ويعتقد أن يكون صحيحا. شخصيا، رجل يعتقد أن * التي لا يمكن أن ينظر إليها لا وجود لها * فكريا، وقد أثبت العلم هذا مرارا وتكرارا. ومع ذلك، في "منطقة فارغة" من اللاهوت، والعكس تماما اقتراح صحيح يحمل البديهية هناك * التي لا يمكن أن ينظر إليها ** يجب ان تكون ** موجودة *.
إيماننا بفضيلة الجيش يكمن أيضا في هذه "المنطقة الفارغة". إذا دفع رجل خاص لقتل رجل آخر، فإننا نسميه "بندقية للتأجير"، وندينه كرجل ضرب. إذا، ومع ذلك، فإن هذا الرجل يضع زي أخضر مع شرائط معينة * ويرتكب نفس الفعل *، ونحن نحييه كبطل ومكافأة له معاش التقاعد. الحقيقة البسيطة (* لا يجب القتل *) تتفق تماما مع الحقيقة العظيمة (* القتل خطأ *) ولكن في الوسط هناك تكمن "منطقة فارغة"، حيث القتل يصبح سحريا "فاضلا".
إذا كانت "المنطقة الخالية" هذه صالحة، اذن أي اقتراح منطقي يمكن أن يستمر. إذا كان الاقتراح صحيحا والعكس الدقيق لهذا الاقتراح صحيح أيضا يصبح المنطق المنطقي مستحيلا. نمو العلوم العقلانية هو الهجوم المطرد على هذه "المنطقة الفارغة"، وتوغل الاتساق الموضوعي في هذه الجيوب الصغيرة المجنونة من النزوة الذاتية.
في الخرائط القديمة، قبل أن ينتهي رسامو الخرائط من استكشافاتهم، إن رسومات الأراضي المعروفة سوف تتلاشى في ورق فارغ. ويتطلب نمو المعرفة أولا تحديد ما هو غير معروف، ومن ثم توسيع المبادئ المعروفة إلى المناطق المجهولة.
وينطبق الشيء نفسه في مجال الأخلاق.
### الخسائر
عبور هذه "المنطقة الفارغة" محفوف بالمخاطر. الطريق من الحقائق الصغيرة إلى الحقائق العظيمة مهدت بعظام الملايين. من وفاة سقراط إلى تعذيب العلماء الأوائل من قبل المتدينين الدينيين، والملايين الذين قتلوا وتوفيوا من أجل الأوهام السوداء للفاشية والشيوعية، فإن أي اتجاه إلى الأمام للمعرفة الإنسانية في "المنطقة الفارغة" محفوف بخطر كبير .
يجب "عبور المنطقة الفارغة" أو توحيد بسلاسة الحقائق الصغيرة مع الحقائق العظيمة حتما سيكون صعبز جدا وخطير؟ إنه تحد هائل لتوحيد الإدراك الحسي مع المفاهيم في خط مستقيم من التفكير المنطقي ولكن هل * يجب * لهذا التقدم ان يستغرق آلاف السنين ومحيطات الدم؟
وإذا نظرنا إلى التقدم التكنولوجي والاقتصادي للبشرية، فإننا نرى خطا ثابتا إلى حد ما لألفيات لا حصر لها، تليها طفرات ضخمة ومتناسقة على مدى السنوات القليلة الماضية. ولا يمكن تصور أن بعض الطفرات الجينية الواسعة الانتشار يمكن أن تسفر عن التسارع المفاجئ والهائل في الاتساق الفكري والنجاح المادي. النظريات التي تدعي أن "تأثير كرة الثلج" معين حيز الوجود، مدفوعا بشكل غامض من قبل تراكم كل الزيادات القليلة من المعرفة التي حدثت منذ فجر الحضارة، ويمكن عادة أن يتم فصله من اليد كليا * تفسيرات * نظرا لعدم وجود قيمة تنبؤية لها.
إذا كنا نفهم أن إمكاناتنا المذهلة كانت متاحة لنا على الأقل عشرات الآلاف من السنين وأن هناك أرباحا كبيرة ومتعة كبيرة في ممارسة ذلك ثم في آن واحد يصبح واضحا أننا حقا * هل * نريد استخدام عقولنا المذهلة.
وبالتالي يجب أن تكون هناك قوة هبوطية عملت تاريخيا على سحق واستقلال الحرية الطبيعية للإنسانية.
في مجال العلم، ليس من الصعب جدا أن نرى القوى القمعية التي أبقت باستمرار عقولنا في الجهل شبه الأولي. إن الجمع بين الخرافات في شكل دين، والعنف في شكل الأرستقراطية، هدد المفكرين العقلانيين بالتخويف والسجن والتعذيب والقتل. فمثلما كان المزارع يحقق أرباحا من الذكاء الضعيف لأبقاره، وأرباح مالك الرقيق من خوف عبيده منه ، احتفظ الكهنة والملوك بامتيازاتهم بتهديدهم بالموت أي شخص تجرأ على التفكير.
والحقيقة البسيطة هي أن "الكهنة" و "الملوك" كانوا وهم رجال فقط. الحقيقة البسيطة هي أن الآلهة والشياطين التي كان من المفترض أن تبرر حكمهم لم تكن موجودة.
لقد قطعنا خطوات كبيرة في فهم طبيعة وواقع المساواة الإنسانية البسيطة، ولكن الحقيقة المحزنة لهذه المسألة هي أن عالم الأخلاق * لا يزال مفقودا في "المنطقة الخالية" في الأوهام المدمرة للحقائق الوسطى ".
### "الحقائق الوسطية"
دعونا ندعو المبادئ المعارضة التي تقع في "المنطقة الفارغة" بين الإدراك الحسي والاتساق المفاهيمي "الحقائق الوسطى".
هذه "الحقائق الوسطى" هي أخطر أوهام الجميع، لأنها تمنح * مظهر * الحقيقة بينما في الواقع * تهاجم * الحقيقة.
من خلال توفير الوهم الذي وجدنا للحقيقة، "الحقائق الوسطى" في الواقع تمنعنا من كسب الحقيقة. إنها خط الدفاع الأخير عن الخيال والافتراس والاستغلال.
وبما أنها ليست عقلانية فحسب، ولكن * مكافحة * ، "الحقائق الوسطى" لا تزال مرنة إلى ما لا نهاية طالما أنها تخدم أولئك في السلطة. على سبيل المثال، نشأت المسيحية من الفاشية المتنامية للإمبراطورية الرومانية المتأخرة جزئيا من خلال انتزاع في الخرافات "البدائية" من اللاهوتيات القائمة. "ننسى الآلهة القديمة، لدينا العلامة التجارية الجديدة الله الذي هو أفضل بكثير!"
"الحقائق الوسطى" تأخذ دائما شكل الحقيقة، تليها كذبة. "زيوس هو خرافة الوثنية" هو بيان صحيح، الذي أدلى به علنا من قبل التبشير المسيحي. الكذب الذي أعقبه كان: "الرب ليس خرافة وثنية، بل إله حقيقي وحي".
يمكننا تخصيص هذا أكثر قليلا مع مثال من شأنه أن يكون مألوف لأي شخص من أي وقت مضى المشورة لصديق مختل. "كانت صديقي الأخير كان احمقا تماما"، وسوف تقول، وسوف توافق بحزم. وسوف تضيف "صديقي الجديد هو حقا * عظيم * على الرغم من ما قالت"، ، وسوف تحاول عدم لف عينيك.
ومن الصعب جدا عدم استبدال الوهم بأخر.
"الحكومة البريطانية طغيان!" بكى الثوريين الأميركيين في القرن الثامن عشر وبعد أن طردوا القوات البريطانية، ثم أنشأوا حكومتهم الخاصة وبدأوا في مهاجمة مواطنيهم.
"أرستقراطية هي رجس ظالم!" بكى ثوريين آخرين، الذين تم استبداد اغلبيتهم في شكل الديمقراطية.
"الحقائق الوسطى" يمكن أن توجد أيضا في العلم، وبالمثل منع التقدم الطبيعي من الحقائق الصغيرة إلى الحقائق العظيمة. حتى القرن الثامن عشر، على سبيل المثال، يعتقد علماء الأحياء في "جيل عفوي"، أو فكرة أن الحياة يمكن أن تنبع من مسألة غير حية. هذا لم يسبق له مثيل، بطبيعة الحال، ولكن تتفق مع الكتابات القديمة على حد سواء الفلسفية والدينية، وهكذا قبلت كحقيقة. أيضا، قبل ثورة أينشتاين في عام 1905، كان يعتقد أن الضوء يتحرك عبر مادة ثابتة وغير مرئية تسمى "الأثير المضيء"، تماما كما تتحرك الموجات الصوتية عبر الهواء. ولم يكن لدى أي عالم يعتقد في هذه النظرية أي دليل تجريبي على هذا "الأثير"، إما شخصيا أو علميا، ولكنه اعتبر ضروريا للامتثال لخصائص أخرى يمكن ملاحظتها.
الدين هو أيضا "حقيقة وسطى" أخرى ، واحدة من أخطرها. صحيح أننا من الأنواع الفريدة في الكون، بقدر ما نعرف. الزرافة هي أطول أربعة أضعاف، ولكن الرجال ليسو مجرد رئيسيات "أكثر ذكاء"، ولكن شيئا مختلفا تماما. وطبيعة هذا الاختلاف لا تزال غير معروفة إلى حد كبير تفسير ديني "نحن لسنا حيوانات لأن لدينا روح والتي تم إنشاؤها من قبل الله" هو مجرد مثال آخر على "الحقيقة المتوسطة". صحيح أننا مختلفين جدا عن الحيوانات. وليس صحيحا أننا خلقنا من قبل إله ولدينا روح.
كما أن بعض الطفيليات لا يمكن أن تتجذر حتى تطرد الطفيليات السابقة، "الحقائق الوسطى" فقط هجوم لأوهام سابقة * بحيث يمكن أن تأخذ مكانها *. أولئك الذين يشككون في الأوهام السابقة يتم رسمها نحو الخيال الجديد. وهكذا فإن المسيحية تحل محل الوثنية، والماركسية تحل محل المسيحية، وما بعد الحداثة تحل محل الماركسية، والديمقراطية تحل محل الأرستقراطية، وهلم جرا.
وإلى أن تتحقق الحقائق العظيمة، وتتحد مع الحقائق الصغيرة، "الحقائق الوسطى" هي مجرد كتيبة دوارة من الباطل الاستغلالي والمدمر مصمم خصيصا لمنع تحقيق الحقائق العظيمة.
والحقائق العظيمة تتحقق دائما من الحقائق الصغيرة.
العالم يقع بسبب سقوط الصخور.
### "Middle Truths" And Exploitation
Biologically, parasitism is a wholly viable survival strategy for many creatures. In the absence of ethical norms, stealing energy and resources from other creatures is perfectly sensible. In general, the most sustainable and stable form of parasitism is *symbiosis*, or mutually beneficial coexistence. Thus the bacteria that inhabit our intestines aid their own survival by helping us digest our food.
However, a virus that renders us continually exhausted, and barely able to keep ourselves alive, can scarcely be called “mutually beneficial”. If we think of our long and grim history of disaster, starvation, war, disease and poverty – and compare it with the astounding material successes of modernity – it is clear that a form of parasitism tyrannised our minds and capacities for millennia. Now that the last few hundred years have shown the power and creativity of the human spirit, we can view our species as an organism that has shaken off a terrible parasite, and sprung from an endless gasping deathbed to perform the most astounding feats of gymnastics.
When we cure ourselves of a disease, we feel better, but the disease does not. From the perspective of the smallpox virus, the smallpox vaccine is genocidal.
In the same way, the parasites that strangle mankind view the liberty of the majority with horror. Since their parasitism frees them from the demands of reality – to earn their daily bread – they inevitably view the freedom of the masses as a form of enslavement for themselves. Thus would a farmer view the “liberation” of his livestock as an utter disaster…
Establishing truth necessarily limits fantasy. Limiting fantasy necessarily limits exploitation. If I can convince you that I am a living man-God, and that the God who birthed me wants you to give me ten percent of your income, or you will be punished for eternity, then I can become exceedingly rich. I am a parasite of illusions, and depend on those illusions for my sustenance as surely as fungus relies on warmth, dampness – and darkness.
Those who use moral fantasies to exploit mankind have always fought tooth and nail against those who threaten their livelihood by discovering and disseminating the truth.
We are familiar with the example of the Mafia, which threatens potential rivals with maiming and death, or the spectacle of religious sects attacking each other, or one government attacking another.
When philosophers expose the falsehoods necessary for continued exploitation, however, they are ideally not aiming to set themselves up as competitors. They do not wish to *replace* the Mafia, or the church – they wish to eliminate it completely.
A more modern analogy would be the relationship between the state, lobbyists and taxpayers. Lobbyists will ferociously attack other lobbyists who compete for the same tax dollars. However, imagine how *all* lobbyists would band together to attack anyone who proposed eliminating the state as an institution.
Parasites will aggressively compete with one another for the host’s limited resources – but it is in their best interest to band together to attack anything that threatens to eliminate the host itself.
In this way, in any society where the state and the church are nominally separated, each entity tends to compete for adherents. Where the church begins to lose ground, the state will aggressively recruit patriots – resulting in secular socialism. Where the state begins to lose ground, the church will aggressively recruit adherents – resulting in religious fundamentalism, often with tinges of libertarianism.
However, the philosophers who oppose *all* intellectual error are the sworn enemies of all the parasites that feed off illusions. The “great truths” of physics eliminate the need for supernatural agents, and render miracles impossible. The explanatory power of science wholly outshines the religious fictions that masquerade as knowledge about the physical world.
The scientific method requires that every thesis be supported by evidence and rationality. Since there is no evidence for gods – and the very *idea* of gods is innately self-contradictory – the thesis “gods exist” cannot stand. Inevitably, the religious parasites attempt to defend their thesis by trying to split reality into “two realms” – the scientific and the spiritual. However, there is no evidence for the existence of this “spiritual” realm in the present, any more than there was for the parallel universe of Platonic “Forms” two thousand five hundred years ago.
Thus the establishment of consistent and universal truth necessarily limits and destroys the exploitive potential of illusion. In particular, the “great truths”, which are universal and consistent, make redundant and ridiculous the “middle truths” – which are in fact exploitive fantasies. We are familiar with the “middle truth” of religion; a few others will be examined and revealed here, some of which may shock you.
### Effective Parasitism
The most effective parasites – or viruses – are those which fool the body into indifference. Our immune systems are designed to attack foreign substances within the body, isolating and killing them. We fear HIV and cancer in particular because they are able to bypass our immune systems. The same technique is used by intellectual parasites to disable the defence systems of those they prey upon.
If a stranger attacks you in an alley and demands your money, you will be horrified and appalled. You may fight back, you may run, or you may give him your wallet, but you would remain shocked, angry and frightened by the interaction. When you repeated the story, you would tell it in a way that reinforced the base and vile violation of your personal and property rights. Others would feel sympathy for your predicament, and would avoid said alley in the future.
This is an example of a “little truth”, which is: “Stealing from me is wrong”.
However, when a government agent sends you a letter demanding that you pay him money, you may feel a certain indignity, but you would not relate the story with the same horror and indignation to your friends.
This is an example of a “middle truth”, which obscures a “great truth”, which is that “stealing is wrong”.
This book will focus on exposing and destroying these false “middle truths”. I believe that mankind suffers endlessly under the tyranny of false ethical “middle truths” which justify the destructive world-views of religious superstition, secular despotism and the cult of the family.
My thesis in this book is that in ethics, as in every other intellectual discipline, the great truths arise directly from the little truths. The disorienting fog of the “middle truths” is a hellish path to navigate, but it is worth struggling through, because the only fundamental alternative to truth is exploitation, destruction – and, inevitably, the untimely demise of millions.
| mit |
alexey-ernest/nodejs-in-action | connect-middleware/session-redis.js | 748 | var connect = require('connect');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
var app = connect()
.use(cookieParser('keyboard cat'))
.use(session({
store: new RedisStore({ prefix: 'sid' })
//secrect: 'keyboard cat'
}))
.use(function (req, res, next) {
var sess = req.session;
if (sess.views) {
res.setHeader('Content-Type', 'text/html');
res.write('<p>Views: ' + sess.views + '</p>');
sess.views++;
res.end();
} else {
sess.views = 1;
res.end('Welcome to the session demo. Refresh!');
}
})
.listen(3000);
| mit |
RoseLeBlood/aSTL | docs/html/d7/dd6/structstd_1_1int__to__type-members.html | 3449 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>alternative Standard Libary: Elementverzeichnis</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="../../Logo128x128.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">alternative Standard Libary
 <span id="projectnumber">0.29.8</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Erzeugt von Doxygen 1.8.13 -->
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('../../',false,false,'search.php','Suchen');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dd/d80/structstd_1_1int__to__type.html','../../');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">std::int_to_type< TVal > Elementverzeichnis</div> </div>
</div><!--header-->
<div class="contents">
<p>Vollständige Aufstellung aller Elemente für <a class="el" href="../../dd/d80/structstd_1_1int__to__type.html">std::int_to_type< TVal ></a> einschließlich aller geerbten Elemente.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="../../dd/d80/structstd_1_1int__to__type.html#a542be96e878c91399fbea8827864857bad99db5fdc7cacaf5d18f706eb3ac8586">value</a> enum-Wert</td><td class="entry"><a class="el" href="../../dd/d80/structstd_1_1int__to__type.html">std::int_to_type< TVal ></a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Erzeugt von
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>
| mit |
nutgaard/Sparkly | src/main/java/no/utgdev/sparkly/proxyimpl/caching/CachingAnnotationProcessor.java | 639 | package no.utgdev.sparkly.proxyimpl.caching;
import no.utgdev.sparkly.annotations.AnnotationProcessor;
import no.utgdev.sparkly.proxies.ProxyConfiguration;
public class CachingAnnotationProcessor implements AnnotationProcessor<Caching> {
public CachingAnnotationProcessor(){}
@Override
public Class<Caching> accepts() {
return Caching.class;
}
@Override
public ProxyConfiguration process(Caching annotation) {
try {
return annotation.configuringClass().newInstance();
} catch (InstantiationException | IllegalAccessException e) {
return null;
}
}
}
| mit |
rick4470/knowRick | packages/users/app.js | 304 | 'use strict';
/*
* Defining the Package
*/
var Module = require('meanio').Module;
var MeanUser = new Module('users');
MeanUser.register(function(app, auth, passport, database) {
MeanUser.routes(app, auth, database, passport);
MeanUser.aggregateAsset('js', 'meanUser.js');
return MeanUser;
});
| mit |
leeon/weibo4sa | src/zll/weibo4sa/model/AppLog.java | 816 | package zll.weibo4sa.model;
import java.io.Serializable;
import java.sql.Timestamp;
public class AppLog implements Serializable{
private static final long serialVersionUID = 1L;
private String content;
private String user;
private Timestamp date;
private String operation;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public Timestamp getDate() {
return date;
}
public void setDate(Timestamp date) {
this.date = date;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
}
| mit |
zedx/zedx | themes/Default/widgets/UserAds/views/index.blade.php | 6380 | <div class="panel panel-default">
<div class="tabbable-panel">
<div class="tabbable-line tabs-below">
<ul class="nav nav-tabs">
<li @if (Route::is('user.ad.index') || Route::is('user.index')) class="active" @endif><a href="{{ route('user.ad.index') }}" class="color-darken"><i class="fa fa-list-ul color-darken"></i> <span class="hidden-xs">{!! trans('frontend.user.ad.all_ads') !!}</span></a></li>
<li @if (isset($adstatus) && $adstatus->title == 'pending') class="active" @endif><a href="{{ route('user.ad.status', 'pending') }}" class="color-blue"><i class="fa fa-hourglass-start color-blue"></i> <span class="hidden-xs hidden-sm">{!! trans('frontend.user.ad.pending') !!}</span></a></li>
<li @if (isset($adstatus) && $adstatus->title == 'validate') class="active" @endif><a href="{{ route('user.ad.status', 'validate') }}" class="color-green"><i class="fa fa-check color-green"></i> <span class="hidden-xs hidden-sm">{!! trans('frontend.user.ad.validated') !!}</span></a></li>
<li @if (isset($adstatus) && $adstatus->title == 'expired') class="active" @endif><a href="{{ route('user.ad.status', 'expired') }}" class="color-orange"><i class="fa fa-hourglass-end color-orange"></i> <span class="hidden-xs hidden-sm">{!! trans('frontend.user.ad.expired') !!}</span></a></li>
<li @if (isset($adstatus) && $adstatus->title == 'banned') class="active" @endif><a href="{{ route('user.ad.status', 'banned') }}" class="color-red"><i class="fa fa-ban color-red"></i> <span class="hidden-xs hidden-sm">{!! trans('frontend.user.ad.banished') !!}</span></a></li>
</ul>
</div>
</div>
<div class="panel-body">
@forelse ($ads as $ad)
<div data-element-parent-action data-id="{{ $ad->id }}" class="ad-details" data-title="{{ str_limit($ad->content->title, 20) }}">
<div class="row">
<div class="col-md-2">
@if ($ad->adstatus->title == 'validate')
<div class="label label-success"><i class="fa fa-check"></i> {!! trans('frontend.user.ad.validated_ad') !!}</div>
@elseif ($ad->adstatus->title == 'pending')
<div class="label label-info"><i class="fa fa-hourglass-start"></i> {!! trans('frontend.user.ad.pending_ad') !!}</div>
@elseif ($ad->adstatus->title == 'expired')
<div class="label label-warning"><i class="fa fa-hourglass-end"></i> {!! trans('frontend.user.ad.expired_ad') !!}</div>
@elseif ($ad->adstatus->title == 'banned')
<div class="label label-danger"><i class="fa fa-ban"></i> {!! trans('frontend.user.ad.banished_ad') !!}</div>
@endif
<br /><br />
@if ($ad->adstatus->title == 'validate')
<div><small>{!! trans('frontend.user.ad.published_at', ['time' => $ad->published_at->diffForHumans()]) !!}</small></div>
@elseif ($ad->adstatus->title == 'expired')
<div><small>{!! trans('frontend.user.ad.expired_at', ['time' => $ad->expired_at->diffForHumans()]) !!}</small></div>
@else
<div><small>{!! trans('frontend.user.ad.created_at', ['time' => $ad->created_at->diffForHumans()]) !!}</small></div>
@endif
</div>
<div class="col-md-2">
@if ($main_pic = $ad->photos()->main()->first())
<a href="{{ route('ad.preview', array($ad->id, str_slug($ad->content->title))) }}">
<img class="img-responsive img-rounded" src="{{ image_route('medium', $main_pic->path) }}" alt="">
</a>
@else
<a href="{{ route('ad.preview', array($ad->id, str_slug($ad->content->title))) }}">
<i class="fa fa-picture-o" style="font-size:70px"></i>
</a>
@endif
</div>
<div class="col-md-5">
<h4><a href="{{ route('ad.preview', array($ad->id, str_slug($ad->content->title))) }}">{{ $ad->content->title }}</a></h4>
<p>{{ str_limit(strip_tags($ad->content->body), 100, "...") }}</p>
@include('widget_frontend_theme_userads::_partials.fields')
@if ($ad->adstatus->title == 'expired' && $ad->adtype->can_renew)
{!! Form::model($ad, ['method' => 'PUT', 'route' => ['user.ad.renew', $ad->id]]) !!}
<p><button type="submit" class="btn btn-warning btn-xs"><i class="fa fa-level-up"></i> {!! trans("frontend.user.ad.renew_ad") !!}</button></p>
{!! Form::close() !!}
@elseif ($ad->adstatus->title == 'validate')
@if (!$ad->expired_at)
@elseif ($ad->expired_at->diffInDays(null, false) >= 0 )
<p><code>{!! trans('frontend.user.ad.expire_today') !!}</code></p>
@else
<p><code>{!! trans_choice('frontend.user.ad.expire_in', $ad->expired_at->diffInDays()) !!} </code></p>
@endif
@endif
</div>
<div class="col-md-3">
<h4>{{ ($price = $ad->price()) && isset($price->pivot) ? number_format($price->pivot->value, trans('frontend.format.number.decimals') , trans('frontend.format.number.dec_point'), trans('frontend.format.number.thousands_sep'))." ".getAdCurrency($ad, $price->unit) : "" }}</h4>
<div class="dropdown pull-right ad-setting">
<button class="btn btn-default btn-circle dropdown-toggle" type="button" data-toggle="dropdown"><i class="fa fa-wrench"></i></button>
<ul class="dropdown-menu">
@if ($ad->adtype->can_edit)
<li><a href="{{ route('user.ad.edit', $ad->id) }}"><i class="fa fa-edit"> {!! trans('frontend.user.ad.edit') !!}</i></a></li>
<li class="divider"></li>
@endif
<li><a href="#" data-url = '{{ route("user.ad.destroy", [$ad->id]) }}' data-toggle="modal" data-target="#confirmDeleteAction" data-title="{{ $ad->content->title }}" data-message="{!! trans('frontend.user.ad.delete_ad_confirmation') !!}"><i class="fa fa-trash"> {!! trans('frontend.user.ad.delete') !!}</i></a></li>
</ul>
</div>
</div>
</div>
<hr />
</div>
<!-- /.row -->
@empty
<p class="text-center">{!! trans("frontend.user.ad.empty_ads_text") !!}</p>
@endforelse
<center>{!! $ads->render() !!}</center>
</div>
</div>
@include('widget_frontend_theme_userads::modals.delete')
| mit |
Bathlamos/Project-Euler-Solutions | solutions/p073.py | 520 | #
# Solution to Project Euler problem 73
# Philippe Legault
#
# https://github.com/Bathlamos/Project-Euler-Solutions
from fractions import Fraction, gcd
from math import ceil
# Not too slow, can be done directly
def compute():
lower_limit = Fraction(1, 3)
upper_limit = Fraction(1, 2)
res = 0
for i in range(1, 12000 + 1):
for j in range(int(ceil(lower_limit * i + 0.00001)), int(upper_limit * i - 0.00001) + 1):
if gcd(i, j) == 1:
res += 1
return res
if __name__ == "__main__":
print(compute()) | mit |
EasyOfficePhone/ember-oauth-example | app/models/sample.js | 214 | import DS from 'ember-data';
export default DS.Model.extend({
number: DS.attr('string'),
extension: DS.attr('string'),
name: DS.attr('string'),
status: DS.attr('string'),
sipuser: DS.attr('string'),
});
| mit |
ugate/releasebot | lib/rollcall.js | 5055 | 'use strict';
var Errors = require('./errors');
var rbot = require('../releasebot');
var regexFuncName = /(?!\W*function\s+)[\w\$]+(?=\()/;
var regexStack = /stack/i;
module.exports = RollCall;
/**
* Synchronous promise that provides a means to add a function to a waiting
* promise queue along with an optional rollback function that will be called in
* a queued or stack order whenever an {Error} is either thrown (stops further
* promise functions from firing) or when all promised functions have been
* called, but {Error}s have been logged
*
* @constructor
* @param options
* the task options
*/
function RollCall(options) {
var wrk = null, wrkq = [], wrkd = [], wrkrb = [], prom = this, wi = -1, endc = null;
var pausd = false, rbpausd = false, rbi = -1, rbcnt = 0, tm = null, es = new Errors(options);
this.then = function(fn, rb) {
wrk = new Work(fn, rb, Array.prototype.slice.call(arguments, 2));
wrkq.push(wrk);
return prom;
};
this.addRollbacks = function() {
if (arguments.length === 0) {
return;
}
// make sure the order of the passed rollback functions is maintained
// regardless of strategy
var args = isStack() ? Array.prototype.reverse.call(arguments) : arguments;
for (var i = 0; i < args.length; i++) {
prom.addRollback(args[i]);
}
};
this.addRollback = function(rb) {
if (typeof rb === 'function') {
addRollbackObj(new Rollback(rb));
}
};
this.work = function() {
return wrk;
};
this.start = function(end) {
endc = end || endc;
var stop = null;
pausd = false;
if (!prom.hasPromises()) {
return rollbacks();
}
for (wi++; wi < wrkq.length; wi++) {
wrk = wrkq[wi];
try {
wrk.run();
if (pausd) {
return;
}
} catch (e) {
stop = e;
prom.error(e);
} finally {
if (stop || (!pausd && !prom.hasPromises())) {
return rollbacks();
}
}
}
};
this.hasPromises = function(i) {
return (i || wi) < wrkq.length - 1;
};
this.pause = function(fn, rb) {
pausd = true;
var rtn = tko(rollbacks);
runNow(fn, rb, Array.prototype.slice.call(arguments, 2));
return rtn;
};
this.resume = function() {
tko();
if (!pausd) {
return 0;
}
return prom.start();
};
this.worked = function() {
return wrkd.slice(0);
};
this.error = function() {
es.log.apply(es, arguments);
return prom;
};
this.errorCount = function() {
return es.count();
};
this.pauseRollback = function(fn, rb) {
rbpausd = true;
var rtn = tko(prom.resumeRollback);
runNow(fn, rb, Array.prototype.slice.call(arguments, 2), true);
return rtn;
};
this.resumeRollback = function() {
tko();
if (!rbpausd) {
return 0;
}
return rollbacks();
};
this.hasRollbacks = function() {
return rbi < wrkrb.length - 1;
};
function rollbacks() {
rbpausd = false;
if (prom.errorCount() > 0) {
rbot.log.info('Processing ' + (wrkrb.length - rbcnt) + ' rollback action(s)');
for (rbi++; rbi < wrkrb.length; rbi++) {
rbot.log.verbose('Calling rollback ' + wrkrb[rbi].name);
try {
wrkrb[rbi].run();
rbcnt++;
if (rbpausd) {
rbot.log.verbose('Pausing after rollback ' + wrkrb[rbi].name);
return rbcnt;
}
} catch (e) {
prom.error(e);
}
}
}
return endc ? endc.call(prom, rbcnt) : rbcnt;
}
function runNow(fn, rb, args, isRb) {
if (typeof fn === 'function') {
var stop = null;
try {
if (isRb) {
// immediately ran rollback needs to be tracked
var rbo = addRollbackObj(new Rollback(fn));
rbi++;
rbcnt++;
rbo.run();
} else {
var wrk = new Work(fn, rb, args, isRb);
wrk.run();
}
} catch (e) {
stop = e;
prom.error(e);
} finally {
if (stop) {
// rollback for the rollback
if (isRb) {
runNow(rb, null, null, true);
} else {
rollbacks();
}
}
}
}
}
function Work(fn, rb, args) {
this.func = fn;
this.rb = rb ? new Rollback(rb, args) : null;
this.args = args;
this.rtn = undefined;
this.run = function() {
this.rtn = this.func.apply(prom, this.args);
wrkd.push(this);
prom.addRollback(this.rb);
return this.rtn;
};
}
function Rollback(rb) {
this.name = funcName(rb);
this.run = function() {
return typeof rb === 'function' ? rb.call(prom) : false;
};
}
function addRollbackObj(rbo) {
if (isStack()) {
wrkrb.unshift(rbo);
} else {
wrkrb.push(rbo);
}
return rbo;
}
function funcName(fn) {
var n = fn ? regexFuncName.exec(fn.toString()) : null;
return n && n[0] ? n[0] : '';
}
function tko(cb) {
if (tm) {
clearTimeout(tm);
}
if (typeof cb === 'function') {
var to = cb === rollbacks ? options.rollbackAsyncTimeout : options.asyncTimeout;
var rbm = cb === rollbacks ? ' rolling back changes' : ' for rollback';
tm = setTimeout(function() {
prom.error('Timeout of ' + to + 'ms reached' + rbm);
cb();
}, to);
}
return prom;
}
function isStack() {
return typeof options.rollbackStrategy === 'string' && regexStack.test(options.rollbackStrategy);
}
} | mit |
ZensuBean/woa-wiki | ReadMe.md | 803 | # WoA-Wiki
## About
`woa-wiki` is planned to be a node.js based wiki application. Currently it is under heavy development and not usable.
## Features
The following feature list is currently a major to-do list that gives an overview which features should be implemented.
Roadmap:
- [ ] Creating and modifying articles
- [ ] Creating and modifying categories
- [ ] Creating and modifying users
- [ ] Connecting articles and categories
- [ ] Create nested categories
- [ ]
## Installation
1. Clone the repository
```
git clone https://github.com/ZensuBean/woa-wiki.git && cd woa-wiki
```
2. Install npm dependencies
```
npm install
```
3. Start the application
```
npm start
```
## Configuration
## Contribution
## References
## License
See the included [license file](LICENSE) | mit |
samwhelp/fix-ubuntu-1404 | main/app/unsettings/bin/configure.sh | 154 | #!/usr/bin/env bash
THE_BASE_DIR_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
source $THE_BASE_DIR_PATH/_init.sh
echo 'configure unsettings start:'
| mit |
hongmi/cpp-primer-4-exercises | chapter-09/9.32.md | 26 | 容量是1024 + 512 = 1536 | mit |
rockResolve/dialog | dist/system/renderers/renderer.js | 1041 | 'use strict';
System.register([], function (_export, _context) {
var Renderer;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
return {
setters: [],
execute: function () {
_export('Renderer', Renderer = function () {
function Renderer() {
_classCallCheck(this, Renderer);
}
Renderer.prototype.getDialogContainer = function getDialogContainer() {
throw new Error('DialogRenderer must implement getDialogContainer().');
};
Renderer.prototype.showDialog = function showDialog(dialogController) {
throw new Error('DialogRenderer must implement showDialog().');
};
Renderer.prototype.hideDialog = function hideDialog(dialogController) {
throw new Error('DialogRenderer must implement hideDialog().');
};
return Renderer;
}());
_export('Renderer', Renderer);
}
};
}); | mit |
troestergmbh/ta4j | ta4j/src/main/java/eu/verdelhan/ta4j/TradingRecord.java | 9570 | /**
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 Marc de Verdelhan & respective authors (see AUTHORS)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package eu.verdelhan.ta4j;
import eu.verdelhan.ta4j.Order.OrderType;
import java.util.ArrayList;
import java.util.List;
/**
* A history/record of a trading session.
* <p>
* Holds the full trading record when running a {@link Strategy strategy}.
* It is used to:
* <ul>
* <li>check to satisfaction of some trading rules (when running a strategy)
* <li>analyze the performance of a trading strategy
* </ul>
*/
public class TradingRecord {
/** The recorded orders */
private List<Order> orders = new ArrayList<Order>();
/** The recorded BUY orders */
private List<Order> buyOrders = new ArrayList<Order>();
/** The recorded SELL orders */
private List<Order> sellOrders = new ArrayList<Order>();
/** The recorded entry orders */
private List<Order> entryOrders = new ArrayList<Order>();
/** The recorded exit orders */
private List<Order> exitOrders = new ArrayList<Order>();
/** The recorded trades */
private List<Trade> trades = new ArrayList<Trade>();
/** The entry type (BUY or SELL) in the trading session */
private OrderType startingType;
/** The current non-closed trade (there's always one) */
private Trade currentTrade;
/**
* Constructor.
*/
public TradingRecord() {
this(OrderType.BUY);
}
/**
* Constructor.
* @param entryOrderType the {@link OrderType order type} of entries in the trading session
*/
public TradingRecord(OrderType entryOrderType) {
if (entryOrderType == null) {
throw new IllegalArgumentException("Starting type must not be null");
}
this.startingType = entryOrderType;
currentTrade = new Trade(entryOrderType);
}
/**
* Constructor.
* @param orders the orders to be recorded (cannot be empty)
*/
public TradingRecord(Order... orders) {
this(orders[0].getType());
for (Order o : orders) {
boolean newOrderWillBeAnEntry = currentTrade.isNew();
if (newOrderWillBeAnEntry && o.getType() != startingType) {
// Special case for entry/exit types reversal
// E.g.: BUY, SELL,
// BUY, SELL,
// SELL, BUY,
// BUY, SELL
currentTrade = new Trade(o.getType());
}
Order newOrder = currentTrade.operate(o.getIndex(), o.getPrice(), o.getAmount());
recordOrder(newOrder, newOrderWillBeAnEntry);
}
}
/**
* @return the current trade
*/
public Trade getCurrentTrade() {
return currentTrade;
}
/**
* Operates an order in the trading record.
* @param index the index to operate the order
*/
public final void operate(int index) {
operate(index, Decimal.NaN, Decimal.NaN);
}
/**
* Operates an order in the trading record.
* @param index the index to operate the order
* @param price the price of the order
* @param amount the amount to be ordered
*/
public final void operate(int index, Decimal price, Decimal amount) {
if (currentTrade.isClosed()) {
// Current trade closed, should not occur
throw new IllegalStateException("Current trade should not be closed");
}
boolean newOrderWillBeAnEntry = currentTrade.isNew();
Order newOrder = currentTrade.operate(index, price, amount);
recordOrder(newOrder, newOrderWillBeAnEntry);
}
/**
* Operates an entry order in the trading record.
* @param index the index to operate the entry
* @return true if the entry has been operated, false otherwise
*/
public final boolean enter(int index) {
return enter(index, Decimal.NaN, Decimal.NaN);
}
/**
* Operates an entry order in the trading record.
* @param index the index to operate the entry
* @param price the price of the order
* @param amount the amount to be ordered
* @return true if the entry has been operated, false otherwise
*/
public final boolean enter(int index, Decimal price, Decimal amount) {
if (currentTrade.isNew()) {
operate(index, price, amount);
return true;
}
return false;
}
/**
* Operates an exit order in the trading record.
* @param index the index to operate the exit
* @return true if the exit has been operated, false otherwise
*/
public final boolean exit(int index) {
return exit(index, Decimal.NaN, Decimal.NaN);
}
/**
* Operates an exit order in the trading record.
* @param index the index to operate the exit
* @param price the price of the order
* @param amount the amount to be ordered
* @return true if the exit has been operated, false otherwise
*/
public final boolean exit(int index, Decimal price, Decimal amount) {
if (currentTrade.isOpened()) {
operate(index, price, amount);
return true;
}
return false;
}
/**
* @return true if no trade is open, false otherwise
*/
public boolean isClosed() {
return !currentTrade.isOpened();
}
/**
* @return the recorded trades
*/
public List<Trade> getTrades() {
return trades;
}
/**
* @return the number of recorded trades
*/
public int getTradeCount() {
return trades.size();
}
/**
* @return the last trade recorded
*/
public Trade getLastTrade() {
if (!trades.isEmpty()) {
return trades.get(trades.size() - 1);
}
return null;
}
/**
* @return the last order recorded
*/
public Order getLastOrder() {
if (!orders.isEmpty()) {
return orders.get(orders.size() - 1);
}
return null;
}
/**
* @param orderType the type of the order to get the last of
* @return the last order (of the provided type) recorded
*/
public Order getLastOrder(OrderType orderType) {
if (OrderType.BUY.equals(orderType) && !buyOrders.isEmpty()) {
return buyOrders.get(buyOrders.size() - 1);
} else if (OrderType.SELL.equals(orderType) && !sellOrders.isEmpty()) {
return sellOrders.get(sellOrders.size() - 1);
}
return null;
}
/**
* @return the last entry order recorded
*/
public Order getLastEntry() {
if (!entryOrders.isEmpty()) {
return entryOrders.get(entryOrders.size() - 1);
}
return null;
}
/**
* @return the last exit order recorded
*/
public Order getLastExit() {
if (!exitOrders.isEmpty()) {
return exitOrders.get(exitOrders.size() - 1);
}
return null;
}
/**
* Records an order and the corresponding trade (if closed).
* @param order the order to be recorded
* @param isEntry true if the order is an entry, false otherwise (exit)
*/
private void recordOrder(Order order, boolean isEntry) {
if (order == null) {
throw new IllegalArgumentException("Order should not be null");
}
// Storing the new order in entries/exits lists
if (isEntry) {
entryOrders.add(order);
} else {
exitOrders.add(order);
}
// Storing the new order in orders list
orders.add(order);
if (OrderType.BUY.equals(order.getType())) {
// Storing the new order in buy orders list
buyOrders.add(order);
} else if (OrderType.SELL.equals(order.getType())) {
// Storing the new order in sell orders list
sellOrders.add(order);
}
// Storing the trade if closed
if (currentTrade.isClosed()) {
trades.add(currentTrade);
currentTrade = new Trade(startingType);
}
}
}
| mit |
SimplyLusum/Stacks | js/main.js | 584 | // Smooth Scroll
$(document).ready(function() {
$('.nav a').smoothScroll({offset: -73});
});
// Scrollspy offset
$('[data-spy="scroll"]').scrollspy({ offset: 100 });
// Tooltip
jQuery(document).ready(function () {
$("[rel=tooltip]").tooltip();
});
// Popover
jQuery(document).ready(function () {
$("[rel=popover]").popover();
});
// Carousel Auto
jQuery(document).ready(function() {
$('#myCarousel-auto').carousel({
interval: 5000,
cycle: true
});
});
var $ = jQuery.noConflict();
| mit |
rishii7/vscode | src/vs/workbench/browser/parts/editor/editorDropTarget.ts | 18500 | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/css!./media/editordroptarget';
import { LocalSelectionTransfer, DraggedEditorIdentifier, ResourcesDropHandler, DraggedEditorGroupIdentifier, DragAndDropObserver } from 'vs/workbench/browser/dnd';
import { addDisposableListener, EventType, EventHelper, isAncestor, toggleClass, addClass, removeClass } from 'vs/base/browser/dom';
import { IEditorGroupsAccessor, EDITOR_TITLE_HEIGHT, IEditorGroupView, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor';
import { EDITOR_DRAG_AND_DROP_BACKGROUND, Themable } from 'vs/workbench/common/theme';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { activeContrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { IEditorIdentifier, EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { isMacintosh } from 'vs/base/common/platform';
import { GroupDirection, MergeGroupMode } from 'vs/workbench/services/group/common/editorGroupsService';
import { toDisposable } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
interface IDropOperation {
splitDirection?: GroupDirection;
}
class DropOverlay extends Themable {
private static OVERLAY_ID = 'monaco-workbench-editor-drop-overlay';
private container: HTMLElement;
private overlay: HTMLElement;
private currentDropOperation: IDropOperation;
private _disposed: boolean;
private readonly editorTransfer = LocalSelectionTransfer.getInstance<DraggedEditorIdentifier>();
private readonly groupTransfer = LocalSelectionTransfer.getInstance<DraggedEditorGroupIdentifier>();
constructor(
private accessor: IEditorGroupsAccessor,
private groupView: IEditorGroupView,
themeService: IThemeService,
private instantiationService: IInstantiationService
) {
super(themeService);
this.create();
}
get disposed(): boolean {
return this._disposed;
}
private create(): void {
const overlayOffsetHeight = this.getOverlayOffsetHeight();
// Container
this.container = document.createElement('div');
this.container.id = DropOverlay.OVERLAY_ID;
this.container.style.top = `${overlayOffsetHeight}px`;
// Parent
this.groupView.element.appendChild(this.container);
addClass(this.groupView.element, 'dragged-over');
this._register(toDisposable(() => {
this.groupView.element.removeChild(this.container);
removeClass(this.groupView.element, 'dragged-over');
}));
// Overlay
this.overlay = document.createElement('div');
addClass(this.overlay, 'editor-group-overlay-indicator');
this.container.appendChild(this.overlay);
// Overlay Event Handling
this.registerListeners();
// Styles
this.updateStyles();
}
protected updateStyles(): void {
// Overlay drop background
this.overlay.style.backgroundColor = this.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND);
// Overlay contrast border (if any)
const activeContrastBorderColor = this.getColor(activeContrastBorder);
this.overlay.style.outlineColor = activeContrastBorderColor;
this.overlay.style.outlineOffset = activeContrastBorderColor ? '-2px' : null;
this.overlay.style.outlineStyle = activeContrastBorderColor ? 'dashed' : null;
this.overlay.style.outlineWidth = activeContrastBorderColor ? '2px' : null;
}
private registerListeners(): void {
this._register(new DragAndDropObserver(this.container, {
onDragEnter: e => void 0,
onDragOver: e => {
const isDraggingGroup = this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype);
const isDraggingEditor = this.editorTransfer.hasData(DraggedEditorIdentifier.prototype);
// Update the dropEffect to "copy" if there is no local data to be dragged because
// in that case we can only copy the data into and not move it from its source
if (!isDraggingEditor && !isDraggingGroup) {
e.dataTransfer.dropEffect = 'copy';
}
// Find out if operation is valid
const isCopy = isDraggingGroup ? this.isCopyOperation(e) : isDraggingEditor ? this.isCopyOperation(e, this.editorTransfer.getData(DraggedEditorIdentifier.prototype)[0].identifier) : true;
if (!isCopy) {
const sourceGroupView = this.findSourceGroupView();
if (sourceGroupView === this.groupView) {
if (isDraggingGroup || (isDraggingEditor && sourceGroupView.count < 2)) {
this.hideOverlay();
return; // do not allow to drop group/editor on itself if this results in an empty group
}
}
}
// Position overlay
this.positionOverlay(e.offsetX, e.offsetY, isDraggingGroup);
},
onDragLeave: e => this.dispose(),
onDragEnd: e => this.dispose(),
onDrop: e => {
EventHelper.stop(e, true);
// Dispose overlay
this.dispose();
// Handle drop if we have a valid operation
if (this.currentDropOperation) {
this.handleDrop(e, this.currentDropOperation.splitDirection);
}
}
}));
this._register(addDisposableListener(this.container, EventType.MOUSE_OVER, () => {
// Under some circumstances we have seen reports where the drop overlay is not being
// cleaned up and as such the editor area remains under the overlay so that you cannot
// type into the editor anymore. This seems related to using VMs and DND via host and
// guest OS, though some users also saw it without VMs.
// To protect against this issue we always destroy the overlay as soon as we detect a
// mouse event over it. The delay is used to guarantee we are not interfering with the
// actual DROP event that can also trigger a mouse over event.
setTimeout(() => {
this.dispose();
}, 300);
}));
}
private findSourceGroupView(): IEditorGroupView {
// Check for group transfer
if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
return this.accessor.getGroup(this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype)[0].identifier);
}
// Check for editor transfer
else if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
return this.accessor.getGroup(this.editorTransfer.getData(DraggedEditorIdentifier.prototype)[0].identifier.groupId);
}
return void 0;
}
private handleDrop(event: DragEvent, splitDirection?: GroupDirection): void {
// Determine target group
const ensureTargetGroup = () => {
let targetGroup: IEditorGroupView;
if (typeof splitDirection === 'number') {
targetGroup = this.accessor.addGroup(this.groupView, splitDirection);
} else {
targetGroup = this.groupView;
}
return targetGroup;
};
// Check for group transfer
if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
const draggedEditorGroup = this.groupTransfer.getData(DraggedEditorGroupIdentifier.prototype)[0].identifier;
// Return if the drop is a no-op
const sourceGroup = this.accessor.getGroup(draggedEditorGroup);
if (typeof splitDirection !== 'number' && sourceGroup === this.groupView) {
return;
}
// Split to new group
let targetGroup: IEditorGroupView;
if (typeof splitDirection === 'number') {
if (this.isCopyOperation(event)) {
targetGroup = this.accessor.copyGroup(sourceGroup, this.groupView, splitDirection);
} else {
targetGroup = this.accessor.moveGroup(sourceGroup, this.groupView, splitDirection);
}
}
// Merge into existing group
else {
if (this.isCopyOperation(event)) {
targetGroup = this.accessor.mergeGroup(sourceGroup, this.groupView, { mode: MergeGroupMode.COPY_EDITORS });
} else {
targetGroup = this.accessor.mergeGroup(sourceGroup, this.groupView);
}
}
this.accessor.activateGroup(targetGroup);
this.groupTransfer.clearData(DraggedEditorGroupIdentifier.prototype);
}
// Check for editor transfer
else if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
const draggedEditor = this.editorTransfer.getData(DraggedEditorIdentifier.prototype)[0].identifier;
const targetGroup = ensureTargetGroup();
// Return if the drop is a no-op
const sourceGroup = this.accessor.getGroup(draggedEditor.groupId);
if (sourceGroup === targetGroup) {
return;
}
// Open in target group
const options = getActiveTextEditorOptions(sourceGroup, draggedEditor.editor, EditorOptions.create({ pinned: true }));
targetGroup.openEditor(draggedEditor.editor, options);
// Ensure target has focus
targetGroup.focus();
// Close in source group unless we copy
const copyEditor = this.isCopyOperation(event, draggedEditor);
if (!copyEditor) {
sourceGroup.closeEditor(draggedEditor.editor);
}
this.editorTransfer.clearData(DraggedEditorIdentifier.prototype);
}
// Check for URI transfer
else {
const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: true /* open workspace instead of file if dropped */ });
dropHandler.handleDrop(event, () => ensureTargetGroup(), targetGroup => targetGroup.focus());
}
}
private isCopyOperation(e: DragEvent, draggedEditor?: IEditorIdentifier): boolean {
if (draggedEditor && !(draggedEditor.editor as EditorInput).supportsSplitEditor()) {
return false;
}
return (e.ctrlKey && !isMacintosh) || (e.altKey && isMacintosh);
}
private positionOverlay(mousePosX: number, mousePosY: number, isDraggingGroup: boolean): void {
const preferSplitVertically = this.accessor.partOptions.openSideBySideDirection === 'right';
const editorControlWidth = this.groupView.element.clientWidth;
const editorControlHeight = this.groupView.element.clientHeight - this.getOverlayOffsetHeight();
let edgeWidthThresholdFactor: number;
if (isDraggingGroup) {
edgeWidthThresholdFactor = preferSplitVertically ? 0.3 : 0.1; // give larger threshold when dragging group depending on preferred split direction
} else {
edgeWidthThresholdFactor = 0.1; // 10% threshold to split if dragging editors
}
let edgeHeightThresholdFactor: number;
if (isDraggingGroup) {
edgeHeightThresholdFactor = preferSplitVertically ? 0.1 : 0.3; // give larger threshold when dragging group depending on preferred split direction
} else {
edgeHeightThresholdFactor = 0.1; // 10% threshold to split if dragging editors
}
const edgeWidthThreshold = editorControlWidth * edgeWidthThresholdFactor;
const edgeHeightThreshold = editorControlHeight * edgeHeightThresholdFactor;
const splitWidthThreshold = editorControlWidth / 3; // offer to split left/right at 33%
const splitHeightThreshold = editorControlHeight / 3; // offer to split up/down at 33%
// Enable to debug the drop threshold square
// let child = this.overlay.children.item(0) as HTMLElement || this.overlay.appendChild(document.createElement('div'));
// child.style.backgroundColor = 'red';
// child.style.position = 'absolute';
// child.style.width = (groupViewWidth - (2 * edgeWidthThreshold)) + 'px';
// child.style.height = (groupViewHeight - (2 * edgeHeightThreshold)) + 'px';
// child.style.left = edgeWidthThreshold + 'px';
// child.style.top = edgeHeightThreshold + 'px';
// No split if mouse is above certain threshold in the center of the view
let splitDirection: GroupDirection;
if (
mousePosX > edgeWidthThreshold && mousePosX < editorControlWidth - edgeWidthThreshold &&
mousePosY > edgeHeightThreshold && mousePosY < editorControlHeight - edgeHeightThreshold
) {
splitDirection = void 0;
}
// Offer to split otherwise
else {
// User prefers to split vertically: offer a larger hitzone
// for this direction like so:
// ----------------------------------------------
// | | SPLIT UP | |
// | SPLIT |-----------------------| SPLIT |
// | | MERGE | |
// | LEFT |-----------------------| RIGHT |
// | | SPLIT DOWN | |
// ----------------------------------------------
if (preferSplitVertically) {
if (mousePosX < splitWidthThreshold) {
splitDirection = GroupDirection.LEFT;
} else if (mousePosX > splitWidthThreshold * 2) {
splitDirection = GroupDirection.RIGHT;
} else if (mousePosY < editorControlHeight / 2) {
splitDirection = GroupDirection.UP;
} else {
splitDirection = GroupDirection.DOWN;
}
}
// User prefers to split horizontally: offer a larger hitzone
// for this direction like so:
// ----------------------------------------------
// | SPLIT UP |
// |--------------------------------------------|
// | SPLIT LEFT | MERGE | SPLIT RIGHT |
// |--------------------------------------------|
// | SPLIT DOWN |
// ----------------------------------------------
else {
if (mousePosY < splitHeightThreshold) {
splitDirection = GroupDirection.UP;
} else if (mousePosY > splitHeightThreshold * 2) {
splitDirection = GroupDirection.DOWN;
} else if (mousePosX < editorControlWidth / 2) {
splitDirection = GroupDirection.LEFT;
} else {
splitDirection = GroupDirection.RIGHT;
}
}
}
// Draw overlay based on split direction
switch (splitDirection) {
case GroupDirection.UP:
this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '50%' });
break;
case GroupDirection.DOWN:
this.doPositionOverlay({ top: '50%', left: '0', width: '100%', height: '50%' });
break;
case GroupDirection.LEFT:
this.doPositionOverlay({ top: '0', left: '0', width: '50%', height: '100%' });
break;
case GroupDirection.RIGHT:
this.doPositionOverlay({ top: '0', left: '50%', width: '50%', height: '100%' });
break;
default:
this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '100%' });
}
// Make sure the overlay is visible now
this.overlay.style.opacity = '1';
// Enable transition after a timeout to prevent initial animation
setTimeout(() => addClass(this.overlay, 'overlay-move-transition'), 0);
// Remember as current split direction
this.currentDropOperation = { splitDirection };
}
private doPositionOverlay(options: { top: string, left: string, width: string, height: string }): void {
// Container
const offsetHeight = this.getOverlayOffsetHeight();
if (offsetHeight) {
this.container.style.height = `calc(100% - ${offsetHeight}px)`;
} else {
this.container.style.height = '100%';
}
// Overlay
this.overlay.style.top = options.top;
this.overlay.style.left = options.left;
this.overlay.style.width = options.width;
this.overlay.style.height = options.height;
}
private getOverlayOffsetHeight(): number {
if (!this.groupView.isEmpty() && this.accessor.partOptions.showTabs) {
return EDITOR_TITLE_HEIGHT; // show overlay below title if group shows tabs
}
return 0;
}
private hideOverlay(): void {
// Reset overlay
this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '100%' });
this.overlay.style.opacity = '0';
removeClass(this.overlay, 'overlay-move-transition');
// Reset current operation
this.currentDropOperation = void 0;
}
contains(element: HTMLElement): boolean {
return element === this.container || element === this.overlay;
}
dispose(): void {
super.dispose();
this._disposed = true;
}
}
export class EditorDropTarget extends Themable {
private _overlay: DropOverlay;
private counter = 0;
private readonly editorTransfer = LocalSelectionTransfer.getInstance<DraggedEditorIdentifier>();
private readonly groupTransfer = LocalSelectionTransfer.getInstance<DraggedEditorGroupIdentifier>();
constructor(
private accessor: IEditorGroupsAccessor,
private container: HTMLElement,
@IThemeService themeService: IThemeService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(themeService);
this.registerListeners();
}
private get overlay(): DropOverlay {
if (this._overlay && !this._overlay.disposed) {
return this._overlay;
}
return void 0;
}
private registerListeners(): void {
this._register(addDisposableListener(this.container, EventType.DRAG_ENTER, e => this.onDragEnter(e)));
this._register(addDisposableListener(this.container, EventType.DRAG_LEAVE, () => this.onDragLeave()));
[this.container, window].forEach(node => this._register(addDisposableListener(node as HTMLElement, EventType.DRAG_END, () => this.onDragEnd())));
}
private onDragEnter(event: DragEvent): void {
this.counter++;
// Validate transfer
if (
!this.editorTransfer.hasData(DraggedEditorIdentifier.prototype) &&
!this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype) &&
!event.dataTransfer.types.length // see https://github.com/Microsoft/vscode/issues/25789
) {
event.dataTransfer.dropEffect = 'none';
return; // unsupported transfer
}
// Signal DND start
this.updateContainer(true);
const target = event.target as HTMLElement;
if (target) {
// Somehow we managed to move the mouse quickly out of the current overlay, so destroy it
if (this.overlay && !this.overlay.contains(target)) {
this.disposeOverlay();
}
// Create overlay over target
if (!this.overlay) {
const targetGroupView = this.findTargetGroupView(target);
if (targetGroupView) {
this._overlay = new DropOverlay(this.accessor, targetGroupView, this.themeService, this.instantiationService);
}
}
}
}
private onDragLeave(): void {
this.counter--;
if (this.counter === 0) {
this.updateContainer(false);
}
}
private onDragEnd(): void {
this.counter = 0;
this.updateContainer(false);
this.disposeOverlay();
}
private findTargetGroupView(child: HTMLElement): IEditorGroupView {
const groups = this.accessor.groups;
for (let i = 0; i < groups.length; i++) {
const groupView = groups[i];
if (isAncestor(child, groupView.element)) {
return groupView;
}
}
return void 0;
}
private updateContainer(isDraggedOver: boolean): void {
toggleClass(this.container, 'dragged-over', isDraggedOver);
}
dispose(): void {
super.dispose();
this.disposeOverlay();
}
private disposeOverlay(): void {
if (this.overlay) {
this.overlay.dispose();
this._overlay = void 0;
}
}
}
| mit |
BaiduHiDeviOS/iOS-Tech-Weekly | 往期周报/20160228.md | 1604 |
## 20160228技术周报
感谢本期周报线索提供同学: 高兴民,桉远
周报汇总 [地址](https://github.com/BaiduHiDeviOS/iOS-Tech-Weekly)
周报博客 [地址](http://baiduhidevios.github.io/)
### 开源代码:
[FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) is a performant animated GIF engine for iOS:
* Plays multiple GIFs simultaneously with a playback speed comparable to desktop browsers
* Honors variable frame delays
* Behaves gracefully under memory pressure
* Eliminates delays or blocking during the first playback loop
* Interprets the frame delays of fast GIFs the same way modern browsers do
### Swift
[Swift 烧脑体操(一) - Optional 的嵌套](http://www.infoq.com/cn/articles/swift-brain-gym-optional)
[Swift 烧脑体操(二) - 函数的参数](http://blog.devtang.com/2016/02/27/swift-gym-2-function-argument/)
[Swift 烧脑体操(三) - 高阶函数](http://blog.devtang.com/2016/02/27/swift-gym-3-higher-order-function/)
### 文章:
[深入浅出-iOS函数式编程的实现 && 响应式编程概念](http://www.jianshu.com/p/7017a220f34c) 本篇主要回顾一下--iOS函数式编程 && 响应式编程概念 ,如何一步步实现函数式编程的过程,对阅读Masonry && SnapKit源码有一定的帮助
[Apple Pay 编程指南](http://wiki.jikexueyuan.com/project/apple-pay/) Apple Pay介绍,配置和接入等
函数式相关的几篇文章:
[What the heck is a monad](http://khanlou.com/2015/09/what-the-heck-is-a-monad/)
[flatmap](http://robnapier.net/flatmap)
[map](http://robnapier.net/maps)
| mit |
gonzoKhan/ics421-DDL_Processing | connectionThread.py | 3900 | import threading
import mysql.connector
import re
# Allows multithreading when creating a connection to database and executing a ddl.
class connectionThread (threading.Thread):
def __init__(self, threadID, config, ddl, nodeinfo, catalog_info):
threading.Thread.__init__(self)
self.threadID = threadID
self.config = config
self.ddl = ddl
self.nodeinfo = nodeinfo
self.catalog_info = catalog_info
# Updates dtables in the catalog that keeps track of tables being added or removed.
def __updateCatalog(self):
dtables = (
"CREATE TABLE "
"DTABLES(tname char(32), "
"nodedriver char(64), "
"nodeurl char(128), "
"nodeuser char(16), "
"nodepasswd char(16), "
"partmtd int, "
"nodeid int, "
"partcol char(32), "
"partparam1 char(32), "
"partparam2 char(32));"
)
try:
connection = mysql.connector.connect(
user = self.catalog_info['username'],
password = self.catalog_info['password'],
host = self.catalog_info['hostname'],
database = self.catalog_info['database'],
port = self.catalog_info['port']
)
cursor = connection.cursor()
# Attempt to create table in case it doesn't exist.
try:
cursor.execute(dtables)
except:
pass
# Grab the table name from the ddl
tname = re.search("table (\w+)", self.ddl, flags=re.IGNORECASE | re.MULTILINE).group(1)
nodedriver = self.nodeinfo['driver']
nodeurl = self.nodeinfo['hostname']
nodeuser = self.config['user']
nodepasswd = self.config['password']
nodeid = self.threadID
# Query for when a table was created.
crt_table = (
"INSERT INTO DTABLES"
"(tname, nodedriver, nodeurl, nodeuser, nodepasswd, "
"partmtd, nodeid, partcol, partparam1, partparam2) "
"VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', NULL, '{5}', NULL, NULL, NULL);"
)
# Query for when a table was removed.
drop_table = "DELETE FROM DTABLES WHERE tname='{0}';"
# Execute if a table was created
if re.search("CREATE TABLE", self.ddl, flags=re.IGNORECASE | re.MULTILINE):
cursor.execute(crt_table.format(tname, nodedriver, nodeurl, nodeuser, nodepasswd, nodeid))
print("RECORD: ADDED TABLE {0} TO NODE{1}".format(tname, nodeid))
# Else execute this is table was dropped.
elif re.search("DROP TABLE", self.ddl, flags=re.IGNORECASE | re.MULTILINE):
cursor.execute(drop_table.format(tname))
print("RECORD: REMOVED TABLE {0} FROM NODE{1}".format(tname, nodeid))
except mysql.connector.Error as err:
print(err)
exit(1)
except Error as err:
print("ERROR UPDATING DTABLES:")
print(str(err))
finally:
cursor.close()
connection.commit()
connection.close()
def run(self):
try:
connection = mysql.connector.connect(**self.config)
cursor = connection.cursor()
cursor.execute(self.ddl)
cursor.close()
connection.close()
self.__updateCatalog()
print("SUCCESS: THREAD{0} (database={1},hostname={2}): Sucessfully executed DDL".format(self.threadID, self.config['database'], self.config['host']))
except mysql.connector.Error as err:
print("FAILURE: THREAD{0} (database={1},hostname={2}): ".format(self.threadID, self.config['database'], self.config['host']) + err.msg)
| mit |
mpopv/mpopv.github.io | js/home-script.js | 3110 | $(document).ready(function(){
//-------------------- Touchscreen fix ---------------------------------------
$('body').bind('touchstart', function() {}); // Makes touchscreens respond like a hover state when clicked
//-------------------- GIF Background ---------------------------------------
// Randomly queries Giphy for GIFs based on input terms.
// Query: Term to search Giphy for. Limit: # of results to return in JSON.
var terms = [
// { query: 'abstract+glitch', limit: '20' },
// { query: 'vaporwave', limit: '20' },
// { query: 'retro+glitch', limit: '20' },
// { query: 'retrofuturistic', limit: '20' },
// { query: 'lasers+sci+fi', limit: '20' },
{ query: 'star+wars+retro', limit: '20' }
];
var term = terms[Math.floor(Math.random() * terms.length)];
var xhr = $.get("http://api.giphy.com/v1/gifs/search?q=" + term.query + "&api_key=dc6zaTOxFJmzC&limit=" + term.limit );
var random = {};
var hoverState = false;
setInterval(function(){ imgChanger(); }, 500);
xhr.done(function(data) {
var giphyData = data;
localStorage.setItem(
'giphyDataRaw',
JSON.stringify(data)
);
preloadGifs(localStorage.getItem('giphyDataRaw'));
});
function preloadGifs(giphyDataRetrieved) {
var gifIndex = 0;
var data = JSON.parse(giphyDataRetrieved);
$.each(data.data, function(gif){
new Image().src = 'https://media.giphy.com/media/' + gif.id + '/giphy.gif';
});
}
function swapGif(gifId) {
$('.hello-new-style').empty();
$('.hello-new-style').html('<style>.bg:before{ background-image: url(https://media.giphy.com/media/' + gifId + '/giphy.gif);}</style>');
}
function imgChanger() {
var random = Math.ceil(Math.random() * (term.limit - 1));
var giphyDataRetrieved = localStorage.getItem('giphyDataRaw');
var data = JSON.parse(giphyDataRetrieved);
swapGif(data.data[random].id);
}
//-------------- Hover link text highlight and text swap ---------------------
$('.matt').hover(function(){
text = $(this).text();
$(this).text("pens");
}, function () { $(this).text(text); });
$('.popo').hover(function(){
text = $(this).text();
$(this).text("lkdn");
}, function () { $(this).text(text); });
$('.vich').hover(function(){
text = $(this).text();
$(this).text("twtr");
}, function () { $(this).text(text); });
// --- Parallax
var flw = $(".logo");
var h1 = $("h1");
$(document).on("mousemove",function(e) {
var ax = -($(window).innerWidth()/2- e.pageX)/20;
var ay = ($(window).innerHeight()/2- e.pageY)/10;
var clr = (($(window).innerHeight()-e.pageY)+50);
if (clr<220){clr=220;}
var fullClr = "rgba("+clr+","+clr+","+clr+",1)";
flw.attr("style", "transform: rotateY("+ax+"deg) rotateX("+ay+"deg);border:1em solid "+fullClr+";box-shadow:"+ax+" "+ay+" 10px 10px rgba(0,0,0,0.9);");
h1.attr("style","color:"+fullClr+";transform: translate("+(1.75*ax)+"px, "+(-1.75*ay)+"px);text-shadow: "+(-0.25*ax)+"px "+(0.25*ay)+"px 20px rgba(0,0,0,0.3);");
}).trigger("mousemove");
});
| mit |
thunderwolf/twSubscriptionPlugin | modules/twSubscriptionEmail/lib/twSubscriptionEmailGeneratorConfiguration.class.php | 648 | <?php
/**
* twSubscriptionEmail module configuration.
*
* @package subscription
* @subpackage twSubscriptionEmail
* @author Your name here
* @version SVN: $Id: twSubscriptionEmailGeneratorConfiguration.class.php 504 2011-03-16 23:26:14Z ldath $
*/
class twSubscriptionEmailGeneratorConfiguration extends BaseTwSubscriptionEmailGeneratorConfiguration
{
protected $user = null;
public function setUser($user)
{
$this->user = $user;
}
public function getUser()
{
return $this->user;
}
public function getFormOptions()
{
return array('user' => $this->getUser());
}
}
| mit |
octanebaby/octanebaby.github.io | _posts/2013-02-23-hamentashen.md | 304 | ---
layout: post
title: Hamentashen
category: nom
image: /assets/hamentashen.png
---

<br>
<sub>Purim 2013. <a href="http://www.foodnetwork.com/search/hamantaschen/results.do?fnSearchType=recipe.htm" target="_blank">Duff Goldman's</a> recipe.</sub>
| mit |
appleseedez/rongmeme-android | rmm/src/org/dragon/core/utils/string/StringUtils.java | 11312 | /*
* 版权:Copyright 2010-2015 dragon Tech. Co. Ltd. All Rights Reserved.
* 修改人:邓杰
* 修改时间:2013-2-25
* 修改内容:
*/
package org.dragon.core.utils.string;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import org.dragon.core.utils.bean.ObjectUtils;
/**
* 字符串工具类,用于实现一些字符串的常用操作
* <ul>
* <li>继承自{@link org.apache.commons.lang3.StringUtils}</li>
* </ul>
*
* @author dengjie
*/
public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* 比较两个String
*
* @param actual
* @param expected
* @return <ul>
* <li>若两个字符串都为null,则返回true</li>
* <li>若两个字符串都不为null,且相等,则返回true</li>
* <li>否则返回false</li>
* </ul>
*/
public static boolean isEquals(String actual, String expected) {
return ObjectUtils.isEquals(actual, expected);
}
/**
* null字符串转换为长度为0的字符串
*
* @param str
* 待转换字符串
* @return
* @see <pre>
* nullStrToEmpty(null) = "";
* nullStrToEmpty("") = "";
* nullStrToEmpty("aa") = "aa";
* </pre>
*/
public static String nullStrToEmpty(String str) {
return (str == null ? "" : str);
}
/**
* 将字符串首字母大写后返回
*
* @param str
* 原字符串
* @return 首字母大写后的字符串
*
* <pre>
* capitalizeFirstLetter(null) = null;
* capitalizeFirstLetter("") = "";
* capitalizeFirstLetter("2ab") = "2ab"
* capitalizeFirstLetter("a") = "A"
* capitalizeFirstLetter("ab") = "Ab"
* capitalizeFirstLetter("Abc") = "Abc"
* </pre>
*/
public static String capitalizeFirstLetter(String str) {
if (isEmpty(str)) {
return str;
}
char c = str.charAt(0);
return (!Character.isLetter(c) || Character.isUpperCase(c)) ? str : new StringBuilder(str.length()).append(Character.toUpperCase(c))
.append(str.substring(1)).toString();
}
/**
* 如果不是普通字符,则按照utf8进行编码
*
* <pre>
* utf8Encode(null) = null
* utf8Encode("") = "";
* utf8Encode("aa") = "aa";
* utf8Encode("啊啊啊啊") = "%E5%95%8A%E5%95%8A%E5%95%8A%E5%95%8A";
* </pre>
*
* @param str
* 原字符
* @return 编码后字符,若编码异常抛出异常
*/
public static String utf8Encode(String str) {
if (!isEmpty(str) && str.getBytes().length != str.length()) {
try {
return URLEncoder.encode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UnsupportedEncodingException occurred. ", e);
}
}
return str;
}
/**
* 如果不是普通字符,则按照utf8进行编码,编码异常则返回defultReturn
*
* @param str
* 源字符串
* @param defultReturn
* 出现异常默认返回
* @return
*/
public static String utf8Encode(String str, String defultReturn) {
if (!isEmpty(str) && str.getBytes().length != str.length()) {
try {
return URLEncoder.encode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
return defultReturn;
}
}
return str;
}
/**
* 得到href链接的innerHtml
*
* @param href
* href内容
* @return href的innerHtml
* <ul>
* <li>空字符串返回""</li>
* <li>若字符串不为空,且不符合链接正则的返回原内容</li>
* <li>若字符串不为空,且符合链接正则的返回最后一个innerHtml</li>
* </ul>
* @see <pre>
* getHrefInnerHtml(null) = ""
* getHrefInnerHtml("") = ""
* getHrefInnerHtml("mp3") = "mp3";
* getHrefInnerHtml("<a innerHtml</a>") = "<a innerHtml</a>";
* getHrefInnerHtml("<a>innerHtml</a>") = "innerHtml";
* getHrefInnerHtml("<a<a>innerHtml</a>") = "innerHtml";
* getHrefInnerHtml("<a href="baidu.com">innerHtml</a>") = "innerHtml";
* getHrefInnerHtml("<a href="baidu.com" title="baidu">innerHtml</a>") = "innerHtml";
* getHrefInnerHtml(" <a>innerHtml</a> ") = "innerHtml";
* getHrefInnerHtml("<a>innerHtml</a></a>") = "innerHtml";
* getHrefInnerHtml("jack<a>innerHtml</a></a>") = "innerHtml";
* getHrefInnerHtml("<a>innerHtml1</a><a>innerHtml2</a>") = "innerHtml2";
* </pre>
*/
public static String getHrefInnerHtml(String href) {
if (isEmpty(href)) {
return "";
}
String hrefReg = ".*<[\\s]*a[\\s]*.*>(.+?)<[\\s]*/a[\\s]*>.*";
Pattern hrefPattern = Pattern.compile(hrefReg, Pattern.CASE_INSENSITIVE);
Matcher hrefMatcher = hrefPattern.matcher(href);
if (hrefMatcher.matches()) {
return hrefMatcher.group(1);
}
return href;
}
/**
* html的转义字符转换成正常的字符串
*
* <pre>
* htmlEscapeCharsToString(null) = null;
* htmlEscapeCharsToString("") = "";
* htmlEscapeCharsToString("mp3") = "mp3";
* htmlEscapeCharsToString("mp3<") = "mp3<";
* htmlEscapeCharsToString("mp3>") = "mp3\>";
* htmlEscapeCharsToString("mp3&mp4") = "mp3&mp4";
* htmlEscapeCharsToString("mp3"mp4") = "mp3\"mp4";
* htmlEscapeCharsToString("mp3<>&"mp4") = "mp3\<\>&\"mp4";
* </pre>
*
* @param source
* @return
*/
public static String htmlEscapeCharsToString(String source) {
if (StringUtils.isEmpty(source)) {
return source;
} else {
return source.replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&").replaceAll(""", "\"");
}
}
/**
* 半角字符转换为全角字符
*
* <pre>
* fullWidthToHalfWidth(null) = null;
* fullWidthToHalfWidth("") = "";
* fullWidthToHalfWidth(new String(new char[] {12288})) = " ";
* fullWidthToHalfWidth("!"#$%&) = "!\"#$%&";
* </pre>
*
* @param s
* @return
*/
public static String fullWidthToHalfWidth(String s) {
if (isEmpty(s)) {
return s;
}
char[] source = s.toCharArray();
for (int i = 0; i < source.length; i++) {
if (source[i] == 12288) {
source[i] = ' ';
// } else if (source[i] == 12290) {
// source[i] = '.';
} else if (source[i] >= 65281 && source[i] <= 65374) {
source[i] = (char) (source[i] - 65248);
} else {
source[i] = source[i];
}
}
return new String(source);
}
/**
* 全角字符转换为半角字符
*
* <pre>
* halfWidthToFullWidth(null) = null;
* halfWidthToFullWidth("") = "";
* halfWidthToFullWidth(" ") = new String(new char[] {12288});
* halfWidthToFullWidth("!\"#$%&) = "!"#$%&";
* </pre>
*
* @param s
* @return
*/
public static String halfWidthToFullWidth(String s) {
if (isEmpty(s)) {
return s;
}
char[] source = s.toCharArray();
for (int i = 0; i < source.length; i++) {
if (source[i] == ' ') {
source[i] = (char) 12288;
// } else if (source[i] == '.') {
// source[i] = (char)12290;
} else if (source[i] >= 33 && source[i] <= 126) {
source[i] = (char) (source[i] + 65248);
} else {
source[i] = source[i];
}
}
return new String(source);
}
/**
* 根据分隔符来进行字符串拼接,最后一个字符后面不带分隔符
*
*
* @param arr
* 字符串数组
* @param cap
* 分隔符
* @return 拼接好的字符串
*/
public static String convertStringArrToStringWithCap(List<String> arr, String cap) {
StringBuilder allPics = new StringBuilder(200);
for (int i = 0; i < arr.size(); i++) {
// 最后一个不进行加分号
if (i == (arr.size() - 1)) {
allPics.append(arr.get(i));
} else {
allPics.append(arr.get(i)).append(cap);
}
}
return allPics.toString();
}
/**
* 把字符串中的空格、换行符、还有空白都替换掉。
*
* @param str
* 输入的字符串
* @return 替换后的字符串
*/
public static String replaceLinebreak(String str) {
String dest = "";
if (str != null) {
dest = str.replace("\r", "").replace("\n", "");
}
return dest;
}
/**
* 将textview中的字符全角化。即将所有的数字、字母及标点全部转为全角字符,使它们与汉字同占两个字节,这样就可以避免由于占位导致的排版混乱问题了。 半角转为全角的代码如下,只需调用即可。
*
* @param input
* @return
*/
public static String toDBC(String input) {
char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == 12288) {
c[i] = (char) 32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
c[i] = (char) (c[i] - 65248);
}
return new String(c);
}
/**
* 去除特殊字符或将所有中文标号替换为英文标号。利用正则表达式将所有特殊字符过滤,或利用replaceAll()将中文标号替换为英文标号。则转化之后,则可解决排版混乱问题。
*
* @param str
* @return
* @throws PatternSyntaxException
*/
public static String stringFilter(String str) throws PatternSyntaxException {
str = str.replaceAll("【", "[").replaceAll("】", "]").replaceAll("!", "!");// 替换中文标号
String regEx = "[『』]"; // 清除掉特殊字符
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
return m.replaceAll("").trim();
}
}
| mit |
Keats/gutenberg | test_site/README.md | 77 | Test site used by some components (`site`, `rebuild`) for integration tests.
| mit |
huzongtao/huzongtao.gitHub.io | _site/2016/08/10/storm集群搭建/index.html | 24326 | <!DOCTYPE html>
<html lang="zh-cmn-Hans" prefix="og: http://ogp.me/ns#" class="han-init">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="google-site-verification" content="KrB23GIOU5WYje5ZqEg8Hr4GAb5rr3FHbCBVfbzfvOQ" />
<title>Strom集群HA搭建 — 可口不可乐</title>
<link rel="stylesheet" href="/assets/vendor/primer-css/css/primer.css">
<link rel="stylesheet" href="/assets/vendor/primer-markdown/dist/user-content.min.css">
<link rel="stylesheet" href="/assets/vendor/octicons/octicons/octicons.css">
<link rel="stylesheet" href="/assets/css/components/collection.css">
<link rel="stylesheet" href="/assets/css/components/repo-card.css">
<link rel="stylesheet" href="/assets/css/sections/repo-list.css">
<link rel="stylesheet" href="/assets/css/sections/mini-repo-list.css">
<link rel="stylesheet" href="/assets/css/components/boxed-group.css">
<link rel="stylesheet" href="/assets/css/globals/common.css">
<link rel="stylesheet" href="/assets/vendor/share.js/dist/css/share.min.css">
<link rel="stylesheet" href="/assets/css/globals/responsive.css">
<link rel="stylesheet" href="/assets/css/posts/index.css">
<!-- Latest compiled and minified CSS -->
<link rel="canonical" href="http://localhost:4000/2016/08/10/storm%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA/">
<link rel="alternate" type="application/atom+xml" title="可口不可乐" href="/feed.xml">
<link rel="shortcut icon" href="/favicon.ico">
<meta property="og:title" content="Strom集群HA搭建">
<meta name="keywords" content="胡宗涛,博客">
<meta name="og:keywords" content="胡宗涛,博客">
<meta name="description" content="Storm集群搭建">
<meta name="og:description" content="Storm集群搭建">
<meta property="og:url" content="http://localhost:4000/2016/08/10/storm%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA/">
<meta property="og:site_name" content="可口不可乐">
<meta property="og:type" content="article">
<meta property="og:locale" content="zh_CN" />
<meta property="article:published_time" content="2016-08-10">
<script src="/assets/vendor/jquery/dist/jquery.min.js"></script>
<script src="/assets/js/jquery-ui.js"></script>
<script type="text/javascript">
function toggleMenu() {
var nav = document.getElementsByClassName("site-header-nav")[0];
if (nav.style.display == "inline-flex") {
nav.style.display = "none";
} else {
nav.style.display = "inline-flex";
}
}
</script>
</head>
<body class="" data-mz="">
<header class="site-header">
<div class="container">
<h1><a href="/" title="可口不可乐"><span class="octicon octicon-mark-github"></span> 可口不可乐</a></h1>
<button class="collapsed mobile-visible" type="button" onclick="toggleMenu();">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<nav class="site-header-nav" role="navigation">
<a href="/" class=" site-header-nav-item" target="" title="首页">首页</a>
<a href="/categories/" class=" site-header-nav-item" target="" title="分类">分类</a>
<a href="/MySkillTree/" class=" site-header-nav-item" target="" title="我的技能树">我的技能树</a>
<a href="/about/" class=" site-header-nav-item" target="" title="关于我">关于我</a>
</nav>
</div>
</header>
<!-- / header -->
<section class="collection-head small geopattern" data-pattern-id="Strom集群HA搭建">
<div class="container">
<div class="columns">
<div class="column three-fourths">
<div class="collection-title">
<h1 class="collection-header">Strom集群HA搭建</h1>
<div class="collection-info">
<span class="meta-info">
<span class="octicon octicon-calendar"></span> 2016/08/10
</span>
<span class="meta-info">
<span class="octicon octicon-file-directory"></span>
<a href="/categories/#bigdata" title="bigdata">bigdata</a>
</span>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- / .banner -->
<section class="container content">
<div class="columns">
<div class="column three-fourths" >
<article class="article-content markdown-body">
<p>Storm集群搭建</p>
<h3 id="集群部署">集群部署:</h3>
<p><a href="http://storm.apache.org/2016/05/06/storm101-released.html">storm-1.0.1</a></p>
<p><a href="https://zookeeper.apache.org/doc/r3.4.8/">zookeeper-3.4.8</a></p>
<p><a href="">jdk-7u79-linux-x64.tar.gz</a></p>
<p><a href="https://bintray.com/package/files/netty/downloads/netty">Netty-4.1.3.Final.tar.bz2</a></p>
<h4 id="主机配置">主机配置:</h4>
<p>nimbus01|nimbus02 2核4G</p>
<table>
<tbody>
<tr>
<td>supervisor01</td>
<td>supervisor02</td>
<td>supervisor03 8核16G</td>
</tr>
</tbody>
</table>
<h3 id="主机uname">主机uname</h3>
<p>以新建nimbus01主机为例</p>
<div class="language-config highlighter-rouge"><pre class="highlight"><code><span class="n">ETWORKING</span>=<span class="n">yes</span>
<span class="n">HOSTNAME</span>=<span class="n">nimbus01</span>
<span class="n">NETWORKING_IPV6</span>=<span class="n">no</span>
<span class="n">PEERNTP</span>=<span class="n">no</span>
<span class="n">GATEWAY</span>=<span class="n">xx</span>.<span class="n">xx</span>.<span class="n">xx</span>.<span class="n">xx</span>
</code></pre>
</div>
<h3 id="集群免密登录">集群免密登录</h3>
<ol>
<li>编辑/etc/hosts</li>
</ol>
<pre><code class="language-hosts">127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.14.162 nimbus01
192.168.14.156 nimbus02
192.168.14.58 supervisor01
192.168.14.119 supervisor02
192.168.14.139 supervisor03
</code></pre>
<ol>
<li>在nimbus和supervisor主机分别创建rsa公钥私钥,以nimbus01为例
```shell
<h1 id="root权限登录">root权限登录</h1>
<p>cd ~/.ssh
ssh-keygen -t rsa</p>
<h1 id="三次回车">三次回车</h1>
<p>cat id_rsa.pub » authorized_keys</p>
</li>
</ol>
<h1 id="登录其他主机将id_rsapub拷贝到nimbus01的ssh目录下">登录其他主机将id_rsa.pub拷贝到nimbus01的.ssh目录下</h1>
<p>cat id_rsa_nimbus02.pub » authorized_keys
cat id_rsa_supervisor01.pub » authorized_keys
cat id_rsa_supervisor02.pub » authorized_keys
cat id_rsa_supervisor03.pub » authorized_keys</p>
<h1 id="将authorized_keys">将authorized_keys</h1>
<p>scp /root/.ssh/authorized_keys nimbus01:/root/.ssh/
scp /root/.ssh/authorized_keys nimbus02:/root/.ssh/
scp /root/.ssh/authorized_keys supervisor01:/root/.ssh/
scp /root/.ssh/authorized_keys supervisor02:/root/.ssh/
scp /root/.ssh/authorized_keys supervisor03:/root/.ssh/</p>
<h1 id="修改文件权限">修改文件权限</h1>
<p>chmod 600 authorized_keys</p>
<div class="highlighter-rouge"><pre class="highlight"><code>
### 安装
#### jdk
```shell
cd /usr/local/soft/
tar -zxvf jdk-7u79-linux-x64.tar.gz
cd jdk1.7.0_65
vim /etc/profile
export JAVA_HOME=/usr/local/soft/jdk1.7.0_79
export PATH=.:$JAVA_HOME/bin:$PATH
source /etc/profile
</code></pre>
</div>
<h4 id="zookeeper集群">zookeeper集群</h4>
<div class="language-shell highlighter-rouge"><pre class="highlight"><code>tar -zxvf zookeeper-3.4.8.tar.gz
<span class="nb">cd </span>zookeeper-3.4.8
mv conf/zoo_sample.cfg conf/zoo.cfg
<span class="c"># 详见下方zoo.cfg配置</span>
vim conf/zoo.cfg
mkdir data <span class="o">&&</span> <span class="nb">echo</span> <span class="s2">"1"</span>>data/myid
</code></pre>
</div>
<p>zoo.cfg配置</p>
<div class="language-config highlighter-rouge"><pre class="highlight"><code><span class="n">tickTime</span>=<span class="m">2000</span>
<span class="n">initLimit</span>=<span class="m">10</span>
<span class="n">syncLimit</span>=<span class="m">5</span>
<span class="n">dataDir</span>=/<span class="n">usr</span>/<span class="n">local</span>/<span class="n">soft</span>/<span class="n">zookeeper</span>-<span class="m">3</span>.<span class="m">4</span>.<span class="m">8</span>/<span class="n">data</span>
<span class="n">clientPort</span>=<span class="m">2181</span>
<span class="n">server</span>.<span class="m">1</span>=<span class="n">suspervisor01</span>:<span class="m">2888</span>:<span class="m">3888</span>
<span class="n">server</span>.<span class="m">2</span>=<span class="n">suspervisor02</span>:<span class="m">2888</span>:<span class="m">3888</span>
<span class="n">server</span>.<span class="m">3</span>=<span class="n">suspervisor03</span>:<span class="m">2888</span>:<span class="m">3888</span>
</code></pre>
</div>
<p>拷贝zookeeper到其他节点
复制supervisor01节点上的ZooKeeper到supervisor01|supervisor02上</p>
<div class="language-shell highlighter-rouge"><pre class="highlight"><code>scp -r /usr/local/soft/zookeeper-3.4.8 root@supervisor02:/usr/local/soft/
<span class="nb">echo</span> <span class="s2">"2"</span> >/usr/local/soft/zookeeper-3.4.8/data/myid
scp -r /usr/local/soft/zookeeper-3.4.8 root@supervisor03:/usr/local/soft/
<span class="nb">echo</span> <span class="s2">"3"</span> >/usr/local/soft/zookeeper-3.4.8/data/myid
</code></pre>
</div>
<p>启动</p>
<div class="language-shell highlighter-rouge"><pre class="highlight"><code><span class="k">for </span>i <span class="k">in </span>supervisor01 supervisor02 supervisor03; <span class="k">do </span><span class="nb">echo</span> <span class="nv">$i</span>; ssh <span class="nv">$i</span> <span class="s2">"/usr/local/soft/zookeeper-3.4.8/bin/zkServer.sh start"</span>; <span class="k">done</span>
</code></pre>
</div>
<h4 id="netty网络通信">netty网络通信</h4>
<p>storm-1.0.1对netty网络通信支持</p>
<h4 id="storm集群">storm集群</h4>
<div class="language-shell highlighter-rouge"><pre class="highlight"><code><span class="nb">cd</span> /usr/local/soft/
tar -zxvf apache-storm-1.0.1.tar.gz
<span class="nb">cd </span>apache-storm-1.0.1
mkdir -p /data/storm/logs
mkdir -p /usr/local/soft/apache-storm-1.0.1/localdir
mkdir -p /data/storm/logs/workers-artifacts
vim conf/storm.yaml
</code></pre>
</div>
<p>storm.yaml配置,可参考官网介绍<a href="https://github.com/apache/storm/blob/v1.0.1/conf/defaults.yaml">storm-default.yaml</a></p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># #### Storm dependents The ZooKeeper Cluster ####</span>
<span class="s">storm.zookeeper.servers</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s2">"</span><span class="s">supervisor01"</span>
<span class="pi">-</span> <span class="s2">"</span><span class="s">supervisor02"</span>
<span class="pi">-</span> <span class="s2">"</span><span class="s">supervisor03"</span>
<span class="c1"># #### Storm Nimbus Nodes HA ####</span>
<span class="s">nimbus.seeds</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">nimbus01"</span><span class="pi">,</span> <span class="s2">"</span><span class="s">nimbus02"</span><span class="pi">]</span>
<span class="s">nimbus.childopts</span><span class="pi">:</span> <span class="s2">"</span><span class="s">-Xmx2048m"</span>
<span class="c1">### ui.* configs are for the master</span>
<span class="s">ui.childopts</span><span class="pi">:</span> <span class="s2">"</span><span class="s">-Xmx1536m"</span>
<span class="c1"># #### Storm Local Storage ####</span>
<span class="s">storm.local.dir</span><span class="pi">:</span> <span class="s2">"</span><span class="s">/usr/local/soft/apache-storm-1.0.1/localdir"</span>
<span class="s">storm.workers.artifacts.dir</span><span class="pi">:</span> <span class="s2">"</span><span class="s">/data/storm/logs/workers-artifacts"</span>
<span class="c1"># #### Storm Supervisor Nodes Worker Process ####</span>
<span class="s">supervisor.slots.ports</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">6700</span>
<span class="pi">-</span> <span class="s">6701</span>
<span class="pi">-</span> <span class="s">6702</span>
<span class="pi">-</span> <span class="s">6703</span>
<span class="c1"># supervisor.childopts: "-Xmx512m"</span>
<span class="s">supervisor.cpu.capacity</span><span class="pi">:</span> <span class="s">400.0</span>
<span class="s">supervisor.worker.timeout.secs</span><span class="pi">:</span> <span class="s">120</span>
<span class="c1">## worker.* configs are for task workers</span>
<span class="c1"># worker.childopts: "-Xmx4096m"</span>
<span class="c1"># worker.heap.memory.mb: 1024</span>
<span class="c1"># logviwer</span>
<span class="s">logviewer.childopts</span><span class="pi">:</span> <span class="s2">"</span><span class="s">-Xmx256m"</span>
<span class="c1"># #### Not Selector ZeroMQ, Storm Use Netty Transport Protocol ####</span>
<span class="s">storm.messaging.transport</span><span class="pi">:</span> <span class="s2">"</span><span class="s">org.apache.storm.messaging.netty.Context"</span>
<span class="s">storm.messaging.netty.server_worker_threads</span><span class="pi">:</span> <span class="s">1</span>
<span class="s">storm.messaging.netty.client_worker_threads</span><span class="pi">:</span> <span class="s">1</span>
<span class="s">storm.messaging.netty.buffer_size</span><span class="pi">:</span> <span class="s">5242880</span>
<span class="s">storm.messaging.netty.max_retries</span><span class="pi">:</span> <span class="s">300</span>
<span class="s">storm.messaging.netty.max_wait_ms</span><span class="pi">:</span> <span class="s">1000</span>
<span class="s">storm.messaging.netty.min_wait_ms</span><span class="pi">:</span> <span class="s">100</span>
<span class="c1">## JVM parameters</span>
<span class="s">nimbus.childopts</span><span class="pi">:</span> <span class="s2">"</span><span class="s">-Xmx2048m</span><span class="nv"> </span><span class="s">-XX:+PrintGCDetails</span><span class="nv"> </span><span class="s">-Xloggc:/data/storm/logs/nimbusGC.log</span><span class="nv"> </span><span class="s">-XX:+PrintGCDateStamps</span><span class="nv"> </span><span class="s">-XX:+PrintGCTimeStamps</span><span class="nv"> </span><span class="s">-XX:+UseGCLogFileRotation</span><span class="nv"> </span><span class="s">-XX:NumberOfGCLogFiles=10</span><span class="nv"> </span><span class="s">-XX:GCLogFileSize=1M</span><span class="nv"> </span><span class="s">-XX:+HeapDumpOnOutOfMemoryError</span><span class="nv"> </span><span class="s">-XX:HeapDumpPath=/data/storm/dump/nimbus-heapdump"</span>
<span class="s">supervisor.childopts</span><span class="pi">:</span> <span class="s2">"</span><span class="s">-Xmx512m</span><span class="nv"> </span><span class="s">-XX:+PrintGCDetails</span><span class="nv"> </span><span class="s">-Xloggc:/data/storm/logs/supervisorGC.log</span><span class="nv"> </span><span class="s">-XX:+PrintGCDateStamps</span><span class="nv"> </span><span class="s">-XX:+PrintGCTimeStamps</span><span class="nv"> </span><span class="s">-XX:+UseGCLogFileRotation</span><span class="nv"> </span><span class="s">-XX:NumberOfGCLogFiles=10</span><span class="nv"> </span><span class="s">-XX:GCLogFileSize=1M</span><span class="nv"> </span><span class="s">-XX:+HeapDumpOnOutOfMemoryError</span><span class="nv"> </span><span class="s">-XX:HeapDumpPath=/data/storm/dump/supervisor-heapdump"</span>
<span class="s">worker.childopts</span><span class="pi">:</span> <span class="s2">"</span><span class="s">-Xmx4096m</span><span class="nv"> </span><span class="s">-XX:PermSize=64M</span><span class="nv"> </span><span class="s">-XX:MaxPermSize=128m</span><span class="nv"> </span><span class="s">-XX:+PrintGCDetails</span><span class="nv"> </span><span class="s">-Xloggc:/data/storm/logs/workerGC.log</span><span class="nv"> </span><span class="s">-XX:+PrintGCDateStamps</span><span class="nv"> </span><span class="s">-XX:+PrintGCTimeStamps</span><span class="nv"> </span><span class="s">-XX:+UseGCLogFileRotation</span><span class="nv"> </span><span class="s">-XX:NumberOfGCLogFiles=10</span><span class="nv"> </span><span class="s">-XX:GCLogFileSize=1M</span><span class="nv"> </span><span class="s">-XX:+HeapDumpOnOutOfMemoryError</span><span class="nv"> </span><span class="s">-XX:HeapDumpPath=/data/storm/dump/worker-heapdump</span><span class="nv"> </span><span class="s">-XX:+UseG1GC"</span>
</code></pre>
</div>
<p>storm集群启动</p>
<div class="language-shell highlighter-rouge"><pre class="highlight"><code>在nimbus01上启动如下进程
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm nimbus &
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm ui &
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm logviewer &
在nimbus02上启动如下进程
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm nimbus &
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm logviewer &
在supervisor01上启动如下进程
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm supervisor &
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm logviewer &
在supervisor02上启动如下进程
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm supervisor &
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm logviewer &
在supervisor03上启动如下进程
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm supervisor &
nohup /usr/local/soft/apache-storm-1.0.1/bin/storm logviewer &
</code></pre>
</div>
<p>maven打包运行应用,将依赖jar和jar分开:</p>
<div class="language-xml highlighter-rouge"><pre class="highlight"><code><span class="nt"><plugin></span>
<span class="nt"><artifactId></span>maven-assembly-plugin<span class="nt"></artifactId></span>
<span class="nt"><configuration></span>
<span class="nt"><descriptorRefs></span>
<span class="nt"><descriptorRef></span>jar-with-dependencies<span class="nt"></descriptorRef></span>
<span class="nt"></descriptorRefs></span>
<span class="nt"><archive></span>
<span class="nt"><manifest></span>
<span class="nt"><mainClass></span>com.path.to.main.Class<span class="nt"></mainClass></span>
<span class="nt"></manifest></span>
<span class="nt"></archive></span>
<span class="nt"></configuration></span>
<span class="nt"></plugin></span>
</code></pre>
</div>
<p>应用jar放置在自定义目录下
依赖jar属于运行环境随storm启动,放置在/usr/local/soft/apache-storm-1.0.1/extlib/</p>
<p>拷贝依赖库
for i in nimbus02 supervisor01 supervisor02 supervisor03; do scp -r /usr/local/soft/apache-storm-1.0.1/extlib/* $i:/usr/local/soft/apache-storm-1.0.1/extlib/; jps; done;</p>
<h3 id="启动拓扑">启动拓扑</h3>
<div class="language-shell highlighter-rouge"><pre class="highlight"><code><span class="c"># 启动拓扑树</span>
storm jar /root/topology/mcp-1.0.0.jar com.rtmap.wcp.events.clean.topology.trident.WcpCleanTopology cluster
<span class="c"># 停止拓扑</span>
storm <span class="nb">kill</span> <span class="o">[</span>topologyName]
<span class="c"># 重新分配</span>
</code></pre>
</div>
<h3 id="参考资料">参考资料</h3>
<p><a href="http://www.cnblogs.com/hseagle/category/519033.html">Storm实践</a></p>
<p><a href="http://blog.xiaoxiaomo.com/2016/06/09/Storm-%E5%B9%B6%E8%A1%8C%E5%BA%A6/">Storm并行度</a></p>
<p><a href="http://www.jianshu.com/p/f645eb7944b0">Storm性能优化</a></p>
</article>
<div class="share">
<div class="share-component"></div>
</div>
<div class="comment">
<!-- Disqus Protection, see https://github.com/mzlogin/mzlogin.github.io/issues/2 -->
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = 'http://localhost:4000/2016/08/10/storm%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA/';
this.page.identifier = '/2016/08/10/storm%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA/';
this.page.title = 'Strom集群HA搭建';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
var shortname = 'hunter-github-io';
s.src = '//' + shortname + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
</div>
</div>
<div class="column one-fourth">
<h3>Search</h3>
<div id="site_search">
<input type="text" id="search_box" placeholder="Search">
<button class="btn btn-default" id="site_search_do"><span class="octicon octicon-search"></span></button>
</div>
<ul id="search_results"></ul>
<link rel="stylesheet" type="text/css" href="/assets/css/modules/sidebar-search.css">
<script src="/assets/js/lunr.min.js"></script>
<script src="/assets/js/search.js"></script>
<h3>Post Directory</h3>
<div id="post-directory-module" class="mobile-hidden">
<section class="post-directory">
<!-- Links that trigger the jumping -->
<!-- Added by javascript below -->
<dl></dl>
</section>
</div>
<script src="/assets/js/jquery.toc.js"></script>
</div>
</div>
</section>
<!-- /section.content -->
<footer class="container">
<div class="site-footer" role="contentinfo">
<div class="copyright left mobile-block">
© <script>document.write(new Date().getFullYear())</script>
<span title="胡宗涛">胡宗涛</span>
<a href="javascript:window.scrollTo(0,0)" class="right mobile-visible">TOP</a>
</div>
<ul class="site-footer-links right mobile-hidden">
<li>
<a href="javascript:window.scrollTo(0,0)" >TOP</a>
</li>
</ul>
<a href="https://github.com/huzongtao/huzongtao.github.io" target="_blank" aria-label="view source code">
<span class="mega-octicon octicon-mark-github" title="GitHub"></span>
</a>
<ul class="site-footer-links mobile-hidden">
<li>
<a href="/" title="首页" target="">首页</a>
</li>
<li>
<a href="/categories/" title="分类" target="">分类</a>
</li>
<li>
<a href="/MySkillTree/" title="我的技能树" target="">我的技能树</a>
</li>
<li>
<a href="/about/" title="关于我" target="">关于我</a>
</li>
<li><a href="/feed.xml"><span class="octicon octicon-rss" style="color:orange;"></span></a></li>
</ul>
</div>
</footer>
<!-- / footer -->
<script src="/assets/vendor/share.js/dist/js/share.min.js"></script>
<script src="/assets/js/geopattern.js"></script>
<script src="/assets/js/prism.js"></script>
<link rel="stylesheet" href="/assets/css/globals/prism.css">
<script>
jQuery(document).ready(function($) {
// geopattern
$('.geopattern').each(function(){
$(this).geopattern($(this).data('pattern-id'));
});
// hljs.initHighlightingOnLoad();
});
</script>
</body>
</html>
| mit |
simonmysun/praxis | TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/5ae736d641f371d76b6e40e95d5fd4f55e5e74958c8c8ac7fb6ea77ae0efd311.html | 550 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>18 --> 19</title>
<link href="./../../assets/style.css" rel="stylesheet">
</head>
<body>
<h2>You have to be fast</h2>
<a href="./9335afdec0ebf0c2ed3a8bf96ba79dfae362fa01b262c777ca1cdf8f17740466.html">Teleport</a>
<hr>
<a href="./../../about.md">About</a> (Spoilers! )
<script src="./../../assets/md5.js"></script>
<script>
window.currentLevel = 7;
</script>
<script src="./../../assets/script.js"></script>
</body>
</html> | mit |
buenadigital/SaaSPro | src/SaaSPro.Infrastructure/Configuration/ApplicationSettingsFactory.cs | 489 | namespace SaaSPro.Infrastructure.Configuration
{
public class ApplicationSettingsFactory
{
private static IApplicationSettings _applicationSettings;
public static void InitializeApplicationSettingsFactory(IApplicationSettings applicationSettings)
{
_applicationSettings = applicationSettings;
}
public static IApplicationSettings GetApplicationSettings()
{
return _applicationSettings;
}
}
}
| mit |
chagn/chagn.github.com | static/impressionist-mysql-errors/amp/index.html | 24970 | <head>
<meta charset="utf-8">
<title>impressionist mysql errors</title>
<meta name="description" content="">
<meta name="HandheldFriendly" content="True">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<link rel="shortcut icon" href="../../favicon.ico">
<link rel="canonical" href="../index.html">
<meta name="referrer" content="no-referrer-when-downgrade">
<meta property="og:site_name" content="Ruby on Rails Developers">
<meta property="og:type" content="article">
<meta property="og:title" content="impressionist mysql errors">
<meta property="og:description" content='Mysql2::Error: BLOB/TEXT in /db/migrate/createimpressionstable.rb 找到 add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name =&gt; "poly_params_request_index", :unique =&gt; false 加入 :length => {:params => 255 } add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name =&gt; "poly_params_request_index", :unique =&gt; false, :length =&gt;'>
<meta property="og:url" content="http://localhost:2368/impressionist-mysql-errors/">
<meta property="article:published_time" content="2017-07-21T07:30:24.000Z">
<meta property="article:modified_time" content="2017-07-24T14:46:06.000Z">
<meta property="article:tag" content="Ruby on Rails">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="impressionist mysql errors">
<meta name="twitter:description" content='Mysql2::Error: BLOB/TEXT in /db/migrate/createimpressionstable.rb 找到 add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name =&gt; "poly_params_request_index", :unique =&gt; false 加入 :length => {:params => 255 } add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name =&gt; "poly_params_request_index", :unique =&gt; false, :length =&gt;'>
<meta name="twitter:url" content="http://localhost:2368/impressionist-mysql-errors/">
<meta name="twitter:label1" content="Written by">
<meta name="twitter:data1" content="Vincent">
<meta name="twitter:label2" content="Filed under">
<meta name="twitter:data2" content="Ruby on Rails">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"publisher": {
"@type": "Organization",
"name": "Ruby on Rails Developers",
"logo": "http://localhost:2368/ghost/img/ghosticon.jpg"
},
"author": {
"@type": "Person",
"name": "Vincent",
"url": "http://localhost:2368/author/yang/",
"sameAs": []
},
"headline": "impressionist mysql errors",
"url": "http://localhost:2368/impressionist-mysql-errors/",
"datePublished": "2017-07-21T07:30:24.000Z",
"dateModified": "2017-07-24T14:46:06.000Z",
"keywords": "Ruby on Rails",
"description": "Mysql2::Error: BLOB/TEXT in /db/migrate/createimpressionstable.rb 找到 add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name =&gt; "poly_params_request_index", :unique =&gt; false 加入 :length => {:params => 255 } add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name =&gt; "poly_params_request_index", :unique =&gt; false, :length =&gt;",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "http://localhost:2368"
}
}
</script>
<meta name="generator" content="Ghost 0.11">
<link rel="alternate" type="application/rss+xml" title="Ruby on Rails Developers" href="../../rss/index.html">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic%7COpen+Sans:700,600,400">
<style amp-custom>
/* ==========================================================================
Table of Contents
========================================================================== */
/*
0. Normalize
1. General
2. Utilities
3. AMP Post
4. Footer
*/
/* ==========================================================================
0. normalize.css v3.0.3 | MIT License | git.io/normalize | (minified)
========================================================================== */
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
}
a:active,
a:hover {
outline: 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
h1 {
margin: 0.67em 0;
font-size: 2em;
}
mark {
background: #ff0;
color: #000;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
vertical-align: baseline;
font-size: 75%;
line-height: 0;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
img {
border: 0;
}
amp-img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 1em 40px;
}
hr {
box-sizing: content-box;
height: 0;
}
pre {
overflow: auto;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
button,
input,
optgroup,
select,
textarea {
margin: 0;
color: inherit;
font: inherit;
}
button {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
cursor: pointer;
-webkit-appearance: button;
}
button[disabled],
html input[disabled] {
cursor: default;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
padding: 0;
border: 0;
}
input {
line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-appearance: textfield;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
border: 1px solid #c0c0c0;
}
legend {
padding: 0;
border: 0;
}
textarea {
overflow: auto;
}
optgroup {
font-weight: bold;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
td,
th {
padding: 0;
}
/* ==========================================================================
1. General - Setting up some base styles
========================================================================== */
html {
max-height: 100%;
height: 100%;
font-size: 62.5%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
max-height: 100%;
height: 100%;
color: #3a4145;
background: #f4f8fb;
letter-spacing: 0.01rem;
font-family: "Merriweather", serif;
font-size: 1.8rem;
line-height: 1.75em;
text-rendering: geometricPrecision;
-webkit-font-feature-settings: "kern" 1;
-moz-font-feature-settings: "kern" 1;
-o-font-feature-settings: "kern" 1;
}
::-moz-selection {
background: #d6edff;
}
::selection {
background: #d6edff;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0 0 0.3em 0;
color: #2e2e2e;
font-family: "Open Sans", sans-serif;
line-height: 1.15em;
text-rendering: geometricPrecision;
-webkit-font-feature-settings: "dlig" 1, "liga" 1, "lnum" 1, "kern" 1;
-moz-font-feature-settings: "dlig" 1, "liga" 1, "lnum" 1, "kern" 1;
-o-font-feature-settings: "dlig" 1, "liga" 1, "lnum" 1, "kern" 1;
}
h1 {
text-indent: -2px;
letter-spacing: -1px;
font-size: 2.6rem;
}
h2 {
letter-spacing: 0;
font-size: 2.4rem;
}
h3 {
letter-spacing: -0.6px;
font-size: 2.1rem;
}
h4 {
font-size: 1.9rem;
}
h5 {
font-size: 1.8rem;
}
h6 {
font-size: 1.8rem;
}
a {
color: #4a4a4a;
}
a:hover {
color: #111;
}
p,
ul,
ol,
dl {
margin: 0 0 2.5rem 0;
font-size: 1.5rem;
text-rendering: geometricPrecision;
-webkit-font-feature-settings: "liga" 1, "onum" 1, "kern" 1;
-moz-font-feature-settings: "liga" 1, "onum" 1, "kern" 1;
-o-font-feature-settings: "liga" 1, "onum" 1, "kern" 1;
}
ol,
ul {
padding-left: 2em;
}
ol ol,
ul ul,
ul ol,
ol ul {
margin: 0 0 0.4em 0;
padding-left: 2em;
}
dl dt {
float: left;
clear: left;
overflow: hidden;
margin-bottom: 1em;
width: 180px;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 700;
}
dl dd {
margin-bottom: 1em;
margin-left: 200px;
}
li {
margin: 0.4em 0;
}
li li {
margin: 0;
}
hr {
display: block;
margin: 1.75em 0;
padding: 0;
height: 1px;
border: 0;
border-top: #efefef 1px solid;
}
blockquote {
box-sizing: border-box;
margin: 1.75em 0 1.75em 0;
padding: 0 0 0 1.75em;
border-left: #4a4a4a 0.4em solid;
-moz-box-sizing: border-box;
}
blockquote p {
margin: 0.8em 0;
font-style: italic;
}
blockquote small {
display: inline-block;
margin: 0.8em 0 0.8em 1.5em;
color: #ccc;
font-size: 0.9em;
}
blockquote small:before {
content: "\2014 \00A0";
}
blockquote cite {
font-weight: 700;
}
blockquote cite a {
font-weight: normal;
}
mark {
background-color: #fdffb6;
}
code,
tt {
padding: 1px 3px;
border: #e3edf3 1px solid;
background: #f7fafb;
border-radius: 2px;
white-space: pre-wrap;
font-family: Inconsolata, monospace, sans-serif;
font-size: 0.85em;
font-feature-settings: "liga" 0;
-webkit-font-feature-settings: "liga" 0;
-moz-font-feature-settings: "liga" 0;
}
pre {
overflow: auto;
box-sizing: border-box;
margin: 0 0 1.75em 0;
padding: 10px;
width: 100%;
border: #e3edf3 1px solid;
background: #f7fafb;
border-radius: 3px;
white-space: pre;
font-family: Inconsolata, monospace, sans-serif;
font-size: 0.9em;
-moz-box-sizing: border-box;
}
pre code,
pre tt {
padding: 0;
border: none;
background: transparent;
white-space: pre-wrap;
font-size: inherit;
}
kbd {
display: inline-block;
margin-bottom: 0.4em;
padding: 1px 8px;
border: #ccc 1px solid;
background: #f4f4f4;
border-radius: 4px;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2),
0 1px 0 0 #fff inset;
color: #666;
text-shadow: #fff 0 1px 0;
font-size: 0.9em;
font-weight: 700;
}
table {
box-sizing: border-box;
margin: 1.75em 0;
max-width: 100%;
width: 100%;
background-color: transparent;
-moz-box-sizing: border-box;
}
table th,
table td {
padding: 8px;
border-top: #efefef 1px solid;
vertical-align: top;
text-align: left;
line-height: 20px;
}
table th {
color: #000;
}
table caption + thead tr:first-child th,
table caption + thead tr:first-child td,
table colgroup + thead tr:first-child th,
table colgroup + thead tr:first-child td,
table thead:first-child tr:first-child th,
table thead:first-child tr:first-child td {
border-top: 0;
}
table tbody + tbody {
border-top: #efefef 2px solid;
}
table table table {
background-color: #fff;
}
table tbody > tr:nth-child(odd) > td,
table tbody > tr:nth-child(odd) > th {
background-color: #f6f6f6;
}
table.plain tbody > tr:nth-child(odd) > td,
table.plain tbody > tr:nth-child(odd) > th {
background: transparent;
}
iframe,
amp-iframe,
.fluid-width-video-wrapper {
display: block;
margin: 1.75em 0;
}
/* When a video is inside the fitvids wrapper, drop the
margin on the iframe, cause it breaks stuff. */
.fluid-width-video-wrapper iframe,
.fluid-width-video-wrapper amp-iframe {
margin: 0;
}
textarea,
select,
input {
margin: 0 0 5px 0;
padding: 6px 9px;
width: 260px;
outline: 0;
border: #e7eef2 1px solid;
background: #fff;
border-radius: 4px;
box-shadow: none;
font-family: "Open Sans", sans-serif;
font-size: 1.6rem;
line-height: 1.4em;
font-weight: 100;
-webkit-appearance: none;
}
textarea {
min-width: 250px;
min-height: 80px;
max-width: 340px;
width: 100%;
height: auto;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="time"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
textarea:focus {
outline: none;
outline-width: 0;
border: #bbc7cc 1px solid;
background: #fff;
}
select {
width: 270px;
height: 30px;
line-height: 30px;
}
/* ==========================================================================
2. Utilities
========================================================================== */
/* Clears shit */
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
zoom: 1;
}
/* ==========================================================================
3. AMP Post
========================================================================== */
.main-header {
position: relative;
display: table;
overflow: hidden;
box-sizing: border-box;
width: 100%;
height: 50px;
background: #5ba4e5 no-repeat center center;
background-size: cover;
text-align: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
.content {
background: #fff;
padding-top: 15px;
}
.blog-title,
.content {
margin: auto;
max-width: 600px;
}
.blog-title a {
display: block;
padding-right: 16px;
padding-left: 16px;
height: 50px;
color: #fff;
text-decoration: none;
font-family: "Open Sans", sans-serif;
font-size: 16px;
line-height: 50px;
font-weight: 600;
}
.post {
position: relative;
margin-top: 0;
margin-right: 16px;
margin-left: 16px;
padding-bottom: 0;
max-width: 100%;
border-bottom: #ebf2f6 1px solid;
word-wrap: break-word;
font-size: 0.95em;
line-height: 1.65em;
}
.post-header {
margin-bottom: 1rem;
}
.post-title {
margin-bottom: 0;
}
.post-title a {
text-decoration: none;
}
.post-meta {
display: block;
margin: 3px 0 0 0;
color: #9eabb3;
font-family: "Open Sans", sans-serif;
font-size: 1.3rem;
line-height: 2.2rem;
}
.post-meta a {
color: #9eabb3;
text-decoration: none;
}
.post-meta a:hover {
text-decoration: underline;
}
.post-meta .author {
margin: 0;
font-size: 1.3rem;
line-height: 1.3em;
}
.post-date {
display: inline-block;
text-transform: uppercase;
white-space: nowrap;
font-size: 1.2rem;
line-height: 1.2em;
}
.post-image {
margin: 0;
padding-top: 3rem;
padding-bottom: 30px;
border-top: 1px #E8E8E8 solid;
}
/* Keep images centered, and allow images wider than the main
text column to break out. */
.post-content amp-img,
.post-content amp-anim {
/* Centers an image by (1) pushing its left edge to the
center of its container and (2) shifting the entire image
in the opposite direction by half its own width.
Works for images that are larger than their containers. */
position: relative;
left: 50%;
display: block;
padding: 0;
min-width: 0;
max-width: 112%; /* fallback when calc doesn't work */
width: calc(100% + 32px); /* expand with to image + margins */
height: auto;
transform: translateX(-50%);
-webkit-transform: translateX(-50%); /* for Safari and iOS */
-ms-transform: translateX(-50%); /* for IE9 */
}
.footnotes {
font-size: 1.3rem;
line-height: 1.6em;
font-style: italic;
}
.footnotes li {
margin: 0.6rem 0;
}
.footnotes p {
margin: 0;
}
.footnotes p a:last-child {
text-decoration: none;
}
/* ==========================================================================
4. Footer - The bottom the AMP Post
========================================================================== */
.site-footer {
position: relative;
margin: 0 auto 20px auto;
padding: 1rem 15px;
max-width: 600px;
color: rgba(0,0,0,0.5);
font-family: "Open Sans", sans-serif;
font-size: 1.1rem;
line-height: 1.75em;
}
.site-footer a {
color: rgba(0,0,0,0.5);
text-decoration: none;
font-weight: bold;
}
.site-footer a:hover {
border-bottom: #bbc7cc 1px solid;
}
.poweredby {
display: block;
float: right;
width: 45%;
text-align: right;
}
.copyright {
display: block;
float: left;
width: 45%;
}
</style>
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body class="amp-template">
<header class="main-header">
<nav class="blog-title">
<a href="../../">Ruby on Rails Developers</a>
</nav>
</header>
<main class="content" role="main">
<article class="post">
<header class="post-header">
<h1 class="post-title">impressionist mysql errors</h1>
<section class="post-meta">
<p class="author">by <a href="../../author/yang/">Vincent</a></p>
<time class="post-date" datetime="2017-07-21">2017-07-21</time>
</section>
</header>
<section class="post-content">
<h3 id="mysql2errorblobtext"><strong>Mysql2::Error: BLOB/TEXT</strong></h3>
<p>in /db/migrate/create<em>impressions</em>table.rb <br>
找到</p>
<pre><code>add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false
</code></pre>
<p>加入 :length => {:params => 255 } </p>
<pre><code>add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false, :length => {:params => 255 }
</code></pre>
</section>
</article>
</main>
<footer class="site-footer clearfix">
<section class="copyright"><a href="../../">Ruby on Rails Developers</a> © 2017</section>
<section class="poweredby">Proudly published with <a href="https://ghost.org">Ghost</a></section>
</footer>
</body>
| mit |
lemonad/methodiki | methodiki/methods/templates/methods-bonus-meta.html | 1164 | {% load i18n thumbnail %}
<div class="bonus-meta">
<p>
{% url user bonus.user.username as link_to_person %}
<em>
{% ifequal bonus.status "PUBLISHED" %}
{% blocktrans with bonus.user.get_profile.name as name and bonus.published_at as published_at %}
Created by <a href="{{ link_to_person }}">{{ name }}</a>
and published at {{ published_at }}.
{% endblocktrans %}
{% endifequal %}
{% ifequal bonus.status "DRAFT" %}
{% blocktrans with bonus.user.get_profile.name as name and bonus.date_created as created_at %}
Created by <a href="{{ link_to_person }}">{{ name }}</a> at {{ created_at }}.
<strong>Bonus is not yet published.</strong>
{% endblocktrans %}
{% endifequal %}
{% if not edit_bonus_flag %}
{% if bonus.user.id == request.user.id or request.user.is_superuser %}
<a class="noprint rounded-button rounded-6"
href="{% url methods-edit-bonus method.published_at.year method.published_at.month method.published_at.day method.slug bonus.id %}">
{% trans "Edit bonus?" %}
</a>
{% endif %}
{% endif %}
</em>
</p>
</div>
| mit |
dunfy/sonus | src/Closca/Sonus/Sonus.php | 19433 | <?php namespace Closca\Sonus;
use Config;
use Closca\Sonus\Helpers;
/**
* Laravel Audio Conversion Package
*
* This package is created to handle server-side conversion tasks using FFMPEG (http://www.fmpeg.org)
*
* @author Rafael Sampaio <[email protected]>
*/
class Sonus
{
/**
* Returns full path of ffmpeg
* @return string
*/
protected static function getConverterPath()
{
return Config::get('sonus::ffmpeg');
}
/**
* Returns full path of ffprobe
* @return string
*/
protected static function getProbePath()
{
return Config::get('sonus::ffprobe');
}
/**
* Returns full path for progress temp files
* @return [type] [description]
*/
protected static function getTempPath()
{
return Config::get('sonus::tmp_dir');
}
/**
* Returns installed ffmpeg version
* @return array
*/
public static function getConverterVersion()
{
// Run terminal command to retrieve version
$command = self::getConverterPath().' -version';
$output = shell_exec($command);
// PREG pattern to retrive version information
$ouput = preg_match("/ffmpeg version (?P<major>[0-9]{0,3}).(?P<minor>[0-9]{0,3}).(?P<revision>[0-9]{0,3})/", $output, $parsed);
// Verify output
if ($output === false || $output == 0)
{
return false;
}
// Assign array with variables
$version = array(
'major' => $parsed['major'],
'minor' => $parsed['minor'],
'rev' => $parsed['revision']
);
return $version;
}
/**
* Returns all formats ffmpeg supports
* @return array
*/
public static function getSupportedFormats()
{
// Run terminal command
$command = self::getConverterPath().' -formats';
$output = shell_exec($command);
// PREG pattern to retrive version information
$output = preg_match_all("/(?P<mux>(D\s|\sE|DE))\s(?P<format>\S{3,11})\s/", $output, $parsed);
// Verify output
if ($output === false || $output == 0)
{
return false;
}
// Combine the format and mux information into an array
$formats = array_combine($parsed['format'], $parsed['mux']);
return $formats;
}
/**
* Returns all audio formats ffmpeg can encode
* @return array
*/
public static function getSupportedAudioEncoders()
{
// Run terminal command
$command = self::getConverterPath().' -encoders';
$output = shell_exec($command);
// PREG pattern to retrive version information
$output = preg_match_all("/[A]([.]|\w)([.]|\w)([.]|\w)([.]|\w)([.]|\w)\s(?P<format>\S{3,20})\s/", $output, $parsed);
// Verify output
if ($output === false || $output == 0)
{
return false;
}
return $parsed['format'];
}
/**
* Returns all video formats ffmpeg can encode
* @return array
*/
public static function getSupportedVideoEncoders()
{
// Run terminal command
$command = self::getConverterPath().' -encoders';
$output = shell_exec($command);
// PREG pattern to retrive version information
$output = preg_match_all("/[V]([.]|\w)([.]|\w)([.]|\w)([.]|\w)([.]|\w)\s(?P<format>\S{3,20})\s/", $output, $parsed);
// Verify output
if ($output === false || $output == 0)
{
return false;
}
return $parsed['format'];
}
/**
* Returns all audio formats ffmpeg can decode
* @return array
*/
public static function getSupportedAudioDecoders()
{
// Run terminal command
$command = self::getConverterPath().' -decoders';
$output = shell_exec($command);
// PREG pattern to retrive version information
$output = preg_match_all("/[A]([.]|\w)([.]|\w)([.]|\w)([.]|\w)([.]|\w)\s(?P<format>\w{3,20})\s/", $output, $parsed);
// Verify output
if ($output === false || $output == 0)
{
return false;
}
return $parsed['format'];
}
/**
* Returns all video formats ffmpeg can decode
* @return array
*/
public static function getSupportedVideoDecoders()
{
// Run terminal command
$command = self::getConverterPath().' -decoders';
$output = shell_exec($command);
// PREG pattern to retrive version information
$output = preg_match_all("/[V]([.]|\w)([.]|\w)([.]|\w)([.]|\w)([.]|\w)\s(?P<format>\w{3,20})\s/", $output, $parsed);
// Verify output
if ($output === false || $output == 0)
{
return false;
}
return $parsed['format'];
}
/**
* Returns boolean if ffmpeg is able to encode to this format
* @param string $format ffmpeg format name
* @return boolean
*/
public static function canEncode($format)
{
$formats = array_merge(self::getSupportedAudioEncoders(), self::getSupportedVideoEncoders());
// Return boolean if they can be encoded or not
if(!in_array($format, $formats))
{
return false;
} else {
return true;
}
}
/**
* Returns boolean if ffmpeg is able to decode to this format
* @param string $format ffmpeg format name
* @return boolean
*/
public static function canDecode($format)
{
// Get an array with all supported encoding formats
$formats = array_merge(self::getSupportedAudioDecoders(), self::getSupportedVideoDecoders());
// Return boolean if they can be encoded or not
if(!in_array($format, $formats))
{
return false;
} else {
return true;
}
}
/**
* Returns array with file information
* @param string $input file input
* @param string $type output format
* @return array, json, xml, csv
*/
public static function getMediaInfo($input, $type = null)
{
// Just making sure everything goes smooth
if (substr($input, 0, 2) == '-i')
{
$input = substr($input, 3);
}
switch ($type)
{
case 'json':
$command = self::getProbePath().' -v quiet -print_format json -show_format -show_streams -pretty -i '.$input.' 2>&1';
$output = shell_exec($command);
$output = json_decode($output, true);
break;
case 'xml':
$command = self::getProbePath().' -v quiet -print_format xml -show_format -show_streams -pretty -i '.$input.' 2>&1';
$output = shell_exec($command);
break;
case 'csv':
$command = self::getProbePath().' -v quiet -print_format csv -show_format -show_streams -pretty -i '.$input.' 2>&1';
$output = shell_exec($command);
break;
default:
$command = self::getProbePath().' -v quiet -print_format json -show_format -show_streams -pretty -i '.$input.' 2>&1';
$output = shell_exec($command);
$output = json_decode($output, true);
break;
}
return $output;
}
/**
* Retrieves video thumbnails
* @param string $input video input
* @param string $output output filename
* @param integer $count number of thumbnails to generate
* @param string $format thumbnail format
* @return boolean
*/
public static function getThumbnails($input, $output, $count = 5, $format = 'png')
{
// Round user input
$count = round($count);
// Return false if user requests 0 frames or round function fails
if ($count < 1)
{
return false;
}
// Execute thumbnail generator command
$command = self::getConverterPath().' -i '.$input.' -vf "select=gt(scene\,0.5)" -frames:v '.$count.' -vsync vfr '.$output.'-%02d.'.$format;
shell_exec($command);
return true;
}
/**
* Retrieves video thumbnails
* @param string $input video input
* @param string $output output filename
* @param integer $count number of thumbnails to generate
* @param integer $duration video duration
* @param string $format thumbnail format
* @return boolean
*/
public static function thumbnify($input,$output, $count=5, $duration, $format = 'png')
{
//Get the timings for thumbs
$total=$duration/$count;
$total=round($total);
// Return false if user requests 0 frames or round function fails
if ($count < 1)
{
return false;
}
// Execute thumbnail generator command
$command = self::getConverterPath().' -i '.$input.' -vf fps=fps=1/'.$total.' '.$output.'-%02d.'.$format;
shell_exec($command);
return true;
}
/**
* Input files
* @var array
*/
protected $input = array();
/**
* Output files
* @var array
*/
protected $output = array();
/**
* Contains the combination of all parameters set by the user
* @var array
*/
protected $parameters = array();
/**
* Contains the job progress id
* @var string
*/
protected $progress;
/**
* Returns object instance for chainable methods
* @return object
*/
public static function convert()
{
$sonus = new Sonus;
return $sonus;
}
/**
* Sets the progress ID
* @param string $var progress id
* @return null
*/
public function progress($var)
{
// If value is null pass current timestamp
if (is_null($var))
{
$this->progress = date('U');
return $this;
} else {
$this->progress = $var;
return $this;
}
}
/**
* Adds an input file
* @param string $var filename
* @return boolean
*/
public function input($var)
{
// Value must be text
if (!is_string($var))
{
return false;
}
array_push($this->input, '-i '.$var);
return $this;
}
/**
* Adds an output file
* @param string $var filename
* @return boolean
*/
public function output($var)
{
// Value must be text
if (!is_string($var))
{
return false;
}
array_push($this->output, $var);
return $this;
}
/**
* Overwrite output file if it exists
* @param boolean $var
* @return boolean
*/
public function overwrite($var = true)
{
switch ($var)
{
case true:
array_push($this->parameters, '-y');
return $this;
break;
case false:
array_push($this->parameters, '-n');
return $this;
break;
default:
return false;
break;
}
}
/**
* Stop running FFMPEG after X seconds
* @param int $var seconds
* @return boolean
*/
public function timelimit($var)
{
// Value must be numeric
if (!is_numeric($var))
{
return false;
}
array_push($this->parameters, '-timelimit '.$var);
return $this;
}
/**
* Sets the codec used for the conversion
* https://trac.ffmpeg.org/wiki/AACEncodingGuide
* https://trac.ffmpeg.org/wiki/Encoding%20VBR%20(Variable%20Bit%20Rate)%20mp3%20audio
* @param string $var ffmpeg codec name
* @return boolean
*/
public function codec($var, $type = 'audio')
{
// Value must not be null
if (is_null($var))
{
return false;
}
switch($type)
{
case 'audio':
array_push($this->parameters, '-c:a '.$var);
return $this;
break;
case 'video':
array_push($this->parameters, '-c:v '.$var);
return $this;
break;
default:
return false;
break;
}
}
/**
* Sets the constant bitrate
* @param int $var bitrate
* @return boolean
*/
public function bitrate($var, $type = 'audio')
{
// Value must be numeric
if (!is_numeric($var))
{
return false;
}
switch ($type)
{
case 'audio':
array_push($this->parameters, '-b:a '.$var.'k');
return $this;
break;
case 'video':
array_push($this->parameters, '-b:v '.$var.'k');
return $this;
break;
default:
return false;
break;
}
}
/**
* Sets the number of audio channels
* https://trac.ffmpeg.org/wiki/AudioChannelManipulation
* @param string $var
* @return boolean
*/
public function channels($var)
{
// Value must be numeric
if (!is_numeric($var))
{
return false;
}
array_push($this->parameters, '-ac '.$var);
return $this;
}
/**
* Sets audio frequency rate
* http://ffmpeg.org/ffmpeg.html#Audio-Options
* @param int $var frequency
* @return boolean
*/
public function frequency($var)
{
// Value must be numeric
if (!is_numeric($var))
{
return false;
}
array_push($this->parameters, '-ar:a '.$var);
return $this;
}
/**
* Performs conversion
* @param string $arg user arguments
* @return string tracking code
* @return boolean false on error
*/
public function go($arg = null)
{
// Assign converter path
$ffmpeg = self::getConverterPath();
// Check if user provided raw arguments
if (is_null($arg))
{
// If not, use the prepared arguments
$arg = implode(' ', $this->parameters);
}
// Return input and output files
$input = implode(' ', $this->input);
$output = implode(' ', $this->output);
// Prepare the command
$cmd = escapeshellcmd($ffmpeg.' '.$input.' '.$arg.' '.$output);
// Check if progress reporting is enabled
if (Config::get('sonus::progress') === true)
{
// Get temp dir
$tmpdir = self::getTempPath();
// Get progress id
if (empty($this->progress))
{
// Create a default (unix timestamp)
$progress = date('U');
} else {
// Assign if it exists
$progress = $this->progress;
}
// Publish progress to this ID
$cmd = $cmd.' 1>"'.$tmpdir.$progress.'.sonustmp" 2>&1';
// Execute command
return shell_exec($cmd);
} else {
// Execute command
return shell_exec($cmd);
}
}
/**
* Returns given job progress
* @param string $job id
* @param string $format format to output data
* @return array
*/
public static function getProgress($job, $format = null)
{
// Get the temporary directory
$tmpdir = self::getTempPath();
// The code below has been adapted from Jimbo
// http://stackoverflow.com/questions/11441517/ffmpeg-progress-bar-encoding-percentage-in-php
$content = @file_get_contents($tmpdir.$job.'.sonustmp');
if($content)
{
// Get duration of source
preg_match("/Duration: (.*?), start:/", $content, $matches);
$rawDuration = $matches[1];
// rawDuration is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawDuration));
$duration = floatval($ar[0]);
if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;
// Get the time in the file that is already encoded
preg_match_all("/time=(.*?) bitrate/", $content, $matches);
$rawTime = array_pop($matches);
// This is needed if there is more than one match
if (is_array($rawTime))
{
$rawTime = array_pop($rawTime);
}
// rawTime is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawTime));
$time = floatval($ar[0]);
if (!empty($ar[1])) $time += intval($ar[1]) * 60;
if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;
// Calculate the progress
$progress = round(($time/$duration) * 100);
// Output to array
$output = array(
'Duration' => $rawDuration,
'Current' => $rawTime,
'Progress' => $progress
);
// Return data
switch ($format)
{
case 'array':
return $output;
break;
default:
return json_encode($output);
break;
}
} else {
return null;
}
}
/**
* Deletes job temporary file
* @param string $job id
* @return boolean
*/
public static function destroyProgress($job)
{
// Get temporary file path
$file = $tmpdir.$job.'.sonustmp';
// Check if file exists
if (is_file($file))
{
// Delete file
$output = unlink($tmpdir.$job.'.sonustmp');
return $output;
} else {
return false;
}
}
/**
* Deletes all temporary files
* @return boolean
*/
public static function destroyAllProgress()
{
// Get all filenames within the temporary folder
$files = glob($tmpdir.'*');
// Iterate through files
$output = array();
foreach ($files as $file)
{
if (is_file($file))
{
// Return result to array
$result = unlink($file);
array_push($output, var_export($result, true));
}
}
// If a file could not be deleted, return false
if (array_search('false', $output))
{
return false;
}
return true;
}
public function getVideoJsonDetails()
{
$ffprobe = self::getProbePath();
$input = implode(' ', $this->input);
$arg1=" -loglevel error -show_format -show_streams";
$arg2=" -print_format json";
$cmd = escapeshellcmd($ffprobe.' '.$arg1.' '.$input.' '.$arg2);
return shell_exec($cmd);
}
}
| mit |
joelengt/joelgt-blog-production | content/themes/avant/assets/portafolio/puls2015/move.js | 229 | var geo=navigator.geolocation;
var opciones={};
function geo_ok(gatito)
{
console.log(gatito);
}
function geo_error()
{
console.log("Lo siento no encontramos tu ubicacion");
}
geo.getCurrentPosition(geo_ok,geo_error,opciones);
| mit |
Azure/azure-sdk-for-ruby | management/azure_mgmt_security/lib/2017-08-01-preview/generated/azure_mgmt_security/security_contacts.rb | 26915 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Security::Mgmt::V2017_08_01_preview
#
# API spec for Microsoft.Security (Azure Security Center) resource provider
#
class SecurityContacts
include MsRestAzure
#
# Creates and initializes a new instance of the SecurityContacts class.
# @param client service class for accessing basic functionality.
#
def initialize(client)
@client = client
end
# @return [SecurityCenter] reference to the SecurityCenter
attr_reader :client
#
# Security contact configurations for the subscription
#
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array<SecurityContact>] operation results.
#
def list(custom_headers:nil)
first_page = list_as_lazy(custom_headers:custom_headers)
first_page.get_all_items
end
#
# Security contact configurations for the subscription
#
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_with_http_info(custom_headers:nil)
list_async(custom_headers:custom_headers).value!
end
#
# Security contact configurations for the subscription
#
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_async(custom_headers:nil)
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if [email protected]_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContactList.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [SecurityContact] operation results.
#
def get(security_contact_name, custom_headers:nil)
response = get_async(security_contact_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_with_http_info(security_contact_name, custom_headers:nil)
get_async(security_contact_name, custom_headers:custom_headers).value!
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_async(security_contact_name, custom_headers:nil)
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if [email protected]_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param security_contact [SecurityContact] Security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [SecurityContact] operation results.
#
def create(security_contact_name, security_contact, custom_headers:nil)
response = create_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param security_contact [SecurityContact] Security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def create_with_http_info(security_contact_name, security_contact, custom_headers:nil)
create_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param security_contact [SecurityContact] Security contact object
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def create_async(security_contact_name, security_contact, custom_headers:nil)
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if [email protected]_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
fail ArgumentError, 'security_contact is nil' if security_contact.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
request_content = @client.serialize(request_mapper, security_contact)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:put, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def delete(security_contact_name, custom_headers:nil)
response = delete_async(security_contact_name, custom_headers:custom_headers).value!
nil
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def delete_with_http_info(security_contact_name, custom_headers:nil)
delete_async(security_contact_name, custom_headers:custom_headers).value!
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def delete_async(security_contact_name, custom_headers:nil)
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if [email protected]_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:delete, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
result
end
promise.execute
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param security_contact [SecurityContact] Security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [SecurityContact] operation results.
#
def update(security_contact_name, security_contact, custom_headers:nil)
response = update_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param security_contact [SecurityContact] Security contact object
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def update_with_http_info(security_contact_name, security_contact, custom_headers:nil)
update_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
end
#
# Security contact configurations for the subscription
#
# @param security_contact_name [String] Name of the security contact object
# @param security_contact [SecurityContact] Security contact object
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def update_async(security_contact_name, security_contact, custom_headers:nil)
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if [email protected]_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
fail ArgumentError, 'security_contact is nil' if security_contact.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
request_content = @client.serialize(request_mapper, security_contact)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:patch, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Security contact configurations for the subscription
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [SecurityContactList] operation results.
#
def list_next(next_page_link, custom_headers:nil)
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Security contact configurations for the subscription
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_next_with_http_info(next_page_link, custom_headers:nil)
list_next_async(next_page_link, custom_headers:custom_headers).value!
end
#
# Security contact configurations for the subscription
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_next_async(next_page_link, custom_headers:nil)
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{nextLink}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
skip_encoding_path_params: {'nextLink' => next_page_link},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContactList.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Security contact configurations for the subscription
#
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [SecurityContactList] which provide lazy access to pages of the
# response.
#
def list_as_lazy(custom_headers:nil)
response = list_async(custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end
end
end
| mit |
markovandooren/jnome | src/org/aikodi/java/input/BytecodeClassParser.java | 336 | package org.aikodi.java.input;
import org.aikodi.chameleon.core.document.Document;
import org.aikodi.chameleon.core.lookup.LookupException;
import org.aikodi.chameleon.core.namespace.RootNamespace;
public interface BytecodeClassParser {
public Document read(Class clazz, RootNamespace root, Document doc) throws LookupException;
}
| mit |
rokon12/mNet2 | src/main/java/org/jugbd/mnet/exception/PatientNotFoundException.java | 349 | package org.jugbd.mnet.exception;
/**
* @author Bazlur Rahman Rokon
* @since 5/15/16.
*/
public class PatientNotFoundException extends RuntimeException {
public PatientNotFoundException(Long id) {
super("Patient not found by id - " + id);
}
public PatientNotFoundException(String message) {
super(message);
}
}
| mit |
zmingee/flaskell | {{cookiecutter.repo_name}}/tasks.py | 1521 | import os
import sys
import multiprocessing as mp
import tempfile
from invoke import task, run
from setup import NAME, VERSION
@task
def setup_virtualenv():
print('Creating virtualenv')
run('virtualenv -p /usr/local/bin/python3 env',
hide=True)
activate_this = 'env/bin/activate_this.py'
with open(activate_this) as f:
code = compile(f.read(), activate_this, 'exec')
exec(code, dict(__file__=activate_this))
run('pip install -r requirements.txt',
hide=True)
run('pip install -r devel-requirements.txt',
hide=True)
def clean_up(x):
return run('find . -name "{0}" | xargs rm -rf'.format(x))
@task
def clean():
print('Cleaning directories')
to_clean = (
'*.pyc',
'*.egg-info',
'.coverage',
'__pycache__',
'.tox',
'build',
'dist',
)
#results = list(map((lambda x: run('find . -name "{0}" | xargs rm -rf'.format(x))), to_clean))
pool = mp.Pool(processes=4)
results = [pool.apply(clean_up, args=(x,)) for x in to_clean]
@task(pre=[setup_virtualenv])
def run_debug():
"""
Run in local machine.
:return:
"""
print('Running debug server')
from werkzeug.serving import run_simple
from {{cookiecutter.repo_name}} import wsgi
run_simple('0.0.0.0', 5000, wsgi.APPLICATION, use_reloader=True, use_debugger=True)
@task
def tox():
"""
Run tox
:return:
"""
print('Running tox')
run('/usr/local/bin/tox --recreate')
| mit |
envoy93/Android-translate | app/src/test/java/shashov/translate/mvp/presenters/MainPresenterTest.java | 1798 | package shashov.translate.mvp.presenters;
import com.squareup.otto.Bus;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
import ru.terrakok.cicerone.Router;
import shashov.translate.RxTestUtils;
import shashov.translate.di.AppComponent;
import shashov.translate.mvp.views.MainView;
import shashov.translate.test.TestComponent;
import shashov.translate.test.TestComponentRule;
import static org.mockito.Mockito.verify;
@Config(manifest = Config.NONE)
public class MainPresenterTest {
@Rule
public TestComponentRule testComponentRule = new TestComponentRule(testAppComponent());
@Mock
MainView mainView;
@Mock
Bus eventBus;
@Mock
Router router;
private MainPresenter presenter;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
RxTestUtils.before();
presenter = new MainPresenter();
presenter.getAttachedViews().add(mainView);
}
@Test
public void showTranslate() {
presenter.attachView(mainView);
presenter.onClickTranslate();
verify(mainView).showTranslate();
}
@Test
public void showHistory() {
presenter.attachView(mainView);
presenter.onClickHistory();
verify(mainView).showHistory();
}
@After
public void tearDown() throws Exception {
RxTestUtils.after();
}
private AppComponent testAppComponent() {
return new TestComponent() {
@Override
public void inject(MainPresenter presenter) {
presenter.eventBus = eventBus;
presenter.router = router;
}
};
}
}
| mit |
schnittchen/gaq | spec-dummy/config/application.rb | 2860 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
# require "sprockets/railtie"
# require "rails/test_unit/railtie"
require 'gaq'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
# config.active_record.whitelist_attributes = true
end
end
| mit |
rdeokar88/angular-number-picker-new | angular-number-picker-new.js | 6220 | /**
*
* Defines `hNumberPicker` directive which can only be used as element.
*
* It allows end-user to choose number, instead of typing
*
* usage:
*
* <h-number value="input.num" min="1" max="10" step="1" change="onChange()"></h-number>
*
* @author Howard.Zuo
* @date July 22th, 2015
*
*/
(function(global) {
'use strict';
var definition = function(angular) {
var defaults = {
min: 0,
max: 100,
step: 1,
timeout: 600
};
var assign = function(dest, src) {
for (var key in src) {
if (!dest[key]) {
dest[key] = src[key];
}
}
return dest;
};
var isNumber = function(value) {
var val = Number(value);
return !isNaN(val) && val == value;
};
var toNumber = function(value) {
return Number(value);
};
var checkNumber = function(value) {
if (!isNumber(value)) {
throw new Error('value [' + value + '] is not a valid number');
}
};
var getTarget = function(e) {
if (e.touches && e.touches.length > 0) {
return angular.element(e.touches[0].target);
}
return angular.element(e.target);
};
var getType = function(e) {
return getTarget(e).attr('type');
};
var transform = function(opts) {
for (var key in opts) {
var value = opts[key];
opts[key] = toNumber(value);
}
};
var directive = function($timeout, $interval) {
return {
restrict: 'E',
scope: {
'value': '=',
'selectedItem' : '=',
'singular': '@',
'plural': '@',
'min': '@',
'max': '@',
'step': '@',
'change': '&'
},
link: function($scope, element) {
var opts = assign({
min: $scope.min,
max: $scope.max,
step: $scope.step
}, defaults);
checkNumber(opts.min);
checkNumber(opts.max);
checkNumber(opts.step);
transform(opts);
$scope.value = $scope.value;
$scope.selectedItem = $scope.selectedItem;
$scope.$watch('value', function(newValue) {
$scope.canDown = newValue > opts.min;
$scope.canUp = newValue < opts.max;
});
var changeNumber = function($event) {
var type = getType($event);
if ('up' === type) {
if ($scope.value >= opts.max) {
return;
}
$scope.value += opts.step;
} else if ('down' === type) {
if ($scope.value <= opts.min) {
return;
}
$scope.value -= opts.step;
}
if($scope.change()){
$scope.change()($scope.selectedItem , type);
}
};
var timeoutPro;
var intervalPro;
var start;
var end;
var addon = element.find('span');
addon.on('click', function(e) {
changeNumber(e);
$scope.$apply();
e.stopPropagation();
});
/*addon.on('touchstart', function(e) {
getTarget(e).addClass('active');
start = new Date().getTime();
timeoutPro = $timeout(function() {
intervalPro = $interval(function() {
changeNumber(e);
}, 200);
}, opts.timeout);
e.preventDefault();
});
addon.on('touchend', function(e) {
end = new Date().getTime();
if (intervalPro) {
$interval.cancel(intervalPro);
intervalPro = undefined;
}
if (timeoutPro) {
$timeout.cancel(timeoutPro);
timeoutPro = undefined;
}
if ((end - start) < opts.timeout) {
changeNumber(e);
$scope.$apply();
}
getTarget(e).removeClass('active');
});*/
$scope.$on('$destroy', function() {
addon.off('touchstart touchend click');
});
},
template: '<div class="input-group">' +
'<span class="input-group-addon" type="down" ng-disabled="!canDown">' +
' - </span>' +
'<label class="form-control">{{ value }} {{value === 1 ? singular : plural}}</label>' +
'<span class="input-group-addon" type="up" ng-disabled="!canUp">' +
' + </span>' +
'</div>'
};
};
var name = 'angularNumberPicker';
angular.module(name, [])
.directive('hNumber', ['$timeout', '$interval', directive]);
return name;
};
if (typeof exports === 'object') {
module.exports = definition(require('angular'));
} else if (typeof define === 'function' && define.amd) {
define(['angular'], definition);
} else {
definition(global.angular);
}
}(window));
| mit |
kherge-abandoned/lib-accessor | docs/1.0.0/2. Classes.md | 1422 | Classes
=======
This is a complete list of available classes:
- [`Phine\Accessor\Type\AbstractNullableType`](Phine/Accessor/Type/AbstractNullableType.md) — The basis for a nullable type class.
- [`Phine\Accessor\Type\ArrayType`](Phine/Accessor/Type/ArrayType.md) — A type class for the array value type.
- [`Phine\Accessor\Type\BooleanType`](Phine/Accessor/Type/BooleanType.md) — A type class for the boolean value type.
- [`Phine\Accessor\Type\CallableType`](Phine/Accessor/Type/CallableType.md) — A type class for a callable value.
- [`Phine\Accessor\Type\FloatType`](Phine/Accessor/Type/FloatType.md) — A type class for the float value type.
- [`Phine\Accessor\Type\InstanceType`](Phine/Accessor/Type/InstanceType.md) — A type class for instances of a specific class or interface.
- [`Phine\Accessor\Type\IntegerType`](Phine/Accessor/Type/IntegerType.md) — A type class for the integer value type.
- [`Phine\Accessor\Type\MixedType`](Phine/Accessor/Type/MixedType.md) — A type class for any value type.
- [`Phine\Accessor\Type\ObjectType`](Phine/Accessor/Type/ObjectType.md) — A type class for the object value type.
- [`Phine\Accessor\Type\ResourceType`](Phine/Accessor/Type/ResourceType.md) — A type class for the resource value type.
- [`Phine\Accessor\Type\StringType`](Phine/Accessor/Type/StringType.md) — A type class for the string value type.
| mit |
oicawa/tames | resources/core/Control/Field/List.js | 1895 | define(function (require) {
require("jquery");
require("w2ui");
var Utils = require("core/Utils");
var Locale = require("core/Locale");
var Uuid = require("core/Uuid");
var Class = require("core/Class");
var Storage = require("core/Storage");
var Dialog = require("core/Dialog");
var Inherits = require("core/Inherits");
var List_ = require("core/Control/List");
var Field = require("core/Control/Field/Field");
var app = require("core/app");
var TEMPLATE = '<div></div>';
function List() {
Field.call(this, "core/Control/Field", "List");
this._list = null;
};
Inherits(List, Field);
List.prototype.init = function(selector, field) {
var dfd = new $.Deferred;
var root = $(selector);
if (0 < root.children()) {
dfd.resolve();
return dfd.promise();
}
root.append(TEMPLATE);
var options = Utils.get_as_json(
{ "class_id" : null, "embedded" : false, "width" : 500, "height" : 200, "actions" : [], "toolbar_items" : [] },
function() { return field.datatype.properties; }
);
// Create controls
this._list = new List_();
this._list.init(selector + " > div", options)
.then(function() {
dfd.resolve();
});
return dfd.promise();
};
List.prototype.backup = function() {
return this._list.backup();
};
List.prototype.commit = function() {
this._list.commit();
};
List.prototype.restore = function() {
this._list.restore();
};
List.prototype.edit = function(on) {
this._list.edit(on);
};
List.prototype.data = function(values) {
if (arguments.length == 0) {
return this._list.data();
} else {
this._list.data(values);
}
};
List.prototype.refresh = function(on) {
this._list.refresh();
};
return List;
});
| mit |
UtainW/storyblog | .phpstorm.meta.php | 38332 | <?php
namespace PHPSTORM_META {
/**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on 2015-12-05.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
$STATIC_METHOD_TYPES = [
new \Illuminate\Contracts\Container\Container => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Illuminate\Auth\Guard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
],
\Illuminate\Contracts\Container\Container::make('') => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Illuminate\Auth\Guard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
],
\App::make('') => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Illuminate\Auth\Guard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
],
app('') => [
'' == '@',
'events' instanceof \Illuminate\Events\Dispatcher,
'router' instanceof \Illuminate\Routing\Router,
'url' instanceof \Illuminate\Routing\UrlGenerator,
'redirect' instanceof \Illuminate\Routing\Redirector,
'Illuminate\Contracts\Routing\ResponseFactory' instanceof \Illuminate\Routing\ResponseFactory,
'Illuminate\Contracts\Http\Kernel' instanceof \App\Http\Kernel,
'Illuminate\Contracts\Console\Kernel' instanceof \App\Console\Kernel,
'Illuminate\Contracts\Debug\ExceptionHandler' instanceof \App\Exceptions\Handler,
'Psr\Log\LoggerInterface' instanceof \Monolog\Logger,
'auth' instanceof \Illuminate\Auth\AuthManager,
'auth.driver' instanceof \Illuminate\Auth\Guard,
'Illuminate\Contracts\Auth\Access\Gate' instanceof \Illuminate\Auth\Access\Gate,
'illuminate.route.dispatcher' instanceof \Illuminate\Routing\ControllerDispatcher,
'cookie' instanceof \Illuminate\Cookie\CookieJar,
'Illuminate\Contracts\Queue\EntityResolver' instanceof \Illuminate\Database\Eloquent\QueueEntityResolver,
'db.factory' instanceof \Illuminate\Database\Connectors\ConnectionFactory,
'db' instanceof \Illuminate\Database\DatabaseManager,
'encrypter' instanceof \Illuminate\Encryption\Encrypter,
'files' instanceof \Illuminate\Filesystem\Filesystem,
'filesystem' instanceof \Illuminate\Filesystem\FilesystemManager,
'filesystem.disk' instanceof \Illuminate\Filesystem\FilesystemAdapter,
'session' instanceof \Illuminate\Session\SessionManager,
'session.store' instanceof \Illuminate\Session\Store,
'Illuminate\Session\Middleware\StartSession' instanceof \Illuminate\Session\Middleware\StartSession,
'validation.presence' instanceof \Illuminate\Validation\DatabasePresenceVerifier,
'view.engine.resolver' instanceof \Illuminate\View\Engines\EngineResolver,
'view.finder' instanceof \Illuminate\View\FileViewFinder,
'view' instanceof \Illuminate\View\Factory,
'command.app.name' instanceof \Illuminate\Foundation\Console\AppNameCommand,
'command.clear-compiled' instanceof \Illuminate\Foundation\Console\ClearCompiledCommand,
'command.command.make' instanceof \Illuminate\Foundation\Console\CommandMakeCommand,
'command.config.cache' instanceof \Illuminate\Foundation\Console\ConfigCacheCommand,
'command.config.clear' instanceof \Illuminate\Foundation\Console\ConfigClearCommand,
'command.console.make' instanceof \Illuminate\Foundation\Console\ConsoleMakeCommand,
'command.event.generate' instanceof \Illuminate\Foundation\Console\EventGenerateCommand,
'command.event.make' instanceof \Illuminate\Foundation\Console\EventMakeCommand,
'command.down' instanceof \Illuminate\Foundation\Console\DownCommand,
'command.environment' instanceof \Illuminate\Foundation\Console\EnvironmentCommand,
'command.handler.command' instanceof \Illuminate\Foundation\Console\HandlerCommandCommand,
'command.handler.event' instanceof \Illuminate\Foundation\Console\HandlerEventCommand,
'command.job.make' instanceof \Illuminate\Foundation\Console\JobMakeCommand,
'command.key.generate' instanceof \Illuminate\Foundation\Console\KeyGenerateCommand,
'command.listener.make' instanceof \Illuminate\Foundation\Console\ListenerMakeCommand,
'command.model.make' instanceof \Illuminate\Foundation\Console\ModelMakeCommand,
'command.optimize' instanceof \Illuminate\Foundation\Console\OptimizeCommand,
'command.policy.make' instanceof \Illuminate\Foundation\Console\PolicyMakeCommand,
'command.provider.make' instanceof \Illuminate\Foundation\Console\ProviderMakeCommand,
'command.request.make' instanceof \Illuminate\Foundation\Console\RequestMakeCommand,
'command.route.cache' instanceof \Illuminate\Foundation\Console\RouteCacheCommand,
'command.route.clear' instanceof \Illuminate\Foundation\Console\RouteClearCommand,
'command.route.list' instanceof \Illuminate\Foundation\Console\RouteListCommand,
'command.serve' instanceof \Illuminate\Foundation\Console\ServeCommand,
'command.test.make' instanceof \Illuminate\Foundation\Console\TestMakeCommand,
'command.tinker' instanceof \Illuminate\Foundation\Console\TinkerCommand,
'command.up' instanceof \Illuminate\Foundation\Console\UpCommand,
'command.vendor.publish' instanceof \Illuminate\Foundation\Console\VendorPublishCommand,
'command.view.clear' instanceof \Illuminate\Foundation\Console\ViewClearCommand,
'Illuminate\Broadcasting\BroadcastManager' instanceof \Illuminate\Broadcasting\BroadcastManager,
'Illuminate\Bus\Dispatcher' instanceof \Illuminate\Bus\Dispatcher,
'cache' instanceof \Illuminate\Cache\CacheManager,
'cache.store' instanceof \Illuminate\Cache\Repository,
'memcached.connector' instanceof \Illuminate\Cache\MemcachedConnector,
'command.cache.clear' instanceof \Illuminate\Cache\Console\ClearCommand,
'command.cache.table' instanceof \Illuminate\Cache\Console\CacheTableCommand,
'command.auth.resets.clear' instanceof \Illuminate\Auth\Console\ClearResetsCommand,
'migration.repository' instanceof \Illuminate\Database\Migrations\DatabaseMigrationRepository,
'migrator' instanceof \Illuminate\Database\Migrations\Migrator,
'command.migrate' instanceof \Illuminate\Database\Console\Migrations\MigrateCommand,
'command.migrate.rollback' instanceof \Illuminate\Database\Console\Migrations\RollbackCommand,
'command.migrate.reset' instanceof \Illuminate\Database\Console\Migrations\ResetCommand,
'command.migrate.refresh' instanceof \Illuminate\Database\Console\Migrations\RefreshCommand,
'command.migrate.install' instanceof \Illuminate\Database\Console\Migrations\InstallCommand,
'migration.creator' instanceof \Illuminate\Database\Migrations\MigrationCreator,
'command.migrate.make' instanceof \Illuminate\Database\Console\Migrations\MigrateMakeCommand,
'command.migrate.status' instanceof \Illuminate\Database\Console\Migrations\StatusCommand,
'command.seed' instanceof \Illuminate\Database\Console\Seeds\SeedCommand,
'command.seeder.make' instanceof \Illuminate\Database\Console\Seeds\SeederMakeCommand,
'seeder' instanceof \Illuminate\Database\Seeder,
'composer' instanceof \Illuminate\Foundation\Composer,
'command.queue.table' instanceof \Illuminate\Queue\Console\TableCommand,
'command.queue.failed' instanceof \Illuminate\Queue\Console\ListFailedCommand,
'command.queue.retry' instanceof \Illuminate\Queue\Console\RetryCommand,
'command.queue.forget' instanceof \Illuminate\Queue\Console\ForgetFailedCommand,
'command.queue.flush' instanceof \Illuminate\Queue\Console\FlushFailedCommand,
'command.queue.failed-table' instanceof \Illuminate\Queue\Console\FailedTableCommand,
'command.controller.make' instanceof \Illuminate\Routing\Console\ControllerMakeCommand,
'command.middleware.make' instanceof \Illuminate\Routing\Console\MiddlewareMakeCommand,
'command.session.database' instanceof \Illuminate\Session\Console\SessionTableCommand,
'hash' instanceof \Illuminate\Hashing\BcryptHasher,
'mailer' instanceof \Illuminate\Mail\Mailer,
'Illuminate\Contracts\Pipeline\Hub' instanceof \Illuminate\Pipeline\Hub,
'queue' instanceof \Illuminate\Queue\QueueManager,
'queue.connection' instanceof \Illuminate\Queue\SyncQueue,
'command.queue.work' instanceof \Illuminate\Queue\Console\WorkCommand,
'command.queue.restart' instanceof \Illuminate\Queue\Console\RestartCommand,
'queue.worker' instanceof \Illuminate\Queue\Worker,
'command.queue.listen' instanceof \Illuminate\Queue\Console\ListenCommand,
'queue.listener' instanceof \Illuminate\Queue\Listener,
'command.queue.subscribe' instanceof \Illuminate\Queue\Console\SubscribeCommand,
'queue.failer' instanceof \Illuminate\Queue\Failed\DatabaseFailedJobProvider,
'IlluminateQueueClosure' instanceof \IlluminateQueueClosure,
'auth.password' instanceof \Illuminate\Auth\Passwords\PasswordBroker,
'auth.password.tokens' instanceof \Illuminate\Auth\Passwords\DatabaseTokenRepository,
'translation.loader' instanceof \Illuminate\Translation\FileLoader,
'translator' instanceof \Illuminate\Translation\Translator,
'command.ide-helper.generate' instanceof \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand,
'command.ide-helper.models' instanceof \Barryvdh\LaravelIdeHelper\Console\ModelsCommand,
'command.ide-helper.meta' instanceof \Barryvdh\LaravelIdeHelper\Console\MetaCommand,
'blade.compiler' instanceof \Illuminate\View\Compilers\BladeCompiler,
],
];
}
| mit |
pducks32/nelson | lib/nelson/expression_builders/multipication_expression_builder.rb | 154 |
module Nelson
class MultipicationExpressionBuilder < ExpressionBuilder
def build
MultipicationExpression.new(*built_terms)
end
end
end
| mit |
hhaslam11/Visual-Basic-Projects | Olympic Rings/Olympic Rings/My Project/AssemblyInfo.vb | 1170 | Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Olympic Rings")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Nechako Lakes")>
<Assembly: AssemblyProduct("Olympic Rings")>
<Assembly: AssemblyCopyright("Copyright © Nechako Lakes 2014")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("507de5c1-cc24-43db-a0e1-8f5a7d196a72")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
| mit |
SamuelYvon/BrainCramp | Java/src/com/samuelyvon/BrainCramp/Compilation/nasm/Segment.java | 800 | package com.samuelyvon.braincramp.compilation.nasm;
import java.util.ArrayList;
import java.util.List;
public class Segment {
private final String name;
private final List<NASMInstruction> instructions;
public Segment(String name) {
this.name = name;
this.instructions = new ArrayList<>();
}
public void toStringBuilder(StringBuilder sb) {
sb.append("section .").append(name);
sb.append("\n\r");
for(NASMInstruction instr : instructions) {
sb.append("\t");
instr.toStringBuilder(sb);
}
}
public void addInstruction(Object... words) {
instructions.add(new NASMInstruction(words));
}
public void addInstruction(NASMInstruction instr) {
instructions.add(instr);
}
}
| mit |
sethvincent/javascripting | problems/object-properties/problem_fr.md | 969 | Vous pouvez manipuler les propriétés d'objets — les clés et valeurs qu'un objet contient — en utilisant des méthodes très similaires aux tableaux.
Voici un example utilisant des **crochets** :
```js
const example = {
pizza: 'yummy'
}
console.log(example['pizza'])
```
Le code ci-dessus va afficher la chaine de caractères `yummy` dans le terminal.
Une alternative consiste à utiliser la **notation en point** pour avoir le même résultat :
```js
example.pizza
example['pizza']
```
Les deux lignes de code ci-dessus renverront `yummy`.
## Le défi :
Créez un fichier nommé `proprietes-objet.js`.
Dans ce fichier, définissez une variable nommée `food` comme ceci :
```js
const food = {
types: 'only pizza'
}
```
Utilisez `console.log()` pour afficher la propriété `types` de l'objet `food` dans le terminal.
Vérifiez si votre programme est correct en exécutant la commande :
```bash
javascripting verify proprietes-objet.js
```
| mit |
comet/Kassi_Desktop | spec/models/badge_notification_spec.rb | 239 | require 'spec_helper'
describe BadgeNotification do
before(:each) do
@badge_notification = Factory.build(:badge_notification)
end
it "is valid with valid attributes" do
@badge_notification.should be_valid
end
end
| mit |
landrade/feed-mensagens-node-js | feed/Makefile | 41 | run:
npm install
npm start
.PHONY: run | mit |
MewesK/WebRedirector | src/MewesK/WebRedirectorBundle/MewesKWebRedirectorBundle.php | 146 | <?php
namespace MewesK\WebRedirectorBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MewesKWebRedirectorBundle extends Bundle
{
}
| mit |
BrianGuilardi/sjsu-cs158b-2010-noname | noname.py | 1274 | #!/usr/bin/env python
# Copyright (c) 2010 Arthur Mesh
# 2010 Christopher Nelson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from widgets.window import Window
def main():
window = Window()
window.run()
if __name__ == '__main__':
main()
| mit |
Flownative/flow-aws-s3 | README.md | 12972 | [](http://opensource.org/licenses/MIT)
[](https://packagist.org/packages/flownative/aws-s3)
[](https://www.flownative.com/en/products/open-source.html)
# AWS S3 Adaptor for Neos and Flow
This [Flow](https://flow.neos.io) package allows you to store assets (resources) in [Amazon's S3](https://aws.amazon.com/s3/)
or S3-compatible storages and publish resources to S3 or [Cloudfront](https://aws.amazon.com/cloudfront/). Because
[Neos CMS](https://www.neos.io) is using Flow's resource management under the hood, this adaptor also works nicely for
all kinds of assets in Neos.
## Key Features
- store all assets or only a specific collection in a private S3 bucket
- publish assets to a private or public S3 bucket
- command line interface for basic tasks like connection check or emptying an S3 bucket
Using this connector, you can run a Neos website which does not store any asset (images, PDFs etc.) on your local webserver.
## Installation
The Flownative AWS S3 connector is installed as a regular Flow package via Composer. For your existing project, simply
include `flownative/aws-s3` into the dependencies of your Flow or Neos distribution:
```bash
$ composer require flownative/aws-s3:2.*
```
## Configuration
In order to communicate with the AWS web service, you need to provide the credentials of an account which has access
to S3 (see next section for instructions for setting up the user in AWS IAM). Add the following configuration to the
`Settings.yaml` for your desired Flow context (for example in `Configuration/Production/Settings.yaml`) and make sure
to replace key, secret and region with your own data:
```yaml
Flownative:
Aws:
S3:
profiles:
default:
credentials:
key: 'CD2ADVB134LQ9SFICAJB'
secret: 'ak1KJAnotasecret9JamNkwYY188872MyljWJ'
region: 'eu-central-1'
```
You can test your settings by executing the `connect` command. If you restricted access to a particular sub path of
a bucket, you must specify the bucket and key prefix:
```bash
$ ./flow s3:connect --bucket test.storage.net --prefix sites/s3-test/
Access list of objects in bucket "test.storage.neos" with key prefix "sites/s3-test/" ...
Writing test object into bucket (arn:aws:s3:::test.storage.neos/sites/s3-test/Flownative.Aws.S3.ConnectionTest.txt) ...
Deleting test object from bucket ...
OK
```
Note that it does make a difference if you specify the prefix with a leading slash "/" or without, because the corresponding
policy must match the pattern correctly, as you can see in the next section.
Right now, you can only define one connection profile, namely the "default" profile. Additional profiles may be supported
in future versions.
## IAM Setup
It is best practice to create a user through AWS' Identity and Access Management which is exclusively used for your
Flow or Neos instance to communicate with S3. This user needs minimal access rights, which can be defined either by
an inline policy or through membership at a group which has the respective policy applied.
The following inline policy provides the necessary rights to the user to execute all necessary operations for asset
management in Neos. It is designed to share one bucket with multiple sites / users and only grants access to a specific
sub path within your bucket. By using using the username as a path segment through a [policy variable](http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html),
this policy can be reused across multiple users (for example by providing it in a IAM Group).
For more detail on the rights used in the policy, Amazon provides detailed information about [how S3 authorizes a request
for a bucket operation](http://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-auth-workflow-bucket-operation.html).
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::test.storage.neos",
"arn:aws:s3:::test.target.neos"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"",
"sites/",
"sites/${aws:username}/"
]
}
}
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectExtended",
"s3:GetObjectTorrent",
"s3:PutObject",
"s3:PutObjectInline",
"s3:DeleteObject",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts",
"s3:GetObjectAcl",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::test.storage.neos/*",
"arn:aws:s3:::test.target.neos/*"
]
}
]
}
```
## Publish Assets to S3 / Cloudfront
Once the connector package is in place, you add a new publishing target which uses that connect and assign this target
to your collection.
```yaml
Neos:
Flow:
resource:
collections:
persistent:
target: 'cloudFrontPersistentResourcesTarget'
targets:
cloudFrontPersistentResourcesTarget:
target: 'Flownative\Aws\S3\S3Target'
targetOptions:
bucket: 'target.neos.example.com'
keyPrefix: '/'
baseUri: 'https://abc123def456.cloudfront.net/'
```
Since the new publishing target will be empty initially, you need to publish your assets to the new target by using the
``resource:publish`` command:
```bash
path$ ./flow resource:publish
```
This command will upload your files to the target and use the calculated remote URL for all your assets from now on.
## Switching the Storage of a Collection
If you want to migrate from your default local filesystem storage to a remote storage, you need to copy all your existing
persistent resources to that new storage and use that storage afterwards by default.
You start by adding a new storage with the S3 connector to your configuration. As you might want also want to serve your
assets by the remote storage system, you also add a target that contains your published resources.
```yaml
Neos:
Flow:
resource:
storages:
s3PersistentResourcesStorage:
storage: 'Flownative\Aws\S3\S3Storage'
storageOptions:
bucket: 'storage.neos.example.com'
keyPrefix: 'sites/wwwexamplecom/'
targets:
s3PersistentResourcesTarget:
target: 'Flownative\Aws\S3\S3Target'
targetOptions:
bucket: 'target.neos.example.com'
keyPrefix: 'sites/wwwexamplecom/'
baseUri: 'https://abc123def456.cloudfront.net/'
```
Some notes regarding the configuration:
You must create separate buckets for storage and target respectively, because the storage will remain private and the
target will potentially be published. Even if it might work using one bucket for both, this is a non-supported setup.
The `keyPrefix` option allows you to share one bucket accross multiple websites or applications. All S3 objects keys
will be prefiexd by the given string.
The `baseUri` option defines the root of the publicly accessible address pointing to your published resources. In the
example above, baseUri points to a Cloudfront subdomain which needs to be set up separately. It is rarely a good idea to
the public URI of S3 objects directly (like, for example "https://s3.eu-central-1.amazonaws.com/target.neos.example.com/sites/wwwexamplecom/00889c4636cd77876e154796d469955e567ce23c/NeosCMS-2507x3347.jpg") because S3 is usually too slow for being used as a server for common assets on your website. It's good for downloads, but not for your CSS files or photos.
In order to copy the resources to the new storage we need a temporary collection that uses the storage and the new
publication target.
```yaml
Neos:
Flow:
resource:
collections:
tmpNewCollection:
storage: 's3PersistentResourcesStorage'
target: 's3PersistentResourcesTarget'
```
Now you can use the ``resource:copy`` command (available in Flow 3.1 or Neos 2.1 and higher):
```bash
$ ./flow resource:copy --publish persistent tmpNewCollection
```
This will copy all your files from your current storage (local filesystem) to the new remote storage. The ``--publish``
flag means that this command also publishes all the resources to the new target, and you have the same state on your
current storage and publication target as on the new one.
Now you can overwrite your old collection configuration and remove the temporary one:
```yaml
Neos:
Flow:
resource:
collections:
persistent:
storage: 's3PersistentResourcesStorage'
target: 's3PersistentResourcesTarget'
```
Clear caches and you're done.
```bash
$ ./flow flow:cache:flush
```
## Full Example Configuration for S3
```yaml
Neos:
Flow:
resource:
storages:
s3PersistentResourcesStorage:
storage: 'Flownative\Aws\S3\S3Storage'
storageOptions:
bucket: 'storage.neos.prd.fra.flownative.net'
keyPrefix: 'flownative/wwwneosio/'
collections:
# Collection which contains all persistent resources
persistent:
storage: 's3PersistentResourcesStorage'
target: 's3PersistentResourcesTarget'
targets:
localWebDirectoryPersistentResourcesTarget:
target: 'Neos\Flow\ResourceManagement\Target\FileSystemTarget'
targetOptions:
path: '%FLOW_PATH_WEB%_Resources/Persistent/'
baseUri: '_Resources/Persistent/'
subdivideHashPathSegment: false
s3PersistentResourcesTarget:
target: 'Flownative\Aws\S3\S3Target'
targetOptions:
bucket: 'target.neos.prd.fra.flownative.net'
keyPrefix: 'flownative/wwwneosio/'
baseUri: 'https://12345abcde6789.cloudfront.net/'
Flownative:
Aws:
S3:
profiles:
default:
signature: 'v4'
credentials:
key: 'QD2AD2B134LQ9SF1CAJB'
secret: 'ak1KJAnotasecret9JamNkwYY188872MyljWJ'
region: 'eu-central-1'
```
## Using Google Cloud Storage
Google Cloud Storage (GCS) is an offering by Google which is very similar to AWS S3. In fact, GCS supports an S3-compatible
endpoint which allows you to use Google's storage as a replacement for Amazon's S3. However, note that if you
access GCS through the S3 compatible service endpoint, you won't be able to use the full feature set of Google Cloud
Storage and you cannot easily restrict access for different users to specific buckets or sub paths.
GCS does not have a limit for the number of buckets you can have for one account, therefore you don't necessarily need
to share buckets across sites or projects. The following instructions assume that you use one dedicated bucket for
your Neos or Flow project.
To enable S3 support, go to your Google Cloud Storage console and enable interoperability in the Settings panel. Once
this mode is enabled, you can create one or more access keys which you can use for accessing GCS through the S3
endpoint.

You can then use the generated key and secret in the settings of the S3 connector. Additionally to the usual credentials,
you need to specify a custom endpoint which refers to Google's S3 compatibility service.
```yaml
Flownative:
Aws:
S3:
profiles:
# Default credentials and client options
# Override these in your settings with real values
default:
credentials:
key: 'GOOGABCDEFG123456789'
secret: 'abcdefgHIJKLMNOP1234567890QRSTUVWXYZabcd'
endpoint: 'https://storage.googleapis.com/mybucket.flownative.net'
```
| mit |
AEDA-Solutions/matweb | frontend/Arquivos/ementa-3403.html | 992 | <table width="90%" border="0" cellspacing="0" cellpadding="3" class="FrameCinza"><tr class="padrao" bgcolor="white"><td><b>Órgão:</b> </td><td>ENE - Departamento de Engenharia Elétrica.</td></tr><tr class="padrao" bgcolor="#E7F3D6"><td><b>Código:</b> </td><td>112313</td></tr><tr class="padrao" bgcolor="white"><td><b>Denominação:</b> </td><td>Eletrônica 2</td></tr><tr class="padrao" bgcolor="#E7F3D6"><td><b>Nível:</b> </td><td>Graduação</td></tr><tr class="padrao" bgcolor="white"><td><b>Vigência:</b> </td><td>1979/1</td></tr><tr class="padrao" bgcolor="#E7F3D6"><td valign="top"><b>Pré-req:</b> </td><td class="PadraoMenor">ENE-111791 Circuitos Elétricos 2 E<br>ENE-111805 Lab de Circuitos Elétricos 2 E<br>ENE-111856 Eletrônica E<br>ENE-111864 Laboratório de Eletrônica OU<br>ENE-111791 Circuitos Elétricos 2 E<br>ENE-111805 Lab de Circuitos Elétricos 2 E<br>ENE-111724 Dispositivos e Circuitos Eletr E<br>ENE-111732 Lab Disp Circuitos Eletrônicos </td></tr></table> | mit |
zerojay/RetroPie-Extra | scriptmodules/ports/openjazz.sh | 1800 | #!/usr/bin/env bash
# This file is part of The RetroPie Project
#
# The RetroPie Project is the legal property of its developers, whose names are
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
#
# See the LICENSE.md file at the top-level directory of this distribution and
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
#
rp_module_id="openjazz"
rp_module_desc="OpenJazz - An enhanced Jazz Jackrabbit source port"
rp_module_licence="GPL2 https://raw.githubusercontent.com/AlisterT/openjazz/master/COPYING"
rp_module_help="For playing the registered version, replace the shareware files by adding your full version game files to $romdir/ports/openjazz/."
rp_module_section="exp"
function depends_openjazz() {
getDepends cmake libsdl1.2-dev libsdl-net1.2-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev timidity freepats unzip libxmp-dev
}
function sources_openjazz() {
gitPullOrClone "$md_build" https://github.com/AlisterT/openjazz.git
}
function build_openjazz() {
cd "$md_build"
make
md_ret_require="$md_build/"
}
function install_openjazz() {
md_ret_files=(
'OpenJazz'
'openjazz.000'
)
}
function configure_openjazz() {
mkRomDir "ports/openjazz"
moveConfigDir "$home/.openjazz" "$md_conf_root/openjazz"
moveConfigFile "$home/openjazz.cfg" "$md_conf_root/openjazz/openjazz.cfg"
if [[ ! -f "$romdir/ports/jazz/JAZZ.EXE" ]]; then
downloadAndExtract "https://image.dosgamesarchive.com/games/jazz.zip" "$romdir/ports/openjazz"
chown -R $user:$user "$romdir/ports/openjazz"
fi
addPort "$md_id" "openjazz" "OpenJazz - An enhanced Jazz Jackrabbit source port" "$md_inst/OpenJazz HOMEDIR $romdir/ports/openjazz"
}
| mit |
InnovateUKGitHub/innovation-funding-service | ifs-web-service/ifs-competition-mgt-service/src/main/java/org/innovateuk/ifs/management/assessor/form/InviteNewAssessorsForm.java | 2018 | package org.innovateuk.ifs.management.assessor.form;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import javax.validation.constraints.NotEmpty;
import org.innovateuk.ifs.controller.BaseBindingResultTarget;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
public class InviteNewAssessorsForm extends BaseBindingResultTarget {
@Valid
@NotEmpty(message = "{validation.inviteNewAssessorsForm.invites.required}")
private List<InviteNewAssessorsRowForm> invites = new ArrayList<>();
@NotNull(message = "{validation.inviteNewAssessorsForm.selectedInnovationArea.required}")
private Long selectedInnovationArea;
private boolean visible = false;
public List<InviteNewAssessorsRowForm> getInvites() {
return invites;
}
public void setInvites(List<InviteNewAssessorsRowForm> invites) {
this.invites = invites;
}
public Long getSelectedInnovationArea() {
return selectedInnovationArea;
}
public void setSelectedInnovationArea(Long selectedInnovationArea) {
this.selectedInnovationArea = selectedInnovationArea;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
InviteNewAssessorsForm that = (InviteNewAssessorsForm) o;
return new EqualsBuilder()
.append(selectedInnovationArea, that.selectedInnovationArea)
.append(invites, that.invites)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(invites)
.append(selectedInnovationArea)
.toHashCode();
}
}
| mit |
Seanstoppable/apidoc | generated/app/BryzekApidocApiV0Client.scala | 169107 | /**
* Generated by apidoc - http://www.apidoc.me
* Service version: 0.11.48
* apidoc:0.11.47 http://www.apidoc.me/bryzek/apidoc-api/0.11.48/play_2_4_client
*/
package com.bryzek.apidoc.api.v0.models {
/**
* Represents a single diff in an application
*/
sealed trait Diff
/**
* Identifies the specific type of item that was indexed by search
*/
sealed trait ItemDetail
/**
* An application has a name and multiple versions of its API.
*/
case class Application(
guid: _root_.java.util.UUID,
organization: com.bryzek.apidoc.common.v0.models.Reference,
name: String,
key: String,
visibility: com.bryzek.apidoc.api.v0.models.Visibility,
description: _root_.scala.Option[String] = None,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class ApplicationForm(
name: String,
key: _root_.scala.Option[String] = None,
description: _root_.scala.Option[String] = None,
visibility: com.bryzek.apidoc.api.v0.models.Visibility
)
/**
* Summary of an application sufficient for display and links
*/
case class ApplicationSummary(
guid: _root_.java.util.UUID,
organization: com.bryzek.apidoc.common.v0.models.Reference,
key: String
) extends ItemDetail
/**
* Attributes are globally unique key which allow users to specify additional
* content to pass in to the code generators.
*/
case class Attribute(
guid: _root_.java.util.UUID,
name: String,
description: _root_.scala.Option[String] = None,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class AttributeForm(
name: String,
description: _root_.scala.Option[String] = None
)
case class AttributeSummary(
guid: _root_.java.util.UUID,
name: String
)
/**
* Attribute values can be set at different levels. Initially we support setting
* organization wide attributes, but in the future plan to support setting
* attribute values with each version of the application.
*/
case class AttributeValue(
guid: _root_.java.util.UUID,
attribute: com.bryzek.apidoc.api.v0.models.AttributeSummary,
value: String,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class AttributeValueForm(
value: String
)
/**
* Represents a single change from one version of a service to another
*/
case class Change(
guid: _root_.java.util.UUID,
organization: com.bryzek.apidoc.common.v0.models.Reference,
application: com.bryzek.apidoc.common.v0.models.Reference,
fromVersion: com.bryzek.apidoc.api.v0.models.ChangeVersion,
toVersion: com.bryzek.apidoc.api.v0.models.ChangeVersion,
diff: com.bryzek.apidoc.api.v0.models.Diff,
changedAt: _root_.org.joda.time.DateTime,
changedBy: com.bryzek.apidoc.api.v0.models.UserSummary,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
/**
* Represents a simpler model of a version specifically for the use case of
* displaying changes
*/
case class ChangeVersion(
guid: _root_.java.util.UUID,
version: String
)
/**
* Separate resource used only for the few actions that require the full token.
*/
case class CleartextToken(
token: String
)
/**
* Generated source code.
*/
case class Code(
generator: com.bryzek.apidoc.api.v0.models.GeneratorWithService,
source: String,
files: Seq[com.bryzek.apidoc.generator.v0.models.File] = Nil
)
/**
* Represents a single breaking diff of an application version. A breaking diff
* indicates that it is possible for an existing client to now experience an error
* or invalid data due to the diff.
*/
case class DiffBreaking(
description: String
) extends Diff
/**
* Represents a single NON breaking diff of an application version.
*/
case class DiffNonBreaking(
description: String
) extends Diff
/**
* Represents a single domain name (e.g. www.apidoc.me). When a new user registers
* and confirms their email, we automatically associate that user with a member of
* the organization associated with their domain. For example, if you confirm your
* account with an email address of [email protected], we will automatically create a
* membership request on your behalf to join the organization with domain
* bryzek.com.
*/
case class Domain(
name: String
)
/**
* Data used to confirm an email address. The token is an internal unique
* identifier used to lookup the specific email address and user account for which
* we sent an email verification email.
*/
case class EmailVerificationConfirmationForm(
token: String
)
case class Error(
code: String,
message: String
)
case class GeneratorForm(
serviceGuid: _root_.java.util.UUID,
generator: com.bryzek.apidoc.generator.v0.models.Generator
)
/**
* Defines a service that provides one or more code generators
*/
case class GeneratorService(
guid: _root_.java.util.UUID,
uri: String,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class GeneratorServiceForm(
uri: String
)
/**
* Wraps a service and a generator providing easier access for applications.
*/
case class GeneratorWithService(
service: com.bryzek.apidoc.api.v0.models.GeneratorService,
generator: com.bryzek.apidoc.generator.v0.models.Generator
)
/**
* When searching for content, the results of the search will be a list of items.
* Each item will have enough information to render for the user, including a type
* and item_guid to enable creating the appropriate link.
*/
case class Item(
guid: _root_.java.util.UUID,
detail: com.bryzek.apidoc.api.v0.models.ItemDetail,
label: String,
description: _root_.scala.Option[String] = None
)
/**
* A membership represents a user in a specific role to an organization.
* Memberships cannot be created directly. Instead you first create a membership
* request, then that request is either accepted or declined.
*/
case class Membership(
guid: _root_.java.util.UUID,
user: com.bryzek.apidoc.api.v0.models.User,
organization: com.bryzek.apidoc.api.v0.models.Organization,
role: String,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
/**
* A membership request represents a user requesting to join an organization with a
* specific role (e.g. as a member or an admin). Membership requests can be
* reviewed by any current admin of the organization who can either accept or
* decline the request.
*/
case class MembershipRequest(
guid: _root_.java.util.UUID,
user: com.bryzek.apidoc.api.v0.models.User,
organization: com.bryzek.apidoc.api.v0.models.Organization,
role: String,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class MoveForm(
orgKey: String
)
/**
* An organization is used to group a set of applications together.
*/
case class Organization(
guid: _root_.java.util.UUID,
key: String,
name: String,
namespace: String,
visibility: com.bryzek.apidoc.api.v0.models.Visibility,
domains: Seq[com.bryzek.apidoc.api.v0.models.Domain] = Nil,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class OrganizationForm(
name: String,
key: _root_.scala.Option[String] = None,
namespace: String,
visibility: com.bryzek.apidoc.api.v0.models.Visibility = com.bryzek.apidoc.api.v0.models.Visibility.Organization,
domains: _root_.scala.Option[Seq[String]] = None
)
/**
* Represents the original input used to create an application version
*/
case class Original(
`type`: com.bryzek.apidoc.api.v0.models.OriginalType,
data: String
)
case class OriginalForm(
`type`: _root_.scala.Option[com.bryzek.apidoc.api.v0.models.OriginalType] = None,
data: String
)
/**
* Allows a user to change their password with authentication from a token.
*/
case class PasswordReset(
token: String,
password: String
)
/**
* Create a password reset request - e.g. an email containing a one time URL to
* change a password
*/
case class PasswordResetRequest(
email: String
)
/**
* On a successful password reset, return some metadata about the user modified.
*/
case class PasswordResetSuccess(
userGuid: _root_.java.util.UUID
)
/**
* Represents a user that is currently subscribed to a publication
*/
case class Subscription(
guid: _root_.java.util.UUID,
organization: com.bryzek.apidoc.api.v0.models.Organization,
user: com.bryzek.apidoc.api.v0.models.User,
publication: com.bryzek.apidoc.api.v0.models.Publication,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class SubscriptionForm(
organizationKey: String,
userGuid: _root_.java.util.UUID,
publication: com.bryzek.apidoc.api.v0.models.Publication
)
/**
* A token gives a user access to the API.
*/
case class Token(
guid: _root_.java.util.UUID,
user: com.bryzek.apidoc.api.v0.models.User,
maskedToken: String,
description: _root_.scala.Option[String] = None,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class TokenForm(
userGuid: _root_.java.util.UUID,
description: _root_.scala.Option[String] = None
)
/**
* A user is a top level person interacting with the api doc server.
*/
case class User(
guid: _root_.java.util.UUID,
email: String,
nickname: String,
name: _root_.scala.Option[String] = None,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class UserForm(
email: String,
password: String,
nickname: _root_.scala.Option[String] = None,
name: _root_.scala.Option[String] = None
)
/**
* Summary of a user sufficient for display
*/
case class UserSummary(
guid: _root_.java.util.UUID,
nickname: String
)
case class UserUpdateForm(
email: String,
nickname: String,
name: _root_.scala.Option[String] = None
)
/**
* Used only to validate json files - used as a resource where http status code
* defines success
*/
case class Validation(
valid: Boolean,
errors: Seq[String] = Nil
)
/**
* Represents a unique version of the application.
*/
case class Version(
guid: _root_.java.util.UUID,
organization: com.bryzek.apidoc.common.v0.models.Reference,
application: com.bryzek.apidoc.common.v0.models.Reference,
version: String,
original: _root_.scala.Option[com.bryzek.apidoc.api.v0.models.Original] = None,
service: com.bryzek.apidoc.spec.v0.models.Service,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class VersionForm(
originalForm: com.bryzek.apidoc.api.v0.models.OriginalForm,
visibility: _root_.scala.Option[com.bryzek.apidoc.api.v0.models.Visibility] = None
)
/**
* Users can watch individual applications which enables features like receiving an
* email notification when there is a new version of an application.
*/
case class Watch(
guid: _root_.java.util.UUID,
user: com.bryzek.apidoc.api.v0.models.User,
organization: com.bryzek.apidoc.api.v0.models.Organization,
application: com.bryzek.apidoc.api.v0.models.Application,
audit: com.bryzek.apidoc.common.v0.models.Audit
)
case class WatchForm(
userGuid: _root_.java.util.UUID,
organizationKey: String,
applicationKey: String
)
/**
* Provides future compatibility in clients - in the future, when a type is added
* to the union Diff, it will need to be handled in the client code. This
* implementation will deserialize these future types as an instance of this class.
*/
case class DiffUndefinedType(
description: String
) extends Diff
/**
* Provides future compatibility in clients - in the future, when a type is added
* to the union ItemDetail, it will need to be handled in the client code. This
* implementation will deserialize these future types as an instance of this class.
*/
case class ItemDetailUndefinedType(
description: String
) extends ItemDetail
sealed trait OriginalType
object OriginalType {
/**
* The original is in the api.json format
*/
case object ApiJson extends OriginalType { override def toString = "api_json" }
/**
* The original is in Avro Idl format
*/
case object AvroIdl extends OriginalType { override def toString = "avro_idl" }
/**
* This is the canonical service spec for apidoc itself. See
* http://apidoc.me/bryzek/apidoc-spec/latest#model-service
*/
case object ServiceJson extends OriginalType { override def toString = "service_json" }
/**
* The original in the swagger.json format
*/
case object SwaggerJson extends OriginalType { override def toString = "swagger_json" }
/**
* UNDEFINED captures values that are sent either in error or
* that were added by the server after this library was
* generated. We want to make it easy and obvious for users of
* this library to handle this case gracefully.
*
* We use all CAPS for the variable name to avoid collisions
* with the camel cased values above.
*/
case class UNDEFINED(override val toString: String) extends OriginalType
/**
* all returns a list of all the valid, known values. We use
* lower case to avoid collisions with the camel cased values
* above.
*/
val all = Seq(ApiJson, AvroIdl, ServiceJson, SwaggerJson)
private[this]
val byName = all.map(x => x.toString.toLowerCase -> x).toMap
def apply(value: String): OriginalType = fromString(value).getOrElse(UNDEFINED(value))
def fromString(value: String): _root_.scala.Option[OriginalType] = byName.get(value.toLowerCase)
}
/**
* A publication represents something that a user can subscribe to. An example
* would be subscribing to an email alert whenever a new version of an application
* is created.
*/
sealed trait Publication
object Publication {
/**
* For organizations for which I am an administrator, email me whenever a user
* applies to join the org.
*/
case object MembershipRequestsCreate extends Publication { override def toString = "membership_requests.create" }
/**
* For organizations for which I am a member, email me whenever a user joins the
* org.
*/
case object MembershipsCreate extends Publication { override def toString = "memberships.create" }
/**
* For organizations for which I am a member, email me whenever an application is
* created.
*/
case object ApplicationsCreate extends Publication { override def toString = "applications.create" }
/**
* For applications that I watch, email me whenever a version is created.
*/
case object VersionsCreate extends Publication { override def toString = "versions.create" }
/**
* UNDEFINED captures values that are sent either in error or
* that were added by the server after this library was
* generated. We want to make it easy and obvious for users of
* this library to handle this case gracefully.
*
* We use all CAPS for the variable name to avoid collisions
* with the camel cased values above.
*/
case class UNDEFINED(override val toString: String) extends Publication
/**
* all returns a list of all the valid, known values. We use
* lower case to avoid collisions with the camel cased values
* above.
*/
val all = Seq(MembershipRequestsCreate, MembershipsCreate, ApplicationsCreate, VersionsCreate)
private[this]
val byName = all.map(x => x.toString.toLowerCase -> x).toMap
def apply(value: String): Publication = fromString(value).getOrElse(UNDEFINED(value))
def fromString(value: String): _root_.scala.Option[Publication] = byName.get(value.toLowerCase)
}
/**
* Controls who is able to view this version
*/
sealed trait Visibility
object Visibility {
/**
* Only the creator can view this application
*/
case object User extends Visibility { override def toString = "user" }
/**
* Any member of the organization can view this application
*/
case object Organization extends Visibility { override def toString = "organization" }
/**
* Anybody, including non logged in users, can view this application
*/
case object Public extends Visibility { override def toString = "public" }
/**
* UNDEFINED captures values that are sent either in error or
* that were added by the server after this library was
* generated. We want to make it easy and obvious for users of
* this library to handle this case gracefully.
*
* We use all CAPS for the variable name to avoid collisions
* with the camel cased values above.
*/
case class UNDEFINED(override val toString: String) extends Visibility
/**
* all returns a list of all the valid, known values. We use
* lower case to avoid collisions with the camel cased values
* above.
*/
val all = Seq(User, Organization, Public)
private[this]
val byName = all.map(x => x.toString.toLowerCase -> x).toMap
def apply(value: String): Visibility = fromString(value).getOrElse(UNDEFINED(value))
def fromString(value: String): _root_.scala.Option[Visibility] = byName.get(value.toLowerCase)
}
}
package com.bryzek.apidoc.api.v0.models {
package object json {
import play.api.libs.json.__
import play.api.libs.json.JsString
import play.api.libs.json.Writes
import play.api.libs.functional.syntax._
import com.bryzek.apidoc.api.v0.models.json._
import com.bryzek.apidoc.common.v0.models.json._
import com.bryzek.apidoc.generator.v0.models.json._
import com.bryzek.apidoc.spec.v0.models.json._
private[v0] implicit val jsonReadsUUID = __.read[String].map(java.util.UUID.fromString)
private[v0] implicit val jsonWritesUUID = new Writes[java.util.UUID] {
def writes(x: java.util.UUID) = JsString(x.toString)
}
private[v0] implicit val jsonReadsJodaDateTime = __.read[String].map { str =>
import org.joda.time.format.ISODateTimeFormat.dateTimeParser
dateTimeParser.parseDateTime(str)
}
private[v0] implicit val jsonWritesJodaDateTime = new Writes[org.joda.time.DateTime] {
def writes(x: org.joda.time.DateTime) = {
import org.joda.time.format.ISODateTimeFormat.dateTime
val str = dateTime.print(x)
JsString(str)
}
}
implicit val jsonReadsApidocapiOriginalType = new play.api.libs.json.Reads[com.bryzek.apidoc.api.v0.models.OriginalType] {
def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[com.bryzek.apidoc.api.v0.models.OriginalType] = {
js match {
case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.OriginalType(v.value))
case _ => {
(js \ "value").validate[String] match {
case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.OriginalType(v))
case err: play.api.libs.json.JsError => err
}
}
}
}
}
def jsonWritesApidocapiOriginalType(obj: com.bryzek.apidoc.api.v0.models.OriginalType) = {
play.api.libs.json.JsString(obj.toString)
}
def jsObjectOriginalType(obj: com.bryzek.apidoc.api.v0.models.OriginalType) = {
play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString))
}
implicit def jsonWritesApidocapiOriginalType: play.api.libs.json.Writes[OriginalType] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.OriginalType] {
def writes(obj: com.bryzek.apidoc.api.v0.models.OriginalType) = {
jsonWritesApidocapiOriginalType(obj)
}
}
}
implicit val jsonReadsApidocapiPublication = new play.api.libs.json.Reads[com.bryzek.apidoc.api.v0.models.Publication] {
def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[com.bryzek.apidoc.api.v0.models.Publication] = {
js match {
case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.Publication(v.value))
case _ => {
(js \ "value").validate[String] match {
case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.Publication(v))
case err: play.api.libs.json.JsError => err
}
}
}
}
}
def jsonWritesApidocapiPublication(obj: com.bryzek.apidoc.api.v0.models.Publication) = {
play.api.libs.json.JsString(obj.toString)
}
def jsObjectPublication(obj: com.bryzek.apidoc.api.v0.models.Publication) = {
play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString))
}
implicit def jsonWritesApidocapiPublication: play.api.libs.json.Writes[Publication] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Publication] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Publication) = {
jsonWritesApidocapiPublication(obj)
}
}
}
implicit val jsonReadsApidocapiVisibility = new play.api.libs.json.Reads[com.bryzek.apidoc.api.v0.models.Visibility] {
def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[com.bryzek.apidoc.api.v0.models.Visibility] = {
js match {
case v: play.api.libs.json.JsString => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.Visibility(v.value))
case _ => {
(js \ "value").validate[String] match {
case play.api.libs.json.JsSuccess(v, _) => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.Visibility(v))
case err: play.api.libs.json.JsError => err
}
}
}
}
}
def jsonWritesApidocapiVisibility(obj: com.bryzek.apidoc.api.v0.models.Visibility) = {
play.api.libs.json.JsString(obj.toString)
}
def jsObjectVisibility(obj: com.bryzek.apidoc.api.v0.models.Visibility) = {
play.api.libs.json.Json.obj("value" -> play.api.libs.json.JsString(obj.toString))
}
implicit def jsonWritesApidocapiVisibility: play.api.libs.json.Writes[Visibility] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Visibility] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Visibility) = {
jsonWritesApidocapiVisibility(obj)
}
}
}
implicit def jsonReadsApidocapiApplication: play.api.libs.json.Reads[Application] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "organization").read[com.bryzek.apidoc.common.v0.models.Reference] and
(__ \ "name").read[String] and
(__ \ "key").read[String] and
(__ \ "visibility").read[com.bryzek.apidoc.api.v0.models.Visibility] and
(__ \ "description").readNullable[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Application.apply _)
}
def jsObjectApplication(obj: com.bryzek.apidoc.api.v0.models.Application) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"organization" -> com.bryzek.apidoc.common.v0.models.json.jsObjectReference(obj.organization),
"name" -> play.api.libs.json.JsString(obj.name),
"key" -> play.api.libs.json.JsString(obj.key),
"visibility" -> play.api.libs.json.JsString(obj.visibility.toString),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
) ++ (obj.description match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiApplication: play.api.libs.json.Writes[Application] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Application] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Application) = {
jsObjectApplication(obj)
}
}
}
implicit def jsonReadsApidocapiApplicationForm: play.api.libs.json.Reads[ApplicationForm] = {
(
(__ \ "name").read[String] and
(__ \ "key").readNullable[String] and
(__ \ "description").readNullable[String] and
(__ \ "visibility").read[com.bryzek.apidoc.api.v0.models.Visibility]
)(ApplicationForm.apply _)
}
def jsObjectApplicationForm(obj: com.bryzek.apidoc.api.v0.models.ApplicationForm) = {
play.api.libs.json.Json.obj(
"name" -> play.api.libs.json.JsString(obj.name),
"visibility" -> play.api.libs.json.JsString(obj.visibility.toString)
) ++ (obj.key match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("key" -> play.api.libs.json.JsString(x))
}) ++
(obj.description match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiApplicationForm: play.api.libs.json.Writes[ApplicationForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.ApplicationForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.ApplicationForm) = {
jsObjectApplicationForm(obj)
}
}
}
implicit def jsonReadsApidocapiApplicationSummary: play.api.libs.json.Reads[ApplicationSummary] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "organization").read[com.bryzek.apidoc.common.v0.models.Reference] and
(__ \ "key").read[String]
)(ApplicationSummary.apply _)
}
def jsObjectApplicationSummary(obj: com.bryzek.apidoc.api.v0.models.ApplicationSummary) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"organization" -> com.bryzek.apidoc.common.v0.models.json.jsObjectReference(obj.organization),
"key" -> play.api.libs.json.JsString(obj.key)
)
}
implicit def jsonReadsApidocapiAttribute: play.api.libs.json.Reads[Attribute] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "name").read[String] and
(__ \ "description").readNullable[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Attribute.apply _)
}
def jsObjectAttribute(obj: com.bryzek.apidoc.api.v0.models.Attribute) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"name" -> play.api.libs.json.JsString(obj.name),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
) ++ (obj.description match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiAttribute: play.api.libs.json.Writes[Attribute] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Attribute] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Attribute) = {
jsObjectAttribute(obj)
}
}
}
implicit def jsonReadsApidocapiAttributeForm: play.api.libs.json.Reads[AttributeForm] = {
(
(__ \ "name").read[String] and
(__ \ "description").readNullable[String]
)(AttributeForm.apply _)
}
def jsObjectAttributeForm(obj: com.bryzek.apidoc.api.v0.models.AttributeForm) = {
play.api.libs.json.Json.obj(
"name" -> play.api.libs.json.JsString(obj.name)
) ++ (obj.description match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiAttributeForm: play.api.libs.json.Writes[AttributeForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.AttributeForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.AttributeForm) = {
jsObjectAttributeForm(obj)
}
}
}
implicit def jsonReadsApidocapiAttributeSummary: play.api.libs.json.Reads[AttributeSummary] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "name").read[String]
)(AttributeSummary.apply _)
}
def jsObjectAttributeSummary(obj: com.bryzek.apidoc.api.v0.models.AttributeSummary) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"name" -> play.api.libs.json.JsString(obj.name)
)
}
implicit def jsonWritesApidocapiAttributeSummary: play.api.libs.json.Writes[AttributeSummary] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.AttributeSummary] {
def writes(obj: com.bryzek.apidoc.api.v0.models.AttributeSummary) = {
jsObjectAttributeSummary(obj)
}
}
}
implicit def jsonReadsApidocapiAttributeValue: play.api.libs.json.Reads[AttributeValue] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "attribute").read[com.bryzek.apidoc.api.v0.models.AttributeSummary] and
(__ \ "value").read[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(AttributeValue.apply _)
}
def jsObjectAttributeValue(obj: com.bryzek.apidoc.api.v0.models.AttributeValue) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"attribute" -> jsObjectAttributeSummary(obj.attribute),
"value" -> play.api.libs.json.JsString(obj.value),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiAttributeValue: play.api.libs.json.Writes[AttributeValue] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.AttributeValue] {
def writes(obj: com.bryzek.apidoc.api.v0.models.AttributeValue) = {
jsObjectAttributeValue(obj)
}
}
}
implicit def jsonReadsApidocapiAttributeValueForm: play.api.libs.json.Reads[AttributeValueForm] = {
(__ \ "value").read[String].map { x => new AttributeValueForm(value = x) }
}
def jsObjectAttributeValueForm(obj: com.bryzek.apidoc.api.v0.models.AttributeValueForm) = {
play.api.libs.json.Json.obj(
"value" -> play.api.libs.json.JsString(obj.value)
)
}
implicit def jsonWritesApidocapiAttributeValueForm: play.api.libs.json.Writes[AttributeValueForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.AttributeValueForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.AttributeValueForm) = {
jsObjectAttributeValueForm(obj)
}
}
}
implicit def jsonReadsApidocapiChange: play.api.libs.json.Reads[Change] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "organization").read[com.bryzek.apidoc.common.v0.models.Reference] and
(__ \ "application").read[com.bryzek.apidoc.common.v0.models.Reference] and
(__ \ "from_version").read[com.bryzek.apidoc.api.v0.models.ChangeVersion] and
(__ \ "to_version").read[com.bryzek.apidoc.api.v0.models.ChangeVersion] and
(__ \ "diff").read[com.bryzek.apidoc.api.v0.models.Diff] and
(__ \ "changed_at").read[_root_.org.joda.time.DateTime] and
(__ \ "changed_by").read[com.bryzek.apidoc.api.v0.models.UserSummary] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Change.apply _)
}
def jsObjectChange(obj: com.bryzek.apidoc.api.v0.models.Change) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"organization" -> com.bryzek.apidoc.common.v0.models.json.jsObjectReference(obj.organization),
"application" -> com.bryzek.apidoc.common.v0.models.json.jsObjectReference(obj.application),
"from_version" -> jsObjectChangeVersion(obj.fromVersion),
"to_version" -> jsObjectChangeVersion(obj.toVersion),
"diff" -> jsObjectDiff(obj.diff),
"changed_at" -> play.api.libs.json.JsString(_root_.org.joda.time.format.ISODateTimeFormat.dateTime.print(obj.changedAt)),
"changed_by" -> jsObjectUserSummary(obj.changedBy),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiChange: play.api.libs.json.Writes[Change] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Change] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Change) = {
jsObjectChange(obj)
}
}
}
implicit def jsonReadsApidocapiChangeVersion: play.api.libs.json.Reads[ChangeVersion] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "version").read[String]
)(ChangeVersion.apply _)
}
def jsObjectChangeVersion(obj: com.bryzek.apidoc.api.v0.models.ChangeVersion) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"version" -> play.api.libs.json.JsString(obj.version)
)
}
implicit def jsonWritesApidocapiChangeVersion: play.api.libs.json.Writes[ChangeVersion] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.ChangeVersion] {
def writes(obj: com.bryzek.apidoc.api.v0.models.ChangeVersion) = {
jsObjectChangeVersion(obj)
}
}
}
implicit def jsonReadsApidocapiCleartextToken: play.api.libs.json.Reads[CleartextToken] = {
(__ \ "token").read[String].map { x => new CleartextToken(token = x) }
}
def jsObjectCleartextToken(obj: com.bryzek.apidoc.api.v0.models.CleartextToken) = {
play.api.libs.json.Json.obj(
"token" -> play.api.libs.json.JsString(obj.token)
)
}
implicit def jsonWritesApidocapiCleartextToken: play.api.libs.json.Writes[CleartextToken] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.CleartextToken] {
def writes(obj: com.bryzek.apidoc.api.v0.models.CleartextToken) = {
jsObjectCleartextToken(obj)
}
}
}
implicit def jsonReadsApidocapiCode: play.api.libs.json.Reads[Code] = {
(
(__ \ "generator").read[com.bryzek.apidoc.api.v0.models.GeneratorWithService] and
(__ \ "source").read[String] and
(__ \ "files").read[Seq[com.bryzek.apidoc.generator.v0.models.File]]
)(Code.apply _)
}
def jsObjectCode(obj: com.bryzek.apidoc.api.v0.models.Code) = {
play.api.libs.json.Json.obj(
"generator" -> jsObjectGeneratorWithService(obj.generator),
"source" -> play.api.libs.json.JsString(obj.source),
"files" -> play.api.libs.json.Json.toJson(obj.files)
)
}
implicit def jsonWritesApidocapiCode: play.api.libs.json.Writes[Code] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Code] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Code) = {
jsObjectCode(obj)
}
}
}
implicit def jsonReadsApidocapiDiffBreaking: play.api.libs.json.Reads[DiffBreaking] = {
(__ \ "description").read[String].map { x => new DiffBreaking(description = x) }
}
def jsObjectDiffBreaking(obj: com.bryzek.apidoc.api.v0.models.DiffBreaking) = {
play.api.libs.json.Json.obj(
"description" -> play.api.libs.json.JsString(obj.description)
)
}
implicit def jsonReadsApidocapiDiffNonBreaking: play.api.libs.json.Reads[DiffNonBreaking] = {
(__ \ "description").read[String].map { x => new DiffNonBreaking(description = x) }
}
def jsObjectDiffNonBreaking(obj: com.bryzek.apidoc.api.v0.models.DiffNonBreaking) = {
play.api.libs.json.Json.obj(
"description" -> play.api.libs.json.JsString(obj.description)
)
}
implicit def jsonReadsApidocapiDomain: play.api.libs.json.Reads[Domain] = {
(__ \ "name").read[String].map { x => new Domain(name = x) }
}
def jsObjectDomain(obj: com.bryzek.apidoc.api.v0.models.Domain) = {
play.api.libs.json.Json.obj(
"name" -> play.api.libs.json.JsString(obj.name)
)
}
implicit def jsonWritesApidocapiDomain: play.api.libs.json.Writes[Domain] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Domain] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Domain) = {
jsObjectDomain(obj)
}
}
}
implicit def jsonReadsApidocapiEmailVerificationConfirmationForm: play.api.libs.json.Reads[EmailVerificationConfirmationForm] = {
(__ \ "token").read[String].map { x => new EmailVerificationConfirmationForm(token = x) }
}
def jsObjectEmailVerificationConfirmationForm(obj: com.bryzek.apidoc.api.v0.models.EmailVerificationConfirmationForm) = {
play.api.libs.json.Json.obj(
"token" -> play.api.libs.json.JsString(obj.token)
)
}
implicit def jsonWritesApidocapiEmailVerificationConfirmationForm: play.api.libs.json.Writes[EmailVerificationConfirmationForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.EmailVerificationConfirmationForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.EmailVerificationConfirmationForm) = {
jsObjectEmailVerificationConfirmationForm(obj)
}
}
}
implicit def jsonReadsApidocapiError: play.api.libs.json.Reads[Error] = {
(
(__ \ "code").read[String] and
(__ \ "message").read[String]
)(Error.apply _)
}
def jsObjectError(obj: com.bryzek.apidoc.api.v0.models.Error) = {
play.api.libs.json.Json.obj(
"code" -> play.api.libs.json.JsString(obj.code),
"message" -> play.api.libs.json.JsString(obj.message)
)
}
implicit def jsonWritesApidocapiError: play.api.libs.json.Writes[Error] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Error] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Error) = {
jsObjectError(obj)
}
}
}
implicit def jsonReadsApidocapiGeneratorForm: play.api.libs.json.Reads[GeneratorForm] = {
(
(__ \ "service_guid").read[_root_.java.util.UUID] and
(__ \ "generator").read[com.bryzek.apidoc.generator.v0.models.Generator]
)(GeneratorForm.apply _)
}
def jsObjectGeneratorForm(obj: com.bryzek.apidoc.api.v0.models.GeneratorForm) = {
play.api.libs.json.Json.obj(
"service_guid" -> play.api.libs.json.JsString(obj.serviceGuid.toString),
"generator" -> com.bryzek.apidoc.generator.v0.models.json.jsObjectGenerator(obj.generator)
)
}
implicit def jsonWritesApidocapiGeneratorForm: play.api.libs.json.Writes[GeneratorForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.GeneratorForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.GeneratorForm) = {
jsObjectGeneratorForm(obj)
}
}
}
implicit def jsonReadsApidocapiGeneratorService: play.api.libs.json.Reads[GeneratorService] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "uri").read[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(GeneratorService.apply _)
}
def jsObjectGeneratorService(obj: com.bryzek.apidoc.api.v0.models.GeneratorService) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"uri" -> play.api.libs.json.JsString(obj.uri),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiGeneratorService: play.api.libs.json.Writes[GeneratorService] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.GeneratorService] {
def writes(obj: com.bryzek.apidoc.api.v0.models.GeneratorService) = {
jsObjectGeneratorService(obj)
}
}
}
implicit def jsonReadsApidocapiGeneratorServiceForm: play.api.libs.json.Reads[GeneratorServiceForm] = {
(__ \ "uri").read[String].map { x => new GeneratorServiceForm(uri = x) }
}
def jsObjectGeneratorServiceForm(obj: com.bryzek.apidoc.api.v0.models.GeneratorServiceForm) = {
play.api.libs.json.Json.obj(
"uri" -> play.api.libs.json.JsString(obj.uri)
)
}
implicit def jsonWritesApidocapiGeneratorServiceForm: play.api.libs.json.Writes[GeneratorServiceForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.GeneratorServiceForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.GeneratorServiceForm) = {
jsObjectGeneratorServiceForm(obj)
}
}
}
implicit def jsonReadsApidocapiGeneratorWithService: play.api.libs.json.Reads[GeneratorWithService] = {
(
(__ \ "service").read[com.bryzek.apidoc.api.v0.models.GeneratorService] and
(__ \ "generator").read[com.bryzek.apidoc.generator.v0.models.Generator]
)(GeneratorWithService.apply _)
}
def jsObjectGeneratorWithService(obj: com.bryzek.apidoc.api.v0.models.GeneratorWithService) = {
play.api.libs.json.Json.obj(
"service" -> jsObjectGeneratorService(obj.service),
"generator" -> com.bryzek.apidoc.generator.v0.models.json.jsObjectGenerator(obj.generator)
)
}
implicit def jsonWritesApidocapiGeneratorWithService: play.api.libs.json.Writes[GeneratorWithService] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.GeneratorWithService] {
def writes(obj: com.bryzek.apidoc.api.v0.models.GeneratorWithService) = {
jsObjectGeneratorWithService(obj)
}
}
}
implicit def jsonReadsApidocapiItem: play.api.libs.json.Reads[Item] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "detail").read[com.bryzek.apidoc.api.v0.models.ItemDetail] and
(__ \ "label").read[String] and
(__ \ "description").readNullable[String]
)(Item.apply _)
}
def jsObjectItem(obj: com.bryzek.apidoc.api.v0.models.Item) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"detail" -> jsObjectItemDetail(obj.detail),
"label" -> play.api.libs.json.JsString(obj.label)
) ++ (obj.description match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiItem: play.api.libs.json.Writes[Item] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Item] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Item) = {
jsObjectItem(obj)
}
}
}
implicit def jsonReadsApidocapiMembership: play.api.libs.json.Reads[Membership] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "user").read[com.bryzek.apidoc.api.v0.models.User] and
(__ \ "organization").read[com.bryzek.apidoc.api.v0.models.Organization] and
(__ \ "role").read[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Membership.apply _)
}
def jsObjectMembership(obj: com.bryzek.apidoc.api.v0.models.Membership) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"user" -> jsObjectUser(obj.user),
"organization" -> jsObjectOrganization(obj.organization),
"role" -> play.api.libs.json.JsString(obj.role),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiMembership: play.api.libs.json.Writes[Membership] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Membership] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Membership) = {
jsObjectMembership(obj)
}
}
}
implicit def jsonReadsApidocapiMembershipRequest: play.api.libs.json.Reads[MembershipRequest] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "user").read[com.bryzek.apidoc.api.v0.models.User] and
(__ \ "organization").read[com.bryzek.apidoc.api.v0.models.Organization] and
(__ \ "role").read[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(MembershipRequest.apply _)
}
def jsObjectMembershipRequest(obj: com.bryzek.apidoc.api.v0.models.MembershipRequest) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"user" -> jsObjectUser(obj.user),
"organization" -> jsObjectOrganization(obj.organization),
"role" -> play.api.libs.json.JsString(obj.role),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiMembershipRequest: play.api.libs.json.Writes[MembershipRequest] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.MembershipRequest] {
def writes(obj: com.bryzek.apidoc.api.v0.models.MembershipRequest) = {
jsObjectMembershipRequest(obj)
}
}
}
implicit def jsonReadsApidocapiMoveForm: play.api.libs.json.Reads[MoveForm] = {
(__ \ "org_key").read[String].map { x => new MoveForm(orgKey = x) }
}
def jsObjectMoveForm(obj: com.bryzek.apidoc.api.v0.models.MoveForm) = {
play.api.libs.json.Json.obj(
"org_key" -> play.api.libs.json.JsString(obj.orgKey)
)
}
implicit def jsonWritesApidocapiMoveForm: play.api.libs.json.Writes[MoveForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.MoveForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.MoveForm) = {
jsObjectMoveForm(obj)
}
}
}
implicit def jsonReadsApidocapiOrganization: play.api.libs.json.Reads[Organization] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "key").read[String] and
(__ \ "name").read[String] and
(__ \ "namespace").read[String] and
(__ \ "visibility").read[com.bryzek.apidoc.api.v0.models.Visibility] and
(__ \ "domains").read[Seq[com.bryzek.apidoc.api.v0.models.Domain]] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Organization.apply _)
}
def jsObjectOrganization(obj: com.bryzek.apidoc.api.v0.models.Organization) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"key" -> play.api.libs.json.JsString(obj.key),
"name" -> play.api.libs.json.JsString(obj.name),
"namespace" -> play.api.libs.json.JsString(obj.namespace),
"visibility" -> play.api.libs.json.JsString(obj.visibility.toString),
"domains" -> play.api.libs.json.Json.toJson(obj.domains),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiOrganization: play.api.libs.json.Writes[Organization] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Organization] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Organization) = {
jsObjectOrganization(obj)
}
}
}
implicit def jsonReadsApidocapiOrganizationForm: play.api.libs.json.Reads[OrganizationForm] = {
(
(__ \ "name").read[String] and
(__ \ "key").readNullable[String] and
(__ \ "namespace").read[String] and
(__ \ "visibility").read[com.bryzek.apidoc.api.v0.models.Visibility] and
(__ \ "domains").readNullable[Seq[String]]
)(OrganizationForm.apply _)
}
def jsObjectOrganizationForm(obj: com.bryzek.apidoc.api.v0.models.OrganizationForm) = {
play.api.libs.json.Json.obj(
"name" -> play.api.libs.json.JsString(obj.name),
"namespace" -> play.api.libs.json.JsString(obj.namespace),
"visibility" -> play.api.libs.json.JsString(obj.visibility.toString)
) ++ (obj.key match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("key" -> play.api.libs.json.JsString(x))
}) ++
(obj.domains match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("domains" -> play.api.libs.json.Json.toJson(x))
})
}
implicit def jsonWritesApidocapiOrganizationForm: play.api.libs.json.Writes[OrganizationForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.OrganizationForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.OrganizationForm) = {
jsObjectOrganizationForm(obj)
}
}
}
implicit def jsonReadsApidocapiOriginal: play.api.libs.json.Reads[Original] = {
(
(__ \ "type").read[com.bryzek.apidoc.api.v0.models.OriginalType] and
(__ \ "data").read[String]
)(Original.apply _)
}
def jsObjectOriginal(obj: com.bryzek.apidoc.api.v0.models.Original) = {
play.api.libs.json.Json.obj(
"type" -> play.api.libs.json.JsString(obj.`type`.toString),
"data" -> play.api.libs.json.JsString(obj.data)
)
}
implicit def jsonWritesApidocapiOriginal: play.api.libs.json.Writes[Original] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Original] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Original) = {
jsObjectOriginal(obj)
}
}
}
implicit def jsonReadsApidocapiOriginalForm: play.api.libs.json.Reads[OriginalForm] = {
(
(__ \ "type").readNullable[com.bryzek.apidoc.api.v0.models.OriginalType] and
(__ \ "data").read[String]
)(OriginalForm.apply _)
}
def jsObjectOriginalForm(obj: com.bryzek.apidoc.api.v0.models.OriginalForm) = {
play.api.libs.json.Json.obj(
"data" -> play.api.libs.json.JsString(obj.data)
) ++ (obj.`type` match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("type" -> play.api.libs.json.JsString(x.toString))
})
}
implicit def jsonWritesApidocapiOriginalForm: play.api.libs.json.Writes[OriginalForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.OriginalForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.OriginalForm) = {
jsObjectOriginalForm(obj)
}
}
}
implicit def jsonReadsApidocapiPasswordReset: play.api.libs.json.Reads[PasswordReset] = {
(
(__ \ "token").read[String] and
(__ \ "password").read[String]
)(PasswordReset.apply _)
}
def jsObjectPasswordReset(obj: com.bryzek.apidoc.api.v0.models.PasswordReset) = {
play.api.libs.json.Json.obj(
"token" -> play.api.libs.json.JsString(obj.token),
"password" -> play.api.libs.json.JsString(obj.password)
)
}
implicit def jsonWritesApidocapiPasswordReset: play.api.libs.json.Writes[PasswordReset] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.PasswordReset] {
def writes(obj: com.bryzek.apidoc.api.v0.models.PasswordReset) = {
jsObjectPasswordReset(obj)
}
}
}
implicit def jsonReadsApidocapiPasswordResetRequest: play.api.libs.json.Reads[PasswordResetRequest] = {
(__ \ "email").read[String].map { x => new PasswordResetRequest(email = x) }
}
def jsObjectPasswordResetRequest(obj: com.bryzek.apidoc.api.v0.models.PasswordResetRequest) = {
play.api.libs.json.Json.obj(
"email" -> play.api.libs.json.JsString(obj.email)
)
}
implicit def jsonWritesApidocapiPasswordResetRequest: play.api.libs.json.Writes[PasswordResetRequest] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.PasswordResetRequest] {
def writes(obj: com.bryzek.apidoc.api.v0.models.PasswordResetRequest) = {
jsObjectPasswordResetRequest(obj)
}
}
}
implicit def jsonReadsApidocapiPasswordResetSuccess: play.api.libs.json.Reads[PasswordResetSuccess] = {
(__ \ "user_guid").read[_root_.java.util.UUID].map { x => new PasswordResetSuccess(userGuid = x) }
}
def jsObjectPasswordResetSuccess(obj: com.bryzek.apidoc.api.v0.models.PasswordResetSuccess) = {
play.api.libs.json.Json.obj(
"user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString)
)
}
implicit def jsonWritesApidocapiPasswordResetSuccess: play.api.libs.json.Writes[PasswordResetSuccess] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.PasswordResetSuccess] {
def writes(obj: com.bryzek.apidoc.api.v0.models.PasswordResetSuccess) = {
jsObjectPasswordResetSuccess(obj)
}
}
}
implicit def jsonReadsApidocapiSubscription: play.api.libs.json.Reads[Subscription] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "organization").read[com.bryzek.apidoc.api.v0.models.Organization] and
(__ \ "user").read[com.bryzek.apidoc.api.v0.models.User] and
(__ \ "publication").read[com.bryzek.apidoc.api.v0.models.Publication] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Subscription.apply _)
}
def jsObjectSubscription(obj: com.bryzek.apidoc.api.v0.models.Subscription) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"organization" -> jsObjectOrganization(obj.organization),
"user" -> jsObjectUser(obj.user),
"publication" -> play.api.libs.json.JsString(obj.publication.toString),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiSubscription: play.api.libs.json.Writes[Subscription] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Subscription] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Subscription) = {
jsObjectSubscription(obj)
}
}
}
implicit def jsonReadsApidocapiSubscriptionForm: play.api.libs.json.Reads[SubscriptionForm] = {
(
(__ \ "organization_key").read[String] and
(__ \ "user_guid").read[_root_.java.util.UUID] and
(__ \ "publication").read[com.bryzek.apidoc.api.v0.models.Publication]
)(SubscriptionForm.apply _)
}
def jsObjectSubscriptionForm(obj: com.bryzek.apidoc.api.v0.models.SubscriptionForm) = {
play.api.libs.json.Json.obj(
"organization_key" -> play.api.libs.json.JsString(obj.organizationKey),
"user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString),
"publication" -> play.api.libs.json.JsString(obj.publication.toString)
)
}
implicit def jsonWritesApidocapiSubscriptionForm: play.api.libs.json.Writes[SubscriptionForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.SubscriptionForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.SubscriptionForm) = {
jsObjectSubscriptionForm(obj)
}
}
}
implicit def jsonReadsApidocapiToken: play.api.libs.json.Reads[Token] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "user").read[com.bryzek.apidoc.api.v0.models.User] and
(__ \ "masked_token").read[String] and
(__ \ "description").readNullable[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Token.apply _)
}
def jsObjectToken(obj: com.bryzek.apidoc.api.v0.models.Token) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"user" -> jsObjectUser(obj.user),
"masked_token" -> play.api.libs.json.JsString(obj.maskedToken),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
) ++ (obj.description match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiToken: play.api.libs.json.Writes[Token] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Token] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Token) = {
jsObjectToken(obj)
}
}
}
implicit def jsonReadsApidocapiTokenForm: play.api.libs.json.Reads[TokenForm] = {
(
(__ \ "user_guid").read[_root_.java.util.UUID] and
(__ \ "description").readNullable[String]
)(TokenForm.apply _)
}
def jsObjectTokenForm(obj: com.bryzek.apidoc.api.v0.models.TokenForm) = {
play.api.libs.json.Json.obj(
"user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString)
) ++ (obj.description match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("description" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiTokenForm: play.api.libs.json.Writes[TokenForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.TokenForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.TokenForm) = {
jsObjectTokenForm(obj)
}
}
}
implicit def jsonReadsApidocapiUser: play.api.libs.json.Reads[User] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "email").read[String] and
(__ \ "nickname").read[String] and
(__ \ "name").readNullable[String] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(User.apply _)
}
def jsObjectUser(obj: com.bryzek.apidoc.api.v0.models.User) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"email" -> play.api.libs.json.JsString(obj.email),
"nickname" -> play.api.libs.json.JsString(obj.nickname),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
) ++ (obj.name match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("name" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiUser: play.api.libs.json.Writes[User] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.User] {
def writes(obj: com.bryzek.apidoc.api.v0.models.User) = {
jsObjectUser(obj)
}
}
}
implicit def jsonReadsApidocapiUserForm: play.api.libs.json.Reads[UserForm] = {
(
(__ \ "email").read[String] and
(__ \ "password").read[String] and
(__ \ "nickname").readNullable[String] and
(__ \ "name").readNullable[String]
)(UserForm.apply _)
}
def jsObjectUserForm(obj: com.bryzek.apidoc.api.v0.models.UserForm) = {
play.api.libs.json.Json.obj(
"email" -> play.api.libs.json.JsString(obj.email),
"password" -> play.api.libs.json.JsString(obj.password)
) ++ (obj.nickname match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("nickname" -> play.api.libs.json.JsString(x))
}) ++
(obj.name match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("name" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiUserForm: play.api.libs.json.Writes[UserForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.UserForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.UserForm) = {
jsObjectUserForm(obj)
}
}
}
implicit def jsonReadsApidocapiUserSummary: play.api.libs.json.Reads[UserSummary] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "nickname").read[String]
)(UserSummary.apply _)
}
def jsObjectUserSummary(obj: com.bryzek.apidoc.api.v0.models.UserSummary) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"nickname" -> play.api.libs.json.JsString(obj.nickname)
)
}
implicit def jsonWritesApidocapiUserSummary: play.api.libs.json.Writes[UserSummary] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.UserSummary] {
def writes(obj: com.bryzek.apidoc.api.v0.models.UserSummary) = {
jsObjectUserSummary(obj)
}
}
}
implicit def jsonReadsApidocapiUserUpdateForm: play.api.libs.json.Reads[UserUpdateForm] = {
(
(__ \ "email").read[String] and
(__ \ "nickname").read[String] and
(__ \ "name").readNullable[String]
)(UserUpdateForm.apply _)
}
def jsObjectUserUpdateForm(obj: com.bryzek.apidoc.api.v0.models.UserUpdateForm) = {
play.api.libs.json.Json.obj(
"email" -> play.api.libs.json.JsString(obj.email),
"nickname" -> play.api.libs.json.JsString(obj.nickname)
) ++ (obj.name match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("name" -> play.api.libs.json.JsString(x))
})
}
implicit def jsonWritesApidocapiUserUpdateForm: play.api.libs.json.Writes[UserUpdateForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.UserUpdateForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.UserUpdateForm) = {
jsObjectUserUpdateForm(obj)
}
}
}
implicit def jsonReadsApidocapiValidation: play.api.libs.json.Reads[Validation] = {
(
(__ \ "valid").read[Boolean] and
(__ \ "errors").read[Seq[String]]
)(Validation.apply _)
}
def jsObjectValidation(obj: com.bryzek.apidoc.api.v0.models.Validation) = {
play.api.libs.json.Json.obj(
"valid" -> play.api.libs.json.JsBoolean(obj.valid),
"errors" -> play.api.libs.json.Json.toJson(obj.errors)
)
}
implicit def jsonWritesApidocapiValidation: play.api.libs.json.Writes[Validation] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Validation] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Validation) = {
jsObjectValidation(obj)
}
}
}
implicit def jsonReadsApidocapiVersion: play.api.libs.json.Reads[Version] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "organization").read[com.bryzek.apidoc.common.v0.models.Reference] and
(__ \ "application").read[com.bryzek.apidoc.common.v0.models.Reference] and
(__ \ "version").read[String] and
(__ \ "original").readNullable[com.bryzek.apidoc.api.v0.models.Original] and
(__ \ "service").read[com.bryzek.apidoc.spec.v0.models.Service] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Version.apply _)
}
def jsObjectVersion(obj: com.bryzek.apidoc.api.v0.models.Version) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"organization" -> com.bryzek.apidoc.common.v0.models.json.jsObjectReference(obj.organization),
"application" -> com.bryzek.apidoc.common.v0.models.json.jsObjectReference(obj.application),
"version" -> play.api.libs.json.JsString(obj.version),
"service" -> com.bryzek.apidoc.spec.v0.models.json.jsObjectService(obj.service),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
) ++ (obj.original match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("original" -> jsObjectOriginal(x))
})
}
implicit def jsonWritesApidocapiVersion: play.api.libs.json.Writes[Version] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Version] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Version) = {
jsObjectVersion(obj)
}
}
}
implicit def jsonReadsApidocapiVersionForm: play.api.libs.json.Reads[VersionForm] = {
(
(__ \ "original_form").read[com.bryzek.apidoc.api.v0.models.OriginalForm] and
(__ \ "visibility").readNullable[com.bryzek.apidoc.api.v0.models.Visibility]
)(VersionForm.apply _)
}
def jsObjectVersionForm(obj: com.bryzek.apidoc.api.v0.models.VersionForm) = {
play.api.libs.json.Json.obj(
"original_form" -> jsObjectOriginalForm(obj.originalForm)
) ++ (obj.visibility match {
case None => play.api.libs.json.Json.obj()
case Some(x) => play.api.libs.json.Json.obj("visibility" -> play.api.libs.json.JsString(x.toString))
})
}
implicit def jsonWritesApidocapiVersionForm: play.api.libs.json.Writes[VersionForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.VersionForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.VersionForm) = {
jsObjectVersionForm(obj)
}
}
}
implicit def jsonReadsApidocapiWatch: play.api.libs.json.Reads[Watch] = {
(
(__ \ "guid").read[_root_.java.util.UUID] and
(__ \ "user").read[com.bryzek.apidoc.api.v0.models.User] and
(__ \ "organization").read[com.bryzek.apidoc.api.v0.models.Organization] and
(__ \ "application").read[com.bryzek.apidoc.api.v0.models.Application] and
(__ \ "audit").read[com.bryzek.apidoc.common.v0.models.Audit]
)(Watch.apply _)
}
def jsObjectWatch(obj: com.bryzek.apidoc.api.v0.models.Watch) = {
play.api.libs.json.Json.obj(
"guid" -> play.api.libs.json.JsString(obj.guid.toString),
"user" -> jsObjectUser(obj.user),
"organization" -> jsObjectOrganization(obj.organization),
"application" -> jsObjectApplication(obj.application),
"audit" -> com.bryzek.apidoc.common.v0.models.json.jsObjectAudit(obj.audit)
)
}
implicit def jsonWritesApidocapiWatch: play.api.libs.json.Writes[Watch] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Watch] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Watch) = {
jsObjectWatch(obj)
}
}
}
implicit def jsonReadsApidocapiWatchForm: play.api.libs.json.Reads[WatchForm] = {
(
(__ \ "user_guid").read[_root_.java.util.UUID] and
(__ \ "organization_key").read[String] and
(__ \ "application_key").read[String]
)(WatchForm.apply _)
}
def jsObjectWatchForm(obj: com.bryzek.apidoc.api.v0.models.WatchForm) = {
play.api.libs.json.Json.obj(
"user_guid" -> play.api.libs.json.JsString(obj.userGuid.toString),
"organization_key" -> play.api.libs.json.JsString(obj.organizationKey),
"application_key" -> play.api.libs.json.JsString(obj.applicationKey)
)
}
implicit def jsonWritesApidocapiWatchForm: play.api.libs.json.Writes[WatchForm] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.WatchForm] {
def writes(obj: com.bryzek.apidoc.api.v0.models.WatchForm) = {
jsObjectWatchForm(obj)
}
}
}
implicit def jsonReadsApidocapiDiff: play.api.libs.json.Reads[Diff] = new play.api.libs.json.Reads[Diff] {
def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[Diff] = {
(js \ "type").validate[String] match {
case play.api.libs.json.JsError(msg) => play.api.libs.json.JsError(msg)
case play.api.libs.json.JsSuccess(discriminator, _) => {
discriminator match {
case "diff_breaking" => js.validate[com.bryzek.apidoc.api.v0.models.DiffBreaking]
case "diff_non_breaking" => js.validate[com.bryzek.apidoc.api.v0.models.DiffNonBreaking]
case other => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.DiffUndefinedType(other))
}
}
}
}
}
def jsObjectDiff(obj: com.bryzek.apidoc.api.v0.models.Diff) = {
obj match {
case x: com.bryzek.apidoc.api.v0.models.DiffBreaking => jsObjectDiffBreaking(x) ++ play.api.libs.json.Json.obj("type" -> "diff_breaking")
case x: com.bryzek.apidoc.api.v0.models.DiffNonBreaking => jsObjectDiffNonBreaking(x) ++ play.api.libs.json.Json.obj("type" -> "diff_non_breaking")
case other => {
sys.error(s"The type[${other.getClass.getName}] has no JSON writer")
}
}
}
implicit def jsonWritesApidocapiDiff: play.api.libs.json.Writes[Diff] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.Diff] {
def writes(obj: com.bryzek.apidoc.api.v0.models.Diff) = {
jsObjectDiff(obj)
}
}
}
implicit def jsonReadsApidocapiItemDetail: play.api.libs.json.Reads[ItemDetail] = new play.api.libs.json.Reads[ItemDetail] {
def reads(js: play.api.libs.json.JsValue): play.api.libs.json.JsResult[ItemDetail] = {
(js \ "type").validate[String] match {
case play.api.libs.json.JsError(msg) => play.api.libs.json.JsError(msg)
case play.api.libs.json.JsSuccess(discriminator, _) => {
discriminator match {
case "application_summary" => js.validate[com.bryzek.apidoc.api.v0.models.ApplicationSummary]
case other => play.api.libs.json.JsSuccess(com.bryzek.apidoc.api.v0.models.ItemDetailUndefinedType(other))
}
}
}
}
}
def jsObjectItemDetail(obj: com.bryzek.apidoc.api.v0.models.ItemDetail) = {
obj match {
case x: com.bryzek.apidoc.api.v0.models.ApplicationSummary => jsObjectApplicationSummary(x) ++ play.api.libs.json.Json.obj("type" -> "application_summary")
case other => {
sys.error(s"The type[${other.getClass.getName}] has no JSON writer")
}
}
}
implicit def jsonWritesApidocapiItemDetail: play.api.libs.json.Writes[ItemDetail] = {
new play.api.libs.json.Writes[com.bryzek.apidoc.api.v0.models.ItemDetail] {
def writes(obj: com.bryzek.apidoc.api.v0.models.ItemDetail) = {
jsObjectItemDetail(obj)
}
}
}
}
}
package com.bryzek.apidoc.api.v0 {
object Bindables {
import play.api.mvc.{PathBindable, QueryStringBindable}
import org.joda.time.{DateTime, LocalDate}
import org.joda.time.format.ISODateTimeFormat
import com.bryzek.apidoc.api.v0.models._
// Type: date-time-iso8601
implicit val pathBindableTypeDateTimeIso8601 = new PathBindable.Parsing[org.joda.time.DateTime](
ISODateTimeFormat.dateTimeParser.parseDateTime(_), _.toString, (key: String, e: _root_.java.lang.Exception) => s"Error parsing date time $key. Example: 2014-04-29T11:56:52Z"
)
implicit val queryStringBindableTypeDateTimeIso8601 = new QueryStringBindable.Parsing[org.joda.time.DateTime](
ISODateTimeFormat.dateTimeParser.parseDateTime(_), _.toString, (key: String, e: _root_.java.lang.Exception) => s"Error parsing date time $key. Example: 2014-04-29T11:56:52Z"
)
// Type: date-iso8601
implicit val pathBindableTypeDateIso8601 = new PathBindable.Parsing[org.joda.time.LocalDate](
ISODateTimeFormat.yearMonthDay.parseLocalDate(_), _.toString, (key: String, e: _root_.java.lang.Exception) => s"Error parsing date $key. Example: 2014-04-29"
)
implicit val queryStringBindableTypeDateIso8601 = new QueryStringBindable.Parsing[org.joda.time.LocalDate](
ISODateTimeFormat.yearMonthDay.parseLocalDate(_), _.toString, (key: String, e: _root_.java.lang.Exception) => s"Error parsing date $key. Example: 2014-04-29"
)
// Enum: OriginalType
private[this] val enumOriginalTypeNotFound = (key: String, e: _root_.java.lang.Exception) => s"Unrecognized $key, should be one of ${com.bryzek.apidoc.api.v0.models.OriginalType.all.mkString(", ")}"
implicit val pathBindableEnumOriginalType = new PathBindable.Parsing[com.bryzek.apidoc.api.v0.models.OriginalType] (
OriginalType.fromString(_).get, _.toString, enumOriginalTypeNotFound
)
implicit val queryStringBindableEnumOriginalType = new QueryStringBindable.Parsing[com.bryzek.apidoc.api.v0.models.OriginalType](
OriginalType.fromString(_).get, _.toString, enumOriginalTypeNotFound
)
// Enum: Publication
private[this] val enumPublicationNotFound = (key: String, e: _root_.java.lang.Exception) => s"Unrecognized $key, should be one of ${com.bryzek.apidoc.api.v0.models.Publication.all.mkString(", ")}"
implicit val pathBindableEnumPublication = new PathBindable.Parsing[com.bryzek.apidoc.api.v0.models.Publication] (
Publication.fromString(_).get, _.toString, enumPublicationNotFound
)
implicit val queryStringBindableEnumPublication = new QueryStringBindable.Parsing[com.bryzek.apidoc.api.v0.models.Publication](
Publication.fromString(_).get, _.toString, enumPublicationNotFound
)
// Enum: Visibility
private[this] val enumVisibilityNotFound = (key: String, e: _root_.java.lang.Exception) => s"Unrecognized $key, should be one of ${com.bryzek.apidoc.api.v0.models.Visibility.all.mkString(", ")}"
implicit val pathBindableEnumVisibility = new PathBindable.Parsing[com.bryzek.apidoc.api.v0.models.Visibility] (
Visibility.fromString(_).get, _.toString, enumVisibilityNotFound
)
implicit val queryStringBindableEnumVisibility = new QueryStringBindable.Parsing[com.bryzek.apidoc.api.v0.models.Visibility](
Visibility.fromString(_).get, _.toString, enumVisibilityNotFound
)
}
}
package com.bryzek.apidoc.api.v0 {
object Constants {
val BaseUrl = "http://api.apidoc.me"
val Namespace = "com.bryzek.apidoc.api.v0"
val UserAgent = "apidoc:0.11.47 http://www.apidoc.me/bryzek/apidoc-api/0.11.48/play_2_4_client"
val Version = "0.11.48"
val VersionMajor = 0
}
class Client(
val baseUrl: String = "http://api.apidoc.me",
auth: scala.Option[com.bryzek.apidoc.api.v0.Authorization] = None,
defaultHeaders: Seq[(String, String)] = Nil
) extends interfaces.Client {
import com.bryzek.apidoc.api.v0.models.json._
import com.bryzek.apidoc.common.v0.models.json._
import com.bryzek.apidoc.generator.v0.models.json._
import com.bryzek.apidoc.spec.v0.models.json._
private[this] val logger = play.api.Logger("com.bryzek.apidoc.api.v0.Client")
logger.info(s"Initializing com.bryzek.apidoc.api.v0.Client for url $baseUrl")
def applications: Applications = Applications
def attributes: Attributes = Attributes
def changes: Changes = Changes
def code: Code = Code
def domains: Domains = Domains
def emailVerificationConfirmationForms: EmailVerificationConfirmationForms = EmailVerificationConfirmationForms
def generatorServices: GeneratorServices = GeneratorServices
def generatorWithServices: GeneratorWithServices = GeneratorWithServices
def healthchecks: Healthchecks = Healthchecks
def items: Items = Items
def membershipRequests: MembershipRequests = MembershipRequests
def memberships: Memberships = Memberships
def organizations: Organizations = Organizations
def passwordResetRequests: PasswordResetRequests = PasswordResetRequests
def passwordResets: PasswordResets = PasswordResets
def subscriptions: Subscriptions = Subscriptions
def tokens: Tokens = Tokens
def users: Users = Users
def validations: Validations = Validations
def versions: Versions = Versions
def watches: Watches = Watches
object Applications extends Applications {
override def get(
orgKey: String,
name: _root_.scala.Option[String] = None,
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
key: _root_.scala.Option[String] = None,
hasVersion: _root_.scala.Option[Boolean] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Application]] = {
val queryParameters = Seq(
name.map("name" -> _),
guid.map("guid" -> _.toString),
key.map("key" -> _),
hasVersion.map("has_version" -> _.toString),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Application]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Application]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def post(
orgKey: String,
applicationForm: com.bryzek.apidoc.api.v0.models.ApplicationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Application] = {
val payload = play.api.libs.json.Json.toJson(applicationForm)
_executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Application", r, _.validate[com.bryzek.apidoc.api.v0.models.Application])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def putByApplicationKey(
orgKey: String,
applicationKey: String,
applicationForm: com.bryzek.apidoc.api.v0.models.ApplicationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Application] = {
val payload = play.api.libs.json.Json.toJson(applicationForm)
_executeRequest("PUT", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Application", r, _.validate[com.bryzek.apidoc.api.v0.models.Application])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def deleteByApplicationKey(
orgKey: String,
applicationKey: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
override def postMoveByApplicationKey(
orgKey: String,
applicationKey: String,
moveForm: com.bryzek.apidoc.api.v0.models.MoveForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Application] = {
val payload = play.api.libs.json.Json.toJson(moveForm)
_executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}/move", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Application", r, _.validate[com.bryzek.apidoc.api.v0.models.Application])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
}
object Attributes extends Attributes {
override def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
name: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Attribute]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
name.map("name" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/attributes", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Attribute]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Attribute]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByName(
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Attribute] = {
_executeRequest("GET", s"/attributes/${play.utils.UriEncoding.encodePathSegment(name, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Attribute", r, _.validate[com.bryzek.apidoc.api.v0.models.Attribute])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def post(
attributeForm: com.bryzek.apidoc.api.v0.models.AttributeForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Attribute] = {
val payload = play.api.libs.json.Json.toJson(attributeForm)
_executeRequest("POST", s"/attributes", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 201 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Attribute", r, _.validate[com.bryzek.apidoc.api.v0.models.Attribute])
case r if r.status == 401 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 401, 409")
}
}
override def deleteByName(
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/attributes/${play.utils.UriEncoding.encodePathSegment(name, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r if r.status == 401 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 401, 404")
}
}
}
object Changes extends Changes {
override def get(
orgKey: _root_.scala.Option[String] = None,
applicationKey: _root_.scala.Option[String] = None,
from: _root_.scala.Option[String] = None,
to: _root_.scala.Option[String] = None,
`type`: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Change]] = {
val queryParameters = Seq(
orgKey.map("org_key" -> _),
applicationKey.map("application_key" -> _),
from.map("from" -> _),
to.map("to" -> _),
`type`.map("type" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/changes", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Change]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Change]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
}
object Code extends Code {
override def get(
orgKey: String,
applicationKey: String,
version: String,
generatorKey: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Code] = {
_executeRequest("GET", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(version, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(generatorKey, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Code", r, _.validate[com.bryzek.apidoc.api.v0.models.Code])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404, 409")
}
}
}
object Domains extends Domains {
override def post(
orgKey: String,
domain: com.bryzek.apidoc.api.v0.models.Domain,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Domain] = {
val payload = play.api.libs.json.Json.toJson(domain)
_executeRequest("POST", s"/domains/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Domain", r, _.validate[com.bryzek.apidoc.api.v0.models.Domain])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def deleteByName(
orgKey: String,
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/domains/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(name, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
}
object EmailVerificationConfirmationForms extends EmailVerificationConfirmationForms {
override def post(
emailVerificationConfirmationForm: com.bryzek.apidoc.api.v0.models.EmailVerificationConfirmationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
val payload = play.api.libs.json.Json.toJson(emailVerificationConfirmationForm)
_executeRequest("POST", s"/email_verification_confirmations", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 409")
}
}
}
object GeneratorServices extends GeneratorServices {
override def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
uri: _root_.scala.Option[String] = None,
generatorKey: _root_.scala.Option[String] = None,
limit: Long = 100,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.GeneratorService]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
uri.map("uri" -> _),
generatorKey.map("generator_key" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/generator_services", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.GeneratorService]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.GeneratorService]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.GeneratorService] = {
_executeRequest("GET", s"/generator_services/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.GeneratorService", r, _.validate[com.bryzek.apidoc.api.v0.models.GeneratorService])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def post(
generatorServiceForm: com.bryzek.apidoc.api.v0.models.GeneratorServiceForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.GeneratorService] = {
val payload = play.api.libs.json.Json.toJson(generatorServiceForm)
_executeRequest("POST", s"/generator_services", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.GeneratorService", r, _.validate[com.bryzek.apidoc.api.v0.models.GeneratorService])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/generator_services/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r if r.status == 403 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 403, 404")
}
}
}
object GeneratorWithServices extends GeneratorWithServices {
override def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
serviceGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
serviceUri: _root_.scala.Option[String] = None,
attributeName: _root_.scala.Option[String] = None,
key: _root_.scala.Option[String] = None,
limit: Long = 100,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.GeneratorWithService]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
serviceGuid.map("service_guid" -> _.toString),
serviceUri.map("service_uri" -> _),
attributeName.map("attribute_name" -> _),
key.map("key" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/generators", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.GeneratorWithService]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.GeneratorWithService]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByKey(
key: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.GeneratorWithService] = {
_executeRequest("GET", s"/generators/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.GeneratorWithService", r, _.validate[com.bryzek.apidoc.api.v0.models.GeneratorWithService])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
}
object Healthchecks extends Healthchecks {
override def getHealthcheck(
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.generator.v0.models.Healthcheck] = {
_executeRequest("GET", s"/_internal_/healthcheck", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.generator.v0.models.Healthcheck", r, _.validate[com.bryzek.apidoc.generator.v0.models.Healthcheck])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getMigrate(
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Map[String, String]] = {
_executeRequest("GET", s"/_internal_/migrate", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Map[String, String]", r, _.validate[Map[String, String]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
}
object Items extends Items {
override def get(
q: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Item]] = {
val queryParameters = Seq(
q.map("q" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/items", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Item]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Item]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Item] = {
_executeRequest("GET", s"/items/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Item", r, _.validate[com.bryzek.apidoc.api.v0.models.Item])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
}
object MembershipRequests extends MembershipRequests {
override def get(
orgGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
orgKey: _root_.scala.Option[String] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
role: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.MembershipRequest]] = {
val queryParameters = Seq(
orgGuid.map("org_guid" -> _.toString),
orgKey.map("org_key" -> _),
userGuid.map("user_guid" -> _.toString),
role.map("role" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/membership_requests", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.MembershipRequest]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.MembershipRequest]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def post(
orgGuid: _root_.java.util.UUID,
userGuid: _root_.java.util.UUID,
role: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.MembershipRequest] = {
val payload = play.api.libs.json.Json.obj(
"org_guid" -> play.api.libs.json.Json.toJson(orgGuid),
"user_guid" -> play.api.libs.json.Json.toJson(userGuid),
"role" -> play.api.libs.json.Json.toJson(role)
)
_executeRequest("POST", s"/membership_requests", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.MembershipRequest", r, _.validate[com.bryzek.apidoc.api.v0.models.MembershipRequest])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def postAcceptByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("POST", s"/membership_requests/${guid}/accept", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 409")
}
}
override def postDeclineByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("POST", s"/membership_requests/${guid}/decline", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 409")
}
}
}
object Memberships extends Memberships {
override def get(
orgGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
orgKey: _root_.scala.Option[String] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
role: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Membership]] = {
val queryParameters = Seq(
orgGuid.map("org_guid" -> _.toString),
orgKey.map("org_key" -> _),
userGuid.map("user_guid" -> _.toString),
role.map("role" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/memberships", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Membership]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Membership]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Membership] = {
_executeRequest("GET", s"/memberships/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Membership", r, _.validate[com.bryzek.apidoc.api.v0.models.Membership])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/memberships/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
}
object Organizations extends Organizations {
override def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
key: _root_.scala.Option[String] = None,
name: _root_.scala.Option[String] = None,
namespace: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Organization]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
userGuid.map("user_guid" -> _.toString),
key.map("key" -> _),
name.map("name" -> _),
namespace.map("namespace" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/organizations", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Organization]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Organization]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByKey(
key: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Organization] = {
_executeRequest("GET", s"/organizations/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Organization", r, _.validate[com.bryzek.apidoc.api.v0.models.Organization])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def post(
organizationForm: com.bryzek.apidoc.api.v0.models.OrganizationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Organization] = {
val payload = play.api.libs.json.Json.toJson(organizationForm)
_executeRequest("POST", s"/organizations", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Organization", r, _.validate[com.bryzek.apidoc.api.v0.models.Organization])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def putByKey(
key: String,
organizationForm: com.bryzek.apidoc.api.v0.models.OrganizationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Organization] = {
val payload = play.api.libs.json.Json.toJson(organizationForm)
_executeRequest("PUT", s"/organizations/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Organization", r, _.validate[com.bryzek.apidoc.api.v0.models.Organization])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def deleteByKey(
key: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/organizations/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
override def getAttributesByKey(
key: String,
name: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.AttributeValue]] = {
val queryParameters = Seq(
name.map("name" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/organizations/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}/attributes", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.AttributeValue]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.AttributeValue]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getAttributesByKeyAndName(
key: String,
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.AttributeValue] = {
_executeRequest("GET", s"/organizations/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}/attributes/${play.utils.UriEncoding.encodePathSegment(name, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.AttributeValue", r, _.validate[com.bryzek.apidoc.api.v0.models.AttributeValue])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def putAttributesByKeyAndName(
key: String,
name: String,
attributeValueForm: com.bryzek.apidoc.api.v0.models.AttributeValueForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.AttributeValue] = {
val payload = play.api.libs.json.Json.toJson(attributeValueForm)
_executeRequest("PUT", s"/organizations/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}/attributes/${play.utils.UriEncoding.encodePathSegment(name, "UTF-8")}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.AttributeValue", r, _.validate[com.bryzek.apidoc.api.v0.models.AttributeValue])
case r if r.status == 201 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.AttributeValue", r, _.validate[com.bryzek.apidoc.api.v0.models.AttributeValue])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 201, 404, 409")
}
}
override def deleteAttributesByKeyAndName(
key: String,
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/organizations/${play.utils.UriEncoding.encodePathSegment(key, "UTF-8")}/attributes/${play.utils.UriEncoding.encodePathSegment(name, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r if r.status == 401 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 401, 404")
}
}
}
object PasswordResetRequests extends PasswordResetRequests {
override def post(
passwordResetRequest: com.bryzek.apidoc.api.v0.models.PasswordResetRequest,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
val payload = play.api.libs.json.Json.toJson(passwordResetRequest)
_executeRequest("POST", s"/password_reset_requests", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204, 409")
}
}
}
object PasswordResets extends PasswordResets {
override def post(
passwordReset: com.bryzek.apidoc.api.v0.models.PasswordReset,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.PasswordResetSuccess] = {
val payload = play.api.libs.json.Json.toJson(passwordReset)
_executeRequest("POST", s"/password_resets", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.PasswordResetSuccess", r, _.validate[com.bryzek.apidoc.api.v0.models.PasswordResetSuccess])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
}
object Subscriptions extends Subscriptions {
override def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
organizationKey: _root_.scala.Option[String] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
publication: _root_.scala.Option[com.bryzek.apidoc.api.v0.models.Publication] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Subscription]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
organizationKey.map("organization_key" -> _),
userGuid.map("user_guid" -> _.toString),
publication.map("publication" -> _.toString),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/subscriptions", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Subscription]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Subscription]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Subscription] = {
_executeRequest("GET", s"/subscriptions/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Subscription", r, _.validate[com.bryzek.apidoc.api.v0.models.Subscription])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def post(
subscriptionForm: com.bryzek.apidoc.api.v0.models.SubscriptionForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Subscription] = {
val payload = play.api.libs.json.Json.toJson(subscriptionForm)
_executeRequest("POST", s"/subscriptions", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 201 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Subscription", r, _.validate[com.bryzek.apidoc.api.v0.models.Subscription])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409")
}
}
override def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/subscriptions/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
}
object Tokens extends Tokens {
override def getUsersByUserGuid(
userGuid: _root_.java.util.UUID,
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Token]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/tokens/users/${userGuid}", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Token]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Token]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getCleartextByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.CleartextToken] = {
_executeRequest("GET", s"/tokens/${guid}/cleartext", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.CleartextToken", r, _.validate[com.bryzek.apidoc.api.v0.models.CleartextToken])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def post(
tokenForm: com.bryzek.apidoc.api.v0.models.TokenForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Token] = {
val payload = play.api.libs.json.Json.toJson(tokenForm)
_executeRequest("POST", s"/tokens", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 201 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Token", r, _.validate[com.bryzek.apidoc.api.v0.models.Token])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409")
}
}
override def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/tokens/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
}
object Users extends Users {
override def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
email: _root_.scala.Option[String] = None,
token: _root_.scala.Option[String] = None,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.User]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
email.map("email" -> _),
token.map("token" -> _)
).flatten
_executeRequest("GET", s"/users", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.User]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.User]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User] = {
_executeRequest("GET", s"/users/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.User", r, _.validate[com.bryzek.apidoc.api.v0.models.User])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def postAuthenticate(
email: String,
password: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User] = {
val payload = play.api.libs.json.Json.obj(
"email" -> play.api.libs.json.Json.toJson(email),
"password" -> play.api.libs.json.Json.toJson(password)
)
_executeRequest("POST", s"/users/authenticate", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.User", r, _.validate[com.bryzek.apidoc.api.v0.models.User])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def post(
userForm: com.bryzek.apidoc.api.v0.models.UserForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User] = {
val payload = play.api.libs.json.Json.toJson(userForm)
_executeRequest("POST", s"/users", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.User", r, _.validate[com.bryzek.apidoc.api.v0.models.User])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def putByGuid(
guid: _root_.java.util.UUID,
userUpdateForm: com.bryzek.apidoc.api.v0.models.UserUpdateForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User] = {
val payload = play.api.libs.json.Json.toJson(userUpdateForm)
_executeRequest("PUT", s"/users/${guid}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.User", r, _.validate[com.bryzek.apidoc.api.v0.models.User])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
}
object Validations extends Validations {
override def post(
value: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Validation] = {
val payload = play.api.libs.json.Json.toJson(value)
_executeRequest("POST", s"/validations", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Validation", r, _.validate[com.bryzek.apidoc.api.v0.models.Validation])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
}
object Versions extends Versions {
override def getByApplicationKey(
orgKey: String,
applicationKey: String,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Version]] = {
val queryParameters = Seq(
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Version]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Version]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByApplicationKeyAndVersion(
orgKey: String,
applicationKey: String,
version: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Version] = {
_executeRequest("GET", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(version, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Version", r, _.validate[com.bryzek.apidoc.api.v0.models.Version])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def postByVersion(
orgKey: String,
version: String,
versionForm: com.bryzek.apidoc.api.v0.models.VersionForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Version] = {
val payload = play.api.libs.json.Json.toJson(versionForm)
_executeRequest("POST", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(version, "UTF-8")}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Version", r, _.validate[com.bryzek.apidoc.api.v0.models.Version])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def putByApplicationKeyAndVersion(
orgKey: String,
applicationKey: String,
version: String,
versionForm: com.bryzek.apidoc.api.v0.models.VersionForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Version] = {
val payload = play.api.libs.json.Json.toJson(versionForm)
_executeRequest("PUT", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(version, "UTF-8")}", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Version", r, _.validate[com.bryzek.apidoc.api.v0.models.Version])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 409")
}
}
override def deleteByApplicationKeyAndVersion(
orgKey: String,
applicationKey: String,
version: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/${play.utils.UriEncoding.encodePathSegment(orgKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(applicationKey, "UTF-8")}/${play.utils.UriEncoding.encodePathSegment(version, "UTF-8")}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
}
object Watches extends Watches {
override def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
organizationKey: _root_.scala.Option[String] = None,
applicationKey: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Watch]] = {
val queryParameters = Seq(
guid.map("guid" -> _.toString),
userGuid.map("user_guid" -> _.toString),
organizationKey.map("organization_key" -> _),
applicationKey.map("application_key" -> _),
Some("limit" -> limit.toString),
Some("offset" -> offset.toString)
).flatten
_executeRequest("GET", s"/watches", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Watch]", r, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Watch]])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Watch] = {
_executeRequest("GET", s"/watches/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Watch", r, _.validate[com.bryzek.apidoc.api.v0.models.Watch])
case r if r.status == 404 => throw new com.bryzek.apidoc.api.v0.errors.UnitResponse(r.status)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200, 404")
}
}
override def getCheck(
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
organizationKey: String,
applicationKey: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Boolean] = {
val queryParameters = Seq(
userGuid.map("user_guid" -> _.toString),
Some("organization_key" -> organizationKey),
Some("application_key" -> applicationKey)
).flatten
_executeRequest("GET", s"/watches/check", queryParameters = queryParameters, requestHeaders = requestHeaders).map {
case r if r.status == 200 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Boolean", r, _.validate[Boolean])
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 200")
}
}
override def post(
watchForm: com.bryzek.apidoc.api.v0.models.WatchForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Watch] = {
val payload = play.api.libs.json.Json.toJson(watchForm)
_executeRequest("POST", s"/watches", body = Some(payload), requestHeaders = requestHeaders).map {
case r if r.status == 201 => _root_.com.bryzek.apidoc.api.v0.Client.parseJson("com.bryzek.apidoc.api.v0.models.Watch", r, _.validate[com.bryzek.apidoc.api.v0.models.Watch])
case r if r.status == 409 => throw new com.bryzek.apidoc.api.v0.errors.ErrorsResponse(r)
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 201, 409")
}
}
override def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit] = {
_executeRequest("DELETE", s"/watches/${guid}", requestHeaders = requestHeaders).map {
case r if r.status == 204 => ()
case r => throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Unsupported response code[${r.status}]. Expected: 204")
}
}
}
def _requestHolder(path: String): play.api.libs.ws.WSRequest = {
import play.api.Play.current
val holder = play.api.libs.ws.WS.url(baseUrl + path).withHeaders(
"User-Agent" -> Constants.UserAgent,
"X-Apidoc-Version" -> Constants.Version,
"X-Apidoc-Version-Major" -> Constants.VersionMajor.toString
).withHeaders(defaultHeaders : _*)
auth.fold(holder) {
case Authorization.Basic(username, password) => {
holder.withAuth(username, password.getOrElse(""), play.api.libs.ws.WSAuthScheme.BASIC)
}
case a => sys.error("Invalid authorization scheme[" + a.getClass + "]")
}
}
def _logRequest(method: String, req: play.api.libs.ws.WSRequest)(implicit ec: scala.concurrent.ExecutionContext): play.api.libs.ws.WSRequest = {
val queryComponents = for {
(name, values) <- req.queryString
value <- values
} yield s"$name=$value"
val url = s"${req.url}${queryComponents.mkString("?", "&", "")}"
auth.fold(logger.info(s"curl -X $method $url")) { _ =>
logger.info(s"curl -X $method -u '[REDACTED]:' $url")
}
req
}
def _executeRequest(
method: String,
path: String,
queryParameters: Seq[(String, String)] = Nil,
requestHeaders: Seq[(String, String)] = Nil,
body: Option[play.api.libs.json.JsValue] = None
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[play.api.libs.ws.WSResponse] = {
method.toUpperCase match {
case "GET" => {
_logRequest("GET", _requestHolder(path).withHeaders(requestHeaders:_*).withQueryString(queryParameters:_*)).get()
}
case "POST" => {
_logRequest("POST", _requestHolder(path).withHeaders(_withJsonContentType(requestHeaders):_*).withQueryString(queryParameters:_*)).post(body.getOrElse(play.api.libs.json.Json.obj()))
}
case "PUT" => {
_logRequest("PUT", _requestHolder(path).withHeaders(_withJsonContentType(requestHeaders):_*).withQueryString(queryParameters:_*)).put(body.getOrElse(play.api.libs.json.Json.obj()))
}
case "PATCH" => {
_logRequest("PATCH", _requestHolder(path).withHeaders(requestHeaders:_*).withQueryString(queryParameters:_*)).patch(body.getOrElse(play.api.libs.json.Json.obj()))
}
case "DELETE" => {
_logRequest("DELETE", _requestHolder(path).withHeaders(requestHeaders:_*).withQueryString(queryParameters:_*)).delete()
}
case "HEAD" => {
_logRequest("HEAD", _requestHolder(path).withHeaders(requestHeaders:_*).withQueryString(queryParameters:_*)).head()
}
case "OPTIONS" => {
_logRequest("OPTIONS", _requestHolder(path).withHeaders(requestHeaders:_*).withQueryString(queryParameters:_*)).options()
}
case _ => {
_logRequest(method, _requestHolder(path).withHeaders(requestHeaders:_*).withQueryString(queryParameters:_*))
sys.error("Unsupported method[%s]".format(method))
}
}
}
/**
* Adds a Content-Type: application/json header unless the specified requestHeaders
* already contain a Content-Type header
*/
def _withJsonContentType(headers: Seq[(String, String)]): Seq[(String, String)] = {
headers.find { _._1.toUpperCase == "CONTENT-TYPE" } match {
case None => headers ++ Seq(("Content-Type" -> "application/json; charset=UTF-8"))
case Some(_) => headers
}
}
}
object Client {
def parseJson[T](
className: String,
r: play.api.libs.ws.WSResponse,
f: (play.api.libs.json.JsValue => play.api.libs.json.JsResult[T])
): T = {
f(play.api.libs.json.Json.parse(r.body)) match {
case play.api.libs.json.JsSuccess(x, _) => x
case play.api.libs.json.JsError(errors) => {
throw new com.bryzek.apidoc.api.v0.errors.FailedRequest(r.status, s"Invalid json for class[" + className + "]: " + errors.mkString(" "))
}
}
}
}
sealed trait Authorization
object Authorization {
case class Basic(username: String, password: Option[String] = None) extends Authorization
}
package interfaces {
trait Client {
def baseUrl: String
def applications: com.bryzek.apidoc.api.v0.Applications
def attributes: com.bryzek.apidoc.api.v0.Attributes
def changes: com.bryzek.apidoc.api.v0.Changes
def code: com.bryzek.apidoc.api.v0.Code
def domains: com.bryzek.apidoc.api.v0.Domains
def emailVerificationConfirmationForms: com.bryzek.apidoc.api.v0.EmailVerificationConfirmationForms
def generatorServices: com.bryzek.apidoc.api.v0.GeneratorServices
def generatorWithServices: com.bryzek.apidoc.api.v0.GeneratorWithServices
def healthchecks: com.bryzek.apidoc.api.v0.Healthchecks
def items: com.bryzek.apidoc.api.v0.Items
def membershipRequests: com.bryzek.apidoc.api.v0.MembershipRequests
def memberships: com.bryzek.apidoc.api.v0.Memberships
def organizations: com.bryzek.apidoc.api.v0.Organizations
def passwordResetRequests: com.bryzek.apidoc.api.v0.PasswordResetRequests
def passwordResets: com.bryzek.apidoc.api.v0.PasswordResets
def subscriptions: com.bryzek.apidoc.api.v0.Subscriptions
def tokens: com.bryzek.apidoc.api.v0.Tokens
def users: com.bryzek.apidoc.api.v0.Users
def validations: com.bryzek.apidoc.api.v0.Validations
def versions: com.bryzek.apidoc.api.v0.Versions
def watches: com.bryzek.apidoc.api.v0.Watches
}
}
trait Applications {
/**
* Search all applications. Results are always paginated.
*/
def get(
orgKey: String,
name: _root_.scala.Option[String] = None,
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
key: _root_.scala.Option[String] = None,
hasVersion: _root_.scala.Option[Boolean] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Application]]
/**
* Create an application.
*/
def post(
orgKey: String,
applicationForm: com.bryzek.apidoc.api.v0.models.ApplicationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Application]
/**
* Updates an application.
*/
def putByApplicationKey(
orgKey: String,
applicationKey: String,
applicationForm: com.bryzek.apidoc.api.v0.models.ApplicationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Application]
/**
* Deletes a specific application and its associated versions.
*/
def deleteByApplicationKey(
orgKey: String,
applicationKey: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
/**
* Moves application to a new organization.
*/
def postMoveByApplicationKey(
orgKey: String,
applicationKey: String,
moveForm: com.bryzek.apidoc.api.v0.models.MoveForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Application]
}
trait Attributes {
/**
* Search all attributes. Results are always paginated.
*/
def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
name: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Attribute]]
/**
* Returns the attribute with this name.
*/
def getByName(
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Attribute]
/**
* Create a new attribute.
*/
def post(
attributeForm: com.bryzek.apidoc.api.v0.models.AttributeForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Attribute]
/**
* Deletes the attribute with this name. Only the user who created an attribute can
* delete it.
*/
def deleteByName(
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait Changes {
def get(
orgKey: _root_.scala.Option[String] = None,
applicationKey: _root_.scala.Option[String] = None,
from: _root_.scala.Option[String] = None,
to: _root_.scala.Option[String] = None,
`type`: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Change]]
}
trait Code {
/**
* Generate code for a specific version of an application.
*/
def get(
orgKey: String,
applicationKey: String,
version: String,
generatorKey: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Code]
}
trait Domains {
/**
* Add a domain to this organization
*/
def post(
orgKey: String,
domain: com.bryzek.apidoc.api.v0.models.Domain,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Domain]
/**
* Remove this domain from this organization
*/
def deleteByName(
orgKey: String,
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait EmailVerificationConfirmationForms {
/**
* Validate an email address using a token.
*/
def post(
emailVerificationConfirmationForm: com.bryzek.apidoc.api.v0.models.EmailVerificationConfirmationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait GeneratorServices {
/**
* List all generator services
*/
def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
uri: _root_.scala.Option[String] = None,
generatorKey: _root_.scala.Option[String] = None,
limit: Long = 100,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.GeneratorService]]
def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.GeneratorService]
def post(
generatorServiceForm: com.bryzek.apidoc.api.v0.models.GeneratorServiceForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.GeneratorService]
/**
* Deletes a generator service.
*/
def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait GeneratorWithServices {
/**
* List all available generators
*/
def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
serviceGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
serviceUri: _root_.scala.Option[String] = None,
attributeName: _root_.scala.Option[String] = None,
key: _root_.scala.Option[String] = None,
limit: Long = 100,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.GeneratorWithService]]
def getByKey(
key: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.GeneratorWithService]
}
trait Healthchecks {
def getHealthcheck(
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.generator.v0.models.Healthcheck]
def getMigrate(
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Map[String, String]]
}
trait Items {
def get(
q: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Item]]
def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Item]
}
trait MembershipRequests {
/**
* Search all membership requests. Results are always paginated.
*/
def get(
orgGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
orgKey: _root_.scala.Option[String] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
role: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.MembershipRequest]]
/**
* Create a membership request
*/
def post(
orgGuid: _root_.java.util.UUID,
userGuid: _root_.java.util.UUID,
role: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.MembershipRequest]
/**
* Accepts this membership request. User will become a member of the specified
* organization.
*/
def postAcceptByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
/**
* Declines this membership request. User will NOT become a member of the specified
* organization.
*/
def postDeclineByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait Memberships {
/**
* Search all memberships. Results are always paginated.
*/
def get(
orgGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
orgKey: _root_.scala.Option[String] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
role: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Membership]]
def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Membership]
def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait Organizations {
/**
* Search all organizations. Results are always paginated.
*/
def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
key: _root_.scala.Option[String] = None,
name: _root_.scala.Option[String] = None,
namespace: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Organization]]
/**
* Returns the organization with this key.
*/
def getByKey(
key: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Organization]
/**
* Create a new organization.
*/
def post(
organizationForm: com.bryzek.apidoc.api.v0.models.OrganizationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Organization]
/**
* Update an organization.
*/
def putByKey(
key: String,
organizationForm: com.bryzek.apidoc.api.v0.models.OrganizationForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Organization]
/**
* Deletes an organization and all of its associated applications.
*/
def deleteByKey(
key: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
/**
* Returns all attribute values for this organization. Results are always
* paginated.
*/
def getAttributesByKey(
key: String,
name: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.AttributeValue]]
/**
* Returns the attribute value with this name.
*/
def getAttributesByKeyAndName(
key: String,
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.AttributeValue]
/**
* Create or update a new attribute value.
*/
def putAttributesByKeyAndName(
key: String,
name: String,
attributeValueForm: com.bryzek.apidoc.api.v0.models.AttributeValueForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.AttributeValue]
/**
* Deletes the attribute value with the specified name. Only the user who created
* an attribute value can delete it.
*/
def deleteAttributesByKeyAndName(
key: String,
name: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait PasswordResetRequests {
/**
* Create a new password reset. This will send the user an email with a link to
* reset their password.
*/
def post(
passwordResetRequest: com.bryzek.apidoc.api.v0.models.PasswordResetRequest,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait PasswordResets {
/**
* Change the password for this token. If the token is invalid, has been used, or
* otherwise no longer can be applied, errors will be returned as 409s. A 204
* represents that the user has successfully changed their password.
*/
def post(
passwordReset: com.bryzek.apidoc.api.v0.models.PasswordReset,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.PasswordResetSuccess]
}
trait Subscriptions {
/**
* Search subscriptions. Always paginated.
*/
def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
organizationKey: _root_.scala.Option[String] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
publication: _root_.scala.Option[com.bryzek.apidoc.api.v0.models.Publication] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Subscription]]
/**
* Returns information about a specific subscription.
*/
def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Subscription]
/**
* Create a new subscription.
*/
def post(
subscriptionForm: com.bryzek.apidoc.api.v0.models.SubscriptionForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Subscription]
def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait Tokens {
def getUsersByUserGuid(
userGuid: _root_.java.util.UUID,
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Token]]
/**
* Used to fetch the clear text token.
*/
def getCleartextByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.CleartextToken]
/**
* Create a new API token for this user
*/
def post(
tokenForm: com.bryzek.apidoc.api.v0.models.TokenForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Token]
def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait Users {
/**
* Search for a specific user. You must specify at least 1 parameter - either a
* guid, email or token - and will receive back either 0 or 1 users.
*/
def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
email: _root_.scala.Option[String] = None,
token: _root_.scala.Option[String] = None,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.User]]
/**
* Returns information about the user with this guid.
*/
def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User]
/**
* Used to authenticate a user with an email address and password. Successful
* authentication returns an instance of the user model. Failed authorizations of
* any kind are returned as a generic error with code user_authorization_failed.
*/
def postAuthenticate(
email: String,
password: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User]
/**
* Create a new user.
*/
def post(
userForm: com.bryzek.apidoc.api.v0.models.UserForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User]
/**
* Updates information about the user with the specified guid.
*/
def putByGuid(
guid: _root_.java.util.UUID,
userUpdateForm: com.bryzek.apidoc.api.v0.models.UserUpdateForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.User]
}
trait Validations {
def post(
value: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Validation]
}
trait Versions {
/**
* Search all versions of this application. Results are always paginated.
*/
def getByApplicationKey(
orgKey: String,
applicationKey: String,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Version]]
/**
* Retrieve a specific version of an application.
*/
def getByApplicationKeyAndVersion(
orgKey: String,
applicationKey: String,
version: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Version]
/**
* Create a new version for an application
*/
def postByVersion(
orgKey: String,
version: String,
versionForm: com.bryzek.apidoc.api.v0.models.VersionForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Version]
/**
* Upsert a version of an application
*/
def putByApplicationKeyAndVersion(
orgKey: String,
applicationKey: String,
version: String,
versionForm: com.bryzek.apidoc.api.v0.models.VersionForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Version]
/**
* Deletes a specific version.
*/
def deleteByApplicationKeyAndVersion(
orgKey: String,
applicationKey: String,
version: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
trait Watches {
/**
* Search attributes. Always paginated.
*/
def get(
guid: _root_.scala.Option[_root_.java.util.UUID] = None,
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
organizationKey: _root_.scala.Option[String] = None,
applicationKey: _root_.scala.Option[String] = None,
limit: Long = 25,
offset: Long = 0,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Seq[com.bryzek.apidoc.api.v0.models.Watch]]
/**
* Returns information about a specific watch.
*/
def getByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Watch]
/**
* Quick check if a user is watching a specific application.
*/
def getCheck(
userGuid: _root_.scala.Option[_root_.java.util.UUID] = None,
organizationKey: String,
applicationKey: String,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Boolean]
/**
* Create a new watch.
*/
def post(
watchForm: com.bryzek.apidoc.api.v0.models.WatchForm,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[com.bryzek.apidoc.api.v0.models.Watch]
def deleteByGuid(
guid: _root_.java.util.UUID,
requestHeaders: Seq[(String, String)] = Nil
)(implicit ec: scala.concurrent.ExecutionContext): scala.concurrent.Future[Unit]
}
package errors {
import com.bryzek.apidoc.api.v0.models.json._
import com.bryzek.apidoc.common.v0.models.json._
import com.bryzek.apidoc.generator.v0.models.json._
import com.bryzek.apidoc.spec.v0.models.json._
case class ErrorsResponse(
response: play.api.libs.ws.WSResponse,
message: Option[String] = None
) extends Exception(message.getOrElse(response.status + ": " + response.body)){
lazy val errors = _root_.com.bryzek.apidoc.api.v0.Client.parseJson("Seq[com.bryzek.apidoc.api.v0.models.Error]", response, _.validate[Seq[com.bryzek.apidoc.api.v0.models.Error]])
}
case class UnitResponse(status: Int) extends Exception(s"HTTP $status")
case class FailedRequest(responseCode: Int, message: String, requestUri: Option[_root_.java.net.URI] = None) extends _root_.java.lang.Exception(s"HTTP $responseCode: $message")
}
} | mit |
newasia2538/MaterializeGoogleContacts | js/custom-js.js | 1224 | $('.button').sideNav({
menuWidth: 260, // Default is 300
edge: 'left', // Choose the horizontal origin
closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor
draggable: true // Choose whether you can drag to open on touch screens
}
);
$('.modal').modal({
dismissible: true, // Modal can be dismissed by clicking outside of the modal
opacity: .5, // Opacity of modal background
inDuration: 300, // Transition in duration
outDuration: 200, // Transition out duration
startingTop: '4%', // Starting top style attribute
endingTop: '10%', // Ending top style attribute
ready: function(modal, trigger) { // Callback for Modal open. Modal and trigger parameters available.
},
complete: function() {} // Callback for Modal close
}
);
$('.collapsible').collapsible({
accordion: false, // A setting that changes the collapsible behavior to expandable instead of the default accordion style
onOpen: function(el) {}, // Callback for Collapsible open
onClose: function(el) {} // Callback for Collapsible close
});
$(document).ready(function() {
$('select').material_select();
});
$('#feedback').val('');
$('#feedback').trigger('autoresize');
| mit |
vovkos/jancy | src/jnc_ct/jnc_ct_VariableMgr/jnc_ct_VariableMgr.h | 4150 | //..............................................................................
//
// This file is part of the Jancy toolkit.
//
// Jancy is distributed under the MIT license.
// For details see accompanying license.txt file,
// the public copy of which is also available at:
// http://tibbo.com/downloads/archive/jancy/license.txt
//
//..............................................................................
#pragma once
#include "jnc_ct_Variable.h"
#include "jnc_ct_Value.h"
namespace jnc {
namespace ct {
class ClassType;
class Function;
//..............................................................................
class VariableMgr {
friend class Module;
friend class Variable;
protected:
Module* m_module;
sl::List<Variable> m_variableList;
sl::Array<Variable*> m_staticVariableArray;
sl::Array<Variable*> m_staticGcRootArray;
sl::Array<Variable*> m_globalVariablePrimeArray;
sl::Array<Variable*> m_globalVariableInitializeArray;
sl::Array<Variable*> m_liftedStackVariableArray;
sl::Array<Variable*> m_argVariableArray;
sl::Array<Variable*> m_tlsVariableArray;
Variable* m_currentLiftedStackVariable;
StructType* m_tlsStructType;
Variable* m_stdVariableArray[StdVariable__Count];
public:
VariableMgr();
Module*
getModule() {
return m_module;
}
void
clear();
void
createStdVariables();
void
finalizeFunction();
bool
isStdVariableUsed(StdVariable variable) {
ASSERT(variable < StdVariable__Count);
return m_stdVariableArray[variable] != NULL;
}
Variable*
getStdVariable(StdVariable variable);
const sl::List<Variable>&
getVariableList() {
return m_variableList;
}
const sl::Array<Variable*>&
getStaticGcRootArray() {
return m_staticGcRootArray;
}
const sl::Array<Variable*>&
getStaticVariableArray() {
return m_staticVariableArray;
}
const sl::Array<Variable*>&
getGlobalVariablePrimeArray() {
return m_globalVariablePrimeArray;
}
const sl::Array<Variable*>&
getGlobalVariableInitializeArray() {
return m_globalVariableInitializeArray;
}
const sl::Array<Variable*>&
getArgVariableArray() {
return m_argVariableArray;
}
const sl::Array<Variable*>&
getTlsVariableArray() {
return m_tlsVariableArray;
}
StructType*
getTlsStructType() {
ASSERT(m_tlsStructType);
return m_tlsStructType;
}
Variable*
getCurrentLiftedStackVariable() {
return m_currentLiftedStackVariable;
}
Variable*
createVariable(
StorageKind storageKind,
const sl::StringRef& name,
const sl::StringRef& qualifiedName,
Type* type,
uint_t ptrTypeFlags = 0,
sl::BoxList<Token>* constructor = NULL,
sl::BoxList<Token>* initializer = NULL
);
Variable*
createSimpleStackVariable(
const sl::StringRef& name,
Type* type,
uint_t ptrTypeFlags = 0
);
Variable*
createSimpleStaticVariable(
const sl::StringRef& name,
const sl::StringRef& qualifiedName,
Type* type,
const Value& value = Value(),
uint_t ptrTypeFlags = 0
);
Variable*
createOnceFlagVariable(StorageKind storageKind = StorageKind_Static);
LeanDataPtrValidator*
createStaticDataPtrValidator(Variable* variable);
Variable*
createArgVariable(
FunctionArg* arg,
size_t argIdx
);
Variable*
createAsyncArgVariable(
const sl::StringRef& name,
Type* type,
const Value& value
);
bool
createTlsStructType();
bool
allocateVariable(Variable* variable);
void
primeStaticClassVariable(Variable* variable);
bool
initializeVariable(Variable* variable);
void
liftStackVariable(Variable* variable);
bool
finalizeDisposableVariable(Variable* variable);
bool
allocateNamespaceVariables(const sl::ConstIterator<Variable>& prevIt);
void
primeGlobalVariables();
bool
initializeGlobalVariables();
void
appendGlobalVariablePrimeArray(const sl::ArrayRef<Variable*>& array) {
m_globalVariablePrimeArray.append(array);
}
protected:
llvm::GlobalVariable*
createLlvmGlobalVariable(
Type* type,
const sl::StringRef& name,
const Value& initValue = Value()
);
bool
allocateHeapVariable(Variable* variable);
};
//..............................................................................
} // namespace ct
} // namespace jnc
| mit |
SquidDev-CC/plethora | src/main/java/org/squiddev/plethora/integration/tconstruct/MetaTConstruct.java | 2406 | package org.squiddev.plethora.integration.tconstruct;
import net.minecraft.item.ItemStack;
import org.squiddev.plethora.api.Injects;
import org.squiddev.plethora.api.meta.ItemStackMetaProvider;
import org.squiddev.plethora.api.meta.SimpleMetaProvider;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.library.materials.ExtraMaterialStats;
import slimeknights.tconstruct.library.materials.HandleMaterialStats;
import slimeknights.tconstruct.library.materials.HeadMaterialStats;
import slimeknights.tconstruct.library.materials.IMaterialStats;
import slimeknights.tconstruct.library.modifiers.IToolMod;
import slimeknights.tconstruct.library.tools.IToolPart;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@Injects(TConstruct.modID)
public final class MetaTConstruct {
public static final SimpleMetaProvider<IMaterialStats> META_MATERIAL_STATS = stats -> {
Map<String, Object> out = new HashMap<>(2);
out.put("id", stats.getIdentifier());
out.put("name", stats.getLocalizedName());
return out;
};
public static final SimpleMetaProvider<ExtraMaterialStats> META_EXTRA_MATERIAL_STATS = stats ->
Collections.singletonMap("extraDurability", stats.extraDurability);
public static final SimpleMetaProvider<HandleMaterialStats> META_HANDLE_STATS = stats -> {
Map<String, Object> out = new HashMap<>(2);
out.put("durability", stats.durability);
out.put("modifier", stats.modifier);
return out;
};
public static final SimpleMetaProvider<HeadMaterialStats> META_HEAD_STATS = stats -> {
Map<String, Object> out = new HashMap<>(4);
out.put("attack", stats.attack);
out.put("durability", stats.durability);
out.put("miningSpeed", stats.miningspeed);
out.put("miningLevel", stats.harvestLevel);
return out;
};
public static final SimpleMetaProvider<IToolMod> META_TOOL_MOD = mod -> {
Map<String, Object> out = new HashMap<>(2);
out.put("id", mod.getIdentifier());
out.put("name", mod.getLocalizedName());
return out;
};
public static final ItemStackMetaProvider<IToolPart> META_TOOL_PART = new ItemStackMetaProvider<IToolPart>("toolPart", IToolPart.class) {
@Nonnull
@Override
public Map<String, ?> getMeta(@Nonnull ItemStack stack, @Nonnull IToolPart toolPart) {
return Collections.singletonMap("cost", toolPart.getCost());
}
};
private MetaTConstruct() {
}
}
| mit |
tcharding/tobin.cc | README.md | 182 | Personal Website
================
Built using [Hugo](https://gohugo.io/),
themed using [Nix](http://themes.gohugo.io/hugo-theme-nix/).
Site URL: [http://tobin.cc](http://tobin.cc)
| mit |
billwen/netopt | harpy3/doc/api/classes/ActiveSupport/Rescuable.html | 10388 | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ActiveSupport::Rescuable</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<span>Ruby on Rails 4.0.2</span><br />
<h1>
<span class="type">Module</span>
ActiveSupport::Rescuable
</h1>
<ul class="files">
<li><a href="../../files/__/__/__/__/usr/local/lib/ruby/gems/2_1_0/gems/activesupport-4_0_2/lib/active_support/rescuable_rb.html">/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_support/rescuable.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<p><a href="Rescuable.html">Rescuable</a> module adds support for easier
exception handling.</p>
</div>
<!-- Namespace -->
<div class="sectiontitle">Namespace</div>
<ul>
<li>
<span class="type">MODULE</span>
<a href="Rescuable/ClassMethods.html">ActiveSupport::Rescuable::ClassMethods</a>
</li>
</ul>
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>H</dt>
<dd>
<ul>
<li>
<a href="#method-i-handler_for_rescue">handler_for_rescue</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-rescue_with_handler">rescue_with_handler</a>
</li>
</ul>
</dd>
</dl>
<!-- Methods -->
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-handler_for_rescue">
<b>handler_for_rescue</b>(exception)
<a href="../../classes/ActiveSupport/Rescuable.html#method-i-handler_for_rescue" name="method-i-handler_for_rescue" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-handler_for_rescue_source')" id="l_method-i-handler_for_rescue_source">show</a>
</p>
<div id="method-i-handler_for_rescue_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../../../usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_support/rescuable.rb, line 85</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">handler_for_rescue</span>(<span class="ruby-identifier">exception</span>)
<span class="ruby-comment"># We go from right to left because pairs are pushed onto rescue_handlers</span>
<span class="ruby-comment"># as rescue_from declarations are found.</span>
<span class="ruby-identifier">_</span>, <span class="ruby-identifier">rescuer</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">rescue_handlers</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">detect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">klass_name</span>, <span class="ruby-identifier">handler</span><span class="ruby-operator">|</span>
<span class="ruby-comment"># The purpose of allowing strings in rescue_from is to support the</span>
<span class="ruby-comment"># declaration of handler associations for exception classes whose</span>
<span class="ruby-comment"># definition is yet unknown.</span>
<span class="ruby-comment">#</span>
<span class="ruby-comment"># Since this loop needs the constants it would be inconsistent to</span>
<span class="ruby-comment"># assume they should exist at this point. An early raised exception</span>
<span class="ruby-comment"># could trigger some other handler and the array could include</span>
<span class="ruby-comment"># precisely a string whose corresponding constant has not yet been</span>
<span class="ruby-comment"># seen. This is why we are tolerant to unknown constants.</span>
<span class="ruby-comment">#</span>
<span class="ruby-comment"># Note that this tolerance only matters if the exception was given as</span>
<span class="ruby-comment"># a string, otherwise a NameError will be raised by the interpreter</span>
<span class="ruby-comment"># itself when rescue_from CONSTANT is executed.</span>
<span class="ruby-identifier">klass</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">klass_name</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>
<span class="ruby-identifier">klass</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">klass_name</span>.<span class="ruby-identifier">constantize</span> <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>
<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">klass</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">case</span> <span class="ruby-identifier">rescuer</span>
<span class="ruby-keyword">when</span> <span class="ruby-constant">Symbol</span>
<span class="ruby-identifier">method</span>(<span class="ruby-identifier">rescuer</span>)
<span class="ruby-keyword">when</span> <span class="ruby-constant">Proc</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">rescuer</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">==</span> <span class="ruby-number">0</span>
<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">instance_exec</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">rescuer</span>) }
<span class="ruby-keyword">else</span>
<span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">_exception</span><span class="ruby-operator">|</span> <span class="ruby-identifier">instance_exec</span>(<span class="ruby-identifier">_exception</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">rescuer</span>) }
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-rescue_with_handler">
<b>rescue_with_handler</b>(exception)
<a href="../../classes/ActiveSupport/Rescuable.html#method-i-rescue_with_handler" name="method-i-rescue_with_handler" class="permalink">Link</a>
</div>
<div class="description">
<p>Tries to rescue the exception by looking up and calling a registered
handler.</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-rescue_with_handler_source')" id="l_method-i-rescue_with_handler_source">show</a>
</p>
<div id="method-i-rescue_with_handler_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../../../usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.2/lib/active_support/rescuable.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">rescue_with_handler</span>(<span class="ruby-identifier">exception</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">handler</span> = <span class="ruby-identifier">handler_for_rescue</span>(<span class="ruby-identifier">exception</span>)
<span class="ruby-identifier">handler</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">!=</span> <span class="ruby-number">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">exception</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">call</span>
<span class="ruby-keyword">true</span> <span class="ruby-comment"># don't rely on the return value of the handler</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html> | mit |
seijinishiguchi/mkvars | README.md | 14 | mkvars
======
| mit |
elloza/evernote-client | evernoteclient/app/src/main/java/com/lozasolutions/evernoteclient/injection/module/ActivityModule.java | 574 | package com.lozasolutions.evernoteclient.injection.module;
import android.app.Activity;
import android.content.Context;
import dagger.Module;
import dagger.Provides;
import com.lozasolutions.evernoteclient.injection.ActivityContext;
@Module
public class ActivityModule {
private Activity activity;
public ActivityModule(Activity activity) {
this.activity = activity;
}
@Provides
Activity provideActivity() {
return activity;
}
@Provides
@ActivityContext
Context providesContext() {
return activity;
}
}
| mit |
sharnee/instaClone | src/scripts/views/comments.js | 612 | import React from 'react'
import CommentSubmit from './commentSubmit'
var Comments = React.createClass({
_listComments: function(commentsArray) {
var commentArr = []
for ( var i = 0; i < commentsArray.length; i++) {
commentArr.push( <li><strong> {commentsArray[i].byUser} </strong> {commentsArray[i].message} </li> )
}
return commentArr
},
render: function() {
var detailData = this.props.model
return (
<section className="comments">
<ul>
{this._listComments(detailData.get('comments'))}
</ul>
{/* <CommentSubmit /> */}
</section>
)
}
})
export default Comments | mit |
petarslovic/bas-info | src/api/bas.js | 1123 | import { Router } from 'express';
import _ from 'lodash';
import BAS from '../services/bas';
import TRAVEL_TYPES from '../constants/travel-types';
import placesJson from '../data/places';
const router = new Router();
const bas = new BAS();
router.get('/', async (req, res, next) => {
try {
const travelType = req.query.travelType;
const placeText = req.query.station;
const date = req.query.date;
if (!placeText || placeText === 'undefined') {
return res.status(400).send({error: `The 'station' query parameter cannot be empty.`});
}
if (travelType && !(travelType in TRAVEL_TYPES)) {
return res.status(400).send({error: `The 'travelType' query parameter is not valid.`});
}
const place = _.findWhere(placesJson, {
First: placeText,
});
if (!place) {
return res.status(400).send({error: `The 'place' query parameter is not valid.`});
}
bas.getData({
place: place.First,
travelType: travelType,
date: date,
}, (results) => res.status(200).send(results));
} catch (err) {
next(err);
}
});
export default router;
| mit |
misshie/bioruby-ucsc-api | spec/hg19/wgencodeuwhistonehmech3k27me3stdhotspotsrep1_spec.rb | 531 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg19::WgEncodeUwHistoneHmecH3k27me3StdHotspotsRep1" do
describe "#find_by_interval" do
context "given range chr1:1-800,000" do
it 'returns a record (r.chrom == "chr1")' do
Bio::Ucsc::Hg19::DBConnection.default
Bio::Ucsc::Hg19::DBConnection.connect
i = Bio::GenomicInterval.parse("chr1:1-800,000")
r = Bio::Ucsc::Hg19::WgEncodeUwHistoneHmecH3k27me3StdHotspotsRep1.find_by_interval(i)
r.chrom.should == "chr1"
end
end
end
end
| mit |
Azure/azure-sdk-for-java | sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesCreateOrUpdateSamples.java | 20132 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.generated;
import com.azure.core.management.SubResource;
import com.azure.core.util.Context;
import com.azure.resourcemanager.compute.fluent.models.CloudServiceInner;
import com.azure.resourcemanager.compute.models.CloudServiceExtensionProfile;
import com.azure.resourcemanager.compute.models.CloudServiceExtensionProperties;
import com.azure.resourcemanager.compute.models.CloudServiceNetworkProfile;
import com.azure.resourcemanager.compute.models.CloudServiceOsProfile;
import com.azure.resourcemanager.compute.models.CloudServiceProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfile;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfileProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleSku;
import com.azure.resourcemanager.compute.models.CloudServiceUpgradeMode;
import com.azure.resourcemanager.compute.models.CloudServiceVaultCertificate;
import com.azure.resourcemanager.compute.models.CloudServiceVaultSecretGroup;
import com.azure.resourcemanager.compute.models.Extension;
import com.azure.resourcemanager.compute.models.LoadBalancerConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerConfigurationProperties;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfigurationProperties;
import java.util.Arrays;
/** Samples for CloudServices CreateOrUpdate. */
public final class CloudServicesCreateOrUpdateSamples {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRole.json
*/
/**
* Sample code: Create New Cloud Service with Single Role.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithSingleRole(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getCloudServices()
.createOrUpdate(
"ConstosoRG",
"{cs-name}",
new CloudServiceInner()
.withLocation("westus")
.withProperties(
new CloudServiceProperties()
.withPackageUrl("{PackageUrl}")
.withConfiguration("{ServiceConfiguration}")
.withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(
new CloudServiceRoleProfile()
.withRoles(
Arrays
.asList(
new CloudServiceRoleProfileProperties()
.withName("ContosoFrontend")
.withSku(
new CloudServiceRoleSku()
.withName("Standard_D1_v2")
.withTier("Standard")
.withCapacity(1L)))))
.withNetworkProfile(
new CloudServiceNetworkProfile()
.withLoadBalancerConfigurations(
Arrays
.asList(
new LoadBalancerConfiguration()
.withName("myLoadBalancer")
.withProperties(
new LoadBalancerConfigurationProperties()
.withFrontendIpConfigurations(
Arrays
.asList(
new LoadBalancerFrontendIpConfiguration()
.withName("myfe")
.withProperties(
new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(
new SubResource()
.withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP")))))))))),
Context.NONE);
}
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndCertificate.json
*/
/**
* Sample code: Create New Cloud Service with Single Role and Certificate from Key Vault.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault(
com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getCloudServices()
.createOrUpdate(
"ConstosoRG",
"{cs-name}",
new CloudServiceInner()
.withLocation("westus")
.withProperties(
new CloudServiceProperties()
.withPackageUrl("{PackageUrl}")
.withConfiguration("{ServiceConfiguration}")
.withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(
new CloudServiceRoleProfile()
.withRoles(
Arrays
.asList(
new CloudServiceRoleProfileProperties()
.withName("ContosoFrontend")
.withSku(
new CloudServiceRoleSku()
.withName("Standard_D1_v2")
.withTier("Standard")
.withCapacity(1L)))))
.withOsProfile(
new CloudServiceOsProfile()
.withSecrets(
Arrays
.asList(
new CloudServiceVaultSecretGroup()
.withSourceVault(
new SubResource()
.withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"))
.withVaultCertificates(
Arrays
.asList(
new CloudServiceVaultCertificate()
.withCertificateUrl(
"https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"))))))
.withNetworkProfile(
new CloudServiceNetworkProfile()
.withLoadBalancerConfigurations(
Arrays
.asList(
new LoadBalancerConfiguration()
.withName("contosolb")
.withProperties(
new LoadBalancerConfigurationProperties()
.withFrontendIpConfigurations(
Arrays
.asList(
new LoadBalancerFrontendIpConfiguration()
.withName("contosofe")
.withProperties(
new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(
new SubResource()
.withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))),
Context.NONE);
}
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndRDP.json
*/
/**
* Sample code: Create New Cloud Service with Single Role and RDP Extension.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithSingleRoleAndRDPExtension(
com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getCloudServices()
.createOrUpdate(
"ConstosoRG",
"{cs-name}",
new CloudServiceInner()
.withLocation("westus")
.withProperties(
new CloudServiceProperties()
.withPackageUrl("{PackageUrl}")
.withConfiguration("{ServiceConfiguration}")
.withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(
new CloudServiceRoleProfile()
.withRoles(
Arrays
.asList(
new CloudServiceRoleProfileProperties()
.withName("ContosoFrontend")
.withSku(
new CloudServiceRoleSku()
.withName("Standard_D1_v2")
.withTier("Standard")
.withCapacity(1L)))))
.withNetworkProfile(
new CloudServiceNetworkProfile()
.withLoadBalancerConfigurations(
Arrays
.asList(
new LoadBalancerConfiguration()
.withName("contosolb")
.withProperties(
new LoadBalancerConfigurationProperties()
.withFrontendIpConfigurations(
Arrays
.asList(
new LoadBalancerFrontendIpConfiguration()
.withName("contosofe")
.withProperties(
new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(
new SubResource()
.withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))
.withExtensionProfile(
new CloudServiceExtensionProfile()
.withExtensions(
Arrays
.asList(
new Extension()
.withName("RDPExtension")
.withProperties(
new CloudServiceExtensionProperties()
.withPublisher("Microsoft.Windows.Azure.Extensions")
.withType("RDP")
.withTypeHandlerVersion("1.2.1")
.withAutoUpgradeMinorVersion(false)
.withSettings(
"<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021"
+ " 15:05:45</Expiration></PublicConfig>")
.withProtectedSettings(
"<PrivateConfig><Password>{password}</Password></PrivateConfig>")))))),
Context.NONE);
}
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithMultiRole.json
*/
/**
* Sample code: Create New Cloud Service with Multiple Roles.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithMultipleRoles(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getCloudServices()
.createOrUpdate(
"ConstosoRG",
"{cs-name}",
new CloudServiceInner()
.withLocation("westus")
.withProperties(
new CloudServiceProperties()
.withPackageUrl("{PackageUrl}")
.withConfiguration("{ServiceConfiguration}")
.withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(
new CloudServiceRoleProfile()
.withRoles(
Arrays
.asList(
new CloudServiceRoleProfileProperties()
.withName("ContosoFrontend")
.withSku(
new CloudServiceRoleSku()
.withName("Standard_D1_v2")
.withTier("Standard")
.withCapacity(1L)),
new CloudServiceRoleProfileProperties()
.withName("ContosoBackend")
.withSku(
new CloudServiceRoleSku()
.withName("Standard_D1_v2")
.withTier("Standard")
.withCapacity(1L)))))
.withNetworkProfile(
new CloudServiceNetworkProfile()
.withLoadBalancerConfigurations(
Arrays
.asList(
new LoadBalancerConfiguration()
.withName("contosolb")
.withProperties(
new LoadBalancerConfigurationProperties()
.withFrontendIpConfigurations(
Arrays
.asList(
new LoadBalancerFrontendIpConfiguration()
.withName("contosofe")
.withProperties(
new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(
new SubResource()
.withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))),
Context.NONE);
}
}
| mit |
jaykang920/x2clr | x2/Links/ClientLink.cs | 5880 | // Copyright (c) 2013-2016 Jae-jun Kang
// See the file LICENSE for details.
using System;
using System.Collections.Generic;
using System.Threading;
namespace x2
{
/// <summary>
/// Common base class for single-session client links.
/// </summary>
public abstract class ClientLink : SessionBasedLink
{
protected LinkSession session; // current link session
/// <summary>
/// Gets the current link session.
/// </summary>
public LinkSession Session
{
get
{
using (new ReadLock(rwlock))
{
return session;
}
}
}
static ClientLink()
{
EventFactory.Register(SessionResp.TypeId, SessionResp.New);
}
/// <summary>
/// Initializes a new instance of the ClientLink class.
/// </summary>
protected ClientLink(string name)
: base(name)
{
Diag = new Diagnostics();
}
/// <summary>
/// Sends out the specified event through this link channel.
/// </summary>
public override void Send(Event e)
{
LinkSession currentSession = Session;
if (Object.ReferenceEquals(currentSession, null))
{
Log.Warn("{0} dropped event {1}", Name, e);
return;
}
currentSession.Send(e);
}
protected override void OnSessionConnectedInternal(bool result, object context)
{
if (result)
{
var session = (LinkSession)context;
using (new WriteLock(rwlock))
{
this.session = session;
}
Log.Debug("{0} {1} set session {2}",
Name, session.Handle, session.Token);
}
}
protected override void OnSessionDisconnectedInternal(int handle, object context)
{
using (new WriteLock(rwlock))
{
if (!Object.ReferenceEquals(session, null))
{
Log.Debug("{0} {1} cleared session {2}",
Name, session.Handle, session.Token);
session = null;
}
}
}
protected override void OnSessionRecoveredInternal(
int handle, object context, int retransmission)
{
LinkSession oldSession;
var session = (LinkSession)context;
using (new WriteLock(rwlock))
{
oldSession = this.session;
this.session = session;
}
session.TakeOver(oldSession, retransmission);
Log.Debug("{0} {1} reset session {2}",
Name, session.Handle, session.Token);
}
internal void OnSessionResp(LinkSession session, SessionResp e)
{
LinkSession currentSession = Session;
string sessionToken = null;
if (!Object.ReferenceEquals(currentSession, null))
{
sessionToken = currentSession.Token;
}
// Save the session token from the server.
session.Token = e.Token;
Log.Trace("{0} {1} session token {2}",
Name, session.InternalHandle, e.Token);
if (!String.IsNullOrEmpty(sessionToken))
{
if (sessionToken.Equals(e.Token))
{
// Recovered from instant disconnection.
session.InheritFrom(this.session);
session.Send(new SessionAck {
_Transform = false,
Recovered = true
});
OnLinkSessionRecoveredInternal(session.Handle, session, e.Retransmission);
return;
}
OnLinkSessionDisconnectedInternal(currentSession.Handle, currentSession);
}
session.Send(new SessionAck { _Transform = false });
OnSessionSetup(session);
}
/// <summary>
/// Frees managed or unmanaged resources.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposed) { return; }
LinkSession session = null;
using (new WriteLock(rwlock))
{
if (this.session != null)
{
session = this.session;
this.session = null;
}
}
if (session != null)
{
session.Close();
}
base.Dispose(disposing);
}
/// <summary>
/// Called by a derived link class on a successful connect.
/// </summary>
protected virtual void OnConnectInternal(LinkSession session)
{
session.Polarity = true;
if (SessionRecoveryEnabled)
{
SendSessionReq(session);
}
else
{
OnSessionSetup(session);
}
}
private void SendSessionReq(LinkSession session)
{
var req = new SessionReq { _Transform = false };
LinkSession currentSession = Session;
if (!Object.ReferenceEquals(currentSession, null) &&
!String.IsNullOrEmpty(currentSession.Token))
{
req.Token = currentSession.Token;
req.RxCounter = currentSession.RxCounter;
req.TxCounter = currentSession.TxCounter;
req.TxBuffered = currentSession.TxBuffered;
}
session.Send(req);
}
}
}
| mit |
jorgemejia/CordovaStatusBarNotification | src/ios/StatusBarNotification.h | 9328 | #import <Cordova/CDV.h>
#import <UIKit/UIKit.h>
@interface StatusBarNotification : CDVPlugin
- (void)echo:(CDVInvokedUrlCommand*)command;
@end
/**
* @brief A simple completion used for handling tapping the notification.
*/
typedef void(^CWCompletionBlock)(void);
# pragma mark - ScrollLabel
/**
* A subclass of @c UILabel that scrolls the text if it is too long for the
* label.
*/
@interface ScrollLabel : UILabel
/**
* Used to find the amount of time that the label will spend scrolling.
* @return The amount of time that will be spent scrolling.
*/
- (CGFloat)scrollTime;
@end
# pragma mark - CWWindowContainer
/**
* A subclass of @c UIWindow that overrides the @c hitTest method in order to
* allow tap events to pass through the window.
*/
@interface CWWindowContainer : UIWindow
/// The height of the notification that is being displayed in the window.
@property (assign, nonatomic) CGFloat notificationHeight;
@end
# pragma mark - CWViewController
/**
* A subclass of @c UIViewController that allows handing over
* @c supportedInterfaceOrientations if needed.
*/
@interface CWViewController : UIViewController
/// Indicates the preferred status bar style.
@property (nonatomic) UIStatusBarStyle preferredStatusBarStyle;
/// Indicats the supported interface orientations.
@property (nonatomic, setter=setSupportedInterfaceOrientations:)
UIInterfaceOrientationMask supportedInterfaceOrientations;
@end
# pragma mark - CWStatusBarNotification
/**
* A subclass of @c NSObject that is responsible for managing status bar
* notifications.
*/
@interface CWStatusBarNotification : NSObject
# pragma mark - enums
/**
* @typedef CWNotificationStyle
* @brief Determines the notification style.
*/
typedef NS_ENUM(NSInteger, CWNotificationStyle) {
/// Covers the status bar portion of the screen.
CWNotificationStyleStatusBarNotification,
/// Covers the status bar and navigation bar portions of the screen.
CWNotificationStyleNavigationBarNotification
};
/**
* @typedef CWNotificationAnimationStyle
* @brief Determines the direction of animation for the notification.
*/
typedef NS_ENUM(NSInteger, CWNotificationAnimationStyle) {
/// Animate in from the top or animate out to the top.
CWNotificationAnimationStyleTop,
/// Animate in from the bottom or animate out to the bottom.
CWNotificationAnimationStyleBottom,
/// Animate in from the left or animate out to the left.
CWNotificationAnimationStyleLeft,
/// Animate in from the right or animate out to the right.
CWNotificationAnimationStyleRight
};
/**
* @typedef CWNotificationAnimationType
* @brief Determines whether the notification moves the existing content out of
* the way or simply overlays it.
*/
typedef NS_ENUM(NSInteger, CWNotificationAnimationType) {
/// Moves existing content out of the way.
CWNotificationAnimationTypeReplace,
/// Overlays existing content.
CWNotificationAnimationTypeOverlay
};
# pragma mark - properties
/// The label that holds the notification text.
@property (strong, nonatomic) ScrollLabel *notificationLabel;
/// The @c UIView that holds a screenshot of the status bar view.
@property (strong, nonatomic) UIView *statusBarView;
/// The block that gets triggered when the notification is tapped.
@property (copy, nonatomic) CWCompletionBlock notificationTappedBlock;
/// Indicates whether the notification is currently being shown.
@property (nonatomic) BOOL notificationIsShowing;
/// Indicates whether the notification is currently dismissing.
@property (nonatomic) BOOL notificationIsDismissing;
/// The window that holds the notification.
@property (strong, nonatomic) CWWindowContainer *notificationWindow;
/**
* The background color of the notification label. Default value is the tint
* color of the application's main window.
*/
@property (strong, nonatomic) UIColor *notificationLabelBackgroundColor;
/**
* The text color of the notification label. Default value is white.
*/
@property (strong, nonatomic) UIColor *notificationLabelTextColor;
/**
* The font of the notification label. Default value is system font.
*/
@property (strong, nonatomic) UIFont *notificationLabelFont;
/**
* Allows setting a custom height for the notification label. If this value is
* 0, the height will be determined by the @c notificationStyle. Default value
* is 0.
*/
@property (assign, nonatomic) CGFloat notificationLabelHeight;
/**
* The custom view to present if using @c displayNotificationWithView. Default
* value is @c nil.
*/
@property (strong, nonatomic) UIView *customView;
/**
* Determines whether the notification text has multiple lines. Default value is
* @c NO.
*/
@property (assign, nonatomic) BOOL multiline;
/**
* The supported interface orientations. Default value is the
* @c supportedInterfaceOrientations value of the root view controller of the
* application.
*/
@property (nonatomic) UIInterfaceOrientationMask supportedInterfaceOrientations;
/**
* The amount of time that it takes to animate the notification in or out.
* Default value is 0.25.
*/
@property (nonatomic) NSTimeInterval notificationAnimationDuration;
/**
* Determines whether the notification covers the status bar or both the status
* bar and the navigation bar. Default value is
* @c CWNotificationStyleStatusBarNotification.
*/
@property (nonatomic) CWNotificationStyle notificationStyle;
/**
* Determines the direction from which the notification animates in. Default
* value is @c CWNotificationAnimationStyleBottom.
*/
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationInStyle;
/**
* Determines the direction from which the notification animates out. Default
* value is @c CWNotificationAnimationStyleBottom.
*/
@property (nonatomic) CWNotificationAnimationStyle
notificationAnimationOutStyle;
/**
* Determines whether the the notification's animation replaces the existing
* content or overlays it. Default value is
* @c CWNotificationAnimationTypeReplace.
*/
@property (nonatomic) CWNotificationAnimationType notificationAnimationType;
/**
* The preferred status bar style. Default value is @c UIStatusBarStyleDefault.
*/
@property (nonatomic) UIStatusBarStyle preferredStatusBarStyle;
#pragma mark - methods
/**
* Displays a notification with the indicated message and then performs the
* completion block once the notification animates in.
* @param message
* The content of the message to be displayed.
* @param completion
* The block to be invoked once the notification is displayed.
*/
- (void)displayNotificationWithMessage:(NSString *)message
completion:(void (^)(void))completion;
/**
* Displays a notification with the indicated message for the indicated
* duration.
* @param message
* The content of the message to be displayed.
* @param duration
* The amount of seconds for which the notification should be displayed,
* not including the animate in and out times.
*/
- (void)displayNotificationWithMessage:(NSString *)message
forDuration:(NSTimeInterval)duration;
/**
* Displays a notification with the indicated attributed string and then
* performs the completion block once the notification animates in.
* @param attributedString
* The content of the message to be displayed.
* @param completion
* The block to be invoked once the notification is displayed.
*/
- (void)displayNotificationWithAttributedString:(NSAttributedString *)
attributedString
completion:(void (^)(void))completion;
/**
* Displays a notification with the indicated message for the indicated
* duration.
* @param attributedString
* The content of the message to be displayed.
* @param duration
* The amount of seconds for which the notification should be displayed,
* not including the animate in and out times.
*/
- (void)displayNotificationWithAttributedString:(NSAttributedString *)
attributedString
forDuration:(NSTimeInterval)duration;
/**
* Displays a notification with the indicated custom view and then performs the
* completion block once the notification animates in.
* @param view
* The custom @c UIView that you wish to present.
* @param completion
* The block to be invoked once the notification is displayed.
*/
- (void)displayNotificationWithView:(UIView *)view
completion:(void (^)(void))completion;
/**
* Displays a notification with the indicated custom view for the indicated
* duration.
* @param view
* The custom @c UIView that you wish to present.
* @param duration
* The amount of seconds for which the notification should be displayed,
* not including the animate in and out times.
*/
- (void)displayNotificationWithView:(UIView *)view
forDuration:(NSTimeInterval)duration;
/**
* Dismisses the currently presented notification and then performs the
* completion block.
* @param completion
* The block to be invoked after the notification is dismissed.
*/
- (void)dismissNotificationWithCompletion:(void(^)(void))completion;
/**
* Dismisses the currently presented notification.
*/
- (void)dismissNotification;
@end
| mit |
digitalcreations/ZE1Sharp | src/ZE1Sharp/Settings/StringSettingWriter.cs | 1241 | namespace ZE1Sharp
{
using System;
using System.Net.Http;
using System.Threading.Tasks;
using ZE1Sharp.Models;
internal class StringSettingWriter : ISettingWriter<StringSetting, string>
{
private readonly IAPICaller _apiCaller;
private readonly string _name;
public StringSettingWriter(IAPICaller apiCaller, string name, StringSetting value)
{
this.Value = value;
this._apiCaller = apiCaller;
this._name = name;
}
public StringSetting Value { get; }
public async Task SetAsync(string value)
{
if (this.Value.ReadOnly)
{
throw new InvalidOperationException($"Setting {this._name} is read only");
}
var response = await this._apiCaller
.RequestAsync<StringSetting>(
HttpMethod.Get,
"/ctrl/set".AttachParameter(this._name, value))
.ConfigureAwait(false);
if (response.Code != StatusCode.OK)
{
throw new InvalidOperationException($"Could not set setting {this._name}");
}
this.Value.Value = value;
}
}
} | mit |
chav0021/ecommerce-website | styleguide/inclass-grid.html | 2199 | <!DOCTYPE html>
<html lang="en-ca">
<head>
<meta charset="utf-8">
<title>Grids</title>
<meta name="handheldfriendly" content="true">
<meta name="mobileoptimized" content="240">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="http://fonts.googleapis.com/css?family=Patua+One" rel="stylesheet">
<link href="../css/common.css" rel="stylesheet">
<link href="../css/typography.css" rel="stylesheet">
<link href="../css/list-group.css" rel="stylesheet">
<link href="../css/media-object.css" rel="stylesheet">
<link href="../css/buttons.css" rel="stylesheet">
<link href="../css/grid.css" rel="stylesheet">
</head>
<body>
<div class="grid">
<div class="unit gutter unit-s-1 unit-m-1-3 unit-l-1-3">
<h2>Col 1</h2>
<p>Lorem ipsum dolorem</p>
</div>
<div class="unit gutter unit-s-1 unit-m-1-3 unit-l-1-3">
<h2>Col 1</h2>
<p>Lorem ipsum dolorem</p>
</div>
<div class="unit gutter unit-s-1 unit-m-1-3 unit-l-1-3">
<h2>Col 1</h2>
<p>Lorem ipsum dolorem</p>
</div>
</div>
<div class="grid">
<div class="unit unit-s-1 unit-m-1 unit-l-1-3">
<img class="img-flex" src="http://placekitten.com/220/200">
</div>
<div class="unit unit-s-1 unit-m-1-2 unit-l-1-3">
<img class="img-flex" src="http://placekitten.com/200/200">
</div>
<div class="unit unit-s-1 unit-m-1-2 unit-l-1-3">
<h2>Col 1</h2>
<p>Lorem ipsum dolorem</p>
</div>
</div>
<div class="grid">
<div class="unit unit-s-1-2 unit-m-1-3 unit-l-1-3">
<h2 class="gutter">Col 1</h2>
<img class="img-flex" src="http://placekitten.com/220/200">
</div>
<div class="unit unit-s-1-2 unit-m-1-3 unit-l-1-3">
<h2 class="gutter">Col 2</h2>
<img class="img-flex" src="http://placekitten.com/200/200">
</div>
<div class="unit unit-s-1 unit-m-1-3 unit-l-1-3">
<h2>Col 3</h2>
<img class="img-flex" src="http://placekitten.com/200/200">
</div>
</div>
<div class="grid">
<div class="unit unit-s-1 unit-m-1-2 unit-l-2-3">
<img class="img-flex" src="http://placekitten.com/120/100">
</div>
<div class="unit unit-s-1 unit-m-1-2 unit-l-1-3">
<p>Lorem ipsum dolorem</p>
</div>
</div>
</body>
</html>
| mit |
openheritage/open-plaques-3 | db/migrate/20111115151056_add_accurate_geolocation_to_plaque.rb | 311 | class AddAccurateGeolocationToPlaque < ActiveRecord::Migration[4.2]
def change
add_column :plaques, :is_accurate_geolocation, :boolean, default: true
Plaque.where("accuracy = 'street' or accuracy = 'Street'").each do |f|
f.update_attribute(:is_accurate_geolocation, 'false')
end
end
end
| mit |
Subsets and Splits