Trying to understand if types imply OO and vice versa.
Questions:
What exactly is a type ?
Can a class in ruby be called a 'type'.
In javascript, the native functions/objects like Array,String,Function ... Are they types ?
Is a C struct a type ?
How is it that a language can be typed even when it doesn't support OO ? For e.g. H...
I am using Simple Captcha plugin in my application. The application was running fine from last two months but recently (last two days) it is giving error "stack level too deep" while saving the user into for "@user.save_with_captcha" line.
The error occurs only in Production environment. In development mode, everything works fine.
After ...
Since the last question similar to this one is from 2008, I thought I'd ask it anyway to see what's new since then.
I'm looking for books or other resources (though I prefer epubs for reading them on the go) for learning how to use DTrace, preferably but not necessarily for Cocoa, ruby or node.js development.
...
hi all
i am saving some erb in my database and rendering it in the view like this:
erb = ERB.new(content)
render :text => erb.result
I am getting errors when trying render erb that has the image_tag in the erb saved in the database. The error is :
undefined method `image_tag' for main:Object
Anyone help on this ? i also get the...
I'm trying to figure out how to better parse lines of text that have values that look like this:
line1
'Line two' fudgy whale 'rolly polly'
fudgy 'line three' whale
fudgy whale 'line four'
'line five' 'fish heads'
line six
I wish to use a single regular expression to display the desired output. I already know how to kludge ...
I am using http://json.codeplex.com/ and I am talking to a Ruby based Rest API. Problem is that most of the propertys have a ruby underscore naming convention. I am wondering if anyone knows of a way so that I can avoid having to Add lots of JsonProperty.
For example I want to avoid adding the JsonProperty attribute and have a conventio...
Hi!
I have something like this:
require 'net/http'
begin
site = Net::HTTP.new('somedomain.com', 80)
site.get('/')
rescue Exception => e
puts "#{e.class}: #{e}"
end
Now, from my tests, if 'somedomain.com' does not exist OR there is no internet connectivity I get a "SocketError: getaddrinfo: No such host is known".
My question for...
How does one create a Rails migration properly so that a table gets changed to MyISAM in MySQL? It is currently InnoDB. Running a raw execute statement will change the table, but it won't update db/schema.rb, so when the table is recreated in a testing environment, it goes back to InnoDB and my fulltext searches fail.
How do I go about ...
Hi, I have a rails 3 app (which I upgraded). It runs on passenger and nginx but on my production server it also starts with the environment set to 'production'. I know I am missing something really basic, but I just can't figure out where to set the environment instead of in environment.rb.
Thanks for helping!
UPDATE: ok, I learned I c...
The Setup
I have a Ruby on Rails application that I manage from a sysadmin perspective. This application in installed on a pool of load balanced application servers. These application servers a running Apache 2 and Passenger 3.0. The application files are stored in a ramdisk because IO on the application servers are ridiculously slow.
...
What is the preferred way to match multiple nodes in cucumber, like checking if links exist? Without having to write the same statement over and over again.
I'm just doing this:
Then /^(?:|I )should see "\[([^"\]]*)\]"(?: within "([^"]*)")?$/ do |array, selector|
with_scope(selector) do
array.split(/,\s+/).each do |text|
i...
Hi,
is there any working in rails3 alternative for following plugins
http://github.com/fnando/has_friends
http://github.com/fauna/has_many_polymorphs
http://github.com/peteonrails/vote_fu
Thanks a lot
...
I found this code:
.each_key {|a| self[a].strip! if self[a].respond_to? :strip! }
on this website: http://granth.ca/2006/02/strip-whitespace
but I assume that is for a hash, I am trying to do the same with an array.
I have tried a few different things, but cannot figure it out.
Thank you for any help
...
I'm trying to parse a URI with Ruby's URI library. This URI contains a #.
For example, I have the URI:
http://twitter.com/#!/dhh/status/26464821879
When I call URI.parse("http://twitter.com/#!/dhh/status/26464821879").path
"/" is returned, when I would expect to see "/#!/dhh/status/26464821879" returned.
How can I get URI.parse to pro...
Hello Everybody,
This question is going to be very general because I do not know where to start. I want users of my service to be able to add their own custom url's. For example, www.[thierurl].com should be able to access their application's index and show pages.
I've seen apps like Tumblr offer this functionality for their front fa...
I have an application that interacts with ActiveResource from a system I have no control of.
It happens that the system sends me a JSON feed and one of the fields is called "type" and, everytime this model is serialized, I get this nasty exception. Since this is a CLI application, it's very annoying.
Is there a way to silence this war...
Hi,
I'm using Faye for pubsub along with Sinatra.
Presently, I'm using Faye:RackAdapter in my config.ru like so:
use Faye::RackAdapter, :mount => '/faye', :timeout => 45
I'd like to be able to add extensions to the instance of Faye::Server. I've tried to retrieve the server object and manipulate it from Sinatra, but it doesn't appea...
I have trouble with using Arel to aggregate 2 columns in the same query. When I run this, the whole server freezes for a minute, before the rails dev-server crashes. I suspect an infinite loop :).
Maybe I have misunderstood the whole concept of Arel, and I would be grateful if anybody could have a look at it.
The expected result of th...
Hello,
I'd like to retrieve the value of 'q' in this URL:
http://www.google.com/url?sa=X&q=http://nashville.broadwayworld.com/article/Just_in_time_for_Halloween_Circle_Players_does_JEKYLL_HYDE_20101013&ct=ga&cad=:s7:f1:v1:d2:i0:lt:e0:p0:t1286988171:&cd=yQoOdKUFTLo&usg=AFQjCNEg2inHF8hXGEvG-TxMQyMx7YGHkA
if I use thi...
Despite the fact that XML attributs can be defined using single or double quotes, my user is trying to integrate my software with another one that will not accept single quoted attribut values.
I user REXML to generate my XMLs.
Is there a way to REXML generate double quoted attribute values?
If not, is there a way for me to convert it ...