import ComputedProperty from '@ember/object/computed';
import { setOwner } from '@ember/application';
import { isNone } from '@ember/utils';
import EmberError from '@ember/error';
import Evented from '@ember/object/evented';
import EmberObject, {
computed,
get,
observer
} from '@ember/object';
import Map from '@ember/map';
import Ember from 'ember';
import { DEBUG } from '@glimmer/env';
import { assert, deprecate, warn } from '@ember/debug';
import { PromiseObject } from "../promise-proxies";
import Errors from "../model/errors";
import isEnabled from '../../features';
import RootState from '../model/states';
import {
relationshipsByNameDescriptor,
relatedTypesDescriptor,
relationshipsDescriptor
} from '../relationships/ext';
/**
@module ember-data
*/
function findPossibleInverses(type, inverseType, name, relationshipsSoFar) {
let possibleRelationships = relationshipsSoFar || [];
let relationshipMap = get(inverseType, 'relationships');
if (!relationshipMap) { return possibleRelationships; }
let relationships = relationshipMap.get(type.modelName).filter(relationship => {
let optionsForRelationship = inverseType.metaForProperty(relationship.name).options;
if (!optionsForRelationship.inverse) {
return true;
}
return name === optionsForRelationship.inverse;
});
if (relationships) {
possibleRelationships.push.apply(possibleRelationships, relationships);
}
//Recurse to support polymorphism
if (type.superclass) {
findPossibleInverses(type.superclass, inverseType, name, possibleRelationships);
}
return possibleRelationships;
}
function intersection (array1, array2) {
let result = [];
array1.forEach((element) => {
if (array2.indexOf(element) >= 0) {
result.push(element);
}
});
return result;
}
const RESERVED_MODEL_PROPS = [
'currentState', 'data', 'store'
];
const retrieveFromCurrentState = computed('currentState', function(key) {
return get(this._internalModel.currentState, key);
}).readOnly();
/**
The model class that all Ember Data records descend from.
This is the public API of Ember Data models. If you are using Ember Data
in your application, this is the class you should use.
If you are working on Ember Data internals, you most likely want to be dealing
with `InternalModel`
@class Model
@namespace DS
@extends Ember.Object
@uses Ember.Evented
*/
const Model = EmberObject.extend(Evented, {
_internalModel: null,
store: null,
__defineNonEnumerable(property) {
this[property.name] = property.descriptor.value;
},
/**
If this property is `true` the record is in the `empty`
state. Empty is the first state all records enter after they have
been created. Most records created by the store will quickly
transition to the `loading` state if data needs to be fetched from
the server or the `created` state if the record is created on the
client. A record can also enter the empty state if the adapter is
unable to locate the record.
@property isEmpty
@type {Boolean}
@readOnly
*/
isEmpty: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loading` state. A
record enters this state when the store asks the adapter for its
data. It remains in this state until the adapter provides the
requested data.
@property isLoading
@type {Boolean}
@readOnly
*/
isLoading: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loaded` state. A
record enters this state when its data is populated. Most of a
record's lifecycle is spent inside substates of the `loaded`
state.
Example
```javascript
let record = store.createRecord('model');
record.get('isLoaded'); // true
store.findRecord('model', 1).then(function(model) {
model.get('isLoaded'); // true
});
```
@property isLoaded
@type {Boolean}
@readOnly
*/
isLoaded: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `dirty` state. The
record has local changes that have not yet been saved by the
adapter. This includes records that have been created (but not yet
saved) or deleted.
Example
```javascript
let record = store.createRecord('model');
record.get('hasDirtyAttributes'); // true
store.findRecord('model', 1).then(function(model) {
model.get('hasDirtyAttributes'); // false
model.set('foo', 'some value');
model.get('hasDirtyAttributes'); // true
});
```
@since 1.13.0
@property hasDirtyAttributes
@type {Boolean}
@readOnly
*/
hasDirtyAttributes: computed('currentState.isDirty', function() {
return this.get('currentState.isDirty');
}),
/**
If this property is `true` the record is in the `saving` state. A
record enters the saving state when `save` is called, but the
adapter has not yet acknowledged that the changes have been
persisted to the backend.
Example
```javascript
let record = store.createRecord('model');
record.get('isSaving'); // false
let promise = record.save();
record.get('isSaving'); // true
promise.then(function() {
record.get('isSaving'); // false
});
```
@property isSaving
@type {Boolean}
@readOnly
*/
isSaving: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `deleted` state
and has been marked for deletion. When `isDeleted` is true and
`hasDirtyAttributes` is true, the record is deleted locally but the deletion
was not yet persisted. When `isSaving` is true, the change is
in-flight. When both `hasDirtyAttributes` and `isSaving` are false, the
change has persisted.
Example
```javascript
let record = store.createRecord('model');
record.get('isDeleted'); // false
record.deleteRecord();
// Locally deleted
record.get('isDeleted'); // true
record.get('hasDirtyAttributes'); // true
record.get('isSaving'); // false
// Persisting the deletion
let promise = record.save();
record.get('isDeleted'); // true
record.get('isSaving'); // true
// Deletion Persisted
promise.then(function() {
record.get('isDeleted'); // true
record.get('isSaving'); // false
record.get('hasDirtyAttributes'); // false
});
```
@property isDeleted
@type {Boolean}
@readOnly
*/
isDeleted: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `new` state. A
record will be in the `new` state when it has been created on the
client and the adapter has not yet report that it was successfully
saved.
Example
```javascript
let record = store.createRecord('model');
record.get('isNew'); // true
record.save().then(function(model) {
model.get('isNew'); // false
});
```
@property isNew
@type {Boolean}
@readOnly
*/
isNew: retrieveFromCurrentState,
/**
If this property is `true` the record is in the `valid` state.
A record will be in the `valid` state when the adapter did not report any
server-side validation failures.
@property isValid
@type {Boolean}
@readOnly
*/
isValid: retrieveFromCurrentState,
/**
If the record is in the dirty state this property will report what
kind of change has caused it to move into the dirty
state. Possible values are:
- `created` The record has been created by the client and not yet saved to the adapter.
- `updated` The record has been updated by the client and not yet saved to the adapter.
- `deleted` The record has been deleted by the client and not yet saved to the adapter.
Example
```javascript
let record = store.createRecord('model');
record.get('dirtyType'); // 'created'
```
@property dirtyType
@type {String}
@readOnly
*/
dirtyType: retrieveFromCurrentState,
/**
If `true` the adapter reported that it was unable to save local
changes to the backend for any reason other than a server-side
validation error.
Example
```javascript
record.get('isError'); // false
record.set('foo', 'valid value');
record.save().then(null, function() {
record.get('isError'); // true
});
```
@property isError
@type {Boolean}
@readOnly
*/
isError: false,
/**
If `true` the store is attempting to reload the record from the adapter.
Example
```javascript
record.get('isReloading'); // false
record.reload();
record.get('isReloading'); // true
```
@property isReloading
@type {Boolean}
@readOnly
*/
isReloading: false,
/**
All ember models have an id property. This is an identifier
managed by an external source. These are always coerced to be
strings before being used internally. Note when declaring the
attributes for a model it is an error to declare an id
attribute.
```javascript
let record = store.createRecord('model');
record.get('id'); // null
store.findRecord('model', 1).then(function(model) {
model.get('id'); // '1'
});
```
@property id
@type {String}
*/
id: null,
/**
@property currentState
@private
@type {Object}
*/
currentState: RootState.empty,
/**
When the record is in the `invalid` state this object will contain
any errors returned by the adapter. When present the errors hash
contains keys corresponding to the invalid property names
and values which are arrays of Javascript objects with two keys:
- `message` A string containing the error message from the backend
- `attribute` The name of the property associated with this error message
```javascript
record.get('errors.length'); // 0
record.set('foo', 'invalid value');
record.save().catch(function() {
record.get('errors').get('foo');
// [{message: 'foo should be a number.', attribute: 'foo'}]
});
```
The `errors` property us useful for displaying error messages to
the user.
```handlebars
<label>Username: {{input value=username}} </label>
{{#each model.errors.username as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
<label>Email: {{input value=email}} </label>
{{#each model.errors.email as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
```
You can also access the special `messages` property on the error
object to get an array of all the error strings.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@property errors
@type {DS.Errors}
*/
errors: computed(function() {
let errors = Errors.create();
errors._registerHandlers(this._internalModel,
function() {
this.send('becameInvalid');
},
function() {
this.send('becameValid');
});
return errors;
}).readOnly(),
/**
This property holds the `DS.AdapterError` object with which
last adapter operation was rejected.
@property adapterError
@type {DS.AdapterError}
*/
adapterError: null,
/**
Create a JSON representation of the record, using the serialization
strategy of the store's adapter.
`serialize` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method serialize
@param {Object} options
@return {Object} an object whose values are primitive JSON values only
*/
serialize(options) {
return this._internalModel.createSnapshot().serialize(options);
},
/**
Use [DS.JSONSerializer](DS.JSONSerializer.html) to
get the JSON representation of a record.
`toJSON` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method toJSON
@param {Object} options
@return {Object} A JSON representation of the object.
*/
toJSON(options) {
// container is for lazy transform lookups
let serializer = this.store.serializerFor('-default');
let snapshot = this._internalModel.createSnapshot();
return serializer.serialize(snapshot, options);
},
/**
Fired when the record is ready to be interacted with,
that is either loaded from the server or created locally.
@event ready
*/
ready: null,
/**
Fired when the record is loaded from the server.
@event didLoad
*/
didLoad: null,
/**
Fired when the record is updated.
@event didUpdate
*/
didUpdate: null,
/**
Fired when a new record is commited to the server.
@event didCreate
*/
didCreate: null,
/**
Fired when the record is deleted.
@event didDelete
*/
didDelete: null,
/**
Fired when the record becomes invalid.
@event becameInvalid
*/
becameInvalid: null,
/**
Fired when the record enters the error state.
@event becameError
*/
becameError: null,
/**
Fired when the record is rolled back.
@event rolledBack
*/
rolledBack: null,
//TODO Do we want to deprecate these?
/**
@method send
@private
@param {String} name
@param {Object} context
*/
send(name, context) {
return this._internalModel.send(name, context);
},
/**
@method transitionTo
@private
@param {String} name
*/
transitionTo(name) {
return this._internalModel.transitionTo(name);
},
/**
Marks the record as deleted but does not save it. You must call
`save` afterwards if you want to persist it. You might use this
method if you want to allow the user to still `rollbackAttributes()`
after a delete was made.
Example
```app/routes/model/delete.js
import Route from '@ember/routing/route';
export default Route.extend({
actions: {
softDelete() {
this.get('controller.model').deleteRecord();
},
confirm() {
this.get('controller.model').save();
},
undo() {
this.get('controller.model').rollbackAttributes();
}
}
});
```
@method deleteRecord
*/
deleteRecord() {
this._internalModel.deleteRecord();
},
/**
Same as `deleteRecord`, but saves the record immediately.
Example
```app/routes/model/delete.js
import Route from '@ember/routing/route';
export default Route.extend({
actions: {
delete() {
this.get('controller.model').destroyRecord().then(function() {
controller.transitionToRoute('model.index');
});
}
}
});
```
If you pass an object on the `adapterOptions` property of the options
argument it will be passed to your adapter via the snapshot
```js
record.destroyRecord({ adapterOptions: { subscribe: false } });
```
```app/adapters/post.js
import MyCustomAdapter from './custom-adapter';
export default MyCustomAdapter.extend({
deleteRecord(store, type, snapshot) {
if (snapshot.adapterOptions.subscribe) {
// ...
}
// ...
}
});
```
@method destroyRecord
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
destroyRecord(options) {
this.deleteRecord();
return this.save(options);
},
/**
Unloads the record from the store. This will cause the record to be destroyed and freed up for garbage collection.
@method unloadRecord
*/
unloadRecord() {
if (this.isDestroyed) { return; }
this._internalModel.unloadRecord();
},
/**
@method _notifyProperties
@private
*/
_notifyProperties(keys) {
Ember.beginPropertyChanges();
let key;
for (let i = 0, length = keys.length; i < length; i++) {
key = keys[i];
this.notifyPropertyChange(key);
}
Ember.endPropertyChanges();
},
/**
Returns an object, whose keys are changed properties, and value is
an [oldProp, newProp] array.
The array represents the diff of the canonical state with the local state
of the model. Note: if the model is created locally, the canonical state is
empty since the adapter hasn't acknowledged the attributes yet:
Example
```app/models/mascot.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
isAdmin: DS.attr('boolean', {
defaultValue: false
})
});
```
```javascript
let mascot = store.createRecord('mascot');
mascot.changedAttributes(); // {}
mascot.set('name', 'Tomster');
mascot.changedAttributes(); // { name: [undefined, 'Tomster'] }
mascot.set('isAdmin', true);
mascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }
mascot.save().then(function() {
mascot.changedAttributes(); // {}
mascot.set('isAdmin', false);
mascot.changedAttributes(); // { isAdmin: [true, false] }
});
```
@method changedAttributes
@return {Object} an object, whose keys are changed properties,
and value is an [oldProp, newProp] array.
*/
changedAttributes() {
return this._internalModel.changedAttributes();
},
//TODO discuss with tomhuda about events/hooks
//Bring back as hooks?
/**
@method adapterWillCommit
@private
adapterWillCommit: function() {
this.send('willCommit');
},
/**
@method adapterDidDirty
@private
adapterDidDirty: function() {
this.send('becomeDirty');
this.updateRecordArraysLater();
},
*/
/**
If the model `hasDirtyAttributes` this function will discard any unsaved
changes. If the model `isNew` it will be removed from the store.
Example
```javascript
record.get('name'); // 'Untitled Document'
record.set('name', 'Doc 1');
record.get('name'); // 'Doc 1'
record.rollbackAttributes();
record.get('name'); // 'Untitled Document'
```
@since 1.13.0
@method rollbackAttributes
*/
rollbackAttributes() {
this._internalModel.rollbackAttributes();
},
/*
@method _createSnapshot
@private
*/
_createSnapshot() {
return this._internalModel.createSnapshot();
},
toStringExtension() {
return get(this, 'id');
},
/**
Save the record and persist any changes to the record to an
external source via the adapter.
Example
```javascript
record.set('name', 'Tomster');
record.save().then(function() {
// Success callback
}, function() {
// Error callback
});
```
If you pass an object using the `adapterOptions` property of the options
argument it will be passed to your adapter via the snapshot.
```js
record.save({ adapterOptions: { subscribe: false } });
```
```app/adapters/post.js
import MyCustomAdapter from './custom-adapter';
export default MyCustomAdapter.extend({
updateRecord(store, type, snapshot) {
if (snapshot.adapterOptions.subscribe) {
// ...
}
// ...
}
});
```
@method save
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
save(options) {
return PromiseObject.create({
promise: this._internalModel.save(options).then(() => this)
});
},
/**
Reload the record from the adapter.
This will only work if the record has already finished loading.
Example
```app/routes/model/view.js
import Route from '@ember/routing/route';
export default Route.extend({
actions: {
reload() {
this.controller.get('model').reload().then(function(model) {
// do something with the reloaded model
});
}
}
});
```
@method reload
@return {Promise} a promise that will be resolved with the record when the
adapter returns successfully or rejected if the adapter returns
with an error.
*/
reload() {
return PromiseObject.create({
promise: this._internalModel.reload().then(() => this)
});
},
/**
Override the default event firing from Ember.Evented to
also call methods with the given name.
@method trigger
@private
@param {String} name
*/
trigger(name) {
let fn = this[name];
if (typeof fn === 'function') {
let length = arguments.length;
let args = new Array(length - 1);
for (let i = 1; i < length; i++) {
args[i - 1] = arguments[i];
}
fn.apply(this, args)
}
this._super(...arguments);
},
attr() {
assert("The `attr` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
},
/**
Get the reference for the specified belongsTo relationship.
Example
```app/models/blog.js
export default DS.Model.extend({
user: DS.belongsTo({ async: true })
});
```
```javascript
let blog = store.push({
data: {
type: 'blog',
id: 1,
relationships: {
user: {
data: { type: 'user', id: 1 }
}
}
}
});
let userRef = blog.belongsTo('user');
// check if the user relationship is loaded
let isLoaded = userRef.value() !== null;
// get the record of the reference (null if not yet available)
let user = userRef.value();
// get the identifier of the reference
if (userRef.remoteType() === "id") {
let id = userRef.id();
} else if (userRef.remoteType() === "link") {
let link = userRef.link();
}
// load user (via store.findRecord or store.findBelongsTo)
userRef.load().then(...)
// or trigger a reload
userRef.reload().then(...)
// provide data for reference
userRef.push({
type: 'user',
id: 1,
attributes: {
username: "@user"
}
}).then(function(user) {
userRef.value() === user;
});
```
@method belongsTo
@param {String} name of the relationship
@since 2.5.0
@return {BelongsToReference} reference for this relationship
*/
belongsTo(name) {
return this._internalModel.referenceFor('belongsTo', name);
},
/**
Get the reference for the specified hasMany relationship.
Example
```javascript
// models/blog.js
export default DS.Model.extend({
comments: DS.hasMany({ async: true })
});
let blog = store.push({
data: {
type: 'blog',
id: 1,
relationships: {
comments: {
data: [
{ type: 'comment', id: 1 },
{ type: 'comment', id: 2 }
]
}
}
}
});
let commentsRef = blog.hasMany('comments');
// check if the comments are loaded already
let isLoaded = commentsRef.value() !== null;
// get the records of the reference (null if not yet available)
let comments = commentsRef.value();
// get the identifier of the reference
if (commentsRef.remoteType() === "ids") {
let ids = commentsRef.ids();
} else if (commentsRef.remoteType() === "link") {
let link = commentsRef.link();
}
// load comments (via store.findMany or store.findHasMany)
commentsRef.load().then(...)
// or trigger a reload
commentsRef.reload().then(...)
// provide data for reference
commentsRef.push([{ type: 'comment', id: 1 }, { type: 'comment', id: 2 }]).then(function(comments) {
commentsRef.value() === comments;
});
```
@method hasMany
@param {String} name of the relationship
@since 2.5.0
@return {HasManyReference} reference for this relationship
*/
hasMany(name) {
return this._internalModel.referenceFor('hasMany', name);
},
setId: observer('id', function () {
this._internalModel.setId(this.get('id'));
}),
/**
Provides info about the model for debugging purposes
by grouping the properties into more semantic groups.
Meant to be used by debugging tools such as the Chrome Ember Extension.
- Groups all attributes in "Attributes" group.
- Groups all belongsTo relationships in "Belongs To" group.
- Groups all hasMany relationships in "Has Many" group.
- Groups all flags in "Flags" group.
- Flags relationship CPs as expensive properties.
@method _debugInfo
@for DS.Model
@private
*/
_debugInfo() {
let attributes = ['id'];
let relationships = { };
let expensiveProperties = [];
this.eachAttribute((name, meta) => attributes.push(name));
let groups = [
{
name: 'Attributes',
properties: attributes,
expand: true
}
];
this.eachRelationship((name, relationship) => {
let properties = relationships[relationship.kind];
if (properties === undefined) {
properties = relationships[relationship.kind] = [];
groups.push({
name: relationship.name,
properties,
expand: true
});
}
properties.push(name);
expensiveProperties.push(name);
});
groups.push({
name: 'Flags',
properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
});
return {
propertyInfo: {
// include all other mixins / properties (not just the grouped ones)
includeOtherProperties: true,
groups: groups,
// don't pre-calculate unless cached
expensiveProperties: expensiveProperties
}
};
},
notifyBelongsToChanged(key) {
this.notifyPropertyChange(key);
},
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, descriptor);
```
- `name` the name of the current property in the iteration
- `descriptor` the meta object that describes this relationship
The relationship descriptor argument is an object with the following properties.
- **key** <span class="type">String</span> the name of this relationship on the Model
- **kind** <span class="type">String</span> "hasMany" or "belongsTo"
- **options** <span class="type">Object</span> the original options hash passed when the relationship was declared
- **parentType** <span class="type">DS.Model</span> the type of the Model that owns this relationship
- **type** <span class="type">String</span> the type name of the related Model
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(record, options) {
let json = {};
record.eachRelationship(function(name, descriptor) {
if (descriptor.kind === 'hasMany') {
let serializedHasManyName = name.toUpperCase() + '_IDS';
json[serializedHasManyName] = record.get(name).mapBy('id');
}
});
return json;
}
});
```
@method eachRelationship
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship(callback, binding) {
this.constructor.eachRelationship(callback, binding);
},
relationshipFor(name) {
return get(this.constructor, 'relationshipsByName').get(name);
},
inverseFor(key) {
return this.constructor.inverseFor(key, this.store);
},
notifyHasManyAdded(key) {
//We need to notifyPropertyChange in the adding case because we need to make sure
//we fetch the newly added record in case it is unloaded
//TODO(Igor): Consider whether we could do this only if the record state is unloaded
//Goes away once hasMany is double promisified
this.notifyPropertyChange(key);
},
eachAttribute(callback, binding) {
this.constructor.eachAttribute(callback, binding);
}
});
/**
@property data
@private
@type {Object}
*/
Object.defineProperty(Model.prototype, 'data', {
get() {
return this._internalModel._data;
}
});
if (DEBUG) {
Model.reopen({
init() {
this._super(...arguments);
if (!this._internalModel) {
throw new EmberError('You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.');
}
}
});
}
Model.reopenClass({
isModel: true,
/**
Override the class' `create()` method to raise an error. This
prevents end users from inadvertently calling `create()` instead
of `createRecord()`. The store is still able to create instances
by calling the `_create()` method. To create an instance of a
`DS.Model` use [store.createRecord](DS.Store.html#method_createRecord).
@method create
@private
@static
*/
/**
Represents the model's class name as a string. This can be used to look up the model's class name through
`DS.Store`'s modelFor method.
`modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string.
For example:
```javascript
store.modelFor('post').modelName; // 'post'
store.modelFor('blog-post').modelName; // 'blog-post'
```
The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
keys to underscore (instead of dasherized), you might use the following code:
```javascript
import { underscore } from '@ember/string';
export default const PostSerializer = DS.RESTSerializer.extend({
payloadKeyFromModelName(modelName) {
return underscore(modelName);
}
});
```
@property modelName
@type String
@readonly
@static
*/
modelName: null,
/*
These class methods below provide relationship
introspection abilities about relationships.
A note about the computed properties contained here:
**These properties are effectively sealed once called for the first time.**
To avoid repeatedly doing expensive iteration over a model's fields, these
values are computed once and then cached for the remainder of the runtime of
your application.
If your application needs to modify a class after its initial definition
(for example, using `reopen()` to add additional attributes), make sure you
do it before using your model with the store, which uses these properties
extensively.
*/
/**
For a given relationship name, returns the model type of the relationship.
For example, if you define a model like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.
@method typeForRelationship
@static
@param {String} name the name of the relationship
@param {store} store an instance of DS.Store
@return {DS.Model} the type of the relationship, or undefined
*/
typeForRelationship(name, store) {
let relationship = get(this, 'relationshipsByName').get(name);
return relationship && store.modelFor(relationship.type);
},
inverseMap: computed(function() {
return Object.create(null);
}),
/**
Find the relationship which is the inverse of the one asked for.
For example, if you define models like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('message')
});
```
```app/models/message.js
import DS from 'ember-data';
export default DS.Model.extend({
owner: DS.belongsTo('post')
});
```
``` js
store.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }
store.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }
```
@method inverseFor
@static
@param {String} name the name of the relationship
@param {DS.Store} store
@return {Object} the inverse relationship, or null
*/
inverseFor(name, store) {
let inverseMap = get(this, 'inverseMap');
if (inverseMap[name] !== undefined) {
return inverseMap[name];
} else {
let relationship = get(this, 'relationshipsByName').get(name);
if (!relationship) {
inverseMap[name] = null;
return null;
}
let options = relationship.options;
if (options && options.inverse === null) {
// populate the cache with a miss entry so we can skip getting and going
// through `relationshipsByName`
inverseMap[name] = null;
return null;
}
return inverseMap[name] = this._findInverseFor(name, store);
}
},
//Calculate the inverse, ignoring the cache
_findInverseFor(name, store) {
let inverseType = this.typeForRelationship(name, store);
if (!inverseType) {
return null;
}
let propertyMeta = this.metaForProperty(name);
//If inverse is manually specified to be null, like `comments: DS.hasMany('message', { inverse: null })`
let options = propertyMeta.options;
if (options.inverse === null) { return null; }
let inverseName, inverseKind, inverse;
//If inverse is specified manually, return the inverse
if (options.inverse) {
inverseName = options.inverse;
inverse = get(inverseType, 'relationshipsByName').get(inverseName);
assert("We found no inverse relationships by the name of '" + inverseName + "' on the '" + inverseType.modelName +
"' model. This is most likely due to a missing attribute on your model definition.", !isNone(inverse));
inverseKind = inverse.kind;
} else {
//No inverse was specified manually, we need to use a heuristic to guess one
if (propertyMeta.parentType && propertyMeta.type === propertyMeta.parentType.modelName) {
warn(`Detected a reflexive relationship by the name of '${name}' without an inverse option. Look at https://guides.emberjs.com/current/models/relationships/#toc_reflexive-relations for how to explicitly specify inverses.`, false, {
id: 'ds.model.reflexive-relationship-without-inverse'
});
}
let possibleRelationships = findPossibleInverses(this, inverseType, name);
if (possibleRelationships.length === 0) { return null; }
let filteredRelationships = possibleRelationships.filter((possibleRelationship) => {
let optionsForRelationship = inverseType.metaForProperty(possibleRelationship.name).options;
return name === optionsForRelationship.inverse;
});
assert("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " +
inverseType.toString() + " multiple times. Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses",
filteredRelationships.length < 2);
if (filteredRelationships.length === 1 ) {
possibleRelationships = filteredRelationships;
}
assert("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " +
this + " were found on " + inverseType + ". Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses",
possibleRelationships.length === 1);
inverseName = possibleRelationships[0].name;
inverseKind = possibleRelationships[0].kind;
}
return {
type: inverseType,
name: inverseName,
kind: inverseKind
};
},
/**
The model's relationships as a map, keyed on the type of the
relationship. The value of each entry is an array containing a descriptor
for each relationship with that type, describing the name of the relationship
as well as the type.
For example, given the following model definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This computed property would return a map describing these
relationships, like this:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
import User from 'app/models/user';
import Post from 'app/models/post';
let relationships = Ember.get(Blog, 'relationships');
relationships.get(User);
//=> [ { name: 'users', kind: 'hasMany' },
// { name: 'owner', kind: 'belongsTo' } ]
relationships.get(Post);
//=> [ { name: 'posts', kind: 'hasMany' } ]
```
@property relationships
@static
@type Ember.Map
@readOnly
*/
relationships: relationshipsDescriptor,
/**
A hash containing lists of the model's relationships, grouped
by the relationship kind. For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
let relationshipNames = Ember.get(Blog, 'relationshipNames');
relationshipNames.hasMany;
//=> ['users', 'posts']
relationshipNames.belongsTo;
//=> ['owner']
```
@property relationshipNames
@static
@type Object
@readOnly
*/
relationshipNames: computed(function() {
let names = {
hasMany: [],
belongsTo: []
};
this.eachComputedProperty((name, meta) => {
if (meta.isRelationship) {
names[meta.kind].push(name);
}
});
return names;
}),
/**
An array of types directly related to a model. Each type will be
included once, regardless of the number of relationships it has with
the model.
For example, given a model with this definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
let relatedTypes = Ember.get(Blog, 'relatedTypes');
//=> [ User, Post ]
```
@property relatedTypes
@static
@type Ember.Array
@readOnly
*/
relatedTypes: relatedTypesDescriptor,
/**
A map whose keys are the relationships of a model and whose values are
relationship descriptors.
For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
let relationshipsByName = Ember.get(Blog, 'relationshipsByName');
relationshipsByName.get('users');
//=> { key: 'users', kind: 'hasMany', type: 'user', options: Object, isRelationship: true }
relationshipsByName.get('owner');
//=> { key: 'owner', kind: 'belongsTo', type: 'user', options: Object, isRelationship: true }
```
@property relationshipsByName
@static
@type Ember.Map
@readOnly
*/
relationshipsByName: relationshipsByNameDescriptor,
/**
A map whose keys are the fields of the model and whose values are strings
describing the kind of the field. A model's fields are the union of all of its
attributes and relationships.
For example:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post'),
title: DS.attr('string')
});
```
```js
import Ember from 'ember';
import Blog from 'app/models/blog';
let fields = Ember.get(Blog, 'fields');
fields.forEach(function(kind, field) {
console.log(field, kind);
});
// prints:
// users, hasMany
// owner, belongsTo
// posts, hasMany
// title, attribute
```
@property fields
@static
@type Ember.Map
@readOnly
*/
fields: computed(function() {
let map = Map.create();
this.eachComputedProperty((name, meta) => {
if (meta.isRelationship) {
map.set(name, meta.kind);
} else if (meta.isAttribute) {
map.set(name, 'attribute');
}
});
return map;
}).readOnly(),
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
@method eachRelationship
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship(callback, binding) {
get(this, 'relationshipsByName').forEach((relationship, name) => {
callback.call(binding, name, relationship);
});
},
/**
Given a callback, iterates over each of the types related to a model,
invoking the callback with the related type's class. Each type will be
returned just once, regardless of how many different relationships it has
with a model.
@method eachRelatedType
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelatedType(callback, binding) {
let relationshipTypes = get(this, 'relatedTypes');
for (let i = 0; i < relationshipTypes.length; i++) {
let type = relationshipTypes[i];
callback.call(binding, type);
}
},
determineRelationshipType(knownSide, store) {
let knownKey = knownSide.key;
let knownKind = knownSide.kind;
let inverse = this.inverseFor(knownKey, store);
// let key;
let otherKind;
if (!inverse) {
return knownKind === 'belongsTo' ? 'oneToNone' : 'manyToNone';
}
// key = inverse.name;
otherKind = inverse.kind;
if (otherKind === 'belongsTo') {
return knownKind === 'belongsTo' ? 'oneToOne' : 'manyToOne';
} else {
return knownKind === 'belongsTo' ? 'oneToMany' : 'manyToMany';
}
},
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are the meta object for the
property.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
birthday: DS.attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
let attributes = Ember.get(Person, 'attributes')
attributes.forEach(function(meta, name) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@property attributes
@static
@type {Ember.Map}
@readOnly
*/
attributes: computed(function() {
let map = Map.create();
this.eachComputedProperty((name, meta) => {
if (meta.isAttribute) {
assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.toString(), name !== 'id');
meta.name = name;
map.set(name, meta);
}
});
return map;
}).readOnly(),
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are type of transformation
applied to each attribute. This map does not include any
attributes that do not have an transformation type.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr(),
lastName: DS.attr('string'),
birthday: DS.attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
let transformedAttributes = Ember.get(Person, 'transformedAttributes')
transformedAttributes.forEach(function(field, type) {
console.log(field, type);
});
// prints:
// lastName string
// birthday date
```
@property transformedAttributes
@static
@type {Ember.Map}
@readOnly
*/
transformedAttributes: computed(function() {
let map = Map.create();
this.eachAttribute((key, meta) => {
if (meta.type) {
map.set(key, meta.type);
}
});
return map;
}).readOnly(),
/**
Iterates through the attributes of the model, calling the passed function on each
attribute.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, meta);
```
- `name` the name of the current property in the iteration
- `meta` the meta object for the attribute property in the iteration
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
let Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
birthday: DS.attr('date')
});
Person.eachAttribute(function(name, meta) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@method eachAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachAttribute(callback, binding) {
get(this, 'attributes').forEach((meta, name) => {
callback.call(binding, name, meta);
});
},
/**
Iterates through the transformedAttributes of the model, calling
the passed function on each attribute. Note the callback will not be
called for any attributes that do not have an transformation type.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, type);
```
- `name` the name of the current property in the iteration
- `type` a string containing the name of the type of transformed
applied to the attribute
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
let Person = DS.Model.extend({
firstName: DS.attr(),
lastName: DS.attr('string'),
birthday: DS.attr('date')
});
Person.eachTransformedAttribute(function(name, type) {
console.log(name, type);
});
// prints:
// lastName string
// birthday date
```
@method eachTransformedAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachTransformedAttribute(callback, binding) {
get(this, 'transformedAttributes').forEach((type, name) => {
callback.call(binding, name, type);
});
}
});
// if `Ember.setOwner` is defined, accessing `this.container` is
// deprecated (but functional). In "standard" Ember usage, this
// deprecation is actually created via an `.extend` of the factory
// inside the container itself, but that only happens on models
// with MODEL_FACTORY_INJECTIONS enabled :(
if (setOwner) {
Object.defineProperty(Model.prototype, 'container', {
configurable: true,
enumerable: false,
get() {
deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.',
false,
{ id: 'ember-application.injected-container', until: '3.0.0' });
return this.store.container;
}
});
}
if (isEnabled('ds-rollback-attribute')) {
Model.reopen({
/**
Discards any unsaved changes to the given attribute. This feature is not enabled by default. You must enable `ds-rollback-attribute` and be running a canary build.
Example
```javascript
record.get('name'); // 'Untitled Document'
record.set('name', 'Doc 1');
record.get('name'); // 'Doc 1'
record.rollbackAttribute('name');
record.get('name'); // 'Untitled Document'
```
@method rollbackAttribute
*/
rollbackAttribute(attributeName) {
if (attributeName in this._internalModel._attributes) {
this.set(attributeName, this._internalModel.lastAcknowledgedValue(attributeName));
}
}
});
}
if (DEBUG) {
Model.reopen({
// This is a temporary solution until we refactor DS.Model to not
// rely on the data property.
willMergeMixin(props) {
let constructor = this.constructor;
assert('`' + intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0] + '` is a reserved property name on DS.Model objects. Please choose a different property name for ' + constructor.toString(), !intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0]);
assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + constructor.toString(), Object.keys(props).indexOf('id') === -1);
},
/**
This Ember.js hook allows an object to be notified when a property
is defined.
In this case, we use it to be notified when an Ember Data user defines a
belongs-to relationship. In that case, we need to set up observers for
each one, allowing us to track relationship changes and automatically
reflect changes in the inverse has-many array.
This hook passes the class being set up, as well as the key and value
being defined. So, for example, when the user does this:
```javascript
DS.Model.extend({
parent: DS.belongsTo('user')
});
```
This hook would be called with "parent" as the key and the computed
property returned by `DS.belongsTo` as the value.
@method didDefineProperty
@param {Object} proto
@param {String} key
@param {Ember.ComputedProperty} value
*/
didDefineProperty(proto, key, value) {
// Check if the value being set is a computed property.
if (value instanceof ComputedProperty) {
// If it is, get the metadata for the relationship. This is
// populated by the `DS.belongsTo` helper when it is creating
// the computed property.
let meta = value.meta();
/*
This is buggy because if the parent has never been looked up
via `modelFor` it will not have `modelName` set.
*/
meta.parentType = proto.constructor;
}
}
});
}
export default Model;


