/*
Updates a single score on a given Score id
426017
function (req, res, next) {
		var scoreId = req.param('id', null);
		var scoreNumber = req.param('number', null);
		var scoreData = req.param('data', null);
		var scoreValue = req.param('value', null);

		if(	scoreId === null ||
			scoreNumber === null ||
			scoreData === null ||
			scoreValue === null){
			return next('Missing properties');
		}

		// Find the score
    	app.models.Scores.findOne(scoreId).exec(function (err, score){
	    	if(err) return next('Failed to get score: ' + err);

	    	if(!score)
	    		return next('Score not found');

	    	var update = {
	    		scores: score.scores || {}
	    	};

	    	update.scores[scoreNumber] = {
	    		value: parseInt(scoreValue),
	    		data: scoreData,
	    	};

	    	// console.log(update);
	    	// next();
	    	app.models.Scores.update(score.id, update, function (err, model){
	    		if(err) return next(err);
	    		console.log(model);
	    		return res.json(model && model[0]);
	    	});
    	});
	}
430605
def keep_everything_scorer(checked_ids):
    """"""
    result = checked_ids.keys()
    for i in checked_ids.values():
        result.extend(i.keys())
    return dict.fromkeys(result).keys()
134928
protected boolean updateAssignment(DBIDIter iditer, List<? extends ModifiableDBIDs> clusters, WritableIntegerDataStore assignment, int newA) {
    final int oldA = assignment.intValue(iditer);
    if(oldA == newA) {
      return false;
    }
    clusters.get(newA).add(iditer);
    assignment.putInt(iditer, newA);
    if(oldA >= 0) {
      clusters.get(oldA).remove(iditer);
    }
    return true;
  }
434382
private int getLeastScore(Collection<String> ids)
	{
		int s = Integer.MAX_VALUE;

		for (String id : ids)
		{
			if (score.get(id) < s) s = score.get(id);
		}

		return s;
	}
1216371
public void updateScannerStat(final int query_index, final int id, 
      final QueryStat name, final long value) {
    Map<Integer, Map<QueryStat, Long>> qs = scanner_stats.get(query_index);
    long cum_time = value;
    if (qs == null) {
      qs = new ConcurrentHashMap<Integer, Map<QueryStat, Long>>();
      scanner_stats.put(query_index, qs);
    }
    Map<QueryStat, Long> scanner_stat_map = qs.get(id);
    if (scanner_stat_map == null) {
      scanner_stat_map = new HashMap<QueryStat, Long>();
      qs.put(id, scanner_stat_map);
    }

    if (scanner_stat_map.containsKey(name)) {
      cum_time += scanner_stat_map.get(name);
    }
    
    scanner_stat_map.put(name, cum_time);
  }
122610
def add_or_update(user_id, app_id):
        '''
        
        '''

        rec = MCollect.get_by_signature(user_id, app_id)

        if rec:
            entry = TabCollect.update(
                timestamp=int(time.time())
            ).where(TabCollect.uid == rec.uid)
            entry.execute()
        else:
            TabCollect.create(
                uid=tools.get_uuid(),
                user_id=user_id,
                post_id=app_id,
                timestamp=int(time.time()),
            )
718985
function update(id, object) {
	// Validations
	if (!_isValidId(id)) {
		return false;
	}

	// Action
	const index = _getIndexOfId(id);

	if (index > -1) {
		if (_isValidAmbushOnUpdate(id, object)) {
			const current = goblin.ambush[index];
			const newAmbush = Object.assign({}, current, object);
			newAmbush.description = _cleanDescription(newAmbush.description);

			// Set updated ambush
			goblin.ambush[index] = newAmbush;
			goblin.ambushEmitter.emit(
				'change',
				{
					type: 'update',
					oldValue: JSONfn.clone(current),
					value: JSONfn.clone(goblin.ambush[index])
				}
			);
		}
	} else {
		logger('AMBUSH_UPDATE_INVALID_REFERENCE');
	}

	return true;
}
189299
function updateValues(id, withoutStep) {
                if (!withoutStep) {
                    margin = (areaLength - totalLength - itemLength) / 2;
                    if (margin < posMin) {
                        margin = (areaLength - itemLength) / 2;
                        totalLength = 0;
                        step++;
                    }
                }
                steps[id] = step;
                margins[step] = $$.isLegendInset ? 10 : margin;
                offsets[id] = totalLength;
                totalLength += itemLength;
            }
1094339
public function updateRating($id, $data)
    {
        $rating = static::find($id);
        $rating->update($data);

        return $rating;
    }
1208154
def update_score(self, node, addToScore):
        
        current_score = 0
        score_string = self.parser.getAttribute(node, 'gravityScore')
        if score_string:
            current_score = int(score_string)

        new_score = current_score + addToScore
        self.parser.setAttribute(node, "gravityScore", str(new_score))
829725
function scoreCandidate (node, contentScore, candidates) {
  let score
  if (typeof node.data('readabilityScore') === 'undefined') {
    score = initializeNode(node)
    candidates.push(node)
  } else {
    score = node.data('readabilityScore') || 0
  }
  node.data('readabilityScore', score + contentScore)
}
1321160
def add_or_update(user_id, app_id, value):
        '''
        
        '''
        rec = MEvaluation.get_by_signature(user_id, app_id)
        if rec:
            entry = TabEvaluation.update(
                value=value,
            ).where(TabEvaluation.uid == rec.uid)
            entry.execute()
        else:
            TabEvaluation.create(
                uid=tools.get_uuid(),
                user_id=user_id,
                post_id=app_id,
                value=value,
            )
238280
function addUpdated(results) {
  results.forEach(function(result) {
    result = normalizeResult(result);
    if (!lastQuery.results.hits) {
      lastQuery = { results: { hits: { total : 0, hits: [] } } };
    } else {
      var i = 0, l = lastQuery.results.hits.hits.length;
      for (i; i < l; i++) {
        if (lastQuery.results.hits.hits[i]._source.uri === result._source.uri) {
          lastQuery.results.hits.hits.splice(i, 1);
          break;
        }
      }
    }
    lastQuery.results.hits.hits.unshift(result);
  });
  updateResults(lastQuery);
}
976782
public void updateRepeatNumber(int id, Integer repeatNumber) {
        PreparedStatement statement = null;
        try (Connection sqlConnection = sqlService.getConnection()) {

            String queryString = "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                " SET " + Constants.ENABLED_OVERRIDES_REPEAT_NUMBER + "= ? " +
                " WHERE " + Constants.GENERIC_ID + " = ?";
            statement = sqlConnection.prepareStatement(queryString);
            statement.setInt(1, repeatNumber);
            statement.setInt(2, id);
            statement.executeUpdate();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
563372
protected ScoreResult computeScore(DBIDs ids, DBIDs outlierIds, OutlierResult or) throws IllegalStateException {
    if(scaling instanceof OutlierScaling) {
      OutlierScaling oscaling = (OutlierScaling) scaling;
      oscaling.prepare(or);
    }

    final ScalingFunction innerScaling;
    // If we have useful (finite) min/max, use these for binning.
    double min = scaling.getMin();
    double max = scaling.getMax();
    if(Double.isInfinite(min) || Double.isNaN(min) || Double.isInfinite(max) || Double.isNaN(max)) {
      innerScaling = new IdentityScaling();
      // TODO: does the outlier score give us this guarantee?
      LOG.warning("JudgeOutlierScores expects values between 0.0 and 1.0, but we don't have such a guarantee by the scaling function: min:" + min + " max:" + max);
    }
    else {
      if(min == 0.0 && max == 1.0) {
        innerScaling = new IdentityScaling();
      }
      else {
        innerScaling = new LinearScaling(1.0 / (max - min), -min);
      }
    }

    double posscore = 0.0;
    double negscore = 0.0;
    // fill histogram with values of each object
    for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
      double result = or.getScores().doubleValue(iter);
      result = innerScaling.getScaled(scaling.getScaled(result));
      posscore += (1.0 - result);
    }
    for(DBIDIter iter = outlierIds.iter(); iter.valid(); iter.advance()) {
      double result = or.getScores().doubleValue(iter);
      result = innerScaling.getScaled(scaling.getScaled(result));
      negscore += result;
    }
    posscore /= ids.size();
    negscore /= outlierIds.size();

    LOG.verbose("Scores: " + posscore + " " + negscore);

    ArrayList<double[]> s = new ArrayList<>(1);
    s.add(new double[] { (posscore + negscore) * .5, posscore, negscore });
    return new ScoreResult(s);
  }
452406
def update(postid, userid, rating):
        '''
        
        '''
        rating_recs = TabRating.select().where(
            (TabRating.post_id == postid) & (TabRating.user_id == userid)
        )
        if rating_recs.count() > 0:
            MRating.__update_rating(rating_recs.get().uid, rating)
        else:
            MRating.__insert_data(postid, userid, rating)
1313236
function() {
      // load a level
        me.levelDirector.loadLevel("map1");

        // reset the score
        game.data.score = 0;

        // add our HUD to the game world
        if (typeof this.HUD === "undefined") {
            this.HUD = new game.HUD.UIContainer();
        }
        me.game.world.addChild(this.HUD);

        // display if debugPanel is enabled or on mobile
        if ((me.plugins.debugPanel && me.plugins.debugPanel.panel.visible) || me.device.touch) {
            if (typeof this.virtualJoypad === "undefined") {
                this.virtualJoypad = new game.HUD.VirtualJoypad();
            }
            me.game.world.addChild(this.virtualJoypad);
        }

        // play some music
        me.audio.playTrack("dst-gameforest");
    }