I have problem that is really easily solved with Guids.
In particular, for a password reset workflow I would like to send a Guid token to a users email and have them reset their password using the token. Since guids are unique this is pretty secure and saves me emailing people passwords which is risky.
I noticed there is one Guid gem...
When i run cucumber it displays the
possible steps that i should define, an example from the RSpec book:
1 scenario (1 undefined)
4 steps (4 undefined)
0m0.001s
You can implement step definitions for undefined steps with these snippets:
Given /^I am not yet playing$/ do
pending
end
When /^I start a new game$/ do
pending
end
Then /^t...
I want to get the background color of a cell of an Excel worksheet. I have already tried the following:
begin; require 'rubygems'; rescue LoadError; end
require 'appscript'
f = MacTypes::Alias.path(File.join(File.dirname(__FILE__), "planning.xls"))
excel = Appscript.app("Microsoft Excel")
excel.activate
excel.open f
w1 = excel.workshee...
What is the idiomatic way to add an include guard in a ruby file analogous to
#ifdef FOO_H
#define FOO_H
...
#endif
in C?
...
If I have a base windows xp system, ruby and an ms access 2007 file (say c:/foo/bar.accdb) file, what's the least intrusive method for reading that .accdb file.
What needs to be installed on the xp system.
What is the specific connection string.
...
I only need to download the first few kilobytes of a file via HTTP.
I tried
require 'open-uri'
url = 'http://example.com/big-file.dat'
file = open(url)
content = file.read(limit)
But it actually downloads the full file.
...
I have a model "Task" which will HABTM many "TaskTargets".
When it comes to TaskTargets however, I'm writing the base TaskTarget class which is abstract (as much as can be in Rails). TaskTarget will be subclassed by various different conceptualizations of anything that can be the target of a task. So say, software subsystem, customer ...
Since http is stateless, every request to an app creates a new object. How does Rails clean up the unused objects / how frequently?
...
I'm working with a Ruby project for school, and have sadly not been able to find an answer to this question in my literature.
I have an array of camping lots, each containing a guest. I initialize the lots like this:
lots = Array.new
for i in (1..36)
lots[i] = Lot.new(i)
end
Further down I create a Guest object, initialize it, an...
I'm new to rails, and I'm watching this video tutorial online and I was wondering what programs are being using - I recognize terminal, but thats about it.
http://media.rubyonrails.org/video/rails_take2_with_sound.mov
...
Hello all, I'm just beginning with Nokogiri and have a question, hope you guys can help me out:
1) I need to parse a set of xml files (let's say 5 files).
2) Find elements with specific value (for instance, City = "London"), with XPATH.
3) Have a new xml file, with the results of the previous xpath parsing.
...
I have the following code in a function:
num_procs.times do
pid = fork
unless pid
DRb.start_service
ts = Rinda::TupleSpaceProxy.new(DRbObject.new_with_uri('druby://localhost:53421'))
loop do
item = ts.take([:enum, nil, nil])
# our termination tuple
break if item == [:enum, -1, nil]
result =
...
Up until now I've been deploying Rails apps to our Apache/Passenger setup using a simple Rake task that I wrote. I haven't tried to mess around with Capistrano or Vlad the Deployer.
However, now more developers are coming on board, and I'm interesting in arranging things so that the deployment process runs the tests first and won't depl...
I'd like to store and update blogger labels to datastore in GAE.
When I run that code, I get this error:
javax.servlet.ServletContext log: Application Error
/base/data/home/apps/yet-another-problem/1.334886515480009498/WEB-INF/gems/gems/sinatra-0.9.2/lib/sinatra/base.rb:45:in each': undefined method bytesize' for #<Hash:0x86684c> (NoMet...
Studying Ruby and the Do block. Coming from much c# I didn't see much that reminded me of Do, but then VB came to mind with the With statement and one which I wish was in c# (maybe it is and I never saw it?). The two statements, Do and With, appear similar.
Is the With statement in VB the same as a Do block in Ruby?
EDIT:
Take this ...
I'm new to EventMachine, so I'm not sure what this means. I'm getting this exception:
EventMachine::ConnectionNotBound recieved ConnectionUnbound for an unknown signature: ef93a97d4d6441cb80d30fe2313d7de73
The program is fairly complicated, so I can't really explain everything that might have led up to it. All I need is a pointer to...
m making project on double data compression which uses the lossless data compression technique..
can any one tell me how should i procede??
m making project for the first tim..
please help me frnds...
...
Hello, I'm trying to run a script every minute with "SINC is not CRON". I've used the following crontab line
* * * * * ruby -X D:/xampp/htdocs/maker ./do.rb
and now every minute I get a new cmd window. How can I force Ruby or SINC to invoke these as background processes?
...
Hypothetically, I have a Room model that belongs to a Building model. Buildings has a has_many relationship with categories.
I'm trying to figure out how to index the Room model so that a search for category_id = 1 will return any room, in any building that happens to have that category assigned to it. Again, a building can have multi...
--preface: ignore if you want.
I'm new to rails, and working on a project that will require user authentication.
I found this tutorial and have been trying to go through it and understand what's happening. Of course, it's not exactly what I need as-is, so I've been modifying as I go along. The tutorial is also out of date in some areas, ...