Updates all of the global catalogs
@param onProgress
@returns {Promise.<>}
182034
function(onProgress) {
        const errorHandler = function(err) {
            if(err instanceof Error) {
                return Promise.reject(err);
            } else {
                return Promise.resolve();
            }
        };

        // TRICKY: the language catalogs are dependent so we must run them in order
        return updateCatalog('langnames', onProgress)
            .catch(errorHandler)
            .then(function(response) {
                return updateCatalog('temp-langnames', onProgress);
            })
            .catch(errorHandler)
            .then(function(response) {
                return updateCatalog('approved-temp-langnames', onProgress);
            })
            .catch(errorHandler)
            .then(function(response) {
                return updateCatalog('new-language-questions', onProgress)
            })
            .catch(errorHandler)
            .then(function() {
                return Promise.resolve();
            });
    }
1223848
public void setProgress(int progress) {
        if (mProgress != progress) {
            mProgress = progress;
            if (mOnCircularSeekBarChangeListener != null) {
                mOnCircularSeekBarChangeListener.onProgressChanged(this, progress, false);
            }

            recalculateAll();
            invalidate();
        }
    }
319398
function(file) {
      var deferred = $q.defer();

      var reader = angular.extend(new FileReader(), {
        onload: function(e) {
          deferred.resolve(e.target.result);
          if (!$rootScope.$$phase) $rootScope.$apply();
        },
        onerror: function(e) {
          deferred.reject(e);
          if (!$rootScope.$$phase) $rootScope.$apply();
        },
        onabort: function(e) {
          deferred.reject(e);
          if (!$rootScope.$$phase) $rootScope.$apply();
        }
        // onprogress: Gee, it'd be great to get some progress support from $q...
      });
      reader.readAsDataURL(file);

      return angular.extend(deferred.promise, {
        abort: function() { reader.abort(); }
      });
    }
989589
function createGlobalFolder() {
        var deferred = Q.defer();

        // Create the results folder if it doesn't exist
        fs.exists(resultsDir, function(exists) {
            if (exists) {
                deferred.resolve();
            } else {
                debug('Creating the global results folder', resultsDir);
                fs.mkdir(resultsDir, function(err) {
                    if (err) {
                        deferred.reject(err);
                    } else {
                        deferred.resolve();
                    }
                });
            }
        });

        return deferred.promise;
    }
717794
function handleProgress() {
                        
      var textSoFar = xhr.responseText,
          newText = textSoFar.substr(numberOfCharsAlreadyGivenToCallback);
      
      
      /* Raise the event for new text.
      
         On older browsers, the new text is the whole response. 
         On newer/better ones, the fragment part that we got since 
         last progress. */
         
      if( newText ) {
         emitStreamData( newText );
      } 

      numberOfCharsAlreadyGivenToCallback = len(textSoFar);
   }
1298718
function (objs, cb) {

      var results = []
        ,   done = false
        ,   self = this

      var updateProgress = function(obj) {
        results.push(obj)
        done = results.length === objs.length
      }

      var checkProgress = setInterval(function() {
        if (done) {
          if (cb) self.lambda(cb).call(self, results)
          clearInterval(checkProgress)
        }
      }, 200)

      for (var i = 0, l = objs.length; i < l; i++)
        this.save(objs[i], updateProgress)

      return this
    }
290084
function _gpfStreamSecureInstallProgressFlag(constructor) {
        constructor.prototype[_gpfStreamProgressRead] = false;
        constructor.prototype[_gpfStreamProgressWrite] = false;
    }
