(function(){
Backbone.js 1.1.0
(c) 2010-2011 Jeremy Ashkenas, DocumentCloud Inc.
(c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
Backbone may be freely distributed under the MIT license.
For all details and documentation:
http://backbonejs.org
(function(){
Save a reference to the global object (window
in the browser, exports
on the server).
var root = this;
Save the previous value of the Backbone
variable, so that it can be
restored later on, if noConflict
is used.
var previousBackbone = root.Backbone;
Create local references to array methods we'll want to use later.
var array = [];
var push = array.push;
var slice = array.slice;
var splice = array.splice;
The top-level namespace. All public Backbone classes and modules will be attached to this. Exported for both the browser and the server.
var Backbone;
if (typeof exports !== 'undefined') {
Backbone = exports;
} else {
Backbone = root.Backbone = {};
}
Current version of the library. Keep in sync with package.json
.
Backbone.VERSION = '1.1.0';
Require Underscore, if we're on the server, and it's not already present.
var _ = root._;
if (!_ && (typeof require !== 'undefined')) _ = require('underscore');
For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
the $
variable.
Backbone.$ = root.jQuery || root.Zepto || root.ender || root.$;
Runs Backbone.js in noConflict mode, returning the Backbone
variable
to its previous owner. Returns a reference to this Backbone object.
Backbone.noConflict = function() {
root.Backbone = previousBackbone;
return this;
};
Turn on emulateHTTP
to support legacy HTTP servers. Setting this option
will fake "PATCH"
, "PUT"
and "DELETE"
requests via the _method
parameter and
set a X-Http-Method-Override
header.
Backbone.emulateHTTP = false;
Turn on emulateJSON
to support legacy servers that can't deal with direct
application/json
requests ... will encode the body as
application/x-www-form-urlencoded
instead and will send the model in a
form param named model
.
Backbone.emulateJSON = false;
A module that can be mixed in to any object in order to provide it with
custom events. You may bind with on
or remove with off
callback
functions to an event; trigger
-ing an event fires all callbacks in
succession.
var object = {};
_.extend(object, Backbone.Events);
object.on('expand', function(){ alert('expanded'); });
object.trigger('expand');
var Events = Backbone.Events = {
Bind an event to a callback
function. Passing "all"
will bind
the callback to all events fired.
on: function(name, callback, context) {
if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this;
this._events || (this._events = {});
var events = this._events[name] || (this._events[name] = []);
events.push({callback: callback, context: context, ctx: context || this});
return this;
},
Bind an event to only be triggered a single time. After the first time the callback is invoked, it will be removed.
once: function(name, callback, context) {
if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;
var self = this;
var once = _.once(function() {
self.off(name, once);
callback.apply(this, arguments);
});
once._callback = callback;
return this.on(name, once, context);
},
Remove one or many callbacks. If context
is null, removes all
callbacks with that function. If callback
is null, removes all
callbacks for the event. If name
is null, removes all bound
callbacks for all events.
off: function(name, callback, context) {
var retain, ev, events, names, i, l, j, k;
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
if (!name && !callback && !context) {
this._events = {};
return this;
}
names = name ? [name] : _.keys(this._events);
for (i = 0, l = names.length; i < l; i++) {
name = names[i];
if (events = this._events[name]) {
this._events[name] = retain = [];
if (callback || context) {
for (j = 0, k = events.length; j < k; j++) {
ev = events[j];
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
(context && context !== ev.context)) {
retain.push(ev);
}
}
}
if (!retain.length) delete this._events[name];
}
}
return this;
},
Trigger one or many events, firing all bound callbacks. Callbacks are
passed the same arguments as trigger
is, apart from the event name
(unless you're listening on "all"
, which will cause your callback to
receive the true name of the event as the first argument).
trigger: function(name) {
if (!this._events) return this;
var args = slice.call(arguments, 1);
if (!eventsApi(this, 'trigger', name, args)) return this;
var events = this._events[name];
var allEvents = this._events.all;
if (events) triggerEvents(events, args);
if (allEvents) triggerEvents(allEvents, arguments);
return this;
},
Tell this object to stop listening to either specific events ... or to every object it's currently listening to.
stopListening: function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
var remove = !name && !callback;
if (!callback && typeof name === 'object') callback = this;
if (obj) (listeningTo = {})[obj._listenId] = obj;
for (var id in listeningTo) {
obj = listeningTo[id];
obj.off(name, callback, this);
if (remove || _.isEmpty(obj._events)) delete this._listeningTo[id];
}
return this;
}
};
Regular expression used to split event strings.
var eventSplitter = /\s+/;
Implement fancy features of the Events API such as multiple event
names "change blur"
and jQuery-style event maps {change: action}
in terms of the existing API.
var eventsApi = function(obj, action, name, rest) {
if (!name) return true;
Handle event maps.
if (typeof name === 'object') {
for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
return false;
}
Handle space separated event names.
if (eventSplitter.test(name)) {
var names = name.split(eventSplitter);
for (var i = 0, l = names.length; i < l; i++) {
obj[action].apply(obj, [names[i]].concat(rest));
}
return false;
}
return true;
};
A difficult-to-believe, but optimized internal dispatch function for triggering events. Tries to keep the usual cases speedy (most internal Backbone events have 3 arguments).
var triggerEvents = function(events, args) {
var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
switch (args.length) {
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args);
}
};
var listenMethods = {listenTo: 'on', listenToOnce: 'once'};
Inversion-of-control versions of on
and once
. Tell this object to
listen to an event in another object ... keeping track of what it's
listening to.
_.each(listenMethods, function(implementation, method) {
Events[method] = function(obj, name, callback) {
var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
listeningTo[id] = obj;
if (!callback && typeof name === 'object') callback = this;
obj[implementation](name, callback, this);
return this;
};
});
Aliases for backwards compatibility.
Events.bind = Events.on;
Events.unbind = Events.off;
Allow the Backbone
object to serve as a global event bus, for folks who
want global "pubsub" in a convenient place.
_.extend(Backbone, Events);
Backbone Models are the basic data object in the framework -- frequently representing a row in a table in a database on your server. A discrete chunk of data and a bunch of useful, related methods for performing computations and transformations on that data.
Create a new model with the specified attributes. A client id (cid
)
is automatically generated and assigned for you.
var Model = Backbone.Model = function(attributes, options) {
var attrs = attributes || {};
options || (options = {});
this.cid = _.uniqueId('c');
this.attributes = {};
if (options.collection) this.collection = options.collection;
if (options.parse) attrs = this.parse(attrs, options) || {};
attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
this.set(attrs, options);
this.changed = {};
this.initialize.apply(this, arguments);
};
Attach all inheritable methods to the Model prototype.
_.extend(Model.prototype, Events, {
A hash of attributes whose current and previous value differ.
changed: null,
The value returned during the last failed validation.
validationError: null,
The default name for the JSON id
attribute is "id"
. MongoDB and
CouchDB users may want to set this to "_id"
.
idAttribute: 'id',
Initialize is an empty function by default. Override it with your own initialization logic.
initialize: function(){},
Return a copy of the model's attributes
object.
toJSON: function(options) {
return _.clone(this.attributes);
},
Proxy Backbone.sync
by default -- but override this if you need
custom syncing semantics for this particular model.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
Get the value of an attribute.
get: function(attr) {
return this.attributes[attr];
},
Get the HTML-escaped value of an attribute.
escape: function(attr) {
return _.escape(this.get(attr));
},
Returns true
if the attribute contains a value that is not null
or undefined.
has: function(attr) {
return this.get(attr) != null;
},
Set a hash of model attributes on the object, firing "change"
. This is
the core primitive operation of a model, updating the data and notifying
anyone who needs to know about the change in state. The heart of the beast.
set: function(key, val, options) {
var attr, attrs, unset, changes, silent, changing, prev, current;
if (key == null) return this;
Handle both "key", value
and {key: value}
-style arguments.
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
Run validation.
if (!this._validate(attrs, options)) return false;
Extract attributes and options.
unset = options.unset;
silent = options.silent;
changes = [];
changing = this._changing;
this._changing = true;
if (!changing) {
this._previousAttributes = _.clone(this.attributes);
this.changed = {};
}
current = this.attributes, prev = this._previousAttributes;
Check for changes of id
.
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
For each set
attribute, update or delete the current value.
for (attr in attrs) {
val = attrs[attr];
if (!_.isEqual(current[attr], val)) changes.push(attr);
if (!_.isEqual(prev[attr], val)) {
this.changed[attr] = val;
} else {
delete this.changed[attr];
}
unset ? delete current[attr] : current[attr] = val;
}
Trigger all relevant attribute changes.
if (!silent) {
if (changes.length) this._pending = true;
for (var i = 0, l = changes.length; i < l; i++) {
this.trigger('change:' + changes[i], this, current[changes[i]], options);
}
}
You might be wondering why there's a while
loop here. Changes can
be recursively nested within "change"
events.
if (changing) return this;
if (!silent) {
while (this._pending) {
this._pending = false;
this.trigger('change', this, options);
}
}
this._pending = false;
this._changing = false;
return this;
},
Remove an attribute from the model, firing "change"
. unset
is a noop
if the attribute doesn't exist.
unset: function(attr, options) {
return this.set(attr, void 0, _.extend({}, options, {unset: true}));
},
Clear all attributes on the model, firing "change"
.
clear: function(options) {
var attrs = {};
for (var key in this.attributes) attrs[key] = void 0;
return this.set(attrs, _.extend({}, options, {unset: true}));
},
Determine if the model has changed since the last "change"
event.
If you specify an attribute name, determine if that attribute has changed.
hasChanged: function(attr) {
if (attr == null) return !_.isEmpty(this.changed);
return _.has(this.changed, attr);
},
Return an object containing all the attributes that have changed, or false if there are no changed attributes. Useful for determining what parts of a view need to be updated and/or what attributes need to be persisted to the server. Unset attributes will be set to undefined. You can also pass an attributes object to diff against the model, determining if there would be a change.
changedAttributes: function(diff) {
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
var val, changed = false;
var old = this._changing ? this._previousAttributes : this.attributes;
for (var attr in diff) {
if (_.isEqual(old[attr], (val = diff[attr]))) continue;
(changed || (changed = {}))[attr] = val;
}
return changed;
},
Get the previous value of an attribute, recorded at the time the last
"change"
event was fired.
previous: function(attr) {
if (attr == null || !this._previousAttributes) return null;
return this._previousAttributes[attr];
},
Get all of the attributes of the model at the time of the previous
"change"
event.
previousAttributes: function() {
return _.clone(this._previousAttributes);
},
Fetch the model from the server. If the server's representation of the
model differs from its current attributes, they will be overridden,
triggering a "change"
event.
fetch: function(options) {
options = options ? _.clone(options) : {};
if (options.parse === void 0) options.parse = true;
var model = this;
var success = options.success;
options.success = function(resp) {
if (!model.set(model.parse(resp, options), options)) return false;
if (success) success(model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
Set a hash of model attributes, and sync the model to the server.
If the server returns an attributes hash that differs, the model's
state will be set
again.
save: function(key, val, options) {
var attrs, method, xhr, attributes = this.attributes;
Handle both "key", value
and {key: value}
-style arguments.
if (key == null || typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options = _.extend({validate: true}, options);
If we're not waiting and attributes exist, save acts as
set(attr).save(null, opts)
with validation. Otherwise, check if
the model will be valid when the attributes, if any, are set.
if (attrs && !options.wait) {
if (!this.set(attrs, options)) return false;
} else {
if (!this._validate(attrs, options)) return false;
}
Set temporary attributes if {wait: true}
.
if (attrs && options.wait) {
this.attributes = _.extend({}, attributes, attrs);
}
After a successful server-side save, the client is (optionally) updated with the server-side state.
if (options.parse === void 0) options.parse = true;
var model = this;
var success = options.success;
options.success = function(resp) {
Ensure attributes are restored during synchronous saves.
model.attributes = attributes;
var serverAttrs = model.parse(resp, options);
if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
if (_.isObject(serverAttrs) && !model.set(serverAttrs, options)) {
return false;
}
if (success) success(model, resp, options);
model.trigger('sync', model, resp, options);
};
wrapError(this, options);
method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
if (method === 'patch') options.attrs = attrs;
xhr = this.sync(method, this, options);
Restore attributes.
if (attrs && options.wait) this.attributes = attributes;
return xhr;
},
Destroy this model on the server if it was already persisted.
Optimistically removes the model from its collection, if it has one.
If wait: true
is passed, waits for the server to respond before removal.
destroy: function(options) {
options = options ? _.clone(options) : {};
var model = this;
var success = options.success;
var destroy = function() {
model.trigger('destroy', model, model.collection, options);
};
options.success = function(resp) {
if (options.wait || model.isNew()) destroy();
if (success) success(model, resp, options);
if (!model.isNew()) model.trigger('sync', model, resp, options);
};
if (this.isNew()) {
options.success();
return false;
}
wrapError(this, options);
var xhr = this.sync('delete', this, options);
if (!options.wait) destroy();
return xhr;
},
Default URL for the model's representation on the server -- if you're using Backbone's restful methods, override this to change the endpoint that will be called.
url: function() {
var base = _.result(this, 'urlRoot') || _.result(this.collection, 'url') || urlError();
if (this.isNew()) return base;
return base + (base.charAt(base.length - 1) === '/' ? '' : '/') + encodeURIComponent(this.id);
},
parse converts a response into the hash of attributes to be set
on
the model. The default implementation is just to pass the response along.
parse: function(resp, options) {
return resp;
},
Create a new model with identical attributes to this one.
clone: function() {
return new this.constructor(this.attributes);
},
A model is new if it has never been saved to the server, and lacks an id.
isNew: function() {
return this.id == null;
},
Check if the model is currently in a valid state.
isValid: function(options) {
return this._validate({}, _.extend(options || {}, { validate: true }));
},
Run validation against the next complete set of model attributes,
returning true
if all is well. Otherwise, fire an "invalid"
event.
_validate: function(attrs, options) {
if (!options.validate || !this.validate) return true;
attrs = _.extend({}, this.attributes, attrs);
var error = this.validationError = this.validate(attrs, options) || null;
if (!error) return true;
this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
return false;
}
});
Underscore methods that we want to implement on the Model.
var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit'];
Mix in each Underscore method as a proxy to Model#attributes
.
_.each(modelMethods, function(method) {
Model.prototype[method] = function() {
var args = slice.call(arguments);
args.unshift(this.attributes);
return _[method].apply(_, args);
};
});
If models tend to represent a single row of data, a Backbone Collection is
more analagous to a table full of data ... or a small slice or page of that
table, or a collection of rows that belong together for a particular reason
-- all of the messages in this particular folder, all of the documents
belonging to this particular author, and so on. Collections maintain
indexes of their models, both in order, and for lookup by id
.
Create a new Collection, perhaps to contain a specific type of model
.
If a comparator
is specified, the Collection will maintain
its models in sort order, as they're added and removed.
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this._reset();
this.initialize.apply(this, arguments);
if (models) this.reset(models, _.extend({silent: true}, options));
};
Default options for Collection#set
.
var setOptions = {add: true, remove: true, merge: true};
var addOptions = {add: true, remove: false};
Define the Collection's inheritable methods.
_.extend(Collection.prototype, Events, {
The default model for a collection is just a Backbone.Model. This should be overridden in most cases.
model: Model,
Initialize is an empty function by default. Override it with your own initialization logic.
initialize: function(){},
The JSON representation of a Collection is an array of the models' attributes.
toJSON: function(options) {
return this.map(function(model){ return model.toJSON(options); });
},
Proxy Backbone.sync
by default.
sync: function() {
return Backbone.sync.apply(this, arguments);
},
Add a model, or list of models to the set.
add: function(models, options) {
return this.set(models, _.extend({merge: false}, options, addOptions));
},
Remove a model, or a list of models from the set.
remove: function(models, options) {
var singular = !_.isArray(models);
models = singular ? [models] : _.clone(models);
options || (options = {});
var i, l, index, model;
for (i = 0, l = models.length; i < l; i++) {
model = models[i] = this.get(models[i]);
if (!model) continue;
delete this._byId[model.id];
delete this._byId[model.cid];
index = this.indexOf(model);
this.models.splice(index, 1);
this.length--;
if (!options.silent) {
options.index = index;
model.trigger('remove', model, this, options);
}
this._removeReference(model);
}
return singular ? models[0] : models;
},
Update a collection by set
-ing a new list of models, adding new ones,
removing models that are no longer present, and merging models that
already exist in the collection, as necessary. Similar to Model#set,
the core operation for updating the data contained by the collection.
set: function(models, options) {
options = _.defaults({}, options, setOptions);
if (options.parse) models = this.parse(models, options);
var singular = !_.isArray(models);
models = singular ? (models ? [models] : []) : _.clone(models);
var i, l, id, model, attrs, existing, sort;
var at = options.at;
var targetModel = this.model;
var sortable = this.comparator && (at == null) && options.sort !== false;
var sortAttr = _.isString(this.comparator) ? this.comparator : null;
var toAdd = [], toRemove = [], modelMap = {};
var add = options.add, merge = options.merge, remove = options.remove;
var order = !sortable && add && remove ? [] : false;
Turn bare objects into model references, and prevent invalid models from being added.
for (i = 0, l = models.length; i < l; i++) {
attrs = models[i];
if (attrs instanceof Model) {
id = model = attrs;
} else {
id = attrs[targetModel.prototype.idAttribute];
}
If a duplicate is found, prevent it from being added and optionally merge it into the existing model.
if (existing = this.get(id)) {
if (remove) modelMap[existing.cid] = true;
if (merge) {
attrs = attrs === model ? model.attributes : attrs;
if (options.parse) attrs = existing.parse(attrs, options);
existing.set(attrs, options);
if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
}
models[i] = existing;
If this is a new, valid model, push it to the toAdd
list.
} else if (add) {
model = models[i] = this._prepareModel(attrs, options);
if (!model) continue;
toAdd.push(model);
Listen to added models' events, and index models for lookup by
id
and by cid
.
model.on('all', this._onModelEvent, this);
this._byId[model.cid] = model;
if (model.id != null) this._byId[model.id] = model;
}
if (order) order.push(existing || model);
}
Remove nonexistent models if appropriate.
if (remove) {
for (i = 0, l = this.length; i < l; ++i) {
if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model);
}
if (toRemove.length) this.remove(toRemove, options);
}
See if sorting is needed, update length
and splice in new models.
if (toAdd.length || (order && order.length)) {
if (sortable) sort = true;
this.length += toAdd.length;
if (at != null) {
for (i = 0, l = toAdd.length; i < l; i++) {
this.models.splice(at + i, 0, toAdd[i]);
}
} else {
if (order) this.models.length = 0;
var orderedModels = order || toAdd;
for (i = 0, l = orderedModels.length; i < l; i++) {
this.models.push(orderedModels[i]);
}
}
}
Silently sort the collection if appropriate.
if (sort) this.sort({silent: true});
Unless silenced, it's time to fire all appropriate add/sort events.
if (!options.silent) {
for (i = 0, l = toAdd.length; i < l; i++) {
(model = toAdd[i]).trigger('add', model, this, options);
}
if (sort || (order && order.length)) this.trigger('sort', this, options);
}
Return the added (or merged) model (or models).
return singular ? models[0] : models;
},
When you have more items than you want to add or remove individually,
you can reset the entire set with a new list of models, without firing
any granular add
or remove
events. Fires reset
when finished.
Useful for bulk operations and optimizations.
reset: function(models, options) {
options || (options = {});
for (var i = 0, l = this.models.length; i < l; i++) {
this._removeReference(this.models[i]);
}
options.previousModels = this.models;
this._reset();
models = this.add(models, _.extend({silent: true}, options));
if (!options.silent) this.trigger('reset', this, options);
return models;
},
Add a model to the end of the collection.
push: function(model, options) {
return this.add(model, _.extend({at: this.length}, options));
},
Remove a model from the end of the collection.
pop: function(options) {
var model = this.at(this.length - 1);
this.remove(model, options);
return model;
},
Add a model to the beginning of the collection.
unshift: function(model, options) {
return this.add(model, _.extend({at: 0}, options));
},
Remove a model from the beginning of the collection.
shift: function(options) {
var model = this.at(0);
this.remove(model, options);
return model;
},
Slice out a sub-array of models from the collection.
slice: function() {
return slice.apply(this.models, arguments);
},
Get a model from the set by id.
get: function(obj) {
if (obj == null) return void 0;
return this._byId[obj.id] || this._byId[obj.cid] || this._byId[obj];
},
Get the model at the given index.
at: function(index) {
return this.models[index];
},
Return models with matching attributes. Useful for simple cases of
filter
.
where: function(attrs, first) {
if (_.isEmpty(attrs)) return first ? void 0 : [];
return this[first ? 'find' : 'filter'](function(model) {
for (var key in attrs) {
if (attrs[key] !== model.get(key)) return false;
}
return true;
});
},
Return the first model with matching attributes. Useful for simple cases
of find
.
findWhere: function(attrs) {
return this.where(attrs, true);
},
Force the collection to re-sort itself. You don't need to call this under normal circumstances, as the set will maintain sort order as each item is added.
sort: function(options) {
if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
options || (options = {});
Run sort based on type of comparator
.
if (_.isString(this.comparator) || this.comparator.length === 1) {
this.models = this.sortBy(this.comparator, this);
} else {
this.models.sort(_.bind(this.comparator, this));
}
if (!options.silent) this.trigger('sort', this, options);
return this;
},
Pluck an attribute from each model in the collection.
pluck: function(attr) {
return _.invoke(this.models, 'get', attr);
},
Fetch the default set of models for this collection, resetting the
collection when they arrive. If reset: true
is passed, the response
data will be passed through the reset
method instead of set
.
fetch: function(options) {
options = options ? _.clone(options) : {};
if (options.parse === void 0) options.parse = true;
var success = options.success;
var collection = this;
options.success = function(resp) {
var method = options.reset ? 'reset' : 'set';
collection[method](resp, options);
if (success) success(collection, resp, options);
collection.trigger('sync', collection, resp, options);
};
wrapError(this, options);
return this.sync('read', this, options);
},
Create a new instance of a model in this collection. Add the model to the
collection immediately, unless wait: true
is passed, in which case we
wait for the server to agree.
create: function(model, options) {
options = options ? _.clone(options) : {};
if (!(model = this._prepareModel(model, options))) return false;
if (!options.wait) this.add(model, options);
var collection = this;
var success = options.success;
options.success = function(model, resp, options) {
if (options.wait) collection.add(model, options);
if (success) success(model, resp, options);
};
model.save(null, options);
return model;
},
parse converts a response into a list of models to be added to the collection. The default implementation is just to pass it through.
parse: function(resp, options) {
return resp;
},
Create a new collection with an identical list of models as this one.
clone: function() {
return new this.constructor(this.models);
},
Private method to reset all internal state. Called when the collection is first initialized or reset.
_reset: function() {
this.length = 0;
this.models = [];
this._byId = {};
},
Prepare a hash of attributes (or other model) to be added to this collection.
_prepareModel: function(attrs, options) {
if (attrs instanceof Model) {
if (!attrs.collection) attrs.collection = this;
return attrs;
}
options = options ? _.clone(options) : {};
options.collection = this;
var model = new this.model(attrs, options);
if (!model.validationError) return model;
this.trigger('invalid', this, model.validationError, options);
return false;
},
Internal method to sever a model's ties to a collection.
_removeReference: function(model) {
if (this === model.collection) delete model.collection;
model.off('all', this._onModelEvent, this);
},
Internal method called every time a model in the set fires an event. Sets need to update their indexes when models change ids. All other events simply proxy through. "add" and "remove" events that originate in other collections are ignored.
_onModelEvent: function(event, model, collection, options) {
if ((event === 'add' || event === 'remove') && collection !== this) return;
if (event === 'destroy') this.remove(model, options);
if (model && event === 'change:' + model.idAttribute) {
delete this._byId[model.previous(model.idAttribute)];
if (model.id != null) this._byId[model.id] = model;
}
this.trigger.apply(this, arguments);
}
});
Underscore methods that we want to implement on the Collection. 90% of the core usefulness of Backbone Collections is actually implemented right here:
var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest',
'tail', 'drop', 'last', 'without', 'difference', 'indexOf', 'shuffle',
'lastIndexOf', 'isEmpty', 'chain'];
Mix in each Underscore method as a proxy to Collection#models
.
_.each(methods, function(method) {
Collection.prototype[method] = function() {
var args = slice.call(arguments);
args.unshift(this.models);
return _[method].apply(_, args);
};
});
Underscore methods that take a property name as an argument.
var attributeMethods = ['groupBy', 'countBy', 'sortBy'];
Use attributes instead of properties.
_.each(attributeMethods, function(method) {
Collection.prototype[method] = function(value, context) {
var iterator = _.isFunction(value) ? value : function(model) {
return model.get(value);
};
return _[method](this.models, iterator, context);
};
});
Backbone Views are almost more convention than they are actual code. A View is simply a JavaScript object that represents a logical chunk of UI in the DOM. This might be a single item, an entire list, a sidebar or panel, or even the surrounding frame which wraps your whole app. Defining a chunk of UI as a View allows you to define your DOM events declaratively, without having to worry about render order ... and makes it easy for the view to react to specific changes in the state of your models.
Creating a Backbone.View creates its initial element outside of the DOM, if an existing element is not provided...
var View = Backbone.View = function(options) {
this.cid = _.uniqueId('view');
options || (options = {});
_.extend(this, _.pick(options, viewOptions));
this._ensureElement();
this.initialize.apply(this, arguments);
this.delegateEvents();
};
Cached regex to split keys for delegate
.
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
List of view options to be merged as properties.
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
Set up all inheritable Backbone.View properties and methods.
_.extend(View.prototype, Events, {
The default tagName
of a View's element is "div"
.
tagName: 'div',
jQuery delegate for element lookup, scoped to DOM elements within the current view. This should be preferred to global lookups where possible.
$: function(selector) {
return this.$el.find(selector);
},
Initialize is an empty function by default. Override it with your own initialization logic.
initialize: function(){},
render is the core function that your view should override, in order
to populate its element (this.el
), with the appropriate HTML. The
convention is for render to always return this
.
render: function() {
return this;
},
Remove this view by taking the element out of the DOM, and removing any applicable Backbone.Events listeners.
remove: function() {
this.$el.remove();
this.stopListening();
return this;
},
Change the view's element (this.el
property), including event
re-delegation.
setElement: function(element, delegate) {
if (this.$el) this.undelegateEvents();
this.$el = element instanceof Backbone.$ ? element : Backbone.$(element);
this.el = this.$el[0];
if (delegate !== false) this.delegateEvents();
return this;
},
Set callbacks, where this.events
is a hash of
{"event selector": "callback"}
{
'mousedown .title': 'edit',
'click .button': 'save',
'click .open': function(e) { ... }
}
pairs. Callbacks will be bound to the view, with this
set properly.
Uses event delegation for efficiency.
Omitting the selector binds the event to this.el
.
This only works for delegate-able events: not focus
, blur
, and
not change
, submit
, and reset
in Internet Explorer.
delegateEvents: function(events) {
if (!(events || (events = _.result(this, 'events')))) return this;
this.undelegateEvents();
for (var key in events) {
var method = events[key];
if (!_.isFunction(method)) method = this[events[key]];
if (!method) continue;
var match = key.match(delegateEventSplitter);
var eventName = match[1], selector = match[2];
method = _.bind(method, this);
eventName += '.delegateEvents' + this.cid;
if (selector === '') {
this.$el.on(eventName, method);
} else {
this.$el.on(eventName, selector, method);
}
}
return this;
},
Clears all callbacks previously bound to the view with delegateEvents
.
You usually don't need to use this, but may wish to if you have multiple
Backbone views attached to the same DOM element.
undelegateEvents: function() {
this.$el.off('.delegateEvents' + this.cid);
return this;
},
Ensure that the View has a DOM element to render into.
If this.el
is a string, pass it through $()
, take the first
matching element, and re-assign it to el
. Otherwise, create
an element from the id
, className
and tagName
properties.
_ensureElement: function() {
if (!this.el) {
var attrs = _.extend({}, _.result(this, 'attributes'));
if (this.id) attrs.id = _.result(this, 'id');
if (this.className) attrs['class'] = _.result(this, 'className');
var $el = Backbone.$('<' + _.result(this, 'tagName') + '>').attr(attrs);
this.setElement($el, false);
} else {
this.setElement(_.result(this, 'el'), false);
}
}
});
Override this function to change the manner in which Backbone persists
models to the server. You will be passed the type of request, and the
model in question. By default, makes a RESTful Ajax request
to the model's url()
. Some possible customizations could be:
setTimeout
to batch rapid-fire updates into a single request.Turn on Backbone.emulateHTTP
in order to send PUT
and DELETE
requests
as POST
, with a _method
parameter containing the true HTTP method,
as well as all requests with the body as application/x-www-form-urlencoded
instead of application/json
with the model in a param named model
.
Useful when interfacing with server-side languages like PHP that make
it difficult to read the body of PUT
requests.
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
Default options, unless specified.
_.defaults(options || (options = {}), {
emulateHTTP: Backbone.emulateHTTP,
emulateJSON: Backbone.emulateJSON
});
Default JSON-request options.
var params = {type: type, dataType: 'json'};
Ensure that we have a URL.
if (!options.url) {
params.url = _.result(model, 'url') || urlError();
}
Ensure that we have the appropriate request data.
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.contentType = 'application/json';
params.data = JSON.stringify(options.attrs || model.toJSON(options));
}
For older servers, emulate JSON by encoding the request into an HTML-form.
if (options.emulateJSON) {
params.contentType = 'application/x-www-form-urlencoded';
params.data = params.data ? {model: params.data} : {};
}
For older servers, emulate HTTP by mimicking the HTTP method with _method
And an X-HTTP-Method-Override
header.
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
params.type = 'POST';
if (options.emulateJSON) params.data._method = type;
var beforeSend = options.beforeSend;
options.beforeSend = function(xhr) {
xhr.setRequestHeader('X-HTTP-Method-Override', type);
if (beforeSend) return beforeSend.apply(this, arguments);
};
}
Don't process data on a non-GET request.
if (params.type !== 'GET' && !options.emulateJSON) {
params.processData = false;
}
If we're sending a PATCH
request, and we're in an old Internet Explorer
that still has ActiveX enabled by default, override jQuery to use that
for XHR instead. Remove this line when jQuery supports PATCH
on IE8.
if (params.type === 'PATCH' && noXhrPatch) {
params.xhr = function() {
return new ActiveXObject("Microsoft.XMLHTTP");
};
}
Make the request, allowing the user to override any Ajax options.
var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
model.trigger('request', model, xhr, options);
return xhr;
};
var noXhrPatch = typeof window !== 'undefined' && !!window.ActiveXObject && !(window.XMLHttpRequest && (new XMLHttpRequest).dispatchEvent);
Map from CRUD to HTTP for our default Backbone.sync
implementation.
var methodMap = {
'create': 'POST',
'update': 'PUT',
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
};
Set the default implementation of Backbone.ajax
to proxy through to $
.
Override this if you'd like to use a different library.
Backbone.ajax = function() {
return Backbone.$.ajax.apply(Backbone.$, arguments);
};
Routers map faux-URLs to actions, and fire events when routes are
matched. Creating a new one sets its routes
hash, if not set statically.
var Router = Backbone.Router = function(options) {
options || (options = {});
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
};
Cached regular expressions for matching named param parts and splatted parts of route strings.
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
Set up all inheritable Backbone.Router properties and methods.
_.extend(Router.prototype, Events, {
Initialize is an empty function by default. Override it with your own initialization logic.
initialize: function(){},
Manually bind a single named route to a callback. For example:
this.route('search/:query/p:num', 'search', function(query, num) {
...
});
route: function(route, name, callback) {
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) {
callback = name;
name = '';
}
if (!callback) callback = this[name];
var router = this;
Backbone.history.route(route, function(fragment) {
var args = router._extractParameters(route, fragment);
callback && callback.apply(router, args);
router.trigger.apply(router, ['route:' + name].concat(args));
router.trigger('route', name, args);
Backbone.history.trigger('route', router, name, args);
});
return this;
},
Simple proxy to Backbone.history
to save a fragment into the history.
navigate: function(fragment, options) {
Backbone.history.navigate(fragment, options);
return this;
},
Bind all defined routes to Backbone.history
. We have to reverse the
order of the routes here to support behavior where the most general
routes can be defined at the bottom of the route map.
_bindRoutes: function() {
if (!this.routes) return;
this.routes = _.result(this, 'routes');
var route, routes = _.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
}
},
Convert a route string into a regular expression, suitable for matching against the current location hash.
_routeToRegExp: function(route) {
route = route.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
.replace(namedParam, function(match, optional) {
return optional ? match : '([^\/]+)';
})
.replace(splatParam, '(.*?)');
return new RegExp('^' + route + '$');
},
Given a route, and a URL fragment that it matches, return the array of
extracted decoded parameters. Empty or unmatched parameters will be
treated as null
to normalize cross-browser behavior.
_extractParameters: function(route, fragment) {
var params = route.exec(fragment).slice(1);
return _.map(params, function(param) {
return param ? decodeURIComponent(param) : null;
});
}
});
Handles cross-browser history management, based on either pushState and real URLs, or onhashchange and URL fragments. If the browser supports neither (old IE, natch), falls back to polling.
var History = Backbone.History = function() {
this.handlers = [];
_.bindAll(this, 'checkUrl');
Ensure that History
can be used outside of the browser.
if (typeof window !== 'undefined') {
this.location = window.location;
this.history = window.history;
}
};
Cached regex for stripping a leading hash/slash and trailing space.
var routeStripper = /^[#\/]|\s+$/g;
Cached regex for stripping leading and trailing slashes.
var rootStripper = /^\/+|\/+$/g;
Cached regex for detecting MSIE.
var isExplorer = /msie [\w.]+/;
Cached regex for removing a trailing slash.
var trailingSlash = /\/$/;
Cached regex for stripping urls of hash and query.
var pathStripper = /[?#].*$/;
Has the history handling already been started?
History.started = false;
Set up all inheritable Backbone.History properties and methods.
_.extend(History.prototype, Events, {
The default interval to poll for hash changes, if necessary, is twenty times a second.
interval: 50,
Gets the true hash value. Cannot use location.hash directly due to bug in Firefox where location.hash will always be decoded.
getHash: function(window) {
var match = (window || this).location.href.match(/#(.*)$/);
return match ? match[1] : '';
},
Get the cross-browser normalized URL fragment, either from the URL, the hash, or the override.
getFragment: function(fragment, forcePushState) {
if (fragment == null) {
if (this._hasPushState || !this._wantsHashChange || forcePushState) {
fragment = this.location.pathname;
var root = this.root.replace(trailingSlash, '');
if (!fragment.indexOf(root)) fragment = fragment.slice(root.length);
} else {
fragment = this.getHash();
}
}
return fragment.replace(routeStripper, '');
},
Start the hash change handling, returning true
if the current URL matches
an existing route, and false
otherwise.
start: function(options) {
if (History.started) throw new Error("Backbone.history has already been started");
History.started = true;
Figure out the initial configuration. Do we need an iframe? Is pushState desired ... is it available?
this.options = _.extend({root: '/'}, this.options, options);
this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false;
this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState);
var fragment = this.getFragment();
var docMode = document.documentMode;
var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
Normalize root to always include a leading and trailing slash.
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
if (oldIE && this._wantsHashChange) {
this.iframe = Backbone.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
this.navigate(fragment);
}
Depending on whether we're using pushState or hashes, and whether 'onhashchange' is supported, determine how we check the URL state.
if (this._hasPushState) {
Backbone.$(window).on('popstate', this.checkUrl);
} else if (this._wantsHashChange && ('onhashchange' in window) && !oldIE) {
Backbone.$(window).on('hashchange', this.checkUrl);
} else if (this._wantsHashChange) {
this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
}
Determine if we need to change the base url, for a pushState link opened by a non-pushState browser.
this.fragment = fragment;
var loc = this.location;
var atRoot = loc.pathname.replace(/[^\/]$/, '$&/') === this.root;
Transition from hashChange to pushState or vice versa if both are requested.
if (this._wantsHashChange && this._wantsPushState) {
If we've started off with a route from a pushState
-enabled
browser, but we're currently in a browser that doesn't support it...
if (!this._hasPushState && !atRoot) {
this.fragment = this.getFragment(null, true);
this.location.replace(this.root + this.location.search + '#' + this.fragment);
Return immediately as browser will do redirect to new url
return true;
Or if we've started out with a hash-based route, but we're currently
in a browser where it could be pushState
-based instead...
} else if (this._hasPushState && atRoot && loc.hash) {
this.fragment = this.getHash().replace(routeStripper, '');
this.history.replaceState({}, document.title, this.root + this.fragment + loc.search);
}
}
if (!this.options.silent) return this.loadUrl();
},
Disable Backbone.history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.
stop: function() {
Backbone.$(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl);
clearInterval(this._checkUrlInterval);
History.started = false;
},
Add a route to be tested when the fragment changes. Routes added later may override previous routes.
route: function(route, callback) {
this.handlers.unshift({route: route, callback: callback});
},
Checks the current URL to see if it has changed, and if it has,
calls loadUrl
, normalizing across the hidden iframe.
checkUrl: function(e) {
var current = this.getFragment();
if (current === this.fragment && this.iframe) {
current = this.getFragment(this.getHash(this.iframe));
}
if (current === this.fragment) return false;
if (this.iframe) this.navigate(current);
this.loadUrl();
},
Attempt to load the current URL fragment. If a route succeeds with a
match, returns true
. If no defined routes matches the fragment,
returns false
.
loadUrl: function(fragment) {
fragment = this.fragment = this.getFragment(fragment);
return _.any(this.handlers, function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
}
});
},
Save a fragment into the hash history, or replace the URL state if the 'replace' option is passed. You are responsible for properly URL-encoding the fragment in advance.
The options object can contain trigger: true
if you wish to have the
route callback be fired (not usually desirable), or replace: true
, if
you wish to modify the current URL without adding an entry to the history.
navigate: function(fragment, options) {
if (!History.started) return false;
if (!options || options === true) options = {trigger: !!options};
var url = this.root + (fragment = this.getFragment(fragment || ''));
Strip the fragment of the query and hash for matching.
fragment = fragment.replace(pathStripper, '');
if (this.fragment === fragment) return;
this.fragment = fragment;
Don't include a trailing slash on the root.
if (fragment === '' && url !== '/') url = url.slice(0, -1);
If pushState is available, we use it to set the fragment as a real URL.
if (this._hasPushState) {
this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
If hash changes haven't been explicitly disabled, update the hash fragment to store history.
} else if (this._wantsHashChange) {
this._updateHash(this.location, fragment, options.replace);
if (this.iframe && (fragment !== this.getFragment(this.getHash(this.iframe)))) {
Opening and closing the iframe tricks IE7 and earlier to push a history entry on hash-tag change. When replace is true, we don't want this.
if(!options.replace) this.iframe.document.open().close();
this._updateHash(this.iframe.location, fragment, options.replace);
}
If you've told us that you explicitly don't want fallback hashchange-
based history, then navigate
becomes a page refresh.
} else {
return this.location.assign(url);
}
if (options.trigger) return this.loadUrl(fragment);
},
Update the hash location, either replacing the current entry, or adding a new one to the browser history.
_updateHash: function(location, fragment, replace) {
if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, '');
location.replace(href + '#' + fragment);
} else {
Some browsers require that hash
contains a leading #.
location.hash = '#' + fragment;
}
}
});
Create the default Backbone.history.
Backbone.history = new History;
Helper function to correctly set up the prototype chain, for subclasses.
Similar to goog.inherits
, but uses a hash of prototype properties and
class properties to be extended.
var extend = function(protoProps, staticProps) {
var parent = this;
var child;
The constructor function for the new subclass is either defined by you
(the "constructor" property in your extend
definition), or defaulted
by us to simply call the parent's constructor.
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
Add static properties to the constructor function, if supplied.
_.extend(child, parent, staticProps);
Set the prototype chain to inherit from parent
, without calling
parent
's constructor function.
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
Add prototype properties (instance properties) to the subclass, if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
Set a convenience property in case the parent's prototype is needed later.
child.__super__ = parent.prototype;
return child;
};
Set up inheritance for the model, collection, router, view and history.
Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
Throw an error when a URL is needed, and none is supplied.
var urlError = function() {
throw new Error('A "url" property or function must be specified');
};
Wrap an optional error callback with a fallback error event.
var wrapError = function(model, options) {
var error = options.error;
options.error = function(resp) {
if (error) error(model, resp, options);
model.trigger('error', model, resp, options);
};
};
}).call(this);


