Monday, November 23, 2015

PostgreSQL installation on AWS Linux server

Steps to install PostgreSQL in Linux server
Prerequisites

    You will need to have access to a superuser, or sudo account, so you can install the PostgreSQL database software

Installation

First, update apt-get library

     $ sudo apt-get update

Then install PostgreSQL and its development libraries

     $ sudo apt-get install postgresql postgresql-contrib libpq-dev

PostgreSQL is now installed  

Create PostgreSQL User

To create new user run the below command with your own user name

     $ sudo -u postgres createuser -s <pg-username>

If you want to set a password for the database user, enter the PostgreSQL console with this command

$ sudo -u postgres psql

Enter the following command in PostgreSQL prompt to set the password for the user that you created before

postgres=# \password pguser

MySQL installation on AWS Linux server

Steps to install MySQL in Linux server
Prerequisites

You will need to have access to a superuser, or sudo account, so you can install the MySQL database software
Installation

First, update apt-get library

     $ sudo apt-get update

Then install MySQL and its development libraries

      $ sudo apt-get install mysql-server mysql-client libmysqlclient-dev

During the installation, your server will ask you to select and confirm a password for the MySQL "root" user. MySQL is now installed

Secure MySQL server

Run some additional commands to get our MySQL environment set up securely

First we need to tell MySQL to create its database directory structure where it will store its information

      $ sudo mysql_install_db

Afterwards, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system

      $ sudo mysql_secure_installation

Access MySQL server

To Access the MySQL shell

      $ mysql -u root -p

After entering the MySQL root password into the prompt you can able to access MySQL server prompt.

Installing RVM in deployment Server

1) Update all latest packages
  • sudo apt-get update

2) Update gpg Keypair
  • gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
If its failed then run the below command
  • command curl -sSL https://rvm.io/mpapis.asc | gpg --import -

3) Install RVM
  • curl -sSL https://get.rvm.io | bash -s stable

4) Load RVM
  • source ~/.rvm/scripts/rvm

5) Install RVM dependancies
  • rvm requirements

6) Install required dependancies
  • rvmsudo /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion



Monday, April 22, 2013


SEARCH ENGINE OPTIMIZATION (SEO)

Introduction
SEO will help search engines find and rank your site higher than the millions of other sites in response to a search query. SEO helps you get traffic from search engines. Although the basic principle of operation of all search engines is the same, the minor differences between them lead to major changes in results relevancy.

SEO Score
SEO has a unique scoring system based on the following SEO factors:
  • Page Indexable
  • Meta Description
  • H1 and H2 tags
  • ALT Image Tag
  • SEO Friendly URL
  • Title Tag
  • Number of links
  • Page Rank
Page Indexable
Search engines can understand content in HTML or text format. Content involving images, and audio and video elements are not legible to search engines. However alternatives are available to make these non-indexable formats understandable to search engines.
Images come with "alt" attribute, which can be given keyword descriptions for capture by search engines; CSS style can be implemented to replace images with text formats publishing text transcripts for audio and video content makes them indexable.

Meta Description
Meta description tag is used for a brief description of the page. It is used by all popular search engines when displaying search engine results. Having a good Meta description can improve your chances of the visitor clicking on your result in the search engine.

  • Write a sensible description and avoid automated tools for generating meta description.
  • You can include your popular keywords n the meta description as they will be bold when displayed in search engine results.
  • Keep it up to around 70 words (350 characters). Search engines display variable length but they will pick the best bit to display based on user search.
  • Use unique descriptions for each page
H1 and H2 tags
Header tags are a great way to help boost your search engine rankings. H1 tag is usually larger than normal text and helps users quickly learn what the page is about.

  • Use H1 and H2 tags to highlight important keywords
  • H1 tag should be used once on the page
  • H2 tag can be used as many times, after the H1 tag

ALT image tag
ALT image tag has became particularly important with the increase in demand for image searches which can significantly contribute to your search engine traffic if used properly. 

The best practices for image search optimizations are:

  • Use alt and title tags in your images to describe the context of the image with relevant keywords
  • Avoiding long ALT text that would be considered as spam.
  • Avoiding only image links for your site's navigation.

SEO Friendly URL
URL structure on the site appear to have a static structure like "/category/page" in contrast to dynamic structure like "/category/page?cat=3&page=1".

Avoid:
    1. using lengthy URLs with unnecessary parameters and session IDs
    2. choosing generic page names like "page1.html"

Title tag
Browser title tag is one of the most important on-page SEO factors. The following things are recommended by SEO

  • Always include a title tag on your pages.
  • Don't use multiple title tags in single page.
  • Keep the title length up to 11 words or 70 characters.
  • Use relevant keywords in your title tags.
  • Don't use single title tag across your site.
  • Using extremely lengthy titles are unhelpful for the users.

Number of links
Number of links represents number of links found on the page. Search engines consider only a certain number of links on a page and would ignore others for purposes of page rank calculation.