579671
function preloader( items, preloadFunction, callback ) {

    var itemc = items.length;
    var loadc = 0;

    // called by preloadFunction to notify result
    function _check( err, id ) {
        updateProgress(1);
        if ( err ) {
            alert('Failed to load ' + id + ': ' + err);
        }
        loadc++;
        if ( itemc == loadc ) callback();
    }

    progressTotalCount += items.length;

    // queue each item for fetching
    items.forEach(function(item) {
        preloadFunction( item, _check);
    });
}
425242
protected function resolver(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
    {
        return function ($resolve, $reject, $notify) use ($onFulfilled, $onRejected, $onProgress) {
            if ($onProgress) {
                $progressHandler = function ($update) use ($notify, $onProgress) {
                    try {
                        $notify($onProgress($update), $this->sharedData);
                    } catch (\Throwable $e) {
                        $notify($e, $this->sharedData);
                    }
                };
            } else {
                $progressHandler = $notify;
            }

            $this->handlers[] = function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject, $progressHandler) {
                $promise
                    ->then($onFulfilled, $onRejected)
                    ->done($resolve, $reject, $progressHandler);
            };

            $this->progressHandlers[] = $progressHandler;
        };
    }
194831
function preloader(items, preloadFunction, callback) {

    var itemc = 0;
    var loadc = 0;

    // called by preloadFunction to notify result
    function _check(err, id) {
        updateProgress(1);
        if (err) {
            alert('Failed to load ' + id + ': ' + err);
        }
        loadc++;
        if (itemc == loadc) callback();
    }

    if (items.constructor == Array) {
        itemc = items.length;
        loadc = 0;
        progressTotalCount += items.length;
        // queue each item for fetching
        items.forEach(function (item) {
            preloadFunction(item, _check);
        });
    } else {
        // object
        for (var key in items) {
            itemc++;
            progressTotalCount++;
            preloadFunction(items[key], _check);
        }
    }
}
712421
@SuppressWarnings("unchecked")
    synchronized void update(CatalogContext catalogContext) {
        CatalogMap<Procedure> procedures = catalogContext.database.getProcedures();

        Map<String, ProcedureRunnerNTGenerator> runnerGeneratorMap = new TreeMap<>();

        for (Procedure procedure : procedures) {
            if (procedure.getTransactional()) {
                continue;
            }

            // this code is mostly lifted from transactional procedures
            String className = procedure.getClassname();
            Class<? extends VoltNonTransactionalProcedure> clz = null;
            try {
                clz = (Class<? extends VoltNonTransactionalProcedure>) catalogContext.classForProcedureOrUDF(className);
            } catch (ClassNotFoundException e) {
                if (className.startsWith("org.voltdb.")) {
                    String msg = String.format(LoadedProcedureSet.ORGVOLTDB_PROCNAME_ERROR_FMT, className);
                    VoltDB.crashLocalVoltDB(msg, false, null);
                }
                else {
                    String msg = String.format(LoadedProcedureSet.UNABLETOLOAD_ERROR_FMT, className);
                    VoltDB.crashLocalVoltDB(msg, false, null);
                }
            }

            // The ProcedureRunnerNTGenerator has all of the dangerous and slow
            // stuff in it. Like classfinding, instantiation, and reflection.
            ProcedureRunnerNTGenerator prntg = new ProcedureRunnerNTGenerator(clz);
            runnerGeneratorMap.put(procedure.getTypeName(), prntg);
        }

        m_procs = ImmutableMap.<String, ProcedureRunnerNTGenerator>builder().putAll(runnerGeneratorMap).build();

        // reload all sysprocs
        loadSystemProcedures(false);

        // Set the system to start accepting work again now that ebertything is updated.
        // We had to stop because stats would be wonky if we called a proc while updating
        // this stuff.
        m_paused = false;

        // release all of the pending invocations into the real queue
        m_pendingInvocations
            .forEach(pi -> callProcedureNT(pi.ciHandle, pi.user, pi.ccxn, pi.isAdmin,
                     pi.ntPriority, pi.task));
        m_pendingInvocations.clear();
    }
1056016
@Override
  public synchronized void onProgressUpdate(float progress) {
    if (mIsFinished) {
      return;
    }
    try {
      onProgressUpdateImpl(progress);
    } catch (Exception e) {
      onUnhandledException(e);
    }
  }
