How to start writing Gnome Shell extensions

GNOME Shell uses GJS, not Seed. There are some differences among both of them, and it might explain why you are having problems. With GOBject Introspection you can read the documentation for the original library and adapt the signature of every method/function to the language you are using. In your particular case, for files, networking, … Read more

Seeding file uploads with CarrierWave, Rails 3

Turns out the documentation for CarrierWave is slightly wrong. There is a more up to date piece of code in the README at the GitHub repository for the project. In a nutshell, though: pi = ProductImage.create!(:product => product) pi.image.store!(File.open(File.join(Rails.root, ‘test.jpg’))) product.product_images << pi product.save!

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

Well one blink at the implementation would show you that he CAN’T have any reason for that claim at all. Why? Because that’s how the set seed function looks like: synchronized public void setSeed(long seed) { seed = (seed ^ multiplier) & mask; this.seed.set(seed); haveNextNextGaussian = false; } And that’s exactly what’s called from the … Read more

How to seed Django project ? – insert a bunch of data into the project for initialization

Similar to Rails, we also have option to seed the database. It is done using management commands. In one of your apps, use the following folder structure <project>/<app>/management/commands/seed.py this makes python manage.py seed available as a management command. I personally follow the following structure. # <project>/<app>/management/commands/seed.py from django.core.management.base import BaseCommand import random # python manage.py … Read more

Seeding users with Devise in Ruby on Rails

You have to do like this: user = User.new user.email=”test@example.com” user.encrypted_password = ‘#$taawktljasktlw4aaglj’ user.save! Read this guide to understand what mass-assignment is: http://guides.rubyonrails.org/security.html I am wondering why do have to directly set the encrypted password. You could do this: user.password = ‘valid_password’ user.password_confirmation = ‘valid_password’

How to seed the production database using the Capistrano gem?

If you are using bundler, then the capistrano task should be: namespace :deploy do desc “reload the database with seed data” task :seed do run “cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}” end end and it might be placed in a separate file, such as lib/deploy/seed.rb and included in your deploy.rb file using following command: … Read more

Java random numbers using a seed

If you’re giving the same seed, that’s normal. That’s an important feature allowing tests. Check this to understand pseudo random generation and seeds: Pseudorandom number generator A pseudorandom number generator (PRNG), also known as a deterministic random bit generator DRBG, is an algorithm for generating a sequence of numbers that approximates the properties of random … Read more

tech