Is IOT going to be the next superhero for this generation??


IoT.jpg

You’ve likely heard the term Internet of Thingsat some point from a colleague, an article, or an advertisement. But the term is very broad & its changing the way we used to live. Now we are moving in an era where technology is dominating the world, but this time it’s for good. Many of the people is not used to a word called IOT, but believes me or not somehow you are the part of this transformation.  IoT companies is growing day by day a range of lighting manufacturers, connected technology companies and industry groups have come together to form a new industry alliance.

In short, the Internet of Things refers to the rapidly growing network of connected objects that are able to collect and exchange data using embedded sensors. To help and clarify how IoT works we have some of the application for you that i am going to tell you.

Applications of the Internet of Things…….

Smart Home

At that moment smart home is one of the most popular IOT application that we have, because it is one that is very affordable and readily available for the consumers. Smart home basically contains a product that is connected by your device, suppose that you are driving home on a hot summer day so you can simply use your smartphone when you are on your way to tell your smart thermostat to lower the temperature, that is IOT for you.

Smart cities

You never judge what is the potential that IOT have, for judging IOT we need to advance our thinking process. It has the potential to solve problems that a common man face in a daily routine, so i can say it’s the new Spiderman for this world that can save you from troubles. But it wasn’t a joke it really can, with proper connection & infrastructure it has the power to saves you from traffic congestion issues, crime and pollution.

Wearables

Now we are in 21st century, and watches are no longer just for telling time. The Apple Watch and other smart-watches on the market have turned our wrists into smart-phone holsters by enabling text messaging, phone calls, and more. And device like Fitbit have helped revolutionize the fitness world by giving people more data about their workouts.

We @ carmatec caters IoT solutions to its wide customer base to collect & secure data into the best available Cloud Technology by upgrading the systems.

5 upcoming Web Design Trends for 2017


5 upcoming Website Design Trends for 2017

Having said that, we have compiled a list of 5 of the latest website design trends that are going to reign over the digital market-space in the year 2017 and beyond. This list is meant to provide you with a general guideline on what design elements are more likely to work this year, as compared to their counterparts. However, it goes without saying that the website design basics will still continue to remain as important as ever.

1. Responsive layouts

2. Overly Simplified Menus

3 Minimalism accompanied by Micro-interactions

5 Breaking out of the grid

Read More : 5 upcoming Website Design Trends for 2017
Qatar Carmatec Professional web design company in Qatar offer web design service through out Doha Qatar. A digital agency focused on creating custom websites, mobile apps & digital marketing to grow brands online.

Step-By-Step Guide to Building Your First Ruby Gem


Step-By-Step-Guide-to-Building-Your-First-Ruby-Gem.png

Nowadays all the functionalities in Rails are built as Ruby gems. For example we can use devise gem for the authentication part of the application. It’s like a package or library that is written in Ruby programming language. Moreover it can be imported and used by others in their programs.

Step 1
Bundler is like a dependency management tool for Ruby, which is also used by Rails. We will use Bundler for the basic gem structure. It helps us to install the correct versions of the gem and forces us to use the same in the application. So the command for that is, gem bundler install
After bundling, we should specify the gem “name” that we are going to create i.e. Bundle gem “testgem” will create a repository shown below

ruby-gem - Step-By-Step Guide to Building Your First Ruby Gem
So in this we can see the basic gem structure. Under the lib folder, version file will be used to mention the version of the Gem. We can edit the version as per our convenience and release it that will be the version in Rubygems.

rubygem - Step-By-Step Guide to Building Your First Ruby Gem

Step 2
We will consider testgem.gemspec, with testgem as the name of the gem that we will create for sample. It will be used to set up the gem on rubgems, for e.g., name of the gem, summary, description, files that are required in this project, test files that are used to testing the files in the project etc.

ruby-gem-1 - Step-By-Step Guide to Building Your First Ruby Gem
Rake file: – This makes releasing the new versions of the gem, and also helps other developers to check the test cases if they are going to modify the particular gem.
After the rake, we should create a test folder and test cases for each segments will be included here in the app directory.

Step 3
Planning to make a rubygem, then we need to analyse the requirements what to build up and what all functionalities should be included in that.
While generating, we should create a sample.rb file inside lib folder and create own class with namespace because the other plugin has also the same classes then it will get conflict in the names. And require the sample.rb file in the testgem.rb file like reqiure “testgem/sample”.