For my friend Julia's birthday and Valentine's Day, I made her and her boyfriend a postcard-sized map. This map displays the places that hold meaning in their relationship in the Midtown neighborhood of Detroit. I landed a concept of connecting important love landmarks in a sort of ground constellation.


My Fabulous Garden
Name
Image
Alstroemerias
Gardenias
Orchids
Peonies
Roses
Sunflowers
Tulips
Season
Save
Delete


abstract fun checkWithFun(checkingFun: (Any) -> Boolean): Boolean
Function that checks the whole filtered structure. Force type checking on a structure that we obtained, so we don't sign more than expected. Example: Oracle is implemented to check only for commands, if it gets an attachment and doesn't expect it - it can sign over a transaction with the attachment that wasn't verified. Of course it depends on how you implement it, but else -> false should solve a problem with possible later extensions to WireTransaction.
checkingFun
- function that performs type checking on the structure fields and provides verification logic accordingly.
Return
false if no elements were matched on a structure or checkingFun returned false.


Home
About
Login/Register
Team KidsFly
Wesley White
Project Lead
Tim Griffith
React 2 Developer
Richard Machado
React Developer
Carter Rose
React Developer
David Davis
UI Developer


Plaid Python Documentation!¶
Client¶
-
class
plaid.
Client
(client_id, secret, public_key, environment, suppress_warnings=False, timeout=600, api_version=None)¶ Python Plaid API client.
See official documentation at: https://plaid.com/docs.
All of the endpoints documented under the
plaid.api
module may be called from aplaid.Client
instance.-
__init__
(client_id, secret, public_key, environment, suppress_warnings=False, timeout=600, api_version=None)¶ Initialize a client with credentials.
Parameters: - client_id (str) – Your Plaid client ID
- secret (str) – Your Plaid secret
- public_key (str) – Your Plaid public key
- environment (str) – One of
sandbox
,development
, orproduction
. - suppress_warnings (bool) – Suppress Plaid warnings.
- timeout (int) – Timeout for API requests.
-
API Endpoints¶
Many API endpoints accept optional parameters via an _options
object in the
raw JSON. To improve forward compatibility as options are added, the Python
functions for these endpoints also include an _options
argument. However,
it is recommended that you pass in options using the provided keyword
arguments where possible.
For example:
// Prefer this...
client.Transactions.get(access_token,
start_date,
end_date,
account_ids=account_ids,
count=count,
offset=offset);
// ... over this.
client.Transactions.get(access_token,
start_date,
end_date,
_options={
'account_ids': account_ids,
'count': count,
'offset': offset,
});
-
class
plaid.api.
Accounts
(client)¶ Accounts endpoints. (HTTP docs)
-
class
Balance
(client)¶ Accounts balance endpoint.
-
Balance.
get
(access_token, _options=None, account_ids=None)¶ Retrieve real-time balance information for accounts.
Parameters: - access_token (str) –
- account_ids ([str]) – A list of account_ids to retrieve for the item. Optional.
-
-
Accounts.
get
(access_token, _options=None, account_ids=None)¶ Retrieve high-level account information for an Item.
Parameters: - access_token (str) –
- account_ids ([str]) – A list of account_ids to retrieve for the item. Optional.
-
class
-
class
plaid.api.
AssetReport
(client)¶ Assets endpoints. (HTTP docs)
-
create
(access_tokens, days_requested, options=None)¶ Create an asset report.
Parameters: - access_tokens ([str]) – A list of access tokens, one token for each Item to be included in the Asset Report.
- days_requested (int) – Days of transaction history requested to be included in the Asset Report.
- options (dict) – An optional dictionary. For more information on the options object, see the documentation site listed above.
-
filter
(asset_report_token, account_ids_to_exclude)¶ Create a new, filtered asset report based on an existing asset report.
Parameters: - asset_report_token (str) – The existing Asset Report’s asset report token.
- account_ids_to_exclude ([str]) – A list of account IDs to exclude from the new Asset Report.
-
get
(asset_report_token, include_insights=False)¶ Retrieves an asset report.
Parameters: - asset_report_token (str) – The asset report token for the asset report you created.
- include_insights (bool) – An optional boolean specifying whether we should retrieve the report as an Asset Report with Insights. For more, see https://plaid.com/docs/#retrieve-json-report-request.
-
get_pdf
(asset_report_token)¶ Retrieves an asset report in the PDF format.
Parameters: asset_report_token (str) – The asset report token for the asset report you created.
-
refresh
(asset_report_token, days_requested, options=None)¶ Create a new, refreshed asset report based on an existing asset report.
Parameters: - asset_report_token (str) – The existing Asset Report’s asset report token.
- days_requested (int) – Days of transaction history requested to be included in the Asset Report.
- options (dict) – An optional dictionary. This is the same object used in create.
-
remove
(asset_report_token)¶ Retrieves an asset report in the PDF format.
Parameters: asset_report_token (str) – The asset report token for the asset report you want to remove.
-
-
class
plaid.api.
Auth
(client)¶ Auth endpoints.
-
class
plaid.api.
Categories
(client)¶ Categories endpoints. (HTTP docs)
-
get
()¶ Fetch all plaid categories.
-
-
class
plaid.api.
CreditDetails
(client)¶ Credit details endpoints. (HTTP docs)
-
get
(access_token)¶ Retrieve credit details associated with an item.
Parameters: access_token (str) –
-
-
class
plaid.api.
Identity
(client)¶ Identity endpoints. (HTTP docs)
-
get
(access_token)¶ Retrieve information about an item.
Parameters: access_token (str) –
-
-
class
plaid.api.
Income
(client)¶ Income endpoints. (HTTP docs)
-
get
(access_token)¶ Retrieve income data associated with an item. Adds the income product to the item if it does not already have it.
Parameters: access_token (str) –
-
-
class
plaid.api.
Institutions
(client)¶ Institutions endpoints. (HTTP docs)
-
get
(count, offset=0, _options=None)¶ Fetch all Plaid institutions, using /institutions/all.
Parameters: - count (int) – Number of institutions to fetch.
- offset (int) – Number of institutions to skip.
-
get_by_id
(institution_id, _options=None)¶ Fetch a single institution by id.
Parameters: institution_id (str) –
-
search
(query, _options={}, products=None)¶ Search all institutions by name.
Parameters: - query (str) – Query against the full list of institutions.
- products ([str]) – Filter FIs by available products. Optional.
-
-
class
plaid.api.
Item
(client)¶ Item endpoints. (HTTP docs)
-
class
AccessToken
(client)¶ Access token endpoints.
-
class
plaid.api.item.
PublicToken
(client)¶ Endpoints for translating between public tokens and access tokens.
-
class
plaid.api.item.
Webhook
(client)¶ Webhook endpoints.
-
class
-
class
plaid.api.
Processor
(client)¶ Endpoints for creating processor tokens.
-
class
plaid.api.
Sandbox
(client)¶ Sandbox-only endpoints. (HTTP docs)
These endpoints may not be used in other environments.
-
class
plaid.api.
Transactions
(client)¶ Transactions endpoints.
-
get
(access_token, start_date, end_date, _options=None, account_ids=None, count=None, offset=None)¶ Return accounts and transactions for an item. (HTTP docs)
The transactions in the response are paginated – compare the number of transactions received so far against response[‘total_transactions’] to determine whether to fetch another page.
Parameters: - access_token (str) –
- start_date (str) – The earliest date for transactions.
- end_date (str) – The latest date for transactions.
- account_ids ([str]) – A list of account_ids to retrieve for the item. Optional.
- count (int) – The number of transactions to fetch. Optional.
- offset (int) – The number of transactions to skip from the beginning of the fetch. Optional.
All date should be formatted as
YYYY-MM-DD
.
-
Errors¶
-
exception
plaid.errors.
BaseError
(message, type, code, display_message)¶ Bases:
Exception
A base error class.
Variables: - message (str) – A developer-friendly error message. Not safe for programmatic use.
- type (str) – A broad categorization of the error, corresponding to the error class.
- code (str) – An error code for programmatic use.
- display_message (str) – A user-friendly error message. Not safe for programmatic use. May be None.
-
exception
plaid.errors.
PlaidError
(message, type, code, display_message, request_id='', causes=None)¶ Bases:
plaid.errors.BaseError
A Plaid API error.
Variables: - message (str) – A developer-friendly error message. Not safe for programmatic use.
- type (str) – A broad categorization of the error, corresponding to the error class.
- code (str) – An error code for programmatic use.
- display_message (str) – A user-friendly error message. Not safe for programmatic use. May be None.
- request_id (str) – A unique id returned for all server responses.
- causes (list) – A list of reasons explaining why the error happened.
-
static
from_response
(response)¶ Create an error of the right class from an API response.
:param response dict Response JSON
-
exception
plaid.errors.
PlaidCause
(message, type, code, display_message, item_id)¶ Bases:
plaid.errors.BaseError
A cause of a Plaid error.
Variables: - message (str) – A developer-friendly error message. Not safe for programmatic use.
- type (str) – A broad categorization of the error, corresponding to the error class.
- code (str) – An error code for programmatic use.
- display_message (str) – A user-friendly error message. Not safe for programmatic use. May be None.
- item_id (str) – The item ID.
-
exception
plaid.errors.
InvalidRequestError
(message, type, code, display_message, request_id='', causes=None)¶ Bases:
plaid.errors.PlaidError
The request is malformed and cannot be processed.
-
exception
plaid.errors.
InvalidInputError
(message, type, code, display_message, request_id='', causes=None)¶ Bases:
plaid.errors.PlaidError
The request is correctly formatted, but the values are incorrect.
-
exception
plaid.errors.
RateLimitExceededError
(message, type, code, display_message, request_id='', causes=None)¶ Bases:
plaid.errors.PlaidError
The request is valid but has exceeded established rate limits.
-
exception
plaid.errors.
APIError
(message, type, code, display_message, request_id='', causes=None)¶ Bases:
plaid.errors.PlaidError
Planned maintenance or an API internal server error.
-
exception
plaid.errors.
ItemError
(message, type, code, display_message, request_id='', causes=None)¶ Bases:
plaid.errors.PlaidError
There is invalid information about an item or it is not supported.
-
exception
plaid.errors.
InstitutionError
(message, type, code, display_message, request_id='', causes=None)¶ Bases:
plaid.errors.PlaidError
There are errors for the requested financial institution.


