Adds sample data to the database.
@return {!IThenable}
345174
function addSampleData() {
  return Promise.all([
    insertPersonData('actor.json', db.getSchema().table('Actor')),
    insertPersonData('director.json', db.getSchema().table('Director')),
    insertData('movie.json', db.getSchema().table('Movie')),
    insertData('movieactor.json', db.getSchema().table('MovieActor')),
    insertData('moviedirector.json', db.getSchema().table('MovieDirector')),
    insertData('moviegenre.json', db.getSchema().table('MovieGenre'))
  ]).then(function(queries) {
    var tx = db.createTransaction();
    return tx.exec(queries);
  });
}
1095262
function()
    {
        var q = new Queryable(this._T, this.dataService);

        var _this = this;

        for (var key in this) {
            if (_(this[key]).isArray())
                q[key] = _(this[key]).clone();
            else
                q[key] = this[key];
        }

        return q;
    }
780301
public function _add() {
		$model = $this->model;
		$instance = new $model ();
		$this->operate_ ( $instance, function ($instance) {
			$datas = $this->getDatas ();
			$this->_setValuesToObject ( $instance, $datas );
			if ($this->_validateInstance ( $instance, $datas )) {
				return $this->AddOperation ( $instance, $datas, true );
			}
			return null;
		}, "inserted", "Unable to insert the instance", [ ] );
	}
350774
function () {
            if (!this.__schemaDataset) {
                var ds = this.db.from(this.table), self = this;
                return this.__createTable().chain(function () {
                    return (self.__schemaDataset = ds);
                });
            } else {
                return when(this.__schemaDataset);
            }
        }
206051
function databaseInitialize() {
  var entries = db.getCollection("entries");
  var messages = db.getCollection("messages");

  // Add our main example collection if this is first run.
  // This collection will save into a partition named quickstart3.db.0 (collection 0)  
  if (entries === null) {
    // first time run so add and configure collection with some arbitrary options
    entries = db.addCollection("entries");
  }

  if (messages === null) {
    messages = db.addCollection("messages");
    messages.insert({ txt: "i will only insert into this collection during databaseInitialize" });
  }
}
1099202
async function tryExample () {
  // Use the connected resource
  const {User} = db.resources
  let user = await User.create({username: 'Black Fire', password: 'Super Cool'})
  /* ... */
}
550843
function (options, callback) {
			var sampleImageCategories = ['abstract', 'animals', 'business', 'cats', 'city', 'food', 'nature', 'technics', 'transport'];
			var numItems = 200;

			// build dataSource based with options
			var resp = {
				count: numItems,
				items: [],
				pages: (Math.ceil(numItems / (options.pageSize || 30))),
				page: options.pageIndex
			};

			// get start and end limits for JSON
			var i, l;
			i = options.pageIndex * (options.pageSize || 30);
			l = i + (options.pageSize || 30);
			resp.start = i + 1;
			resp.end = l;

			// add sample items to datasource
			for (i; i < l; i++) {
				resp.items.push({
					name: ('Thumbnail ' + (i + 1)),
					src: 'http://lorempixel.com/65/65/' + sampleImageCategories[Math.floor(Math.random() * 9)] + '/?_=' + i
				});
			}

			// call and simulate latency
			setTimeout(function () {
				callback(resp);
			}, loadDelays[Math.floor(Math.random() * 4)]);
		}
680388
function databaseInitialize() {
  var users = db.getCollection("users");

  // on first run, this will be null so add collection
  if (!users) {
    users = db.addCollection("users");
  }

  // add simple 1 step 'females' transform on first run
  if (!users.getTransform("females")) {
    users.addTransform("females", [{ type: 'find', value: { gender: 'f' }}]);
  }
  
  // simple parameterized document paging transform
  if (!users.getTransform("paged")) {
    users.addTransform("paged", [
      {
        type: 'offset',
        value: '[%lktxp]pageStart'
      },
      {
        type: 'limit',
        value: '[%lktxp]pageSize'
      }
    ]);
  }

  // let's keep the dynamic view from dynview example without its sort
  if (!users.getDynamicView("over 500")) {
    let ov500 = users.addDynamicView("over 500");
    ov500.applyFind({ age: { $gte : 500 } });
  }

  // for this example we will also seed data on first run
  if (users.count() === 0) {
    seedData();
  }
  
  // at this point all collections, transforms and dynamic view should exist 
  // so go ahead and run your program logic
  runProgramLogic();
}
126393
def _add_externalData(self):
        
        externalData = self._new_externalData()
        externalData._add_autoUpdate(val=False)
        self._insert_externalData(externalData)
        return externalData
1092292
public void addSample(double[] sampleData) {
		if (sampleIndex >= numSamples)
			throw new IllegalArgumentException("Too many samples");
		if (sampleData.length != sampleSize)
			throw new IllegalArgumentException("Unexpected sample size");

		for (int i = 0; i < sampleData.length; i++) {
			A.set(sampleIndex, i, sampleData[i]);
		}
		sampleIndex++;
	}
1036800
public Data addAll(Iterable<Property> toAdd) {
        return !Iterables.isEmpty(toAdd)
               ? new Data(Stream.concat(properties.stream(), StreamSupport.stream(toAdd.spliterator(), false)).collect(Collectors.toList()))
               : this;
    }
517522
function createDatabase (name) {
  var deferred = q.defer();

  // Make sure the database location exists
  ready.then(function () {
    // Check if database exists
    fs.exists(globalConfig.db.location + name + '.db.json', function (exists) {
      if(exists) return deferred.resolve();

      // If database is non-existent, simply write an empty object as placeholder
      fs.writeFile(globalConfig.db.location + name + '.db.json', '{}', function (err) {
        if(err) return deferred.reject('Database couldn\'t create table');

        return deferred.resolve();
      });
    });
  }, function () {
    deferred.reject('Database couldn\'t instantiate');
  });

  return deferred.promise;
}
1354286
public void addSample( double[] sampleData ) {
        if( A.getNumCols() != sampleData.length )
            throw new IllegalArgumentException("Unexpected sample size");
        if( sampleIndex >= A.getNumRows() )
            throw new IllegalArgumentException("Too many samples");

        for( int i = 0; i < sampleData.length; i++ ) {
            A.set(sampleIndex,i,sampleData[i]);
        }
        sampleIndex++;
    }
453779
def append_sample(self, **kwargs) -> 'Seeding':
        
        data = {
            'seed': random.randint(0, 1000000)
        }
        data.update(kwargs)

        return self._append_seed(SEED_TYPE_SAMPLE, data)
926683
function() {
			this.states.add([
				new wp.media.controller.Library({
					id: 'insert',
					title: this.options.title,
					selection: this.options.selection,
					priority: 20,
					toolbar: 'main-insert',
					filterable: this.options.filterable,
					searchable: this.options.searchable,
					library: wp.media.query( this.options.query ),
					multiple: this.options.multiple,
					editable: this.options.editable,
					displaySettings: this.options.displaySettings,
					displayUserSettings: this.options.displayUserSettings
				}),

				new wp.media.controller.EditImage({ model: this.options.editImage })
			]);
		}
1071603
public void addSample(int[] sample, SP lastProperty) {
        S target = getOrCreateState(sample);
        if (!target.tryMergeStateProperty(lastProperty)) {
            throw new IllegalStateException();
        }
    }
1336434
function (object) {
            object.id = object.id || this.generateId();
            this.data.push(object);
            this.mapValues[object.id] = {};
            this.eachMap(function (map, mapName) {
                this.addObjectToMap(mapName, object);
            });
            return this;
        }