Step 4
We have require “bundler/gem_tasks” in rake file so when we run rake release, it will release the gem to ruby gems and make it available. Push to git repository

RubyGems are commonly used in Applications
1) Rails – Rails is a ruby gem
2) Better Errors / Rails Footnotes – Debugging tools for Rails/Rack apps.
3) Resque / Delayed Job / Sidekiq – Used for creating background jobs, placing them on multiple queues, and processing them later.
4) Cancan / Devise – Authorization / Authentication Gems for Ruby on Rails.
5) Letter Opener – Test your emails within the browser itself.
6) Discourse – Discussion Forum.
7) Carrierwave / Paperclip – Classy solutions for file uploads for Rails.
8) Whenever – Cron jobs (scheduled tasks) in Ruby.
9) Thin / Unicorn / Puma – Web servers.

RailsCarma provide end to end Ruby on Rails Development services including, consulting, architecture, building, management and extension to companies around the globe. You can also hire Ruby on Rails developers with an easy to hire process. Contact us to know more.

Application API with Ruby on Rails


application-api-with-ruby-on-rails

What is an API? Why API in ROR?
An API is an application programing interface. It’s an interface between inside and outside where outside interact with inside using codes. So the inside could be a server or devise like mobile, IPad, software libraries like Ruby on Rails, JQuery etc., interacting with HTTP through the web.
API’s are built as a component of the application. Basically we need to have a web API if we want to store and process our data in server and let any other application (web application, mobile application, iOS devices etc.) request and get data from that server if needed. These other applications can be part of your system or you can open your data for others to use.

Advantages of Building an API
We can separate the front end into Angular JS, Ember JS, or other popular client frameworks for building customized UI.

Advantages :

  • Lots of flexibility
  • Lower maintenance cost
  • Higher scalability
  • Simplicity
  • API development also allows you to easily integrate other user interfaces, which saves a lot of time.

Disadvantages of building an API

  • Since the coder is sending message repeatedly with redundant information, it adds up to the bandwidth.
  • Negligible latency
  • Use of headers is clumsy and ties the API to HTTTP Response.

REST API in Rails
Representational state Transfer convention for Hadoop developed in Web.is the software architectural style for the web. The architecture is used for giving flexibility to retrieve data through some endpoints. It runs over HTTP protocol.

How does one makes an API REQUEST?
URL = HTTP, HOSTNAME, URI
E.g. URL: -https://portal.ehealthpro.com/blogs

     Screenshot-from-2016-07-05-092406 - Application API with Ruby on Rails           Screenshot-from-2016-07-05-092406 - Application API with Ruby on Rails                    Screenshot-from-2016-07-05-092406 - Application API with Ruby on Rails

Protocol       SERVER              URI

Each resource has two URI’s, one represents the collections of the list i.e., https://portal.ehealthpro.com/blogs and other represents the item, i.e. it represents the single item in that collection   https://portal.ehealthpro.com/blogs/12
For building an API, We can use the Gem called “gem rails-api”
https://github.com/rails-api/rails-api , Generally, API needs to respond to uniform resource identifier (URI) and HTTTP. So,

In Routes,

Rails-Development-1 - Application API with Ruby on Rails

Namespaces

Rails generator create a Userscontroller and related routes specs. In the above routes, by defining a namespace under the routes.rb file, Rails will automatically map that namespace to an index coordinating the name under the controllers folder, the api/ directory. And the response we are acheiving via JSON format, so we just need to specify this format as the default one. Setting the API under a subdomain due to escalate the application to a DNS level.
And path option is to set the starting path for any request to be root in relation to the subdomain.

Versioning

Versioning the  application provides the basic structure to the API, and also when changes needs to be  done then we  can give developers the opportunity to adapt for the new features while old ones are being deprecated. In order to set the version for the API, we first need to add another directory under the API we created i.e. “v1”.we can add scope our API into different versions according to our convenience.

Scope module: :v1,
Constraints: ApiConstraints.new(version: 1, default: true) do
………
End

Generating the Controller
Command use to generate the User controller, rails generate controller API:: v1::users

In controller we need to do the requests respond with JSON data, Technically JSON is a lightweight data-interchange format, a collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
In rails, there is a gem called Active model serializer for implementing the JSON response. By using this gem we will get the proper format of the JSON.
Active Model Serializer is a great way to build JSON responses using an object oriented approach. The objects have a very similar feel on how your ActiveModel object is set up in terms of attributes and relationships. It likewise permits you to pick your connector to decide what type of JSON structure is produced-or to build your own.

