Hey guys, I have a sort of speed dating type application (not used for dating, just a similar concept) that compares users and matches them in a round based event.
Currently I am storing each user to user comparison (using cosine similarity) and then finding a round in which both users are available. My current set up works fine for sma...
I want to test one program which can capture and send IP packets to some clients, so how to mock request or client in Cucumber? thanks
...
Is there a way to find out how many bytes of data is available on an TCPSocket in Ruby? I.e. how many bytes can be ready without blocking?
...
Hi, Im new to watir and running scripts from it. Just want to ask if how can I get or extract the error messages Scite displays on the left panel and import it to a textfile? or is it really possible to do? Thanks.
...
I use crontab to invoke rake task at some time for example:
every 3 hour
I want to ensure that when crontab ready to execute the rake task
it can check the rake task is running. if it is so don't execute.
how to do this. thanks.
...
I'm trying to setup an ajax-based website that loads a fragment of a webpage when a specific combination of GET variables and HTTP Headers are given.
GET /normal/html/page?ajax=true
X-ajax: true
What I've setup in my controller is:
before_filter do |controller|
if request_by_ajax?
ApplicationController.layout false
end
end
...
I am new to Ruby on Rail and I have some questions.
I have used the Builder to output XML.
render :template => "xxx/yyy.xml.builder"
However I want to add a filter to modify the output (i.e. signing it). I prefer not to generate the XML and modify it in the controller as I think it is a responsibility of a view. Is there any chain me...
If I have a text input name 'email', and if I set :message => 'Your email is wrong kind' the validation error message will have something like
'Email Your email is wrong kind.'
I am wondering if there is any way to remove that orginal input name (in above case, its Email) from the validation error output in rails3.
...
We're doing some prototyping of a new app and noticed that one of the actions were taking forever to load (80-120 seconds). As a lot of the processing doesn't need to happen on page load (we can request the data via Ajax later), I thought of using Process.fork to allow the page to return immediately, while the processing still happening ...
I am in ruby 1.9.2, rails3.
So My website has some structures,
and I want to put menu in a middle of my webpage.
I am doing something like (within application.html.erb file)
blahblahblah
<div id="menu">
<%= yield :menu %>
<div>
blahblhablah
I have a file menu.html.erb which has menu structure for the site.
What can I do if I wan...
require 'eventmachine'
module EchoServer
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
send_data ">>>you sent: #{data}"
close_connection if data =~ /quit/i
end
def unbind
puts "-- someone disconnected from the echo server!"
end
end
class ...
I understand that the file task is executed dependent on some list of monitored files:
file "file_to_edit" => ["a","b"] do
do_x_here
sh "echo 'a or b changed' >> file_to_edit"
end
So in this case, if a or b change, then do_x_here is executed as is the sh command.
However, I have a situation where the same file would be changed wi...
Wondering if there's a way I can avoid fetching the attachments as well.
...
I have bees searching for a good solution for Tree Data Structure in Rails 3.
I'm trying to build a Tree menu.
What do you use and what would you recommend?
...
I understand my question is a bit vague but I don't know how else to describe it. I've asked in numerous places and no one seems to understand why I want to do this. But please bear with me, and I'll explain why I want something like this.
I'm using Liquid Templates to allow users to make some dynamic pages on my site. And for those tha...
hi all,
is there a way to tell rubygems to always search for remote gems (instead of local)? I tried adding the following line to my ~/.gemrc
gem: --remote
but the problem is, that when i do gem list i get the following result
~$ gem list
*** REMOTE GEMS ***
- (1)
10io-jekyll (0.7.0)
1234567890_ (1.0)
2Performant (0.0.8)
360_servi...
I am having trouble accessing the attributes of a join in Rails3.
There is two models/tables : Place and Address. One place can have many addresses (i.e. a specific street address, a "corner of" address, etc.). For historical reasons, the tables do not follow standard Rails conventions:
class Place < ActiveRecord::Base
set_table_name ...
Hi i have a XSD that i want to parse. Note that i don't want validate it against a XML but get all enumerations that i have there. For example
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="fruitNames">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="banana" />
<xsd:enumeration valu...
Hi!
I've got an array of uniq numbers. Like this: [1,2,3,4,7,8,10,12]. It can be unsorted.
What I need is to get intevals for this array:
intervals_for [1,2,3,4,7,8,10,12]
#=> "1-4, 7-8, 10,12"
I've got my own solution:
def intervals_for(array)
array.sort!
new_array = []
array.each do |a|
if new_array.last and a == new_arr...
Hello, I have a form displaying a nested relationship. The call to render the nested child objects is made like below:
<% if @fpimgblocks %>
<% f.fields_for @fpimgblocks do |builder| %>
<%= render 'fpimgblock_fields', :f => builder %>
<% end %>
<% end %>
@fpimgblocks is the result of a find, I have verified there are zero resu...