The National’s Matt Berninger puts his own spin on Big Thief’s ‘Not’ – watch
Berninger performed the song solo at a Toronto benefit concert
The National‘s Matt Berninger appears to be a fan of Big Thief, so much so that he performed a cover of their song ‘Not’ at a recent benefit concert.
- Read more: The National – ‘I Am Easy To Find’ review
Taking to the stage in Toronto last night (November 2), Berninger performed solo at Dream Serenade, an annual benefit concert that raises money for and celebrates “children with exceptionalities and their caregivers.”
Choosing to perform a cover, The National frontman put his own spin on his 4AD label mates Big Thief’s ‘Not’, taken from their fourth studio album, ‘Two Hands’.

Watch the performance below:
Last month, The National played ‘Where Is Her Head’ on US TV chat show Jimmy Kimmel Live.
A true highlight from their acclaimed 2019 album and movie ‘I Am Easy To Find‘, the track sees The National’s cast of stellar female backing vocalists take the majority of the lead before frontman Matt Berninger squawks through between choruses.
Meanwhile, The National frontman Matt Berninger has shared the video for ‘Walking On A String’ – his new collaboration with Phoebe Bridgers.
Having been featured on the soundtrack for the new Between Two Ferns Movie, the track sees the pair also collaborate with Berninger’s wife and lyrical partner Carin Besser as well as musician Mike Brewer. ‘Walking On A String’ also features Walter Martin on guitar and The Walkmen‘s Matt Barrick on drums.


