Hi,
I previously asked a similar question on this topic, I ended up deriving several solutions which worked, one based on bloom filters + ngrams, the other based on hash tables + ngrams. Both solutions perform fine with small data sets (<1000 texts, usually tweets) but the computation time grew exponentially meaning doing 10,000 could t...
I'm trying to get Redmine working with postgres.
In my logs I keep seeing.
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`
After googling everyone said you needed to do gem install pg. But when I do gem list
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.8, 2.3.5)
activeresource (2.3....
Possible Duplicate:
class << self idiom in Ruby
I have a quick Ruby question. I come from a Java/c background, so I understand in Ruby "self" when referenced inside a instance method acts like "this". And "self." prefix for method defines it as a class method.
But what does this mean here??
class << self
def some_method
...
Okay I have an extensive ruby application running behind Ruby on Rails right now. This application needs form input but I don't want to refresh the page when I update the text box. What I mean is:
I have a form that has two text boxes, one is called "starttime" and one is called "endtime". I somehow need to get the value of these text b...
I'm writing a new gem I'm basing off of Yehuda's new gem template and I'm slightly confused. Having a Gemfile with dependencies, and also specifying a gemspec with dependencies seems redundant to me. Can someone explain why this is desirable and if it's truly necessary?
Note, this is the first gem I've ever written so I'm new to all o...
I'm looking to build a web interface for an existing Ruby app and I'm trying to figure out which version of Rails to use - the latest current version 2.3 or the soon-to-be-released version 3.0.
The reasons for using 2.3 are pretty straightforward: it's the current version and it's stable.
My reasons for considering 3.0 are:
My app us...
I was getting 0.5 reqs/s on the front page of my rails app (a very simple, mostly static page that made a couple of database calls, but nothing that WEBrick said took longer than 0.8 ms), served with thin. I added ruby-prof profiling tools to my ApplicationController via the instructions at Dan Mange's blog and dumped the call graph to s...
It's a best-practice question. There are obvious ways to do that, none of them just seem quite right.
Quite often I need to test that some multi-line string gets produced. This normally breaks indentation making everything look like a mess:
class TestHelloWorld < Test::Unit::TestCase
def test_hello
assert_equal <<EOS, hello_world...
I can't believe there isn't a standard way of doing this, but I'm submitting content from a textarea to a Rails controller, and it doesn't seem to preserve the line breaks (of any form).
Here is my view code:
f.text_area :keywords, :cols => 50, :rows => 10
submit_to_remote 'button', "#{t "add_keywords"}",
:html => {:id => 'add...
I want to delete my task ajax-style if some conditions are met. I do that with the help of link_to_remote. The thing is that link_to_remote wants to render a template and i dont want it to.
In my view ( _task_sth.html.erb):
<%= link_to_remote "Delete task", :url => {:controller => 'tasks', :action => 'delete_task', :task_pers_id => sor...
I'm constructing some data to send over jQuery's $.post, the data that I send looks like this:
authenticity_token: LxHlgi1WU8o0DtaNuiQOit/e+HlGR2plVcToHUAhA6I=
crews[0][boat_id]: 2
crews[0][crew][]: 10
end_time: 1280408400
start_time: 1280404800
Which is from jQuery converting the data object which is prepared by:
creating an array ...
I've recently just added Devise to my first Rails3 app, and I'm having a bit of trouble with the controller tests.
I'm testing the User controller class, which is the same model that Devise uses. So at the beginning of my spec I have this:
before(:each) do
sign_in @user = Factory.create(:user)
end
Now I can get the test passing wit...
Here's a simple ActiveResource class. It has some instance variables and maybe even some methods, but it's not backed by any data.
ruby-1.8.7-p299 > class Box < ActiveResource::Base;
attr_accessor :a, :b, :c, :d;
end
=> nil
Let's populate it:
ruby-1.8.7-p299 > bx = Box.new; bx.a = 100; bx.b = 20...
I have recently started using Rake for my personal projects, mainly because I am not into make anymore and prefer to avoid learning a custom language just for builds.
However, based on a quick google, there don't seem to be any many non-ruby projects using rake. And certainly none with any recall value.
Am I right? Are there any non...
I am using a class that accepts overridden methods i meant optional argument signatures (not sure if that matters in this case, but maybe)
when I call this from IRB it is working as expected, eg, it accepts the arguments
(filtering namespaces and passwords with [filtered] where needed to keep secret stuff secret and my company happy)
...
Is there an easy way to have backgroundrb started (restarted) when the server reboots?
Ex. What if your hosting use mongrel cluster and you have no access to it (except start/stop)
One of solution i found on forums is code snippet in backgroundrb plugin with check for PID exist (if not exist start with exec or system) etc.
Just your id...
Trying to set up a Rails app in a subdirectory. My server is Cherokee. I have a base url of:
www.nonsense.com, which is a wordpress blog, and I wish to set up a rails app in, www.nonsense.com/rails_app.
A quick scan of google led me to using: ActionController::AbstractRequest.relative_url_root = "/rails_app"
However, it seems this has...
I'm initializing an instance of a class that tests the equality of two formulas.
The formula's calculated values are in fact equal:
RubyChem::Chemical.new("SOOS").fw
=> 96.0
RubyChem::Chemical.new("OSSO").fw
= 96.0
When I created a new class to check the equality of these two instances I'm a bit surprised by the results:
x = RubyCh...
What's the most concise way to determine if @hash[:key1][:key2] is defined, that does not throw an error if @hash or @hash[:key1] are nil?
defined?(@hash[:key1][:key2]) returns True if @hash[:key1] exists (it does not determine whether :key2 is defined)
...
I have a Ruby webapp that caches some frequently used information in a lightweight layer, but there are times at which I want to reset the cache without restarting the entire process.
Before I started using Unicorn, I had a known list of ports that I could send a special HTTP request to reset the cache on each instance. However, under U...