Capture shot

@method capture

@param {String} location
@param {Function} callback
@return void
779037
function( location, callback ) {

        var scope = this;

        if(
            location === null
            && scope.opts.callbackReturn ===
                Webcam.CallbackReturnTypes.buffer
        ) {

            console.warn(
                "If capturing image in memory\
                your callback return type cannot be the location"
            );

            scope.opts.callbackReturn = "buffer";

        }

        var fileType = Webcam.OutputTypes[ scope.opts.output ];

        var location = location === null
            ? null
            : ( location.match( /\..*$/ )
                ? location
                : location + "." + fileType
            );


        //Shell statement grab

        var sh = scope.generateSh( location );

        if( scope.opts.verbose ) {

            console.log( sh );

        }


        //Shell execute

        var shArgs = {
            maxBuffer: 1024 * 10000
        };

        EXEC( sh, shArgs, function( err, out, derr ) {

            if( err ) {

                return callback && callback( err );

            }

            if( scope.opts.verbose && derr ) {

                console.log( derr );

            }


            //Run validation overrides

            var validationErrors;

            if( validationErrors = scope.runCaptureValidations( derr ) ) {

                return callback && callback( validationErrors );

            }


            //Callbacks

            var shot = scope.createShot( location, derr );

            if( scope.opts.saveShots ) {

                scope.shots.push( shot );

            }

            scope.dispatch({ type: "capture", shot: shot });

            callback && (
                scope.handleCallbackReturnType( callback, shot )
            );

        });

    }
631560
function(callback) {
      populatedSnapshot = true;
      loadConfig(app,
                 apimanager,
                 models,
                 currdir,
                 snapdir,
                 snapshotID,
                 callback);
    }
265621
function reverseGeocode(location, callback) {
  var latlng = util.format("%s,%s", location.lat, location.lng)
    , query = qs.stringify({ latlng: latlng, sensor: false })
    , reqtmpl = "http://maps.googleapis.com/maps/api/geocode/json?%s"
    , req = util.format(reqtmpl, query)
    , geo
    ;
  
  request(req, function(err, res, body) {
    if (err) {
      console.log('ERROR: ' + err);
      return callback(err);
    }

    console.log(body);

    geo = parseGoogleGeocodes(JSON.parse(body));

    if (!geo) {
      return callback("can't determine address");
    } else {
      return callback(null, geo);
    }
  });
}
197002
function makeWrappedCallback(callback, frameLocation) {
        // add a fake stack frame. we can't get a real one since we aren't inside the original function
        var traceError = new Error();
        traceError.__location = frameLocation;
        traceError.__previous = currentTraceError;
        return function() {
            // if (currentTraceError) {
            //     FIXME: This shouldn't normally happen, but it often does. Do we actually need a stack instead?
            //     console.warn("(long-stack-traces) Internal Error: currentTrace already set.");
            // }
            // restore the trace
            currentTraceError = traceError;
            try {
                return callback.apply(this, arguments);
            } catch (e) {
                console.error("Uncaught " + e.stack);
                if (LST.rethrow)
                    throw ""; // TODO: throw the original error, or undefined?
            } finally {
                // clear the trace so we can check that none is set above.
                // TODO: could we remove this for slightly better performace?
                currentTraceError = null;
            }
        }
    }
630929
function(callback) {
        var self = this;
        var guid = guidFor(this);

        Ember.$(window).on('hashchange.ember-location-'+guid, function() {
          run(function() {
            var path = self.getURL();
            if (get(self, 'lastSetURL') === path) { return; }

            set(self, 'lastSetURL', null);

            callback(path);
          });
        });
      }
