Why is Ruby, and Ruby on Rails (1.8.6 One Click Installer, local database) so ruddy slow on Windows?
ruby script/server - 30 seconds
rake test - 45 seconds
etc.
Yet, when I pop over to a much slower linux box, it's virtually instantaneous. I've checked everything - no significant CPU processes running, no network issues... and so on...
I have a table with a float called 'cost' and timestamp called'created_at'.
I would like it to output an array with the summing the costs for each particular day in the last month.
Something like:
@newarray = [] #creating the new array
month = Date.today.month # Current Month
year = Date.today.year # Current Year
coun...
Ubuntu 9.10
Just installed newgem
gem install newgem
and when i try
newgem new_project
I get
adam@adam-ubuntu:~$ newgem newproject
newgem: command not found
Ive checked my path via echo $PATH
adam@adam-ubuntu:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/adam/.gem
and my gem en...
is there are proper subversion client for ruby, that could be used to manage text files, images and other documents from a subversion project? it needs to be able to checkout the project, update and merge content (not automatically, but respond with a diff or something in case of a problem), commit, etc.
please don't ask me how we got t...
I found a suggestion on a Stack Overflow topic about problems beginners should do to learn a new language. A user posted a very nice list of problems from Beginner to advanced that should help you get to know a language. One of the problems is to create a phone book, with random phone numbers and random people on the phone book, and a us...
I can easily ascend the class hierarchy in Ruby:
String.ancestors # [String, Enumerable, Comparable, Object, Kernel]
Enumerable.ancestors # [Enumerable]
Comparable.ancestors # [Comparable]
Object.ancestors # [Object, Kernel]
Kernel.ancestors # [Kernel]
Is there any way to descend the hierarchy as well? I'd like to do this
...
I am trying to format my code with textmate "indent" option . but textmate just left aligns everything .
What is the proper way to format ruby code in textmate?
...
I have a RoR project on my Windows 7 PC.
I want to create some Ruby code that I can execute from the cmd.exe command line that manipulates the development database (via database.yml) of the project. (I don't want to have to run my utility code via a web page.)
What is the best way to go about pulling this off? (I'm a newbie.)
I can'...
This code runs on my local RoR/Windows 7 (64-bit):
sql = ActiveRecord::Base.connection()
last_pk = sql.insert("insert into manual (name) values ('hello new value')")
puts 'last_pk=', last_pk
but always displays "0."
For various reasons I can't use ActiveRecord in this situation.
(Note: The above code runs fine on my shared host.
A...
I've just upgraded from MRI-1.8.7 to MRI-1.9.1 and heard about this lighthouse ticket which indicates that Ruby 1.9.1 and Rails 2.3.x won't play nicely together when a user enters any kind of non-ASCII standard character (i.e. å é Ã Ø å ल) unless rails is patched.
My problem is that I CAN'T reproduce the bug.
I've tried everything. I'...
when you use the random(min,max) function in most languages, what is the distribution like ?
what if i want to produce a range of numbers for 20% of the time, and another range of numbers for 80% of the time, how can i generate series of random number that follows that ?
ex) i should get random frequency but the frequency of "1" must ...
I have no knowledge of Python. I started with .NET and than learned PHP. Someone later asked me to learn Ruby as well. I started learning it. Since last few months I am seeing many libraries and drivers written in Python. I want to know what are the advantages of Python over PHP/Ruby? What type of language it is and is there a need to le...
In ApplicationHelper I have such code:
def inside_layout layout = 'application', &block
@template.instance_variable_set '@content_for_layout', capture(&block)
concat \
@template.render :file => "layouts/#{layout}", :use_full_path => true
end
which behaves like this:
application.html.haml:
!!!
%html
%head
...
%body
...
I have a couple of views I'd like to have appear on every view that is rendered, but short of duplicating code or breaking the specifications, I can't seem to find a way to accomplish this.
Here's my current code, putting calls in every view:
def ImOnABoat::Views
def layout
html do
head do title "Petstore" end
body...
I am starting on a number of big PHP projects which I need Bug Tracking, Wiki and Subversion integration capabilities for.
I used to have a Virtual Server running Windows Server and a Trac/SVN installation for this, but I am planning a relocation to another country this year, so I want to close that server down and move the functionali...
I am looking to set up a Redmine server on a Windows virtual machine on my local workstation. (Background in this related question.)
I have zero knowledge of Ruby nor Rails, and while Redmine may be the opportunity to dip into those platforms somewhat, my first goal is to get it running as quickly and easily as possible. For that, I am...
I'm using the ancestry gem to structure some groups in a tree. At the same time I'm using acts_as_list to keep groups at the same tree level in a sorted list. Given the following model:
class Group < ActiveRecord::Base
acts_as_tree
acts_as_list :scope => "ancestry"
named_scope :parentable, :conditions => "NOT type = 'PriceGroup'"...
Trying to Google around for an a Rails plugin that will allow for throttling the amount of requests a particular resource gets consumed. Django's Piston has some open source code for this. Is there something available out of the box for Rails or is it safe to assume that looking at how Piston does it and porting it as a Rails plugin is s...
Let say, I have a web application that allows users to upload images and documents and my application stores all those assets on S3, is there a way I can monitor resource usage PER user account?
For example, if a user account has a 1GB storage limit, how can I monitor how much of that allowance any individual is using?
Furthermore (but...
After reading http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html I just can't seem to find what I'm looking for. I have a simplistic model that deletes the oldest message after the list of messages reaches 24, the model is this simple:
class Message < ActiveRecord::Base
after_create :destroy_old_messages
prot...