4
1 But in the last days it will come about
that the mountain of Yahweh's house
will be established over the other mountains.
It will be exalted above the hills,
and peoples will stream to it.
2 Many nations will go and say,
"Come, let us go up to the mountain of Yahweh,
to the house of the God of Jacob.
He will teach us his ways,
and we will walk in his paths."
For from Zion the law will go out,
and the word of Yahweh from Jerusalem.
3 He will judge among many peoples
and will decide concerning numerous nations far away.
They will beat their swords into plowshares
and their spears into pruning knives.
Nation will not lift up sword against nation,
neither will they learn how to wage war any more.
4 Instead, they will sit every person under his vine
and under his fig tree.
No one will make them afraid,
for the mouth of Yahweh of hosts has spoken.
5 For all the peoples walk,
each one, in the name of their god.
But we will walk in the name of Yahweh our God
forever and ever.
6 "On that day," says Yahweh,
"I will assemble the lame
and gather the outcast,
those whom I have afflicted.
7 I will turn the lame into a remnant,
and the ones driven away into a strong nation,
and I, Yahweh, will reign over them on Mount Zion,
now and forever.
8 And you, watchtower for the flock,
hill of the daughter of Zion,
to you it will come—
the former rule will come,
the kingdom of the daughter of Jerusalem.
9 Now, why do you cry out aloud?
Is there no king in you,
is your counselor perished,
that pangs have taken hold of you like a woman in labor?
10 Be in pain
and labor to give birth,
daughter of Zion,
like a woman in labor.
For now you will you go out of the city,
live in the field,
and go to Babylon.
There you will be rescued.
There Yahweh will rescue you
from the hand of your enemies.
11 Now many nations are assembled against you;
they say, 'Let her be defiled;
let our eyes gloat over Zion.'"
12 The prophet says, They do not know Yahweh's thoughts,
neither do they understand his plans,
for he has gathered them like sheaves for the threshing floor.
13 Yahweh says, "Arise and thresh, daughter of Zion,
for I will make your horn to be iron,
and I will make your hooves to be bronze.
You will crush many peoples.
I will devote their unjust wealth to myself, Yahweh,
their possessions to me, the Lord of the whole earth."