All Packages Class Hierarchy This Package Previous Next Index
Class BIT.highBIT.Instruction
java.lang.Object
|
+----BIT.highBIT.Instruction
- public class Instruction
- extends Object
- implements Cloneable
Represents a valid Java Virtual Machine instrucion.
- See Also:
- Routine
-
index
- Index of this instruction in InstructionArray
-
modified
- Is this an instruction in the modified array?
-
modified_index
- Index of this instruction in modified instructions array
-
offset
- This variable indicates the offset of this instruction from the
start of code buffer.
-
opcode
-
Represents the opcode of the instruction.
-
routine
- Pointer to the routine that this instruction is in.
-
Instruction(int, int, Routine)
- Constructor for Instruction class.
-
Instruction(int, Routine)
-
-
addAfter(String, String, Object)
-
-
addBefore(String, String, Object)
-
-
clone()
-
-
getDoubleOperandValue()
-
-
getInstructionType()
- Returns the type of this instruction.
-
getLength()
- Returns the length of this instruction.
-
getModifiedIndex()
- Gets the modified index of this instruction.
-
getOffset()
- Returns the offset of this instruction from the start of code buffer.
-
getOpcode()
- Returns the opcode of this instruction.
-
getOperandValue()
- Returns the value of the operands.
-
setIndex(int)
- Sets the index of this instruction.
-
setModified()
-
-
setModifiedIndex(int)
- Sets the modified index of this instruction.
-
setOffset(int)
- Set the offset of the instruction.
-
write(DataOutputStream)
-
opcode
protected int opcode
- Represents the opcode of the instruction.
This value can be read by invoking getOpcode() method.
- See Also:
- getOpcode
offset
protected int offset
- This variable indicates the offset of this instruction from the
start of code buffer.
routine
protected Routine routine
- Pointer to the routine that this instruction is in.
index
protected int index
- Index of this instruction in InstructionArray
modified_index
protected int modified_index
- Index of this instruction in modified instructions array
modified
protected boolean modified
- Is this an instruction in the modified array?
Instruction
public Instruction(int opcode,
int offset,
Routine routine)
- Constructor for Instruction class.
- Parameters:
- opcode - the opcode of this instruction
- offset - the offset of this instruction in bytes from start of code buffer
Instruction
public Instruction(int opcode,
Routine routine)
setIndex
public void setIndex(int index)
- Sets the index of this instruction.
setModifiedIndex
public void setModifiedIndex(int modified_index)
- Sets the modified index of this instruction.
A modified index is the index of this instruction that corresponds
to the modified instructions array.
getModifiedIndex
public int getModifiedIndex()
- Gets the modified index of this instruction.
A modified index is the index of this instruction that corresponds
to the modified instructions array.
getOpcode
public int getOpcode()
- Returns the opcode of this instruction.
getDoubleOperandValue
public int getDoubleOperandValue()
write
public void write(DataOutputStream oStream)
getInstructionType
public short getInstructionType()
- Returns the type of this instruction.
getOffset
public int getOffset()
- Returns the offset of this instruction from the start of code buffer.
getLength
public int getLength()
- Returns the length of this instruction.
getOperandValue
public int getOperandValue()
- Returns the value of the operands.
setOffset
public void setOffset(int offset)
- Set the offset of the instruction.
setModified
public void setModified()
clone
protected Object clone() throws CloneNotSupportedException
- Overrides:
- clone in class Object
addBefore
public int addBefore(String classname,
String methodname,
Object arg)
addAfter
public int addAfter(String classname,
String methodname,
Object arg)
All Packages Class Hierarchy This Package Previous Next Index