railsdeveloment2 - Application API with Ruby on Rails

HTTP Status code, is just way to uniformly tell the person what the respond is, whether the response shows error or not.
And some of the status code are,
200 – OK , Successful Get
204 – No content, Successful Delete or Post
201 – Created – Successful Post
422 – Unprocessable Entity
401- Unauthorized, Authentication Failure

SECURITY
For the security reason in our API application, we can use HTTPS,
Rails.application.configure do
config.force_ssl = true
end

Finally,Testing the API,S
comand line: – curl or htttpie
Browser: – Postman, JSON-Formatter
Rspec :- Request Specs
Rails Minitest :- Integration tests

RailsCarma has been providing ruby on rails development and consulting services from past 8 years Our developers are well versed in doing all kinds of ruby on rails development work and handling any kind of project. Contact us to know more about our development skills and the projects which we can handle.

Source: Application API with Ruby on Rails

Essential & Useful Ruby Gems for Rails 4


Essential & Useful Ruby Gems for Rails 4

Ruby on Rails framework is a powerful tool for building web applications. It is easy to learn and it comes with plenty of built-in functions which help to speed up the development of your web application such as an object-relation mapper and routing. Ruby on Rails uses the MVC pattern to organize application programming. Ruby gems makes development much easier. They are packaging systems designed to facilitate the creation and distribution of Ruby programs and libraries.

Check out some of the best Ruby on Rails gems for Rails 4.

CarrierWave

Using this gem you can upload files in your applications. It store them on different back ends. It supports a variety of ORMs, frameworks and image processors such as ImageMagick and GraphicsMagick. CarrierWave keeps your code clean, reusable and it is easy to test.

To install :

$ gem install carrierwave

To add to your Gemfile:

gem “carrierwave”

To generate an uploder :

class AvatarUploader < CarrierWave::Uploader::Base
storage :file
end

The about command will give you a file in app/uploaders/image_uploader.rb

Sidekiq

There are many gems for background processing, Sidekiq is the one of the most popular one and it uses threads to perform jobs at the same time in the same process and it is compatible with Resque. Sidekiq supports sending emails asynchronously with Action Mailer out of the box. The reason behind its popularity is the simplicity of its API.

Gem Installation : gem install sidekiq

Bullet

Bullet gem is designed to help you increase your application’s performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading, when you are using eager loading that is not necessary and when you should use counter cache.Best practice is to use Bullet in development mode or staging mode.

Draper

Draper gem provides decorators which bundles view logic in an object oriented fashion. It helps make your views much cleaner and lets you avoid writing helpers
To install Draper gem below line to your Gemfile:

gem “draper”, “~> 1.3”

PaperTrail

paper_trial gem is used to track your model changes for auditing, and it stores the pre change version of model. Also, it does not waste space storing a version of the object as it currently stands, PaperTrail stores the values in the Model Before column. Other auditing plugins store the after column. PaperTrail makes reverting to a previous version easy, PaperTrail can restore three types of associations: has_many_through, has_many, and has_one.

To install Paper Trial gem below line to your Gemfile:

gem “paper_trail”

Active Admin

Active admin is Ruby On Rails plugin. Using this framework you can create an admin interface to manage you data and this gem is highly customizable.it simple for developers to implement beautiful and elegant interfaces with very little effort. To install this gem add line to you gem file and run buldle install, after installing the gem, you need to run the generator. By default this gem is using Devise, and the generator creates an AdminUser model.

gem “activeadmin” # to install gem
rails g active_admin:install   # creates the AdminUser class

Strong parameters

Rails 4 requires you to whitelist input values for your app. This feature is known as Strong Parameters. It adds an extra layer of security that prevents attackers from posting harmful or garbage information to your application.

To install Strong Parameters gem below line to your Gemfile:

gem “strong_parameters”

AxlsxRails

axlsx_rails provides a renderer and a template handler. It adds the: xlsx format and parses .xlsx.axlsx templates. This lets you take all the Axlsx code out of your controller or model and place it inside the template, where view code belongs, axlsx provides three options for initializing a spreadsheet:

1. xlsx_author (String) – The author of the document
2. xlsx_created_at (Time) – Timestamp in the document properties (defaults to current time)
3. xlsx_use_shared_strings (Boolean) – This is passed to the workbook to specify that shared strings should be used when serializing the package.

