Pardon my ignorance, but What is a Metaobject protocol, and does Ruby have one? If not, is it possible to implement one for Ruby? What features might a Metaobject protocol possess if Ruby was to have one?
...
Say I have two versions of a gem installed (somegem versions 0.10.6 and 0.10.5) and I want to run the earlier version from the commandline. Do I have to uninstall the newer version? Is there a way I can use a flag to specify which version I want to use? Something like...
somegem /path/to/dir --version 0.10.5
I checked the rubygems do...
I am trying to fill an array of hashes with hashes created through an each loop, If I print each individual hash within the iteration they are distinct, but when I try to push them to an array, the resulting array has the last hash repeated whatever number of times. Here's the code:
def get_tweets
tweet_array = Array.new
tweet = {}
...
I have a data struts like this:
category:
subcategory:
color:red
name:pen
Is there any better method to store if i want to load such data in memcache? or Is there any other better memory database?
Thanks!
...
How connect to different db depending on @request.host value?
Using Sinatra and MongoDB with Mongoid.
I need to read a Sintra application's menu, data ... from different databases. I wish to deploy it only in one place and depending on request.host(subdomain) value to serve the specific pages.
...
What does the to_sym method do? What is it used for?
...
I have written a mapreduce application for hadoop and tested it at the command line on a single machine. My application uses two steps Map1 -> Reduce1 -> Map2 -> Reduce2
To run this job on aws mapreduce, I am following this link http://aws.amazon.com/articles/2294. But I am not clear how to use Ruby CLI client provide by amazon to do al...
I'd like to split and do a substitution in a string in one chained command.
Here's my example including the error message:
>> filebase
=> "Ueki_-_Hello_World"
>> filebase.split("_-_").gsub("_"," ")
NoMethodError: private method `gsub' called for ["Ueki", "Hello_World"]:Array
from (irb):16
It works when I save the result of "split...
How can i add space character in the ruby array if i want to use %w(a b c) syntax?
...
Hi guys, I'm writing a pong game and I have a ball class that has velocity x, y, positions and all that stuff that every frame is updated by calling @ball.update, this moves the ball forward by its x_vel and Y_vel etc. My question is Should my collision code be in the loop or in the update method of the ball class? Or should it all be in...
So I've been using a number of educational software web based apps, they are games, and they are all using flash. Recently I've seen some posts about making games with ruby. Are there any good examples out there for making games with ruby. I know of the game library, and then there is one book on amazon that has some awful reviews, and t...
I'm following along with the O'Reilly Rails book, but it's created for Rails 2, so I think that's where the error lies.
In app/views/entries/sign_in.html.erb:
<html>
<head><title>Hello <%=h @name %> </title> </head>
<body>
<h1> Hello <%=h @name %></h1>
<%= form_tag :action => 'sign_in' do %>
<p>Enter your name:
<%= text_field_ta...
StyleCop is a tool that analyzes C# source code to enforce a set of style and consistency rules.
Is there anything similar for the Ruby language?
...
I am on Ubuntu10.
Create new db file with
touch development.db
Want my migrations
rake db:migrate
but get locked error
SQLite3::BusyException: database is locked
How it can be locked?!
update it can be locked by samba. it's shared folder
...
I think what I'm trying to do is pretty simple, and I'm really not sure why this isn't working. I'm using Rails 3.
Essentially, I'm just trying to select the distinct values from a column in an existing model, and print them out all. For the most part, this works but the .each loop in my view also ends up printing the entire array at t...
Hello,
I'm very new to Ruby. I've recently finished writing a simple script, which uses a bunch of gems. It works well on my own workstation.
When I copied the script over to my laptop, it stopped working, even though I manually installed all the gems. I think it may be due to version differences in the gems installed, but I wanted to ...
The issue: I am writing out some CSV data using "csv::write". Some other software I am using does not read the data correctly, such that the second record of this data will not interpret the double quotes as an escaped quote:
1,"Sometimes my ""name"" is Joe, and sometimes it is not."
2,I might ""like"" jam!
Is there a way I can force ...