PaaS product prototypes
Current iteration
Previous versions
About this prototype
This prototype has 2 main sections: product pages and admin tool.
Product page sections
Product homepage
This page gives a broad overview of the platform, what it can do and why a service should use it.
Get started
Outlines the steps the user needs to take to start using GOV.UK PaaS.
Request an account
This is where the user requests a PaaS account for their organisation.
Features section
The features section has multiple sub pages such as: Roadmap, Information assurance and Security.
Pricing section
This section gives an overview of the pricing model and links to the pricing calculator.
Pricing calculator
The user can select different backing services and work out how much their service is likely to pay for using GOV.UK PaaS.
Support
Outlines the different support options for the user.
Admin tool sections
My organisations
List the organisations the user has admin access too.
Org overview/dashboard
Gives an overview of a specific organisations PaaS memory and usage and allows the user to dig deeper into the different spaces and applications in the org.
Team members
Gives an overview of a specific organisations team members and permissions. Gives the user the opportunity to add more team members or view a specific team member in more detail.
Billing section
Allows the user to see what their service has spent on GOV.UK PaaS on a monthly basis.


12.4
Observations on Board
Since no information about the operating history of the vessel was made available by owners/managers and also the Final Report of the JAIC contains very little in this respect, members of this 'Group of Experts' have spoken to previous passengers, advisers and crew members in order to find out how ESTONIA and her crew did perform during the 20 months in service under Estonian flag. Further information has come from viewers of the Swedish TV program 'EFTERLYS' after the ESTONIA casualty had been presented and viewers were requested to report about their own experiences on board the ESTONIA, which about 40 viewers did. The reports submitted during or immediately after the program - attached as Enclosure 12.4.145 - were analysed and the witnesses assumed to have made relevant observations were contacted by a Swedish speaking expert of this 'Group of Experts' either personally or by phone. The results are summarised in two faxes from Oy Mariner's Assistance Ltd. Ab, Helsinki to Marine Claims Partner (Germany) GmbH, Hamburg dated 30.07.97 - Enclosure 12.4.146 and dated 12.08.97 - Enclosure 12.4.147. The results of all observations made on ESTONIA and which are available to this 'Group of Experts' are summarised below.
One of the viewers of the 'EFTERLYS' program reported that he saw the ESTONIA in July 1994 at her berth in Stockholm with open visor and open bow ramp, which was categorically denied by N&T, ESCO and the JAIC members.The following picture proves it. It was made by a German tourist in July 1994.
12.4.1
Heavy weather, excessive speed and banging noises
»I have made, at least, 20-25 voyages on the ESTONIA and was, at least, 3 times on the bridge.
I am sending you the Swedish translation of an interview with Andi Meister published in the Estonian newspaper 'Postimees' on 16 January 1996.
Read the article and draw your own conclusions.
For me, having read his statement, it is a further confirmation that the guy doesn't know what he is talking about.
He made it quite clear that the causes of the catastrophe are exclusively technical.
Why is the excessive speed not taken into account?
In interviews and statement by the Estonian members of the JAIC it is said that the speed is of no relevance and had no effect on the catastrophe.
The chairman of the Commission has furthermore given wrong information in the interview when he stated that during the voyage there would be nobody on the car deck.The crew went safety rounds on the car deck.
At the same time I am asking the question, after having read in the interview about all the deficiencies that had been on the vessel, why were these obvious deficiencies not rectified when the vessel changed flags to Estonia?
The vessel was for a longer time sailing under Estonian flag and it should very well have been noted that the ramp was at the wrong place.
Or didn't they have competent masters and superintendents who were able to find that out?
According to the Estonian newspapers one of the conclusions in the Final Report shall be that the speed had no relevance for the catastrophe, which is totally wrong and not understandable because the vessel was proceeding with full engine power against a full storm. Many people, who do not even have own experience with good seamanship, will laugh about it. Already in the autumn (1995) the public has pointed to the fact that the Estonian Commission is biased. This is true, but the required consequences have not been taken.
The Commission itself does everything to make the Final Report, which is of substantial international interest, a farce, which is absolutely impossible.
Forsberg did indeed state in yesterday's 'Svenska Dagbladet' that the survivors had been questioned by the police. I am asking you, Hans: Is it possible for an external, who has never had to do with shipping or with how to handle a vessel, to ask the proper questions to establish a correct picture (scenario) of what had happened?«
Hans Rosengren never replied to this letter and the friendship between the two came to an end.
»My cabin was on the 4th deck, port side, forward and was overlooking the forecastle deck. I went to bed at 11.30 hours Estonian time. The waves were coming over the bow visor and were smashing with remarkable force against my cabin window. Each time the vessel was diving into a wave-trough there was banging - metal on metal - and I had the feeling that the visor was loose. It was impossible to sleep, so I got dressed and walked all around the vessel and subsequently I went as deep as I could inside the vessel. Down there I could also hear the banging, but it did not sound as dangerous. I went back to my cabin where the banging noises were much louder and frightening. I went back to the aft part of the vessel and found an empty sofa, where I slept until the next morning.«
The complete letter with office translation is attached as Enclosure <IP_ADDRESS>.
12.4.2
Proceeding through iceThe picture below shows ESTONIA at her berth in Tallinn with open visor and bow ramp on 30.03.94, i.e. more or less at the end of the ice winter which had left visible traces to the visor's structure - see arrow.
Carl Övberg:
"I also made trips with ESTONIA in February/March 1994 when ESTONIA was acting like an icebreaker proceeding at full speed through heavy ice all the time until shortly before arrival. Once she almost stopped due to the very thick ice and then proceeded slowly ahead. The vessel was shaking and vibrating which was felt and heard all over the ship.
ESTONIA was always late arriving in Tallinn and also always delayed departing from Tallinn, but she was always on time in Stockholm no matter what the ice or wind conditions were like."The complete statement of Carl Övberg is attached as Enclosure <IP_ADDRESS>.
Henning Frederiksson on 24.03.1994:
»It was stormy weather and ESTONIA was proceeding in open water at full speed with a following sea when she met pack ice, which she crashed into without any speed reduction. ESTONIA came fast into the pack ice with an enormous crash and had to go backwards and try again. There was 16 m/sec. storm, nevertheless, ESTONIA kept her high speed.«
The ice situation is demonstrated on the ice chart of 28.03.94 which is attached as Enclosure <IP_ADDRESS> and two photos showing the cruise vessel SALLY ALBATROSS sitting aground outside Porkkala (opposite Tallinn) in heavy ice during February/March 1994. The photos attached as Enclosure <IP_ADDRESS> clearly demonstrate the ice conditions which were prevailing at this time in the Gulf of Finland. The effect these ice conditions had on the visor and foreship of the ESTONIA can be seen on the photo below which was made on 24.03.94.


