Friday, December 18, 2009

Aptitude Package search in Linux

We can search the packages available in the synaptic package manager without accessing Synaptic Manger GUI mode.

In Terminal

$sudo aptitude search package name

It will gives you the package list which contains your package name. It also tells you whether this package is installed in your machine or not.

Installed Package - starts with 'i'
Not installed Package - starts with 'p'

for eg.,

sudo aptitude search firefox-3
i A firefox-3.0 - safe and easy web browser from Mozilla
i A firefox-3.0-branding - Package that ships the firefox branding
p firefox-3.0-dev - Development files for Mozilla Firefox
p firefox-3.0-dom-inspector - dummy upgrade package for firefox-3.0-dom-inspector -> xulrunner-1.9-dom-inspect
p firefox-3.0-gnome-support - Support for Gnome in Mozilla Firefox
p firefox-3.0-venkman - dummy upgrade package for firefox-3.0-venkman -> xulrunner-1.9-venkman
p firefox-3.1 - dummy upgrade package for firefox-3.1 -> firefox-3.5
p firefox-3.1-branding - dummy upgrade package for firefox-3.1 -> firefox-3.5
p firefox-3.1-dbg - dummy upgrade package for firefox-3.1 -> firefox-3.5
p firefox-3.1-dev - dummy upgrade package for firefox-3.1 -> firefox-3.5
p firefox-3.1-gnome-support - dummy upgrade package for firefox-3.1 -> firefox-3.5
i firefox-3.5 - safe and easy web browser from Mozilla
i A firefox-3.5-branding - Package that ships the firefox branding
p firefox-3.5-dbg - firefox-3.5 debug symbols
p firefox-3.5-dev - Development files for Mozilla Firefox
p firefox-3.5-gnome-support - Support for Gnome in Mozilla Firefox

Thursday, December 17, 2009

IBM's Mainframe Machine Dresses up with Linux

IBM's new system uses IBM's specialty Linux processor and runs either Novell SUSE or Red Hat systems. They are not using mainframe operating system z/OS but includes mainframe management software as well as IBM's z/Virtual Machine system on that machine. So IBM Machines are going to rock with Linux...

Details from

Saturday, December 12, 2009

git revert wrong commits

If you made any mistake in newly committed data then you can revert the git HEAD to previous commit.
For that u have to run the command

git revert --hard

for eg.,

$git revert --hard ab343n78

you can get this hash value in git log file for that you run this command

$git log

This shows you the Commit details in your local machine

Tuesday, December 8, 2009

Using Jekyll - blog post for static website

Basically jekyll is the gem which is mainly used for blog aware and static web page generator.
Jekyll follows its own directory structure and we can write it in any markup languages such as HTML, Textile or markdown etc.

#Install Jekyll gem

$ sudo gem install jekyll

You should have your website directory like


The configuration for jekyll as follows


destination: ./_site
auto: false # for auto updation without restarting jekyll server
lsi: true
server_port: 4000 #port number for server
permalink: date #Type of url generated for _posts

The _layout/ folder contains the default layout for website and you can have multiple layouts

The _post/ folder contains the blog post for your website Blog.

The post file name should be in this format "2009-12-8-how-to-post-a-blog-using-jekyll.html"
For reference

In terminal

cd website/ #give project directory
jekyll #It creates the _site/ in your website folder

The _site/ folder has the static web pages with blog posts...

For example:

Layout page i.e default.html has html, head and body tags


Inside Body tag contains
{{ content }}

This will replace the content for each page..

The Index.html looks like


layout: default
title: Index Page

<------ content for index page ---------->

After runninng the jekyll all this convention are converted as static page.

Tuesday, October 6, 2009

Rails ActionMailer gmail Configuration using SMTP

If u have RAILS_VERSION >= 2.3.3 and RUBY VERSION >= 1.8.7

then you no need to install any tls plugin.... Just follow the below steps....

Step 1

You have to add the following Configuration settings in {RAILS_ROOT}/config/environment.rb for Gmail ..

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "",
:port => 587,
:domain => "",
:user_name => "",
:password => "password123",
:authentication => :login,
:enable_starttls_auto => true #This line is must to ensure the tls for Gmail
config.action_mailer.default_content_type = "text/html"

Create mailer for your Project

#Type this in terminal
script/generator mailer
for eg.,

$ script/generator mailer Mailnotifier
exists app/models/
create app/views/mailnotifier
exists test/unit/
create test/fixtures/mailnotifier
create app/models/mailnotifier.rb
create test/unit/mailnotifier_test.rb

Step 3
Then you need to generate the mailer method for describing the mail content etc.,

$ script/generate mailer Mailnotifier notifier
exists app/models/
exists app/views/mailnotifier
exists test/unit/
exists test/fixtures/mailnotifier
overwrite app/models/mailnotifier.rb? (enter "h" for help) [Ynaqdh] Y
force app/models/mailnotifier.rb
overwrite test/unit/mailnotifier_test.rb? (enter "h" for help) [Ynaqdh] Y
force test/unit/mailnotifier_test.rb
create app/views/mailnotifier/notifier.erb
create test/fixtures/mailnotifier/notifier

Step 4
Then your models/Mailnotifier.rb looks like


class Mailnotifier < ActionMailer::Base
def notifier(sent_at =
subject 'Notifier'
recipients '' # Give the recipients mailID
from ''
sent_on sent_at
body :greetings => 'Hi,'

Step 5
In views/mailnotifier/notifier.erb file you can format the mail content as you like....

You Type this in your Terminal change directory to your rails application

$ script/console
Loading development environment (Rails 2.3.4)
>> Mailnotifier.deliver_notifier

This will send You the mail to your recipients address... :)

It Works Cool for me.....

Saturday, September 19, 2009

Argument Error (A copy of SectionsController has been removed from the module tree but is still active!)

U have seen this error frequently in rails 2.3.3.. So what u have do is just call your controller(which is shown in the ArgumentError) explicitly in your dependent controllers.

Add this line on top inside the class:

require "_controller"

This will not throw the following error...

ArgumentError (A copy of SectionsController has been removed from the module tree but is still active!):
app/controllers/sections_controller.rb:61:in `index'
haml (2.2.2) lib/sass/plugin/rails.rb:19:in `process_without_compass'
/usr/lib/ruby/gems/1.8/gems/chriseppstein-compass-0.8.8/lib/compass/app_integration/rails/action_controller.rb:7:in `process'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendered rescues/_trace (185.0ms)
Rendered rescues/_request_and_response (0.5ms)
Rendering rescues/layout (internal_server_error)

Gem command reference for Rails

I used this link for gem command reference.... I think this may useful to u...

Tuesday, June 30, 2009

How to Install the Image_science gems on hardy

The Gem Image_science is depends on FreeImage and RubyInline.So we have to install these two packages first.

Step : 1

Install FreeImage First from source:

1 sudo apt-get install build-essential
2 cd ~/sources
3 wget
4 tar -xvf freeimage_3.9.3.orig.tar.gz
5 cd freeimage-3.9.3.repacked/FreeImage
6 make
7 sudo make install

Step : 2
Install RubyInline as Gem

1 sudo gem install RubyInline -v 3.6.3

Step : 3
Install ImageScience as Gem

1 sudo gem install image_science