Input a text passage to get a total word count:
Optionally enter a word to count the number of times it occurs in the passage:
Total Word Count:
Selected Word Count:


Pat's cookie-stand
OUR LOCATIONS
Seattle
Tokyo
Dubai
Paris
Lima
for contact please call: 00-0000-0000
amountOfSales


--- layout: post title: Former SAP Exec to Lead Causata Growth as New CEO date: '2012-03-07T12:13:42-08:00' tags: tumblr_url: http://alexhwilliams.tumblr.com/post/18912416604/former-sap-exec-to-lead-causata-growth-as-new-ceo ---
http://bit.ly/AnzvJA


This is one of the favored lists to follow for opp
Cerdit will go to Gigguk for the video's because they were posted under his youtube channel
Has a track recond for kills and is known for her extreme personality
She was the one with the longest survival time in the anime


--- layout: page title: "Claims reserving" subtitle: A website related to claims reserving in general insurance. Under development at present (September 2017) css: "/css/index.css" meta-title: "David Hindley" meta-description: "Non-Exec Director, Actuary, Runner, West Ham supporter" bigimg: - "/img/big-imgs/deepwater-horizon.jpg" : "Deepwater Horizon, Gulf of Mexico, U.S (20 April 2010)" - "/img/big-imgs/katrina5.jpg" : "Hurricane Katrina, Louisiana, U.S (28 August 2005)" - "/img/big-imgs/piper-alpha3.jpg" : "Piper Alpha, North Sea, U.K (6 July 1988)" - "/img/big-imgs/yorkfloods15.jpg" : "Flooding, York, U.K (28 December 2015)" - "/img/big-imgs/JapanQuake2011.jpg" : "Tohoka Earthquake and Tsunami, Japan (11 March 2011)" - "/img/big-imgs/Costaconc.jpg" : "Costa Concordia, off Isola del Giglio, Italy (13 January 2012)" - "/img/big-imgs/asbestos.jpg" : "Asbestos claims (Various locations and dates)" - "/img/big-imgs/ExxonV.jpg" : "Exxon Valdez oil spill, Prince William Sound, Alaska, U.S (March 24,1989)" - "/img/big-imgs/MH17.jpg" : "MH17, Eastern Ukraine (17 July, 2014)" ---


