Blogs

Introduction


CSS Grid is new layout supported browsers. If we compare to with Bootstrap then CSS Grid does not require to include any external libraries, By adding CSS rules to parent (Grid Container) and to child elements (Grid Items).

CSS Grid is a two-dimensional grid layout, we can work with columns and rows. In comparison to Flexboxes (which is one-dimensional), the CSS Grid layout system provides you to build more complex layouts. It is possible we can use both: Flexbox and Grid Layout in CSS

In Bootstrap Grid Layout system it’s much cleaner to define the layout structure in CSS only. You don't need to include layout definition within your codes. This makes the code easier to read and you are able to quickly adapt the layout if needed without needing to rearrange your code.

 

Terminology

grid css

 

Grid Container

The grid container is the parent element of a grid layout system. The CSS rule display: grid needs to be applied to this container in order to active the CSS Grid layout mode.

Grid Line

Grid lines are the lines which define the structure of the grid and are dividing the grid into cells. Lines in a grid can be either vertically (dividing the grid into columns) or horizontally (dividing the grid into rows).

Each grid line has a unique number starting from 1 on the left side of the grid / on top of the grid. This line numbering is used to define grid area. You’ll see a practical example later on.

 


 

Grid Cell

A grid cell is the smallest unit inside a grid and is the area between two adjacent column grid lines and two adjacent row grid lines.

Grid Area

Inside a grid, a grid area can be any area which is surrounded by four lines. Each area can comprise of any number of cells.

Grid Item

Any direct child elements of the parent grid container are called grid items.

 

 Defining Grid Column And Rows

 

 grid-template-columns / grid-template-rows

The next step is to define grid columns and rows. This is done by adding CSS properties grid-template-columns and grid-template-rows to the definition of class container:

 

Location of Grid Items

 

grid-column-start / grid-column-end / grid-row-start / grid-row-end

 

So far our example showed that the defined grid elements are put into the grid cells one by another. Each grid item is placed inside one grid cell. You can change the grid item’s location and define that a grid item should span across multiple grid cells by using CSS properties grid-column-start, grid-column-end, grid-row-start, and grid-row-end.

To specify the location with these properties we’re referring to specific grid lines. Remember the lines are automatically numbered starting by 1 (both in row and column direction).

 

Browser Support

Since the beginning of 2017 CSS Grid layout support has been shipped with the public released of all majors browsers like Firefox, Chrome, Opera, and Safari.

The IE/Edge version of the specification is prefixed with an -ms prefix and the properties implemented in IE/Edge. This means that the default CSS property names like:

 

grid-template-columns needs to be changed in IE/Edge to: -ms-grid-columns


 

 

First, lets get into what is Shopify?

 

Shopify is an e-commerce platform for online stores.

Shopify gives us a platform for creating our own online shopping stores.


 

What is Liquid?

Liquid is an open source template language created by Shopify and which is written in Ruby. All the Shopify themes are built using liquid so we can say it is the backbone of Shopify and is used to load the dynamic content of online stores.

Liquid acts as a bridge between the web layout and the website data.

Basically, a template language makes it possible to re-use the static elements that define the layout of a webpage, while dynamically loading the pages with data from a Shopify store. The static elements are of-course written in HTML, and the dynamic elements are written in Liquid.

 

How does Liquid work with Shopify?

 

1. User requests a URL of a Shopify store in the browser.

 

2. Shopify works out to find which store is being requested.

 

3. For the requested store, Shopify selects the required liquid template from the active theme directory.

 

4. The liquid content place-holder is replaced with the real data stored on the Shopify platform for the requested e-Commerce website.

 

5. After that, the compiled HTML file is sent to the browser.

 

6. The browser processes the HTML file and fetches all other required assets(images, JS, CSS, etc.) files.


Liquid Syntax:

 

Liquid code can be categorized mainly into three things: Objects, Tags, and Filters.

 

Objects:

  • For displaying any object and or any variable name, we can use the output tag denoted by {{ …. }} double curly braces.

  • For example, we can display the title of a page using {{ page.title }}. Here, Liquid is rendering the value of the object with the name page.title.

  • Objects uses the dot syntax in-order to fetch any properties of an object.

Tags:

  • Tags are used to create the logic and control flow part for the templates.

  • The {% …. %} curly braces with a percent sign are used to denote a logic.

For example:

 

If the user is logged in and his name is Jay, then the above code will display - Hello Jay

Filters:

  • Liquid filters are used to modify the output of any numbers, strings, objects, and variables.

  • They are denoted by a pipe character “ | ” and are placed within an output tag {{ }}.

For example:

 

Liquid Collections:

  • Liquid collection is different from product collection. Generally, a bunch of products that are grouped together logically is called a product collection and in Liquid, a collection is the number of objects that are all the same.

  • Example: Collection of product images, etc

 

Conclusion:

Liquid is a powerful template language while working on the Shopify platform. And its similarity with HTML and ability to load the dynamic data makes it a great choice to create eCommerce websites with Shopify.

 

Introduction to ElasticSearch:


Elasticsearch is an open-source full-text search, real-time distributed engine. Developed on Java programming language, which enables Elasticsearch to run on different platforms.

Accessible from RESTful web service interface for querying and indexing massive amounts of structured data.

Elasticsearch can also be used as a data store engine.


 

General Feature:

Elasticsearch is scalable up to petabytes of structured and unstructured data. It can be used as a replacement of document stores like MongoDB where all the data store in a document.

The good thing about ElasticSearch is that, it an open source platform and available under the Apache license version 2.0.

Elasticsearch uses denormalization to improve the search performance.


 

Elasticsearch Advantages:

Elasticsearch is real time, in other words, after one second the added document is searchable in this engine. It is distributed from the cluster, which makes it easy to scale and integrate into any big organization.

Elasticsearch provides JSON objects as responses, which makes it possible to invoke the Elasticsearch server with a large number of different programming languages.

It also provides the feature of backup the data. Creates full backups easily by using the concept of the gateway.


 

Installation of ElasticSearch in Linux OS:

To begin, run the following command to import the Elasticsearch public GPG key into APT:

1]wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -


 

2]echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list


 

3] sudo apt update

4] sudo apt install elasticsearch


 

Open the file for configuration


 

5] sudo nano /etc/elasticsearch/elasticsearch.yml

Add network.host: localhost

6] sudo systemctl start elasticsearch


 

7] To enable Elasticsearch to start up every time your server boots:

sudo systemctl enable elasticsearch


 

8] Test whether your Elasticsearch service is running by sending an HTTP request:


 

Run command on terminal

curl -X GET "localhost:9200”

Output will get in response:


 

{ "name" : "ZlJ0k2h", "cluster_name" : "elasticsearch", "cluster_uuid" : "beJf9oPSTbecP7_i8pRVCw", "version" : { "number" : "6.4.2", "build_flavor" : "default", "build_type" : "deb", "build_hash" : "04711c2", "build_date" : "2018-09-26T13:34:09.098244Z", "build_snapshot" : false, "lucene_version" : "7.4.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }


 

Domain where we can use the ElasticSearch:

We can use the ElasticSearch where we have a huge amount of datasets and search data easily. Blog search document, E-commerce product sites, Geosearch data feature are the some domain where we can use the ElasticSearch.


 

Indexing in Elasticsearch:

Let’s say I have created an article in database

article#1 -> “global article"

article#2 -> “rails article"

article#3 -> “ruby on rails"


 

An inverted index for these records will be like this:


 

global -> article#1

article -> article#1, article#2

ruby-> article#3


 

In the inverted index,article#1 article#2 are the indices for ElasticSearch data. Now, searching for the word “article” uses the inverted index and return article#1 and article#2 directly.



 

Integration of Elasticsearch in Rails:


 

For integrating ElasticSearch, I created one rails application where simply implemented Article creation with fields Article title and content of the article. Also added one search form where I can search the text related to Articles.

To start using ElasticSearch add gems in Gemfile:


 

gem 'elasticsearch-model'

gem 'elasticsearch-rails’


 

Then we have to make the elastic search in the model we want to implement global search like below:


 

require 'elasticsearch/model'

class Article < ActiveRecord::Base

include Elasticsearch::Model

include Elasticsearch::Model::Callbacks


 

def self.search(query)

__elasticsearch__.search(

{

query: {

multi_match: {

query: query,

fields: ['title^10', 'text']

}

}

}

)

end

settings index: { number_of_shards: 1 } do

mappings dynamic: 'false' do

indexes :title, analyzer: 'english'

indexes :text, analyzer: 'english'

end

end

end

Article.__elasticsearch__.client.indices.delete index: Article.index_name rescue nil


 

# Create the new index with the new mapping

Article.__elasticsearch__.client.indices.create \

index: Article.index_name,

body: { settings: Article.settings.to_hash, mappings: Article.mappings.to_hash }


 

# Index all article records from the DB to Elasticsearch

Article.import


 

To create the indices in a model where a search will be execute ElasticSearch provide the method:


 

Article.__elasticsearch__.client.indices.create


 

To delete the indices use

Article.__elasticsearch__.client.indices.delete


 

There are many features provided by the ElasticSearch like keyword Analyser to search any text data using the keyword.



 

Peatio is an open source cryptocurrency exchange web application. Here you will be going to have your own cryptocurrency exchange. For the installation of Peatio, you should have a fresh Ubuntu system along with minimum 4GB RAM and 1 TB SSD.

 

Prerequisites

Now Start with the installation of following technology stack required for the peatio configuration and installation.

  1. Redis server

  2. RabbitMQ

  3. MySQL database

  4. Bitcoind

  5. Nginx with Passenger

  6. JavaScript Runtime

 

Step 01: Install Redis with a stable version

Redis is basically used in peatio for storing session data as well as trading data, that needs to be transferred from one application to another.
 

sudo apt-get update

sudo apt-get install redis-server

 

Now you can configure the redis.conf file as per the requirements

sudo nano /etc/redis/redis.conf

 

Step 02: Install RabbitMQ Server

RabbitMQ is used for exchange the data between servers, applications, and processes.
It uses the Advanced Message Queuing Protocol (AMQP) to exchange the data between peatio and the coin servers like bitcoind, ethereum, rippled, etc.

 

Install the rabbitmq-server by using the following commands.

 

sudo apt-get update

sudo apt-get install rabbitmq-server

 

To start the rabbitmq-server first enable the rabbitmq management plugin and then restart it.

 

sudo rabbitmq-plugins enable rabbitmq_management

 

sudo service rabbitmq-server restart

 

Same like above command we can use start, stop and status for checking the status of rabbitmq-server.

 

Step03: Install MySQL Database

Here we are going to install the mysql database.

sudo apt-get update

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

 

Step 04: Installation and Configuration of Bitcoind Server

 

Bitcoind is a program or daemon which implements bitcoin protocols for remote procedure call (RPC).
When the Bitcoind get installed in the Ubuntu system, it started syncing blocks of blockchain of Bitcoin. Once the difference between the current block and synced block is getting the same then we can make transaction form our local system.


Installation

First, install the dependencies then install bitcoind server.
 

sudo apt-get update

sudo apt-get install bitcoind

 

Configuration

Here we can configure the bitcoind server for testnet as well for real Bitcoin network.
 

mkdir -p ~/.bitcoin

touch ~/.bitcoin/bitcoin.conf

nano ~/.bitcoin/bitcoin.conf

 

Now insert the following lines into the bitcoin.conf file and replace with your ’s rpcuser and rpcpassword.

 

server=1

 

daemon=1

 

# If run on the test network instead of the real Bitcoin network

 

testnet=1

 

rpcuser=USERNAME

 

rpcpassword=PASSWORD

 

rpcport=18332

 

# Notify when receiving coins

 

walletnotify=/usr/local/sbin/rabbitmqadmin publish routing_key=peatio.deposit.coin payload='{"txid":"%s", "currency":"btc"}'

 

Now we can start bitcoind server using the following command or we can use bitcoin-cli for further operations.

 

bitcoind

 

Step 05: Nginx Installation

Nginx is an open-source web server which is used for low memory uses and high concurrency. It handles the high numbers of connections and acts as a load balancer to manage traffic and distribute it.
 

sudo apt-get update

sudo apt-get install nginx

sudo ufw allow 'Nginx HTTP'

systemctl status nginx

 

Now configure the default config file to setup Nginx with reverse proxy

open file ‘/etc/nginx/sites-available/default’ in an editor and replace the file content with the following

 

#

 

# ATTENTION!

 

#

 

# Make sure to add the next line to /etc/hosts.

 

#

 

 

 

server {

 

server_name http://localhost:3000;

 

listen 80 default_server;

 

 

 

location ~ ^/(?:trading|trading-ui-assets)\/ {

 

proxy_pass http://localhost:5000;

 

}

 

 

 

location / {

 

proxy_pass http://localhost:3000;

 

}

 

}

 

 

 

Make sure to replace http://localhost:3000 with your actual server.

 

You can verify the syntax of the config file is valid or not.

 

 

 

sudo nginx -t

 

and then restart the nginx server

 

sudo systemctl restart nginx

 

Step 06: Install JavaScript Runtime

The JavaScript Runtime is used for assets pipeline to work.

 

curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -

 

sudo apt-get install nodejs

 

Installation & Configuration of Peatio

First, take the clone of peatio form GitHub

 

mkdir cryptocurrency_exchange

 

cd cryptocurrency_exchange

 

git clone https://github.com/rubykube/peatio.git

 

cd peatio

 

use rvm 2.5.1

 

bundle install

 

now prepare the configuration files

 

bin/init_config

 

install and run the yarn

 

npm install -g yarn

 

bundle exec rake tmp:create yarn:install

 

Setup bitcoind rpc endpoints

 

Edit ‘config/seed/currencies.yml’

 

Replace ‘username:password’ and ‘port’

 

remember username:password should only contain letters and numbers not email address as a username.

 

Setup database for peatio

 

Edit ‘config/database.yml’ replace your database username and password. And run the commands.

 

bundle exec rake db:create

 

bundle exec rake db:migrate

 

bundle exec rake currencies:seed

 

bundle exec rake markets:seed

 

Run daemons

in the peatio directory

 

god -c lib/daemons/daemons.god

 

you can use commands like god start, god restart and god status daemon

 

Setup Authentication

 

By default peatio uses the google authentication, you can also use barong for the authentication.
Change the sign in provider as per your requirement in “/config/application.yml”

 

Run Peatio

Here we can start the server and run the Peatio application.
 

bundle exec rails s -p 3000

 

Here we can see the Peatio is running now.

 

A few clients ask us for what good reason we utilize Ruby on Rails to create web applications rather than the various web systems and languages. There are numerous purposes behind our choice, yet before I leave on an exchange of the favorable circumstances of Ruby on Rails, I should initially clarify what Ruby on Rails really is. 

RUBY ON RAILS 

Rails is a development tool which gives web developers a framework, providing structure for all the code they write.
The Rails framework helps developers to build Websites and Applications because it abstracts and simplifies common repetitive tasks.

Rails is written in Ruby, the programming language which is additionally utilized close by Rails. Ruby is to Rails as PHP is to Symfony and Zend, or as Python is to Django. The intrigue of Ruby to engineers lies in the polish and briskness of the language. 

One of the key standards of Ruby on Rails advancement (from this time forward 'Rails') is tradition over design. This implies the software engineer does not need to invest a great deal of energy arranging records so as to get setup, Rails accompanies a lot of traditions which help accelerate advancement. 

Another characteristic of Rails is the emphasis on RESTful application plan. REST (Representational State Transfer) is a style of programming engineering based around the customer server relationship. It empowers a consistent structure inside applications, which implies they can without much of a stretch be uncovered as an API (Application Programming Interface). 

From a project management point of view, the Ruby on Rails people group advocates Agile Web Development – an iterative improvement technique, that empowers shared and adaptable methodology, which is especially appropriate for Web Application Development with quick evolving prerequisites. 

In the course of the most recent couple of years Ruby on Rails development has picked up a vast and eager after, however, let's consider the fundamental pros of Rails. 

WHY WE PREFER TO USE RUBY ON RAILS: 

  • The way toward writing computer programs is a lot quicker than with different systems and languages, somewhat as a result of the article arranged nature of Ruby and the huge accumulation of open source code accessible inside the Rails people group. 
  • The Rails traditions additionally make it simple for engineers to move between various Rails ventures, as each task will, in general, pursue a similar structure and coding rehearses. 
  • Rails is useful for Rapid Application Development (RAD), as the structure makes it simple to oblige changes. 
  • Ruby code is truly readable and for the most part self-reporting. This expands efficiency, as there is less need to work out independent documentation, making it less demanding for different designers to get existing ventures. 
  • Rails has built up a solid spotlight on testing, and has great testing systems
  • Rails and the vast majority of its libraries are open source, so unlike other commercial development frameworks there are no licensing costs involved.

Active Job in Rails

26 Feb 2019

Ruby on Rails is the framework that provides the code to build most of the part of the application. When we develop the feature, the job is to write the parts of the application that help to perform a specific task. Ruby on Rails contains different sub-framework to complete feature, one of them is Active Job. When rails application requires to perform the queuing backend job Active Job framework can be used to declare job and make it run.

The active job can be used to send emails, calculate billing, send notifications, scheduled clean-ups. It divides the job in small chunks and runs in parallel. Our effort is to provide the customers with a user-friendly and flexible web application.

This can be approached when server response time is effective. So put jobs that take more time of server to execute in a queue and serve in the backend. Scheduling the task in queue backend distribute traffic on the server by allowing to complete the job when the server is free.

To schedule backend job and run the job resque-scheduler, delayed_job gems can be used.

I worked on the project Google Review management that requires to send the notification to the users whenever there is a new google review comes in application. If I have performed send notification in real time to users that will decrease the response time of server. To achieve this, I found the solution to use Active Job framework.

How to create the Active job in rails?

Active Job framework has a rails generator to create job.

$ rails generate job email_notifier


 


 


 


 

Above will generate the below structure.

invoke test_unit

create test/jobs/email_notifier_job_test.rb

create app/jobs/email_notifier_job.rb

Created job will be as below

class EmailNotifierJob < ApplicationJob

queue_as :default

def perform(*emails)

# perform notification task

end

end

ApplicationJob is the base class for Active Job.

Keep Job in the Queue

1] To enqueue the job to be performed as soon as the queuing system is free.

EmailNotifierJob.perform_later user

2]Schedule job in the queue to be performed tomorrow at noon use

EmailNotifierJob.set(wait_until: Date.tomorrow.noon).perform_later(user)

Execution process of Active Job

To process the queueing backend job in production, need to set up the third party queueing rails library. Rails have its own in-process queuing structure that holds the job in RAM. In case of process crash and resetting system, there can be chances to lost all the scheduled backend task work as default async backend. For backend scheduling, active Job has built-in adapters for multiple queuing backends (Sidekiq, Resque, Delayed Job, Scheduler and others ).

Setup Backend

# config/application.rb

module ReviewApp

class Application < Rails::Application

config.active_job.queue_adapter = :sidekiq

end

end


 

Begin Job in Backend

This job serves the Action mailer’s #deliver_later features which are used to send mails in the background as scheduled. Now a day ’s, it is commonly feature require in web application.

Let us consider the adapter of rails library sidekiq .Method #deliver_later sends emails asynchronously to multiple users. Therefore sidekiq start working using this method after Active job setup. Mailers are queued in the queue mailers.

To start sidekiq processing that enqueue:

bundle exec sidekiq -q default -q mailers

In Job queue to send the notification using actionmailer sidekiq as backend

NotifyUserMailer.notify_new_review(user).deliver_later.

We can also use other rails adaptor, it depends on the requirement to perform Active job in Rails.

What is E-commerce?

E-commerce i.e electronic commerce or internet commerce is nothing but the process of buying and selling of goods or services, or the transfer of money and data online i.e using the internet or electronic network. From mobile shopping to online payment, e-commerce encloses a wide variety of data, systems, and tools for both online buyers and sellers.

 

Most businesses with an e-commerce presence in short e-business use an e-commerce store and/or an e-commerce platform in order to conduct both online marketing and sales activities and to supervise plans and fulfillment.

 

E-commerce platforms are generally of two types:

1. E-commerce webstore with Single-vendor

2. E-commerce Marketplace with Multi-vendor

 

Types of E-commerce Models:

Generally, there are four main models of e-commerce where almost every transaction between takes place between consumers and businesses can be categorized into:

1. B2C

2. B2B

3. C2C

4. C2B

 

Let’s look at each type of e-commerce models in a bit more detail.

 

1. Business to Consumer (B2C):

B2C e-commerce encloses transactions made between a business and a consumer.

It refers to the sale of a good or service to an individual consumer by an individual business.

e.g: You buy shoes from an online shoe retailer.

 

This is one of the most widely used transaction models in the e-commerce context.

 

2. Business to Business (B2B):

B2B e-commerce encloses transactions made between businesses, such as a manufacturer and a wholesaler or retailer.

It refers to the sale of a good or service from one business to another business.

e.g: A business sells software-as-a-service (SaaS) for other businesses to use.

 

3. Consumer to Consumer (C2C):

C2C e-commerce business model is one of the earliest forms of e-commerce model.

It refers to the sale of goods or services between customers.

 e.g: You sell your old furniture’s on eBay or Amazon to another customer.

 

4. Consumer to Business (C2B):

When a consumer sells their own products or services to a business or organization, this kind of transaction is called C2B.

That is Individual consumers make their products or services available for business buyers.

An example of this would be a kind of business model like iStockPhoto, in which stock photos are available online for purchase directly from different photographers.

 

Shopify E-commerce Platform:

 

Shopify is “all in one” e-commerce platform which allows you to build an online store with the great user experience. It’s a fully featured hosted platform which is easy to use and quick to set up.

If you’re looking to sell products online with less experience in web development or coding, Shopify can be the e-commerce platform to achieve this.

Key features of Shopify:

  • Admin/Dashboard: They provide a dashboard/admin.

  • Theme Store: Shopify provides free and paid themes from the Shopify Theme Store to make your store look great.

  • Product Management: In Shopify, Product Management is easy. You can easily add Images from URL, manage variations of your products like product with different sizes or colors.

  • Payments methods: Shopify offers a wide range of payment methods with Shopify Payment which is Shopify's own payment provider to accept credit card payments and you can also choose Third Party Providers i.e. from over 70 credit card payment providers for your store.

  • Marketing & SEO: Shopify offers built-in Search Engine Optimization (SEO) features.

  • Analytics: Shopify provided with built-in analytics that helps you to keep track of your website’s progress over time.

  • 24/7 support: A dedicated Support team available 24/7 to answer your questions.

Shopify provides 14 days trial period, you can try to see how it works for your business. There are different monthly Shopify Pricing Plans, if the merchants located in India, you can see the details here otherwise if they located outside of India, you can click here to see details.

As Shopify is an E-commerce platform (i.e with single-vendor), you can sell your own products online.

 

You can also convert your Shopify single-vendor app into multi-vendor Marketplace by installing Multi-Vendor Marketplace plugin from Shopify app store into your Shopify app.

 

So, if you want to sell products on your own E-commerce webstore, I would like to suggest you prefer Shopify.

A cryptocurrency is nothing but a digital currency. Cryptocurrency exchanges are the platforms where you can buy, sell or exchange cryptocurrencies with other digital currency or with other assets such as fiat money. Fiat currency is like paper money for example Rupees, Dollars whose value is decided by the government.

 

To start with the cryptocurrency exchange, you have to create an account in a cryptocurrency exchange. The exchange will then verify your account. When you want to buy the cryptocurrency, check the asks and when you want to sell the cryptocurrency, check the bids. The ask represents the lowest price sell order that is currently available in the market or the lowest price that someone is willing to go short. The bids represent the highest price buy order that is currently available in the market.

 

Peatio Cryptocurrency Exchange

Peatio is an open-source cryptocurrency exchange developed in Ruby On Rails framework. You can easily use the Peatio cryptocurrency exchange code as it is freely available to any user.

 

If you have an interest in the cryptocurrency exchange domain and want to make your own cryptocurrency exchange, you can achieve that easily by making use of the Peatio cryptocurrency exchange.

 

Peatio is divided into three application i.e Peatio, Barong and Peatio Trading UI.

 

It’s key features:

  • Register/Login - User can register and login to the exchange.

  • Trading market - the Trading market is the heart of Peatio exchange.

  • Bids and Asks - In a trading market, the user can bid and ask the currencies. It gives the best match for bids and asks.

  • Trade machine-engine – As it has high-performance machine-engine for trading, orders and transactions can take place automatically.

  • Trading dashboard – It shows the data in real time for charts, orders, bids, asks, and markets.

  • Markets – There is a multi-currency market.

  • Orders – When user bid or ask, the order will get created in the exchange and once the price is matched for asks and bid order, the transaction takes place in the exchange.

  • Funds – User can easily deposit/withdraw coins and fiat amount in the exchange.

  • Transaction History – It has a transaction history page which shows the history of the transaction.

  • Admin Dashboard

  • Multiple currency support - There are many currencies supported by Peatio for exchange such as BCH, BTC, DASH, ETH, USD

  • 2FA and KYC – For the user security purpose, 2FA and KYC is developed

     

Being an open source, you can easily do the customization of UI. You can also customize the functionality of Peatio Cryptocurrency Exchange. I have seen making use of this exchange in an application created by “Cryptex Technologies” who is a ‘Ruby On Rails’ expert.

 

In Peatio, they have linked three application i.e. Peatio, Barong and Peatio Trading UI together using Nginx reverse proxy setup. They have also customized the UI of Barong, Peatio and Peatio Trading UI. ‘Cryptex Technologies’ have also implemented the browser and the IP address for phishing from which the security can be improved while exchanging cryptocurrency. They have also set up servers like RabbitMQ Event API server, Redis server and MySQL database server which is required for exchanging the Bitcoin.

 

For more Details Please Visit: https://bit.ly/2srao8I

 

 

You cannot ignore online marketing, especially when you are a real estate broker or dealer. With potential customers using the Internet to search their future purchase a strong and powerful digital marketing strategy helps real estate brokers and dealers to stand out in the competition.

 

The industry of real estate has expanded enough where buyers are doing an extensive search online before actually making their final purchase decision. The buyers are searching for brokers, dealers, projects, and sellers online which makes online marketing even more beneficial for the real estate industry.

 

Some of the advantages of this Real Estate Web Applications are:-

Upload unlimited properties images/videos

● Upload 360-degree virtual tour

Listings with photos and videos

● Get directly connected to the customers

Real-time messaging

● Setup an appointment online

● Search engine with powerful filters

24/7 online presence

● Location awareness and maps

 

Why real estate application?

You can build your own brand and also build trust among the customers and get directly connected with your prospective customers.

 

What are the requirements?

One of the biggest reasons many people stay away from investing in an application is believing that it requires advanced technical knowledge and web design experience to build and manage an application. It's quite the contrary.

You don't need any experience to set up your own online application and start investing in digital real estate application get this complete property selling solution in your domain in just 1 DAY with just one click and set up your own brand.

There are options to buy or rent websites.

 

In conclusion

Eventually, you will start building your brand and connects from the application. Then you can decide whether to sell your application for a profit or to continue to use it. The choice is yours!

Cryptex Technologies is a Real Estate App Development Company which has developed such an application and can set up the application in your domain in just 1 Day.

For DEMO click: https://bit.ly/2BvdY5B

Introduction 

React.js is a Javascript library for building interactive UI application. React.js is very popular nowadays because of its features like performance, virtual DOM, component_based application, etc. After completing development of React.js application next step is to deploy the application on the Production server. There are several ways to deploy React.js application on a production server. We can deploy React.js application using ngnix, apache2, pm2, etc on a production server.

Prerequisite:

  • The production server instance with Ubuntu 16.04 Operating System.

  • React-project-demo is an already developed project and ready to go live.

1) Deploy React Application using Nginx

Step #1: Installing Environment Dependencies

We’ll need to install node to get working with our React app. The following will do the job to get the latest version of Node at the time of running.

sudo apt-get update

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -

sudo apt-get install -y nodejs

sudo apt-get install -y build-essential

This install Node,
npm
and the build tools that come in handy for npm.

Clone your project repository on Step #2:
server instance

sudo mkdir /var/www

cd /var/www/


Take the clone or paste the code in the current directory, then change the directory:

cd react-project-demo

Install the project on the system:

sudo npm install 

Then you need to create the optimized production build of the project:

sudo npm run build


 

Step #3: Install and Configure Nginx to serve your application

sudo apt-get install nginx

sudo nano /etc/nginx/sites-available/default

and paste the below code:

server {

listen 80 default_server;

root /var/www/react-project-demo/build;

server_name localhost;

index index.html index.htm;

error_page 404 /;

location / {

}

}


Now you need to start your server:

sudo service nginx start


To restart application service:

sudo service nginx restart


To stop application service:

sudo service nginx  stop


You can check the nginx logs in the following files :

/var/log/nginx/access.log
/var/log/nginx/error.log


 

2) Deploy React Application using pm2:


pm2 is NPM package, using which one can start react application in detached mode.

Install Node & npm from step #1 of first method, then run following command:

npm i -g pm2 

 

This installs PM2, aka Process Manager. It’s going to help us handle running our app in the background of your server.

 

To run the react application:

pm2 start npm -- start 

 

To check the log of pm2:

pm2 logs

 

Other useful commands of pm2:

To make sure its running and to check its port number use:

pm2 list

 

to stop all the running instance of pm2:

pm2 stop all

 

to save the current running state:

pm2 save

 

to auto start on machine restarts:

pm2 startup

 

to disable autostart on machine restarts:

pm2 unstartup


 

manually restored saved processes:

pm2 resurrect

 

Similarly, we can use apache2 to deploy our React.js application on the production server.

 

Introduction

Capistrano is an automation tool for executing commands on the server through SSH. Capistrano basically a script which provides various commands to execute which helps to deploy the code on the server. It helps to reduce the manual efforts to deploy code and use the same command to deploy code every time. In this document, I am going to describe how to deploy your application from GitHub to the production server.

Capistrano Flow

The Capistrano have main flow as follows:

1. First, you need to install and configure Capistrano in your application.

2. Once the installation and configuration are done every time you have to push the latest code to GitHub and then run Capistrano script to deploy it to the server.

 

Step 1: Install the following gems in Gemfile.

gem 'capistrano', require: false

gem 'capistrano-rails', require: false

gem 'capistrano-rvm', require: false

gem 'capistrano-bundler'

 

Step 2: Run following commands to install these gems and initialize Capistrano

$ bundle install

$ bundle exec cap install

 

Step 3: Capfile

require 'We need to uncomment some lines according to our requirement. As I want to run bundle install automatically I have uncommented line capistrano/bundler'. In the same way for precompiling assets and running migration require 'capistrano/rails/assets' , require 'capistrano/rails/migrations'. As I am using RVM, I have uncommented the line require "capistrano/rvm". Similarly I am using GitHub for code deployment require "capistrano/scm/git"

, install_plugin Capistrano::SCM:: Git.

 

 Step 4: config/deploy.rb

deploy. In rb file mention name of the application. Then mention GitHub repository path as I have mentioned ‘git@github.com:username/application_name.git’.

Mention username and password of your GitHub repository. We also have to connect server where we have to deploy our application with GitHub. For that, we have to enter ssh public key in settings of GitHub so that it will connect GitHub with the server.

 

Step 5: config/deploy/production.rb

There are two ways to define servers. First one is with simple role-based syntax and another one is extended server based syntax. You should use only one from both, not both of them. In this, we have to set the environment of our rails application like ‘production’. Mention the branch of your code and also the path of application folder on the server in front of ‘deploy_to’.

 

(b) production.rb

Step 6: Run script

Now, run following command to run the script.

$ cap deploy production

 

Step 7: Server Setting

In this tutorial, we simply cloned our application code from GitHub to our server. While first time deployment of code it will use a defined directory structure on the server.

1. ‘release’ folder holds all deployments in a folder. Every time you run Capistrano to deploy code, it makes clones GitHub repository to a new subdirectory inside release.

2. ‘current’ folder is a symlink pointing to the latest release inside the releases folder. This symlink will update at every deployment. If deployment fails in any step the current symlink still points to the old release.

3. ‘repo’ folder holds the copy of GitHub repository.

4. shared’ folder contains the configuration which will not be taken from the GitHub repository. As Capistrano deploy works by cloning the GitHub repository into a release It will contain files like (e.g. config/database.yml and config/secrets.yml). You have to put those files in shared and instruct Capistrano to symlink them to release directory on every deploy. This is done through the linked_files and linked_dirs configuration options in deploy.rb file.

Mention the path to the current folder in configuration settings of the server as it contains the latest code from GitHub repository and then restarts the server.I have mention the path like DocumentRoot /home/path/to/your_rails_app/current/public in /etc/apache2/sites-available/application_name.conf file.

  An Introduction to RabbitMQ:

 
RabbitMQ is a message broker software in Ruby on Rails framework where web applications connect to the queue and transfer a message onto it.

When one application server sends the request to another application server, RabbitMQ works as a queue manager where requests handled and served one by one. 

Message transferring is done from one application to another through RabbitMQ. RabbitMQ uses the standard Advanced Message Queuing Protocol (AMQP) to keep message request in queues and serve easily. The message may contain any information like simple text transfer or task that need to process on another server.

This RabbitMQ software saves messages in a queue and keeps in a queue until receiving application get connected and start processing the messages.

Why should we use RabbitMQ in Ruby on Rails Development?

Message broker works on the producer, broker, and consumer logic. Message broker server allows consumer and producer server to respond request fast instead of using resources heavily at one time. Message broker is used to optimize the load on the server and provide services until application executes the task on the requested server. The requested server can be any third party application which performs the task.

Queued messages will be used to send the messages or task to multiple recipients from consumption that leads to the load balancing on the producer and consumer server.

 

Let take an example of ruby on rails server and bitcoin exchange server (i.e. bitcoind) for btc transaction working.

I have rails server running as producer and bitcoind server as a consumer.

Rails server send multiple request to bitcoind server continuously. There may be chances to slow down bitcoind because of multiple requests send to bitcoind server to process task.

In that case, RabbitMQ can fulfill the role of load balancing and messages passing by keeping the request coming from rails server in a queue and serve request one by one to bitcoind server.


Bitcoind server will take a task from the queue and start processing.                                                           

RabbitMQ with Ruby on Rails for Web Application Development               

AMQP role in RabbitMQ:

AMQP store and forward messages to consumers, same as SMTP protocol which is used to deliver mail to mailboxes. Messages start from producer application to the exchanges that help to redirect in queues. Lastly, queues deliver task to the consumer application. It's now consumer's server responsibility to take the messages from queues to process as required. 


A virtual channel is used to establish the connection between publishing messages from the queue. All process exchanges done over the channels.

How to use RabbitMQ in Rails application?

Using Bunny ruby RabbitMQ client, we can integrate RabbitMq with rails application. There are some gems available to start with RabbitMQ in ruby like

gem “bunny”

 

Bunny help rails application to interoperate with the consumer application, it can be built in any technologies irrespective of the size and complexity of the application. Also, add anampq gem in rails Gemfile to use AMQP protocol services.

   gem  ‘amqp’

 

RabbitMQ installation commands in Ubuntu:

1] Step 1: Update system
   

sudo apt-get update


2] Step 2: Install Erlang

RabbitMQ is written in Erlang, you need to install Erlang before you can use RabbitMQ:

a] wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_20.1-1~ubuntu~xenial_amd64.deb
 b] sudo dpkg -i esl-erlang_20.1-1\~ubuntu\~xenial_amd64.deb


3] Step 3: Install RabbitMQ

      sudo apt-get installrabbitmq-server

 

4] Step 4: Start the Server

   sudo systemctl start rabbitmq-server.service
   sudo systemctl enable rabbitmq-server.service

 

Thus if you are looking for web development services which is faster, reliable, redundant and scalable then you can definitely opt for Ruby on Rails RabbitMQ. Hire RoR developers for developing a robust messaging software.

  

 

 

Action Cable is a powerful feature introduced in Rails 5. Using action cable one can develop real-time web applications. Action cable uses Web Sockets to create full duplex communication between application’s server and client.

 

Using action cable feature we can create any real-time functionality like live chatting, which updates chats, show new messages, notifications, etc without reloading of the page. Action cable basically keeps ruby on rails server data and client data updated using web sockets which make the application more feasible to use.

 

Action cable is not supported by RAILS VERSION > 5.

 

PREREQUISITES:

 

This ruby gem requires jQuery. If jQuery is not present in the project then simply add “jquery_rails” gem to gemfile.rb and redis-server in the system.

 

 

STEPS REQUIRED TO USE ACTION CABLE:

Add following in Gemfile.rb file :

 

gem 'redis', '~> 4.0'

 

Also add following in application.js file :

//= require rails-ujs

//= require jquery

//= require turbolinks

//= require_tree

Thats all about installation process.

 

Let’s see an EXAMPLE :

For creating Notification model, controller and views using scaffold command just run :

 

rails g scaffold Notification name:string

 

Then create a Channel , we call this channel “WebNotifications”.


rails generate channel WebNotifications

 

And we add some CoffeeScript files to show notifications to all users in javascripts/page.coffee:

App.room = App.cable.subscriptions.create "WebNotificationsChannel",

received: (data) ->

$('#notification div').append '<li>' + data['notification'] + '</li>'

$('#notifications-count,.notifications-count').text data['count'] 

 

And finally we need to add the below code to the channels web_notifications_channel.rb.

 

class WebNotificationsChannel < ApplicationCable::Channel

def subscribed

stream_from "web_notifications_channel"

end

def unsubscribed

end

end

Changes in notifications_controller.rb file To call the action cable: 
def create

@notfication = Notfication.new(notfication_params)

respond_to do |format|

if @notfication.save

format.html { redirect_to @notfication, notice: 'Notfication was successfully created.' }

format.json { render :show, status: :created, location: @notfication }

else

format.html { render :new }

format.json { render json: @notfication.errors, status: :unprocessable_entity }

end

end

ActionCable.server.broadcast 'web_notifications_channel', notification: @notfication.name, count: Notification.all.count

end

Changes in app/views/layouts/application.html.erb file : I have added simple notification navigation in the application layouts.

<ul class="nav navbar-nav navbar-right">

<li class="dropdown">

<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Notification (<b class="notifications-count">2</b>)</a>

<ul class="dropdown-menu notify-drop">

<div class="notify-drop-title">

<div class="row">

<div class="col-md-6 col-sm-6 col-xs-6">Notifications (<b id="notifications-count">2</b>)</div>

<div class="col-md-6 col-sm-6 col-xs-6 text-right"><a href="" class="rIcon allRead" data-tooltip="tooltip" data-placement="bottom" title="tümü okundu."><i class="fa fa-dot-circle-o"></i></a></div>

</div>

</div>

<!-- end notify title -->

<!-- notify content -->

<div class="drop-content" id="notification">

<% Notfication.all.each do |notification| %>

<li>

<div class="col-md-3 col-sm-3 col-xs-3">

<%= notification.name %>

</div>

</li>

<% end %>

</div>

</ul>

</li>

</ul>


We need to do simple configuration setup in the cable.yml file.

redis: &redis

adapter: redis

url: redis://localhost:6379/1


production: *redis

development: *redis

test: *redis


To start the application first we need to start the redis-server the command to start the redis-server is:

redis-server

The Redis-server will be started then you can serve your application.
Following are the snapshots of output scenarios:

 

Creating new Notifications:

 

Introduction to Action Cable in Rails 5

 

The result will be shown like that By using the action cable it will update the Notification to all live users.

 

Ruby on Rails Action cable tutorial

 

 

In Ruby on Rails web development, using Action Cable RoR developers can show the live notifications to all users. These notifications can be of any type like Messaging, Sending push notification etc.

As software testing is moving from manual into automation at very fast speed, at times testers get into a scenario where they need to opt what needs to be automated, when to automate and why to opt for automated software testing?

 

If you are a software tester, this blog will help you to choose one from the two testing methods.

 

Software testers generally perform manual testing in the following scenarios:

 

 

1. When an application is at the initial stage of development. As application flow and feel and change over developing period it's better to go for manual testing then automating it. Automation can be done only when the application is stable.

 

2. When negative testing of the application is to be done because it's more reliable to depend on manual testing.

 

3. When regression is not required multiple times i.e. there are no multiple executions of test cases.

 

4. When there are some functionalities which cannot be automated like Captcha.

 

 

 

What is Automated Software Testing?

 

It is a process in which specific tools are used to execute scripts or test and compare the results. There are various tools available in the market to automate different types of software testing like QTP, Selenium, etc.

 

Starting with automation first need to take in consideration the following to avoid any confusion.

 

  • Is the build stable?

  • Does the application requires testing same functionality many times(Regression/Sanity/Smoke)

  • Will writing automated test case save time?

  • Do we have that much time to invest in automated testing?

 

 

If the answer to this question is YES then you can opt for automation testing for the application. Choosing the right framework for application is all dependent on what you are going to test.

 

And yes a team of experts for software testing to carry out the process is really important aspect followed by proper planning and strategy.

 

When to Choose Automated Software Testing?

 

1. Regression Testing: When we need to test the same test case or functionality multiple times. As testing the same functionality manually make people bore and error chances increase.

 

2. Large No. of Test Cases: When there is a large number of test cases to execute, it’s better to go with automation where just running the test suite will solve the problem.

 

3. Time management: As said above executing a large number of test cases manually will take a lot of time and money. So the time can be saved if we are using automation testing.

 

4. Performance: It's not possible to invest thousands of users to test the performance of any application. Automated testing can generate the required amount of user to interact with application and network.

 

5. Accuracy: It can be obtained with the help of regression/sanity/smoke testing: one has to just run the script. Manually there is a chance of missing any scenario.

   

Nowadays, data handling is a big responsibility for every web and mobile application. Arrays make the process easier and it can handle any list of data. Once you have data in an array, you can easily sort it, remove duplicates, change its order to either ascending or descending and many more.

 

In Ruby programming, there are many methods for Array object i.e. Map, Collect, Select, Reject, Each, Inject, Reduce, Detect and Find. Most of the Ruby on Rails developers uses these methods in their web applications.

 

In this blog, we have outlined the difference between all the methods.

 

Let’s have a look at them to choose the one which is best suitable for your requirement.

 

1. Map

 

The map method takes each element from the array and evaluates
given block on it. Output will be in the form of an array containing evaluated results without changing the original array.

 

Array Methods in Ruby

 

 

2. Map!

 

If you want to modify the original array by replacing the output array elements with the original array elements then you can use the map! method.

 

Ruby Methods for Array

 

 

3. Collect

 

There is no difference between collect and map method both methods work same. Similarly map! and collect! methods are also same.

 

 

Array Method in Ruby on Rails

 

 

4. Select

 

The select method takes each element from the array and evaluates given block on it. If block or statement evaluates to true the original elements gets added into the output array. In this case output array and original array are different. If you want to replace the original array to the output array, you can use select! Method.

 

Array Methods in Ruby Programming

 

 

5. Reject

 

The reject method is exactly opposite to the select method. It will take each element of the array in the block to evaluate. The output array will consist of all the elements in the original array for which block evaluates to false. The reject! method is also opposite to the select! method.

 

Array Method in Ruby on Rails Programming

 

6. Each

 

The each method will iterate over array taking each element from it for evaluation. It will return the original array, but not evaluated one. Now, it depends on you what kind of operation you want to perform in the block.

 


How to use Ruby Methods in Arrays

 

 

7. Inject

 

The inject method takes two arguments, one as an accumulator and other as each element in the array. Accumulator accumulates the evaluated values. This returns the final value of the accumulator as a result. The initial value of the accumulator can be defined if not define it takes the first element of the array as initial value.

 

 

Ruby on Rails Programming Developers uses this Array Methods

 

 

8. Reduce

 

Reduce method is similar to the inject method.

 

Reduce Method in Ruby for Arrays

 

 

9. Detect

 

The detect method is similar to the select method, but the only difference is its output. The detect method also evaluates a block for each element of the array, but returns the first element in the array for which the block evaluates to true or statement in the block evaluates to true.

 

Ruby on Rails Programming with Arrays

 

 

10. Find

 

Find method is similar to Detect method.

 

Ruby on Rails Development and Array Methods

 

  

 

  

If you want to create Rails Application dependent on API only and you have a requirement to provide Token based authentication in your application. So you can use JWT+ KNOCK token based Authentication solution.

 

Knock is an authentication solution for Rails API-only application based on JSON Web Tokens.

JWT is JSON based web tokens.

 

Advantages of using JWT and Knock in Ruby on Rails Application:

 

  • JWT:

 

1. It is lightweight

2. It is easy to use

3. It is stateless

 

  • Knock:

 

1. Seamless JWT authentication for Rails API

2. It is easy to implement and maintain.

3. It allows customization.

 

Step 1: Create Rails API Project

 

rails new project_name --api -d mysql 

 

where

# --api specifies the rails application is API based

# -d mysql specifies that we use mysql database in this application

 

Step 2 : Add gem

 

Add following gem into project_name/Gemfile

 

gem 'knock' 

gem 'jwt'

 

gem file looks like

 

Token Authentication in Rails Application

Figure 1: Gemfile for JWT and Knock

 

Next to run command on terminal for installing gem in application.

bundle install 

 

Step 3. Setup a basic Knock structure.

 

Run following command

 

rails generate knock:install 

rails generate knock:token_controller user

 

Now run the following commands to setup your Rails application.

 

rails generate model users 

rails generate controller users 

rails generate controller home

 

 

If you add custom model so you can do it

 

File Location: project_name/db/migrate/:random_number_create_users.rb

 

Migration file in Ruby on Rails Application

Figure 2: Migration File

 

Run following command to create User table

 

rake db:migrate 

 

Step 4 . Authorization/Knock Setup:

 

File Location: project_name/config/initializers/knock.rb

 

Knock Setup in Rails Application

Figure 3: Knock.rb file

 

Step 5. Setup your User model with some basic validation.

 

 

File Location: project_name/app/model/user.rb

 

 

Your user model look like this.

 

Knock and JWT in Rails Application

Figure 4: User.rb file

 

Now you can setup controller to access the Authentication.

 

Add include Knock::Authenticable 

 

File Location: project_name/app/controller/application_controller.rb

 

Application Controller in Rails Application

Figure 4: Application Controller
 

Also each and every method call pass though knock authentication.

 

Add before_action :authentication_user, only[:auth]

 

Here auth is a method to check client is authorized.

 

In home controller there is index method and auth method for login.

 

File Location: project_name/app/controller/api/v1/home_controller.rb

 

Home Controller | Ruby on Rails Developer

Figure 6: Home Controller

 

File Location: project_name/app/controller/api/v1/users_controller.rb

In user controller there is index, current method for current user data and create method for creating new user. Also you can add update and delete method.

 

Add authentication on required method with help of authentication_user , authorize_as_admin, and authorize method.

 

User Controller in Ruby on Rails Application

Figure 7: User Controller

Final Step: Test API

 

We test API with help of Postman.

 

1. User creation API: API endpoint is http://localhost:3000/api/v1/users/create

 

We send parameter in body for user creation so that API method type POST. After calling API we get successful response with status 200 and and message “User was created ”.

 

After user creation we go to login API, but for application login we need a token so we need to call token API.

 

User Create API - Rails Application | Token Authentication

 

Figure 8: User create API

 

 

2. API Endpoint: http://localhost:3000/api/v1/user_token

 

For user token we need to send email id and password in body of method type POST.

 

If email id and password is valid to API we get jwt token from knock in response.

 

Great we now got token. With help of this we access knock authorized method.

 

User Token API - Rails Application Development

Figure 9: User_token API

 

3. Login API:

 

API Endpoint: http://localhost:3000/api/vi1/auth

 

we sent jwt token in header of API and content type is applicationJson.

 

Authentication: Bearer jwt token

content type: : applicationJson.

 

If everything is OK, then we get successful response.

 

Rails Application - Token Based Authentication API

Figure 10: Login with jwt token

 

These two gems Knock + JWT can help us to develop token based API in Rails 5 very easily and will save the overall time required in Ruby on Rails development.

In this blog we will discuss about Unit Testing, the very first thing that we need to know is when the Unit Testing is being performed. Unit testing is the initial level of software testing, that is performed on the application source code mainly by the developer. The main motive of Unit Testing is to isolate a section of code and verify it’s correctness.

 

What is Unit Testing:

 

A level of software testing where the individual units or components of a software or web applications are tested by developer is called Unit Testing. It is an important aspect of Software Testing. It is a component of test-driven development (TDD).

 

Benefits of Unit Testing:

 

1. Defects revealed by a unit test are easy to locate and relatively easy to repair. Unit testing verifies the accuracy of the each unit.

 

2. In unit testing procedure – the developer needs to write test cases for all functions and methods so that whenever a change is required, it can be fixed quickly in later date and the module also works correctly.

 

3. Unit testing improves the quality of the code. It helps the programmer to write the better code. It identifies every defect that may have come up before code is sent further for regression testing.

 

4. If a test fails, then only the latest changes need to be made in the code and need to debug. So It’s better to say unit testing helps to simplify the debugging process.

 

5. Codes are more reusable. In order to make unit testing possible, codes need to be modular. This means that codes are easier to reuse.

Unit Testing in Ruby on Rails Software Development

 

Gems to perform Unit Testing in your Ruby on Rails web application:

 

There are several gems available in Ruby on Rails application framework to perform the unit testing.

 

  • rspec_rails: Rspec is an automated test case, used to test the code written by developer while creating the application.

  • factory_girl_rails: create dummy data while performing testing.

  • minitest: It is also used to perform the unit testing in your rails application.

 

These 3 gems given above are used for Test Driven Development (TDD) environment.

 

  • database cleaner: Used to cleanup the database in Ruby while testing.

 

Most of the Ruby on Rails Developers use the best practices for carrying unit testing on individual units of source code or program modules.

 

Unit Test Case Best Practices:

 

  • You Should always follow the proper naming conventions for your unit testing, i.e. clear and consistent naming conventions for the unit tests.

 

  • If any changes done in the requirements then your unit test case should not be affected. Your test cases should be independent.

 

  • Always follow “test as your code" approach. The more code you write without testing, the more paths you have to check for errors.

 

  • If any changes needs to done in the code for the corresponding module, make sure that you have the unit test case for that particular module and need to pass the test case before any implementation done.

 

Conclusion:

 

Developer should make Unit testing a part of their regime to make neat and clean, reusable, and bug free codes. Also by using unit testing the quality of code will be improved. Unit testing helps to reduce the cost of bug fixes.

We have gone through many web applications and mobile applications which do not reload the entire page but instead reloads only the required section. These are nothing but Single Page Applications (SPA) which are developed using Angular. A good example of SPA is Gmail where we have noticed that when we click on the inbox, it only reloads and displays that email in the e-mail list sections.

Introduction to Angular:

Angular is a TypeScript-base open-source front-end platform and framework led by the Angular Team at Google used for building client-side web applications. Angular itself is written in TypeScript, which is a superset of JavaScript and used for front end development.

Installation:

In order to start with the installation, we first need to make sure that we have nodejs and npm installed with the latest version.

We can install nodejs on Ubuntu OS by running the following command on terminal:

  • sudo apt-get update

  • sudo apt-get install nodejs

To install npm, we run the following one-line command on terminal:

  • sudo apt-get install npm

To check the versions of Node.js and npm installed, we run following command:

  • nodejs –v

  • npm –v

Let’s install Angular CLI by running the following command:

  • npm install –g @angular/cli

IDEs for Angular:

We can use any of the IDE i.e., WebStorm, Atom, Visual Studio Code, etc. But usually, Visual Studio Code is preferred.

Architectural Blocks of Angular:

The main building blocks of an Angular application are:

  • Modules

  • Components

  • Templates

  • Metadata

  • Data binding

  • Directives

  • Services

  • Dependency injection

In this blog, we will have an overview of Angular Modules and Angular Components.

Angular Modules:

We have Angular modules or we can say NgModules which maintains the modularity of Angular apps. Every Angular app has at least one module as the root module. Conventionally, it is named as AppModule. Typically, an app contains many functional modules. In angular, any module is a class with the @NgModule decorator.

The NgModule decorator is a function that takes metadata object whose properties describe the module. The properties are as follows:

  • declarations: Here, we have to declare the classes that are related to views (i.e. The components, the directives, and the pipes that belong to this NgModule).

  • exports: Here, we have to mention the classes that should be accessible to the components of other modules.

  • imports: Here, we have to mention the modules whose classes are needed by the component of this NgModule.

  • providers: Here, we have to mention the Services present in one of the modules which are to be used in the other modules or components. Once a service is included in the providers it becomes accessible in all parts of that application

  • bootstrap: Here, we have to mention the root component which is the main view of the application. This root NgModule only has this property and it indicates the component that is to be bootstrapped.

The root module (i.e. src/app/app.module.ts) by default looks like:

 

Angular | A JavaScript Framework for Front End Development

Image: The Root Module in Angular

 

Angular Components

Every Angular application has a root component i.e. AppComponent which is bootstrapped inside the main module. In angular, each component defines a class with the application data and logic and is associated with a view i.e. HTML template to be displayed in a target environment.

The root component (i.e. src/app/app.component.ts) by default looks like:

 

Angular | A JavaScript Framework for Front End Development

 

 

 

 

 

 

 

Image: The Root Component in Angular

 

Advantages of Angular:

  • Angular is faster, lighter and easier framework which is built to create faster performance applications that are smaller in size and easier to develop.

  • It provides high performance, offline, and zero-step installation. So, Angular is pretty much easy to work with.

  • Angular is universal that means we can use any technology with it for serving the application like node.js, .NET, PHP, Ruby on Rails and other servers.

  • Angular is productive as:

  • It generates UI templates quickly with simple and powerful template syntax.

  • Angular CLI with Command line tools.

Apart from front end development we use Ruby on Rails framework for backend development. Hope this blog would be informative to understand the basic building blocks of Angular.

Introduction to FontAwesome 5:

 

Font Awesome 5 is upgraded version of Font Awesome 4, It has a more attractive icon with big improvement icons as compare to Font Awesome 4

Some improved points are listed below:

 

  • FontAwesome 5 icons are drawn now with SVG.

 

  • Now we have to reference Javascript file with SVG embedded in place of CSS file ( In FontAwesome 4 we use CSS file only ).

 

However, version 5 is now redesigned and rewritten from scratch.

 

Now, Let us see the changes in FontAwesome 5

 

Different icon styles:

 

In Version 5, there are 3 different styles:

i) Solid Style

ii) Regular Style

iii) Light Style

 

Brand Icons” are separated out into their own style and is easy to use. Version 4 had one prefix only “-fa” and Version 5 has four prefixes. To set a style of any icon with ease, every prefix has different Javascript and SVG file. If we want to use them, we need to import Javascript and SVG file. Some as mentioned below.

 

Font Awesome 5 Prefix

Icon Style

JS+SVG Filename

Web Font

fab

Font Awesome Brands

brands.js

fa-brands-400

fas or fa

Font Awesome Solid

solid.js

fa-solid-900

far

Font Awesome Regular

regular.js

fa-regular-400

fal

Font Awesome Light

light.js

Fa-light-300

 

Table: Font Awesome 5 Details

 

Syntax

 

Version 4’s Syntax

 

1)<i class=”fa fa-rocket”></i>

 

Version 5’s Syntax

 

1)<i class=”fas fa-rocket”></i>-----------“fas ‘s’ for Solid”

2)<i class=”far fa-rocket”></i>----------- “far ‘r’ for Regular”

3)<i class=”fal fa-rocket”></i>----------- “fal ‘l’ for Light”

 

Note:- Some Icon name changed in the upgraded version.

 

How to use FontAwesome 5:

 

Step1: Add Assets for FontAwesome 5 (Version 5)

 

Download cdn which is required for version 5

 

Web Font & CSS files

 

  1. css/solid.css

  2. css/regular.css

  3. css/brand.css

  4. css/fontawesome.css

  5. css/light.css

  6. For all CSS, we can use css/all.css

 

JS & SVG files

 

  1. js/solid-.js

  2. js/regular.js

  3. js/brand.js

  4. js/fontawesome .js

  5. js/light.js

  6. For all js, we can use js/all.js

 

There is one more file that is “ Shims ” file.

Shim file is created to be used as band-aids until you get time to upgrade. Version 4 allows you to keep v4 icon name, aliases, and syntax while mapping Version 5. If we want to use then add below extra line to our Version 5

 

<link rel=”stylesheet” href=”https://use.fontawesome.com/releases/v5.2.0/css/v4-shim.css”>

 

v4-shim is used for both Web Fonts + CSS and SVG + JS Frameworks.

If we want to use new and fancy SVG+JS of rendering icon, then switch the “css/all.css” into “js/all.js” also “css/v4-shims.css” into “js/v4-shims.js“

 

Step2: Add syntax in your HTML file

 

For Example:

<i class=”fal fa-rocket”></i>

<i class=”far fa-rocket”></i>

<i class=”fas fa-rocket”></i>

 

An effect you can see in below image:

 

FontAwesome 5 in Web Designing

 

Image: Font Awesome 5 Comparison

 

Note: In FontAwesome 5 some icon name are changed, if we don’t want to use them then, we have to add shim file. Version 5 has lots of icon but some icons are paid, if we want to use then we need to buy PRO Version .

 

Advantages:

 

1) Icon are designed using SVG and Javascript.

2) Icon Fonts are Ligatures and auto-accessibility.

3) Icon can be re-written, redesigned using CSS and JS.

A scheduled task is very important in Ruby on Rails application. Ruby on Rails does not have this type of “out-of-the-box” feature, but we can use the Cron job to achieve the purpose. Cron can be scheduled to send a reminder email, or scheduling to crawl something from another website on daily basis. In this blog, let’s quickly go through how to use Cron job.

What is CRON?

Cron task is a time-based job scheduler in Unix-like computer operating systems. Cron can be used to schedule jobs to run periodically at fixed times, dates, or intervals. Cron is most suitable for scheduling repetitive tasks in Ruby on Rails applications.

Let’s take an example of sending a daily digest email to persons or users. In this case, we might have a mailer like this using crontab:

 

#STEP 1.

The user can run any method from the terminal. Here I’m running an action inside a model i.e schedule_rb_method.

Open “app/models/reminder.rb” and then add the method for running an action as shown below.

 

Cron Job in Ruby on Rails Application

 

Run rails runner “Reminder.schedule_rb_method” command inside the project path on the terminal, to check method is running or not.

 

#STEP 2.

 

Set the default rvm to the project.

run rvm --default use 2.5.0

 

#STEP 3.

 

Creating a Crontab:

Cron is driven by a crontab (cron table) file, a configuration file that specifies shell commands to run periodically on a given schedule.

Users can have their own individual Crontab files in the system.

It’s pretty easy to start working with cron jobs in rails. You can start editing your cron tasks using the crontab command on your terminal:

Open your terminal: run crontab -e

This command will open a text file in your terminal’s default editor.

 

#STEP 4.

 

We are going to enter a line into this crontab file. It will have the following structure:

[timings] [switch to your app directory] && [path to ruby] script/runner -e [environment] “[model class name] . [ (run method name) path to cron log]”


By looking at the above line to understand: Run a task every day at 10 am.

 

Rails Cron Job Tutorials for Beginners

 

  1. If you try and save your crontab and you receive errors, make sure the whole command is in one line on your terminal.

  2. If your model method runs OK, you should either get some mail as mentioned in the cron. However, if there is an error, you must check your cron method to check the log you created in rails to understand the error.

     

Crontab Syntax:

Once you’re in the editor, you can start creating and editing cron tasks in rails. To schedule a cron task, you need to define when the task will run, then define the command to trigger that task.

There are 5 variables that can be changed inside a cron task in Ruby on Rails application:

  • 1st variable: Minute, which can be specified from 0 to 59 min

  • 2nd variable: Hour, which can be specified from 0 to 23 hr

  • 3rd variable: Day of Month, which can be specified from 1 to 23 day

  • 4th variable: Month, which can be specified from 1 to 12 month

  • 5th variable: Day of Week, which can be specified from 0 - 6 (Sunday = 0) week days

If the variable is a “*” it means for all.

If the variable is a series of number split by a comma “,”, it means OR condition on each of the specified number in Cronjobs.

 

Example:

Timing Format: 
minute   hour   day   month   weekday
0 30      *      *      *      *   example command to be executed

 

Cron job Crontab in rails application

 

While cron jobs are useful and can get the job done in many instances, you should be careful in your decision of how to implement scheduled and delayed tasks in Ruby on Rails application.

In rails, Cronjobs are best for tasks that are not highly critical or essential to your application’s functionality or performance. They should also execute in a reasonably short amount of time so that they don’t bog down your rails server(s).

 

Every University has thousands of applications streaming in for each course. A single application has a minimum of three stages – the document submitted by the student, his/her interview and finally, uploading the financial proof. Managing all of this singularly is a huge challenge.

There is a strong need for providing a common platform for application management. Offshore System for Student Management, a software developed and managed by Cryptex Technologies, India is the perfect one-stop solution for this. This application is developed using Ruby on Rails technology.

It is integrated with a dashboard showcasing the various features of this application, you can easily navigate around to make your work easier.

The dashboard has options for viewing the student application checklist, interview scheduling and feedback, advanced search functionality, along with the financial document submission and COE.

A database of a thousand and more entries can be filtered according to the search requirement. You can generate reports for specified time durations in the form of graphs and charts.

An export data feature is introduced in this to export the online data directly to your desktop.

Another added feature of OSSM is that of accessing the information of the agent via whom the student has applied. This helps during future decision making, giving a constructive insight into the work done by each of the agents.

Having a consolidated application for admission procedure is a one-time solution for eliminating all the manual efforts and errors.

 

Student Management Software using Ruby on Rails

 

Contact us if your needs are similar to this and we will build a smooth student management platform for you.

Cryptex Technologies

Plot No.8, Gopal Nagar,Nagpur-440022,
Maharashtra, India

Contact No: +91-712-223-2300

Email ID: info@cryptextechnologies.com

Redis is an open source very fast, non-relational, in-memory data structure store. It stores data in the form of a key-value pair. Redis has a support of data structure like sets, hashes, strings, list. Redis is mostly used for the cache store.

 

When to use Redis?

 

Redis is used when we have a performance issue related to scalability. For example when we have data in the database which is not going to change frequently then you use Redis to cache that data to remove the load from the MySql or PgSql server.

 

How to use Redis in Ruby on rails?

 

In order to use Redis in Ruby on Rails application you have to follow the steps given below:

 

Step 1:

 

Add the following gem into the Gemfile of application and run the “bundle install” command.

 

Improve performance of Rails Application using Redis

 

 

 

 

Step 2:

 

Next is to create redis.rb file in config/initializers directory and add the following code into that file 

 

Ruby on Rails Application using Redis

 

In the above code “app_name” is the Namespace of my application. Gem “redis-namespace” organize everything under one application wise namespace, when multiple applications use same Redis server.

 

Step 3:

 

Next, to instruct rails to use Redis as a cache store we have added following code into application.rb file.

 

Increase scalability of Ruby on Rails Application using Redis

 

Step 4:

 

In the below code I have written a query in booths_controller.rb file to fetch all booths of size 16m2. And write a helper method in booths_helper.rb to fetch the data from Redis.

 

Ruby on Rails Application using Redis

 

 

Ruby on Rails Application using Redis

 

In the above code when we call the new_booth method of booths_controller, it will call the fetch_booths_16 helper method.

 

In this fetch_booths_16 method, the booths_16 will get nil value because no data is pushed into redis yet. We then instruct rails to push booths_16 data into redis. Then after a subsequent call to this method, data will be fetched from redis.

 

Since we are loading data in new_booths as a json we have to change when you call @booth_size_16.name to @booth_size_16[“name”] because data is in the form of json.

 

Advantages of using Redis:

  • Support for rich data structure types: hash, string, set, list, sorted etc.

  • Data is stored in memory and retrieve quickly: Redis store data in memory so instead of requesting data from the server it will fetch from memory and retrieve data very quickly

  • Redis is used to speed up service response.

  • Redis is a very fast non-relational and NoSQL key-value pair data store.

  • Redis allows to insert a large amount of data into its cache very easily: Sometimes a situation comes like we have to load a thousand pieces of data into cache in a short period of time. This can be done by Redis, with mass insertion feature of it.

  • Redis uses “Redis hashing” which is its own hashing mechanism: Datastore in redis in the form of key-value pair i.e. string field and a string value.

 

Redis offers efficient caching mechanism and it will take very less time to implement this cache mechanism. But outcomes of using this will get high-performing cache system in our application.

 

So this is the way you can improve the performance and increase the scalability of Rails application to a great extent.

In this blog, you are going to learn about the deployment of rails application on the production server with its configuration setting in Apache. For this, you need to have Ruby, Rails, MySQL installed in your server system.

         

Let’s begin with the process of deploying the Rails application.

 

Step 1: Add the code copy to the server.

 

          For adding code to the server, you need to take a copy of the code on your server by login using sftp.

 

$ sftp user@yourserver.com

$ put samplecode

 

 

Step 2: Installation of project and configuration settings.

 

          Install all libraries of the project and make configuration settings including configuration of database.yml and secrets.yml by using following commands. For this, you need to login to the server using ssh and go to the project folder.

 

$ ssh user@yourserver.com

$ cd samplecode

 

          Rails app has ruby versions and you have to use that specific version to run the application. So, use the ruby version of the application.

 

$ rvm use (ruby version)

 

          Install all libraries of the project, set the database and compile assets. Rails have some specific commands to do that.

 

$ bundle install

$ rake db:create RAILS_ENV=production

$ rake db:migrate RAILS_ENV=production

$ rake assets:precompile RAILS_ENV=production

 

          Rails provide a secret key which you have to mention it into the config/secret.yml file of the application to maintain the security.

 

$ rake secret

 

Above command provide a secret key, add it to the config/secrets.yml file of you RoR project.

 

Step 3: Apache settings

 

          You have to do apache settings to run the application in production mode on apache server. For this first, you have to create samplecode.conf file in etc/apache2/sites-available/ path.

 

The file content will look like as in Image 1. Where you have to mention the domain of your application like www.myapp.com and server name like myapp.com. With this, you also have to mention the path of a public folder of the application and ruby version of the application.

 

Deploying RoR Application on production server

 

Image 1: Samplecode.conf File

 

You need to create the symlink of the file samplecode.conf to the sites-enabled folder.  It is created for apache and virtual host settings. This virtual host setting will tell Apache where your application is located. Replace myapp.com with your application name and as well as mention path to ruby with the ruby version of the application into the samplecode.conf file.

 

          If you start the application on some port and not on some domain like www.myapp.com, you need to specify the port number in the conf file in place of port “80” at the top of the file. And then mention that port to the ports.conf file which is located at /etc/apache/ports.conf.

 

Deploying Ruby on Rails Application on Production Server

 

Image 2: Ports.conf File

 

In the above image, you can see how to mention port, like I have mentioned port 3000 to be heard by apache while serving the page. At last restart the apache server by using the following command. It will run the application on the link like 127.0.0.0:3000 or if it is for a domain then it will run on www.myapp.com or myapp.com.

 

$ sudo restart apache2 restart

 

In this way, you can start a rails app on the production server.

 

In my coding lifetime, I have enhanced and improved my coding style after client feedback and guidance. I have learned over the years of time, that there aspects and points that has utmost importance in the coding of Ruby on Rails (RoR) application.

We as developers start writing code without actually analyzing and understanding the code requirement as well. A messed up code is no one’s favorite and not to be delivered.

I am sharing my thumb rules that will surely help you as it did to me.

 

Rule No. 1: Indent your code

What if you are given a much messed up code to update? I am sure you will get frustrated; in order to write very clear code keep it well indented. In Ruby on rails, though the auto-generated code is four space indented style we should use two spaces to intend our block of code as this is most widely adapted style. This improves the readability of our code.

 

Rule No. 2: Name it well!

Naming convention should be followed as this is helpful for us to understand the purpose of it and at certain places, active record in ruby also works on the basis of names.

Active record uses the same naming convention in order to find out how the mapping between the models and database tables are created.

Say for example a class “Category”, should have a database table called “Categories”. The rails pluralization mechanism is very powerful such that it is capable of pluralizing both regular and irregular words.

When it comes to naming a variable, you should follow CamelCase form, which says that the first word should start with a small letter and the next word should start with a capital letter, e.g. “categoryOne”.

When the table name has two words, it should be separated by “_” , e.g. “book_categoryies”. When it comes to model class, it should be singular with the first letter of each word capitalization e.g. “CategoryBook”.

Similarly, the name of methods should be such that it should define the purpose of that method, for e.g. “category_list”.

 

Rule No. 3: Less If else, Less complex

If else statement is a block of condition where you check the condition if it is true or false.

Using the number of if-else statement creates makes the code bulky. It will increase the number of lines in the code, which can be reduced or should not be used at all. It also makes the code complex and not easy to understand.

 

Rule No. 4: Use of a number of variables

What do variables do in rails? It allocates the memory for which it is assigned for. When the expression can be directly assigned or can be directly passed, a variable should not be used as this will be the unnecessary allocation of memory, unnecessary declaration of a variable.

In Ruby on rails development, we have four different types of variables global variables, class variables, instance variable and local variables.

Global variables are accessible globally in the application which means it can be modified from any part of the program hence it let to lack of security of our code.

Hence it is recommended not to use global variables.

Always try to replace instance variable with local variable as local variables are accessed locally which ensures the security of our code.

 

Rule No. 5: Put-up a comment there

Comments are the description written in the source code within the special character so that it should be ignored by the compiler.

What if, you get a new project with some classes having methods in it? Will you be able to understand the purpose of it?

Even, if the method name is good enough? No, sometimes only method names do not help in recognizing or understanding the main purpose of the method or how it works, hence your method should be well commented in order to let others also understand its basic purpose.

 

Rule No. 6: Don’t put too much logic in the view, make use of helpers, create them!

Views are specially meant for displaying the data hence it should not have too much logic, this can be done by making use of helpers, if the piece of code is used many times in a view, make a helper and call it in a view.

So, these are my six thumb rules while writing code, from the time that I have become the developer. These have helped me and can be taken as consideration to make your code scalable, robust and secure.

This will add sparkle to your code, which will eventually make your client happy! :)  

If you have a different lookout, let me know your views, in the comments section below.

Automated testing is extremely on the boom, across the board nowadays and obviously Ruby has its own arrangements to make it work for Ruby on Rails developers. One of these is RSpec, a madly prevalent tool for mechanized testing. The fortunate thing about it is we can test almost every part of RoR Application easily.

 

Rspec is easy to get it up and running, expressive way to write test cases, easy to use and also fast.

 

Let’s start with assembling all the components together to start with:

 

To begin it’s necessary to install Ruby. You can do it from here for Windows OS:  http://www.rubyinstaller.org

 

After completing installation let’s check if Ruby is installed properly along with version number.

 

  • For this go to command prompt and type:

                 ruby -v

 

        You will get the following result.

 

Automated Testing using RSpec and Selenium

 

  • Next, you need to install RSpec gem. Gem is Ruby library which can be used in one’s own code.
  • Go to command prompt and type the following :
       gem install rspec

 

       You will get the following output:

         

    Done installing documentation for diff-lcs, rspec-support, rspec-mocks,

rspec-expectations, rspec-core, rspec after 22 seconds 

6 gems installed

 

  • To start with Selenium in Ruby you also need to install the gem selenium-webdriver which will act as a binder for Ruby from the command line.

 

Type the following command to install ‘selenium-webdriver’:

 

gem install selenium-webdriver
  • Now, create directory i.e. folder to store Rspec scripts. Open your command prompt and change the directory path to the one where you would be saving your scripts.

Example: If your directory name is ‘sample_scripts’ on desktop:

 

C:\Desktop\sample_scripts>

 

Let’s start with writing script in Rspec.

 

So for this open any editor. Here, I have used sublime.

 

  • Write the following code in the sublime editor and save it. Save it with name sample.rb

 

Automated Testing Codes of RSpec & Selenium

 

 

  • To run the script go to command prompt and type:
C:\Desktop\sample_scripts>rspec sample.rb

 You will get the output as following after executing the script:

 

 Finished in 0.002 seconds (files took 0.11101 seconds to load)   1 example, 0 failures

 

Keywords in Rspec:

 

As this is targeted to new coders, you need to know some keywords which are meant to be used in your code. This helps in understanding the protocol to be followed while coding.

 

  • describe..... do

Description of the collection of related test cases

 

  • it......do

Individual test cases

 

  • Before() and After()

 

Optional test statements run before and after each or all test cases.

 

 

So, let’s hope you have understood the significance of using RSpec while automation testing.

 

This reduces your time to test & increases the efficiency of testing.

 

The code quality is needless to mention becomes high.

 

All these steps are for test-driven development (TDD) environment if you want to know how to use RSpec in Behaviour Driven Development (BDD) please refer our previous blog about it.

 

Aren’t we testers meant to have this as our focus? This is all about the beginning of using RSpec in your Ruby on Rails Development process.

 

 

 

 

When working in a team, you may have come across a situation wherein there are many copies of Code of your Ruby on Rails Application and then you really don't know if it has been updated,well-organized or well merged, for that matter, haven’t you?

Well, GitHub is your solution to the same.GitHub is that platform that I rely a lot on my coding. Be it organizing, updated code or merging code, this platform takes care of it all.

GitHub is a code hosting platform for version control and collaboration. It is a very useful tool that allows you to work in any geographical location.

GitHub is the most powerful platform for management and review of the code. Github is used for managing the code on the single platform. Using GitHub you can track the changes of each commit. Github also provides public and private repositories. The public repository is most commonly used for open source software applications.

Let’s learn:

  • How to create a repository in a GitHub?
  • How to create new branches and manage these branches in  GitHub?
  • How to push your code in GitHub?
  • How to manage commits?
  • How to create and manage pull request GitHub?.

I’ll start considering you a RoR developer and then, of course, you know how to create your account in GitHub. Well, You should know that!

        On Logging into GitHub, you’ll find many options and parameters but for a kick-start to committing codes in GitHub, first, you need to create a repository.

 

     Create a repository in a GitHub :

The GitHub repository is a  virtual directory or space where we can access your project, its files, and all related data.

GitHub - Platform for Software Development

On click of new repository button, you will be redirected to new directory form page. You need to follow the below steps to create a new repository in GitHub.

  1. Write a valid name for the repository
  2. Write a short and simple description of the project.
  3. Click on new repository button to submit the form for creating the repository.

GitHub - A Platform for Software Developers

 

 

After successful submission of the form, you will be redirected to the Setup page of the created repository.

Software Development and Code Committing Platforms - GitHub

 

First of all, take a clone for the projects, you need to make your backup is ready!. Use the following command.

 

git clone https://github.com/Test/sample-app.git

 

Then you need to change the directory

 

cd sample-app

 

If you want to create a new branch by command line and switch to that branch you can use the below command.

 

git checkout -b  NC-2018-06-charts-data

 

Your  branch name should be short and descriptive

 

You can also change the current working branch by using the below command.

git checkout  NC-2018-06-charts-data

 

Push the code:

 

Now, once whatever changes you have made in the file you can track by using the below command.

 

git status

 

The above commands will list out all of the changes in files.

 

You can also check what contents and lines have been modified by using the below command. It will list out the changes, the Green color will show the line added and the red color will show line removed

 

git diff “file_path”

 

If the files are ready to push you can add these files by using the below command.

git add “file_path”

 

You can also remove the file from your local system and the remote system.

First, you need to delete the files locally then after executing the command “git status” it will list out the files that have been removed locally, then you need to run.

git remove “file_path”

 

After adding all the files you can commit the code on the remote server.

git commit -m “The commit message”

 

After adding all the files you can push the code on a remote server by using the command.

git push origin Rs-2018-06-charts-data

Manage commits:

 

IF you have NOT pushed your changes to the remote repository and just committed the code and then you may want to remove the commit, use.

git reset HEAD~1

 

If you have pushed your changes and you may want to revert to the previous commit then you need to run the below command.

git revert HEAD

 

This command will revert/remove the last one commit/ change.

 

Create and manage pull request:

 

Software Development and Code Committing by Team

 

First, you will have to take the fork of the repository then you can change in the code and commit the code.

 

On click, or pull request, you can send the pull request to the specified person. After getting the pull request you can click on Merge pull request. Your commits will be merged into the base branch.

 

So, now you know, how easily GitHub can manage the code -not depending on any locations!!

Export data in HTML table is one of the most convenient features in the web application.  

 

Basically export means the user can download the data in some format like Excel, PDF or CSV. Once the data get exported it can be used offline.

 

Nowadays most of the web applications process data easily without accessing the server continuously at client side itself. It becomes more user-friendly in rapidly accessing data without interacting with the server. It gets required data once on the client side and process as you want.

 

When to use data exporting in Web application:

 

Web application developed for administrative purpose where a large amount of data get added on daily basis.

 

If you want to analyze data offline, exported data help you to create reports for future scope, what will be the next strategies to improve your business.

 

Data in the tabular format most of the time is required to export.

 

Let’s take an example of buyers/user in an inventory management system, which contains buyer details.

 

Sr. No

Name

Address

Mobile No

Comment

1

Roney

8806 Green Hill St.

2025550125

Roney is a student

2

John Tale

7 Sherman Lane

2015489798

Professional Writer

3

Martin

Massapequa Park

2215468763

Sales Executive

4

Emily

9872 Wagon Station

2645498874

Graduate

5

Sarah

Bayberry St. Lilburn

2016745162

Housewife

 

Table 1: Buyer/User Details

 

Export HTML table data in excel using jQuery is one of the best approaches to implement, no need to use any jQuery plugins. On click of a button, the user can easily download the data in excel format.

This document will help you to export table data in excel file format with column heading present in the table.

Below is the example of Rails view table code with “Export to Excel” button.

 

Export HTML Table Data into Excel in ROR Application

 

Figure 1: Code for Export HTML Data into Excel

 

Tags used in rails view table:

<caption></caption> tag is used to get the heading in excel sheet after export.

 

Hidden column data export in excel:

In the above table code if you add any hidden column names, still you can export data in excel.

For example, I have the comment column, I don’t want to display in the table of rails view but comments should be exported to excel.

In that case, just add hidden <th></th> tag in header and body ( to hide <th> you can use display:none css ) of table, where you want in a sequence.

<th class="text-center hidden-th">Comment</th>

After clicking on “Export To Excel” button hidden column data will export.

Javascript function to export data:

 

<script>

      function exportDataToExcel(table-id, filename = '')
       {

          var downloadurl;

          var fileType = 'application/vnd.ms-excel';

          var tableSelect = document.getElementById(table-id);

          var dataHTML = tableSelect.outerHTML.replace(/ /g, '%20');

          filename = filename?filename+'.xls':'user_details.xls';

          downloadurl = document.createElement("a");

          document.body.appendChild(downloadurl);

         if(navigator.msSaveOrOpenBlob)
           {

              var blob = new Blob(['\ufeff', dataHTML],
               {

                  type:  fileType

              });

             navigator.msSaveOrOpenBlob( blob, filename);

           }
        else
          {

           downloadurl.href = 'data:' + fileType + ', ' + dataHTML;

           downloadurl.download = filename;

          downloadurl.click();

       }

    }

</script>

 

Above exportDataToExcel jQuery function will take the table id to get the data from the table of rails view.

 

After that, it will generate the downloadable URL.

 

In below line of code, you can provide the file name

 

filename = filename?filename+'.xls':'user_details.xls';

See the exported HTML user data in excel format in the given Table 2:

Export HTML Table Data into Excel in ROR Application

Table 2: Exported HTML User Details in Excel Format

 Above is a simple way to export data easily in excelling format. Likewise, you can export data in CSV and PDF format just mention the file type in for example:

csvFile = new Blob([csv], {type: "text/csv"});

We can also customize the excel view and content as per requirement. Above is the simple and easiest way to implement data export in excelling format.

Hope, this blog helps you in your Ruby on Rails Application!

Please post comments below, if I could be of any help.

 

QR Code: Why they are more helpful than a standard standardized identification? Is that they can store more information, including URL connections, content and so on.

 

Here, I am automating - I mean to say scanning/reading QR code without any mobile or without any scanner.

 

To make this work, please follow the steps given below:

 

Step 1:

 

Locate the existing QR code path in your local storage location.

 

In below screenshot, I have shown the location of QR code from my local storage location.

 

This location/path is used to convert into a URL and put into the selenium script.

 

Below QR_Code is in image format which is in .png format.

 

 

Software Testing in Ruby on Rails Application

 

Figure 1: QR Code in Image Format

 

Step 2:

 

This image should be converted into a URL path. It is too simple. Please follow the instruction given below.

  1. Open Google Chrome.
  2. Pick your QR_Code image and drop into google chrome.
  3. Now, the image is converted into the URL. (Please check below image)
  4. Copy URL and put into selenium script.

 

QR Code Automation - Software Testing in Ruby on Rails Development

 

Figure 2: QR Image converted into URL

 

Step 3:

 

Now, open eclipse

 

Create Java project

 

Import required library as follows,

 

1. Selenium-server-standalone

2. Testng

3. Zxing

4. Zxing-1.7-javase

(Please refer the image given below)

 

 

Ruby on Rails Development and Software Testing

 

Step 4:

 

Write a script in Eclipse editor.

 

Import org.openqa.selenium.webdriver;

import org.testng.annotation.Test;

  public class QRAutomation {

        @Test

        public void testQRCode()

{

System.setProperty("webdriver.chrome.driver", "chromedriver.exe path");

WebDriver driver = new chromeDriver();

driver.manage().window().maximize();

driver.get(" C:\\Users\\Prateek\\Desktop\\QR_Code_Updated.png");

String qrCodeFileUrl =         driver.findElement(By.tagName("img")).getAttribute("src");


System.out.println("QR Code Image URL is : " +qrCodeFileUrl);

URL urlOfImage = new URL(qrCodeFileUrl);

BufferedImage bufferedImage = ImageIO.read(urlOfImage);

LuminanceSource luminanceSource = new           BufferedImageLuminanceSource(bufferedImage);

BinaryBitmap binaryBitmap = new BinaryBitmap(new          HybridBinarizer(LuminanceSource));

Result result = new MultiFormatReader().decode(binaryBitmap);

String textInQrCode = result.getText();

System.out.println("The Text in QR Code is : "+textInQrCode);

}

 

Step 5:

 

Understanding the code

  1. Bufferedimage: It is used to handle and manipulate the image data.

 

  1. ImageIO.read: To perform the image read-write operation we will import the ImageIO class.

 

  1. LuminanceSource: The examples are extracted from open source    Java projects.

 

  1. BufferedImageLuminanceSource: Always use the returned object, and ignore the length of the array.

 

  1. BinayBitmap: This class is the core bitmap class used by ZXing to represent 1-bit data. Reader objects accept a BinaryBitmap and attempt to decode it.

 

  1. HybridBinarizer: It is designed for high scale images of QR code with black data on white backgrounds. This Binarizer is the default for the unit tests and the recommended class for library users.

 

  1.  MultiFormatReader(): By default, it attempts to decode all QR Code formats that the library supports. Optionally, you can provide a hints object to request different behavior, for example only decoding QR codes.

Step 6:

 

Run the script in Eclipse.

 

Click on “Run” button

 

 

 

 

Step 7:

 

Display the result in a console of the eclipse

 

After clicking on the Run button, the result/output is displaying on the console of the eclipse. (Please refer the image given below.)

 

 

Ruby on Rails Web Application Development with Automated TestingAbove image is used to display the output in console panel.

 

 

QR Code Automation Output - Software Testing in ROR Application

 

Above image display, the actual data stored into the QR code and as same output are printed in eclipse console.

 

  • Advantages of QR_Code testing:

 

  1. This is used to test that the actual data matches with expected data.

 

  1. Security and Authorization is the base of all applications. Hope, the above way of automated testing helps you to test security and confidentiality of data in a better way.
What is Rspec?

 

Before implementing Rspec you should know what is the actual meaning of Rspec? R stands for ‘Ruby’ and the meaning of ‘Spec’ is Specification. RSpec is a unit test framework used in Ruby on Rails web application development. RSpec is 'Domain Specific Language' (DSL) testing tool. You should write Rspec in Ruby language to test your Ruby code.

 


Why do you use Rspec?

 

Rspec is an automated test case, used to test the code written by you while creating the application.
 

Developers follow the Rspec to write is known as TDD (Test Driven Development) and the Rspec written by the Testers, generally known as BDD (Behavior-driven development).

 

Advantages of Rspec:

 

There are several advantages of Rspec when you use it in your application.

 

  • Rspec always performs fast tests.
  • Rspec is very good for unit testing, that is testing models, controllers, and views.
  • If you develop the test cases with Rspec is easy and clear to Understand.
  • Much clear failure reports.
  • RSpec includes traditional Unit Testing, which means testing a class or part of the application in isolation from the rest of the application.
  • RSpec used for Acceptance Testing known as TDD (Test Driven Development) or BDD (Behaviour Driven Development) Specification.  These are support business-case driven Integration Tests.

 

How to setup Rspec in your Rails app?

 

Now to configure Rspec or to setup rspec in your application you should go through the following steps.

 

First you need to add rspec-rails to both the :development and :test groups in the Gemfile:

1.  group :development, :test do

          gem 'rspec-rails', '~> 3.7'

     end

 

 

2.  Then you should run the command,

    bundle install

 

 

3.  Then you should initialize the spec/ directory with:

     rails generate rspec:install

 

This adds the following files which are used for configuration:

.rspec

spec/spec_helper.rb

spec/rails_helper.rb

 

If you want to add the files for your controller or model, then first you need to create the controller or model directory under spec folder and add the specific files inside those folders.


As an example you can say, spec/controllers/category_controller_spec.rb.

 

4. To run your specs you need to use the ‘rspec’ command.
     i.e ~$ rspec

 

What is the basic syntax of Rspec?

 

1) describe:

 

Here describe is the Rspec Keyword, which is generally used to define a class name or an example group or string arguments. This is the basic building blocks to organize the tests.

 

  RSpec.describe HelloWorld, type: :class do

    describe HelloWorld do

     context "when testing the helloworld123 class" do

      it "should say 'Hello World' when calling the method" do

       hlo= HelloWorld.new

       msg= hlo.say_hello

       expect(msg).to eq "Hello World!"

       puts "HelloWorld executed!"

     end

    end

  end

end

 

2) context:

 

The context keyword is the same as describe keyword.  It also accepts the string arguments or class name.

 

Here context is a block which is used to describe the context, in which the class or method mentioned in the describe block is being used.

 

Example:

context "With valid input" do

 

3) it:

 

it keyword basically defines what is the example do. In simple word, you can say, what kind of test is performed that is defined by it keyword. It also used in a block of a statement and it contains do/end.

 

Example:

it 'create a new blog with a blog_name and description'

 

4) expect:

 

It defines what the expected output for the test is. It’s nothing but the expectations in rspec.

 

Sometimes need to use expect().to be true. It depicts the test result is expected to be true i.e positive test cases. Similarly  expect().to be false, it is expected the negative test results. RSpec uses a simple framework and keywords like should() and should _not() to express expectations.
 

Expect also use eql keyword i.e expect().to eq “hello”. Eql is basically a matcher that used to show the equality of test result with the expected result.

 

Example:

expect(response).to be_success

 

RSpec in Test Driven Development

 

RSpec in Behavior Driven Development

 

At last, I hope this article will be helpful to understand and implement Rspec in your ruby code and to cover all the scenarios (i.e including positive and negative test cases).

 

All the Ruby on Rails Developers, you can save a lot of your time while testing Ruby on Rails code making it faster. And overall it will be very much useful to write the automated test cases rather than using the manual test cases.

  Everything is shifting from a physical, tangible experience to a more personalized, yet virtual interface. The dating game has changed with Tinder and you can even experience landing on the moon from Apollo 15 by just putting on those VR goggles. The dynamics of life have changed and with that has changed your lifestyle.

 

  Have you ever visited an exhibition? The hallways are swarming with people, everyone wants to go around in that stipulated time. Other than the high ticket fares, you can only visit the one exhibition on display for the weekend in your city, not those in Paris or Sydney.

 

 Cryptex has developed virtual exhibition software, an exhibition on the tiny screen you can carry around the entire day. Unlike the conventional, physical expos, this application allows you to access any exhibition from over the world, which is on display in the application. While the end user can choose the category of expo they wish to visit, the businessmen and companies can get a filtered audience, instead of a large footfall not converting into business.

 

  We at Cryptex have made sure that the virtual touch doesn’t sideline the human needs. With an inbuilt chat system using both audio and video functionality, the user can communicate with the exhibitor freely. Apart from reading the business brochures stacked on the book stand by the booth, the visitor can add it to his briefcase for referencing later.

 

Virtual Trade Fair

 

   Figure 1: Virtual Fair

 

Owners can present an online presentation of their work, products or simply an informative tour of the business. For future communication, they can provide their social media handle links along with the website link or Email ID on a virtual booth.

 

Virtual Exhibition Software

Figure 2: Virtual Stalls

  A feature of exchanging visiting cards is also provided on this booth. This can be treated as a trade show management software. 

The next step is to include a VR feature enabling the users to have a wholesome experience, touring in any exhibition they wish to.

 

Devise is a flexible authentication solution for Rails. It is a complete MVC solution based on Rails engines. It allows you to have multiple models signed in at the same time. It hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.

This ultimate feature of Ruby on Rails development makes your application more secure than other platforms.

STEP 1: gem 'devise' install

                                 

STEP 2: run bundle install

 

STEP 3: run rails generate devise:install

 

rails generate deviserun STEP 4: :views

 

Let’s see an example of STEP 5: application in which need 2 models assuming one is member model and the other is contact model. So now we are going to create our member model using devise:

run rails generate devise member

The migration file will be located in

db/migrate/ devise_create_members.rb.

 

Ruby On Rails Development Using Devise

 

rake that, you should have to runAfter STEP 6: db:create (For creating new database)

 

rake runSTEP 7: db:migrate

Once you run the db:migrate command, rails will create a table called members with the following field that the Devise specified in the migration file. Check the tables have created successfully.

STEP 8: run the server by typing “rails server” and copy and paste the 1 and 2 addresses to your browser search bar.

1- http://0.0.0.0:3000/members/sign_up

2- http://0.0.0.0:3000/members/sign_in

 

STEP 9: run rails generate migration add_username_to_members username:string

We have to add the username to the sign-up form. This command will generate another migration file in your “db/migrate” directory.

 

Ruby On Rails Application Using Devise

rake runSTEP 10: db:migrate

 

STEP 11: run rails generate model contact

 

Edit the migration file of contact and specify the 2 fields as shown below.

 

Open db/migrate/ 20180312073055_create_contacts.rb.

 

Ruby On Rails Development Using Devise


STEP 12: run rake db:migrate

STEP 13: run rails generate controller home

 

And then create a new index file for the home controller like “app/views/home/index.html.erb and then add the following.

 

 

STEP 14: Once you have done, open app/config/routes.rb

add this line

 

root :to =>'home#index'

 

STEP 15: run rails generate controller registration

Open “app/controllers/registration_controller.rb” and then edit the file as shown below.

 

 

STEP 16: We have to mention the relationships between 2 models (member, contact). Here the relationship will be as follows.

Open_Filepath: app/models/member.rb

 

 

Open_Filepath: app/models/contact.rb

 

 

STEP 17: Now refer the registration controller file in app/controllers/registration, here after completing the registration & the values that the member entered is stored in the table successfully I just redirected the member to the dashboard page. So we have to add that page to our home controller.

 

Open_Filepath: app/views/home/dashboard.html.erb

 

Open app/config/routes.STEP 18: rb and you have to specify this path in our routes.rb file.

 

STEP 19: run “rails s” and go to http://localhost:3000 address to your browser search bar.

 

 

       There are a number of gems used in Ruby on Rails Framework. Cocoon gem is one of them; this gem is basically used for Nested forms, multiple models and in multiple attributes in one form.

 

Nested forms in Rails are the forms which are used for creating; updating, deleting multiple models data using a single form.

 

For example, we have two models user and address. If we have to save user and address data from single form here nested forms are used.

 

Let us consider another scenario, if we have to save one user data having multiple addresses at that time cocoon gem is very useful.

 

The cocoon gem generates nested form and adds/remove button for adding/removing multiple forms for the nested model (in above case “addresses”).

 

Simply clicking on add/remove button we can generate multiple form fields of the nested model (addresses).

 

PREREQUISITES:

 

This gem requires jQuery. If jQuery is not present in the project then simply add “jquery_rails” gem to gemfile.rb.

 

INSTALLATION STEPS FOR “COCOON” GEM:

 

Add following in Gemfile.rb file:


gem 'cocoon'

 

Also, add following in the application.js file:


//= require cocoon

 

That’s all about the installation process.

 

Let’s see an Example PROJECT

 

For creating a Project model, controller and views using scaffold command just run:


rails g scaffold Project name:string description:string

 

Then create a Task model which belongs to the project:


rails g model Task description:string done:boolean project:belongs_to

 

Changes in rb file:


class Project < ApplicationRecord

  has_many :tasks, inverse_of: :project

  accepts_nested_attributes_for :tasks, reject_if: :all_blank, allow_destroy: true

end

 

No changes required in rb file:

 


class Task < ApplicationRecord

  belongs_to :project

end

 

 

Changes in projects_controller.rb file: 

 


def project_params

  params.require(:project).permit(:name, :description, tasks_attributes: [:id, 

  :description, :done, :_destroy])

 end

 

Changes in projects/_form.html.erb file:

 

Cocoon Gem in Ruby on Rails Development

 

 

Create a new file named as _task_fields.html.erb in the projects folder in view and add following code in it:

 

 

Cocoon Gem in Ruby on Rails Development

 

 

Following are the snapshots of output scenarios:

 

  1. Creating a new project:

   

 Creating a new project in Ruby on Rails

  1. Adding one task in project form (click on add task link to render task form):

     

Nested Forms in Ruby on Rails Development

 

  1. Adding two tasks in project form:

 

Nested Forms with Add or Remove Tasks in Ruby on Rails Development

 

Similarly, we can remove task form from the project by clicking in remove task link present on the project form.

 

In the process of web application development nested forms play important roles that can be achieved by using COCOON GEM so that one can add multiple instances of nested form in a form.

As a web developer, everyone knows the importance of HTML & CSS for making his or her web pages to be interesting.

We all know that web languages upgrade regularly, so all web developers need to stay current and updated. The latest version of HTML has introduced in the market i.e. HTML5.

HTML5 has all new features that you will love to use while making document structure.

A bunch of new tags to make our pages more semantic has introduced in this version. It will also help search engines and targeted audience to navigate our pages and improve the web experience for everyone. Some of the new semantics or structural elements have been covered here:

Tags Description

<article>

  Defines an article in a document

<aside>

  Defines content aside from the page content

<figure>

  Defines self-contained content

<mark>

  Defines marked/highlighted text

<progress>

  Represents the progress of a task

<section>

  Defines a section in a document

<ruby>

  Defines a ruby annotation

<nav>

  This tag contains navigational elements, such as the main navigation on a site or more specialized navigation like next or previous-links.

Some of the tags are explained with examples below:

1) Article Tag

<article>
  <p class="content font-new"> Content </p>
  <p class="content font-new"> Content </p>
</article> 

2) Aside Tag

<aside class="menu-sidebar d-none d-lg-block">
  <div class="logo">
    <a href="#">
      <img src="/assets/logo.jpg" alt="Jcu" class="logo-img"/>
    </a>
  </div>
  <div class="menu-sidebar__content js-scrollbar1">
    <nav class="navbar-sidebar">
        <ul class="list-unstyled navbar__list text-center">
            <li class="active has-sub">
                <a class="js-arrow" href="#">
                  <i class="fas fa-tachometer-alt"></i>APPS
                </a>
            </li>
        </ul>
    </nav>
  </div>
</aside>

3) Figure Tag

<figure>
  <img class="thumb" src="images/img.png" alt="" title="product1">
  <figcaption>Fresh Whole Chicken</figcaption>
</figure>

4) Mark Tag

<p>Peter's Poultry was founded in 1997 and was known as <mark>Prestige Poultry</mark>.</p>

5) Progress Tag

<progress value="10" max="40"></progress>

6) Section tag

<section id="footer">
    <div class="container">
    <div class="row">
      <h4 class="text-center font-size19">CONTACT US</h4>
      <div class="clearfix-20"></div>
    </div>
    <div class="row">
      <div class="col-md-8 col-md-offset-2">
        <div class="col-lg-3 text-center border-right"><a href="contact.html" class="footer-menu">CONTACT US</a></div>
        <div class="col-lg-3 text-center border-right"><a href="#" class="footer-menu">SITEMAP</a></div>
        <div class="col-lg-3 text-center border-right"><a href="#" class="footer-menu">PRIVACY & TERMS</a></div>
        <div class="col-lg-3 text-center"><a href="#" class="footer-menu">ACCESSIBILITY</a></div>
      </div>
    </div>
    <div class="clearfix-20"></div>
    <div class="row">
      <div class="social-media col-lg-12 text-center">
        <ul class="list-inline col-lg-12">
          <li><a href="http://www.nextbootstrap.com/" title=""><i class="fa fa-facebook font-size19"></i></a></li>
          <li><a href="http://www.nextbootstrap.com/" title=""><i class="fa fa-twitter font-size19"></i></a></li>
          <li><a href="http://www.nextbootstrap.com/" title=""><i class="fa fa-instagram font-size19"></i></a></li>
          <li><a href="http://www.nextbootstrap.com/" title=""><i class="fa fa-google-plus font-size19"></i></a></li>
           </ul>
      </div>
      </hr>
    </div>  
 </div>
</section>

7) Nav Tag 

<nav class="navbar navbar-inverse ">
  <div class="container-fluid head-border-bottom">
    <div class="navbar-header col-sm-4">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
      <a class="navbar-brand logo-box" href="#">
        <div class="col-sm-12">
            <img src="images/logo.png" class="logo-img">
        </div>
      </a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav navbar-right">
        <li class="hvr-sweep-to-top"><a href="index.html">Home</a></li>
        <li class="hvr-sweep-to-top  active-menu"><a href="index.html#products">Our Products</a></li>
        <li class="hvr-sweep-to-top"><a href="food_safety.html">Quality and Food Safety</a></li>
        <li class="hvr-sweep-to-top"><a href="#">Gallery</a></li>
        <li class="hvr-sweep-to-top"><a href="our_story.html">Our Story</a></li>
        <li class="hvr-sweep-to-top "><a href="contact.html">Contact Us</a></li>
      </ul>
    </div>
  </div>
</nav>

Some new form elements are added like ‘<datalist>’ which specifies a list of pre-defined options for input controls and ‘<output>’ which defines the result of a calculation.

Also, new input types with their input attributes, new attribute syntaxes with graphics and media elements have been offered in HTML5.

Not only HTML5 but CSS3 both has given wings to web application development.

CSS 3 has built using the principles about styles, selectors and the cascade that was also in the earlier version of CSS. However, in CSS3 some of the new features have been added like new selectors, pseudo-classes and a lot of properties. It helps in making your layout easily.

A simple introduction for markup is given here. Consider a section with a heading and a paragraph of text. We can make it more appealing using CSS3 features.

Example:

#intro {

          margin-top: 66px;

          padding: 44px;

          background: #467612 url ("bg.png") repeat-x;

          background-size: 100%;

          border-radius: 22px;

}

Here are two new properties which we can use.

The first one is background-size; it allows us to scale the background image.  If we scale it to 100% on both axes the box expands when more content is added to it parallel gradient background will scale as well. This was not possible in CSS 2.1 without non-semantic markup and miscellaneous browser issues.

The second new property is border-radius, it gives rounded corners to the element. Different values can be given to the radius.

Web Development and Designing with HTML 5 tags

It is possible to develop any web app from legal document software to music distribution software with these features of HTML 5 and CSS 3.

 

Introduction to Vscode (Visual Studio Code)

Visual Studio Code i.e. Vscode is modern and robust code editor developed by Microsoft.

We can use it for setting up Ruby on Rails development environment.

It combines the simplicity of code editor with powerful tools like IntelliSense, code completion, debugging and built-in Git support. One of the beauties of Vscode it's free and open source.

It is available for Windows, Mac, and Linux with huge community support. 

How to Install Vscode?

Installation steps of Vscode are pretty simple, go to Visual Studio it will automatically detect the operating system you are using and provides a download link. After installation, you are ready to start customizing Vscode for Rails development.

How do you set up Vscode for Rails?

· Ruby extension:

The first thing you have to do is install a ruby extension in Vscode. Press f1, type ext install then search for ruby OR go to ‘View’ > ‘Extensions’ and search for ruby and hit install.

· Debugger:

    In ruby extension, there is ruby-debug ide protocol to allow Vscode to communicate with ruby-debug. It requires ruby-debug-ide to be installed on your system. This is how Ruby Mine/Net Beans does by default. Read the documentation GitHub to install ruby-debug-ide protocol.

· Linters:

Linting is the process of running a program that will analyze code for potential errors. Below is the list of linters supported by ruby. You will need to install the ruby gems for each of these for Linting to work:

1. rubocop

2. ruby-lint

3. reek

4. fasterer

5. debride

After installing ruby gems for linters, enable each one in your workspace or user settings. To do this go to ‘File’ > ‘Preferences’ > ‘Settings’ and paste the below settings.

 "ruby.lint": {

      "reek": true,

      "rubocop": true,

      "ruby": true,

      "fasterer": true,

      "debride": true,

      "ruby-lint": true

},

· Ruby on Rails snippets extension:

Ruby on Rails snippets extension save your lots of time. After installation reloads Vscode and just type ‘controller-rest’ it automatically writes all the rest methods for you. It will save your 80% time. There are many snippets available for controllers, models, and views. Go ahead try yourself.

· Ruby Solargraph:

Solargraph is a language server that provides IntelliSense, code completion, and inline documentation for Ruby.

Themes and Editor Settings

· Theme:

Vscode provides a couple of built-in themes. If you are the sublime user, just go to ‘File’ > ‘Preferences’ > ‘Color Theme’ and select ‘Monokai’ theme. There are hundreds of themes available for you, just go to ‘File’ > ‘Extensions’ and type theme name and install it.

· Font:

The font is one of the most important things when you are writing code. If the font of your code editor doesn’t look good you cannot write code for a long time and it hurts your eyes.

'. Download it and install on your system. Go to FIRA CODE. There is beautiful font available for you that is ‘Vscode settings and add below settings to activate ‘FIRA CODE’.

"editor.fontFamily": "Fira Code",

"editor.fontLigatures": true,

 · Editor settings:

These are some editor settings that you can prefer.

"editor.lineHeight": 40,

"editor.rulers": [80,120],

"[html]": {

                 "editor.foldingStrategy": "indentation"

               },

"html.format.indentInnerHtml": true,

"editor.tabSize": 2,

"editor.formatOnSave": true,

"editor.autoIndent": true,

"editor.fontWeight": "500",

"html.suggest.html5": true,

"editor.fontSize": 17,

"editor.minimap.maxColumn": 30,
 
Task Automation:

Lots of tools available to automate tasks like Linting, code formatting, and testing. These tools uses command line interface to run the tasks. But we want everything in our editor, we don’t want to switch from editor to terminal for running single command.

To create tasks in Vscode click on ‘Task’ > ‘Configure Task’ > ‘Create task.json file form template’ > ‘Others’ it will create ‘.vscode’ directory into root of your project and also creates ‘task.json’ file. Below file generated by Vscode.

{

// See https://go.microsoft.com/fwlink/?LinkId=733558

// for the documentation about the tasks.json format

"version": "2.0.0", "tasks":

 [

    {

       "label": "echo",

       "type": "shell",

       "command": "echo Hello"

    }

  ]

}

 The task array contains all your tasks. Read more about task automation in Vscode. It makes developer life easier.

We have created a couple of tasks for HTML beautifier, Rubocop, rspec, rails server etc. You need to install HTML beautifier gem to use ‘beautify’ task.

 "version": "2.0.0", "tasks":

[

  {

     "taskName": "beautify",

     "type": "shell",

     "command": "htmlbeautifier ${relativeFile}",

     "problemMatcher": [],

     "presentation": { "reveal": "never" }

   },

  {

    "taskName": "rubocop",

    "type": "shell",

    "command": "rubocop --auto-correct ${relativeFile}",

    "problemMatcher": [],

    "presentation": {"reveal": "never"}

  },

 {

   "taskName": "rspec",

   "type": "shell",

   "command": "bundle exec rspec",

   "problemMatcher": [],

   "presentation": { "reveal": "always" }

 },

{

  "taskName": "rspec file",

  "type": "shell",

  "command": "bundle exec rspec ${relativeFile}",

  "problemMatcher": [],

  "presentation": {"reveal": "always"}

 },

{

 "taskName": "rails c",

 "type": "shell",

 "command": "bundle exec rails console",

 "problemMatcher": [],

 "presentation": { "reveal": "always"}

},

{

  "taskName": "rails s",

  "type": "shell",

  "command": "bundle exec rails server",

  "problemMatcher": [],

  "presentation": { "reveal": "always"}

}

 So here it is folks, you can create many tasks as per your requirement. If you need any help for setting up Vscode for Ruby on Rails development please comment below :)

Being a Rails developer we are familiar with ActiveRecord queries, but not so much with Arel. Arel is a library which allows us to customize our queries in object-oriented manner without having to use manual SQL and string interpolation.

We often use where a method for querying the database. Where method can handle equality, null, arran ays and now in Rails 4 it is also able to handle inequality condition with not method. But when there is a requirement of writing queries with OR statement or greater-than or less-than conditions most developers opt for writing SQL string queries. We have a better way to handle this situation using Arel.

For example:

If you want to select students having the date of birth greater than today’s date or date of birth less-than or equals to today’s date, usually a developer will write the query like this

Student.where("date_of_birth> ?", Date.today)

or

Student.where("date_of_birth<= ?", Date.today)

But this is not a good way to write such queries as we can write these queries in a more better way using Arel like this

Student.where(Student.arel_table[:date_of_birth].gt(Date.today))

or

Student.where(Student.arel_table[:date_of_birth].lteq(Date.today)) 

In the same way, ActiveRecord does not provide support for OR queries in earlier rails version.

If you want to fetch all the students having first as John or last name as Doe you can write the query like this but that is not the recommended way

Student.where(“first_name = ? OR last_name = ?”, “John”, “Doe”)

The recommended way of writing a query for the above scenario is

arel = Student.arel_table

Student.where(arel[:first_name].eq("John").or(arel[:last_name].eq("Doe")))

Same with the LIKE queries when we opt for writing SQL string literals

Arel has a keyword called matches for writing LIKE queries

Advantages of Using Arel are:

1. Follows DRY principle

Most of the time we write duplicate queries having one different parameter. We can avoid writing such queries using Arel. Because we can write queries in methods and that methods can be used for another query as well as we can design query builder using Arel.

2. Reliability

When we write Join query using SQL string it can break down due to ambiguity in column names but this is not the case with Arel.

3. Readability

Methods provided by Arel are readable to anyone who even don’t know much about coding. As we can write queries in parts using Arel it is much easier to understand in parts.

Arel allows rails developer to write queries in an object-oriented manner and it also allows us to write more complex queries with ease and modular code. Next time, when you stuck into complex queries go for Arel. This article just provides an overview of Arel as there is much more to explain in Arel. Detail description is available in the official docs of Arel.

Many times, we need to track the page views of any page such as profile page, shopping sites page in a Ruby on Rails applications, for which we can make use of Impressionist gem to track those page details easily.

It is a lightweight plugin that logs impressions per action or manually per model. We can log impressions multiple times per request. And we can also attach it to a model.

Below are the simple steps needed to follow to implement it:

Step 1: Create a sample app using scaffold.

Step 2: Add “gem ‘impressionist’” gem to the Gemfile and install it by running bundle install command.

  • gem ‘impressionist’, git: ‘https://github.com/jordanhudgens/impressionist’

Step 3: Now generate the impressions table migration by running the below commands:

  • rails g impressionist
  • rake db:migrate

Step 4: Now we need to update our controller that we want to add the impression or page views counting system. So first we have add the following method in our controller with mentioning the list of actions that we want to count:

And then update the controller action with the impressionist method:

Step 5: We need to add the new counter cache column to the model that we are working with. Run the following command:

  • rails g migration add_impressions_count_to_blogs impressions_count:integer
  • rails db:migrate

Now we can update the model for tracking the hits:

Step 6: Now we can display how many views this Blog has.

The dynamics of web development have changed over the years. The HTML single page coding with CSS styling is an obsolete method now. One of the open source front end web application framework is the JavaScript based AngularJS, which has been in the industry for around 6 years now.

  • What reason do we need Protractor Framework for?

Protractor is a node.js program that is used to write end-to-end test. The tests are written in javascript to simulate user stories on a web browser. Protractor is effectively built upon webdriver so a lot of stuff we do on protractor will seem very similar.

JavaScript is utilized as a part of all web applications. As the applications develop, JavaScript additionally increments in size and many-sided quality. In such case, it turns into a troublesome situation for Testers to test the web application for different situations.

In some cases, it is hard to catch the web components in AngularJS applications utilizing JUnit or Selenium WebDriver.
Protractor is a NodeJS program which is composed in JavaScript and keeps running with Node to recognize the web components in AngularJS applications, and it additionally utilizes WebDriver to control the program with client activities.

  • What reason wouldn’t bediscovered in Angular JS web components utilizing Normal Selenium Web driver?

Precise JS applications have some additional HTML properties like ng-repeater, ng-controller, ng-display and so on, which are excluded in Selenium locators. Selenium can’t recognize those web components utilizing Selenium code. Along these lines, Protractor on the highest point of Selenium can deal with and controls those qualities in Web Applications.

The protractor is a conclusion to end testing system for Angular JS based applications. While most structures center on leading unit tests for Angular JS applications, Protractor centers on testing the genuine usefulness of an application.

  • Before we start Protractor, we need to install the following:

Selenium

NPM (Node.js)

Protractor Installation

  1. Open command prompt and type “npm install –g protractor” and hit Enter.
  2. Check the installation and version using “Protractor –version.” If successful it will show the version as like in below screenshot. If not, perform the step 1 again.
  3. Update the Web driver.
    webdriver-manager update

    webdriver-manager start

    Now, if you go to the following URL (http://localhost:4444/wd/hub/static/resource/hub.html) in your browser, you will actually see the Web driver manager running in the background.
  • Sample AngularJS application testing using Protractor

Protractor needs two files to run, a spec file and configuration file.

Configuration file: This File helps protractor to where the test files are placed (specs.js) and to talk with Selenium server (Selenium Address). Chrome is the default browser for Protractor.

Spec file: This File contains the logic and locators to interact with the application.

Configuration file:

// An example configuration file.

exports.config = {

directConnect: true,

// Capabilities to be passed to the webdriver instance.

capabilities: {

‘browserName’: ‘firefox’

},

// Framework to use. Jasmine is recommended.

framework: ‘jasmine’,

// Spec patterns are relative to the current working directory when

// protractor is called.

specs: [‘Example_spec1.js’],

// Options to be passed to Jasmine.

jasmineNodeOpts: {

defaultTimeoutInterval: 30000

}

};

Spec file:(This is the sample script which is by default present in our directory)

describe(‘angularjs homepage’, function() {

it(‘should greet the named user’, function() {

browser.get(‘http://www.angularjs.org&#8217;);

element(by.model(‘yourName’)).sendKeys(‘Julie’);

var greeting = element(by.binding(‘yourName’));

expect(greeting.getText()).toEqual(‘Hello Julie!’);

});

describe(‘todo list’, function() {

vartodoList;

beforeEach(function() {

browser.get(‘http://www.angularjs.org&#8217;);

todoList = element.all(by.repeater(‘todo in todoList.todos’));

});

it(‘should list todos’, function() {

expect(todoList.count()).toEqual(2);

expect(todoList.get(1).getText()).toEqual(‘build an AngularJS app’);

});

it(‘should add a todo’, function() {

varaddTodo = element(by.model(‘todoList.todoText’));

varaddButton = element(by.css(‘[value=”add”]’));

addTodo.sendKeys(‘write a protractor test’);

addButton.click();

expect(todoList.count()).toEqual(3);

expect(todoList.get(2).getText()).toEqual(‘write a protractor test’);

});

});

});

  • Execution of the Code

To begin with, we will change the registry way or explore the envelope where the conf.js and spec.js are set in our framework.

Follow the following step.

  1. Open the command prompt.
  2. Make sure selenium web driver manager is up and running. For that give the command as “webdriver-manager start” and hit Enter.
  3. Open a new command prompt and give the command as “protractor conf.js” to run the configuration file.

(Reference link: https://docs.npmjs.com/)

GraphQL With Ruby

08 May 2018

GraphQL With Ruby

Now a day’s most of the web or mobile applications fetch data from server which is stored in a database. REST API provides an interface to stored data that require by the applications. GraphQL is a query language for REST API's not for server databases.

It is database agnostic and effectively can be used in any context where an API is used. GraphQL provide platform for declarative data fetching where client need to specify what data needs from API in response.

Instead of multiple endpoints that return fixed data structures, a GraphQL server only exposes a single endpoint and responds with precisely the data a client asked for. GraphQL minimizes the amount of data that needs to be transferred over the network and improves applications operating under these conditions.

Introduction to GraphQL API on Ruby on Rails

  1. Start with adding gem in Gemfile
gem ‘graphql’
  1. Run command
bundle install
  1. Run command
rails generate graphql:install

Above command will add graphiql-rails in installation.
Let Post API where clients can get post and create post.
The post has an ID, title and description, goes into app/graphql/types/post.rb

Post = GraphQL::ObjectType.define do
name 'Post'
description 'Post creation'
field :id, !types.Int
...
end

The GraphQL ID type is a string, so we use Int.
GraphQL defines a schema with queries (eg. get post) and mutations (eg. create a post), which typically goes into app/graphql/schema.rb.

Schema = GraphQL::Schema.define do
query Query
mutation Mutation
end

The query root returns an post by ID, implemented in app/graphql/queries.rb.

Query = GraphQL::ObjectType.define do
name 'Query'
field :post, Post do
argument :id, !types.Int
description 'Get an post by ID.'
resolve ->(_obj, args, _ctx) {
OpenStruct.new(
...
)
}
end
end

A mutation creates posts in app/graphql/mutations/create_post_mutation.rb. Use Relay, a data fetching framework that makes it easy.

CreatePostMutation = GraphQL::Relay::Mutation.define do
name 'createPost'

input_field :title, !types.string
input_field :description, !types.string
return_type Post

resolve ->(_object, inputs, _ctx) {
OpenStruct.new(
id: 2,
...
)
}
end
  1. GraphQL Controller

GraphQL accepts a single JSON payload via POST in a typical Rails controller in app/controllers/graphql_controller.rb.

class GraphqlController < ApplicationController
def execute
result = Schema.execute(
query,
variables: variables,
context: context,
operation_name: operation_name
)
render json: result
end

private
def query
...
end

def operation_name
...
end
def context
...
end
def variables
...
end
end
  1. Set routes in config/routes.rb
Rails.application.routes.draw do
post '/graphql', to: 'graphql#execute'
end
  1. Start the rails application

using rails s

and type  http://localhost:3000/graphql   in browser for local environment for rails.

What is SearchKick Gem?

Searchkick Gem is a Ruby on Rails gem that runs on top of Elasticsearch and makes it easy searches in a Rails-friendly fashion. Searchkick supports the complete Elasticsearch Search API, as by using it our search becomes more advanced. In addition, it allows you to add more features including analytics, auto suggestions, and personalized results.

The steps are required:

  1. Add the gem “gem ‘searchkick’.
  2. Then run the bundle install command.

Then we will generate the complete model by using Scaffold generator

rails g scaffold Article name:string description:text

After running the above command it will generate all the necessary files then we will run the database migration command.

rake db:migrate

The controller code will be modified like that

Def index
	Query=params[:q].presence || “*”
	@artivles=Article.search(
		query,
		page: params[:page}, per_page: 25
	)
end

The model code will be modified like that

searchkick
def search_data
	{
title: title
}
end

The view code for display the articles will be modifeid like these.

Before starting the application we need to create the indexes

rake searchkick:reindex CLASS=Article

The ouput of the application look like these.

Step 1: First install postgres in Ubuntu system using following commands.

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

To check psql (postgres) version.

$  psql –version

Step 2:  Now to create root user and password for psql.

$  sudo -u postgres createuser -s root
$  sudo -i -u  postgres

Now, you are in postgres environment.

postgres@admin:~$

Now, use the following command to enter and manage psql.

postgres@admin:~$  psql

Now, set the password for psql username “root”.

postgres=# \password root
enter password
confirm

Now, you can exit from psql using following command

postgres=# \q

Step 3:  Create new user and database in psql

$ sudo su postgres
$ psql -c "create user mack with password 'mack'"
$ psql -c "create database mackdb owner mack"
$ sudo -i -u postgres
postgres@admin:~$  psql

Step 4:  Give all privileges over database to a particular user.

postgres=# grant all privileges on database mackdb to mack

You might be face this type of error while rakedb:create

PG::InsufficientPrivilege: ERROR: permission denied for relation schema_migrations rakedb:create

postgres=# ALTER USER mack WITH SUPERUSER;

To list all the users of psql.

postgres=# \du


To list all the databases of psql.

postgres=# \l


Step 5:  Take backup or dump file to the database.

$ sudo su postgres

To take the backup of psql database

postgres@admin:~$ pg_dump dbname > outfile

To dump into psql database. Go to particular directory where the dump file is present enter following command

postgres@admin:~$  pg_restore dbname < infile
exit.

This is all about postgres. Hope this is helpfull.

Thank You.

  • The best_in_place gem is the easiest solution for in place editing in Ruby on Rails.
  • This gem provides functionality of “in place editing” in ruby on rails without writing any extra ajax code.
  • It supports text inputs, textarea, select dropdown, checkboxes, jQuery UI Datepickers, etc.
  • Also Displays server-side validation

Installation Steps of “best_in_place” Gem :

Installing best_in_place is very easy and straight-forward. Just begin including the gem in your Gemfile:

gem ‘best_in_place’

After that, specify the use of the jquery and best in place javascripts in your application.js, and optionally specify jquery-ui if you want to use jQuery UI datepickers:

 //= require jquery
//= require best_in_place

//= require jquery-ui
//= require best_in_place.jquery-ui

Then, just add a binding to prepare all best in place fields when the document is ready:

$(document).ready(function() {
  /* Activating Best In Place */
  jQuery(".best_in_place").best_in_place();
});

You are done!

I have created a sample DemoApp in which I have done couple of changes in code as:

  1. users/show.html.erb:

<p id=”notice”><%= notice %></p>

<p>

<strong>Name:</strong>

<%= best_in_place @user, :name %>

</p>

<p>

<strong>Email:</strong>

<%= best_in_place @user, :email %>

</p>

<p>

<strong>Address:</strong>

<%= best_in_place @user, :address, :as => :textarea, :ok_button => ‘Save’, :cancel_button => ‘Cancel’ %>

</p>

<p>

<strong>Gender:</strong>

<%= best_in_place @user, :gender, :as => :select, :collection => [[“Male”,”Male”],[“Female”,”Female”]] %>

</p>

<p>

<strong>Subscribe:</strong>

<%= best_in_place @user, :subscribe, as: :checkbox, collection: {false: “No”, true: “Yes”} %>

</p>

    1. app/assets/stylesheets/users.scss
.purr{
	position: fixed;
	top: 30px;
	right: 100px;
	width: 250px;
	padding: 20px;
	background-color: #FCC;
	border: solid 2px #C66;
	&:first-letter { text-transform: uppercase; }
}

Following are the snapshots of various scenarios:

  1. initial page:

  1. Editing in place Name Field:

  1. Address TextField as in place textfield with Save and Cancel Button.

  1. Gender field as in place Select Dropdown

  1. Server side errors using in best_in_place. In example it triggered when email is duplicate.

The details about this gem is given on :

https://github.com/bernat/best_in_place

Django

16 Apr 2018

What is Django?

Django not only used for making websites, rather than it is used for creating web applications. Django can be used to create dynamic high-security web applications.

Django is an open source web application framework, written in Python. A web framework that is a set of components that helps to develop websites faster and easier.

For authentication, one of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface.

Django Design Principles:

  • Less Coding: Less code so in turn a quick development.
  • Don’t Repeat Yourself (DRY): everything should be developed only in exactly one place instead of repeating it again and again.
  • Fast Development: Django’s philosophy is to do all it can to facilitate hyper-fast development.
  • Clean Design: Django strictly maintains a clean design principle. throughout its own code and makes it easy to follow best web-development practices.
  • Loosely Coupled: Django aims to make each element of its stack independent of the others.

How to start Django Project:

Step 1: django-admin startproject mysite

Step 2: python manage.py startapp webapp

Step 3: To create the first view,

Open the file webapp/views.py

We import the class HttpResponse from the django.http module to render to the specific html pages.

The view returns an HttpResponse object that contains the generated response. Each view function is responsible for returning an HttpResponse object.

Step 4: In the next step to specify the root, URLconf at the webapp/urls.py path,

we need to write:

We have specified the paths for admin, index and home.

Step 5: To run the app, we have to write:

$ Python manage.py runserver

Step 6: For migration, to create the tables in the database, we need to write the command:

$ Python manage.py migrate

Step 7: To create the models we will write:

here we have created models for Question, Choice and Board.

Finally the output is:

Action Mailer is the Rails component that enables applications to send and receive emails. In Rails, emails are used by creating mailers that inherit from “ActionMailer::Base” in app/mailers. Those mailers have associated views that appear alongside controller views in app/views.

Now we will build a rails application which will send an email to the user when a new user is created. Let’s create a new rails application.

$ rails new sample_app
$ cd sample_app
$ rails generate scaffold user first_name:string last_name:string   phone_number:string email:string
$ rake db:migrate

Action Mailer- Configuration:

Following are the steps you have to follow to complete your configuration before proceeding with the actual work.

We will just add following lines of code in  config/environments/development.rb

config.action_mailer.delivery_method = :smtp

#It tells ActionMailer that you want to use the SMTP server.

Generate a Mailer :

We now have a basic application, let’s make use of ActionMailer. The mailer generator is similar to any other generator in rails.

$ rails g mailer example_mailer

#This will create a example_mailer.rb in the app\mailer directory.

Now we open up app/mailers/example_mailer.rb and add a mailer action that sends users a signup email.

app/mailers/example_mailer.rb

Now let’s write the mail we want to send to our users, and this can be done in app/views/example_mailer. Create a file sample_email.html.erb which is an email formatted in HTML.

app/views/example_mailer/sample_email.html.erb

We also need to create the text part for this email as not all clients prefer HTML emails. Create sample_email.text.erb in the app/views/example_mailer directory.

app/views/example_mailer/sample_email.text.erb

Now in the controller for the user model app/controllers/users_controller.rb, add a call to ExampleMailer.send_signup_email when a user is saved.

app/controllers/users_controller.rb

That’s it! When a new user object is saved, an email will be sent to the user via SendGrid.

Using JWT in Rails

03 Apr 2018

JWT is a Json Web Token, it is a standard and has been implemented in almost all popular programming languages. Hence, they can be easily used or exchanged in systems implemented in diverse platforms.

JWT has libraries for almost all platforms and Ruby is no exception.

Now we will see how JWT is used in Rails:

We will create a simple Rails application which uses the excellent Devise gem for authentication and the jwt gem for creating and verifying JWT tokens.

Let’s create a sample Rails application:

rails new rails_on_jwt

Once the application is generated, create a Home controller which we will use to check our authentication.

Create  home_controller.rb in the app/controllers

classHomeController ApplicationController
	def index
	end
end

Write the route for  HomeController to /home in config/routes.rb:

Rails.application.routes.draw do
get 'home' => 'home#index'
end

Now, add Devise to our application. First, we will add the Devise and jwt gems in our Gemfile.

gem 'devise'
gem 'jwt'

Then run a command “bundle install” on terminal.

Now let’s create the Devise configuration files:

For that we have will have to create the Devise User model and migrate the database:

rails g devise User
rakedb:migrate

Created User Model use for authentication.now  It’s time to integrate jwt into our application. First, we will create a class named JsonWebToken in lib/json_web_token.rb.This class will encapsulate the JWT token encoding and decoding logic.

classJsonWebToken
defself.encode(payload)
JWT.encode(payload, Rails.application.secrets.secret_key_base)
end

defself.decode(token)
returnHashWithIndifferentAccess.new(JWT.decode(token, Rails.application.secrets.secret_key_base)[0])
rescue
nil
end
end

We have to create an initializer for including the JsonWebToken class in config/initializers/jwt.rb.

require 'json_web_token'

We have to add some helper method in ApplicationController class which we will use in AuthenticationController class:

In app/controllers/application_controller.rb:

classApplicationController
<ActionController::Base
attr_reader :current_user

protected
defauthenticate_request!
unlessuser_id_in_token?
renderjson: { errors: ['Not Authenticated'] }, status: :unauthorized
return
end
    @current_user = User.find(auth_token[:user_id])
rescue JWT::VerificationError, JWT::DecodeError
renderjson: { errors: ['Not Authenticated'] }, status: :unauthorized
end

private
defhttp_token
      @http_token ||= if request.headers['Authorization'].present?
request.headers['Authorization'].split(' ').last
end
end

defauth_token
    @auth_token ||= JsonWebToken.decode(http_token)
end

defuser_id_in_token?
http_token&&auth_token&&auth_token[:user_id].to_i
end
end 

We have added a few helper methods like authenticate_request!which will act as a before_filter to check user credentials and we have created AuthenticationController to handle all authentication requests to the API. In app/controllers/authentication_controller.rb:

classAuthenticationController<ApplicationController
defauthenticate_user
user = User.find_for_database_authentication(email: params[:email])
ifuser.valid_password?(params[:password])
renderjson: payload(user)
else
renderjson: {errors: ['Invalid Username/Password']}, status: :unauthorized
end
end
private
def payload(user)
return nil unless user and user.id
    {
auth_token: JsonWebToken.encode({user_id: user.id}),
user: {id: user.id, email: user.email}
    }
end
end

Here we have added AuthenticationController to implement the authentication endpoint. It uses Devise to authenticate the user and issue a JWT if the credentials are valid.

Now we have to update our routes.rb to add the authentication endpoint.

Rails.application.routes.draw do
post 'auth_user' => 'authentication#authenticate_user'
get 'home' => 'home#index'
end

Also, we have to modify the HomeController to secure it using a before_filter and add a meaningful response in case of successful authentication:

classHomeController<ApplicationController
before_filter :authenticate_request!
def index
renderjson: {'logged_in' => true}
	end
end

Now, create a sample user to test the authentication by using rails console or by Using Seed command:Start the server and check out how JWT authentication works:

rails s
Introduction:

Sometimes the rails application requires sending the bulk mails using action mailers on the single attempt. The user can be able to send them seamlessly. But, this task is not possible in synchronous way. This will affect whole application performance and will take a lot of time to load the respective pages.

To overcome this problem rails community have enormous kinds of solutions. Among them  sidekiq is the best choice to overcome this kind of problems.

The sidekiq is a full-featured background processing framework for Ruby. It aims to be simple to integrate with any modern Rails application and much higher performance than other existing solutions.

The Redisis an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperlog logs and geospatial indexes with radius queries.

The Action Mailer is a service provided by rails to send the mails on respective emails ids. To send an email we must have to invoke deliver method of actionmailer.

To send mails asynchronously we have to use the sidekiq.

Integration Setup:

Add sidekiq into your rails application by including it into your Gemfile and run the bundle command.

#Gemfile

gem ‘sidekiq’

To run sidekiq, run the following command:

$ bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml(default development mode)

$ bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e production (production mode)

Sending Delayed Emails:

                Sidekiq provides asynchronous emails sending provision with Action Mailer. That will be performed by adding below three methods to the ActionMailer module.

.dealy

The .delay method will call the action mailer method and add this mail into to DelayedMailer queue for processing.

                                For ex.,   NewsMailer.delay.newsmailer(@email)

.delay_for(interval)

Here, user can be proviode inerval time before sending emails asynchronously.

                                For ex.,   NewsMailer.delay_for(1.day).newsmailer(@email)

.delay_until(timestamp)

Here, user can set the timestamp for sidekiq. Sidekiq will wait until the provided time to send the email.

For ex.,   NewsMailer.delay_until(3.day.from_now).newsmailer(@email)

Sending Bulk delayed Emails:

The below example illustrated the way to send bulk emails.

ApplicationMailer.delay.new_article_mail(@article)

Here., ApplicationMailer is a class have new_article_mail(article) method. We used .delay method to                           set the delay for sending mail asynchronously.

# Send an email to all the users if new project has been posted in website.

		def new_article_mail(article)
			@article = article
			all_users("New article added in GXP")
		end
	
		private
		def all_users(subject)
		     User.all.map{ |user|
		       @user = user
		       send_mail(user.email, subject).deliver
		     }
		end

		def send_mail(email, subject)
		    mail to: email, subject: subject
		end

Here, new_article_mail method has one more method all_users in which we are calling send_mail method for sending an email to the individual user.

What is Data scraping?

Website/Data  Scraping is a technique to operating large amounts of data from websites whereby the data is extracted and displayed in own sites or it can be stored to a File/Database. Data scraping is basically used where the websites does not provides API.

Some Applications do not provide API to collect records. For the same , Data Scraping technique is used.

The data can be scraped using Nokogiri Gem.

The steps are required:

  • Add the gem “gem ‘nokogiri’, ‘~> 1.8’, ‘>= 1.8.1'”.
  • Then run the bundle install
  • Add the “require ‘nokogiri'”, “require ‘open-uri'” line where you will write the code for the scraping.

The controller of the page will look like below:

The view of the code of view page will look like :

The result in our application will look like:

Mechanize Gem in rails

The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, and can follow links and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history.

For the above site ,I have used Mechanize gem to scrap the data or search the record.

We are having the following Sample application running on the local

The steps required are:

  • Add the gem “gem ‘mechanize’, ‘~> 2.7’, ‘>= 2.7.5’“.
  • Then run the bundle install
  • Add require ‘mechanize’ in the controller.

The controller code to scrap the data using mechanize gem for search:

The output of the above scraping as would be seen on the console:

By using the mechanize gem we can select radio button as given below:

staff_data.page.forms[0].radiobutton_with(:id => “First_drop”).check

By using the mechanize gem we can see all input fields in the form.

staff_data.page.forms[0].fields

By using the mechanize gem we can also select the drop down value of the site.

staff_data.page.forms[0].field_with(:id => “country”).value = “Single”

By using the mechanize gem we can find the form content of the site.

form = staff_data.page.form_with(:id => “search_form”)

By using the mechanize gem we can find the button as given.

button = form.button_with(:value => “Search”)

In the Mechanize gem, link_with method is available to make it simpler to fetch the random record link .

link = staff_data.link_with(text: ‘Random article’)

In the mechanize gem the click method instructs mechanize to follow the link

page = link.click

By using the mechanize gem we can find the page title of the site.

staff_data.page.title
Devise is a flexible authentication solution for Rails. It is a complete MVC solution based on Rails engines. It allows you to have multiple models signed in at the same time. It hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
STEP 1. gem ‘devise’ install.
STEP 2. run bundle install
STEP 3. run rails generate devise:install
STEP 4. run rails generate devise:views
STEP 5. Here in this application we mainly need 2 models, one is member model and the other one is contact model. So now we are going to create our member model using devise:run rails generate devise member

The migration file will located in db/migrate/ devise_create_members.rb.

STEP 6. After that you should have to run rake db:create (For creating new database)

STEP 7. run rake db:migrate

Once you run the db:migrate command, rails will create a table called members with the following field that the Devise specified in the migration file. Check the tables have created successfully.

STEP 8. run the server by typing “rails server” and copy and paste the 1 and 2 address to your browser search bar.

  1. http://0.0.0.0:3000/members/sign_up
  2. http://0.0.0.0:3000/members/sign_in

STEP 9. run rails generate migration add_username_to_members username:string

we have to add the username to the sign-up form. This command will generate another migration file in your “db/migrate” directory.

STEP 10. run rake db:migrate

STEP 11. run rails generate model contact

Edit the migration file of contact and specify the 2 fields as shown below. Open db/migrate/ 20180312073055_create_contacts.rb

STEP 12. run  rake db:migrate

STEP 13. run  rails generate controller home

And then create a new index file for home controller like “app/views/home/index.html.erb” and then add the following

STEP 14. Once you have done, Open app/config/routes.rb

add the line

root :to =>’home#index’

STEP 15. run rails generate controller registration

Open “app/controllers/registration_controller.rb” and then edit the file as shown below

STEP 16. We have to mention the relationships between 2 models (member,contact). Here the relationship will be as follows.

Open_Filepath : app/models/member.rb

Open_Filepath : app/models/contact.rb

STEP 17. Now refer the registration controller file in app/controllers/registration, here after completing the registration & the values that the member entered is stored in the table successfully, I just redirected the member to the dashboard page. So we have to add that page to our home controller.

Open_Filepath : app/views/home/dashboard.html.erb

STEP 18. Open app/config/routes.rb and you have to specify this path in our routes.rb file

STEP 19. run “rails s” and go to http://localhost:3000 address to your browser search bar

Introduction to DevOps…

DevOps is a combination of Development (Software Development) and Operations (Software Productions/IT Operations…)

What is DevOps?

DevOps is not a technology or tool, it is a concept of behavior, and it is an extension of Agile Methodology.

The DevOps is a set of practices designed to overcome the gap between development, QA and Operations by effective communication and collaboration, incorporating continuous integration process with automated deployment.

DevOps helps to increase an organization’s speed to deliver applications and services. It allows organizations to serve their customers better and compete more strongly in the market.

There are four basic continuous processes in DevOps:

  • Continuous Integration
  • Continuous Delivery
  • Continuous Testing
  • Continuous Monitoring

Relationship between Agile and DevOps

Agile Development is an umbrella term for several iterative and incremental software development methodologies.

The most popular agile methodologies include Extreme Programming (XP), Scrum, Crystal, Lean Development, and Feature-Driven Development (FDD).

On the other hand, DevOps is about a culture where development, and operations collaborate to give maximum throughput and high-end outcomes.

Similar to Agile, there are ways through which DevOps can be implemented such as deep communication and automated deployment.

Agile is all about software development while DevOps deals with software development and operations.

Note: Therefore one thing is clear that DevOps is an extension of Agile methodology.

DevOps Lifecycle

DevOps is deep integration between development and operations. Understanding DevOps is not possible without knowing DevOps life cycle.

Here is a brief information about the Continuous DevOps life-cycle:

  • Development
    In this DevOps stage the development of software takes place constantly. In this phase, the entire development process is separated into small development cycles. This benefits DevOps team to speed up software development and delivery process.
  • Testing
    QA team use tools like Selenium to identify and fix bugs in the new piece of code.
  • Integration
    In this stage, new functionality is integrated with the prevailing code, and testing takes place. Continuous development is only possible due to continuous integration and testing.
  • Deployment
    In this phase, the deployment process takes place continuously. It is performed in such a manner that any changes made any time in the code, should not affect the functioning of high traffic application.
  • Monitoring
    In this phase, operation team will take care of the inappropriate system behavior or bugs which are found in production.

Software Tools for DevOps

As DevOps is the collaboration of Development, QA and Operations, it is obvious that a single tool cannot be adequate for all the needs. So there are multiple tools required in each stage to perform all the operations successfully.

Popular Tool for DevOps Automation:

  • Git : Version Control System tool
  • Jenkins : Continuous Integration tool
  • Selenium : Continuous Testing tool
  • Puppet, Chef, Ansible : Configuration Management and Deployment tools
  • Nagios : Continuous Monitoring tool
  • Docker : Containerization tool

How do all these tools work together?

 

This flow may vary from organization to organization as per the requirement.

  • Developers develop the code and this source code is managed by Version Control System tools like Git etc.
  • Developers send this code to the Git repository and any changes made in the code is committed to this Repository.
  • Jenkins pulls this code from the repository using the Git plugin and build it using tools like Ant or Maven.
  • Configuration management tools like puppet deploys & provisions testing environment and then Jenkins releases this code on the test environment on which testing is done using tools like selenium.
  • Once the code is tested, Jenkins send it for deployment on the production server (even production server is provisioned & maintained by tools like puppet).
  • After deployment It is continuously monitored by tools like Nagios.
  • Docker containers provides testing environment to test the build features

Let’s start with an example that you have two different tables called InternalEmail and ExternalEmail.

internal_emails

Id (integer) sender_id (integer) content (text) Subject (character varying) recipient_email (character varying) Status (character varying) created_at (timestamp without time zone) updated_at (timestamp without time zone)
1 52 internal_content_1 internal_subject_1 44 accepted 2016-10-21 00:49:24.991002 2016-10-21 00:49:24.991002
2 46 internal_content_2 internal_subject_2 43 rejected 2017-10-21 00:49:24.991002 2017-10-21 00:49:24.991002

 

 external_emails
Id (integer) sender_id (integer) content (text) Subject (character varying) receiver_id (integer) opened (boolean) created_at (timestamp without time zone) updated_at (timestamp without time zone)
1 44 external_content_1 external_subject_1 42 true 2014-10-21 00:49:24.991002 2014-10-21 00:49:24.991002
2 42 external_content_2 external_subject_2 41 false 2015-10-21 00:49:24.991002 2015-10-21 00:49:24.991002
3 32 external_content_3 external_subject_3 40 true 2016-10-21 00:49:24.991002 2016-10-21 00:49:24.991002

If you want to combine these two tables to get result set as given below

internal_external_emails
Id (integer) type (character varying) sender_id (integer) content (text) subject (character varying) receiver_id (integer) recipient_email (character varying) opened (boolean) status (character varying) created_at (timestamp without time zone) updated_at (timestamp without time zone)
1 external 44 external_content_1 external_subject_1 42   true   2014-10-21 00:49:24.991002 2014-10-21 00:49:24.991002
2 external 42 external_content_2 external_subject_2 41   false   2015-10-21 00:49:24.991002 2015-10-21 00:49:24.991002
3 external 32 external_content_3 external_subject_3 40   true   2016-10-21 00:49:24.991002 2016-10-21 00:49:24.991002
1 internal 52 internal_content_1 internal_subject_1   abc@gmail.com   accepted 2016-10-21 00:49:24.991002 2016-10-21 00:49:24.991002
2 internal 46 internal_content_2 internal_subject_2   internal@gmail.com   rejected 2017-10-21 00:49:24.991002 2017-10-21 00:49:24.991002

you can use SQL UNION. Unlike JOIN query, UNION combines data from two tables into new rows that means each row of result set will be from Table A or from Table B. Then store this UNION query as SQL view in database to be able to use it as database table and query on it as and when required to display data on UI. To create view of UNION query, add migration in rails.

$rails generate migration CreateInternalExternalEmailView

Generated migration file should look like this

20180220065644_create_internal_external_email_view.rb
class CreateLightboxTeamLightboxView < ActiveRecord::Migration
def up
execute <<-SQL
CREATE VIEW internal_external_emails AS
SELECT id, 'external' AS type, sender_id, content, subject, receiver_id, NULL AS  recipient_email, opened, NULL AS status, created_at, updated_at
	FROM external_emails
	UNION ALL
SELECT id, 'internal' AS type, sender_id, content, subject, NULL AS receiver_id,       recipient_email, NULL AS opened, status, created_at, updated_at
FROM internal_emails
SQL
end

def down
execute "DROP VIEW internal_external_emails"
end
end

In above migration file, I have used NULL AS for some columns because there is rule of UNION query that it must contain same number of columns with same datatype.

Above migration will create SQL view internal_external_emails in database.

You can generate model InternalExternalEmail to mention necessary associations in it.

internal_external_email.rb model will look like this

class InternalExternalEmail < ActiveRecord::Base
self.primary_key = 'id'
belongs_to :sender, class_name: :User
belongs_to :receiver, class_name: :User
end

Blockchain was the idea originally developed by a group of people known by the pseudonym, Satoshi Nakamoto. But since then, it has evolved into something greater, and the main question every single person is asking is: What is Blockchain?

By allowing digital information to be distributed but not copied, blockchain technology created the backbone of a new type of internet. It was originally designed for the digital currency named Bitcoin. Of course you have heard the term Bitcoin, Bitcoin is one of the most popular cryptocurrencies there are. That much popular Bitcoin has become and the main reason behind the tremendous success of bitcoin is Blockchain.

Do you know how to use the internet? Of course you do but you don’t know how it works, do you? Because you don’t need to know how the Internet works, just to use it.

Everyone who has invested in bitcoin is unknowingly using Blockchain. Just like the Internet, you don’t need to know how blockchain works to use it. However, having a basic knowledge of this new technology show why it’s considered revolutionary.

The basic idea behind this complex but useful technology is surprisingly very easy. Blockchain technology is a form of distributed ledger technology that changed the concept of money, with the advent of bitcoin over the past decade. Blockchain offers a database, spread over a network of computers around the world where all data is stored in an immutable and tamper-proof manner without the need of an intermediary party to ensure the trustworthiness of the data. This feature of the blockchain technology enabled bitcoin to be used as a peer medium of exchange as a replacement for conventional money without the need of middlemen such as banks, credit card companies, governments, etc.

This adoption of blockchain technology has today led to the rise of several cryptocurrencies like bitcoin to enter the mainstream economy as a replacement for conventional currencies for value transfer around the world.

“As revolutionary as it sounds, Blockchain truly is a mechanism to bring everyone to the highest degree of accountability. No more missed transactions, human or machine errors, or even an exchange that was not done with the consent of the parties involved. Above anything else, the most critical area where Blockchain helps is to guarantee the validity of a transaction by recording it not only on a main register but a connected distributed system of registers, all of which are connected through a secure validation mechanism.”

Ian Khan, TEDx Speaker | Author | Technology Futurist

A Distributed Database

Picture a spreadsheet that is duplicated thousands of times across a network of computers. Then imagine that this network is designed to regularly update this spreadsheet and you have a basic understanding of the blockchain.

Information held on a blockchain exists as a shared — and continually reconciled — database.

This way of using the network has obvious benefits. The blockchain database isn’t stored in any single location, meaning the records it keeps are truly public and easily verifiable.

No centralized version of this information exists for a hacker to corrupt. Hosted by millions of computers simultaneously, its data is accessible to anyone on the internet.

Blockchain has major advantages over centralized data-management systems.

  • Highly durable and Robust:

Blockchain technology is like the internet in that it has a built-in robustness. By storing blocks of information that are identical across its network, the blockchain cannot be controlled by any single entity and has no single point of failure.

  • Transparent and incorruptible:

The blockchain network lives in a state of consensus, one that automatically checks in with itself every ten minutes. A kind of self-auditing ecosystem, the network reconciles every transaction that happens in ten-minute intervals.

Data is embedded within the network as a whole, by definition it is public and in-turn the whole system is transparent.

No centralized version of this information exists for a hacker to corrupt. Hosted by millions of computers simultaneously, that is why the data cannot be corrupted.

To integrate the Instagram API in your website, you need you have to follow following process

  1. Log in to Instagram and open this page https://instagram.com/developer/clients/manage
  2. Click on the button «Register a New Client».
  3. Then Fill all the Mandatory fields, in Valid Redirect URIs specify your valid redirected URI and click «Register». Then click «Manage» button to obtain both Client ID and Client Secret of your just registered app.
  4. Use the Client ID and Client Secret to generate access token with this link https://rudrastyh.com/tools/access-token. You can find more info there as well.

A Short Introduction about sandbox mode

  • All newly created apps start in Sandbox Mode
  • Apps in Sandbox mode have access only to 20 latest media of an access token owner (and sandbox users invited to your app).
  • To avoid these restrictions you should send your app to approval.

We can get instagram feed in our website by two ways

  • By User ID
  • By a Username

How can we get Instagram feed in our website by Using User ID?

Following is the javascript code to get instagram feed into our website by using User ID

var token ='your access token',
userid=3679808080,
 num_photos =5;// how much photos do you want to get
 
$.ajax({
 url:'https://api.instagram.com/v1/users/'+userid+'/media/recent',// or /users/self/media/recent for Sandbox
 dataType:'jsonp',
 type:'GET',
 data:{access_token: token, count: num_photos},
 success:function(data){
 console.log(data);
 for( x indata.data){
 
 }
 },
 error:function(data){
 console.log(data);// send the error notifications to console
 }
});

 

How can we get Instagram feed in our website by Using Username?

Following is the JavaScript code to get instagram feed into our website by using Username.

var token ='your access token',
 username ='vksbomen',// vksbomen - my username :)
 num_photos =4;
 
$.ajax({// the first ajax request returns the ID of user vksbomen
 url:'https://api.instagram.com/v1/users/search',
 dataType:'jsonp',
 type:'GET',
 data:{access_token: token, q: username},// actually it is just the search by username
 success:function(data){
 console.log(data);
 $.ajax({
 url:'https://api.instagram.com/v1/users/'+data.data[0].id+'/media/recent',// specify the ID of the first found user
 dataType:'jsonp',
 type:'GET',
 data:{access_token: token, count: num_photos},
 success:function(data2){
 console.log(data2);
 for(x in data2.data){
 
 }
 },
 error:function(data2){
 console.log(data2);
 }
 });
 },
 error:function(data){
 console.log(data);
 }
});

How to generate access token?

Follow the below link to generate your access token

https://elfsight.com/blog/2016/05/how-to-get-instagram-access-token/

To divide large number of records into multiple parts, we use pagination. It allows user to display a part of records only. Loading all records in a single page may take time, so it is always recommended to created pagination. In will_paginate-bootstrap gem integrates the Bootstrap pagination component. The usage for this is extremely simple and it magically works. So let’s take a look at adding this.

STEP 1. gem install will_paginate-bootstrap

STEP 2. Open app/controller/posts_controller.rb and it adds necessary parameters in the resultant collection of record to display pagination links in front-end (.erb).

Parameters:

  • :page- This is parameter sent in Query String. Based on this, which records are to be fetched is decided. i.e. Offset is decided
  • :per_page- This is Number of results that you want to fetch per page i.e. From offset (.erb)
  • limit – per page limit for the paginated result data
  • offset – current paginated data set -> to show current page

 

STEP 3. Open app/views/posts/index.html.erb for adding pagination links and also add bootstrap CDN links.

It will add pagination links like,  <-  Older 1 2 Newer->  on front-end.

STEP 4.  A collection of extensions for the database layer that enable paginated queries, and view helpers for popular frameworks that render pagination links. With proper combination of view helpers and CSS styling.

Number of Pages here 1, 2 is decided based on total numbers of records that you have in your database, the final result can look like this:

PAGE NO 1. (Paginated result data)

PAGE NO 2. (Paginated result data)

Artists or Bands create songs. These songs are recorded in the digital format like mp3, wav, aac etc. Every artist would like to promote their songs and make money out of it. This is possible by uploading the songs to different digital platforms like itunes, amazon, spotify. Listeners goto these websites to buy, download and listen to the songs. Each website send a revenue sheet with the amount that is collected by the digital platforms which are also called as DSP (Digital Service Provider). This is how an artist monetize the digital content created by him/her.

Digital Music Distribution

Know details of what music distribution is & how it works.

The process of uploading a song on a DSP is different for each DSP. Also keeping a track of revenue from each DSP is also time taking. Artists are more creative and do not like to spend a lot of time with the DSP in managing their contents. This creates a need of Music Distribution System.

Music Distribution System is one stop solution for uploading digital contents (songs) and managing the revenues. It has all the DSPs integrated in the system. The user can create an account on the application and upload the songs to be distributed. User can select the list of DSPs where the song is to be distributed and rest all is taken care by the application.

It uploads the songs and process the revenues at the end of the month. There are reports created that gives an insight on the performance of the songs on different DSPs.

Along with artists, labels can create an account and manage all their artists. They can also create a contract with the artist on the revenue sharing.  There are individual artist reports created along with cumulative label reports.

This all comes with a small fee and helps artist and labels in monetizing their digital contents which are their songs and albums.

How can my application share it's resources with another client? This is where the CORS, or Cross Origin Resource protocol comes in. CORS introduces a standard mechanism that can be used by all browsers for implementing cross-domain requests. The spec defines a set of headers that allow the browser and server to communicate about which requests are (and are not) allowed. CORS continues the spirit of the open web by bringing API access to all.

What is a cross-site request?

Cross-site HTTP requests are HTTP requests for resources from a different domain than the domain of the resource making the request. Such requests are subject to security-based restrictions. To handle this restrictions, and get around them in a secure manner, W3C developed CORS.

What is CORS?

The Cross-Origin Resource Sharing (CORS) mechanism provides a way for a server to support cross-site requests and enable the secure transfer of data across different domains/sites.

How can our Rails API utilize CORS?

When the API is not configured to respond to requests you will likely get the error “No ‘Access-Control-Allow-Origin’ header is present on the requested resource”. In other words, you won’t be able to call the API directly. So if you have your frontend and backend on different domains you’ll need to allow CORS (cross-origin HTTP request) with the rack-cors gem. This gem provides Rack CORS Middleware to our Rails app, allowing it to support cross-origin resource sharing.

Setting up Rack-CORS:

A few easy steps and we'll be ready to go!
    1. Add the following to your Gemfile and bundle install:
      gem 'rack-cors', :require=>'rack/cors’
    2. Then run bundle install
    3. Add your API module to config/application.rb and configure your Rack-CORS Middleware:
      classApplication <Rails::Application
      
          # Rails 5
      
          config.middleware.insert_before 0, Rack::Corsdo
      
            allow do
      
              origins '*'
      
              resource '*', :headers=>:any, :methods=>[:get, :post, :options]
      
            end
      
          end
      
      
      
          # Rails 3/4
      
          config.middleware.insert_before 0, "Rack::Cors"do
      
            allow do
      
              origins '*'
      
              resource '*', :headers=>:any, :methods=>[:get, :post, :options]
      
            end
      
          end
      
      end
      
      
    4. With origins "*", we specify that our API will accept HTTP requests from any domain in the whole wide internet.
    5. With resource "*", we specify that a cross-origin request can access any of our resources.
    We then specify that a cross-origin request using any HTTP method will be accepted–although, if you recall, we defined our Graduates class inside our API module to respond to only requests for all grads or just one grad.

CKEditor is text editor basically used for transforming simple text field to dynamic word featured field that helps user to simplify web content creation. In this blog, we will learn how to use CKEditor gem and how to customize it in our Ruby on Rails Application.

Ckeditor Rails Gem

How to use it & customize in Rails application!

Follow some simple steps :

  1. Add 'ckeditor' gem to “Gemfile.rb” and run $ bundle command:
  2. gem 'ckeditor'
  3. Include following in your app's “config/initializers/assets.rb” file:
  4. Rails.application.config.assets.precompile += %w( ckeditor/*)
  5. Following, Include ckeditor javascripts in your “app/assets/javascripts/application.js” file:
    //= require ckeditor/init
  6. Then change simple text_area field to cktext_area in view file as follows:
    <%= f.cktext_area :template_text, placeholder: "Email Body Text" %>
  7. These will transform text field to Ckeditor. The basic Ckeditor will look like image as given below.
    VKeditor by cryptex technologies
  8. To customize CKEditor create “config.js” file in “app/assets/javascripts/ckeditor/” folder and add following code in it:
  9. CKEDITOR.editorConfig = function (config) {
    
    config.toolbar_mini = [
    
    ["Bold",  "Italic",  "Underline",  "Strike",  "-"],
    
    ['BulletedList','NumberedList' ],['Outdent','Indent'],
    
    ];
    
    config.toolbar = "mini";
    
    config.toolbarLocation = 'bottom';
    
    config.height = 280;
    
    config.width = 620;
    
    config.removePlugins = 'elementspath';config.removePlugins = 'elementspath';
    
    }
  1. The customized CKEditor will look like image as given below:

In many applications we need to provide the ability to like/dislike, upvote/downvote kind of functionalities and in order to implement this there is an awesome gem available in Ruby on Rails called “Acts as Votable” gem.These are the simple steps to follow:

Step 1: Create a sample App using scaffold.
Step 2: Add “acts_as_votable” gem to the Gemfile and install it by running bundle install command.
Step 3: This Gem uses vote table to save all voting information. To generate vote migration/ table, run below commands:
rails g acts_as_votable:migration
rake db:migrate
Step 4: For example I have a model called Movie, so I have added acts_as_votabe helper to it. But you can add the following to whatever model in your application which you want to make votable. In app/models/movie.rb, I have :

Also I need another model called User, who is going to vote. So in the app/models/user.rb, I have:

Step 5: For setting up the views to interact with the new functionality of voting I’ll need to add some routes. In app/config/routes.rb, I’ll need to add another block to my movies section.

Step 6: This block invokes the upvote and downvote methods in the movies controller, but those methods don't exist yet. So I’ll define those methods in the app/controllers/movies_controller.rb

Step 7: Finally I will create links in our views to like and dislike i.e. to implement the voting functionality in the browser.

This will create some basic links as like and dislike that, when clicked on, will update with the amount of respective upvotes or downvotes for each movie.

How blockchain works

Blockchain is a distributed database, which consists of two records:

  1. Individual transactions
  2. Blocks

Individual transactions consist of “Header” and “Data” which is related to transactions. Transactions take place for a given period of time. Block is used to create alphanumeric string called as “Hash”.When the first record is created, the next block takes previous block’s Hash for creation of their own Hash. This is authenticated or validated. At this point of the Blockchain process, a majority of nodes in the network must agree the new block’s hash is correctly calculated and ensures that all copies of the distributed ledger share the same state. Once block added, cannot be changed. If we try to change or swap that block, the hashes for previous and subsequent blocks will also change. The other computers in the network will also understand that problem and they will never add new block, until the problem is resolved. When the problem is solved they will start to add the block. If a problem is found in the block it will be not accepted and the process repeats.

Integration on Blockchain API with Rails:

To integrate blockchain api to exchange bitcoin from one wallet to another wallet.

API KEY:

To get the API key we have to first signup on the link https://api.blockchain.info/customer/signup

then we will get the API key, for e.g. :

api_code: XXXXXXXX-XXX-XXXX-XXXX-XXXXXXXXXXXX

Create API:

First need to create a wallet:

I have created the wallet in the method:

http://localhost:3030/api/v2/create_wallet

Description: This api is use to create blockchain wallet

# create_wallet: http://XXX.XXX.X.XX:3030/api/v2/create_wallet

# create_wallet: https://blockchain.info/api/v2/create_wallet

Write the API method to check the wallet balance.

            wallet_address: “Address of the wallet”

            Confirmation: “Password”

address_balance: https://blockchain.info/q/addressbalance/%{wallet_address}?confirmations=%{confirmation}

Write API to send or receive bitcoin using guid.

	Guid: Uniq id of the user
	main_password: blockchain password
	second_password: blockchain second password
	to: Receiving address
	from: Sending address

make_payment_by_guid: http://localhost:3030/merchant/%{guid}/payment?password=%{main_password}&second_password=%{second_password}&to=%{address}&amount=%{amount}&from=%{from}

current_rate: https://blockchain.info/ticker

Description: “this api will use for getting bitcoin value as per the local currency.”

for ex., 1btc = ? (USD)

The following method is used to call the bitcoin exchange API using guid

# def self.transaction_by_guid(receiver_address, amount_in_btc, guid, main_pass, second_pass)

def self.receive_btc_by_guid(guid, sender_main_password, sender_second_password, to_wallet_address, amt_in_btc, from_wallet_address)

# convert btc to satoshi and add transaction fee

amount = (btc_to_satoshi(amt_in_btc))

# Prepare params

request_url = Bitcoinexchange::Application.blockchain[“api”][“make_payment_by_guid”] % {guid: guid || ”, main_password: sender_main_password || ”, second_password: sender_second_password || ”, address: to_wallet_address, amount: amount, from: from_wallet_address}

# If in response failure occurred using third party API or http client it generate error and return nil into the response

response =  begin

RestClient.get(request_url, {“Content-Type”: “application/x-www-form-urlencoded”})

rescue RestClient::ExceptionWithResponse => e

e.response

end

# If response is success(code == 200)

response_body = JSON.parse(response.body)

if response.code == 200

response_body

elsif response_body[“error”]!=””

response_body[“error”]

# it gives the the converted value in BTC

# response_body = “#{response_b[“message”]}” +” to “+”#{response_b[“to”]}”+”successfully.”

else

# To raise the error if error occured in executing blockchain api

raise Exceptions::TransactionError::ParamsError, response.body

end

end

What is filterrific?

'filterrific' gem is used for filtering the data only. It is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.

Ruby On Rails Gem Filterrific

Features of filterrific gem:

    • It Integrates with pagination
    • Filters can be reset to default settings
    • Makes heavy use of ActiveRecord Scopes
    • API option to use Filterrific with Rails API mode. Just use gem 'filterrific', require: 'filterrific_api' in your Gemfile
    • ActionController helpers to shuttle filter params from ActionView forms to ActiveRecord based models, and to return matching records back from ActiveRecord to ActionView
    • It depends on ActiveRecord scopes for building DB queries
    • Can be used for HTML/JS/JSON/XML response formats
    • It is used to run filter settings from a filter UI to the controller and ActiveRecord
    • It persists filter settings in the HTTP session or DB for saved searches

Dependencies:

  • Rails - 3.x and above
  • ActiveRecord 4 and above
  • jQuery and Asset pipeline for form observers and spinner

What I need to do?

  • Need to define ActiveRecord Scopes
  • Need to build and style filter form and record lists

How to use it?

Let us assume that we want to show the lists of ‘Students’ that can be filtered by application’s users. Step 1:
  • #Gem File
  • gem ‘filterrific’
Step 2: Add Filterrific to ‘student’ model:
filterrific(
 default_filter_params: { sorted_by: 'created_at_desc' },
 available_filters: [
 :sorted_by,
 :search_query,
 :with_country_id,
 ]
 )
 # define ActiveRecord scopes for
 # :search_query, :sorted_by, :with_country_id
Step 3: Use Filterrific in index method of StudentsController:
def index
 @filterrific = initialize_filterrific(
 Student,
 params[:filterrific]
 ) or return
 @students = @filterrific.find.page(params[:page])

respond_to do |format|
 format.html
 format.js
 end
 end
Step 4: Here's the lists of students' data is showing in the view. Lastly, the Filterrific ActionView API is used to create the views:
  • Basically it shows the list of matching records and the form to update filter settings via AJAX form submission
  • Also used to reset the filter settings

FFmpeg is an extremely powerful and versatile command line tool for converting any multimedia files. It is free and available for Windows, Mac and Linux machines. Whether you want to join two video files, extract the audio component from a video file, convert your video into an animated GIF, FFmpeg can do it all and even more.

FFmpeg command synopsis

ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url} ...

Some Basic and Useful Commands

  • Cut video file into a smaller clip

ffmpeg -i videoplayback.mp4 -ss 00:00:50 -codec copy -t 20 output.mp4

  • Convert video from one format to another

ffmpeg -i videoplayback.mp4 -c:v libx264 filename.wav

  • Mute a video (Remove the audio component)

ffmpeg -i videoplayback.mp4 -an mute-video.mp4

  • Convert Video into Images

ffmpeg -i videoplayback.mp4 -r 0.25 frames_%1d.png

  • Convert a video into animated GIF

ffmpeg -i videoplayback.mp4 -vf scale=500:400 -r 5 -t 00:00:30 image.gif

  • Add subtitles to a movie

ffmpeg -i videoplayback.mp4 -i subtitles.srt -c copy -c:v libx264 -crf 23 output.mkv

Steps to use FFmpeg commands in Ruby on Rails application:

  • FFmpeg must be installed in the system
  • Create .yml file in application to specify ffmpeg path as environment variable, you will get to know the ffmpeg path using command which ffmpeg in your system
  • You will have to specify ffmpeg command in rails application as system command Example is given below:

Syntax:- system("#{ENV['FFMPEG']} -i input.mp4 output.avi”)

Introduction:

Spree Commerce is a complete, scalable, API-driven open source Ecommerce framework. It is built with Ruby on Rails, empowering forward thinking developers for years. In 2018 Spree is a matured and market proven technology.

Spree is well suited to serve as a custom technology platform for any type of an Ecommerce application: an online shop, a multi vendor marketplace, a rich-content driven commerce project, a social commerce website or a backend engine for an Ecommerce mobile or tablet app (iOS, Android).

Spree allows you to design and develop a unique, beautiful front-end UX. On the backend it combines API driven omni-channel support with multiple stock location capability, enabling business scalability and flexibility.

Spree allows for rapid development and short time to market because its lean core functionality may be easily customized with a collection of official extensions, as well as hundreds of unofficial ones. By applying these extensions you may customize Spree to your specific use case, industry or a business model.

Integrating Spree using ruby on rails

    1. Prerequisites

Before integrating spree in our ruby on rails application we will require the following prerequisites.

      • Ubuntu OS(14.04 or higher)
      • Sublime text/ VScode(Editor)
      • Ruby 2.3.0 or higher
      • Rails 4.2 or higher
      • Database(MySql/Sqlite/psql)
      • Heroku setup(optional)
    1. Installation guide

The following steps will guide us how to integrate spree in our rails application.

  • Create ruby on rails application
  • For ex., rails new SpreeDemo -d
    here,
    database: Name of the database(mysql, psql etc)
  • Add the specific required gem in the gemfile.
    Rails 5.1
    gem 'spree', '~> 3.4.4'
    gem 'spree_auth_devise', '~> 3.3'
    gem 'spree_gateway', '~> 3.3'
    Rails 5.0
    gem 'spree', '~> 3.2.7'
    gem 'spree_auth_devise', '~> 3.3'
    gem 'spree_gateway', '~> 3.3'
    Rails 4.2
    gem 'spree', '~> 3.1.12'
    gem 'spree_auth_devise', '~> 3.3'
    gem 'spree_gateway', '~> 3.3'
    • Run the following rake commands and generator commands.
      1. bundle install
      2. Use the install generators to set up Spree:
    rails g spree:install --user_class=Spree::User
    rails g spree:auth:install
    rails g spree_gateway:install
        • Rake setup
    bundle exec rake railties:install:migrations
    bundle exec rake db:migrate
    bundle exec rake db:seed
    bundle exec rake spree_sample:load
    1. Customization
  • To meet the business requirement we have to override/ extend the classes and views.
  • Standard practice for including such changes in your application or extension is to create a file within the relevant app/models/spree or app/controllers/spree directory with the original class name with _decorator
  • Adding a custom method to the Product model:
    app/models/spree/product_decorator.rb
    Spree::Product.class_eval do
    def some_method

    end
    end
    • Adding a custom action to the ProductsController:
      app/controllers/spree/products_controller_decorator.rb
      Spree::ProductsController.class_eval do
      def some_action
      ...
      end
      end
    • You can export all views from spree frontend into your application using rails generate spree:frontend:copy_viewsThis is the recommended way of customizing views in Spree.
    1. Websites built in Spree
      • urbanladder.com
      • huckberry.com
      • meundies.com
      • primeriti.es
      • garmentory.com
      • kliper.cl
      • bestmadeco.com
      • qisahn.com
      • bionic.com.cy
      • championnet.ru
    2. Market Statistics
      This is the APR-2017 market statistics. This market statistics shows the difference between shopify and spree commerce. The difference is due to its use and handling. The shopify eCommerce store can be created and published by anyone. But, spree commerce have to be integrated and published manually by application programmers(web developers). spree-commerce
    3. Advantages
      • Easily customizable construction allowing users to create the ideal store for their business.
      • Light, fast, and flexible with a powerful backend admin module.
      • Comprehensive support package plus Ruby on Rails community offers solid and reliable support.
      • Spree officially maintains many extensions to provide additional functionality that isn’t available out of the box.
      • Fast and easy integrations with third-party solutions
    4. Disadvantages
      • Coding skills or technical assistance are needed.
      • Currently, only a handful of themes is available.
      • In some cases, some “common” functionality may require custom development.
        Support
        This platform doesn’t provide any support in a traditional sense, but still, you can find a forum and tons of useful documentation on the web. Plus, there’s a Ruby on Rails community which maintains Spree, making it stable, multi-functional and free.
    5. Screenshots

      Admin Page:

      admin-page
      Front End:
      Home-page
    6. Reference

    What is Docker?

    Docker is the world's leading software container platform. Docker is a tool designed to make it easier to deploy and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package.

    Where does Docker operate?

    1. Design
    2. Development
    3. Deployment
    4. Testing/Release

    Docker makes the process of application deployment very easy and efficient and resolves a lot of issues related to deploying applications.

    • Build application only once:

    An application inside a container can run on any system that has Docker installed. So there is no need to build and configure application multiple times on different platform.

    • More Sleep and Less Worry

    With Docker you test your application inside a container and ship it inside a container. This means the environment in which you test is identical to the one on which the application will run in production.

    • Portability

    Docker containers can run on any platform. It can run on your local system, Amazon ec2, Google Cloud platform, Rackspace server, Virtual box... etc.

    • Version Control

    Like Git, Docker has in-built version control system.

    Docker container work just like GIT repositories, allowing you to commit changes to your Docker images and version control them.

    • Isolation

    With Docker, every application works in isolation in its own container and does not interferes with other applications running on the same system. So multiple containers can run on same system without interferes. For removal also you can simply delete the container and it will not leave behind any files or traces on the system.

    • Productivity

    Docker allows faster and more efficient deployments without worrying about running your application on different platform.

    How to Install Docker in Linux?

    1. Connect to Linux Connect with AWS or other
    2. Install Docker sudo yum -y update sudo yum install -y docker
    3. Start Docket sudo service docker start sudo usermod -a -G docker ec2-user(This is optional)
    4. Stop Docker sudo service docker stop

    For more information-> go to http://get.docker.com

    Many beginners want to deploy their simple application on production environment, but they do not get any free cloud service. So what they can do? Well, there is a solution provided by Heroku. Heroku is a cloud platform as a service supporting several programming languages that is used as a web application deployment model.

    Before starting deployment, we need four things Git version control, SSH key, Bit-bucket remote repository and Heroku account. If you don't have any one of these, don't worry.

    So, let’s get started!

    Step 1. Install Git version control system.

    • To install git on your system, go ahead and download latest version of Git, follow the instructions to install Git.
    • To verify the installation was successful, open terminal or command prompt and type git --version. It will look like this.
    $ git –version

    git version 2.9.2

    • If you have installed Git first time you need to create username and email using below commands.
                 $ git config --global user.name "Foo Bar"             
                 $ git config --global user.emailfoobar@example.com

    Congratulation! you have Git on your system. The next step is to create Ruby on Rails application.

    Step 2. Create Ruby on Rails application.

    • If you are new to Ruby on Rails, visit Rails Guides and create simple blog application.
    • In root directory of project run $ git init to initialize new repository. Add all the project files to repository using command $ git add -A.
    • To tell Git we want to keep the changes, we use the commit command.
                 $ git commit –m “Initialize repository”

    Step 3. Setup Bit-bucket remote repository.

    You also can use GitHub remote repository, but there is a problem, GitHub does not provide free private repositories while Bit-bucket does.

    • Sign up for a Bit-bucket account if you don’t already have one.
    • We need SSH key to use Bit-bucket, so how to get and install SSH key in Bit-bucket account.
    • Add your public key to Bit-bucket by clicking on the avatar image. Select “Bit-bucket settings” and then “SSH Keys”.
    • Once you’ve added your public key, click on ‘+’ sign to create a new repository, make sure “This is a private repository” checked and select "include a README" to No.
    • Now we are going to push our project to the Bit - bucket. The below commands first tell Git that you want to add Bit-bucket as the origin for your repository, and then push your repository up to the remote origin. To find the remote origin URL has gone to bit-bucket -> open repository created in previous steps -> scroll down and choose "I have an existing project".
                $ git remote add origin git@bitbucket.org:/
                $ git push -u origin –all

    Step 4. Deploy application to Heroku.

    Heroku uses the PostgreSQL as production database, which means that we need to add the 'pg gem' in the production environment to allow Rails to talk to PostgreSQL. Open Gem file and below group.

    group :production do
    gem 'pg', '0.20.0'
    end

    To prepare the project for deployment, we run bundle install with a special flag to prevent the local installation of any production gems.

    $ bundle install --without production

    Next, we have to create and configure a new Heroku account.

    • The first step is to sign up for Heroku. Then check to see if your system already has the Heroku command-line client installed. If you don't have Heroku installed. Install it using Heroku Toolbelt.
                $ heroku version
    • Once you’ve verified that the Heroku command-line interface is installed, use the Heroku command to log in and add your SSH key.
                $ heroku login
                $ herokukeys:add
    • Finally, use heroku create command to create a place on the Heroku servers for the app to live.
                 $ heroku create
    • To deploy the application use Git to push the master branch up to Heroku.

    To see your newly deployed application, visit the address that you saw when you run heroku create.

    After creating REST API, it’s important that API should be documented, so the others can use the documentation and understand the requirement and implementation of API.

    Swagger documentation provides the interface to REST APIs which allows people and system to understand the API without access to source code.

    Use ‘swagger-docs’ gem to document the API.

    This will generate swagger-ui json files for rails apps with APIs specification that can be used by person to know about the APIs.

    To start create swagger_docs.rb file in config/initializers and define your APIs as below:

    Swagger::Docs::Config.register_apis({
    "1.0" => {
    :api_extension_type =>:json,
    # path for .json files 
    :api_file_path =>"public",
    :base_path =>"http://api.somedomain.com",
    :clean_directory =>false,
    :attributes => {
    :info => {
    "title" =>"Swagger Sample App",
     }
     }
     }
    })

    Swagger document contain the json controller which has the API swagger_controller directives.

    For example ItemsController has the API specification

    classItemsController
    defshow
    render:json => {result:"Success"}, :status =>200
    end
    
    end

    Run rake task to generate docs

    Rake swagger: docs

    Above command examines your controllers to determine which controllers should be documented for swagger-ui.

    Generate the api-docs.json output in public folder which contains the API specification for the items_swagger controller.

    Breadcrumbs are graphical control element used as navigational aid in user interfaces. Today I am going to explain how it can be implemented in Ruby on Rails in simple steps as follows:

    Step 1: Create a sample app using scaffold

    Step 2: Add"breadcrumbs_on_rails" gem to the Gemfile and install it.

    Step 3: Create a home.html.erb in articles for home page and route for it.

    --> app/views/articles/home.html.erb

    Welcome

    This is the home page of Sample Article

    <%= link_to "Articles", articles_path%>

    --> config/routes.rb

    root 'articles#home'

    Breadcrumb00

    Step 4: Add breadcrumb for home page.

    In Articles Controller create method “add_breadcrum” to set the braedcrumb for home path like this:

    --> app/controllers/articles_controller.rb

    defadd_breadcrum

    add_breadcrumb "Home".html_safe

    end

    For every view page set home page as the first breadcrumb in articles controller by the default using:

    before_action :add_breadcrum

    Step 5: Add breadcrumb for other pages of article like index, create, edit and show in articles controller by adding the line for breadcrumb as “add_breadcrumb ...........”.

    --> app/controllers/articles_controller.rb

    def index

    @articles = Article.all

    add_breadcrumb "Index".html_safe

    end

    Breadcrumb01

    def new

    @article = Article.new

    add_breadcrumb "Index".html_safe

    add_breadcrumb "Create".html_safe

    end

    Breadcrumb02

    def edit

    add_breadcrumb "Index".html_safe

    add_breadcrumb "Edit: #{@article.title}".html_safe

    end

    Breadcrumb03

    def show

    add_breadcrumb "Index".html_safe

    add_breadcrumb "Show: #{@article.title}".html_safe

    end

    Breadcrumb04

    Step 6: To add seprator “/” and show breadcrumb to view page we will render the breadcrumb

    <%= render_breadcrumbs :separator => " / " %>

    I have seen many developers that are looking for creating "Drag and Drop" functionality in Ruby On Rails technology. So I'm going to brief about a sample to create and implement this functionality using JQuery Rails, JQuery UI Rails and Rails Sortable gems. Given below are simple steps required to create the rails application:

    Ruby On Rails Programming

    How to create Drag and Drop functionality in Ruby on Rails?

    First of all we will create a simple application first to create the products.

      1. The first Step we required to create the Rails Application.
        $ rails new SampleSortRails
      2. By using the scaffold we will generate the the MVC components needed for Simple Products application form
        $ cd SampleSortRails
        $ rails g scaffold Product name:string description:text quantity:integer price:integer sort:integer
      3. Create the Products database table:
         $ rake db:create
        $ rake db:migrate
        Rails uses rake commands to run migrations. Migrations are Ruby classes that are designed to make it simple to create and modify database tables. Rails uses rake commands to run migrations.
      4. Then we need to set routes of our application.
        $ rake routes
             Prefix Verb   URI Pattern                  Controller#Action
                products GET    /products(.:format)          products#index
                         POST   /products(.:format)          products#create
             new_product GET    /products/new(.:format)      products#new
            edit_product GET    /products/:id/edit(.:format) products#edit
                 product GET    /products/:id(.:format)      products#show
                         PATCH  /products/:id(.:format)      products#update
                         PUT    /products/:id(.:format)      products#update
                         DELETE /products/:id(.:format)      products#destroy
                    root GET    /                            products#index
        sortable_reorder POST   /sortable/reorder(.:format)  sortable#reorder
      5. In the routes.rb file then we will set the routes of our application.
        Rails.application.routes.draw do
          resources :products
          root 'products#index'
        end
        
      6. We have made the simple application for products CRUD operation for adding the Drag and drop functionality in the Application we need to follow some steps and need to do Setup .
        First of all we need to add the gem files in the application in the gem file.
        gem 'jquery-rails'
        gem 'jquery-ui-rails'
        gem 'rails_sortable'
      7. Then we need to run the bundle install command.
         $bundle install
      8. And then We need to add the following to the asset pipeline in the application.js:
        //= require jquery
        //= require jquery_ujs
        //= require jquery-ui/widgets/sortable
        //= require rails_sortable
      9. We have already run the migration command our database migration command look like this.
        class CreateProducts < ActiveRecord::Migration[5.1]
          def change
            create_table :products do |t|
              t.string :name
              t.text :description
              t.integer :quantity
              t.integer :price
              t.integer :sort
        
              t.timestamps
            end
          end
        end
        
      10. The product model look like this
        class Product < ApplicationRecord
          include RailsSortable::Model
          set_sortable :sort
        end
        
      11. In the controller index method we only need to change one line.
        class ProductsController < ApplicationController
          def index
            @products = Product.order(:sort).all
          end
        end
      12. Normally The view of index page always look like this we only need to change some part of code
        class="sortable">
            <% @products.each_with_sortable_id do |product, sortable_id| %>
              id="<%= sortable_id %>">
                <%= product.name %>
                <%= product.description %>
                <%= product.quantity %>
                <%= product.price %>
                <%= product.sort %>
                <%= link_to 'Show', product %>
                <%= link_to 'Edit', edit_product_path(product) %>
                <%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %>
                
              <% end %>
            
          
      13. In the Application.js file we need to add the Javascript function
        $(function() {
          $('.sortable').railsSortable();
        });
      14. Then we need to start the server.
        $rails s
      Feel free to ask any queries.

    Code cleanup refers to the act of writing code so that it cleans up leftover data structures and other unwanted materials from memory and the file system. It is not the same as refactoring code, which involves making the source code itself easier to understand, maintain, and modify. TraceRoute is the tool helpful for code cleanup.

    Integrate this gem in the Rails application by putting this gem into gem file.

    Traceroute is a route cleaning tool for Rails applications. It provides a simple rake task for checking which routes are mapped to non existing controller actions, and finds out which controller actions are not reachable.

    The following steps with the description implements Traceroute for code cleanup using traceroute gem in our ruby on rails application easily.

    STEP 1. gem install traceroute

    STEP 2. Bundle Install

    STEP 3.Type rake traceroute in command prompt and press Enter. List will appears with unused routes and unreachable action methods.

    Sorting, searching and paginating data has always been one of the requirements of a Rails application.DataTable gem provides a jQuery Javascript library - Highly flexible tool, based upon the foundations of progressive enhancement which will add advanced interaction controls to any HTML table.

    Integrate this gem in the Rails application by putting this gem into gemfile.

    DataTables makes it easy to convert a plain HTML table into one with pagination, sorting, and searching - all done with JavaScript or jQuery. Instead of writing searching functionality, sorting functionality and pagination functionality separately, these functionalities are conveniently performed by using datatable gem.

    Sorting data is inbuilt so instead of sortable_table gem use datatable gem and all columns are sortable in ascending and descending order.

    In some cases, we have to hide searching, pagination functionality in table. For hiding pagination functionality we have to write "bPaginate": false and for hiding searching functionality we have to write "searching": false.

    When you reload the page,you can see your listing page in better UI with sorting searching and pagination functionality.

    The following steps with the description implements sorting,searching and pagination for particular table using datatable gem in our ruby on rails application easily.

    STEP 1. gem install jquery-datatables-rails

    STEP 2. Open app/assets/javascript/application.js and write : //= require dataTables/jquery.dataTables

    STEP 3. Open app/assets/stylesheets/application.css and write : *= require dataTables/jquery.dataTables

    STEP 4. Provide id for a particular table.) (table class="table table-bordered table-striped" id="myTable"

    STEP 5. Call this table id by jQuery DataTable() function.

    Sample Code:

    table class="table table-bordered table-striped" id="myTable"

    script type="text/javascript"

    $(document).ready(function(){

    $('#myTable').DataTable();

    });

    Crypto currency, virtual currency, digital currency no matter you selected to choose it, bitcoin includes a heap to supply the world, virtual consumers of nowadays. It's an internet based mostly payment system between 2 people or business entities. The network functions of bitcoin are while not the negotiator or central governing agency. It's gaining quality and momentum day by day within the on-line virtual world amongst techno-savvy folks all across the planet regardless of origins or professions.

    The bitcoin payment entrance way has various edges like international accessibility, management against fraud, price potency, purpose of sale transactions, and super quick international payment. Another splendid feature of bitcoin transactions is that there's no limit on the quantity that may be transferred, thus it opens the flood gates of infinite business or personal transactions. The marvelous aspects of this payment entrance way are that it doesn't involve any middlemen, thus it doesn't levy any extra surcharges or negotiator charges on the users that is why it's gaining quality day by day. This doesn't permit developing any scope of fraud to occur at any purpose throughout the dealings. This mode of payment is secure and irreversible and provides an excellent sense of satisfaction and mental piece to the user and also the bitcoin merchants yet. Several online stores or shops that settle for bitcoin currency facet by facet with native currency, debit cards or credit cards, opens the window of chance for users to check the advantages of searching via bitcoin payment gateway.

    As a bitcoin merchandiser, it permits to square out amongst the normal business merchants and earn respect from the bitcoin user community. Bitcoin payment entranceway has opened a inordinate of opportunities to the e-commerce world and has given flexibility to the merchant’s community yet on the user community severally. the largest USP (Unique commercialism Proposition) is that one will open its own on-line store and begin acceptive bitcoins because the payment entrance way for any physical or digital product or service.

    Hence, victimization Bitcoin Payment entrance way has several blessings than not victimization it the selection is yours!

    Give your web and mobile apps the power to exchange messages of any variety, from chat to SMS. You get global reach, delivery intelligence and the highest reliability over both IP and carrier networks, all with minimal development effort.

    Here Twilio, is a cloud communications platform. We can able to use it in a various ways. It is specially available for the developers to get interact with the communication resources like., SMS, MMS, voice or video calls.

    Twilio platform is available not only for ruby language but also for many kinds of programming languages like., C#.Net, Java, Python, PHP, Node, Android etc. The availability of the service is really good and easy for the developers perspective which bring something good for the developing application.

    Using Twilio we can integrate SMS, MMS, or Voice and Video service in our developing application. It is just a couple of integration steps through which we can use the described services easily.

    So, Lets start with the some programming language through which we can use it easily. The following steps with the description implements simple messaging service in our ruby on rails web application easily.

    STEP 1.

    For implementing SMS service into our rails application by twilio we have to register freely onto https://www.twilio.com. Just after registration we will get the the attributes which we will use into our rails application and that are., TWILIO_AUTH_TOKEN, TWILIO_ACCOUNT_SID, TWILIO_NUMBER.

    STEP 2.

    Create a simple Rails application using “rails new ” .

    STEP 3. gem install twilio-ruby

    STEP 4. For the use of SMS service create a controller “Messaging_using_twilio”.

    STEP 5. Create a method send_sms into the controller as well as we have to create a view which show only two fields, that are., Message text box and Send button.

    STEP 6. Into the send_sms method we need to set three parameters which are we got from twilio account for the service use, that are., twilio_account_sid, twilio_auth_token, twilio_number.

    STEP 7. Just below the parameters initialization we will create rest object of the twilio or instantiate Twilio::REST::Client To access Twilio REST resources. The Twilio::REST::Client needs your Twilio credentials(twilio_account_sid, twilio_auth_token, twilio_number). It will return twilio REST resources.

    STEP 8. Then just after that we can call the method messages.create() which require :from, :to and :body parameters. The :from is our twilio contact number, :to is our registered contact number (or any contact number if :from number is a paid/ purchased) and :body is nothing but our string message.

    STEP 9. The twilio-ruby library will throw a Twilio::REST::RequestError. 400-level errors are normal during API operation (“Invalid number”, “Cannot deliver SMS to that number”, for example) and should be handled appropriately. Through out this way you can easily implement sms service using twilio trial account.

    Example

    def send_sms

    ENV['TWILIO_ACCOUNT_SID'] = "AC48df98e647aeaasdasAASD232bbc26863"

    ENV['TWILIO_AUTH_TOKEN'] = "5819a96aed8298f232130f212137b5"

    ENV['TWILIO_NUMBER'] = "+11159878489"

    begin

    client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'],

    ENV['TWILIO_AUTH_TOKEN']

    response = client.messages.create(

    from: ENV['TWILIO_NUMBER'],

    to: params[:phone_no],

    body: "Welcome to Twilio SMS service.")

    render json: {:response => response}, status: :ok

    rescue Twilio::REST::RequestError => e

    render json: {:errmsg => e.message}, status: :ok

    end

    end

    In the current technologically sound world more and more are opting for web applications for taking their business to a new lateral. In the past few years, Canvas has evolved as one of the most popular learning management system (LMS) and is successfully adopted by many educational and corporate institutions. However, people have restrained there thinking to the fact that canvas can only be used as a Learning Management System. The fact is that Canvas is not limited to only LMS; instead, it is beyond that. Canvas can be effectively used for other domains as well; one of the most innovative ways of using canvas is for conducting Virtual expos.

    Features in canvas can be proficiently used for commencing virtual Exhibitions, such as:

    Registration of User Types: In any sort of exhibition, different group of people or companies set up their booths for displaying their product and services. For establishing a virtual exhibition there are both visitors and organizers. As whole of the process is done through online medium, hence, canvas provides different users different registration type. This helps is proper bifurcation of users.

    Restrictions of accessibility as per the user type: With Canvas, one can create different types of users and based on their role can also define accessibility criteria. For examples: admin can have access to all the functionalities of the application, booth owners will have their own set of accessibility and so the visitors. This will maintain proper flow and confidentiality of data.

    Allocation of number of Expos and Booths as per the subscription Plan: Canvas also offer monthly, quarterly, half yearly or annual subscription plan for allocating defined number of expos or booths. This feature helps in keeping proper records of past as well as future expos.

    Creation of Expos: Canvas acts as a medium for organizing different types of events. As everything is virtual, hence, the booths that are induced in the expos are also virtual that can be created using canvas.

    Creation of Booths: Expos are incomplete without booths; this is so because booths signify the display of products and services in expos. Like expos, booths can also be created from canvas.

    Video Upload: This is one of the most interesting features in Canvas, one can upload videos of past expos for giving the visitors can have an overview of how the expos are held. This gives them a sense of confidence. In addition, one can also create dummy videos of how they are planning for the upcoming expos.

    Audio visualizers renders music beautifully by visual effects it is a feature found in digital media players it displays animated images synchronized with a piece of deity. If you break the term "audio visualizer" in two parts you get "Audio" and "visualizer", to visualize something is to form a mental image of it, so the audio visualizer converts an audio file into visual effects. Visual effects when combined and synced with music gives listeners a visual delicacy and leisure. We have created a visualizer with web audio API based on HTML5 which is compatible with all the technologies. our visualizer can be customized according to the music genre and personal requirements. This visualizer allows listeners to comment on the songs and express their opinions, their comments can seen by others while listening the songs, these pop on the digital visualizer. Comments can be filtered, we enforce a standard common decency and civility here, aggressiveness, personal attacks and bigotry is prohibited and can be reported.

    The graphic visualizations of music is a great source of inspiration for the info-graphic designers. The potential music visualization has for an open mind is tremendous. The combinations of both auditory and the visual effect is often ignored, but the audio visualizers can add a real wow!! factor to your music website. Adding the visualizer gives you impeccable user interface and attraction. Visualizers can either be 3D or 2D.

    Music distribution websites design and display their own audio visualizer so that their users can feats their eyes on something while listening music. The essential features of the visualizers that it must have are contrast, clarity improved loud list and an attractive but not too much flamboyant background. The visualizer should also be completely synced with the beats and rhythm of the piece of music. Adding real-time Music visualizer gives your music distribution website more lifelike experience.

    Software development is something all types of companies around the world are having to adopt. How they go about purchasing a custom software is a key to their success. There are two choices a company has when it comes to custom software.

    1) Waterfall methodology.

    2) Agile methodology.

    Waterfall methodology is older than Agile methodology is basically a linear model of software design. Waterfall employs sequential codes and design process. In contrast agile proposes an iterative approach to software design. Agile methodology was born after the waterfall model in response to the shortcomings of the waterfall model.

    The present situation of the software development market is inconsistent and unstable. Nowadays everyone seems to sell software development services, price ranges significantly, the companies are young and quotes are rarely transparent, etc. In order to sustain in competitive and inconsistent environment one should adopt an agile methodology. There are several ways agile methodology can help software development companies respond to the dynamic conditions of the market.

    Transparency and pricing :

    Agile contracts offer transparency: The Standard agile contract defines resource types, and resource dedication.

    For example:

    1) Project manager 50% dedication

    2) .net developer 25% dedication

    3) Senior .net developer 25% dedication

    Clients actively participate in requirement definition and operating cost of the development team. Everything is discussed out in the open team. Time and cost related with every software functionality discussed openly with the development team.

    Many lawyers make the mistake of overlooking the fact that they have to deal with a pile of documents every day, this makes their work more tedious.. We have created a web application called FCD for lawyers to solve this problem, which is easy to use and offers great service delivery for lawyers. It will reduce the time spent on phone calls, providing updates and confirming appointments. It will also save time of lawyer's secretary, scheduler, filing clerk, bookkeeper and organized rolled into one. This app is designed to meet every busy lawyers file and case management requirement even when he/she is on the go. Busy clients who are on the go can stay in loop with instant updates, reducing the need for them to contact you.

    Law firms are using FCD to increase client satisfaction and internal productivity. FCD helps in Increasing the reach of marketing and the legal insights. To engage more efficiently with clients and collect feedback. It Enables assistants and interns to work and learn simultaneously also helps to increase project management capabilities. It's truly a revolutionary way to help law firms improve client communication while gaining a competitive advantage. Given law firms are faced with unprecedented competition, FCD presents amazing opportunity to embrace innovation ahead of the curve. The great news is any firm can get started today.

    The benefit of innovating via our technology are countless
    • Manage and keeps clients up to date with the progress of their client.
    • Reduce the need for constant phone calls, emails and letters.
    • helps to manage a case update
    • Maintain case and update case notes at anytime from anywhere.
    • Creating appointments with your clients is just a click away
    • follow up cases with reminder alarm

    One of the greatest benefits of FCD app for lawyers is the flexibility, lawyers have access to their client's case and their information whenever and wherever they are. Taking your practice with you was next to impossible before the introduction of FCD but now it lets lawyers take advantage of the time they spend commuting. Waiting in court or travelling? You can leave that briefcase at the office you are not dependent or limited to, your library or computer you will never need to sync information with your office assistants and you get to bill on the go! Now its possible to keep your client happy 24/7 they do not have to wait for information from your end. You can send secure emails to your clients and solve their queries on the spot real time.

    Stock Projection Application basically used for Stock Markets in which shares of publicly held companies are issued and traded either through exchanges or over the counter markets . Also known as the equity markets, the stock market is one of the most vital components of a free-market economy, as it provides companies with access to capital in exchange for giving investors a slice of ownership in the company.

    Function and Purpose of Stock Market

    The stock market is one of the most important ways for companies to raise money, along with debt markets which are generally more imposing but do not trade publicly. This allows businesses to be publicly traded, and raise additional financial capital for expansion by selling shares of ownership of the company in a public market. The liquidity that an exchange affords the investors enables their holders to quickly and easily sell securities. This is an attractive feature of investing in stocks, compared to other less liquid investments such as property and other immoveable assets. Some companies actively increase liquidity by trading in their own shares.

    About Stock Projection Application

    This application fetches the recent data of all together 2161 companies from Yahoo Finance and after some calculation reffrenced with past 7 days , it will display conditions of “Buy” (i.e whether the company has profit or loss). All company records from last 10 years are saved in database and by continously monitoring these values, next day prediction of condtions are set. One important property of theses application is it shows result of companies in json format or in table form. So user can save particular company data in document for there use.

    Firstly, these Application fetches updated previous close price from Yahoo Finance and starts calculating Terms used for calculating conditions. It calculates the following terms to set condition of “Win” or “Loose”

    Buy Price – mean(price_array_yearly)- where price_array_yearly is array of last one year prices.

    Sell Price - Buy Price + target_increase- where target_increase = percentage change in Average Price with taking 5( user defined) at numerator

    Average Price(Past 01Year) – Calculate mean of last 1 year prices.

    Standard Deviation Yearly- Calculate standard deviation of prices.

    Average Monthly Standard Deviation 3 years- Calculate average of last 3 years standard deviations.

    Lifetime Strike Rate- It will monitor 4725 records of trend and check whether the trend >10 or =10, and decides the conditions for “win” or “loose”.

    Yearly Strike Rate- It will monitor 365 records of trend and check whether the trend >10 or =10, and decides the conditions for “win” or “loose”.

    Gain Momentum In Percentage - Calculate percentage of Average price with 5 (user defined) at numerator.

    Target In Percentage - Calculate percentage of Average price with 10 (user defined) at numerator.

    Conditions – display result of win as “Buy” or loose as blank.

    Conclusion

    This application is very useful for people who are investing in stock market and it help people to understand and predict stocks, find the possibility of win or loose by monitoring history of companies prices.

    With the Kaltura Canvas Video App, teachers, students, and staff easily view, record, manage, edit, transcode, and deliver high-quality video that is visible on any device, at any time. You'll be able to currently take teaching and learning to a full new level with interactive video tools seting with LMS. This app permits you to look at, upload, publish and share videos directly from inside your LMS. This interprets into time and cash saved for your establishment, and a lot of encouraging, interactive learning expertise for college students as well as for colleges.

    With Kaltura, you can
    • Create videos with webcams, or Kaltura’s optional CaptureSpace video capture solution
    • Upload existing media from your laptop, college video platforms and also social media
    • Add searchable captions and data for exaggerated discoverability
    • Manage videos by personal library, course galleries or shared repository
    • Edit with in-system tools like clipping, chaptering and managing thumbnails
    • Publish to a course gallery, as a part of a check or assignment in a blog or more
    Benefits:
    • Increase collaboration, engagement, community and learning outcomes
    • Ensure media security victimization Canvas permission system
    • Take advantage of Kaltura's tier one hosting and CDN to deliver a high-quality expertise while not overloading your LMS
    • Lower prices and work by sanctionative students and college to transfer and manage videos within the LMS while not requiring facilitate from a central media team
    Kaltura Integration Step through External LTI Tools In Canvas :

    For Kaltura Configuration in LMS, You will need an account either at Kaltura.com or with a self-hosted instance of Kaltura.

    • From your course home page in Canvas click on Settings.
    • Click on the Apps tab and then View App Configurations.
    • Click on Add New App(the button may just say Add App in some versions of Canvas).
    • A pop form will appear, underConfiguration Type Select “Paste XML”.
    • Name can be set to any non-blank value. You will need to contact your Kaltura account administrative to get Kaltura account Partner Id as "Consumer Key", account administrator secret as “Shared Secret” and Paste the content of MyMedia.xml provided to you by your Kaltura representative.
    • Checked the "Add Kaltura to Rich-Text Editor" button so it will appear in Rich-Text Editor
    • Click Submit. The My Media tool will be listed in the list of external tools and a new navigation menu item will be added to the course menu.

    The Mockworth Clock Game is concentration game based on Mockworth Clock. The Game has a black background circular Dial with 24 "+" marks representing 24 slots like clock and red dot jumping over these slots . The red dots moves in short jumps like the second hand of an analog clock, approximately every second. At infrequent and irregular intervals, the red dots makes a double jump, e.g. 3 times in 1 complete loop. Basically the game is to detect when the double jumps occur by pressing space-bar. Typically, Mackworth's participants would play these game for pre-defined number of loops.

    The Clock is an experimental device used in the field of experimental psychology to study the effects of long term vigilance on the detection of signals. It was originally created by Norman Mackworth as an experimental simulation of long term monitoring by radar operators in the British Air Force during World War II.

    Technology

    In Mockworth clock game, black circular dial is designed with the help of HTML and CSS, 24 “+” signs are designed using images and it is placed in circle with css property transform: rotate(x deg) translate(x px) rotate(-x deg) where x and y is user defined.

    For example:

    red dot pointing at 12 o'clock

    .deg270 {

    transform: rotate(270deg) translate(17em) rotate(-270deg);

    }

    Red dot movement is achieved with the help of javascript animate() function and opacity css property. And to make red dot movement in loop, we use javascript recursive setTimeout(function()) function.

    For example:

    To blink red dot at some interval of time.

    setTimeout(function() {

    $(#id_name]).animate(

    {opacity: 1},{

    duration: 400,complete: function ()

    {

    $(this).css({opacity: 0}); <.p>

    }

    }

    );

    Skipping of red dot is done by Math.round(Math.random()) function.

    When red dot skips, participant need to press space-bar and hit counts. These is achieved by using keypress() function and result is displayed in score board.

    For example:

    For counting space-bar pressed.

    $(document).keypress(function(event){

    var keycode = (event.keyCode ? event.keyCode : event.which);

    if(keycode == '32' ){

    SCORE = SCORE + 1 ;

    }

    document.getElementById(' id_name ').innerHTML = SCORE;

    });

    At the end of game, final result is displayed, which is using parseInt() and text() function.

    Game Procedures
    • A circle, with 24 equally spaced "slots" (as represented by the empty space between two "+" marks), is presented on the computer screen.
    • The Subject can put n number of loops as per interest in input box and starts the game.
    • A red dot starts from the 12'o clock position and flashes in turn in each "slot".
    • The dot stays visible for 1 sec and so there is an interval of 1 sec between each flash.
    • At some postion red dot skip anomaly .
    • Total number skip is random in complete one loop.
    • The subject identifies this event by hitting the space bar (or other user-definable key).
    • The entire game lasts up to a pre-defined number of loop.
    • After the game over result is diplayed on Score Board in percentage.

    Canvas is a cloud-based Learning Management System that makes teaching and learning easier. Many tools are integrated in Canvas, so it can be used online, on mobile and on tablet. One of the interesting tool is Blackboard Collaborate.

    Blackboard Collaborate web conferencing is an LTI-compliant LMS, such as Canvas, BrainHoney and Sakai. Instructors create and manage Blackboard Collaborate sessions and recordings from inside the LMS of their choice.

    Blackboard Collaborate perfectly complements Blackboard Learn creating a comprehensive digital learning environment. For students and teachers, synchronous learning is a rich part of their learning experience and is seamlessly available through Blackboard Learn and Bb Student.

    For blackboard integration in LMS, Contact Blackboard for account registration and to retrieve a key, secret and URL.

    Instruction to Set-up in Canvas LMS

    These instructions describing how to setup Blackboard Collaborate LTI tool in your Canvas Course, where LTI stands for Learning Tools Interoperability.

    • From your course home page in Canvas click on Settings.
    • Click on the Apps tab and then View App Configurations.
    • Click on Add New App(the button may just say Add App in some versions of Canvas).
    • A pop form will appear, select Configuration Type as By URL , the Name can be set to any non-blank value.
    • You will need to contact your Blackboard account administrative to get the "Launch URL", "Shared Secret" and "Consumer Key". Checked the "Show in Course Navigation" button so it will appear in Course Navigation.
    • Click Submit.

    Now you will able to see Blackboard Collaborate in Course Navigation and you can create sessions and recordings.

    Why Use Pluck in Ruby on Rails:

    Pluck in ROR is used to get array of particular attribute based on particular condition from database. If you only require a few attributes from a table, rather than instantiating a collection of models and then running a .map over them to get the data you need, it’s much more efficient to use .pluck to pull back only the attributes you need as an array.

    The benefits of using pluck are: better SQL performance and less time and memory spent in Ruby on Rails.

    Standard format of using pluck method is

    pluck(*column_names)

    Using Pluck:
    1. You can select one or more attributes without loading a bunch of records just to grab the attributes you want.
    2. You will get array of values of attribute which we pass to it.
    3. Pluck also replace select and map while querying.
    4. You can avoid extra loops to get ids from the collection of ActiveRecord while using the pluck method.
    5. Pluck is useful method in ruby to improving performance of your app.
    6. Pluck returns the array and breaks the ActiveRecord query method chain so becareful when you want to query on the result.

    Pluck can be use in various ways to improve our code quality as well as speed of app, some of them are shown below

    When you want array of ids from a table you can use pluck

    eg. Category.pluck(:id)

    # => [1, 2, 3]

    You can use pluck to get array of multiple attributes from table

    eg. Service.pluck(:id, :business_id)

    # => [[1, 3], [2, 5], [3, 2]]

    If you want unique values of attribute in array you can use pluck as given below

    eg. Category.uniq.pluck(:name)

    # => ['home', 'apartment', 'hotel']

    You can use pluck in query itself

    eg. categories = Category.where(name: “home”)

    Service.where(category_id: categories.pluck(:id))

    # => [1, 2, 3, 4, 5]

    Bitcoins are a very common terminology now. To let you know further about Bitcoin it’s a very popular cryptocurrency. As it’s a crypto currency it’s a virtual money and cannot be exchanged physically.

    There are ways of using plastic money and most of the merchants use the way of getting the payment online. But while including this third party integration the merchant has to pay this third party and there is approximately 3% the merchant has to pay for every transaction made.

    The way PayPal, Braintree, Ccavenue, and other payment gateway work the same way Bitcoin payment gateway can be integrated in a merchant's e-commerce site.Bitcoins are virtual currency and can be saved in virtual wallets. The merchant’s wallet will be integration in his application and the customer can make the payment through bitcoins which Will be transferred to the merchants wallet.

    These bitcoins accumulated in merchant’s account can be exchanged to the local currency as and when required. Bitcoin payment gateway integration is a very easy to be implemented payment gateway and has a easy understandable documentations for the same.

    What is RESTful API

    A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. Representational state transfer (REST), which is used by browsers, can be thought of as the language of the Internet.

    Steps in creating RESTful API: Step 1: Creating an API

    While creating an API, the controller is kept in a separate folder named api inside app/controller of the ROR application.

    Step 2: Creating a Versioning Folder

    Once an api folder is created, we create a versioning folder under api folder. This versioning folder is created according to the API requirement. An existing API should never be modified, except for critical bugfixes. Rather than changing existing API we create another version of that API.

    For ex., app/controller/api/v1 or app/controller/api/v2

    Step 3: Creating a Controller File

    Create a controller file inside the api folder like home_controller.rb

    Step 4: Creating Controller Class

    Inside the controller file we need to create the controller class. This controller class will contain the method which is used while calling an API. Basically, the method inside the controller is nothing but a business logic of the requirment of an API. So, this method is defined to run as per the requirement of an API. This method will return the JSON format data. For that we need to render the result into JSON format.

    The above steps deals with the controller /api folder. Now, if someone wants to call a particular api method, for that we need to define in routes.

    The routes is used for calling an API methods defined inside the config/ routes.rb file of the ROR application.

    Route Example :

    namespace :api do

    resources :home, defaults: { format: 'json' } do

    collection do

    get 'business_details&:category_service&:city', to:'home#business_details'

    end

    end

    end

    So, our calling URL for above step should be http://localhost:3000/api/home/business_details&Food andRestaurants&USA

    And result should be

    {“name”:“MacDonalds”, “address”:“New York, USA”}

    In the early days artists use to record songs and distribute on different DSP's which help them to make money. But, in an era of internet, distribution of songs on different DSPs is not sufficient for an Artist.. Social media presents an interesting opportunity. As music fans, most of us turn to Twitter or Facebook to keep updated about our favorite bands, whilst new tracks or videos will 99% of the time get their launch on social channels. This gives a complete popularity to the artist. Artist needs promotion on Social media along with distribution and royalty processing so that he earns more revenue.

    There are many social media platforms for promoting music but facebook is one of the fastest medias to Promote Music and Generate Revenues

    In order to increase your popularity on facebook you should have all of the following in place before running your ads.

    1. Create an artist page first

    2. Make your presence on facebook as an active member by posting on a daily basis

    3. Online music sale should be listed

    4.Content like videos, pictures and blog posts for your fans to interact with and comment on.

    Benefits of Facebook Ads:

    Facebook ads allows to learn about your audience, gain fans, and sell music by putting your ad in front of a very targeted group of Facebook users.

    Facebook Ads does the following:

    • It will Drive traffic on your Facebook page
    • Get Likes for Your Facebook page
    • Advertise Your Facebook Event
    • Advertise any offer that links to a website outside of Facebook
    • Target specific Facebook users depends upon likes, age, region etc.
    Targeting fans who already ‘Like’ you on Facebook

    It’s common to spend a lot of time targeting new fans and forget to target the people that have already shown interest in your music. Most likely you have far more people that Like your Facebook page than have actually purchased your music. Facebook allows you to specifically target people who like your page, so why not make special offers for the people that are most likely to buy your music?

    Cryptex Technologies will help you in the following Key elements of an effective ad
    • Focus on a call to action: A “call to action” is a line that basically says, “do this now.
    • Compelling Text: Since there is not too much space for text in facebook ads, hence the ad should be crisp and effective. Cryptex Technologies creates facebook ads which perform best.
    • A picture is worth a 1,000 clicks: Cryptex Technologies follows marketing research guidelines to upload images which will be clicked more often.

    Elasticsearch provides a powerful, RESTful HTTP interface for indexing and querying data, built on top of the Apache Lucene library. it provides scalable, efficient, and robust search, with UTF-8 support. It’s a powerful tool for indexing and querying massive amounts of structured data.

    Why Chewy?

    Despite Elasticsearch’s scalability and efficiency, integration it with Rails didn’t end up to be quite as straightforward as anticipated. And thus, the Chewy gem was born.

    A few notably noteworthy options of Chewy include:

    1. Each index is discernible by all the connected models:

    Most indexed models square measure associated with one another. And generally, it’s necessary to denormalize this connected information and bind it to a similar object (e.g., if you wish to index associate degree array of tags beside their associated article). Chewy permits you to specify associate degree updatable index for each model, thus corresponding articles are going to be re-indexed whenever a relevant tag is updated.

    2. Index categories square measure freelance from ORM/ODM models:

    With this improvement, implementing cross-model auto-completion, as an example, is far easier. you'll simply outline associate degree index and work with it in object-oriented fashion. not like alternative shoppers, the Chewy gem removes the requirement to manually implement index categories, information import callbacks, and alternative elements.

    3. Bulk import is everywhere:

    Chewy utilizes the majority Elasticsearch API for full re-indexing and index updates. It additionally utilizes the conception of atomic updates, aggregation modified objects among associate degree atomic block and change all of them right away.

    4. Chewy provides associate degree AR-style question DSL.

    By being chainable, mergable, and lazy, this improvement permits queries to be created in a very additional economical manner.

    In the prevailing technologically sound world paying due consideration on the quality of goods and services are very crucial for ensuring customer satisfaction. In addition, quality also maintains customer expectations, reputation, meeting standards and above all costs. Automated Code Quality Testing is a very popular concept in the Information Technology industry. Earlier, the concept of manual code quality testing was very popular but there were some limitations associated with the same, such as:

    • Manual code review is a slow process. On an average it covers only 100 to 200 lines per hour.
    • There were also various security related flaws in the testing process.
    • At a time human memory can keep seven items in memory that are helpful in performing the testing process but automated tools can keep hundreds or even thousands of criteria. This indeed does not eliminate the need of human reviewer, as they are the one can produce both false positive as well as false negative testing reports.

    Moving ahead with the automated code reviewing tools, there are various tools that are available in the market that claims to offer efficient code quality testing. List of popular tools comprise of TraceRoute, Rack-Mini-Profiler, Brakeman, DeadWeight, CodeClimate, RubyCritic, Rails Best Practices and more.

    Most of the tools that are mentioned above are paid and some does not ensure complete accuracy. However, Rails Best Practices is the one that helps in ensuring accurate result. Ruby on Rails is one of the niche technologies; there are very limited companies who work flawlessly on this technology.

    Cryptex Technologies is one of the most renowned companies that work on ROR and also religiously follow Rails Best Practices. The very reason why Cryptex Technologies have a stable clientele is because of the code quality they maintain for creating web and mobile applications.

    A productive framework has changed the rules of web development.

    Ruby on Rails is a framework innovation: it contains all the ingredients necessary to quickly build a web application performance. It is a tool designed in the spirit of agile development to deliver productivity and flexibility for development teams.

    Based on the Ruby development language, it has revolutionized the world of web development through its pragmatic approach.

    Ruby on Rails' philosophy is summarized by two principles:

    • "Never again" and it saves time, concentration and reduces code size.

    • "Convention over configuration": it is better to use the conventions that wasting time to configure.

    The advantages of Ruby on Rails:

    1 - Develop faster

    • Ruby on Rails is a compact language provided a clear and concise syntax: it produces less code than its competitors.

    • Less code to produce, so it's less time to code, less error-prone, less code to maintain.

    • Integrated tools for automating repetitive tasks: creating a form, management of database error handling...

    • Developments are simpler because the code is lightweight and easily readable, the closest possible human syntax.

    2 - Gain productivity

    Everything has been designed to minimize the development part of a project and maximize the part creativity and originality of the project. Developers focus on design rather than reinventing the wheel with each new project. They are gaining more productivity by eliminating repetitive tasks and find the pleasure of coding.

    3 - Check the code quality

    Ruby on Rails has a test framework built checking code quality. With each new code change, it is verified and validated. Errors are reported as and when the programming and can be quickly corrected. This ensures high code quality.

    4 - Create interactive interfaces

    The technologies needed to program rich interface are integrated and activated on demand. With integrated javascript framework is easy to activate features drag & drop, apparitions progressive elements, zoom.

    5 - Structuring the development

    Ruby on Rails is based on the design template "Model-View-Controller" that separates the application from the data, presentation and treatment. This requires the programmer to better structure the application and code in a logical and coherent. This encourages a higher level of abstraction in programming the application, thanks to high-level functions to focus on features rather than on the details.

    Ruby on Rails developers working in varying regions of India have taken steps to write web applications in Ruby programming language that helps in communication between stakeholders, and helps to maintain high code quality with a very good standard. It is commonly termed as ROR and is an object oriented program language. It is only because of Ruby on Rails the web application has been created.

    Benefits and Advantages of Ruby on Rails

    ROR has several web services that work effortlessly by building powerful and well-designed applications. It is very useful for developing data base, supported with web application

    • Using simple methods and less code you can very well develop the applications
    • It makes easy and quick web solutions development and flexible with different types of web servers and databases for fast implementation
    • Provides smooth compliances with various databases and allow the ROR programmers to create the latest user friendly and advanced application
    • The ROR framework helps in the speed of development with culture and standard. It is very easy to understand with the help of this programmer
    • The development rate possessed by Ruby on Rails developers in India has been increased by about 40 % as compared to other programming language or framework
    • The most important parts of the culture are a social ROR which enables to help others to solve any issue. You can also share with the community.
    Tools Developed by ROR Team in India

    Ruby on Rail Developers in India has come up with several nice development tools, which include:

    • Testing: The Company with the help of quality control department helps to test projects Caching: important factor to develop major internet project and ROR already has regular basic configuration means of caching data
    • Routing: ROR has the flexibility to change and configure routing, typing addresses, main sections names and also in a position to quickly change the address without disturbing the whole project address.
    • Validating: places all the validation input data perfectly. Users can verify mail id address, password and login.
    • Localizing: whenever the user wants to put another language while doing the project then he can open a parallel project which is a copy of it and translate it.
    • Database structure:
    • Safety: Provides safety measures
    • Deployments: tools are used in the deployment process
    • You can now have the opportunity to enjoy the advantages of Ruby on Rail development in India with the support of rate and cost.

    With the scenario of internet business and online promotion, large numbers of artists and labels have chosen to upload their songs and musical contents on digital media websites rather than following of traditional selling methods. On the other side, reputable digital distribution platforms have started offering individual singers, labels and other artists with advanced and safest modes to make money by selling their uploaded contents via internet. Especially, Cryptex Technologies offer a special facility of Royalty processing to benefit labels and to obtain success in the sector of digital media distribution. Significance of this technique will include:

    Processing of Payments in Hassle-Free Way

    Innovative Royalty processing software collects suitable royalty amount from varying music and media sources in DSP format and then, according to required format of clients, it processes the earned amount to respective clients, labels and individual artists without any difficulty and within less possible duration.

    Aims at Boosting Efficiency and Accuracy Levels

    Usage of advanced web-based solution for digital royalties boosts accuracy and efficiency and in turn, gives individuals with complete control on the workflow of revenue recognition and royalty processing. In fact, our reputable digital distribution medium lets clients to recognize revenue generated from different media sources, like ad-supported, subscription based and transnational sources.

    Ongoing Support is Possible

    Our sophisticated software solution and qualified technicians let labels and artists to receive ongoing support for their royalty processing services. For this, we cleanse and validate each data comes in your system.

    Assures Creating Long-Term Success

    Based on our experience in dealing with digital media platforms, we opt to follow key steps aimed at sound management of your royalty account processes, which would foster drastic growth, creates big success in the sector and simultaneously, maintain stability with various clients.

    At some purpose in each Rails application's life, you'll have to perform some reasonably maintenance or code update that may need taking your application offline for a short span of time. There square measure strategies to attain zero-downtime deployments, however typically it's simply easier to require your application offline for five minutes throughout a preparation. If you recognize that no-one is writing information into the info, then you do not need to worry regarding synchronizing information or merging info backups back in once your deployment is finished. It simply makes life less complicated in cases once a number of minutes of time period is appropriate.

    But, throughout this "dark period" once your application is offline, you must still offer your users some notice of what's happening, and after they will expect the upkeep amount to finish.

    Quick-Start with Turnout

    The turnout gem makes it straightforward to quickly place up a friendly maintenance page for your users, and block access to all or any routes at identical time (to forestall writes to your database).

    The main edges are:
    • Easy installation
    • Rake commands to show maintenance mode on and off
    • Easily offer a reason for every time period while not writing the upkeep.html file
    • Allow sure information sciences or IP ranges to bypass the upkeep page
    • Allow sure methods to be accessible throughout maintenance
    • Easily override the default maintenance.html file together with your own
    Install

    In your Gemfile add:

    gem "turnout"

    then run

    bundle install

    Activate

    rake maintenance:start reason="We're updating our site, please check back in 5 minutes"

    In the recent few years, Ruby on Rails has become one of the productive frameworks to bring drastic revolutions in the rules of web application development. In fact, ROR development now works as a framework innovation and contains each necessary ingredients or resources that will help in creation of a high performance of web application.

    Especially, Ruby on Rails developed by one of the reputable companies as Cryptex Technologies serves as an innovative tool aims at agile development and assures delivery of highest possible flexibility and productivity for various web development teams. Major contribution given by the technician team of Cryptex Technology to boost the productivity of website developers and application developers will include

    Database Access Library

    ROR has incorporated active record or database access library to allow simplification in the actual process related to handling of data contained in databases. Furthermore, this library maps different tables automatically into varying classes and in the same way, rows into different objects.

    Allows for Fast Development Process

    According to experienced web app developers, Ruby on Rails is a type of compact language that provides concise and clear syntax or produces relatively less code as compared to competitors available in the market. Less code obviously requires less time in coding job and less error prone towards less maintenance.

    Helps Boost in Productivity

    RORs available for web application development intends to reduce development job associated with any project and in turn, enhances originality and creativity. Hence, developers can easily focus on their designs instead of reinventing wheels with new projects.

    Customization Process is Possible

    Last, but not the least, Ruby on Rails developed by Cryptex Technologies allows users to develop wide range of search-engine friendly and personalized types of URLs.

    If you're new to programming in Ruby, here are the 3 tools you must know.

    Debugger

    The Ruby debugging tool can be found in the library file debug.rb. This tool will let you run your program one instruction at a time, with pauses in between. At every pause you can examine the values or variables of your code, locate your position in a series of nested commands and/or resume execution. You can also tell the debugger when to stop, more commonly known as breakpoints.

    Using a debugger varies from programmer to programmer. Just because a debugging facility is available for Ruby, it doesn't mean that a novice programmer should quickly adapt himself to using it at once. There are programmers who are comfortable using a debugger, some aren't. It's a matter of preference but at any rate, it's nice to know that there's a tool available for Ruby.

    Profiling

    Eventually, when you start writing longer programs, you'll want to measure how much resources, especially time, is used up by parts of your program or as a whole. This is called profiling.

    You can do profiling using the command $ ruby -r profile c2fi.rb Profiling identifies the areas in your program that are using up lots of the system resources. Having identified these areas, you need to re-code your program to make it run efficiently.

    ERb

    Probably the coolest tool of them all, Ruby provides you with a program called ERb (Embedded Ruby), which allows you to put Ruby code inside an HTML file. You get to embed Ruby inside non-Ruby, and interprets the whole thing as program input.

    Ruby on Rails is becoming a popular choice for many programmers in India. Cryptex Technologies is having an experts team of Ruby on Rails Developers in india and delivers a bug free web app as well as mobile app.

    The music industry is growing by the day. Nowadays, music is available on digital channels. If you have iTunes installed in your mobile phones then you can listen to the music of your choice. A significant percentage of the global music industry revenue is obtained from digital channels. Out of them, a certain percentage comes from streaming services that are subscription based.

    If independent artists are contemplating of placing their music in digital stores then it can prove to be difficult, sometimes. It is because many stores do not accept submissions from independent artists. They focus on selling their music through a network of trusted companies. The concept of distributor is important thus. The distributors are entrusted with the task of getting the music to the stores. In the stores, nowadays, music is sold in compact discs, DVDs. In this context, it is relevant to state that there has been a sharp reduction in physical sales.

    Correspondingly, there has been an enhancement in digital revenues. Distributors that earlier focussed on physical products now offering distribution digitally. Considering all this, it makes sense that developing own distribution is more profitable. For instance, if you consider about revenues obtained in 2015, you will find about 20 billion i.e. about 5 billion higher as compared to the data obtained during the last year. In addition, experienced people of reputed music distribution application, like for instance Cryptex Group has predicted that the figure will reach at extremely high during the upcoming 2020.

    When talking about digital music, there is a broad variety of online stores and services, from where the distributors supply music. The stores deal with the distributors for proper delivery of the content. The different processes in the stores are run automatically. Having to handle a process manually is time consuming.

    Because of this, distributors have developed software to automate the processes. In addition, if labels and artists opt to sell their music contents to online distributors, they may have to give some percentage as share say 15 percent to distribution for selling of music collections. In this situation, far better option would be to develop own software and thereby, save few bucks.

    In contemporary times, the digital music distribution is quite popular. As already discussed, it is quite convenient and very much profitable.

    The framework of Ruby on Rails is a very powerful tool within the development of web applications. it's several integral options like object-relation plotter and intelligent routing that accelerate web applications development.

    Rails is specifically designed to own a simple extension with use of Ruby gems. an enormous system of Ruby gems has been created as a result of it. These gems will accelerate development method and extend application method by reducing time concerned to figure on common practicality development.

    Devise

    Devise is the most gem on Rails. This gem provides authentication resolution that's convenience to use for Rails applications permitting registration, login, account locks, forget password, and different options associated with account.

    Pundit

    There is associate importance of knowing the distinction between authorization and authentication. Devise is that the one serving to within the authentication and verification of users whereas authorization is assures that users area unit allowed to perform any action or have access to any resource. Oundit is incharge of whole method and provides straightforward ways in which of describing authorization systems simply by the utilization of Ruby classes.

    Slim

    Template systems area unit everyplace. Rails uses the model system of eRuby by default however it’s one thing that users usually opt to replace. Slim is taken into account as a standard replacement as a result of it's permitting users to keep up straightforward reading templates through its syntax whereas it maintains fast compilation times.

    Drapers

    Draper is that the gem that enables user to make decorators around their models. This gem makes views cleaner thus users area unit prevented to jot down helpers. instead of line of work helper on the models procedural, users outline the decorator wrapping the first model and giving the list of extended attributes and ways to things.

    Cells

    Many application parts area unit typically re-used. Basically, partials area unit within the use of those behavior however users should take hold on partial calls and every one partial calls having consistent behavior. Cells enable users to require a part of controllers and encapsulate those in their own controller. By this, you'll be able to mark your own code cleaner and avoid helpers.

    FriendlyId

    URL resources area unit usually known by personal key, that is additionally the info ID. however this might result to un-optimized URLs of websites that aren’t that easy. FriendlyId will instantly rework URLs to a friendlier, straightforward to hit the books URLs thus there'll be no code changes on the appliance.

    Simple Form

    Forms are the core of web application. User interactions are sometimes done exploitation web forms. Simple form simplifies straightforward and repetitive tasks. It implements simple to use DSL in creating forms. Users pay lesser time on writing HTML for forms and have longer for the guts of the application’s business logic.

    Paperclip

    It’s additionally exhausting to contend with file attachments as a result of they involve relevant work and time to implement them in an exceedingly secure manner. Paperclip takes charge of this method on Rails applications and extends time for thumbnails.

    Kaminari

    This gem is the most popular having 5M downloads. This enables users to paginate from ActiveRecord relations to simple arrays using simple APIs fully agnistic to any template or ORM engine.

    Sidekiq

    This gem is that the most well liked in backgrounding tools. it's has simple API and scale even better than some background processors.

    Making use of these gems Cryptex Technologies ROR developers in India deliver an excellent bug free applications.

    Every developer needs programming for net applications to stay as straightforward because it will get. Most of them need to figure with a framework that's straightforward and simple to use. Similarly, each business needs a technology that helps it to save time. This is often wherever Ruby on Rails comes into image as it is a standard web application development framework extensively used in IT industry. The framework is incredibly useful to developers because it doesn't force them to jot down lines of codes for adding options and functionalities in websites and applications of clients' comes.

    More so, developers realize this framework not solely very simple to figure with however additionally fun for development functions. The framework is hot at the instant because it comes packed with AN array of useful options to feature tremendous price to websites and on-line applications. For net applications, Ruby on Rails is taken into account simply good because it fetches a operating example in a very super gait. It additionally provides developers the convenience of checking the practicability of net comes in a very hassle-free and simple manner. the most effective half, it permits fixing of cracks within the development cycle early - one thing not out there with different frameworks.

    Furthermore, businesses realize Ruby on Rails quite favorable because it helps them save lots of cash with their net comes. It's 100 percent free and this makes it one amongst most efficient frameworks around for businesses to satisfy their web development goals in a cheap manner. It runs on the open supply Linux and developers face completely no issue in operating with this framework. More so, developers victimization this framework move from the look to actual development stage in a very swift manner and this encompasses a ton to try to to with the straightforward handling that it offers. This is often however an excellent deal of your time is saved with comes.

    In addition, the framework is supported by a lively and useful community wherever developers are continually able to troubleshoot issues of any nature and facilitate folks engaged on comes. it is the efforts of community that sees a forceful improvement within the code and this is often however the framework becomes a lot of sturdy and standard for users and businesses alike. More so, comes that use Ruby on Rails ne'er face issues once taken from one developer to a different as secret writing conventions ar followed in building them. Since this framework is straightforward and easy to figure, comes can continually have a viability in future.

    Furthermore, Ruby on Rails is one amongst those technologies that facilitate one build their own plug and play apps while not seeking external support. which suggests, future comes are often sustained on the idea of components of existing comes and developers are going to be saved the inconvenience of doing things from the scratch. More so, this framework lets your apps to serve multiple functions in conjunction with being expandable. Quite clearly, the list of options is simply an excessive amount of to ignore and you ought to therefore rent ruby developers to learn from all of them.

    Anyone who closely follows the developments within the internet Technology trends can understand that today the most demanded technologies is Ajax and Ruby on Rails. And, nowadays the thrill word is that the customizable on-line message processors. It is an open source and web based message life cycle management system that can be used for software development projects.

    This tool provides basic message life cycle management functions that will embrace the regular add, edit, delete, review and different functions. Some of the current functionality include:

    1. Content validation that's rule-based to validate the input as per the pre-defined rules. As a result, the inputs that don't benefits the principles won't be saved within the system.

    2. Every individual will create modifications and enter comments.

    3. It permits you to import or export XML directly into your software system.

    4. May be changed simply to best meet your project needs.

    5. May be deployed as an online application simply.

    This tool has been designed on Ruby on Rails, that may be a sturdy framework for developing the online applications. The Customizable on-line message processor may be extended or custom as per your specific desires. It conjointly provides straightforward thanks to manage the information connected style and helps you to trace the complicated information transactions.

    It also can be used for the event of product specific needs like user authentication and different connected applications.

    As we tend to enter the Web 3.0 era, there are many other upcoming apps under rapid development, and they will hit the market pretty soon. So, keep an eye on the release of the latest open source projects in the world of web technology.

    With the consistent progression in the sector of music and digital technology during the last few decades, mainland CD stores and their popularities in the market decreased continuously, while demand for download of digital music continued to be popular in between worldwide music lovers.

    By claiming approximately half of the worldwide music buying audience, digital music distribution serves as a predominant method offered by musical marketing world today. Indeed, the question comes in the mind of people is that how digital music platform helps artists, labels and music lovers belonging to different parts of the world.For this, experts have said

    Serves as Platform for Artists and Labels

    Digital music mediums have provided an efficient platform for large numbers of talented and skilled labels, who want to explore their music over iTunes and other musical sites.

    Offers Royalty Processing Benefits to Users

    Online music distribution software offers royalty-processing benefits to their users. This implies that the website collects suitable royalty amount in the suitable DSP format and later on, process it in the format demanded by labels in hassle-free way and even within the mentioned duration.

    Provides Data about Demands and Sales

    Each label or artist chooses to register with digital music platform would be able to receive necessary updates and reports on demands and latest trends regarding the sales of their music or songs. Last, but not the least, artists opt to join reputable digital music platforms will also be able to avail of load balancing solutions based on their specific requirements.

    Therefore, digital music distribution platform has provided wide range of benefits and many applications to labels and music lovers worldwide.

    Big companies belonging to different parts of the world have already started trading with Bitcoin crypto currencies. However, now many small business owners and entrepreneurs are stepping forward to include this virtual currency in their own business activities. On 15th of June, a meeting takes place at the Hester Street Fair in New York City’s Lower East Side, where large numbers of artists, collectors and entrepreneurs have joined and planned to host NYC Bitcoin Fair for the year 2015.

    Here, individuals associated with trading and business activities will be able to find large numbers of technological enthusiasts, innovative companies dealing with the virtual currency of Bitcoin, meet-ups, traders and more than 30 different small-scale businesspeople selling their top quality of artisan goods and food items for Bitcoin.

    Suhyun Pak, who is one of the co-organizers of Hester Fair and Bitcoin Fair’s creator, commented, “Every Sunday, we will hold this fair to motivate online traders until 26th of October. This fair would definitely act as a perfect environment for the utilization of bitcoin. Majority of businesspeople attended the Hester Street Fair possess entrepreneurial feelings and have huge willingness to try innovative things. Even many of the attendees have shown huge excitements to stay at the fore front of new bitcoin trading technology.”

    Another update about bitcoin trading highlighted that on West Coast, large numbers of restaurants located in San Francisco have started trading with Bitcoin. In fact, many of them use its old payment system as Bitpay and use it for 1% of the total transaction fee. Especially, one such restaurant of San Francisco had been accepting Bitcoin virtual currency since past few months.