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


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.


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.

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.


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

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


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 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 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”


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 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”


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!

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

How to Add Functionality to Ruby Classes with Decorators

How to Add Functionality to Ruby Classes with Decorators

Decorators allow us to add behavior to objects in runtime and don’t affect other objects of the class. Decorators can be applied when you need to dynamically add and remove responsibility to a class. The decorator pattern is a helpful alternative to creating sub-classes. They give additional functionality to a class while still keeping the public API consistent. Let’s look at an example to understand the importance of Ruby Decorators.

consider we have a Tattoo class with a price method that returns 300.

Class Tattoo
def price

Now we will add an extra color as a feature, and the price would be increased by 150

The simplest way is to create a TattooWithColour subclass that returns 450 in the price method.

class TattooWithColour < Tattoo
def price

Next, we need to represent a big tattoo that adds 200 to the price of our tattoos. We can represent this using a BigTattoo subclass of Tattoo.

class BigTattoo < Tattoo
def price

We could also have bigger sized tattoos and they may add further price to our BigTattoo. If we were to consider that these tattoos types could be used with colours, we would need to add BigTattooWithColour and BiggerTattooWithColour subclasses.

With this method, we end up with total of 6 classes. Even Double that the number if you want to represent these combinations with extra designs on tattoo.

Read full article at RailsCarma Blog. 

Components of Hadoop


The previous article has given you an overview about the Hadoop and the two components of the Hadoop which are HDFS and the Mapreduce framework. This article would now give you the brief explanation about the HDFS architecture and its functioning.


The Hadoop Distributed File System(HDFS) is self-healing high-bandwidth clustered storage. HDFS has a master/slave architecture. An HDFS cluster constitutes of a single NameNode, a master server that manages the file system namespace and regulates access to files by clients. In addition there are number of datanodes usually one per node in the cluster, which manages the storage attached to the nodes that they run on.

HDFS exposes a file system namespace and allows user data to be stored in files. Internally a file is split into one or more blocks and these blocks are stored in a set of DataNodes. The NameNode executes file system namespace operations like opening, closing and renaming files and directories.

It also determines the mapping of blocks to DataNOdes. The DataNodes are responsible for serving read and write requests from the file system’s clients. The DataNodes also perform block creation, deletion and replication upon instruction from the NameNode.


The above sketch represents the architecture of the HDFS.


The other concept and component of the Hadoop is the Mapreduce. The Mapreduce is distributed fault-tolerant resource management and scheduling coupled with a scalable data programming abstraction.

It is parallel data-processing framework. The Mapreduce framework is used to get the data out from the various files and data nodes available in a system.The first part is that the data has to be pushed onto the different servers where the files would get replicated in short it is to store the data.

The second step once the data is stored the code is to be pushed onto the Hadoop cluster to the namenode which would be distributed on different datanodes which would be becoming the compute nodes and then the end user would be receiving the final output.

Mapreduce in Hadoop is not only the one function happening, there are different tasks involved like record reader, map, combiner, partition-er, shuffle and sort and reduce the data and finally gives the output. It splits the input data-set into independent chunks which are processed by the map tasks in a completely parallel manner.

The framework sorts the outputs of the maps, which are then pushed as an input to the reduced tasks. Typically both the input and the output of the job are stored in a file-system. The framework also does take care of scheduling, monitoring them re-executing the failed tasks.

Mapreduce Key-value pair:

Mappers and reducers always use key-value pairs as input and output. A reducer reduces values per key only. A mapper or reducer may emit 0,1 or more key value pairs for every input. Mappers and reducers may emit any arbitrary keys or values,not just subsets or transformations of those in the input.


def map(key, value, context)

value.to_s.split.each do |word|

word.gsub!(/\W/, ”)


unless word.empty?





def reduce(key, values, context)

sum = 0

values.each { |value| sum += value.get }



Mapper method splits on whitespace, removes all non-word characters and downcases. It outputs a one as the value. Reducer method is iterating over the values, adding up all the numbers, and output the input key and the sum.

Input file: Hello World Bye World

output file: Bye 1

Hello 1

World 2


Hence ends the briefing about the components of the Hadoop, their architecture, functioning and also steps involved in different processes happening in both the systems of the Hadoop.

There are also some pros and cons of the Hadoop similarly like a coin consisting of two faces which would be discussed in the coming blogs. Complete knowledge of any concept can be possible only once you get to know about the merits and demerits of the particular concept.