Welcome to Scabbard’s documentation!¶
About¶
Scabbard is a Pythonic client for the Sabre Dev Studio REST APIs. With Scabbard, it is not necessary to create extensive low-level boilerplate code before you can use each API call. You can begin to interact with the Sabre Dev Studio APIs with as few as 3 lines of code.
A scabbard is a sheath for holding a sword, such as a sabre - https://en.wikipedia.org/wiki/Scabbard
Features¶
- Defined Scabbard REST endpoints can be reviewed in the SwaggerUI:
- https://bundgus.github.io/scabbard/SwaggerUI/index.html
Documentation¶
- Sabre Dev Studio API Documentation:
- https://developer.sabre.com/docs/read/Home
- Sabre Dev Studio REST API documentation:
- Scabbard docs:
- https://bundgus.github.io/scabbard/html/
- Scabbard SwaggerUI:
- https://bundgus.github.io/scabbard/SwaggerUI/index.html
- Scabbard GitHub Home:
- https://github.com/bundgus/scabbard
- Scabbard PyPi Home:
- https://pypi.python.org/pypi/scabbard
Getting Started¶
(1) You can register for a free Sabre Dev Studio account at the following URL:
https://developer.sabre.com/apps/mykeys
(2) Install the scabbard library with pip.
$ pip install scabbard
(3) A file called api_connect_parameters.json must exist in the directory in which python is run, with your Sabre Dev Studio clientID and clientSecret credentials.
api_connect_parameters.json
{
"clientId": "zzzzzzzzzzzzzzzz",
"clientSecret": "xxxxxxxx",
"environment": "https://api.test.sabre.com",
"group": "DEVCENTER",
"domain": "EXT",
"formatVersion": "V1"
}
(4) Run code to exercise the API. For example:
example_V1ListsSupportedCountriesGet.py
import scabbard
client = scabbard.get_client()
countries = client.Air_Utility.V1ListsSupportedCountriesGet(pointofsalecountry='NZ').result()
print('PointOfSale')
print(countries.PointOfSale)
print('OriginCountries')
for c in countries.OriginCountries:
print(c.CountryCode, c.CountryName)
print('DestinationCountries')
for c in countries.DestinationCountries:
print(c.CountryCode, c.CountryName)
print('Links')
for l in countries.Links:
print(l.rel)
print(l.href)
(5) Run your python example.
$ python example_V1ListsSupportedCountriesGet.py
PointOfSale
NZ
OriginCountries
AU Australia
ID Indonesia
IE Ireland
NZ New Zealand
TH Thailand
GB United Kingdom
DestinationCountries
AU Australia
FR France
DE Germany
HK Hong Kong
IN India
ID Indonesia
IE Ireland
MY Malaysia
NL Netherlands
NZ New Zealand
PH Philippines
SG Singapore
TH Thailand
GB United Kingdom
US United States
Links
self
https://api.test.sabre.com/v1/lists/supported/countries?pointofsalecountry=NZ
linkTemplate
https://api.test.sabre.com/v1/lists/supported/countries?pointofsalecountry=<pointofsalecountry>
Installation¶
$ pip install scabbard
License¶
Copyright (c) 2018, Mark Bundgus. All rights reserved.
- not a Sabre provided or supported software library
- all referenced Sabre content and services are the property of Sabre
Scabbard is licensed with a BSD 3-Clause License.


Wiki EOD Stock Prices (Code: WIKI)
End of day stock prices, dividends and splits for 3,000 US companies, curated by the Quandl community and released into the public domain.


Pranoy Admits to Being a Narcissist
Written by David Li and Ben Wang at 10:30 Tuesday, April 11th
This past Friday, after a long time of prodding and poking, Pranoy Dutta has finally admitted to being a narcissist! It started off as a normal lunch, with Pranoy spouting out phrases about his perfectly chiseled face and how he was so smart. After a while, however, he finally announced, "I'm so handsome, it's no surprise that I'm narcissistic. If you had my face you would too!" Gaping, the people near him quickly took out their phones and asked him to repeat himself. Within seconds, the aspiring Indian programmer was across the internet, saying how he was a narcissist. Many people are not surprised, however, and only shrugged saying that it was about time he finally admitted it.


Table of Contents from the print editionWAR CRIMES
A Report on United States War Crimes Against Iraq to the Commission of Inquiry for the International War Crimes Tribunalby Ramsey Clark and Others
Not including the WWW Index or IntroductionContents
- Preface and Acknowledgements
- The Tribunal's Final Judgment, February 29, 1992
- Part One: The Charges
- Part Two: The Basis in International Law
- Why an Inquiry / Sara Flounders
- The Legal and Moral Basis for an International War Crimes Tribunal / Ramsey Clark
- International Law and War Crimes / Michael Ratner
- War Crimes Committed Against the People of Iraq / Francis Kelly
- Part Three: Testimony and Evidence
- Provoking Iraq / Gautam Biswas and Tony Murphy
- U.S. Conspiracy to Initiate the War Against Iraq / Brian Becker
- The Myth of Surgical Bombing in the Gulf War / Paul Walker
- The Massacre of Withdrawing Soldiers on "The Highway of Death" / Joyce Chediac
- The Effects of the War on Health Care in Iraq / David Levinson
- The Impact of Sanctions on Baghdad's Children's Hospital / Ann Montgomery
- The Impact of the War on Iraqi Society / Adeeb Abed and Gavrielle Gemma
- Eyewitness Interviews
- Crimes Against Egyptian and Palestinian Civilians in Iraq / Mustafa El Bakri
- Waging War on Civilization / Fadwa El Guindi
- The Attack on the Women's Peace Ship / E. Faye Williams
- The Truth Behind Economic Sanctions: Report on the Embargo of Food and Medicines / Eric Hoskins
- Part Four: The New World Order
- The New World Order: What It Is and How to Fight It / Monica Moorehead
- The Demonization of Saddam Hussein: A Violation of the UN Convention Against Racism / Esmeralda Brown
- The Impact of the Gulf War on Women and Children / Nawal El Saadawi
- The Continuing War and the Kurds / Ali Azad
- Government Attacks and Violence Against Arab People / Neal Saad
- The Gulf War: A Crime Against the Peoples of Africa and Asia / Karen Talbot
- Yemen: A Victim of the Bribery and Corruption of the UN / Abdel Hameed Noaman
- Expulsion of Guest Workers and the Impact on Africa / M. A. Samad-Matias
- Palestine and the Gulf War / Houda Gazalwin
- The Harsh Government Prosecution of Military Resisters / William Kunstler
- The Old World Order and the Causes of the Gulf War / Tony Benn
- Appendix A: International Law
- Appendix B: Background Documents for the Tribunal
- The Announcement of the Formation of a Commission of Inquiry
- A Letter to Javier Perez de Cuellar / Ramsey Clark
- A Letter to Claiborne Pell / Ramsey Clark
- Selections from The Report to the Secretary General on Humanitarian Needs in Kuwait and Iraq / Martti Ahtisaari
- H.Res. 86: A Motion to Impeach George Bush / Henry Gonzalez
- H.Res. 180: A Resolution to Lift the Economic Embargo on Iraq / Henry Gonzalez
- The April Glaspie Connection
- Appendix C: International Tribunals
- Report from Belgium
- Report from Turkey
- Report from East Asia
- Index
Index
WWW URL: http://deoxy.org/wc-toc.htm
Copyright © 1992 by The Commission of Inquiry for the International War Crimes Tribunal


