Questions tagged [seed]

Seed is a JavaScript interpreter and a library of the GNOME project.

632 questions
35
votes
6 answers

How can I use FactoryBot in db/seeds?

Is it possible to do this? If so, how can you do it? Note: FactoryBot was previously named FactoryGirl
fespinozacast
  • 2,484
  • 4
  • 23
  • 38
35
votes
14 answers

Seeding users with Devise in Ruby on Rails

In my development and test environments, I want to seed the database with a bunch of users. I'm using Ruby on Rails v3.2.8 and the latest Devise. So I added this line in my db/seeds.rb file: User.create(email: 'test@example.com',…
at.
  • 50,922
  • 104
  • 292
  • 461
32
votes
3 answers

What's the benefit of seeding a random number generator with only prime numbers?

While conducting some experiments in Java, my project supervisor reminded me to seed each iteration of the experiment with a different number. He also mentioned that I should use prime numbers for the seed values. This got me thinking — why primes?…
Dhruv Gairola
  • 9,102
  • 5
  • 39
  • 43
31
votes
2 answers

How to start writing Gnome Shell extensions

I have found it's very hard to find documentation about Gnome Shell Extensions. I found some bits on Gnome Wiki (and it's first-level links), but it's not much: http://live.gnome.org/GnomeShell/Extensions The problem here is GJS and it's bindings.…
lzap
  • 16,417
  • 12
  • 71
  • 108
31
votes
6 answers

Seeding file uploads with CarrierWave, Rails 3

I'm trying to seed a database in Rails 3 with images using CarrierWave, however nothing I try seems to work short of having to upload them all by hand. pi = ProductImage.new(:product => product) pi.image = File.open(File.join(Rails.root,…
Nathan Kleyn
  • 5,103
  • 3
  • 32
  • 49
26
votes
2 answers

How to create SecurityStamp for AspNetUser in ASP .NET MVC 5

When I create user by Register action whe application is running the application user gets SecurityStamp. When I add user by: if (!context.Users.Any()) { System.Diagnostics.Debug.WriteLine("INSIDE"); var hasher = new…
Yoda
  • 17,363
  • 67
  • 204
  • 344
25
votes
2 answers

Why is seeding the random generator not stable between versions of Python?

I am trying to reproduce a random sequence from python's random.random() on a different system with a different python3 version installed. This should be easy as the documentation says: Most of the random module’s algorithms and seeding functions…
Peter Smit
  • 27,696
  • 33
  • 111
  • 170
22
votes
3 answers

Python's random: What happens if I don't use seed(someValue)?

a)In this case does the random number generator uses the system's clock (making the seed change) on each run? b)Is the seed used to generate the pseudo-random values of expovariate(lambda)?
andandandand
  • 21,946
  • 60
  • 170
  • 271
21
votes
8 answers

How to get current seed from C++ rand()?

I generate a few thousand object in my program based on the C++ rand() function. Keeping them in the memory would be exhaustive. Is there a way to copy the CURRENT seed of rand() at any given time? This would give me the opportunity to store ONLY…
user1339629
  • 213
  • 1
  • 2
  • 6
20
votes
3 answers

How to seed data when using Model First approach?

So I am learning MVC3 and EF4. I tried the code first method but it was too confusing for me.. I can create the classes no problem, but the hard part comes when dealing with foreign keys and the relationships between each other. But I've gone with…
masfenix
  • 7,736
  • 11
  • 45
  • 60
18
votes
4 answers

Does every machine generate same result of random number by using the same seed?

I'm current stuck in the random generator. The requirement specification shows a sample like this: Random rand = new Random(3412); The rand result is not directly given out, but used for other performance. I'd written the same code as above to…
Ivan Li
  • 1,850
  • 4
  • 19
  • 23
17
votes
4 answers

Execute sql script inside seed.rb in rails3

I want to execute this sql script inside my seed.rb LOAD DATA LOCAL INFILE '/home/list-38.csv' INTO TABLE list FIELDS TERMINATED BY ':' LINES TERMINATED BY '\n' (email,name,password); I checked this link but unable to figure out the solution.So…
Bijendra
  • 9,467
  • 8
  • 39
  • 66
16
votes
2 answers

Rails: Make this rake task aware that it is in the test environment

I have the following rake task defined in my lib/tasks folder: namespace :db do namespace :test do task :prepare => :environment do Rake::Task["db:seed"].invoke end end end Now, what this does is seed the test DB when I run rake…
Andrew
  • 42,517
  • 51
  • 181
  • 281
16
votes
3 answers

Independent instances of 'random'

The below code attempts to illustrate what I want. I basically want two instances of "random" that operate independently of each other. I want to seed "random" within one class without affecting "random" in another class. How can I do that? class…
Lin
  • 5,235
  • 8
  • 31
  • 30
16
votes
2 answers

Using Paperclip within seeds.rb

Let's says I have the following entry in my seeds.rb file : Image.create(:id => 52, :asset_file_name => "somefile.jpg", :asset_file_size => 101668, :asset_content_type => "image/jpeg", :product_id => 52) If I seed it, it tries to process the image…
Ben
  • 5,030
  • 6
  • 53
  • 94
1
2
3
42 43