In the Ruby Programming Language, Chapter 6 (second paragraph) they state:
Many languages distinguish between
functions, which have no associated
object, and methods, which are invoked
on a receiver object. Because Ruby is
a purely object oriented language, all
methods are true methods and are
associated with at least one...
Background: I'm writing a 'standard' (nothing special) web application in Ruby (not Rails) and I need to start thinking about deployment.
So I've been hearing a lot of recommendations to use JRuby to deploy Ruby web applications, regardless of whether you actually need Java libraries or not. How true is this? Is it worth using the Java ...
I'm just learning how to program in Ruby on Rails, and I'm really impressed by how much work the Ruby on Rails framework does for you. I have the following two classes:
Object
--------
object_id
description
ObjectGroup
--------
group_id
description
The idea is that I have some objects, and I'd like for the users to be able to define...
Is there a curl library for Ruby?
...
In answering this code golf question, I ran across a problem in my answer.
I've been testing this and I cannot even get these two comparisons to work in the code, despite the fact that IRB has the right behavior. I really need some help here.
Here's the code, below that will be an explanation of the problem.
def solve_expression(expr...
I'd like to run validations on the static web content I'm creating. Are there any good validators for XHTML, ATOM, and CSS? (The first two would be covered by any general-purpose XML-DTD validator.)
Later
I failed to specify that I wanted local validation, not something that uses the W3C service.
...
I'd like to apply the action_mailer patch mentioned in this thread but I have never applied a patch before and I'm not sure how these work:
https://rails.lighthouseapp.com/projects/8994/tickets/2263
My action mailer gem is here: /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/gems/actionmailer-2.3.2
I assume I need to go to that ...
I'm using hpricot to read HTML. I got a segmentation fault error, I googled and some say upgrade to latest version of Ruby. I am using rails 2.3.2 and ruby 1.8.7. How to resolve this error?
...
With a Ruby module, you can cluster together a bunch of methods that you might use in one place and then include them into a class so it's as if you had written them in that class.
What kinds of practical uses are there for Ruby modules in a rails app?
I would appreciate if someone could mention an example of where they've actually u...
Hi,
I need to format a decimal like this:
00.33
11.24
05.22
The problem is that when I retrieve 00.33 it outputs as 0.33.
I have tried everything and can't get it to work correctly. I could do MySQL's Zerofill but I'm really trying to avoid that.
Any suggestions?
Thanks!
...
I'm looking for a method in Ruby which is basically this:
io.ready_for_read?
I just want to check whether a given IO object (in my case, the result of a popen call) has output available, i.e. a follow up call io.read(1) will not block.
These are the two options I see, neither of which I like:
io.read_nonblock - too thin an abstract...
n=0
k=[]
q=[]
j=0
if n!=-1
p=gets
n=p.to_i
for i in (1..n)
l=gets
k[i]=l.to_i
a=a+k[i]
end
if a%n !=0
q[j] = -1
continue
end
a=a/n
for i in (1..n)
if k[i] >a
q[j]=q[j]+(a-k[i])
end
end
j=j+1
end
for i in (1..j)
puts(q[j])
end
it ...
I'm wondering about the current support there is in Ruby for semantic web technologies. Is there good RDF options? It seems that the last surveys done were circa 2007 ( http://paul-classic.stadig.name/2007/10/26/the-state-of-rdf-support-in-ruby-2007/ ). Is Redland's RDF wrappers the best way to go for RDF support - all the other proje...
Hey all, I am completely lost on this one.
I found a code snippet online to help validate fields via ajax as the user types into them. So I'm trying to write a spec against part of it and I just can't get it to pass.
Here's the code
def validate
field = params[:field]
user = User.new(field => params[:value])
output = ""
user...
One of my Rails applications is going to depend on a secret key in memory, so all of its functions will only be available once administrator goes to a certain page and uploads the valid key.
The problem is that this key needs to be stored securely, so no other processes on the same machine should be able to access it (so memcached and ...
Ill keep this short and simple. I need to find out the steps that I would have to take in order to administer IIS on a windows box using Ruby. The main thing I am trying to achieve is setting an existing websites home directory to a different folder.
...
For the caching purpose I can't have url like /users/2/index?month=2009-02 . The problem with this approach is that if I do page caching then same page is returned even for /users/2/index?month=2009-03 .
To solve the caching issue I would like to have url like /users/2/events/2009-02.html . I have defined users to be a restful resource....
Upfront, I'd like to confess to being a complete newbie to cryptography and password security. I'm trying to store passwords in a database being babysat by ruby. My understanding is that plaintext passwords should be appended to a random "salt" and that whole phrase should be hashed by some hashing algorithm such as:
Digest::SHA1....
I'm working a project that has recurring, weekly events. Thus, I use several DateTime fields in a nontraditional way. What I'm working on is a FormBuilder that creates a field that outputs a select for a weekday, and a select for time. I'm using a twelve-hour plugin I found online, so that works:
class ActionView::Helpers::FormBuilder
...
Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resour...