todo push to what ops? Also what is this error called again?
348250
public static double computeError(GrayF32 imgA, GrayF32 imgB ) {
		final int h = imgA.getHeight();
		final int w = imgA.getWidth();

		double total = 0;

		for (int y = 0; y < h; y++) {
			for (int x = 0; x < w; x++) {
				double difference =  Math.abs(imgA.get(x,y)-imgB.get(x,y));
				total += difference;
			}
		}

		return total / (w*h);
	}
938656
private void push(ScopeOptions options) throws JSONException {
        m_top += 1;
        if (m_top >= MAX_DEPTH) {
            throw new JSONException("Nesting too deep.");
        }
        try {
            m_writer.write(options.m_prefix);
        }
        catch (IOException e) {
            throw new JSONException(e);
        }

        HashSetOfString keyTracker = options.createKeyTracker();
        m_scopeStack[m_top] = keyTracker;
        m_mode = (keyTracker == null) ? 'a' : 'k';
        m_expectingComma = false;
    }
213962
function push (directory, uri, callback) {
  var db = nano(uri);
  loadDocument(directory, function (err, doc) {
    if (err) return callback.call(null, err);
    loadAttachments(doc, directory, function (err, doc) {
      if (err) return callback.call(null, err);
      db.get(doc._id, function (err, body) {
        if (err && err.reason !== "missing") return callback.call(null, err);
        if (body && body._rev) {
          doc._rev = body._rev;
        }
        db.insert(doc, doc._id, callback);
      });
    });
  });
}
476330
function(key, value, isUnique) {
      if(isUnique) {
        return this._op(key, value, 'pushUnique');
      } else {
        return this._op(key, value, 'push');
      }
    }
1252174
def push(self, *args, **kwargs):
        '''  '''
        stdout = six.b('')

        # Execute command
        cmd = self.git.push(as_process=True, *args, **kwargs)

        # Capture output
        while True:
            output = cmd.stdout.read(1)

            sys.stdout.write(output.decode('utf-8'))
            sys.stdout.flush()

            stdout += output

            # Check for EOF
            if output == six.b(""):
                break

        # Wait for the process to quit
        try:
            cmd.wait()
        except GitCommandError as error:
            # Add more meta-information to errors
            message = "'{0}' returned exit status {1}".format(
                ' '.join(str(c) for c in error.command),
                error.status
            )

            raise GitError(message, stderr=error.stderr, stdout=stdout)

        return stdout.strip()
894791
function update () {
      sourceOrOptions.bundle()
        .pipe(concat(function (data) {
          add(filepath, data.toString())
        }))
        .on('error', function (err) {
          console.error(err.stack)
          ASSET_PENDING--
        })
    }
365436
public final void addOp(Operation op) {
    try {
      if (!authLatch.await(authWaitTime, TimeUnit.MILLISECONDS)) {
        FailureMode mode = connectionFactory.getFailureMode();
        if (mode == FailureMode.Redistribute || mode == FailureMode.Retry) {
          getLogger().debug("Redistributing Operation " + op + " because auth "
            + "latch taken longer than " + authWaitTime + " milliseconds to "
            + "complete on node " + getSocketAddress());
          connection.retryOperation(op);
        } else {
          op.cancel();
          getLogger().warn("Operation canceled because authentication "
            + "or reconnection and authentication has "
            + "taken more than " + authWaitTime + " milliseconds to "
            + "complete on node " + this);
          getLogger().debug("Canceled operation %s", op.toString());
        }
        return;
      }
      if (!inputQueue.offer(op, opQueueMaxBlockTime, TimeUnit.MILLISECONDS)) {
        throw new IllegalStateException("Timed out waiting to add " + op
            + "(max wait=" + opQueueMaxBlockTime + "ms)");
      }
    } catch (InterruptedException e) {
      // Restore the interrupted status
      Thread.currentThread().interrupt();
      throw new IllegalStateException("Interrupted while waiting to add " + op);
    }
  }
