The Nginx approach to HTTP PUSH is relatively simple. There are 3 party involve: Subcriber (receiver), Publisher (sender), and the server itself act as multicast server.
Nginx can also separate into different channel with different channel ID that user can access.
But I still don't know how to authorize/limit content only for logged in...
I have to render a mesh of a few thousand polygons in Google Sketchup. I find that add_face tends to get slower as the number of faces in the model increases. I believe this to be due to some edge detection algorithm that Sketchup is running behind the scenes. Hopefully, there should be some way to suppress this edge detection or other p...
As a ruby newbie, I was wondering, will gems ever conflict with eachother? For example, if 2 gems overrode the << method on array, which would win, or is there something to stop this?
Thanks
...
consider that i have a migration as follows
create_table :dummies do |t|
t.decimal :the_dummy_number
end
i instantiate like the following
dummy = Dummy.new
dummy.the_dummy_number = "a string"
puts dummy.the_dummy_number
the output for the above is
0.0
how did this happen? since i assign a wrong value shouldn't it raise a...
I have a Capistrano deploy.rb script which has multiple tasks that can be invoked on the command line
cap site1_to_live deploy
cap site2_to_live deploy
(...etc)
I have tried combining these into a single task as follows
task :all_to_live do
site1_to_live
site2_to_live
site3_to_live
end
However, only one of the tasks is execut...
I'm learning Ruby and RoR at the moment, and I came across this:
<% for post in @posts %>
in the Rails guide. I'd understood that the idiomatic way to do this in Ruby is with:
<% @posts.each do |post| %>
If there is a difference then what is it? And if there isn't a difference then wouldn't it be better for the Rails people to be p...
In which I mean "rebasing" in the dictionary, rather than git definition...
I have a large, long running Rails project that has about 250 migrations, it's getting a touch unwieldy to manage all of these.
That said, I do need a base from which to purge and rebuild my database when running tests. So the data contained in these is importa...
Let's say, I want to separate certain combinations of elements from an array. For example
data = %w{ start before rgb 255 255 255 between hex FFFFFF after end }
rgb, hex = [], []
data.each_with_index do |v,i|
p [i,v]
case v.downcase
when 'rgb' then rgb = data.slice! i,4
when 'hex' then hex = data.slice! i,2
end
end
pp [r...
So i have an array of @horses = [] that i start filling with some random horses.
How can i check if my @horses array includes a horse that is already included (exists) in it?
I tried something like:
@suggested_horses = []
@suggested_horses << Horse.find(:first,:offset=>rand(Horse.count))
while @suggested_horses.length < 8
hor...
We're adding an expires_at column to one of our models. Among other changes, we've got to track down everything with a belongs_to relationship to the model and add the condition that expires_at must be in the future.
Is there a way to do this centrally, so that rather than modifying all the other models, we modify the one that expires?...
I'm working on some scripted GUI test for a windows C# .net app. I'm using Ruby to drive the testing and my feet are officially wet in the realms of WIN32API - but I'm certainly not over-confident with it. As a mater of fact, I feel like I'm missing some fundamental understanding. At this point, the only way I know how to gain access ...
I am working on the application that require documents to be embeded inside the webpage .
I want to embed a powerpoint slides inside the page, any pointer would be helping
The application i am working on is built on Ruby on Rails
I have checked google doc viewer but for some reason its not rendering the pdf/ppt from my application
c...
[
{
"name": "John Doe",
"location": {
"name": "New York, New York",
"id": 12746342329
},
"hometown": {
"name": "Brooklyn, New York",
"id": 43453644
}
},
{
"name": "Jane Doe",
"location": {
"name": "Miami, Florid...
I am trying to create instances of objects of various types by iterating and checking for validity. I need an array of types so I can do something like this:
def tryClasses(in)
types = [Foo::A, Foo::B, Foo::C]
types.each do |type|
a = type.new(in)
return a != null
end
end
How do I create and array of clas...
Ok, so I'm not having trouble with this per say, but I want to make sure that I'm doing this right because it just seems like a lot of extra work in the long run.
I am working with Sinatra and using HAML templates. I want to include a JavaScript file from my HAML file. My directory structure looks like this:
media/
js/
init.js (file...
What is the best Ruby library for dealing with Excel spreadsheets?
I found spreadsheet-gem but I didn't find it to be as good as PHPExcel - a library I used to use when I was a PHP developer.
Please help.
Thanks.
...
Guys,
Is there a may to write an instance method that only operates on a collection of the class?
So for example say I have something like this:
class Foo
def collection_method
puts "I only work on a collection of Foo!"
end
end
@foos = []
5.times {@foos << Foo.new}
@foo = Foo.new
@foos.collection_method #=> I only w...
Goal: Using a CRON task (or other schedule event) update rails database with nightly export of data from an existing system.
All data is created/updated/deleted in an existing system. The website does no directly integrate with this system, so the rails app simply needs to reflect the updates that appear in the data export.
I have a .t...
Hi all.
I'm a happy user of RoR but have one complaint. When I do script/generate scaffold it automatically generates all my files and places them in their proper folders. However, all the different scaffolds I've created name their view files the same.
I have a bunch of index.html.erb view files and when I have them open in my tex...
this is a sample of the xml file
<row tnote="0">
<entry namest="col2" nameend="col4" us="none" emph="bld"><blst>
<li><text>Single, head of household, or qualifying widow(er)—$55,000</text></li>
<li><text>Married filing jointly—$115,000</text></li>
</blst></entry>
<entry colname="col6" ldr="1" valign="middle"> </entr...