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 RandomSeeded:
def __init__(self, seed):
import random as r1
self.random...
I have a rails project with seeds that are executed using rake db:seed. This in turn loads the RB files in the db/seeds directory which in turn executes something like this:
Fixtures.create_fixtures("db/seeds","projects")
There is a projects.yml in the form
project_name1:
property: value
project_name2:
property: value
In the ...
I'm pretty sure I understand how seeding work with respect to seeds.rb, but I can't seem to use it to stick a restful_authentication User object into the database.
User.create(:login => 'admin',
:role => Role.find_by_name('super_admin'),
:email => '[email protected]',
:password => '123123')
Am I mis...
I have been looking at monotorrent and while investigating the whole bittorrent thing I saw that a torrent file may also specify web seeds, which are basically standard HTTP downloads but which can work e.g. as an initial seed.
I have also seen in the release notes of monotorrent 0.8 that they
Added the ability to easily add webseed...
Is there a way to store the current state of the built in pseudo-random number generator in Perl so that when my program is run again, it can pick up the sequence from where it left off rather than starting with a new sequence?
Right now, I am storing where I am as well as the initial seed and then throwing away the initial segment whic...
I need to run a MonteCarlo simulations in parallel on different machines. The code is in c++, but the program is set up and launched with a python script that set a lot of things, in particular the random seed. The function setseed thake a 4 bytes unsigned integer
Using a simple
import time
setseed(int(time.time()))
is not very good ...
in regard to recursion what is a seed value?
...
I updated my rails gem to 2.3.5 but I keep getting this error when running db:seed:
$ rake db:seed --trace
(in c:/Documents and Settings/Owner/workspace/thepatstudio)
rake aborted!
Don't know how to build task 'db:seed'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1728:in `[]'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake....
Hi
I am trying to figure out the "right" way to do this.
In my application every time I create a new user I want to have specific data loaded into an associated table. The associated table is a different preset lists. So a User has many lists and those lists have many items. Some of those Items I want to be loaded when the User is creat...
As part of teaching myself python I've written a script which allows a user to play hangman. At the moment, the hangman word to be guessed is simply entered manually at the start of the script's code.
I want instead for the script to choose randomly from a large list of english words. This I know how to do - my problem is finding that l...
I am trying to generate a good random seed for a psudo-random number generator. I thought I'd get the expert's opinions. let me know if this is a bad way of doing it or if there are much better ways.
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <ctime>
unsigned int good_seed()
{
unsigned int random_seed, ran...
I have a normalized Database. And i have like 150 Clients that connect to this database and use it as an application. I am wondering if Schemas would make the queries run any faster. Simply because I ran a query on a stripped down database and it ran fast and i ran it on my live database and it was much slower.
Also If i implemented...
Hello,
What is the best way to load seed (initial or test) data into grails application. I'm considering 3 options
Putting everything in *BootStrap.groovy files. This is tedious if the domain classes and test data are many.
Write custom functionality to load it through xml. May not be too difficult with the excellent xml support ...
How do I create a separate seed for some test inside one test class?
PHPUnit documentation includes this example
<?php
require_once 'PHPUnit/Extensions/Database/TestCase.php';
class DatabaseTest extends PHPUnit_Extensions_Database_TestCase
{
protected function getConnection()
{
$pdo = new PDO('mysql:host=localhost;dbna...
I have an XML file containing seed data that I'm trying to load into my production database.
The problem being that I have associations between different data types / nodes in the XML file, and so I need the specified IDs to be the same when loaded into MySQL from Rails.
This works fine with SQLite during development, I just use a line...
Hi - I need to write some junit tests on java code that calls Math.random(). I know that I can set the seed if I was instantiating my own Random object to produce repeatable results. Is there a way to do this also for Math.random() ?
...
I found Seed, which is basically a JavaScript environment and binding for programming GTK+. Are there any limitations compared to using e.g. C and C++? Are there any major speed concerns?
...
To get the seed and step values of an identity column in sql server i can use this syntax
SELECT ColumnName = name, Seed = seed_value, Step = increment_value
FROM sys.identity_columns
So far in MySql i have found that if i use this syntax
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE auto_increment IS NOT NULL
I can at least fi...
Hello,
I got question about IDENTITY_INSERT. When you change it to ON, SQL Server automatically changes AUTOINC_NEXT value to the last inserted value as identity.
So if you got only one row with ID = 1 and insert row with ID = 100 while IDENTITY_INSERT is ON then next inserting row will have ID = 101. I'd like it to be 2 without need ...
I have a lot of data that I'm trying to seed into a polymorphic model in Rails 2.3.8. The association for all of the data is with the County model. The data looks like:
data = Datum.create([
...
{ :value => '14389', :value_type => County, :value_id =>'3103'},
{ :value => '59013', :value_type => County, :value_id =>'3105'},
{ :va...