say a php script executes a ruby script in the background each time, php script is run from the browser.
what would be an approach to associate the logged in user on the website, to the running background ruby script ?
this is so the logged in user on the website can get feedback on the running ruby script they executed by visiting a s...
I am working on a simple budget app using Sinatra and DataMapper in Ruby.
I want to get the sum of all transactions across all income accounts within the last 30 days.
Something like Account.income_accounts.account_entries.sum(:amount, :transaction_date.gte => Date.today - 30) should work. Instead, the limiting condition on transactio...
I am working on a simple app in Sinatra with DataMapper. I want to see the queries that DM is created for my various chained finders, etc.
I have tried:
DataMapper::Logger.new(STDOUT, :debug)
in my configure do ... end block in an environment.rb file that loads when the app is started.
I have also tried:
DataMapper::Logger.new('...
I was looking at an authentication system which had this code:
# prevents a user from submitting a crafted form that bypasses activation
# anything else you want your user to change should be added here.
attr_accessible :login, :email, :password, :password_confirmation, :first_name, :last_name
I don't understand why attr_accessi...
How to enter a directory like the command - cd, thus operate remote files without a path prefix ?
Here is my current code.
Net::SFTP.start do |sftp|
sftp.rename!(REMOTE_PATH + "latest.zip", REMOTE_PATH + "latest.back.zip")
sftp.upload!("latest.zip", REMOTE_PATH + "latest.zip")
end
I would like to have:
sftp.cd REMOTE_PATH ...
I have written quite a few Ruby programs, but if I need to show my friend one of the program, I need to install Ruby 1.8.6 on that computer, and that is 20,000 files. For running of my Ruby programs, is there a way besides this?
...
On the page:
http://rubyforge.org/frs/?group%5Fid=167
There are stable versions (1.8.6 p26 being the latest), and there are some "Previews" for 1.9.1. Are the "Previews" stable versions or are they Beta?
It seems that otherwise, the most recent stable version you can get is 1.8.6?
On page
http://www.ruby-lang.org/en/download...
How can I split a String by Unicode range in Ruby. I wanted to split under \u1000 and over \u1000 with comma. For example, I wanted to split this string...
I love ျမန္မာ
to this...
I love, ျမန္မာ
You may not see the Unicode Characters in my example. It's Unicode range \u1000 and over.
Thanks.
...
In my application I would like to provide a dashboard like screen when they login to get an overview of what is happening. I have about 4 models I would need to collect data from and sort them into order. My problem is knowing the action, so I can get specific fields per model.
Here are a few ideas of how to go about it, but I feel they...
What's the most most ruby-like way of converting from an Array like [:one, 1, :two, 2] to a Hash like {:one => 1, :two => 2}?
...
Not exactly sure how to look this up, but I'm not finding the solution anywhere. I want to assign an array of users an array of websites. Like so:
users = User.all
sites = Site.all
users.each do |user|
sites.each do |site|
user.websites << site
end
end
Obviously, this does not work because I'm missing something about block s...
Hi guys,
I have an urgent issue.
I'm using mediaplug-ruby to get the images cropped on the fly.
I went through mediaplug-ruby doc(the http://github.com/intridea/mediaplug-ruby/blob/master/README.rdoc) and it says, i have to supply my site url, which id id.
The image-url i supplied is:http://s3.amazonaws.com/lifetuner-production/photo...
Is it possible to add a gem dependency only if the person is using a certain version of ruby?
Background: I'm working on a fork of a project that uses Test::Unit::Autorunner and the like. They are part of the standard library in ruby 1.8, but aren't part of the standard library in 1.9.1, and is instead in the "test-unit" gem. I want to ...
If I have an international phone number such as this:
0541754301
how can I format it to produce something like this:
0541-754-301
...
Any suggestions for a good twitter library (preferably in Ruby or Python)? I have a list of usernames, and I need to be able to programmatically follow these users.
I tried twitter4r in Ruby, but finding users doesn't seem to work. When I do
twitter = Twitter::Client.new(:login => 'mylogin', :password => 'mypassword')
user = Twitter::...
I need to get the child nodes of a node using XPath as I want to "drill down" into a node. Here's the code I'm trying:
xml_ns = 'Document:http://www.google.com/books/'
xml_document = XML::Document.file('./test_pages/test.xml')
book_xpath = '//Document:View/Document:Books'
book_title_xpath = '//Document:Title'
xml_document.find...
Can anyone help with an odd Ruby Gem problem I'm having - note I've installed many gems in the past and never seen this.
I've downloaded the net-ssh and net-sftp gems using the following commands:
sudo gem install net-ssh
sudo gem install net-sftp
both installed successfully. However when I reference the files within my code I get th...
Let's say I have a class of 30 students and want generate every possible way in which they can be partitioned into groups of 5 (order is irrelevant).
I know how to find all the combinations of students to form one group individually (http://www.merriampark.com/comb.htm). By using that iterator and some recursion, I can find PERMUTATIONS...
If a Ruby regular expression is matching against something that isn't a String, the to_str method is called on that object to get an actual String to match against. I want to avoid this behavior; I'd like to match regular expressions against objects that aren't Strings, but can be logically thought of as randomly accessible sequences of ...
Here's what I've determined:
Delta indexing works fine in development
Delta indexing does not work when I push to the production server, and no action is logged in searchd.log
I'm running Phusion Passenger, and, as recommended in the basic troubleshooting guide, have confirmed that:
www-data has permission to run indexing rake tasks (...