1233415
function dispatch(action, payload) {
    if (process.env.NODE_ENV !== 'production' && dispatching) {
      throw new Error(`'${action.toString()}' was dispatched while '${dispatching.toString()}' was still updating. Updaters should be pure functions and must not dispatch actions.`);
    }
    try {
      dispatching = action;
      state = updater(state, action, payload);
      if (process.env.NODE_ENV !== 'production' && debug) {
        console.info(state);
      }
    } finally {
      dispatching = null;
    }
    updateUI();
  }
910324
function pushTo(array) {
	return map(function (file, cb) {
		array.push(file);
		cb(null, file);
	});
}
330887
function add() {
            vm.error = undefined;
            service.add({
                description: vm.description
            }, function() {
                _fetch();
            }, function() {
                vm.error = 'An error occurred when adding a todo';
            });
            vm.description = '';
        }
327721
def push(value)
      RedisEventStore.instance.lpush(@key, value)
    rescue Redis::CommandError, Redis::CannotConnectError
      RedisEventStore.logger.error("unable to push event: #{@key}")
      nil
    end
474533
function createPushError(store, operationTableManager, storeTaskRunner, pushOperation, operationError) {

    // Calling getError will return the operationError object to the caller without cloning it.
    // (As operationError can have loops, our simplistic makeCopy(..) method won't be able to clone it)
    //
    // To guard ourselves from possible modifications to the operationError object by the caller,
    // we make a copy of its members we may need later.
    var serverRecord = makeCopy(operationError.serverInstance),
        statusCode = makeCopy(operationError.request.status);
    
    /**
     * @class PushError
     * @classdesc A conflict / error encountered while pushing a change to the server. This wraps the underlying error
     * and provides additional helper methods for handling the conflict / error. 
     * @protected
     */
    return {
        /**
         * @member {boolean} isHandled When set to true, the push logic will consider the conflict / error to be handled.
         *                             In such a case, an attempt would be made to push the change to the server again.
         *                             By default, `isHandled` is set to false.
         * @instance
         * @memberof PushError
         */
        isHandled: false,

        getError: getError,
        
        // Helper methods
        isConflict: isConflict,
        
        // Data query methods
        getTableName: getTableName,
        getAction: getAction,
        getServerRecord: getServerRecord,
        getClientRecord: getClientRecord,

        // Error handling methods
        cancelAndUpdate: cancelAndUpdate,
        cancelAndDiscard: cancelAndDiscard,
        cancel: cancel,
        update: update,
        changeAction: changeAction
    };

    /**
     * Gets the name of the table for which conflict / error occurred.
     * 
     * @function
     * @instance
     * @memberof PushError
     * 
     * @returns {string} The name of the table for which conflict / error occurred. 
     */
    function getTableName() {
        return makeCopy(pushOperation.logRecord.tableName);
    }
    
    /**
     * Gets the action for which conflict / error occurred.
     * 
     * @function
     * @instance
     * @memberof PushError 
     * 
     * @returns {string} The action for which conflict / error occurred. Valid action values
     *                   are _'insert'_, _'update'_ or _'delete'_.
     */
    function getAction() {
        return makeCopy(pushOperation.logRecord.action);
    }
    
    /**
     * Gets the value of the record on the server, if available, when the conflict / error occurred.
     * This is useful while handling conflicts. However, **note** that in the event of
     * a conflict / error, the server may not always respond with the server record's value.
     * Example: If the push failed even before the client value reaches the server, we won't have the server value.
     * Also, there are some scenarios where the server does not respond with the server value.
     * 
     * @function
     * @instance
     * @memberof PushError
     * 
     * @returns {object} Server record value.
     */
    function getServerRecord() {
        return makeCopy(serverRecord);
    }
    
    /**
     * Gets the value of the record that was pushed to the server when the conflict /error occurred.
     * Note that this may not be the latest value as local tables could have changed after we
     * started the push operation. 
     * 
     * @function
     * @instance
     * @memberof PushError
     * 
     * @returns {object} Client record value.
     */
    function getClientRecord() {
        return makeCopy(pushOperation.data);
    }
    
    /**
     * Gets the underlying error encountered while performing the push operation. This contains
     * grannular details of the failure like server response, error code, etc.
     * 
     * Note: Modifying value returned by this method will have a side effect of permanently
     * changing the underlying error object
     * 
     * @function
     * @instance
     * @memberof PushError
     * @returns {Error} The underlying error object.
     */
    function getError() {
        // As operationError can have loops, our simplistic makeCopy(..) method won't be able to clone it. 
        // Return without cloning.
        return operationError;
    }
    
    /**
     * Checks if the error is a conflict.
     * 
     * @function
     * @instance
     * @memberof PushError
     * 
     * @returns {boolean} true if the error is a conflict. False, otherwise.
     */
    function isConflict() {
        return statusCode === 409 || statusCode === 412;
    }
    
    /**
     * Cancels the push operation for the current record and updates the record in the local store.
     * This will also set {@link PushError#isHandled} to true.
     * 
     * @function
     * @instance
     * @memberof PushError
     * 
     * @param {object} newValue New value of the client record that will be updated in the local store.
     * 
     * @returns {Promise} A promise that is fulfilled when the operation is cancelled and the client record is updated.
     *                    The promise is rejected with the error if `cancelAndUpdate` fails.
     */
    function cancelAndUpdate(newValue) {
        var self = this;
        return storeTaskRunner.run(function() {

            if (pushOperation.logRecord.action === 'delete') {
                throw new Error('Cannot update a deleted record');
            }
            
            if (_.isNull(newValue)) {
                throw new Error('Need a valid object to update the record');
            }
            
            if (!_.isValidId(newValue.id)) {
                throw new Error('Invalid ID: ' + newValue.id);
            }
            
            if (newValue.id !== pushOperation.data.id) {
                throw new Error('Only updating the record being pushed is allowed');
            }
            
            // Operation to update the data record
            var dataUpdateOperation = {
                tableName: pushOperation.logRecord.tableName,
                action: 'upsert',
                data: newValue
            };
            
            // Operation to delete the log record
            var logDeleteOperation = {
                tableName: operationTableName,
                action: 'delete',
                id: pushOperation.logRecord.id
            };
            
            // Execute the log and data operations
            var operations = [dataUpdateOperation, logDeleteOperation];
            return store.executeBatch(operations).then(function() {
                self.isHandled = true;
            });
        });
    }
    
    /**
     * Cancels the push operation for the current record and discards the record from the local store.
     * This will also set {@link PushError#isHandled} to true.
     * 
     * @function
     * @instance
     * @memberof PushError
     * 
     * @returns {Promise} A promise that is fulfilled when the operation is cancelled and the client record is discarded
     *                    and rejected with the error if `cancelAndDiscard` fails.
     */
    function cancelAndDiscard() {
        var self = this;
        return storeTaskRunner.run(function() {
            
            // Operation to delete the data record
            var dataDeleteOperation = {
                tableName: pushOperation.logRecord.tableName,
                action: 'delete',
                id: pushOperation.logRecord.itemId
            };
            
            // Operation to delete the log record
            var logDeleteOperation = {
                tableName: operationTableName,
                action: 'delete',
                id: pushOperation.logRecord.id
            };
            
            // Execute the log and data operations
            var operations = [dataDeleteOperation, logDeleteOperation];
            return store.executeBatch(operations).then(function() {
                self.isHandled = true;
            });
        });
    }
    
    /**
     * Updates the client data record associated with the current operation.
     * If required, the metadata in the log record will also be associated.
     * This will also set {@link PushError#isHandled} to true.
     *
     * @function
     * @instance
     * @memberof PushError
     * 
     * @param {object} newValue New value of the data record. 
     * 
     * @returns {Promise} A promise that is fulfilled when the data record is updated in the localstore.
     */
    function update(newValue) {
        var self = this;
        return storeTaskRunner.run(function() {
            if (pushOperation.logRecord.action === 'delete') {
                throw new Error('Cannot update a deleted record');
            }
            
            if (_.isNull(newValue)) {
                throw new Error('Need a valid object to update the record');
            }
            
            if (!_.isValidId(newValue.id)) {
                throw new Error('Invalid ID: ' + newValue.id);
            }
            
            if (newValue.id !== pushOperation.data.id) {
                throw new Error('Only updating the record being pushed is allowed');
            }

            //TODO: Do we need to disallow updating record if the record has been deleted after
            //we attempted push?

            return operationTableManager.getMetadata(pushOperation.logRecord.tableName, 'upsert', newValue).then(function(metadata) {
                pushOperation.logRecord.metadata = metadata;
                return store.executeBatch([
                    { // Update the log record
                        tableName: operationTableName,
                        action: 'upsert',
                        data: pushOperation.logRecord
                    },
                    { // Update the record in the local table
                        tableName: pushOperation.logRecord.tableName,
                        action: 'upsert',
                        data: newValue
                    }
                ]).then(function() {
                    self.isHandled = this;
                });
            });

        });
    }
    
    /**
     * Changes the type of operation that will be pushed to the server.
     * This is useful for handling conflicts where you might need to change the type of the 
     * operation to be able to push the changes to the server.
     * This will also set {@link PushError#isHandled} to true.
     *
     * Example: You might need to change _'insert'_ to _'update'_ to be able to push a record that 
     * was already inserted on the server.
     * 
     * Note: Changing the action to _'delete'_' will automatically remove the associated record from the 
     * data table in the local store.
     * 
     * @function
     * @instance
     * @memberof PushError
     * 
     * @param {string} newAction New type of the operation. Valid values are _'insert'_, _'update'_ and _'delete'_.
     * @param {object} [newClientRecord] New value of the client record. 
     *                          The `id` property of the new record should match the `id` property of the original record.
     *                          If `newAction` is _'delete'_, only the `id` and `version` properties will be read from `newClientRecord`.
     *                          Reading the `version` property while deleting is useful if
     *                          the conflict handler changes an _'insert'_  /_'update'_ action to _'delete'_' and also updated the version
     *                          to reflect the server version.
     * 
     * @returns {Promise} A promise that is fulfilled when the action is changed and, optionally, the data record is updated / deleted.
     *                    If this fails, the promsie is rejected with the error.
     */
    function changeAction(newAction, newClientRecord) {
        var self = this;
        return storeTaskRunner.run(function() {
            var dataOperation, // operation to edit the data record
                logOperation = { // operation to edit the log record 
                    tableName: operationTableName,
                    action: 'upsert',
                    data: makeCopy(pushOperation.logRecord)
                };

            // If a new value for the record is specified, use the version property to update the metadata
            // If not, there is nothing that needs to be changed in the metadata. Just use the metadata we already have.
            if (newClientRecord) {
                if (!newClientRecord.id) {
                    throw new Error('New client record value must specify the record ID');
                }
                    
                if (newClientRecord.id !== pushOperation.logRecord.itemId) {
                    throw new Error('New client record value cannot change the record ID. Original ID: ' +
                                    pushOperation.logRecord.id + ' New ID: ' + newClientRecord.id);
                }

                // FYI: logOperation.data and pushOperation.data are not the same thing!
                logOperation.data.metadata = logOperation.data.metadata || {};
                logOperation.data.metadata[tableConstants.sysProps.versionColumnName] = newClientRecord[tableConstants.sysProps.versionColumnName];
            }

            if (newAction === 'insert' || newAction === 'update') {
                
                // Change the action as specified
                var oldAction = logOperation.data.action;
                logOperation.data.action = newAction;

                // Update the client record, if a new value is specified
                if (newClientRecord) {
                    
                    dataOperation = {
                        tableName: pushOperation.logRecord.tableName,
                        action: 'upsert',
                        data: newClientRecord
                    };
                    
                } else if (oldAction !== 'insert' && oldAction !== 'update') {

                    // If we are here, it means we are changing the action from delete to insert / update. 
                    // In such a case we expect newClientRecord to be non-null as we won't otherwise know what to insert / update.
                    // Example: changing delete to insert without specifying a newClientRecord is meaningless.
                    throw new Error('Changing action from ' + oldAction + ' to ' + newAction +
                                    ' without specifying a value for the associated record is not allowed!');
                }
                
            } else if (newAction === 'delete' || newAction === 'del') {

                // Change the action to 'delete'
                logOperation.data.action = 'delete';

                // Delete the client record as the new action is 'delete'
                dataOperation = {
                    tableName: pushOperation.logRecord.tableName,
                    action: 'delete',
                    id: pushOperation.logRecord.id
                };

            } else {
                throw new Error('Action ' + newAction + ' not supported.');
            }
            
            // Execute the log and data operations
            return store.executeBatch([logOperation, dataOperation]).then(function() {
                self.isHandled = true;
            });
        });
    }
    
    /**
     * Cancels pushing the current operation to the server permanently.
     * This will also set {@link PushError#isHandled} to true.
     * 
     * This method simply removes the pending operation from the operation table, thereby 
     * permanently skipping the associated change from being pushed to the server. A future change 
     * done to the same record will not be affected and such changes will continue to be pushed.
     *  
     * @function
     * @instance
     * @memberof PushError
     *
     * @returns {Promise} A promise that is fulfilled when the operation is cancelled OR rejected
     *                    with the error if it fails to cancel it.
     */
    function cancel() {
        var self = this;
        return storeTaskRunner.run(function() {
            return store.del(operationTableName, pushOperation.logRecord.id).then(function() {
                self.isHandled = true;
            });
        });
    }
}
1112104
function (def, err) {
    def.errors = def.errors || []
    err.message = err.message.cyan
    def.errors.push(err)
  }
