Posted in Ruby on Rails (RoR) on August 23, 2007 | No Comments »
Step1> Open your database.yml file. Under the three standard databases (development, test and production) add the informations needed to connect to you extra dataabse(consider u are running application in production mode and have student_database and second database has mail_database) . Use the standard yml sintax like:
development:
adapter: mysql
database: Login_app_development
username: root
password:
host: localhost
test:
adapter: mysql
database: Login_app_test
username: root
password:
host: localhost
production:
adapter: mysql
database: [...]
Read Full Post »
Posted in Ruby on August 22, 2007 | 1 Comment »
Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward
The language was created by Yukihiro “Matz” Matsumoto, who started working on Ruby on February 24, 1993, and released it to the public [...]
Read Full Post »
Posted in Mysql on August 22, 2007 | No Comments »
Importing
The example below imports data from .txt file into table testtable.
temp.txt file is a tab separated file:
“1 string” 100
“2 string” 102
“3 string” 104
“4 string” 106
testtable structure
CREATE TABLE testtable
(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
text varchar(45) NOT NULL,
price integer not null);
query = “LOAD DATA INFILE ‘”+filename+
“‘ INTO TABLE testtable (text,price);”;
If you want to [...]
Read Full Post »
Rails 0.12 Added script/benchmarker to easily benchmark one or more statement a number of times from within the Rails environment.
Usage:
benchmarker times ‘Person.expensive_way’ ‘Person.another_expensive_way’ …
Examples:
# runs the one statement 10 times
script/performance/benchmarker 10 ‘Person.expensive_method(10)’
# pits the two statements against each other with 50 runs each
script/performance/benchmarker 50 ‘Person.expensive_method(10)’ ‘Person.cheap_method(10)’
$ ruby [...]
Read Full Post »
Create a form that will submit via an XMLHttpRequest instead of a POST request. The parameters are passed exactly the same way (so the controller can use the params method to access the parameters). Fallback for non JavaScript enabled browsers can be specified by using the :action methods in the :html option.
form_remote_tag :html => { [...]
Read Full Post »
Mongrel_cluster is a GemPlugin that wrappers the mongrel HTTP server and simplifies the deployment of webapps using a cluster of mongrel servers. Mongrel_cluster will conveniently configure and control several mongrel servers, or groups of mongrel servers, which are then load balanced using a reverse proxy solution. Typical load balancing reverse [...]
Read Full Post »