Tuesday, February 26, 2008

Rmagick installation on Ubuntu

Rmagick installation on Ubuntu

I have seen many times that people are facing a lot of problem in installing RMagick and Image Magick on ubuntu.......The same problem was faced by me and i got it solve by following the steps given below


Download RMagick and Imagemagick..

put RMagick in the vendors folder where u want it to run from and Image Magick on Desktop

Go to the Path where Image Magick is stored and follow the steps

1) ./configure

2) make

3) make install


if you get an error while doing this task

type the following command in terminal

apt-get install build-essential (make sure that ruby dev is installed)


once you have done this follow the above 3 steps and things should start working

So thats all about ImageMagick

now come RMagick installation

move the the RMagick installation path and follow the steps

1) ./configure

Thats it..now things should work..

I dont think u will get any error. If you get any post ur errors as comment and get it solved..

Setting up ImageMagick & rmagick on Redhat



  1. sudo yum install libjpeg-devel libpng-devel glib2-devel fontconfig-devel zlib-devel libwmf-devel freetype-devel libtiff-devel
  2. wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.2-9.tar.gz
  3. tar zxzvf ImageMagick-6.3.2-9.tar.gz
  4. cd ImageMagick-6.3.2-9
  5. ./configure
  6. make
  7. sudo make install
  8. sudo gem install rmagick

Wednesday, February 20, 2008

Radiant CMS

Radiant CMS

Its a powerful open source CMS (Content Management System) developed in ruby on rails. Radiant 0.6.4 has just been released! This version includes a powerful extension system so developers can tailor Radiant to their specific needs. Here i gave you some instructions to deploy it on your localhost.

First install the gem by

% gem install --include-dependencies radiant

Then create a radiant project of your own by

% radiant --database [mysql|postresql|sqlite3] path/to/project

for eg:
% radiant --database mysql my_radiant_application


Then you have to configure your database by edit your database.yml file like follows

development:
adapter: mysql
database: my_radiant_development
username: root
password: admin
host: localhost

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: mysql
database: my_radiant_test
username: root
password:
host: localhost

production:
adapter: mysql
database: my_radiant_production
username: root
password: admin
host: localhost



you can use any of the database modes listed in database.yml. Then based on your database configuration
database schema should created by

% rake [environment] db:bootstrap

for eg: % rake production db:bootstrap if u r in production environment

Here u goes, start your server

% mongrel_rails start -e , where mongrel is your server (Mongrel server)


Type the http://localhost:3000/admin to login. The user name is password should be known to you because
while creating schema it asks for u the admin user name and password.
In the application you can't see any model, controller or view files but its working
fine this is how possible is all those files are written along with the radiant gem that
u should installed before starting project. you can see those files in your local ruby gems folder.

Thats all , now you can go ahead with some other own radiant application.
if you want more explanation go and visit Radiant home page

Sunday, February 17, 2008

Captcha

Well with increase in spamming this facility of captcha has done the magic although people always find some or the other reason to crack a security but for the time being this can be implemented..

Captchator is a very good service which can be combined easily with RoR and implement captcha

Jst few lines of code does the magic for you

View :-
in img src call the follwing source http://captchator.com/captcha/image/$yoursessionid

Just like the one below



Write the above lines in views which will display a random captcha on the form or the page

Then http://captchator.com/captcha/check_answer/$yoursessionid/$answer using this fetch the value which is entered by the user

If the answer is correct, the result is "1", if not, it is "0".

You can check the same in ur browser

Try it in your Browser:

1. Go to http://captchator.com/captcha/image/(anything you like) and read the text from the picture.
2. Go to http://captchator.com/captcha/check_answer/(anything you like)/(text from the picture). If you entered the text correctly, you will see "1".


Thats it..Captcha Ready for ur site..Aviod spamming in 10 mins no more security and coding required.

File Column Plugin

This is another plugin which i have implemented for File uploading. The main advantage of this is that we can integrate RMagick to it easily for generating thumbnails and giving other properties to the plugin.

The main thing after downloading the plugin from http://www.kanthak.net/opensource/file_column/file-column-0.3.1.tar.gz
you just need to put 2-3 lines of code and get things going

on the page from where u want to upload a file just write 1 line of code

<%= image_tag url_for_file_column("entry", "image") %>

Controller will look something like where versions part can be included only if you configure Rmagick else just remove the 2nd line and use it :-

class Entry < ActiveRecord::Base
file_column :image, :magick => {
:versions => { "thumb" => "50x50", "medium" => "640x480>" }
}
end


Lastly Model (the most imp part) :-

class Entry < ActiveRecord::Base
file_column :image, :magick => { :geometry => "640x480>" }
end

write this in the model of the page where u want to implement the plugin

Thats it.. njoi

Act As Threaded (Forums)

Hi all looking out for making a forum for your site..

this is one of the methods which i have implemented on www.pleasecoumtnein.org

Act_As_threaded which is a tree structure forum where performance is a concern. The nested_set model is insert/update heavy but the whole tree can be retrieved in order from the database with a single query.

It can be downloaded from http://i.nfectio.us/plugins/acts_as_threaded.zip

More in depth execution and implementation will be shown here later on.

Thursday, February 14, 2008

Acts as Authenticated

Acts as Authenticated
Acts As Authenticated is a simple authentication generator plugin for Ruby on Rails. It is available in subversion at:

http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated

Use script/plugin to install it:

Try This

script/plugin source http://svn.techno-weenie.net/projects/plugins
script/plugin install acts_as_authenticated

Or One-Line It

script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated

Then…

script/generate authenticated user accountrake db:migrateStart your server and navigate to the account page:

http://localhost:3000/account/indexThe whole idea behind the plugin is that you generate the code once and add in your application specific authentication actions. This makes no attempt to decide how your application’s authorizing works.