143053
function push(topic) {
        var args = arguments;
        var argc = args.length;
        var id, result;
        if (argc < 2 || argc > 3) {
            throw new Error('Wrong number of arguments');
        }
        if (argc === 2) {
            result = args[1];
        }
        else {
            id = args[1];
            result = args[2];
        }
        if (typeof id === 'undefined') {
            var topics = getTopics(topic);
            for (id in topics) { _push(topic, id, result); }
        }
        else if (Array.isArray(id)) {
            id.forEach(function(id) { _push(topic, id, result); });
        }
        else {
            _push(topic, id, result);
        }
    }
1212488
function WalletError(category, message, details, more) {
  more=more&&(': '+more)||''
  Error.call(this);
  Error.captureStackTrace(this, this.constructor);
  var status=parseInt(message),code=parseInt(details);
  this.category = category;
  this.code=code||undefined
  this.message = !isNaN(status)&&(messages.getStatus(status)+more)||message;
  this.details = code&&messages.getDescription(code)||details;
  this.name = this.constructor.name;
}
604736
function (operation, space, groupId, res) {
        if (!((operation.moveTo && operation.moveTo.space) ||
        (operation.transform && (operation.transform.scale || operation.transform.translate)))) {
            // An attempt to do something we don't understand
            log.error('Invalid Operation:', 'request:', JSON.stringify(operation));
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid operation' }));
        } else if (operation.moveTo && operation.moveTo.space && !server.spaces[operation.moveTo.space]) {
            log.error('Invalid Space', 'request:', JSON.stringify(operation));
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid space' }));
            return;
        } else if (operation.transform) {
            if (operation.transform.scale && (operation.transform.scale.x === undefined || operation.transform.scale.y === undefined)) {
                log.error('Invalid Dimensions for Scale operation', 'request:', JSON.stringify(operation));
                Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid dimensions' }));
                return;
            } else if (operation.transform.translate && (operation.transform.translate.x === undefined || operation.transform.translate.y === undefined)) {
                log.error('Invalid Dimensions for Translate operation', 'request:', JSON.stringify(operation));
                Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid dimensions' }));
                return;
            }
        }

        let sectionsToUpdate = [];
        const sections = server.state.get('sections');
        if (groupId) {
            if (!Utils.isNullOrEmpty(server.state.get('groups[' + groupId + ']'))) {
                log.info('Updating sections of group:', groupId);
                const group = server.state.get('groups[' + groupId + ']').slice();
                group.forEach(function (e) {
                    let i = parseInt(e, 10);
                    sectionsToUpdate.push(i);
                });
            }
        } else if (space) {
            log.info('Updating sections of space:', space);
            let i = -1;
            let findSectionsBySpace = function (e, x) {
                return x > i && !Utils.isNullOrEmpty(e) && !Utils.isNullOrEmpty(e.spaces[space]);
            };
            i = sections.findIndex(findSectionsBySpace);
            while (i !== -1) {
                sectionsToUpdate.push(i);
                i = sections.findIndex(findSectionsBySpace);
            }
        } else {
            sections.forEach(function (e, i) {
                if (!Utils.isNullOrEmpty(e)) {
                    sectionsToUpdate.push(i);
                }
            });
        }

        // Check whether any operation has to be made.
        if (Utils.isNullOrEmpty(sectionsToUpdate)) {
            Utils.sendEmptySuccess(res);
            return;
        }

        let rangeError = false;
        let geometries = {};
        sectionsToUpdate.forEach(function (e) {
            const section = sections[e];
            geometries[e] = { x: section.x, y: section.y, w: section.w, h: section.h };
            let space;
            if (operation.moveTo && operation.moveTo.space) {
                space = operation.moveTo.space;
            } else {
                space = Object.keys(section.spaces)[0];
            }
            const bounds = _getSpaceGeometries()[space];
            if (operation.transform) {
                if (operation.transform.scale) {
                    geometries[e].w = (geometries[e].w * operation.transform.scale.x) << 0;
                    geometries[e].h = (geometries[e].h * operation.transform.scale.y) << 0;
                }
                if (operation.transform.translate) {
                    geometries[e].x = (geometries[e].x + operation.transform.translate.x) << 0;
                    geometries[e].y = (geometries[e].y + operation.transform.translate.y) << 0;
                }
            }
            if (geometries[e].x < 0 || geometries[e].y < 0 || Math.max(geometries[e].x, geometries[e].w) > bounds.w || Math.max(geometries[e].y, geometries[e].h) > bounds.h) {
                log.error('Section no longer fits within space after transformation for section id:', e, 'space:', space, 'geometry:', JSON.stringify(geometries[e]));
                rangeError = true;
            }
        });
        if (rangeError) {
            log.error('Unable to update sections due to one or more range errors');
            Utils.sendMessage(res, HttpStatus.BAD_REQUEST, JSON.stringify({ error: 'invalid dimensions' }));
            return;
        }

        sectionsToUpdate.forEach(function (e) {
            const section = sections[e];
            let space;
            if (operation.moveTo && operation.moveTo.space) {
                space = operation.moveTo.space;
            }
            _updateSectionById(e, space, geometries[e], section.app);
        });
        if (sectionsToUpdate.length === server.state.get('sections').length) {
            log.info('Successfully updated all sections');
        } else {
            log.info('Successfully updated sections:', sectionsToUpdate);
        }
        Utils.sendMessage(res, HttpStatus.OK, JSON.stringify({ ids: sectionsToUpdate }));
    }
14080
protected void pushContext() {
    antOut = System.out;
    antErr = System.err;
    System.setOut(new PrintStream(out));
    System.setErr(out == err ? System.out : new PrintStream(err));
  }