Henceforth to acquire complete knowledge of Hadoop keep following the upcoming posts of the blog.

 The Two Faces of Hadoop


  • Hadoop is a platform which provides Distributed storage & Computational capabilities both.
  • Hadoop is extremely scalable, In fact Hadoop was the first considered to fix a scalability issue that existed in Nutch – Start at 1TB/3-nodes grow to petabytes/1000s of nodes.
  • One of the major component of Hadoop is HDFS (the storage component) that is optimized for high throughput.
  • HDFS uses large block sizes that ultimately helps It works best when manipulating large files (gigabytes, petabytes…)
  • Scalability and Availability are the distinguished features of HDFS to achieve data replication and fault tolerance system.
  • HDFS can replicate files for specified number of times (default is 3 replica) that is tolerant of software and hardware failure, Moreover it can automatically re-replicates data blocks on nodes that have failed.
  • Hadoop uses MapReduce framework which is a batch-based, distributed computing framework, It allows paralleled work over a large amount of data.
  • MapReduce let the developers to focus on addressing business needs only, rather than getting involved in distributed system complications.
  • To achieve parallel & faster execution of the Job, MapReduce decomposes the job into Map & Reduce tasks and schedules them for remote execution on the slave or data nodes of the Hadoop Cluster.
  • Hadoop do has capability to work with MR jobs created in other languages – it is called streaming
  • suited to analyzing big data
  • Amazon’s S3 is the ultimate source of truth here and HDFS is ephemeral. You don’t have to worry about reliability etc – Amazon S3 takes care of that for you. Also means you don’t need high replication factor in HDFS.
  • You can take advantage of cool archiving features like Glacier.
  • You also pay for compute only when you need it. It is well known that most Hadoop installations struggle to hit even 40% utilization [3],[4]. If your utilization is low, spinning up clusters on demand may be a winner for you.
  • Another key point is that your workloads may have some spikes (say end of the week or month) or may be growing every month. You can launch larger clusters when you need to and stick with smaller ones otherwise.
  • You don’t have to provision for peak workload all the time. Similarly, you don’t need to plan your hardware 2-3 years upfront as is common practice with in-house clusters. You can pay as you go, grow as you please. This reduces the risk involved with Big Data projects considerably.
  • Your administration costs can be significantly lower reducing your TCO.
  • No up-front equipment costs. You can spin up as many nodes as you like, for as long as you need them, then shut it down. It’s getting easier to run Hadoop on them.
  • Economics – Cost per TB at a fraction of traditional options.
  • Flexibility – Store any data, Run any analysis.


  • As you know Hadoop uses HDFS and MapReduce, Both of their master processes are single points of failure, Although there is active work going on for High Availability versions.
  • Until the Hadoop 2.x release, HDFS and MapReduce will be using single-master models which can result in single points of failure.
  • Security is also one of the major concern because Hadoop does offer a security model But by default it is disabled because of its high complexity.
  • Hadoop does not offer storage or network level encryption which is very big concern for government sector application data.
  • HDFS is inefficient for handling small files, and it lacks transparent compression. As HDFS is not designed to work well with random reads over small files due to its optimization for sustained throughput.
  • MapReduce is a batch-based architecture that means it does not lend itself to use cases which needs real-time data access.
  • MapReduce is a shared-nothing architecture hence Tasks that require global synchronization or sharing of mutable data are not a good fit which can pose challenges for some algorithms.
  • S3 is not very fast and vanilla Apache Hadoop’s S3 performance is not great. We, at Qubole, have done some work on Hadoop’s performance with S3 filesystem .
  • S3, of course, comes with its own storage cost .
  • If you want to keep the machines (or data) around for a long time, it’s not as economical a solution as a physical cluster.

Here ends the briefing of Big Data and Hadoop and its various systems and their pros and cons. Wish you would have got an overview about the concept of Big Data and Hadoop.

Source: RailsCarma


Scaling Applications with Multiple Database Connection

Business requirements keep changing day by day and we always keep optimizing or scaling our applications based on the usage, new feature additions or subtractions. Over all the agile development adds challenges every now and then.

Applications depending on databases can be scaled by separating the database layer and scaling it independently. The OPS team does take care of such infrastructure changes based on the application deployment architecture.

As a programmer, we can configure our application to work with multiple databases. In this document we are going to explain how we can achieve this in a Rails application.

There are 3 different ways to connect extra database to an application

  1. Set-up database.yml
  2. Direct connection
  3. Writing in module

1. Set-up database.yml:

As we know database.yml will be having 3 database connection by default for development, test and production. We can connect another database to all three environments by adding the code shown below.

  adapter: adapter_name (mysql2, postgresql, oracle, Mssql, etc.,)

  database: database_name_development

  user_name: user_name

  password: ******


  adapter: adapter_name (mysql2, postgresql, oracle, Mssql, etc.,)

  database: database_name_test

  user_name: user_name

  password: ******


  adapter: adapter_name (mysql2, postgresql, oracle, Mssql, etc.,)

  database: database_name_production

  user_name: user_name

  password: ******

After setting up database.yml we can connect it in 2 ways based on the below cases

  • Known database structure
  • Un-known database structure

Known database structure:

If we are aware of the database structure, we can create models for each and we can establish the connection in the model.


class OtherTable < ActiveRecord::Base

  self.abstract_class = true

  establish_connection “other_#{Rails.env}”


This can also be inherited by another model

class Astronaut < OtherTable

  has_many :missions

  has_many :shuttles, through: :missions


Un-known database structure:

When we don’t know the database structure we can write only one model and we can make the connection to it. We can do the crud based on the dynamic parameters.


class ExternalDatabaseConnection < ActiveRecord::Base

  self.abstract_class = true # this class doesn’t have a table



  1. Direct connection:

In case 2nd database has not much importance and is used in one or two places we can directly call the

ActiveRecord::Base.establish_connection with credentials and we can interact with that database.



:username =>"user_name",:password => "*********",:database =>  "database_name")

  1. Writing in module:

We can also connect the database from module and included in model as shown below.


module SecondDatabaseMixin

  extend ActiveSupport::Concern

  included { establish_connection “other_#{Rails.env}” }


External database connection:

Database to be connected can be exists on any server. In case it is not on the same server we can give host as IP address of the server where it exists.


adapter:  adapter_name (mysql2, postgresql, oracle, Mssql, etc.,)

  host:  external_db_server_ip (

  username:  user_name

  password:  *******

  database:  db_name

Note: There are few gems available to  magic_multi_connections, Db-charme etc…

Pros and cons:


  • If the application has multiple clients and each wants a different database for their customers.
  • Helps in backups for each client.
  • Another database may be used in another application which may have different adapter.
  • When users report that access is slow, easy to know which DB is causing the trouble.


  • If application is simple with less users
  • Maintenance of code for the rest if any changes on database structure.

Source: RailsCarma