adam_reg()
is a way to generate a specification of an ADAM model
before fitting and allows the model to be created using
different packages. Currently the only package is smooth
.
adam_reg( mode = "regression", ets_model = NULL, non_seasonal_ar = NULL, non_seasonal_differences = NULL, non_seasonal_ma = NULL, seasonal_ar = NULL, seasonal_differences = NULL, seasonal_ma = NULL, use_constant = NULL, regressors_treatment = NULL, outliers_treatment = NULL, outliers_ci = NULL, probability_model = NULL, distribution = NULL, loss = NULL, information_criteria = NULL, seasonal_period = NULL, select_order = NULL )
| mode | A single character string for the type of model. The only possible value for this model is "regression". |
|---|---|
| ets_model | The type of ETS model. The first letter stands for the type of the error term ("A" or "M"), the second (and sometimes the third as well) is for the trend ("N", "A", "Ad", "M" or "Md"), and the last one is for the type of seasonality ("N", "A" or "M"). |
| non_seasonal_ar | The order of the non-seasonal auto-regressive (AR) terms. Often denoted "p" in pdq-notation. |
| non_seasonal_differences | The order of integration for non-seasonal differencing. Often denoted "d" in pdq-notation. |
| non_seasonal_ma | The order of the non-seasonal moving average (MA) terms. Often denoted "q" in pdq-notation. |
| seasonal_ar | The order of the seasonal auto-regressive (SAR) terms. Often denoted "P" in PDQ-notation. |
| seasonal_differences | The order of integration for seasonal differencing. Often denoted "D" in PDQ-notation. |
| seasonal_ma | The order of the seasonal moving average (SMA) terms. Often denoted "Q" in PDQ-notation. |
| use_constant | Logical, determining, whether the constant is needed in the model or not. This is mainly needed for ARIMA part of the model, but can be used for ETS as well. |
| regressors_treatment | The variable defines what to do with the provided explanatory variables: "use" means that all of the data should be used, while "select" means that a selection using ic should be done, "adapt" will trigger the mechanism of time varying parameters for the explanatory variables. |
| outliers_treatment | Defines what to do with outliers: "ignore", so just returning the model, "detect" outliers based on specified level and include dummies for them in the model, or detect and "select" those of them that reduce ic value. |
| outliers_ci | What confidence level to use for detection of outliers. Default is 99%. |
| probability_model | The type of model used in probability estimation. Can be "none" - none, "fixed" - constant probability, "general" - the general Beta model with two parameters, "odds-ratio" - the Odds-ratio model with b=1 in Beta distribution, "inverse-odds-ratio" - the model with a=1 in Beta distribution, "direct" - the TSB-like (Teunter et al., 2011) probability update mechanism a+b=1, "auto" - the automatically selected type of occurrence model. |
| distribution | what density function to assume for the error term. The full name of the distribution should be provided, starting with the letter "d" - "density". |
| loss | The type of Loss Function used in optimization. |
| information_criteria | The information criterion to use in the model selection / combination procedure. |
| seasonal_period | A seasonal frequency. Uses "auto" by default. A character phrase of "auto" or time-based phrase of "2 weeks" can be used if a date or date-time variable is provided. See Fit Details below. |
| select_order | If TRUE, then the function will select the most appropriate order. The values list(ar=...,i=...,ma=...) specify the maximum orders to check in this case. |
The data given to the function are not saved and are only used
to determine the mode of the model. For adam_reg()
, the
mode will always be "regression".
The model can be created using the fit()
function using the
following engines:
"auto_adam" (default) - Connects to smooth::auto.adam()
"adam" - Connects to smooth::adam()
Main Arguments
The main arguments (tuning parameters) for the model are:
seasonal_period
: The periodic nature of the seasonality. Uses "auto" by default.
non_seasonal_ar
: The order of the non-seasonal auto-regressive (AR) terms.
non_seasonal_differences
: The order of integration for non-seasonal differencing.
non_seasonal_ma
: The order of the non-seasonal moving average (MA) terms.
seasonal_ar
: The order of the seasonal auto-regressive (SAR) terms.
seasonal_differences
: The order of integration for seasonal differencing.
seasonal_ma
: The order of the seasonal moving average (SMA) terms.
ets_model
: The type of ETS model.
use_constant
: Logical, determining, whether the constant is needed in the model or not.
regressors_treatment
: The variable defines what to do with the provided explanatory variables.
outliers_treatment
: Defines what to do with outliers.
probability_model
: The type of model used in probability estimation.
distribution
: what density function to assume for the error term.
loss
: The type of Loss Function used in optimization.
information_criteria
: The information criterion to use in the model selection / combination procedure.
These arguments are converted to their specific names at the time that the model is fit.
Other options and argument can be
set using set_engine()
(See Engine Details below).
If parameters need to be modified, update()
can be used
in lieu of recreating the object from scratch.
auto_adam (default engine)
The engine uses smooth::auto.adam()
.
Function Parameters:
## Registered S3 method overwritten by 'greybox': ## method from ## print.pcor lava
## function (data, model = "ZXZ", lags = c(frequency(data)), orders = list(ar = c(0), ## i = c(0), ma = c(0), select = FALSE), formula = NULL, outliers = c("ignore", ## "use", "select"), level = 0.99, distribution = c("dnorm", "dlaplace", ## "ds", "dgnorm", "dlnorm", "dinvgauss", "dgamma"), h = 0, holdout = FALSE, ## persistence = NULL, phi = NULL, initial = c("optimal", "backcasting"), ## arma = NULL, occurrence = c("none", "auto", "fixed", "general", "odds-ratio", ## "inverse-odds-ratio", "direct"), ic = c("AICc", "AIC", "BIC", "BICc"), ## bounds = c("usual", "admissible", "none"), regressors = c("use", "select", ## "adapt"), silent = TRUE, parallel = FALSE, ...)
The MAXIMUM nonseasonal ARIMA terms (max.p
, max.d
, max.q
) and
seasonal ARIMA terms (max.P
, max.D
, max.Q
) are provided to
forecast::auto.arima()
via arima_reg()
parameters.
Other options and argument can be set using set_engine()
.
Parameter Notes:
All values of nonseasonal pdq and seasonal PDQ are maximums.
The smooth::auto.adam()
model will select a value using these as an upper limit.
xreg
- This is supplied via the parsnip / modeltime fit()
interface
(so don't provide this manually). See Fit Details (below).
adam
The engine uses smooth::adam()
.
Function Parameters:
## function (data, model = "ZXZ", lags = c(frequency(data)), orders = list(ar = c(0), ## i = c(0), ma = c(0), select = FALSE), constant = FALSE, formula = NULL, ## regressors = c("use", "select", "adapt"), outliers = c("ignore", "use", ## "select"), level = 0.99, occurrence = c("none", "auto", "fixed", ## "general", "odds-ratio", "inverse-odds-ratio", "direct"), distribution = c("default", ## "dnorm", "dlaplace", "ds", "dgnorm", "dlnorm", "dinvgauss", "dgamma"), ## loss = c("likelihood", "MSE", "MAE", "HAM", "LASSO", "RIDGE", "MSEh", ## "TMSE", "GTMSE", "MSCE"), h = 0, holdout = FALSE, persistence = NULL, ## phi = NULL, initial = c("optimal", "backcasting"), arma = NULL, ic = c("AICc", ## "AIC", "BIC", "BICc"), bounds = c("usual", "admissible", "none"), ## silent = TRUE, ...)
The nonseasonal ARIMA terms (orders
) and seasonal ARIMA terms (orders
)
are provided to smooth::adam()
via adam_reg()
parameters.
Other options and argument can be set using set_engine()
.
Parameter Notes:
xreg
- This is supplied via the parsnip / modeltime fit()
interface
(so don't provide this manually). See Fit Details (below).
Date and Date-Time Variable
It's a requirement to have a date or date-time variable as a predictor.
The fit()
interface accepts date and date-time features and handles them internally.
Seasonal Period Specification
The period can be non-seasonal (seasonal_period = 1 or "none"
) or
yearly seasonal (e.g. For monthly time stamps, seasonal_period = 12
, seasonal_period = "12 months"
, or seasonal_period = "yearly"
).
There are 3 ways to specify:
seasonal_period = "auto"
: A seasonal period is selected based on the periodicity of the data (e.g. 12 if monthly)
seasonal_period = 12
: A numeric frequency. For example, 12 is common for monthly data
seasonal_period = "1 year"
: A time-based phrase. For example, "1 year" would convert to 12 for monthly data.
Univariate (No xregs, Exogenous Regressors):
For univariate analysis, you must include a date or date-time feature. Simply use:
Formula Interface (recommended): fit(y ~ date)
will ignore xreg's.
Multivariate (xregs, Exogenous Regressors)
The xreg
parameter is populated using the fit()
function:
Only factor
, ordered factor
, and numeric
data will be used as xregs.
Date and Date-time variables are not used as xregs
character
data should be converted to factor.
Xreg Example: Suppose you have 3 features:
y
(target)
date
(time stamp),
month.lbl
(labeled month as a ordered factor).
The month.lbl
is an exogenous regressor that can be passed to the arima_reg()
using
fit()
:
fit(y ~ date + month.lbl)
will pass month.lbl
on as an exogenous regressor.
Note that date or date-time class values are excluded from xreg
.
#> #>#>#> #>#>#> #>#>#> #>#>#>#> #>#>#>#> # A tibble: 306 × 3 #> id date value #> <fct> <date> <dbl> #> 1 M750 1990-01-01 6370 #> 2 M750 1990-02-01 6430 #> 3 M750 1990-03-01 6520 #> 4 M750 1990-04-01 6580 #> 5 M750 1990-05-01 6620 #> 6 M750 1990-06-01 6690 #> 7 M750 1990-07-01 6000 #> 8 M750 1990-08-01 5450 #> 9 M750 1990-09-01 6480 #> 10 M750 1990-10-01 6820 #> # … with 296 more rows# Split Data 80/20 splits <- initial_time_split(m750, prop = 0.8) # ---- AUTO ADAM ---- # Model Spec model_spec <- adam_reg() %>% set_engine("auto_adam") # Fit Spec model_fit <- model_spec %>% fit(log(value) ~ date, data = training(splits))#>model_fit#> parsnip model object #> #> Fit time: 1.3s #> Time elapsed: 1.19 seconds #> Model estimated using auto.adam() function: ETS(AAdN) #> Distribution assumed in the model: S #> Loss function type: likelihood; Loss function value: -471.368 #> Persistence vector g: #> alpha beta #> 1 0 #> Damping parameter: 0.9784 #> Sample size: 244 #> Number of estimated parameters: 6 #> Number of degrees of freedom: 238 #> Information criteria: #> AIC AICc BIC BICc #> -930.7360 -930.3816 -909.7530 -908.7788# ---- STANDARD ADAM ---- # Model Spec model_spec <- adam_reg( seasonal_period = 12, non_seasonal_ar = 3, non_seasonal_differences = 1, non_seasonal_ma = 3, seasonal_ar = 1, seasonal_differences = 0, seasonal_ma = 1 ) %>% set_engine("adam") # Fit Spec model_fit <- model_spec %>% fit(log(value) ~ date, data = training(splits)) model_fit#> parsnip model object #> #> Fit time: 1.1s #> Time elapsed: 1.04 seconds #> Model estimated using adam() function: ETS(AAN)+ARIMA(3,1,3) #> Distribution assumed in the model: Normal #> Loss function type: likelihood; Loss function value: -444.7548 #> Persistence vector g: #> alpha beta #> 0.0315 0.0315 #> #> ARMA parameters of the model: #> AR: #> phi1[1] phi2[1] phi3[1] #> 0.1000 -0.0508 0.1156 #> MA: #> theta1[1] theta2[1] theta3[1] #> -0.2071 -0.4779 -0.4091 #> #> Sample size: 244 #> Number of estimated parameters: 15 #> Number of degrees of freedom: 229 #> Information criteria: #> AIC AICc BIC BICc #> -859.5097 -857.4044 -807.0521 -801.2657


GPS is a national treasure.
In 2011 NYC DOH collected GPS and accelerometer data for 803 NYers
Built Environment and Health Research Group (Rundle, Neckerman, Quinn...)
Traditionally, public health studies looked at home (maybe work) address radial and network buffers or admin. bounds.
While neighborhood contextualization with GPS was a novel approach, mode detection and quantifiying distance traveled with GPS-only proved difficult.
Use of global positioning system (GPS) technology has become more commonly deployed for data collection in epidemiology and public health studies.
However, in dense urban environments, GPS measurements are highly prone to error as signals bounce off large buildings and other structures.
Formally defined as multipath error, these reflections increase the distance that the GPS signal must travel to reach the receiver—causing miscalculations in position.
Multipath problems can result in locations that seemingly wander or jump as the signal is dropped and regained.
Although the error associated with these split second delays may seem negligible, the multipath phenomena can substantially impact positional accuracy and tracking measurements.
This location may be influenced by multipath error differently than...
...this location.
Disclaimer: Student and volunteer data, no students were harmed during these experiments!
Testing:
GlobalSat DG-100
Grad students, take a hike walk!
We hypothesized...
Recommendations:
Add. studies (Lovasi)-GPS deployment in Rio Das Pedras for human mobility
GPS at home location (side profile)
NIH/CDC folks out there, need more funding!
Thanks:
Thanks! could keep going on about NYC Taxi data if additional time or end!
A map of all dropoff and pickup GPS points in 2013 (starts of trips in blue and the ends in orange on this map:) New York City taxi trips - Eric Fisher, Mapbox. Note points in water and over where buildings are.
Midtown (symbolized by dist. from roadbed) in QGIS
Calculating Distance (arcpy.GenerateNearTable_analysis
) from Pickup/Dropoffs to Nearest Roadbed feature, OGR-GDAL and Pandas IPython Notebooks for Data Munging.
But promising first pass results...
Every 1-unit increase in distributed building height was associated with approximately a 17% increase in distance from roadbed
0.17, 95% CI = 0.15 - 0.19, Adjusted R-squared 0.0089(Bruzelius)
Learn More:


[§174C-95] Abandonment. Any owner of any stream diversion work wishing to abandon or remove such work shall first obtain a permit to do so from the commission. [L 1987, c 45, pt of §2]


Boris Johnson’s government accused of ‘lying’ and ‘xenophobia’ after claiming EU citizens have ‘preferential’ access to NHS
by Thomas Colson, Business Insider US- Cabinet minister Michael Gove is accused of ‘lying’ after he claimed EU citizens have “preferential access” to NHS care
- Nicolas Hatton, the co-founder of the3million, an EU citizens’ rights group, said Gove’s claims drew on ‘pure propaganda from the far-right.’
- EU citizens do not receive preferential access to the NHS and are not automatically entitled to free healthcare treatment until they pay tax unless they are students.
- Labour’s Shadow Home Secretary Diane Abbott accused Gove of ‘bashing and blaming migrants.’
LONDON – Boris Johnson’s government has been accused of “lying” over claims that EU citizens have “preferential access” to NHS care as campaign groups accused him of drawing on “far-right” propaganda to win support in the general election.
Gove, the chancellor of the Duchy of Lancaster, claimed in a newspaper article on Sunday that EU citizens had “preferential access to free NHS care … without paying in.”
EU citizens do not receive preferential access to the NHS and are not automatically entitled to free healthcare treatment until they pay tax unless they are students.
Nicolas Hatton, founder of the 3million, which campaigns for EU citizens’ rights, said Gove’s remarks drew on “propaganda from the far-right.”
“Pretending to ignore EU law on reciprocal healthcare arrangement to claim EU citizens have preferential treatment and create a pressure on the NHS is pure propaganda from the far right,” he told Business Insider.
“Brits in Europe have the same rights and nearly 10% of doctors are EU citizens so we are not the problem, we are the solution.”
EU free movement rules and reciprocal health arrangements have allowed 1.2 million British nationals to settle elsewhere in Europe.
Claude Moraes, a Labour MEP, told the Guardian: “Gove is lying and I think they are going to continue lying for the campaign. The line that Gove used about ‘paying into’ the NHS is really an old-style racist trope and is designed to target Labour marginals where the vote is about leave or remain.”
Labour’s Shadow Home Secretary Diane Abbott accused Gove of “bashing and blaming migrants.”
In his article for the Mail on Sunday, Gove said: ” “It’s unfair that people coming from European countries can access free NHS care without paying in while others make significant contributions … It’s not right that people from Bulgaria and Slovenia can come here without any controls and have automatic rights that people from Bangladesh and Singapore do not.”
Diane Abbott tweeted: “Michael Gove is completely wrong to say people from EU are accessing the NHS without ‘paying in’. EU workers pay taxes. The NHS is not a contributory system.”


Cricket: Rampant India on brink of big win in day-night Test
KOLKATA: A sparkling century by Virat Kohli and Ishant Sharma's four wickets put India on the cusp of a big win over Bangladesh on just the second day of their maiden day-night Test on Saturday (Nov 23).
Tourists Bangladesh were 152 for six at stumps in their second innings, still needing 89 runs to avoid an innings defeat in the Kolkata pink ball Test.
Kohli made 136 as India, who lead the two-match series 1-0, declared their innings on 347 for nine and then Ishant rattled the Bangladesh batting.
"Batting under lights was difficult. When I batted yesterday, even when I saw on TV what was happening I think first session is slightly easier to bat," said Indian batsman Cheteshwar Pujara, who made 55 on day one.
"When there are lights the ball start swinging more and it is a bit challenging. During sunlight it is easier to see the ball red or pink."
Ishant struck early to leave Bangladesh tottering at 13 for four before Mushfiqur Rahim made an unbeaten 59 to take the five-day match to day three.
Mushfiqur and Mahmudullah, who retired hurt on 39 with a hamstring strain, put on 69 runs for the fifth wicket to offer some resistence against a persistent Indian pace attack.
Mushfiqur stayed on to complete his second half-century of the series with concussion substitute Taijul Islam losing his wicket for 11 to paceman Umesh Yadav and umpires called for end of play.
Mushfiqur survived two leg before wicket decisions that went against him but he successfully reviewed both the calls in his favour.
After India's declaration in the second session, Ishant trapped Shadman Islam lbw for nought and then claimed skipper Mominul Haque for a second zero in the same match.
HITS AND MISSES
The pace spearhead, who claimed five wickets in the first innings, bowled at a lively pace as one of his rising deliveries hit Mohammad Mithun on the helmet but the batsman went on to complete his innings.
"I thought light and pink ball had a role to play because as a batsman it is not easy to pick the ball, especially the short balls, the kind of pace our fast bowlers have," said Pujara on Bangladesh batsmen getting hit by Indian pacemen.
"As I know their batters have not played any pink ball game even at the domestic level and it's not easy."
Bangladesh were forced to take two concussion substitutes in Mehidy Hasan and Taijul for Liton Das and Nayeem Hasan who were hit on the helmet by Shami on day one.
Earlier Kohli aced the pink ball Test as he completed his 27th century before falling to a stunning catch by Taijul.
Left-arm spinner Taijul made it count with a wicket of Ajinkya Rahane for 51 and then took a diving catch at fine leg to send back Kohli off paceman Ebadat Hossain.
India lost a few quick wickets, but Wriddhiman Saha and Shami knocked a few boundaries and a six by the last man in pulverised the Bangladesh bowlers.
Pacemen Al-Amin Hossain and Ebadat took three wickets each.
"We are still 90 (89) odd runs behind and tomorrow we will try to avoid an innings defeat and make them bat again," Al-Amin told reporters.
Kohli stood out with his prolific scoring as he put on crucial partnerships including a 99-run stand with overnight partner Rahane.
The star batsman smashed fast bowler Abu Jayed for four straight boundaries in one over before finishing with 18 fours in his 194-ball stay.


1) What is put before variables in PHP?
$
#
@
Nothing
2) What does PHP stand for?
PHD Flopper
Hypertext Preprocessor
Phil's Hyper Processor
Nothing
3) What keyword is used to load a php file in html?
Has
Needs
Include
Nothing
4) PHP will not display anything if ...
A variable starts with a capital letter
Everything is coded properly
There is a syntax error.
Nothing
5) PHP is used for
Styling Webpages
Backend Development
Created Databases
Nothing


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.validator.EmailValidator
Perform email validations.
This class is a Singleton; you can retrieve the instance via the getInstance() method.
Based on a script by Sandeep V. Tamhankar http://javascript.internet.com
This implementation is not guaranteed to catch all possible errors in an email address. For example, an address like<EMAIL_ADDRESS>will pass validator, even though there is no TLD "somedog"
.
| Constructor Summary | |
protected |
EmailValidator()
Protected constructor for subclasses to use. |
| Method Summary | |
static EmailValidator |
getInstance()
Returns the Singleton instance of this validator. |
boolean |
isValid(java.lang.String email)
Checks if a field has a valid e-mail address. |
protected boolean |
isValidDomain(java.lang.String domain)
Returns true if the domain component of an email address is valid. |
protected boolean |
isValidIpAddress(org.apache.oro.text.perl.Perl5Util ipAddressMatcher)
Validates an IP address. |
protected boolean |
isValidSymbolicDomain(java.lang.String domain)
Validates a symbolic domain name. |
protected boolean |
isValidUser(java.lang.String user)
Returns true if the user component of an email address is valid. |
protected java.lang.String |
stripComments(java.lang.String emailStr)
Recursively remove comments, and replace with a single space. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected EmailValidator()
| Method Detail |
public static EmailValidator getInstance()
public boolean isValid(java.lang.String email)
Checks if a field has a valid e-mail address.
email
- The value validation is being performed on. A null
value is considered invalid.protected boolean isValidDomain(java.lang.String domain)
domain
- being validatied.protected boolean isValidUser(java.lang.String user)
user
- being validatedprotected boolean isValidIpAddress(org.apache.oro.text.perl.Perl5Util ipAddressMatcher)
ipAddressMatcher
- Pattren matcherprotected boolean isValidSymbolicDomain(java.lang.String domain)
domain
- symbolic domain nameprotected java.lang.String stripComments(java.lang.String emailStr)
emailStr
- The email address
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Built-In Functions
Functional Programming
- map
- Applies function to every item of an iterable object and returns a list of the results.
- filter
- Returns a sequence from those elements of iterable for which function returns True.
- reduce
- Applies function of two arguments cumulatively to the items of iterable, from left to right, so as to reduce the iterable to a single value.
Numeric Types Conversions and Constructors
- bool
- Returns an expression converted into a Boolean.
- int
- Returns an expression converted into an integer number.
- long
- Returns an expression converted into a long integer number.
- float
- Returns an expression converted into a floating point number.
- complex
- Returns an expression converted into a complex number.
Numeric Types Conversions
- bin
- Returns an integer converted into a binary string.
- oct
- Returns an integer converted into an octal string.
- hex
- Returns an integer converted into a hexadecimal string.
Arithmetic
- abs
- Returns the absolute value of a number.
- pow
- Returns a number raised to a power; or optionally a modulus of the number raised to a power and another number.
- round
- Returns a floating point number rounded to a specified number of decimal places.
- divmod
- Returns quotient and remainder after a division of two numbers.
String Conversions
- chr
- Returns a string of one character whose ASCII code is the specified number.
- ord
- Returns an integer representing the code of the character.
- unichr
- Returns a Unicode character specified by the code.
- format
- Returns a formatted string.
- repr
- Returns a string containing a printable representation of an object.
Sequences Constructors
- str
- Returns a string containing a printable representation of an object.
- unicode
- Returns the Unicode string version of object.
- list
- Converts an object into a list.
- tuple
- Returns a tuple built from iterable.
- bytearray
- Returns a new array of bytes.
- buffer
- Returns a new buffer object which references the object argument.
- memoryview
- Returns a memoryview object.
- range
- Returns a list of arithmetic progressions.
- xrange
- Returns an xrange object.
Mappings Constructors
- dict
- Returns a dictionary object.
- set
- Returns a set type initialized from iterable.
- frozenset
- Returns a frozenset object.
Operating on Containers
- enumerate
- Returns an enumerate object.
- len
- Returns an int type specifying number of elements in the collection.
- reversed
- Returns a reverse iterator over a sequence.
- sorted
- Returns a sorted list from the iterable.
- sum
- Returns a total of the items contained in the iterable object.
- zip
- Returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables.
- slice
- Returns a slice object.
Iterators
- iter
- Returns an iterator object.
- next
- Retrieves the next item from the iterator by calling its next() method.
Comparisons
- cmp
- Compares two objects and returns an integer according to the outcome.
- max
- Returns the largest item in an iterable or the largest of two or more arguments.
- min
- Returns the smallest item from a collection.
- all
- Returns a Boolean value that indicates whether the collection contains only values that evaluate to True.
- any
- Returns a Boolean value that indicates whether the collection contains any values that evaluate to True.
Identity
- hash
- Return the hash value of the object (if it has one).
- id
- Returns the “identity” of an object.
File Objects Constructors
- file
- Returns a file object.
- open
- Opens a file returning a file object.
Object Oriented Functions
- classmethod
- Returns a class method for the function.
- property
- Returns a property attribute for new-style classes (classes that derive from object).
- staticmethod
- Returns a static method for function.
- super
- Returns a proxy object that delegates method calls to a parent or sibling class of type.
- setattr
- Assigns a value to the object’s attribute given its name.
- getattr
- Returns the value of the named attribute of object.
- delattr
- Deletes the named attribute of an object.
- hasattr
- Returns a Boolean stating whether the object has the specified attribute.
- isinstance
- Returns a Boolean stating whether the object is an instance or subclass of another object.
- issubclass
- Returns a Bool type indicating whether an object is a subclass of a class.
- vars
- Returns the mapping of an object’s (writable) attributes.
- dir
- Returns the list of names in the current local scope. If supplied with an argument attempts to return a list of valid attributes for that object.
- type (1)
- Returns the type of an object (constructor name).
- type (2)
- Returns a new type object.
System
- __import__
- Imports a module.
- reload
- Reloads a previously imported module.
- compile
- Returns an AST or code object.
- execfile
- Evaluates contents of a file.
- eval
- Returns a result of the evaluation of a Python expression.
- input
- Evaluates user input.
- intern
- Enters the string into interned strings table (if not already there).
- print
- Returns a printed representation of the objects.
- raw_input
- Reads a line from standard input stream.
Misc
- object
- Returns a new featureless object.
- apply
- Returns the result of a function or class object called with supplied arguments.
- basestring
- This abstract type is the superclass for str and unicode. It cannot be called or instantiated, but it can be used to test whether an object is an instance of str or unicode.
- coerce
- Returns a tuple consisting of the two numeric arguments converted to a common type.