620962
function capture (instance, index, list) {
  if (process.env.NODE_ENV !== 'production') {
    captureCount++
  }

  if (instance.$options && instance.$options.abstract && instance._vnode && instance._vnode.componentInstance) {
    instance = instance._vnode.componentInstance
  }

  // Functional component.
  if (instance.fnContext && !instance.componentInstance) {
    const contextUid = instance.fnContext.__VUE_DEVTOOLS_UID__
    let id = functionalIds.get(contextUid)
    if (id == null) {
      id = 0
    } else {
      id++
    }
    functionalIds.set(contextUid, id)
    const functionalId = contextUid + ':functional:' + id
    markFunctional(functionalId, instance)
    return {
      id: functionalId,
      functional: true,
      name: getInstanceName(instance),
      renderKey: getRenderKey(instance.key),
      children: (instance.children ? instance.children.map(
        child => child.fnContext
          ? captureChild(child)
          : child.componentInstance
            ? capture(child.componentInstance)
            : undefined
      )
        // router-view has both fnContext and componentInstance on vnode.
        : instance.componentInstance ? [capture(instance.componentInstance)] : []).filter(Boolean),
      inactive: false,
      isFragment: false // TODO: Check what is it for.
    }
  }
  // instance._uid is not reliable in devtools as there
  // may be 2 roots with same _uid which causes unexpected
  // behaviour
  instance.__VUE_DEVTOOLS_UID__ = getUniqueId(instance)

  // Dedupe
  if (captureIds.has(instance.__VUE_DEVTOOLS_UID__)) {
    return
  } else {
    captureIds.set(instance.__VUE_DEVTOOLS_UID__, undefined)
  }

  mark(instance)
  const name = getInstanceName(instance)

  const ret = {
    uid: instance._uid,
    id: instance.__VUE_DEVTOOLS_UID__,
    name,
    renderKey: getRenderKey(instance.$vnode ? instance.$vnode['key'] : null),
    inactive: !!instance._inactive,
    isFragment: !!instance._isFragment,
    children: instance.$children
      .filter(child => !child._isBeingDestroyed)
      .map(capture)
      .filter(Boolean)
  }

  if (instance._vnode && instance._vnode.children) {
    ret.children = ret.children.concat(
      flatten(instance._vnode.children.map(captureChild))
        .filter(Boolean)
    )
  }

  // record screen position to ensure correct ordering
  if ((!list || list.length > 1) && !instance._inactive) {
    const rect = getInstanceOrVnodeRect(instance)
    ret.top = rect ? rect.top : Infinity
  } else {
    ret.top = Infinity
  }
  // check if instance is available in console
  const consoleId = consoleBoundInstances.indexOf(instance.__VUE_DEVTOOLS_UID__)
  ret.consoleId = consoleId > -1 ? '$vm' + consoleId : null
  // check router view
  const isRouterView2 = instance.$vnode && instance.$vnode.data.routerView
  if (instance._routerView || isRouterView2) {
    ret.isRouterView = true
    if (!instance._inactive && instance.$route) {
      const matched = instance.$route.matched
      const depth = isRouterView2
        ? instance.$vnode.data.routerViewDepth
        : instance._routerView.depth
      ret.matchedRouteSegment =
        matched &&
        matched[depth] &&
        (isRouterView2 ? matched[depth].path : matched[depth].handler.path)
    }
  }
  return ret
}
377886
def capture(rect=None, filepath='', prompt=True, hideWindow=None):
        
        widget = XSnapshotWidget(QApplication.desktop())
        widget.setRegion(rect)
        widget.setHideWindow(hideWindow)
        widget.setFilepath(filepath)
        widget.move(1, 1)
        widget.resize(QApplication.desktop().size())
        
        if prompt or not filepath:
            widget.show()
        else:
            widget.save()
63496
function(location, name) {
  
  this.location = location;
  this.name = name;

  if (this.isUrl(location)) {
    if (this.name)
      this.name = require('sanitize-filename')(this.name, {replacement: '_'});
    if (typeof window === 'undefined')
      this.request = require('request').defaults({headers: {'User-Agent': 'limberest'}});
    else
      this.request = require('browser-request');
  }
  else {
    this.storage = new Storage(this.location, this.name);    
  }

  this.path = this.location;
  if (this.name)
    this.path += '/' + this.name;
}
242945
def shot_save_callback(self, *args, **kwargs):
        
        tasksel = self.browser.shotbrws.selected_indexes(2)
        if not tasksel or not tasksel[0].isValid():
            self.statusbar.showMessage('No task selected! Cannot save!')
            return

        taskitem = tasksel[0].internalPointer()
        task = taskitem.internal_data()
        rtype = djadapter.RELEASETYPES['work']
        descriptor = self.shot_descriptor_le.text()
        if not self.check_selection_for_save(task, rtype, descriptor):
            return

        tfi = TaskFileInfo.get_next(task=task, releasetype=rtype,
                                    typ=self._filetype, descriptor=descriptor)
        self._save_tfi(tfi)
1257112
public void getLocation(String key, LocationCallback callback) {
        DatabaseReference keyRef = this.getDatabaseRefForKey(key);
        LocationValueEventListener valueListener = new LocationValueEventListener(callback);
        keyRef.addListenerForSingleValueEvent(valueListener);
    }