{# check if this is developers mode, if there is an admin bar at the bottom of the page #} {# to have more CSS controle we use the title to create an page id #}
{% block content %}If you see me, you haven’t set your block content
yet.
See Swig’s Template Inheritance documentation for an explanation.


Go to the source code of this file.
Definition at line 15 of file enums.h.
standard quality enum
Definition at line 6 of file enums.h.


$def with ( event )
$var title = 'Event'
Event Id: $event[ 0 ]
$if 'base.TIMESTAMP' in event[ 1 ].values()[ 0 ]:
Time: $tsToTime( event[ 1 ].values()[ 0 ][ 'base.TIMESTAMP' ] )
Download file in this event
$json.dumps( event[ 1 ], indent = 2 )


Add Area
Homepage
Going Out
Add Area
About us
Please let us use your current location!
What is the name of the place that you want to add?
I'm there at the moment, use my location.
Submit


{% extends "base.html" %} {% block content %}
Choose source startlist:
Always a unique name.
Enter only number
Number of start lines


|
wxExtension
v3.0.2
|
Collection of all lexers. More...
#include <wx/extension/lexers.h>
Public Member Functions | |
| void | ApplyGlobalStyles (wxStyledTextCtrl *stc) |
| Sets global styles (and colours and indicators) for current theme for specified component. More... | |
| void | ApplyHexStyles (wxStyledTextCtrl *stc) const |
| Sets hex styles for specified component. | |
| void | ApplyIndicators (wxStyledTextCtrl *stc) const |
| Sets indicators for specified component. | |
| const wxString | ApplyMacro (const wxString &text, const wxString &lexer="global") |
| Applies macro to text: if text is referring to a macro, text is replaced by the macro value. More... | |
| void | ApplyMarkers (wxStyledTextCtrl *stc) const |
| Sets markers for specified component. | |
| void | ApplyProperties (wxStyledTextCtrl *stc) const |
| Sets properties for specified component. | |
| const wxString | BuildWildCards (const wxFileName &filename) const |
| Builds a wildcard string from available lexers using specified filename. | |
| const wxExLexer | FindByFileName (const wxFileName &filename) const |
| Finds a lexer specified by a filename. | |
| const wxExLexer | FindByName (const wxString &name) const |
| Finds a lexer specified by the (display scintilla) name. | |
| const wxExLexer | FindByText (const wxString &text) const |
| Finds a lexer if text starts with some special tokens. | |
| size_t | GetCount () const |
| Returns the number of lexers. | |
| const wxExStyle & | GetDefaultStyle () const |
| Returns the default style. | |
| const wxFileName & | GetFileName () const |
| Gets the filename. | |
| const wxString | GetKeywords (const wxString &set) const |
| Gets the keywords for the specified named set of keywords. More... | |
|
const std::map< wxString, wxString > & | GetMacros (const wxString &lexer) |
| Gets the macros for specified lexer. | |
| const std::vector< wxExProperty > & | GetProperties () const |
| Gets global properties. | |
| const wxString & | GetTheme () const |
| Returns the current theme. | |
| bool | GetThemeOk () const |
| Returns whether the current theme is not the empty theme. | |
|
const std::map< wxString, wxString > & | GetThemeMacros () |
| Gets the theme macros for the current theme. | |
| bool | IndicatorIsLoaded (const wxExIndicator &indic) const |
| Returns true if specified indicator is available. | |
| bool | LoadDocument () |
| Loads all lexers (first clears them) from document. More... | |
| bool | MarkerIsLoaded (const wxExMarker &marker) const |
| Returns true if specified marker is available. | |
| void | RestoreTheme () |
| Restores theme from config (after SetThemeNone). | |
| bool | SetTheme (const wxString &theme) |
| Sets specified theme. More... | |
| void | SetThemeNone () |
| Temporary use the no theme, until you do RestoreTheme. | |
| bool | ShowDialog (wxWindow *parent, wxString &lexer, const wxString &caption=_("Enter Lexer"), bool show_modal=true) const |
| Shows a dialog with all lexers, allowing you to choose one. More... | |
| bool | ShowThemeDialog (wxWindow *parent, const wxString &caption=_("Enter Theme"), bool show_modal=true) |
| Shows a dialog with all themes, allowing you to choose one. More... | |
Static Public Member Functions | |
| static wxExLexers * | Get (bool createOnDemand=true) |
| Returns the lexers object. More... | |
| static wxExLexers * | Set (wxExLexers *lexers) |
| Sets the object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be NULL). More... | |
Collection of all lexers.
The lexers are loaded from lexers.xml, this is done automatically during the first Get call.
| void wxExLexers::ApplyGlobalStyles | ( | wxStyledTextCtrl * | stc | ) |
Sets global styles (and colours and indicators) for current theme for specified component.
| const wxString wxExLexers::ApplyMacro | ( | const wxString & | text, |
| const wxString & | lexer = "global" |
||
| ) |
Applies macro to text: if text is referring to a macro, text is replaced by the macro value.
Otherwise the same text is returned.
|
static |
Returns the lexers object.
If this is the first invocation, and createOnDemand is true, it also invokes LoadDocument.
| const wxString wxExLexers::GetKeywords | ( | const wxString & | set | ) | const |
Gets the keywords for the specified named set of keywords.
Returns empty string if set does not exist.
| bool wxExLexers::LoadDocument | ( | ) |
Loads all lexers (first clears them) from document.
Returns true if the document is loaded.
|
static |
Sets the object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be NULL).
| bool wxExLexers::SetTheme | ( | const wxString & | theme | ) |
Sets specified theme.
Returns true if theme is an existing theme.
| bool wxExLexers::ShowDialog | ( | wxWindow * | parent, |
| wxString & | lexer, | ||
| const wxString & | caption = _("Enter Lexer") , |
||
| bool | show_modal = true |
||
| ) | const |
Shows a dialog with all lexers, allowing you to choose one.
Returns true and fills the lexer if you selected one.
| parent | parent |
| lexer | If you specify an existing lexer, it is selected in the list. If you press OK, the lexer is set to the selected lexer. |
| caption | caption |
| show_modal | shows modal dialog |
| bool wxExLexers::ShowThemeDialog | ( | wxWindow * | parent, |
| const wxString & | caption = _("Enter Theme") , |
||
| bool | show_modal = true |
||
| ) |
Shows a dialog with all themes, allowing you to choose one.
Returns true and sets current theme if you select one.
| parent | parent |
| caption | caption |
| show_modal | shows modal dialog |


