Inside a module I have a class named Process.
module M
Process= Class.new
Process::wait(0)
end
This raises NoMethodError.
How do I access the toplevel Process from inside the module? Is this at all possible, without renaiming my class?
...
As I retrieve data from a database table an array is populated. Some of the fields are defined as decimal & money fields and within the array they are represented as BigDecimal.
I use these array values to populate a CSV file, but the problem is that all BigDecimal values are by default represented in Scientific format (which is the de...
I'm trying to run the DelegateClass example from http://ruby-doc.org/stdlib/libdoc/delegate/rdoc/files/delegate_rb.html
Here is the code:
require 'delegate'
require 'tmpdir'
class TmpFile < DelegateClass(File)
def initialize(basename, tmpdir=Dir.tmpdir)
@tmpfile = File.new("#{tmpdir}/#{basename}.tmp", File::RDWR|File::CREAT|File...
I'm writing a Rakefile for a C++ project. I want it to identify #includes automatically, forcing the rebuilding of object files that depend on changed source files. I have a working solution, but I think it can be better. I'm looking for suggestions for:
Suggestions for improving my function
Libraries, gems, or tools that do the work f...
Hi Guys,
I'm new at this, and I'm having trouble finding the proper way to phrase this in Ruby. And I don't know if the Ruby API in SketchUp is different. But, thats what I'm trying to use it for.
def self.initialize_job_info
return{
'salesperson' => ' = $pg_settings['salespersons'[['salesperson']['id']]] if ('on' = $pg_set...
Hello stackoverflow experts,
I got a very strange problem in a task I'm creating with Capistrano. I'm trying to pass a variable from the command line:
>> cap create_dir -s name_of_dir=mydir
task :create_dir do
printf("#{name_of_dir}")
if !(exists?(:name_of_dir)) then
name_of_dir = Capistrano::CLI.ui.ask("Name of dir to be ...
What are the consequences, (if any) not calling the conn.logoff() method after the following script when connecting to an Oracle database using the Ruby OCI8 library.
conn = OCI8.new('scott', 'tiger')
num_rows = conn.exec('SELECT * FROM emp') do |r|
puts r.join(',')
end
puts num_rows.to_s + ' rows were processed.'
The reason I'm...
When you run git clone, it updates progress in place. For example, the percentage of the objects received changes in place.
user@athena:~/cloj/src$ git clone git://git.boinkor.net/slime.git
Initialized empty Git repository in /home/user/cloj/src/slime/.git/
remote: Counting objects: 15936, done.
remote: Compressing objects: 100% (5500/5...
I have a simple web app with users and posts. I have an index controller and view that shows a list of the posts in the database. With the list, it shows a "Show" link which links to the specific post.
I am trying to replicate that for users but something is going wrong. I have an index view that shows all the users in the database and ...
I have a basic Dreamhost account as well as an iMac running Apache2/Rails/SVN/et al. I can only get my Hello World Ruby script to execute in my iMac's cgi-bin. Dreamhost doesn't have any cgi-bin that I'm aware of.
I've CHMODed the .rb file to 755. I've tried both a shebang line that points directly to Ruby and another that uses the...
Hi guys, I'm using rspec to test a code that may fail depending on the change of a site structure (the external influence I mentioned). I would like to write an example that involves "should raise an error" but I'm not sure if rspec is the right tool to test code in such situations. Could someone point me in some direction?
Thanks in a...
I've read through countless tutorials and I keep coming up short. Here's what I've got:
-- I'm running RubyMine on my Windows desktop
-- I've installed Git on my WebFaction hosting account per their instructions
-- Git appears to be working fine on both machines
Here's what I'm doing:
1. On server:
a. mkdir project
b...
Is there I way I can make this look a little better?
conn.exec 'select attr1, attr2, attr3, attr4, attr5, attr6, attr7 ' +
'from table1, table2, table3, etc, etc, etc, etc, etc, ' +
'where etc etc etc etc etc etc etc etc etc etc etc etc etc'
Like, is there a way I imply concatenation?
...
I've got a batch of a 100k or so records that I'm importing to a Rails app.
There's a date in each row formatted like the following: 03/17/81
However, when I try to just assign it to a date field, it gets converted as follows:
ruby-1.8.7-p174 > "03/17/81".to_date
=> Sat, 17 Mar 0081
Ultimately I would like the format to result in ...
Paperclip is a great upload plugin for Rails. Storing uploads on the local filesystem or Amazon S3 seems to work well. I'd just assume store files on the localhost, but the use of S3 is required for this app as it will be hosted on Heroku.
How would I go about getting all of my uploads/attachments from S3 in a single zipped download?
G...
When I try to run the following, I get an error back from ActiveRecord stating that the connector hasn't been found.
require 'activerecord'
ActiveRecord::Base.establish_connection(
:adaptor => "sqlite3",
:database => "db.sqlite3"
)
Error Message:
>> ActiveRecord::Base.establish_connection("adaptor" => "sqlite3-ruby")
ActiveR...
I am new to ruby. I need to receive password as an input through gets command.
How do I hide the password input typed in the terminal, during gets call
...
I'm trying to save some lookup table data out to a YAML file so that later when I need to set up my app on a different machine I can load the data in as seed data.
The data is stuff like select options, and it's pretty much set, so no worries about the live data changing between serializing and deserializing.
I have output the data lik...
Lets say I have a rails application in which code is pasted into the content text box like the following.
Pasted Code
Person name
Person name
Person name
Person name
It is put into the database with the proper new lines after each line according to my server log.
What I want to do is in the show action I want to output this text a...
Hi,
I have a remote embedded system which it is telnet-able. How can I download a binary file from the host to it? I can read file from the system, but have no idea how to write to it.
...