When developing for mobile applications I want to target multi platforms, thus, i found that Rhodes Framework allows to code "a single application that works on all major smartphones".
As it's a ruby framework and I'm not a ruby programmer, I want to know if it's worth it !
Is Rhodes working well in a production enviroment
what custo...
Is there any command-line tool or ruby library to clean/correct invalid .csv files, something like tidy for html?
Example of error: unescaped non-successive double quotes.
Related to: Regular expression to find and replace unescaped Non-successive double quotes in CSV file.
...
p parent.class #=> NilClass # ok.
p !!parent # => false # as expected.
p parent.object_id # => 17006820 # should be 4
p parent && parent.foo # => NoMethodError foo # should be nil-guarded
Where does this object come from?
...
Hello,
been trying to understand how to implement a timeout detection to a ruby TCP server of mine. Mainly because sometimes clients with instable internet lose connection and i need my server to detect it.
The idea is to teach my server to detect when a connection had been silent for longer than 30 seconds and abort it. I've been try...
I have a rake task for a series of rspecs as follows...
require 'spec/rake/spectask'
require 'joliscrapper'
namespace :spec do
desc "Web scraping files"
task :scrapers => :environment do
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/scr...
So I have a Git project, and we (a mostly typical Rails project) have a pretty deep directory structure.
When I do git merge I see results like:
app/views/shared/exception_report.erb | 6 +
app/views/ui/sample.html.erb | 11 +-
app/views/verifications/new.html.erb | 10 +-
config/de...
I would like to collect and store all this info into an array.
I have the following, how should I refactor this?
require 'rubygems'
require 'nokogiri'
require 'open-uri'
@urls = %w{http://url_01.com http://url_02.com http://url_03.com}
@link_01_arr = []
@link_02_arr = []
@link_03_arr = []
link_01 = Nokogiri::HTML(open("#{@urls[0]}"...
I am attempting to deploy a Rails application (which works fine in development) onto a production server. I have installed and configured Apache, Passenger, and the necessary gems. After I restart apache and navigate to the server, I get the following error:
Exception PhusionPassenger::UnknownError in PhusionPassenger::Railz::Applicatio...
Using arrays what's the main difference between collect and each? Preference?
some = []
some.collect do {|x| puts x}
some.each do |x|
puts x
end
...
I'm using Rails 2.3.8 with Ruby 1.9.1 and I'm having a problem with
serialized attributes in active record not preserving string encodings.
The underlying problem is probably yaml, but I'm wondering if anyone has
any good ideas on how to handle this. The app I'm working on has
numerous serialized fields some of which contain deep struct...
C++:
for(i=0,j=0;i<0;i++,j++)
What's the equivalence to this in ruby?
Besides the normal for, while loop seen in C++. Can someone name off the other special loops ruby has? Such as .times? .each?
Thanks in advance.
...
Trying to reinstall RSpec, and I can't seem to re-add its command to my bin folder.
Mac-Users-MacBook-Pro:bin macuser$ rspec
-bash: /usr/bin/rspec: No such file or directory
>> which rspec
#> returns nothing.
I tried sudo gem install rspec --prerelease a dozen times, bundle install , and nothing seems to give.
What am I missing?
...
I am using the xml-simple gem inside a rake task to parse the contents of a db dump. The problem is that the database xml file contains characters like those in the title that causes xml-simple to crash. Is there a work around to this?
...
Is there a prescribed way to "clean up" Ruby Gems which have native extensions that have failed to build. There are directories/files left in the gems directory, however gem list --local does not list them as being installed.
e.g. sqlite3-ruby, linecache, mongo
...
Ruby
req = Net::HTTP.get_response(URI.parse('http://www.domain.com/coupons.txt'))
@play = req.body
req.body give me the entire page in to a string. What if I just want to read line by line? gets? Can you read line by line through a http get? Or do I just need to read a file from local?
The text file looks like this
1 John Ham 25,0...
I often write code to provide a default value upon encountering nil/empty value.
E.g:
category = order.category || "Any"
# OR
category = order.category.empty? ? "Any" : order.category
I am about to extend the try method to handle this idiom.
category = order.try(:category, :on_nill => "Any")
# OR
category = order.try(:category, :o...
Given say 2x3 and mx3 arrays (I have used NArray): how to construct a (2+m)x3 array, the concatenation of each. + or << do not keep the elements properly aligned.
e.g.
a = [[1,2,3],[4,5,6]]
b = [[1,2,3,4],[5,6,7,8]]
# should be concatenated as:
# [[1,2,3,1,2,3,4],[4,5,6,5,6,7,8]]
Thanks.
...
Hello all,
I'm not a Ruby programmer, but as I was reading through the extensive RoR security guide I noticed this section:
http://guides.rubyonrails.org/security.html#regular-expressions
A common pitfall in Ruby’s regular expressions is to match the string’s beginning and end by ^ and $, instead of \A and \z.
Does anyone know if...
I am update a clients rails application and its rails
RAILS_GEM_VERSION = '2.2.2'
and I need a nested form...any suggestions of another idea
I have user which has one profile
...
Having problems figuring this out.
trying to do a
rescue_from NoMethodError, :with => :try_some_options
But its not working.
EDITED:
For testing I'm doing a simple redirect
def try_some_options
redirect_to root_url
end
EDITED 2:
Sample of my controller. Added (exception) as recommended below.
I know the reason I'm getting the...