Select in form_for in Rails 3

July 11, 2011

0

I have often been confused about form helpers in rails. Recently I was doing a project in which I had to use select tag. So finally after spending a lot of time on this trivial things I figured it out. Its very simple….lemme explain (or I must say lemme show u how stupid I was […]

Posted in: Rails app

Rake 0.9 breaks. !!

June 27, 2011

0

Recently I was doing a rails project where I did a normal rake db:migrate I got an error like this: rake aborted! uninitialized constant Rake::DSL /usr/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'  /usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:8:in `<class:TaskLib>'  /usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:6:in `<module:Rake>'  /usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/tasklib.rb:3:in `<top (required)>'  /usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/rdoctask.rb:20:in `require' /usr/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/rdoctask.rb:20:in `<top (required)>'  /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `require'  /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `<top (required)>' /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `load' /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `block in <top (required)>'  /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `each'  /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `<top […]

Posted in: Rails app

A SAMPLE PROGRAM TO PERFORM REGRESSION ON 2 SERIES

June 25, 2011

0

The formula used is : Regression Equation(y) = a + bx  Slope(b) = (NΣXY – (ΣX)(ΣY)) / (NΣX2 – (ΣX)2) Intercept(a) = (ΣY – b(ΣX)) / N #this is a simple program to perform linear regression on 2 sequences x and y #the 2 sequences will be accepted as arguments in the function #v is the […]

Posted in: Ruby

A SAMPLE PROGRAM TO CALCULATE CORRLATION BETWEEN 2 SERIES

June 25, 2011

0

  The program is self-explanatory and comments will be helpful The formula used is : #This is a program to find correlation between 2 sequences x and y #In this program , x and y will be arrays passed as arguments to the function class Correlation def corr_calculate(x,y) #first lets fnd mean of x and […]

Posted in: Ruby

A SIMPLE PROGRAM TO CALCULATE GEOMETRIC MEAN OF A GIVEN SEQUENCE IN RUBY LANGUAGE

June 24, 2011

0

In this program the practical definition of a geometric mean is used. The definition is : The average of the logarithmic values of a data set, converted back to a base 10 number. I have found that base 10 is not required. I have used base 2 and as far as I know, anything can […]

Posted in: Ruby

CONNECT 2 DATABASES IN A SINGLE RAILS APPLICATION

June 22, 2011

0

Many a times , the need of the situation is to connect ,multiple databases to a single rails app. This seems to be a bit complex issue since we are all used to connect a single database to a rails app. But after some googling, I found out that in rails, it’s a damn simple […]

Posted in: Database, Rails app

DEPLOY A RAILS 3 APP IN RACKSPACE

June 20, 2011

0

EDIT: TO INSTALL MYSQLITE AND SQLITE3 USE THE FOLLWING: yum install mysql-server mysql-libs mysql-devel yum install sqlite sqlite-devel THIS INSTALLS THE LIBRARIES gem install sqlite3-ruby THIS INSTALLS THE GEM The steps to setup/deploy your rails application on a rackspace cloud server are given below. The steps given below worked for me. Along with the steps […]

Posted in: Rails app