This page is made by Veličković Đorđe as Project... Work for Computer Practicum II subject of the University of Primorska. It is one of 3 Projects that students can choose. Due to global situation with the COVID-19 and inability for Universities to stick with regular exams which require physical attendance, these Projects are counted as Midterm I exam. There are minimum requirements students have to meet such as User Interface design as well as Optional Features for a higher grade. By now you probably already know what I am shooting for. I'll give my best to make this page be fun and pleasurable experience to you but also for me to reach higher grades. Enjoy! Read more
© Veličković Đorđe


|
Connected Home over IP
672cf7684
|
Classes | |
| class | BleApplicationDelegate |
| class | BleConnectionDelegate |
| class | BLEEndPoint |
| class | BleEndPointPool |
| class | BleLayer |
| This class provides an interface for a single thread to drive data either up the stack via the BleLayer platform interface functions, or down the stack via a chipConnection object associated with a BLEEndPoint. More... | |
| class | BleLayerObject |
| class | BlePlatformDelegate |
| class | BleTransportCapabilitiesRequestMessage |
| class | BleTransportCapabilitiesResponseMessage |
| class | BtpEngine |
| struct | ChipBLEDeviceIdentificationInfo |
| chip BLE Device Identification Information Block More... | |
| struct | ChipBleUUID |
Typedefs | |
| typedef uint8_t | SequenceNumber_t |
Enumerations | |
| enum | { kBleCloseFlag_SuppressCallback = 0x01, kBleCloseFlag_AbortTransmission = 0x02 } |
| enum | BleRole { kBleRole_Central = 0, kBleRole_Peripheral = 1 } |
| Role of end points' associated BLE connections. Determines means used by end points to send and receive data. More... | |
| enum | BleTransportProtocolVersion { kBleTransportProtocolVersion_None = 0, kBleTransportProtocolVersion_V1 = 1, kBleTransportProtocolVersion_V2 = 2, kBleTransportProtocolVersion_V3 = 3 } |
| Enum defining versions of CHIP over BLE transport protocol. More... | |
| enum | PacketType_t { kType_Data = 0, kType_Control = 1 } |
| enum | chipBLEServiceDataType { kchipBLEServiceDataType_DeviceIdentificationInfo = 0x01, kchipBLEServiceDataType_TokenIdentificationInfo = 0x02 } |
| chip data block types that may appear with chip BLE service advertisement data. More... | |
Functions | |
| void | RegisterLayerErrorFormatter () |
| Register a text error formatter for BLE Layer errors. More... | |
| bool | FormatLayerError (char *buf, uint16_t bufSize, int32_t err) |
| constexpr size_t | kCapabilitiesResponseLength (kCapabilitiesResponseMagicnumLength+kCapabilitiesResponseL2capMtuLength+kCapabilitiesResponseSelectedProtocolVersionLength+kCapabilitiesResponseWindowSizeLength) |
| static uint8_t | HexDigitToInt (const char c) |
| bool | UUIDsMatch (const ChipBleUUID *idOne, const ChipBleUUID *idTwo) |
| bool | StringToUUID (const char *str, ChipBleUUID &uuid) |
| static void | IncSeqNum (SequenceNumber_t &a_seq_num) |
| static bool | DidReceiveData (BitFlags< BtpEngine::HeaderFlags > rx_flags) |
| static void | PrintBufDebug (const System::PacketBufferHandle &buf) |
| struct chip::Ble::ChipBLEDeviceIdentificationInfo | __attribute__ ((packed)) |
Variables | |
| static BleEndPointPool | sBLEEndPointPool |
| constexpr size_t | kCapabilitiesRequestMagicnumLength = 2 |
| constexpr size_t | kCapabilitiesRequestL2capMtuLength = 2 |
| constexpr size_t | kCapabilitiesRequestSupportedVersionsLength = 4 |
| constexpr size_t | kCapabilitiesRequestWindowSizeLength = 1 |
| constexpr size_t | kCapabilitiesRequestLength |
| constexpr size_t | kCapabilitiesResponseMagicnumLength = 2 |
| constexpr size_t | kCapabilitiesResponseL2capMtuLength = 2 |
| constexpr size_t | kCapabilitiesResponseSelectedProtocolVersionLength = 1 |
| constexpr size_t | kCapabilitiesResponseWindowSizeLength = 1 |
| const ChipBleUUID | CHIP_BLE_SVC_ID |
| constexpr size_t | kTransferProtocolHeaderFlagsSize = 1 |
| constexpr size_t | kTransferProtocolSequenceNumSize = 1 |
| constexpr size_t | kTransferProtocolAckSize = 1 |
| constexpr size_t | kTransferProtocolMsgLenSize = 2 |
| constexpr size_t | kTransferProtocolMaxHeaderSize |
| constexpr size_t | kTransferProtocolMidFragmentMaxHeaderSize |
| constexpr size_t | kTransferProtocolStandaloneAckHeaderSize |
| typedef uint8_t chip::Ble::SequenceNumber_t |
| enum chip::Ble::BleRole |
| struct chip::Ble::ChipBLEDeviceIdentificationInfo chip::Ble::__attribute__ | ( | (packed) | ) |
|
inlinestatic |
| bool chip::Ble::FormatLayerError | ( | char * | buf, |
| uint16_t | bufSize, | ||
| int32_t | err | ||
| ) |
|
inlinestatic |
|
inlinestatic |
|
constexpr |
|
static |
| void chip::Ble::RegisterLayerErrorFormatter | ( | ) |
Register a text error formatter for BLE Layer errors.
| bool chip::Ble::StringToUUID | ( | const char * | str, |
| ChipBleUUID & | uuid | ||
| ) |
| bool chip::Ble::UUIDsMatch | ( | const ChipBleUUID * | idOne, |
| const ChipBleUUID * | idTwo | ||
| ) |
| const ChipBleUUID chip::Ble::CHIP_BLE_SVC_ID |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
static |


| Rotates the image counter-clockwise a specific angle. |
| image = variable containing the image handle value# = floating number from 0 to 350 degrees |
Command Description:
| I'm going to start this description off with: This command is not fast enough to render rotations in real time! Now, the purpose of this command is to rotate an image a specified number of degrees. Since it is slow, you will need to pre-calculate rotated images with this command. This means, before the program actually displays the images you rotate, you will want to rotate them ahead of time. This command automatically dithers/anti-aliases the rotated graphic image, so it might mess with your transparency. To avoid this issue, use the TFormFilter command. This will render the rotated images with bi-linear filtering. I'm going to end this command with: This command is not fast enough to render rotations in real time! |
Example:
| ; RotateImage/TFormFilter Example ; Turn on graphics mode Graphics 640,480,16 ; Change the 0 to a 1 to see the difference ; between filter on and off. TFormFilter 0 ; Create new empty graphic to store our circle in gfxBox=CreateImage(50,50) ; Draw the box image ; Set drawing operations to point to our new empty graphic SetBuffer ImageBuffer(gfxBox) Color 255,0,0 ; Note the extra space between the box and the edge of the graphic Rect 10,10,30,30,1 SetBuffer FrontBuffer() While Not KeyHit(1) ; Make a copy of the image so we are always using a fresh one each time ; we rotate it. gfxTemp=CopyImage(gfxBox) ; Rotate it a random value and draw it at a random location RotateImage gfxTemp,Rnd(360) DrawImage gfxTemp,Rnd(640),Rnd(480) Wend |