620345
private void executeGlobalPreprocessing(List<JoinableResourceBundle> bundlesToBuild, boolean processBundleFlag,
			StopWatch stopWatch) {

		stopProcessIfNeeded();

		if (resourceTypePreprocessor != null) {
			if (stopWatch != null) {
				stopWatch.start("Global preprocessing");
			}
			GlobalPreprocessingContext ctx = new GlobalPreprocessingContext(config, resourceHandler, processBundleFlag);
			resourceTypePreprocessor.processBundles(ctx, bundles);

			// Update the list of bundle to rebuild if new bundles have been
			// detected as dirty in the global preprocessing phase
			List<JoinableResourceBundle> currentBundles = getBundlesToRebuild();
			for (JoinableResourceBundle b : currentBundles) {
				if (!bundlesToBuild.contains(b)) {
					bundlesToBuild.add(b);
				}
			}
			if (stopWatch != null) {
				stopWatch.stop();
			}
		}
	}
286569
public void progress(long amount) {
        Entry e = flushedEntry;
        assert e != null;
        ChannelPromise p = e.promise;
        long progress = e.progress + amount;
        e.progress = progress;
        if (p instanceof ChannelProgressivePromise) {
            ((ChannelProgressivePromise) p).tryProgress(progress, e.total);
        }
    }
120480
protected void updateProgressListener(ProgressListener progressListener, Response response) {
        InputStream responseStream = response.getResponseByteStream();

        int bytesDownloaded = 0;
        long totalBytesExpected = response.getContentLength();
        // Reading 2 KiB at a time to be consistent with the upload segment size in ProgressRequestBody
        final int segmentSize = 2048;

        byte[] responseBytes;
        if (totalBytesExpected > Integer.MAX_VALUE) {
            logger.warn("The response body for " + getUrl() + " is too large to hold in a byte array. Only the first 2 GiB will be available.");
            responseBytes = new byte[Integer.MAX_VALUE];
        }
        else {
            responseBytes = new byte[(int)totalBytesExpected];
        }

        // For every 2 KiB downloaded:
        //      1) Call the user's ProgressListener
        //      2) Append the downloaded bytes into a byte array
        int nextByte;
        try {
            while ((nextByte = responseStream.read()) != -1) {
                if (bytesDownloaded % segmentSize == 0) {
                    progressListener.onProgress(bytesDownloaded, totalBytesExpected);
                }
                responseBytes[bytesDownloaded] = (byte)nextByte;
                bytesDownloaded += 1;
            }
        }
        catch (IOException e) {
            logger.error("IO Exception: " + e.getMessage());
        }

        // Transfer the downloaded data to the Response object so that the user can later retrieve it
        if (response instanceof ResponseImpl) {
            ((ResponseImpl)response).setResponseBytes(responseBytes);
        }
    }
57596
function updateExistingItems(groupUi) {
    let itemUi = groupUi.firstElementChild
    while (itemUi) {
      updateItem(itemUi)
      itemUi = itemUi.nextElementSibling
    }
  }
511731
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
    {
        if (null !== $this->result) {
            if ($this->result instanceof PromiseWithSharedDataInterface) {
                _mergeSharedData($this->sharedData, $this->result->sharedData, true);
            }
            return $this->result->then($onFulfilled, $onRejected, $onProgress);
        }

        if (null === $this->canceller) {
            return new static($this->resolver($onFulfilled, $onRejected, $onProgress), null, $this->sharedData);
        }

        // keep a reference to this promise instance for the static canceller function.
        // see also parentCancellerFunction() for more details.
        $parent = $this;
        ++$parent->requiredCancelRequests;

        return new static(
            $this->resolver($onFulfilled, $onRejected, $onProgress),
            self::parentCancellerFunction($parent),
            $this->sharedData
        );
    }