How many TCP connections can Ruby deal with ?
I have a general ubuntu server, and I want to use Ruby to deal with many TCP requests, I want to know how many connections it can handle. ...
I have a general ubuntu server, and I want to use Ruby to deal with many TCP requests, I want to know how many connections it can handle. ...
Hi, I have to run couple of scripts which crawl some 1000s web pages and save some information for every 10 minutes. I am using dreamhost shared hosting for my PHP site hosting. What would be the appropriate way to configure these services in cron so that it executes 24X7. Please let me know which host i can use for the same....
is there a way to stop execution and return a different value in a before do block in sinatra ? before do # code is here # I would like to 'return "Message"' # I would like "/home" to not get called. end // rest of the code get '/home' do end ...
I have latest Xcode Tools 3.2.4 installed. Just whenever I try to install any gem, for example, the MySQL gem, such error occurs: VNMB:rails2app ABC$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- \ --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \ --with-mysql-include=/usr/local/mysql/include Pas...
In our Cucumber steps, we would like to start a long running task in one step and check that the task is running and that it set up the UI for the task correctly, in another step. Checking the UI must be done while the first step is still running. Our Cucumber looks similar to this: Given I start my long running task And I navigate to...
Hi, I have the following object that has been created @post = Post.create(:name => 'test', :post_number => 20, :active => true) Once this is saved, I want to be able to get the object back to a hash, e.g. by doing somthing like: @object.to_hash How is this possible from within rails? Thanks ...
I have implemented pagination using the will_paginate plugin. I want have a drop down list where the user can display what number of records they display on each "page". The idea is once they select something, the current screen gets refreshed with the adjust number of records displaying. The code I have isn't triggering a refresh... ...
Hi, I'm trying to setup integrity for my project. Sadly, my bash-fu is poor so I need some help. In build script I enter rake spec. In integrity it returns status 0 and output (in /home/rails/integrity/builds/builds/66) but I know, that I should got status 1 and output (after running it manually from console): rails@integrity:...
The Error : 2010-10-06T04:40:41-0700: * [Worker(delayed_job host:domU-12-31-39-0C-CC-64 pid:21517)] acquired lock on PhotoJob 2010-10-06T04:40:41-0700: * [JOB] delayed_job host:domU-12-31-39-0C-CC-64 pid:21517 failed with AWS::S3::NoSuchKey: The specified key does not exist. - 1 failed attempts Paperclip matches the ID, but the ID sud...
Start with the following scenario: class Foo def bar(baz={}) p baz end end foo = Foo.new p meth = foo.method(:bar) # => #<Method: Foo#bar> p meth.parameters # => [[:opt, :baz]] So I can figure out that the method bar is optional, but how do I find the default value ({}) for the method? ...
Rails 3.0 deprecated f.error_messages and now requires a plugin to work correctly - I however want to learn how to display error messages the (new) native way. I am following the getting started guide, which uses the deprecated method when implementing the comments form. For example: <h2>Add a comment:</h2> <%= form_for([@post, @post.co...
Hi, Country Model set_table_name "countries" has_many :states, :primary_key => 'col1', :foreign_key => 'col1' has_many :cities, :through => :states, :primary_key => 'col1', :foreign_key => 'col1' State Model set_table_name "strain_appendices" belongs_to :country has_many :states, :primary_key => 'col2', :foreign_key => 'col2' ...
Does anyone know of a (preferably open source) PHP to ruby compiler? i.e. a program which parses PHP code and produces semantically equivalent ruby code? ...
Trying to use $SAFE=1 (just wanted to put some processing in a drb server) make rails unusable: it can't load some paths, data recovered from the DB are tainted, etc. For instance: rails console Loading development environment (Rails 3.0.0) ruby-1.9.2-p0 > $SAFE=1; User.first SecurityError: Insecure operation - file? from .rvm/gems/...
I have an Array extension method I want to use in my Rails 3 project. Where should it live? I have a app/classes where I originally put it (array_extensions.rb), and in my config/application.rb I load the path: config.autoload_paths += %W(#{Rails.root}/app/classes). However, when I drop to rails console the extension is not loaded. I...
Hi all.. I am new to RoR and I am experiencing the 500 server error for a long time without success. I need someone tell me (or link to) how to debug RoR apps from the shell. My application is redmine and I am trying to host it at hostmonster who tuns rails version 2.3.8 ...
Hello, I'm trying to manage a ssh connection to a network device via the PTY module, with a code similar to this : cmd_line = "ssh [email protected]" begin PTY.spawn(cmd_line) do |r_f,w_f,pid| ... rescue PTY::ChildExited => cended ... end The whole i/o works pretty well, however I don't know how to get the exit status...
I am just starting to learn ruby. It seems that the default gems install path is not part of Ruby. Is this normal behavior? How can I set the default ruby path? Example: [11:53:33]wuntee:/Library/Ruby/Gems/1.8/gems/packetfu-1.0.0/examples$ sudo ruby arphood.rb Fetching the oui.txt from IEEE, it'll be a second. Avoid this with arphood.r...
In Ruby 1.8, how do I delete a tree of directories where some of the subdirectories begin with '.'? For example, I have an embedded Linux filesystem directory that I want to clean out. One of its subdirectories is ./dev/.udev/files. Dir[ "{**/*,**/.**,**/.*}" ].sort.reverse.each do | p | puts p if ( ( p != '..' ) and ( p != '.'...
In Python, the with statement is used to make sure that clean-up code always gets called, regardless of exceptions being thrown or function calls returning. For example: with open("temp.txt", "w") as f: f.write("hi") raise ValueError("spitespite") Here, the file is closed, even though an exception was raised. A better explanat...