This is related to this question:
http://stackoverflow.com/questions/3179797/how-to-use-rubytorrent-or-other-gems
I thought RubyGems is a package manager, similar to apt-get on Ubuntu...
So when do we need to require 'rubygems' in our code?
...
Hi All
I am trying to pass my test data to the test object.
I have a data object which has the parameters/hash that i need to pass to the test object.I just need to use the test framework for
1) running assertions on data in my data object
2) and to be able show a cumulative results for a large number of these test objects through ...
Hi Folks,
I'm trying to run Rails 3 beta 4 & Ruby 1.9.2rc on Ubuntu 10.04. It worked initially, but after doing my first bundle install/package, I now get the following errors in all rails projects. Even a basic 'rails new testproject' followed by a rake brings up the error messages.
In short, I'm stumped. Any help regarding what could...
Hi folks,
I've spent a fair bit of time with PHP & Python frameworks and recently thought I'd branch out to rails. The framework itself I like, but I seem to spend at least half my development time navigating through odd bugs and/or version incompatibilities between rails/ruby/rake/gems.
I'm happy to battle through it all if it gets le...
How to convert a ruby hash object to JSON? So I am trying this example below & it doesn't work?
I was looking at the RubDoc and obviously Hash object doesn't have a to_json method. But I am reading blogs, that Rails supports active_record.to_json and it also supports hash#to_json. I can understand ActiveRecord is a Rails object, but Has...
I've got two models that look like this
class Stage
include DataMapper::Resource
property :id, Serial
belongs_to :staff
end
class Staff
include DataMapper::Resource
property :id, String, :key => true
property :full_name, String
property :email, String
has n, :stages
end
I'm trying to find all Stages that hav...
I have found a lot of information about adding form helper methods (see one of my other questions) but I cant find anything about adding helper methods as if they where defined in application_helper.rb
Ive tried basically copying application_helper.rb from a rails app into the gem but that didn't work.
Ive also tried:
class ActionVie...
like this:
s = 'HelloWorld-Hello guys'
I want to inert tag every 5 characters the result I want like this:
Hello<wbr>World<wbr>-Hell<wbr>o guys
thanks!
...
$param=k.chomp.split("\t")
how to find the lenght of $param thats is having class array.
actully when i m writing
puts $param.class
i got the o/p like Array.
now how to find the length of this array plzz help me
i tried with $param.length but its not working
...
I have the following string "\u3048\u3075\u3057\u3093". I got the string
from a web page as part of returned data in JSONP.
What is that? It looks like UTF8, but then should it look like "U+3048U+3075U+3057U+3093"?
What's the meaning of the backslashes (\)?
How can I convert it to a human-readable form?
I'm looking to a solution with...
I am starting out to play around with Ruby and trying to make a desktop app using Ruby and wxRuby.
So, to start out with a new ruby only project, I have few questions:
I need a standard directory structure, what is the best possible way to do it? I tried out newgem with details here, but it seems that that the newgem website is not up...
Hi guys,
I'm trying to do a validates_format_of on the latlng object that is passed back from Google Maps API. I've got the map set up perfectly so that when I click on a point in the map it fills in a text-field with the latlng (which looks like this: 46.320615137905904, 9.400520324707031). I'm storing this value as a string in the db ...
I have a string coming from a database, for example 0b0101000.
I'd like to cast it to a binary value, in order to apply byte operations on it, like 0b01011000 & (1<<0 | 1<<4)
...
Hi guys,
I want to replace the last occurence of a substring in ruby. What's the most eastest way?
For example, in abc123abc123, I want to replace the last abc to ABC. How can I did that?
...
Hi, the new object structure in 1.9 embeds some ivars into objects for faster access:
#define ROBJECT_EMBED_LEN_MAX 3
struct RObject {
struct RBasic basic;
union {
struct {
long numiv;
VALUE *ivptr;
struct st_table *iv_index_tbl;
} heap;
VALUE ary[ROBJECT_EMBED_LEN_MAX...
I'm creating some basic work assistance utilities using Ruby. I've hit a problem that I don't really need to solve, but curiosity has the best of me.
What I would like to be able to do is search the contents of a file, starting from a particular line and find the first PREVIOUS occurrence of a string.
For example, if I have the follow...
I have the following code:
puts "amit"
puts "ravi"
It outputs:
amit
ravi
I would like to redirect amit to one file and ravi to a different file.
Suppose my file name is name.rb. When I am trying like
system("name.rb > #{@filename}")
both amit and ravi are redirected to @filename but I want redirection to a different file or fi...
Hi guys
I would like to know if anyone meet a similar situation.
What are the reasons for a company to decide that you must develop using Linux environment (virtual machine) and not Windows environment?
Here there's no workstations with Linux at all - all computers have Windows installed. There's one production Linux server.
Is it ...
How simplify this part of code:
actor.inspect if actor.is_a? Array or actor.is_a? Hash
I try sth like this, but it dosen't work proper:
actor.inspect if [Array, Hash].each { |c| actor.is_a? c }
...
It appears this topic has been covered a few times before, but those solutions have only gotten me so far. I now have my sources properly updated and I am able to query for gems without an error but I keep getting empty results for my searches.
I installed rubysspi and copied over the spa.rb file as mentioned in the readme.
The readme...