If you think Ruby on Rails is a great option to build your application, get in touch with us to know how we can help you!

Splitting Monolithic Rails Application to Microservices


As a business gets bigger, they require more functionalities and thus you can’t help but add new models/controller to the existing Rails application and sometimes it becomes a monolith. If you are facing a monolith application which has become unmaintainable and difficult to deploy, you need to know some ways to manage it. If your team has to go through thousands of lines in order to understand the project and to make some changes, it is time to split them.

When to split application

  • When your tests run for more than 20 minutes.
  • Models grown to several hundred or thousands.
  • Independent functionality.
  • When developers cannot work independently to develop/deploy their own modules.

Different ways to split Monolithic application

  • Using microservices.
  • Using ‘faster’ technologies.
  • Add a bunch of servers.

What is microservice                                                                                                                                           Microservices is a strategical way for decomposing a large project into smaller, more manageable pieces. A microservice is a piece of application functionality re-factored out into its own code base, speaking to other microservices over a standard protocol. To accomplish this, first divide your business requirements into related groups like user management logic, advertising logic, and a web user interface.

Why microservice
The first force that led to the surge in microservices was a reaction against normal monolithic architecture. While a monolithic app is One Big Program with many responsibilities, microservice-based applications are composed of smaller programs, each with a single responsibility. This allows teams of devs to work independently on different services. The inherent decoupling also encourages smaller, simpler programs that are easier to understand, so new devs can start contributing more quickly. Finally, since no single program represents the whole of application, services can change direction without massive costs. If new technology becomes available that makes more sense for a particular service, it’s feasible to rewrite just that service. Similarly, since microservices communicate across a different languages, an application can be composed of several different platforms – Ruby, Java, PHP, Node, Go, etc without any issue.

Advantages

  • Modules can be reused.
  • Deployment goes smoothly independent of whole big application.
  • Easy to add features.
  • Reduces testing time to test one module instead of all.
  • Big applications tend to be harder to maintain that the small ones.
  • Having set of small applications allows us to focus on working on isolated parts.
  • We might have more chance of not breaking other parts of the application.
  • Reliability and fault tolerance.
  • Easy to migrate or upgrade.
  • Technology diversity.
  • If any single application function is not working entire application doesn’t goes down.
  • Makes it easier for a new developer to understand the functionality of a service.

Disadvantages
Because everything is now an independent service, you have to handle requests carefully travelling between your modules. There can be a scenario where any of services may not be responding.
Multiple databases and transaction management can be painful.
Productivity will be less till the microservice base is set.

Monolithic v/s Microservices
The below diagram shows the difference between traditional monolithic app and microservices in terms of human resource, time, maintenance and handling complexity of applications.

image - Splitting Monolithic Rails Application to Microservices

How to set up microservices
Strategical how to shrink the monolithic application is to split the layers like presentation, business logic and data access layers. A typical enterprise application consists of at least three different types of components:

  • Presentation layer – Components that handle HTTP requests and implement either a (REST) API or an
    HTML-based web UI. In an application that has a sophisticated user interface.
  • Business logic layer – Components which are the core of the application where business rules are implemented.
  • Data-access layer – Components having access to infrastructure components such as databases and message brokers.

RailsCarma has been implementing Ruby on Rails applications from its nascent stages for development, training, deploying and contributing back to the Rails Community. Through trusted technical expertise and consummate customer service combined to deliver a delightful experience for clients, RailsCarma provide end to end Ruby on Rails Development ,consulting, architecture, management and extension to companies around the globe. Contact us to know more.

Source : Splitting Monolithic Rails Application to Microservices

How to Translate JavaScript Strings in Rails


Rails I18n and elegant message passing to JavaScript

The process of “internationalization” usually means to abstract all strings and other locale specific bits (such as date or currency formats) out of your application. The process of “localization” means to provide translations and localized formats for these bits.

How I18n in Ruby on Rails Works

The limits of my language are the limits of my world. ‒Ludwig Wittgenstein. With over 6,909 distinct languages in the world and most of them differing in so many different ways (e.g. in pluralization rules), it is difficult to provide specific tools for internalization. However, for unrestricted barriers of languages, Rails I18n API focuses on:

  • providing support for English and similar languages out of the box
  • making it easy to customize and extend everything for other languages

As part of this solution, every static string in the Rails framework – e.g. Active Record validation messages, time and date formats – has been internationalized, so localization of a Rails application means “over-riding” these defaults.

Read more on RailsCarma Blog