Page Rank
Page Rank is one of many factors that determine where your web page appears in search result ranking, but if all other factors are equal, Page Rank can have significant impact on your search engines rankings. to increase your Page Rank, you need to have "back-links," Search engines often use the number of back links that a website has as one of the most important factors for determining that website's search engine ranking, popularity and importance. As you build web pages within your website, you can create some of your own back-links by linking to relevant pages within your own website.

Conclusion
As an Internet marketing strategy, SEO considers how search engines work, what people search for, the actual search terms or keywords typed into search engines and which search engines are preferred by their targeted audience. Optimizing a website may involve editing its content, HTML and associated coding to both increase its relevance to specific keywords and to remove barriers to the indexing activities of search engines. Promoting a site to increase the number of back links, or inbound links, is another SEO tactic.


Saturday, March 31, 2012

Install Rails 3 using RVM on ubuntu


1. Installing RVM

Ruby Version Manager is a great tool for isolating your development environment to each individual project.  This allows you to have specific ruby versions with specific gemsets isolated from the rest of your development environment, virtually eliminating any potential conflicts.  Although not absolutely required to use Rails or Ruby, RVM will greatly reduce headaches with managing ruby.  To learn more about RVM, visit the RVM homepage.
Luckily, RVM provides an install script that we can download and execute with a single command.  This command will download the latest code from the github repository, so you need to have git and curl installed on the system.  If you are using a recent linux distro like Ubuntu 11.10, then you might already have git and curl installed. If not, execute the following command:

>$ sudo apt-get install git curl
Start the RVM installation by running this command:

>$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Friday, March 30, 2012

Devise gem for Authentication in Rails 3

Devise Authentication in Rails 3

 Devise gem features:
  • Database Authenticatable: encrypts and stores a password in the database to validate the authenticity of an user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
  • Token Authenticatable: signs in a user based on an authentication token (also known as “single access token”). The token can be given both through query string or HTTP Basic Authentication.
  • Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
  • Recoverable: resets the user password and sends reset instructions.
  • Registerable: handles signing up users through a registration process, also allowing them to edit and destroy their account.
  • Rememberable: manages generating and clearing a token for remembering the user from a saved cookie.
  • Trackable: tracks sign in count, timestamps and IP address.

Thursday, March 29, 2012

Rails 3.2.3.rc1 has been released!

Rails 3.2.3.rc1 has been released.

IMPORTANT

This release changes the default value of config.active_record. white-list_attributes to true. This change only affects newly generated applications so it should not cause any backwards compatibility issues for users who are upgrading but it may affect some tutorials and introductory material. For more information see the mass assignment section of the ruby on rails security guide We've also adjusted the dependencies on rack-cache and mail to address the recent security vulnerabilities with those libraries. If you are running a vulnerable version of mail or rack-cache you should update both gems to a safe version. We also fixed a couple of regressions in the render method.
If there are no release blockers, then I will be releasing the final version on March 30th. If you find something please open an issue on github and let me know through email (santiago at wyeworks.com), tweet (spastorino) or cc me on the github issue.

CHANGES since 3.2.2

Action Mailer
  • Upgrade mail version to 2.4.3 ML
Action Pack
  • Do not include the authenticity token in forms where remote: true as ajax forms use the meta-tag value DHH

How to develop rails plugin from scratch?...

How to develop rails plug-in from scratch?

Generate Plug-in with command: 

     >$ rails generate plugin hello_world

It will create file system as bellow:
- lib
    - hello_world.rb
- tasks
    - hello_world_tasks.rake
- test
    - hello_world_test.rb
- init.rb
- install.rb
- uninstall.rb
- README
- Rakefile
- MIT-LICENSE

init.rb will be executed every time when your application runs. Generally hook code is to be included here like you want to make all methods of your plugin available in your app’s models, controllers, views and helpers

Example:
#All methods in module HelloWorld will be available in all #model’s object
ActiveRecord::Base.class_eval do
    include HelloWorld
end

Ruby on rails installation on ubuntu

1. What is Rails ?

Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern. From the Ajax in the view, to the request and response in the controller, to the domain model wrapping the database, Rails gives you a pure-Ruby development environment. To go live, all you need to add is a database and a web server.

2. How to Install it on Ubuntu ?

2.1 First we need to install Ruby and irb (Interactive ruby shell) and we'll add ri and rdoc. The recommended Ruby version for rails is 1.8.5.
      Open your terminal and type: 

     >$ sudo apt-get install ruby irb ri rdoc ruby1.8-dev
To check Ruby version

     >$ ruby -v
2.2 Then we need to install RubyGems. RubyGems is installed from tgz file.We are going to install RubyGems with the following command

Wednesday, March 28, 2012

Intro to Ruby On Rails

What is Ruby ?

Before we ride on Rails, let's know a little bit about Ruby which is the base of Rails.

Ruby is
  • A High Level Programming Language
  • Interpreted like Perl, Python, Tcl/TK.
  • Object-Oriented Like Smalltalk, Eiffel, Ada, Java.
  • Originated in Japan and Rapidly Gaining Mind-share in US and Europe.

Why Ruby ?

Ruby is becoming popular exponentially in Japan and now in US and Europe as well. Following are greatest factors: