I fired up a sample application that uses Amazon S3 for image hosting. I managed to coax it into working. The application is hosted at github.com. The application lets you create users with a profile photo. When you upload the photo, the web application stores it on Amazon S3 instead of your local file system. (Very important if you host...
hi,
Am new to ruby.
Can any one tell me how to find inverse of a number in ruby.Is there any function for it?
or just 1/number ?
Thanks in advance.
...
I have a string of words; let's call them bad:
bad = "foo bar baz"
I can keep this string as a whitespace separated string, or as a list:
bad = bad.split(" ");
If I have another string, like so:
str = "This is my first foo string"
What's the fasted way to check if any word from the bad string is within my comparison string, and ...
I'm looking for plugins that will allow my codebase to interact with, browse, and poll an SVN server for information about a repository.
Trac can do this, but I was hoping there was an easy-to-use library available to accomplish the task, rather than trolling through the Trac codebase. Googling for this returns mostly vague results abo...
I know similar questions have been answered before - such as: Where should logic go, where to do certain tasks, etc. But I have a more specific question - How far should I take this axiom: "keep your controller skinny, make your model fat!"
Here is an example:
For instance let's say I have multiple source of verification data. A good e...
Guys,
Long time Java developer here, but I've spent more time working with Ruby over the past 3 years or so as far as web applications go. I really have enjoyed it, but there are concerns I've uncovered that I won't cover here.
Now that I've found the Play! framework, I'm thrilled about the prospect of having a Rails-like experience wi...
When running Ruby code on NetBeans (like when running the tests) I'm having some failures because a program is not being found. That program is installed somewhere in /opt and while for the shell I get that added to my PATH, it seems NetBeans is not getting it.
How do I specify the PATH in NetBeans?
...
Hi, everybody!
I'm new on both this site and ruby on rails!
I have a common installation of authlogic and want password to be generated automaticly for user registration if user did not set the password. What is the best way to do it?
...
I was wondering what are the strengths and weakness of using Ruby on Rails for Web Application development. I would like an insight from other developers as to why they have chosen to write in Ruby on Rails over other languages and technologies.
What does Ruby on Rails provide that has the edge over other web application technologies an...
What should I do to marshal an hash of arrays?
The following code only prints {}.
s = Hash.new
s.default = Array.new
s[0] << "Tigger"
s[7] << "Ruth"
s[7] << "Puuh"
data = Marshal.dump(s)
ls = Marshal.restore( data )
p ls
If the hash doesn't contain an array it is restored properly.
...
Inspired by http://stackoverflow.com/questions/2552363/how-can-i-marshal-a-hash-with-arrays I wonder what's the reason that Array#<< won't work properly in the following code:
h = Hash.new{Array.new}
#=> {}
h[0]
#=> []
h[0] << 'a'
#=> ["a"]
h[0]
#=> [] # why?!
h[0] += ['a']
#=> ["a"]
h[0]
#=> ["a"] # as expected
Does it have to do wit...
I'm getting this erron when trying to install RedCloth on openSuse:
sudo gem install RedCloth
Building native extensions. This could take a while...
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
creating Makefile
make
sh: make: nie znaleziono polecenia
Gem files wil...
I have two arrays:
x = [ ["0", "#0"], ["1", "#1"] ]
y = [ ["00", "00 description"], ["10", "10 description"] ]
What i need is to merge them so i get the following as result:
result = [ ["000", "#0 00 description"], ["010", "#0 10 description"],
["100", "#1 00 description"], ["110", "#1 10 description"] ]
Is there a method for th...
Does anyone know of a good guide on building your own authentication system in ruby on rails?
I want to roll my own system to use with my community im building :)
Thanks!
...
Hey Guys
I am trying to remove all the relative image path slashes from a chunk of HTML that contains several other elements.
For example
<img src="../../../../images/upload/1/test.jpg />
would need to become
<img src="http://s3.amazonaws.com/website/images/upload/1/test.jpg" />
I was thinking of writing this as a rails helper, a...
Hi,
I'm trying to setup a simple timer that gets started from a Rails Application. This timer should wait out its duration and then start a shell script that will start up ./script/runner and complete the initial request. I need script/runner because I need access to ActiveRecord.
Here's my test lines in Rails
output = `at #{(Time.n...
like DOMDocument class in PHP, is there any class in RUBY (i.e the core RUBY), to parse and get node elements value from a HTML Document.
...
In another question I asked (why is Rake test so slow), part of the response was that:
The reason is that file stat's in
windows are dreadfully slow, and,
since Ruby is written on Linux (and
optimized for Linux), there hasn't
been much work to make it faster.
Can someone explain this further?
...
I'm having a problem with one of my Capistrano scripts - specifically, using using sudo, setting the path, and finding mongrel_rails. The path is correct, and mongrel_rails is in /opt/rails/gems/1.8/bin, but I getting the following error:
/usr/lib/ruby/1.8/rubygems.rb:578:in
`report_activate_error': Could not find RubyGem mongrel (>...
Hi,
So I'm having huge trouble with sinatra.
Here's what I have:
require 'dm-core'
DataMapper.setup(:default, ENV['DATABASE_URL'] || 'sqlite3://my.db')
class Something
include DataMapper::Resource
property :id, Serial
property :thing, Text
property :run_in, Integer
property :added_at, ...