ISATab-Viewer
- Part of
Developed and maintained by
the ISA-tools Team
Provide a Github gist identifier to an ISA-Tab file to view
Load File from Github Gist
ISA-Tab files


{% load static %}
I am a full-stack freelance web developer and designer based in Nairobi, Kenya. I develop web applications using Python and Django web framework.
I excel at helping clients bring their ideas to life. I will definitely do the same for you if you hire me!
When am not coding, I may be doing one of these things:
I have passion in developing start-ups and helping clients make their concepts a reality.
Real estate website for Dubiz Investments that enable the enterprise to showcase their properties and make it possible for clients to search for property in their preferred place.
Close ProjectGrocery store website showcasing the products that are available at the store
Close Project


| SMSGateway Class Identification : | SMSGateway Class Inheritance : |
|
|
| |
|||
| |
|
|
|
| IP | IP address of MOXA Gateway | String | none |
| PIN | The PIN code is stored on the SIM card; if the PIN code cannot be accessed, then the modem will not be accessible over the network. | String | none |
| |
||||
| |
|
|
|
|
| State | DEV_VOID | DEV_STATE | OPERATOR | This command gets the device state (stored in its device_state data member) and returns it to the caller. |
| Status | DEV_VOID | CONST_DEV_STRING | OPERATOR | This command gets the device status (stored in its device_status data member) and returns it to the caller. |
| Reset | DEV_VOID | DEV_VOID | OPERATOR | Reset (disconnect, enter command mode and restore the flash settings) |
| Connect | DEV_VOID | DEV_VOID | OPERATOR | OpMode |
| SendSMS | DEV_VOID | DEV_VOID | OPERATOR | None. |
| |
||
| Input Argument | Tango::DEV_VOID | none |
| Output Argument | Tango::DEV_STATE | Device state |
| DisplayLevel | OPERATOR | .. |
| Inherited | true | .. |
| Abstract | true | .. |
| Polling Period | Not polled | .. |
| Command allowed for | All states | .. |
| |
||
| Input Argument | Tango::DEV_VOID | none |
| Output Argument | Tango::CONST_DEV_STRING | Device status |
| DisplayLevel | OPERATOR | .. |
| Inherited | true | .. |
| Abstract | true | .. |
| Polling Period | Not polled | .. |
| Command allowed for | All states | .. |
| |
||
| Input Argument | Tango::DEV_VOID | |
| Output Argument | Tango::DEV_VOID | |
| DisplayLevel | OPERATOR | .. |
| Inherited | false | .. |
| Abstract | false | .. |
| Polling Period | Not polled | .. |
| Command allowed for | All states | .. |
| |
||
| Input Argument | Tango::DEV_VOID | |
| Output Argument | Tango::DEV_VOID | |
| DisplayLevel | OPERATOR | .. |
| Inherited | false | .. |
| Abstract | false | .. |
| Polling Period | Not polled | .. |
| Command allowed for | All states | .. |
| |
||
| Input Argument | Tango::DEV_VOID | |
| Output Argument | Tango::DEV_VOID | |
| DisplayLevel | OPERATOR | .. |
| Inherited | false | .. |
| Abstract | false | .. |
| Polling Period | Not polled | .. |
| Command allowed for | All states | .. |
| |
|||||||
| |
|
|
|
|
|
|
|
| TextMessage | false | false | Scalar | WRITE | Tango::DEV_STRING | OPERATOR | SMS content, Max length is 160. |
| Phone | false | false | Scalar | WRITE | Tango::DEV_STRING | OPERATOR | SMS Receiveer |
|
|
|
|
|
|
| |
|
| |
|
| ON | HTTP status code: 200 OK Standard response for successful HTTP requests. |
| FAULT | HTTP status code:404, Not Found, The requested resource could not be found but may be available in the future. |
| ALARM | HTTP status code: 403, Forbidden. The request was valid, but the server is refusing action. |
| UNKNOWN | Other |