The DoSS Toolkit is a bunch of self-paced modules to help you learn and use R.
We all know that R is a critical part of applied statistics and data science these days, but it can have a steep learning curve and be intimidating to get started with.
The Department of Statistical Sciences (DoSS) toolkit is a free series of open source online modules written by undergraduates, that their fellow students and the public can use to learn the essentials of R.
How to use this resource
If you have never used R before
You use this resource by running R code! This may sound intimidating if you’ve never used R before, so we’ve made a video that walks through what you need to do.
Get started by going to R Studio Cloud - https://rstudio.cloud - and creating an account. When you’ve signed up, start a new project, and copy-paste the code below to install packages. (If you already have R and R Studio working on your local computer then you don’t have to use R Studio Cloud, you can install the packages on your local machine instead.)
You’ll use the function run_tutorial to run each module. At the moment we have nine modules. So you can pick one to start with. For instance, if you wanted to run the ‘hello world’ module then run:
You’ll use the function run_tutorial to run each module. At the moment we have ten modules. So you can pick one to start with. For instance, if you wanted to run the ‘hello world’ module then run:
Writing R Packages, written by Matthew Wankiewicz.
Getting started with Blogdown, written by Annie Collins.
Getting started with Shiny, written by Matthew Wankiewicz.
Contributors
Annie Collins is an undergraduate student in the Department of Mathematics specializing in applied mathematics and statistics with a minor in history and philosophy of science. In her free time, she focuses her efforts on student governance, promoting women’s representation in STEM, and working with data in the non-profit and charitable sector.
Haoluan Chen is an undergraduate student in the Department of Statistical Science specializing in applied statistics. He is interested in applying data science techniques, especially in NLP, to gain insight from the data.
Isaac Ehrlich is an undergraduate student in Statistics and Cognitive Science at the University of Toronto. He enjoys using R for everything from analysing trends in his recent movie-viewing history, to his past research building models on human categorization.
Mariam Walaa is an undergraduate student in the Department of Computer and Mathematical Sciences at University of Toronto Scarborough, majoring in Mathematics and minoring in GIS and statistics. Mariam enjoys learning about how to work with data such as spatial and text data to extract insights.
Marija Pejcinovska is a graduate student in the Department of Statistical Sciences. Her research is motivated by modelling challenges that arise with “complicated” data (sparse/highly biased/poor quality data), usually in the context of social or health inequalities.
Matthew Wankiewicz is an undergraduate student at the University of Toronto, majoring in Statistics and minoring in Mathematics and the History and Philosophy of Science.
Michael Chong is a graduate student in the Department of Statistical Sciences. His research aims to build statistical models for demographic estimation in contexts where high quality data are unavailable. There is almost always an active R session on his computer!
Paul Hodgetts is a Master of Information candidate concentrating in Human-Centred Data Science in the Faculty of Information, University of Toronto. He sincerely believes that Calvin and Hobbes is the greatest comic ever produced.
Rohan Alexander is an assistant professor in the Faculty of Information and the Department of Statistical Sciences. Some people convert to catholicism upon marriage, Rohan converted to R. His greatest professional achievement is probably getting a pull request accepted into R for Data Science (it was just fixing a minor typo but still).
Samantha-Jo Caetano is an assistant professor (teaching stream) in the Department of Statistical Sciences. She loves statistics, socializing, her family, and her dogs, not necessarily in that order.
Shirley Deng is an undergraduate student specializing in Statistics and majoring in Mathematics. Meticulous and soft-hearted, she often finds herself engrossed in new pastimes by the second at the influence of her peers. One of which that has remained a longtime constant - spending an excessive amount of time helping people debug their R code.
Yena Joo is an undergraduate student majoring in Economics and double minoring in Statistics and Computer Science.
Pedagogical underpinnings
Coming soon.
Acknowledgements
We gratefully acknowledge the support of Professor Bethany White, Chair Radu Craiu, and the U of T Faculty of Arts & Sciences Pedagogical Innovation and Experimentation Fund.
We’d like to acknowledge the help of:
Liza Bolton
Monica Alexander
Sabrina Sixta
We’d like to thank Alex Cookson for his collection of datasets.
This toolkit builds on, and complements, the work of many others, including:
Bodwin, Kelly, and Hunter Glanz (2020). flair: Highlight, Annotate, and Format your R Source Code. R package version 0.0.2. https://CRAN.R-project.org/package=flair
de Vries, Andrie, Barret Schloerke and Kenton Russell (2020). sortable: Drag-and-Drop in ‘shiny’ Apps with ‘SortableJS’. R package version 0.4.4. https://CRAN.R-project.org/package=sortable
Hester, Jim, Gábor Csárdi, Hadley Wickham, Winston Chang, Martin Morgan and Dan Tenenbaum (2020). remotes: R Package Installation from Remote Repositories, Including ‘GitHub’. R package version 2.2.0. https://CRAN.R-project.org/package=remotes
R Core Team (2020). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
The best way to contribute fixes and minor typos is to make a pull request on GitHub.
If you are interested in contributing lessons or modules, then please contact Rohan Alexander. We are particularly interested in partnering with an institution where the language of instruction is French to develop a French language version.


At Postman, we create with the same curiousity that we see in our users. We value transparency and honest communication about not only successes, but mistakes. In our work, we focus on specific goals that add up to a larger vision. Our inclusive work culture ensures that everyone is valued equally as important pieces of our final product. We are dedicated to delivering the best products we can.
We repeatedly ask 'why?' and challenge best practices.
We seek input first and actively listen before taking action.
We recognize that clear priorities promote efficiency and quality.
We count on each other, always offer help, and focus on solutions.
We learn from our mistakes and adapt with ease.
We offer competitive salary and benefits, an informal and fun working environment, and provide lunch every day. (Yes, seriously. Every day.) We believe in autonomous small teams taking on big challenges, and we’re intentional about building an inclusive culture where everyone is able to do their best work and be the best version of themselves. We’re building a long-term company, and we want you to be part of it.
We offer company-subsidized medical plans to keep you healthy.
We offer company-subsidized dental plans to keep you smiley.
We offer company-subsidized vision plans so you can see your brilliant colleagues.
There’s a drum set in the Bangalore office. If you’re ever there, you should play it.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Consectetur cras netus dapibus ac placerat cras in ac id. Nunc habitant cras eget velit etiam viverra lectus. Amet etiam pretium
We repeatedly ask 'why?' and challenge best practices.
We repeatedly ask 'why?' and challenge best practices.
We repeatedly ask 'why?' and challenge best practices.
We repeatedly ask 'why?' and challenge best practices.
We repeatedly ask 'why?' and challenge best practices.
We repeatedly ask 'why?' and challenge best practices.
We repeatedly ask 'why?' and challenge best practices.
We repeatedly ask 'why?' and challenge best practices.


This page demonstrates responsive design.
Try to make the page smaller or wider, to see responsive design in action.
W3Schools is a web developer's site.
We provide tutorials and references covering many aspects of web programming, including HTML, CSS, JavaScript, XML, SQL, PHP, ASP, etc.
W3schools contains thousands of code examples. By using an online editor, readers can edit examples experimentally.
HTML Tutorial
W3Schools is a web developer's site.
We provide tutorials and references covering many aspects of web programming, including HTML, CSS, JavaScript, XML, SQL, PHP, ASP, etc.
W3schools contains thousands of code examples. By using an online editor, readers can edit examples experimentally.
HTML Tutorial
This page demonstrates responsive design.
Try to make the page smaller or wider, to see responsive design in action.


Hello, Dry!
It’s almost Feminist Pride Day! Saturday is going to be a day of feminist reclamation, declaration, and inspiration - but why stop at one day? We’re partying all week long [ http://feministcampus.org/feministprideday/ ] - and you’re totally invited! There’s two ways to jump on board: you can tweet selfies as part of our week-long selfie storm, or you can sign the Feminist Pride Day Pledge.
We want to show the world what feminism looks like - so start by taking a picture of yourself! Whether you’re with friends and family or you use a glamorous solo shot, *post a selfie on Twitter or Instagram with the hashtag to show the world that you’re proud to be a feminist! *(When you post your feminist selfie, you’ll also be entered to win some feminist swag from the FMF’s Feminist Store [ http://store.feminist.org ], and we’ll be retweeting and featuring your selfies all week long!) Once you’re done showing your beautiful face to the world, *head over to our Feminist Pride Day portal and sign a pledge to declare that you “are ” [ http://feministcampus.org/feministprideday/ ].*
In honor of Feminist Pride Day, let your feminist flag fly. Now let’s get this party started!
Looking forward,
*The Feminist Campus Team*
Adriana, Brooke, Carmen, Edwith, Kristy, Maddie and duVergne
You have received this e-mail because of your interest in women’s issues. To unsubscribe, please click here. [ http://salsa.democracyinaction.org/o/1400/p/salsa/supporter/unsubscribe/public/index.sjs?unsubscribe_page_KEY=494 ]


Complete the steps below in the Trinket to solve this problem with Python. It is recommended that you type each line instead of copying/pasting so you start to remember what you've done previously.
There may be multiple ways to get the correct answer. If you have a cool method, please fill out the feedback form for extra credit! See the footer or first page for the link.
# Import Libraries
, add:
import scipy.constants as sp
import math
# Variables
, add:
height = #
. Replace #
with the distance between the power lines and the ground.length = #
. Replace #
with the distance between the power lines.current = #
. Replace #
with the current.freq = #
. Replace #
with the frequency.h_body = #
. Replace #
with the length of the body at the base of the tower.w_body = #
. Replace #
with the width of the body at the base of the tower.# Calculations
, add the following to calculate the magnitude of the magnetic field:
r = math.sqrt(height**2 + ((length**2)/4))
sin_theta = length/(2*r)
ang_freq = 2 * sp.pi * freq
area_body = h_body * w_body
B = (((sp.mu_0*current)/(2*sp.pi*r))*2)*sin_theta
max_emf = B * area_body * ang_freq
max_emf_mV = max_emf * 1000
# Print
, print the answers! Add:
print("Part 1: The magnitude of the magnetic field =", B, "T")
print("Part 2: The maximum emf =", max_emf_mV, "mV")


Multi metrics Analysis
Here are the analysis based on corresponding following metrics cats dogs horses elephants


{% with all_lounges=view_objects.viz_hotspots.all_lounges %}
Hot Spot Analysis : {{ TEAM_LABEL }}
This visualization shows the relative level of energy consumption over
the past 7 days for a single lounge.
Bigger spots mean more energy used. Red spots are the top five spots that consume the most
energy.
The size of the dot indicates the relative energy consumption during that hour.
You can use this visualization to look for trends in energy data, such
as days (rows) or hours of the day (columns) with relatively large (or
small) consumption.