How to install Capybara on Linux

Standard

Using the Capybara on Linux, you need to install some dependencies.

You may get some errors like these:

Installing capybara-webkit (0.12.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/home/franzejr/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb

Gem files will remain installed in /home/franzejr/.rvm/gems/ruby-1.9.2-p320@indica/gems/capybara-webkit-0.12.1 for inspection.
Results logged to /home/franzejr/.rvm/gems/ruby-1.9.2-p320@indica/gems/capybara-webkit-0.12.1/./gem_make.out
An error occured while installing capybara-webkit (0.12.1), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v ‘0.12.1’` succeeds before bundling.

OR

`ensure_application_exists!’: Xvfb not found on your system (Headless::Exception)

group :test,:development do
     gem 'capybara'
     gem 'capybara-webkit'
end

Firstly you need to use the capybara-webkit and install QT dependencies in your OS.

Ubuntu

sudo apt-get install libqt4-dev libqtwebkit-dev

Ubuntu 10.04 LTS

sudo apt-get install libqt4-dev

Debian Stable

sudo apt-get install libqt4-dev

Fedora

yum install qt-webkit-devel

Fedora 16

yum install qtwebkit-devel

If you are using a recent version of Fedora, the qmake executable is now called qmake-qt4. This will cause the gem installation to fail. So you need to add an environment variable your profile or the system profile.

export QMAKE=/usr/bin/qmake-qt4

Gentoo Linux

emerge x11-libs/qt-webkit

About QT installation you may check here.

You will need to install  xvfb and also use Headless gem. Headless is the Ruby interface for Xvfb. It allows you to create a headless display straight from Ruby code, hiding some low-level action. It can also capture images and video from the virtual framebuffer.

 

Advertisements

Sending e-mails with :sendmail in Rails 3

Standard

If you have a Linux Server and you want to send emails in your Rails Application using your own email server please check this. We are using ssmtp.

Put this in your environment.rb:

ActionMailer::Base.delivery_method = :sendmail
        ActionMailer::Base.sendmail_settings = {
          :location => "ssmtp",
          :arguments => "-i"
        }

Common Mistakes

Errno::EPIPE: Broken pipe

Maybe cause you are using the argument “-t” rather than “-i”.

SSMTP is a simple and powerful way to send e-mails, mainly now in your rails application. = )

Sending Emails from a Ubuntu Server – GMail

Standard

1)Instal SSMTP:

sudo apt-get install ssmtp

2)Edit /etc/ssmtp/ssmtp.conf

mailhub=smtp.gmail.com:587
hostname=USER@MYDOMAIN.com
root=USER@MYDOMAIN.com
AuthUser=USER@MYDOMAIN.com
AuthPass=PASSWORD
UseSTARTTLS=yes
UseTLS=yes
FromLineOverride=yes

3)Edit /etc/ssmtp/revaliases

This step is important!

root:USER@MYDOMAIN.com:smtp.gmail.com:587
matt:USER@MYDOMAIN.com:smtp.gmail.com:587

4)Send a Test E-mail

ssmtp test@test.com
To: Test Guy <test@test.com>
From: Me <USER@MYDOMAIN.com>
Subject: Hello World

Hello world!

Using web2py with postgreSQL

Standard

You must to install the packages:

  • python-dev
  • libpq-dev
We will use the PsycoPg which is the most popular PostgreSQL adapter for Python.
Download the PskycoPg.
At psycopg directory:
$python setup.py install
At db.py, you can use:
    db = DAL(‘postgres://postgres:postgres@localhost/name’)

Problem with Debian and Dropbox

Standard

I’m a Debian User. I’m using Debian 6.0 (squeeze). I have a lot of problems with my dropbox installation, because there are some dependencies which in Debian are not default. With this tutorial I hope that any debian user can install dropbox( nautilus-dropbox ) in your machine.

1)Download the .deb at Dropbox Site

wget http://www.dropbox.com/download?dl=packages/nautilus-dropbox_0.6.8_i386.deb

If you want instal, you will see an error like this:

Depends: libnautilus-extension1 (>=1:2.22.2) but 2.30.1-2 is to be installed
This dependencies are not correctly specified.

2)Create a directory, put the dropbox files in it, do some modifications and build a new version for you with
these modifications.

mkdir -p extract/DEBIAN
dpkg-deb -x  nautilus-dropbox_0.6.8_i386.deb extract/
dpkg-deb -e nautilus-dropbox_0.6.8_i386.deb extract/DEBIAN/

Edit the control file at /extract and after copy this file to /DEBIAN
You must to modify this line:

Depends: libatk1.0-0 (>= 1.20.0), libc6 (>= 2.4), libcairo2 (>= 1.6.0), libglib2.0-0 (>= 2.16.0), libgtk2.0-0 (>= 2.12.0), 
libnautilus-extension1 (>=2.22.2), libpango1.0-0 (>= 1.20.1), python (>= 2.5), python-gtk2 (>= 2.12)
Suggests: nautilus (>= 2.16.0)

Before it was:

libnautilus-extension1 (>= 1:2.22.2) , you must to delete “1:”

3)Create a new build with these modifications:

mkdir build

dpkg-deb -b extract/ build/

With this new .deb you can install
4)dpkg -i nautilus-dropbox_0.6.8_i386.deb
5)Start dropbox: dropbox start -i
My .deb you can download here

Restoring default gnome settings

Standard

I was with a problem. When I started my gnome, the processor was 100% in use. So, after a lot of searches I found this command:

$ rm -rf .gnome .gnome2 .gconf .gconfd .metacity

With this my gnome has back to default configurations and my processor is not running at 100%. I think it happens cause I done something wrong