Balıkesir is the capital city of Balıkesir Province. Balıkesir is in the Marmara region of Turkey and has a population of 331,788] inhabitants. Between 1341-1922, it was the capital of Karasi. Balıkesir has famous carpet , cologne and desert (höşmerim). Actually my hometown is a small city. If you will visit there , you can go a little different places but they are really beautiful places.


My Cookies Store
Location Of Store
Minimum # of Customers
Maximun # of Customers
Customer Number
Submit
Main Page


Important Note! Actual tasks for the study courses will first appear in ORTUS and/or in your email. This site is for information purpose only.


This Browser Extension will help you determine when there is a relationship between a YouTube content creator and advertiser. These relationships are determined through the presence of Affiliate Marketing Links, which trace the source of traffic to a web page and, if products are purchased, the YouTube content creator that brought you there earns a commission. Though affiliated marketing is not always bad, it is important to realize when a video is sponsored in order to form a full opinion about the content of the video.
Known affiliate links are highlighted in red
Suspected affiliate links are highlighted in orange
Suspected coupon codes are highlighted in yellow
When you load a Youtube video, this extension will alert you in your preferred format (configured through your settings) if the video contains sponsored content.


This dataset can be found in the textfiles in data-mcdonalds-nutrition
This dataset can be found below. This dataset has not been exported and does not fit JSON formatting rules.


U-TURN A film review by Steve Rhodes Copyright 1997 Steve Rhodes
RATING (0 TO ****): ** 1/2
Oliver Stone, one of our most visceral directors, rarely makes anything but engaging films. He received Oscars for his hard-hitting PLATOON and BORN ON THE FOURTH OF JULY, but even his films like JFK, which are nothing less than balderdash, are fascinating and involving pieces of filmmaking. And when Stone tests our tolerance for violence, as in NATURAL BORN KILLERS, he can enrage an audience. Like him or hate him or both, his pictures are always in your face.
U-TURN can be argued to be one of Stone's most shocking films since it is shockingly mediocre. People are likely to leave the theater neither engaged nor enraged.
Although Stone may not operate on the edge in U-TURN, his Academy Award winning cinematographer Robert Richardson does. Every frame is oversaturated with grainy colors, and the images frequently jump as if filmed with a strobe light. His obsession with panning and zooming will have you ready to cry uncle before the end of the first reel. Combined with the choppy, overediting by Hank Corwin and Thomas J. Nordberg, the film takes on the nightmarish appearance of someone dying of a caffeine overdose.
The script by John Ridley, which is based on his book "Stray Dogs," relies on a stream of quirky characters to create his version of a black comedy. With Stone as the director, half of Hollywood shows up to take part. Liv Tyler, for example, has a cameo part that requires her to walk into a bus station to buy a ticket. Now, that's a part I could do.
The star of the film, and the only one worth seeing is Sean Penn. In recent times Penn's talent has become increasing evident. Here, as in this year's SHE'S SO LOVELY, he steals the show.
Penn, playing a not very successful gambler and crook named Bobby Cooper, arrives in a dusty, Godforsaken town in the middle of the Arizona desert. His car has a broken radiator hose, and the only mechanic is a dishonest simpleton named Darrell. Billy Bob Thornton plays Darrell with a face caked in grease like a cartoon character who just walked into an explosion and with teeth that looks like he's been eating dirt. Darrell flashes Bobby a smile that says "I am about to take you for everything you have since I'm your only hope of getting out of this hellhole." Penn later tells Bobby he is just "an ignorant, inbred, tumbleweed hick." But, Bobby saves his best insult for last.  Why aren't you one of them?"
When Penn wanders into town to get a bite to eat, he meets a blind, part Indian, Vietnam veteran, overacted as almost a self-parody by Jon Voight. The blind man is the local philosopher whose aphorisms include, "Everything is everything." Is Voight really this far gone? Why does this once excellent actor only takes roles that are caricatures?
In this town, which would make a ghost town look appealing, Bobby runs into its only shining light, Jennifer Lopez in her sexiest part yet as Grace McKenna. After asking him up to her place to shower, her grizzled husband Jake, played by an almost unrecognizable Nick Nolte, walks in on them. Jake turns out to be a man with a highly malleable conscience. Or as he puts it, "a man with no ethics is a free man."
The rest of the show involves contradictory murder plots and ends in a typical Stone bloodbath. Along the way, we get to meet a host of other characters including Powers Boothe as the shifty-eyed sheriff, Claire Danes as the oversexed, local girl wanting to have Bobby's love child, Joaquin Phoenix as her violent boyfriend, Julie Hagerty as a cliched waitress named Flo and many others.
Penn saves the film, but just barely. His attempt to find sanity in this Twilight Zone of a town manages to rise above the rest of the all-too-cute material. A week after you have seen the show, only the film's bold, but repetitiously tiring cinematographic techniques will remain in your memory. Nothing else about the film is unusual enough to be remembered, and that is the tragedy. Has Stone gone soft?
U-TURN runs 2:05. It is rated R for gore, sex, brief nudity, and profanity. The film would be fine for older teenagers. For Penn's performance I give the film a mild recommendation and ** 1/2.
**** = A must see film. *** = Excellent show. Look for it. ** = Average movie. Kind of enjoyable. * = Poor show. Don't waste your money. 0 = Totally and painfully unbearable picture.
REVIEW WRITTEN ON: October 1, 1997
Opinions expressed are mine and not meant to reflect my employer's.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Blog
Home
Blog
About
Projects
Technical Blog.
Week One
Week Three
Week Four
Week Five
Week Six
Week Seven
Week Eight