I'm considering using bundler for deploying a Spree app on Heroku. My question is, is bundler ready for prime time? I know there are some rough edges but I guess I'd like to know more about what the current limitations are and figure out if this is an option for us.
Specifically, I'd like to do the git repository stuff
git "git://git...
Hi, I am trying to to get cucumber to run with no luck. Here is the error I am seeing:
cucumber features Using the default profile... no such file to
load -- test/ (MissingSourceFile)
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
poly...
Net::HTTPResponse's body is a stream-like object, and you get can read its input in lazy chucks using read_body. In the rest of ruby, steams are represented as class IO. Is there a wrapper or something that lets me use a Net::HTTPResponse as if it was an IO object?
...
I've got a parser written using ruby's standard StringScanner. It would be nice if I could use it on streaming files. Is there an equivalent to StringScanner that doesn't require me to load the whole string into memory?
...
The following function generates a 'stack level too deep (SystemStackError)' for n = 5,000
def factorial(n)
n == 0 ? 1 : factorial(n -1) * n
end
Is there a way to avoid this error using continuations/callcc?
Note:
I know this can be implemented without recursion. e.g.
def factorial2(n)
(1..n).inject(1) {|result, n| result * n ...
I want to define the block as a string, then create the lambda.
The following example does not work.
Is something like this possible?
code_string = "|x|x*2"
l = lambda {eval(code_string)}
l.call(3) => 6
...
Hi
I want to use a custom template file which shoud use the base layout file (app/view/layouts/application.html.erb) in a Rails metal code. Can somebody give me some hints what I need to require or how I can do that?
...
The text file has hundreds of these entries (format is MT940 bank statement)
{1:F01AHHBCH110XXX0000000000}{2:I940X N2}{3:{108:XBS/091502}}{4:
:20:XBS/091202/0001
:25:5887/507004-50
:28C:140/1
:60F:C0914CHF7789,
:61:0912021202D36,80NTRFNONREF//0887-1202-29-941
04392579-0 LUTHY + xxx, ZUR
:86:6034?60LUTHY + xxxx, ZUR vom 01.12.0...
I'm trying to interpolate environment variables into a string in Ruby and not having much luck. One of my requirements is to do something (log an error, prompt for input, whatever) if a placeholder is found in the initial string that has no matching environment variable. It looks like the block form of String#scan is what I need. Below i...
How can I do the equivalent of the Ruby snippet below using Java?
require 'net/http'
res = Net::HTTP.get_response(URI.parse("http://somewhere.com/isalive")).body
...
I would like to randomly iterate through a range. Each value will be visited only once and all values will eventually be visited. For example:
class Array
def shuffle
ret = dup
j = length
i = 0
while j > 1
r = i + rand(j)
ret[i], ret[r] = ret[r], ret[i]
i += 1
...
In Java, a 'static method' would look like this:
class MyUtils {
. . .
public static double mean(int[] p) {
int sum = 0; // sum of all the elements
for (int i=0; i<p.length; i++) {
sum += p[i];
}
return ((double)sum) / p.length;
}
. . .
}
// Called from outside the MyUtils cl...
Hi
How can I use yield for template inheritance in erb? I want to use erb in a plain ruby CGI script and want to use a base template and subtemplate like it Rails with the application template does.
...
Hello,
I not sure I have understood all the principles of nosql, especially Cassandra project, but I like to know if it's possible to have Cassandra working with Data-mapper ?
I working on a ruby application using Data-mapper and MySQL and start to think of migrating to Cassandra. Is that something easy and worth doing ?
Thanks a lot,
Lu...
I am trying to rescue from a `require': no such file to load in ruby in order
to hint the user at specifying the -I flag in case he has forgotten to do so.
Basically the code looks like:
begin
require 'someFile.rb'
rescue
puts "someFile.rb was not found, have you"
puts "forgotten to specify the -I flag?"
exit
end
I have expect...
While coding in Ruby I did not really miss the type-orientedness of Java or C++ so far, but for some cases I think it is useful to have them. For Python there was a project PyProtocols which defined interfaces and protocols for objects. Does a similar initiative also exist for Ruby? I would like to be able to declare the expected paramet...
I have a situation for Ruby, where an object is possibly necessary to be created, but it is not sure. And as the creation of the object might be costly I am not too eager creating it. I think this is a clear case for lazy loading. How can I define an object which is not created only when someone sends a message to it? The object would be...
On a bash console, if I do this:
cd mydir
ls -l > mydir.txt
The > operator captures the standard input and redirects it to a file; so I get the listing of files in mydir.txt instead of in the standard output.
Is there any way to do something similar on the rails console?
I've got a ruby statement that generates lots of prints (~8k l...
I'm getting some weirdness with QtRuby when using a TableWidget. The table widget loads, but when you click on the elements in the row, the app segfaults and crashes.
require 'Qt4'
class SimpleModel < Qt::AbstractTableModel
def rowCount(parent)
return 1
end
def columnCount(parent)
return 1
end
...
If i had a list of balls each of which has a color property. how can i cleanly get the list of balls with the most frequent color.
[m1,m2,m3,m4]
say,
m1.color = blue
m2.color = blue
m3.color = red
m4.color = blue
[m1,m2,m4] is the list of balls with the most frequent color
My Approach is to do:
[m1...