To install RMagick with image magick on ubuntu is very simple you just need to run three commands from your terminal. Just make sure that you have install ruby and rubygem.
Once your ruby and rubygem is install run the following command.
1. sudo apt-get install imagemagick
2. sudo apt-get install libmagick9-dev
3. sudo gem install rmagick
Thats it and Rmagick in installed on your ubuntu environment.
Tuesday, September 30, 2008
Monday, September 29, 2008
uninitialized constant Gem::GemRunner (NameError)
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
After installing ruby and rubygem on Ubuntu i started getting 'uninitialized constant Gem::GemRunner (NameError)' Error, so the solution for this is.
add the following command in your /usr/bin/gem
require 'rubygems/gem_runner'
Thats it and it will start working..
After installing ruby and rubygem on Ubuntu i started getting 'uninitialized constant Gem::GemRunner (NameError)' Error, so the solution for this is.
add the following command in your /usr/bin/gem
require 'rubygems/gem_runner'
Thats it and it will start working..
Wednesday, September 3, 2008
add_column new feature :after
Have created a new method, at the time of adding a new column in existing method. The method name is called :after
for ex
add_column :users, :user_info, :string, :after => "email"
when we execute the migration the email will be place just after user_info field in users table.
for ex
add_column :users, :user_info, :string, :after => "email"
when we execute the migration the email will be place just after user_info field in users table.
Monday, September 1, 2008
list of same column name from all the tables.
Hello Friend,
This time i'll tell you something about how we can know which table contains the same column name in a database.
[Note] This query only work in MySQL 5.02 and above
[Important]: - This query can help Ruby developer when they assigned a new project and if the project does not have a E-R diagram, As we never set a foreign key at a database level.
So here is the query
SELECT TABLE_NAME, COLUMN_NAME FROM information_schema.columns
WHERE COLUMN_NAME = user_id' AND table_schema = "test_development"
This time i'll tell you something about how we can know which table contains the same column name in a database.
[Note] This query only work in MySQL 5.02 and above
[Important]: - This query can help Ruby developer when they assigned a new project and if the project does not have a E-R diagram, As we never set a foreign key at a database level.
So here is the query
SELECT TABLE_NAME, COLUMN_NAME FROM information_schema.columns
WHERE COLUMN_NAME = user_id' AND table_schema = "test_development"
MySQL Database Dump from shell....
Hello Friends,
This is how we can take a database dump from command prompt.
1. Suppose you want to dump the entire database u can fire following command from cmd prompt...
"test_dump" will be your database name...
Your_location_where_you_want_to_save:\> mysqldump -u root -p test_dump > filename.sql
2. Suppose there are n numbers of table and we want to take a back of only 2 table let say table_abc, table_xyz from the "test_dump" database, so you can fire the below mention query...
Your_location_where_you_want_to_save:\> mysqldump --add-drop-table -u root -p test_dump table_abc table_xyz > filename.sql
Note: -
1. The filename can be anything.
2. Your_location_where_you_want_to_save = can be let say c drive c:\>
This is how we can take a database dump from command prompt.
1. Suppose you want to dump the entire database u can fire following command from cmd prompt...
"test_dump" will be your database name...
Your_location_where_you_want_to_save:\> mysqldump -u root -p test_dump > filename.sql
2. Suppose there are n numbers of table and we want to take a back of only 2 table let say table_abc, table_xyz from the "test_dump" database, so you can fire the below mention query...
Your_location_where_you_want_to_save:\> mysqldump --add-drop-table -u root -p test_dump table_abc table_xyz > filename.sql
Note: -
1. The filename can be anything.
2. Your_location_where_you_want_to_save = can be let say c drive c:\>
Monday, August 25, 2008
ERROR: While executing gem ... (Gem::InstallError)
Many developer had faced the issue at the time of installing rails 2.1.0 by using 'gem install rails'
ERROR: While executing gem ... (Gem::InstallError)
invalid gem format for c:/ruby/lib/ruby/gems/1.8/cache/activesupport-2.1.0.gem
So here is the solutions:
After doing some sort of R&D i found that you will need to download 'activesupport-2.1.0.gem' from http://rubyforge.org/frs/?group_id=570 site and first install activesupport manually. and then run 'gem install rails' from command prompt.
Wednesday, July 9, 2008
divide single word into sentence.
The below mention function will divide the long character word into specific sentence.
for e.g you have a input like "aaaaaaaaaaaaaaaaaaaa" you want this should be divide that means each sentence should contain 5 character "aaaaa aaaaa aaaaa aaaaa".
def word_division(char_length, comment_value)
return nil if comment_value.nil?
chunk_size = char_length
i = 0
chunks = []
while i < comment_value.to_s.length
chunks << comment_value.to_s[i,chunk_size]
i = i + chunk_size
end
return chunks.join(" ")
end
for e.g you have a input like "aaaaaaaaaaaaaaaaaaaa" you want this should be divide that means each sentence should contain 5 character "aaaaa aaaaa aaaaa aaaaa".
def word_division(char_length, comment_value)
return nil if comment_value.nil?
chunk_size = char_length
i = 0
chunks = []
while i < comment_value.to_s.length
chunks << comment_value.to_s[i,chunk_size]
i = i + chunk_size
end
return chunks.join(" ")
end
Subscribe to:
Posts (Atom)