363791
function msGotPointerCapture(inEvent) {
  const e = this.dispatcher.makeEvent('gotpointercapture', inEvent, inEvent);
  this.dispatcher.dispatchEvent(e);
}
1167555
function( callback, shot ) {

        var scope = this;

        switch( scope.opts.callbackReturn ) {

            case Webcam.CallbackReturnTypes.location:

                return callback( null, shot.location );


            case Webcam.CallbackReturnTypes.buffer:

                return scope.getShotBuffer( shot, callback );


            case Webcam.CallbackReturnTypes.base64:

                return scope.getBase64( shot, callback );

            default:

                return callback(
                    new Error(
                        "Callback return type not valid " + scope.opts.callbackReturn
                    )
                );

        }

    }
596615
function CaptureTimeoutLauncher (timer, captureTimeout) {
  if (!captureTimeout) {
    return
  }

  let pendingTimeoutId = null

  this.on('start', () => {
    pendingTimeoutId = timer.setTimeout(() => {
      pendingTimeoutId = null
      if (this.state !== this.STATE_BEING_CAPTURED) {
        return
      }

      log.warn(`${this.name} have not captured in ${captureTimeout} ms, killing.`)
      this.error = 'timeout'
      this.kill()
    }, captureTimeout)
  })

  this.on('done', () => {
    if (pendingTimeoutId) {
      timer.clearTimeout(pendingTimeoutId)
      pendingTimeoutId = null
    }
  })
}
858083
function runGetFeature(callback) {
  var next = _.after(2, callback);
  function featureCallback(error, feature) {
    if (error) {
      callback(error);
      return;
    }
    if (feature.name === '') {
      console.log('Found no feature at ' +
          feature.location.latitude/COORD_FACTOR + ', ' +
          feature.location.longitude/COORD_FACTOR);
    } else {
      console.log('Found feature called "' + feature.name + '" at ' +
          feature.location.latitude/COORD_FACTOR + ', ' +
          feature.location.longitude/COORD_FACTOR);
    }
    next();
  }
  var point1 = {
    latitude: 409146138,
    longitude: -746188906
  };
  var point2 = {
    latitude: 0,
    longitude: 0
  };
  client.getFeature(point1, featureCallback);
  client.getFeature(point2, featureCallback);
}
233656
function writeLocationFile(location) {
  console.log('Writing location.js file')
  if (getTargetPlatform() === 'win32') {
    location = location.replace(/\\/g, '\\\\')
  }

  var platform = getTargetPlatform()
  var arch = getTargetArch()

  var contents = 'module.exports.location = "' + location + '"\n'

  if (/^[a-zA-Z0-9]*$/.test(platform) && /^[a-zA-Z0-9]*$/.test(arch)) {
    contents +=
        'module.exports.platform = "' + getTargetPlatform() + '"\n' +
        'module.exports.arch = "' + getTargetArch() + '"\n'
  }

  fs.writeFileSync(path.join(libPath, 'location.js'), contents)
}
1010740
def stop_capture(self):
        """"""
        self._populate_coordinates()
        self.canvas.setMapTool(self.previous_map_tool)
        self.show()
1279181
function () {
                        var encodingProperties = Windows.Media.MediaProperties.ImageEncodingProperties.createJpeg(),
                            overwriteCollisionOption = Windows.Storage.CreationCollisionOption.replaceExisting,
                            tempFolder = Windows.Storage.ApplicationData.current.temporaryFolder;

                        tempFolder.createFileAsync("cameraCaptureImage.jpg", overwriteCollisionOption).done(function (capturedFile) {
                            capture.capturePhotoToStorageFileAsync(encodingProperties, capturedFile).done(function () {
                                // store intermediate result in object's global variable
                                capturedPictureFile = capturedFile;
                                // show pre-captured image and toggle visibility of all buttons
                                previewContainer.style.backgroundImage = 'url("' + 'ms-appdata:///temp/' + capturedFile.name + '")';
                                toggleElements('capturePreview', 'takePicture', 'cancelCapture', 'selectPicture', 'retakePicture');
                            }, function (err) {
                                destroyCameraPreview();
                                errorCallback(CaptureError.CAPTURE_INTERNAL_ERR, err);
                            });
                        }, function (err) {
                            destroyCameraPreview();
                            errorCallback(CaptureError.CAPTURE_INTERNAL_ERR, err);
                        });
                    }