I am writing a simple ruby controller that just needs to respond as a webservice to a bunch of mobile clients.
Someone told me I should look into Sinatra. What is the point of using Sinatra for something this simple? He mentioned that it would be "faster" but how can a wrapper on top of something make it faster?
I don't want to overco...
I'm trying to convert this:
[ [1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12] ]
into this:
[ [1, 5, 9],
[2, 6, 10],
[3, 7, 11],
[4, 8, 12] ]
Is there a build-in function to do this? If it's not, what's the shorter and cleaner way?
...
Hi ,
how could I run a ruby script as a command in linux.
I have this script which access the lib but i have to run it as
teraData.rb
i want to run it as teradata (or some meaningful command ) with args on linux from any command promt.
Where should i place the script and what should I do?
I am kinda new to linux so please help
...
Hi All,
Loving MRToolkit -- great to get away from Java while writing Hadoop jobs. It has become apparent that the library was written to interface with an EC2 cluster, and not with Amazon's elastic map/reduce system. Does anybody have insights into running jobs defined using the toolkit on elastic map/reduce servers? It isn't readil...
Many of my users are typing in plain URL's and not using the Textile format for creating links. I would like Textile to just make the URL's linkable to the URL's. I don't really need to worry about XSS or anything malicious because it is an internal network with a very small group of users. What would be the best way to go about achievin...
Hello,
I saw this post
http://stackoverflow.com/questions/2059920/ruby-on-rails-awesome-nested-set-plugin
but I am wondering how to do the same thing without using node? I am also wondering what exactly this node is doing in the code itself.
In my categories view folder i have _category.html.erb and a _full_categores_list.html.erb.
...
I have a bunch of posts which have category tags in them.
I am trying to find out how many times each category has been used.
I'm using rails with mongodb, BUT I don't think I need to be getting the occurrence of categories from the db, so the mongo part shouldn't matter.
This is what I have so far
@recent_posts = current_user.rec...
In a windows environment I am getting the following error when trying to deploy to Heroku
C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/base.rb:32:in ': No such file or directory - git
remote (Errno::ENOENT)
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ba
se.rb:32:in shell'
...
Rails can't load (404 error) CSS & JS files on production but has no problem loading them in development.
I'm using Capistrano for deployment and running Rails 3. My path on development is /www/myapp but my path on production is /www/myapp/current.
The application itself seems to work fine, so the issue seems to be isolated to CSS/JS f...
So I'm using Delayed::Job workers (on Heroku) as an after_create callback after a user creates a certain model.
A common use case, though, it turns out, is for users to create something, then immediately delete it (likely because they made a mistake or something).
When this occurs the workers are fired up, but by the time they query ...
I am not trying to create yet another web framework.
For one of the applications I am working on, I want to create a custom framework. I don't want to use any already available framework.
What are the common things to consider?
What should be the architecture?
Thanks :)
...
I wonder if one should validate that the arguments passed to a method is of a certain class.
eg.
def type(hash = {}, array = [])
# validate before
raise "first argument needs to be a hash" unless hash.class == Hash
raise "second argument needs to be an array" unless array.class == Array
# actual code
end
Is it smart to do th...
I have some methods for a class which return arrays like ["1", "3", "2", "6", "2"]. It is ok that these are string arrays, not numeric. I have another method that takes an array, and turns it into a single string like this 1 3 2 6 2.
class Turn
def initialize
@rolls = 1
@dice = []
end
def roll
@roll = []
x = 5 - @dice.le...
In Rails guide this came up:
%w{ models }.each do |dir|
Could someone explain for me what %w{ models } means? Never seen it before. Is it ruby or rails specific.
Thanks
...
No luck in googling on this error message
features/manage_hand_evaluator.feature: Parse error at features/manage_hand_evaluator.feature:21. Found examples when expecting one of: comment, py_string, row, scenario, scenario_outline, step, tag. (Current state: step). (Gherkin::Parser::ParseError)
Here's the setup I have for Examples secti...
This loop does not terminate after I type x. I'm really new to Ruby, and so far, it is so much different than what I learned before - quite interesting,
total = 0
i = 0
while ((number = gets) != "x")
total += number.to_i
i += 1
end
puts "\nAverage: " + (total / i).to_s
Any help is greatly appreciated.
...
I've been learning a lot about web technologies recently and I want to put together a neat little website to play with html, css, javascript, flash, and what have you.
I know that as far as the web browser is concerned all I need to do is send a text file (usually HTML) from my server using HTTP over TCP.
I've gone through a couple o...
Does GridFS have an upsert?
For example, if i want to save an image with a specified _id, and one with that same _id already exists, i want it to overwrite (update) it. Otherwise, insert it.
Thanks!
Matt
...
How do I go about using SMSFu?
I have a Posts controller and I have cloned the sms-fu files into my plugin folder. But when I include SMSFu and refresh my application, I get this error uninitialized constant PostsController::SMSFu.
Where am I going wrong?
Thanks.
...
Suppose I installed some ruby gems using gem install gemname. Where should I install them, and when what directory should I run gem install rubygems-update-1.3.1.gem from?
...