I am a developer and I know how hard it is to solve difficult issues while programming in case you did not get any help. I have faced this so many times. That's why I started this blog so that I can share problems and solutions with developer community. In case if you face any issue in programming do check my blog once, it will surely save your time.

Thursday, March 30, 2017

This blog is coming out of conversation with one of the developer in my team. He recently made some changes in API in local development and push code to test server. But on server it was throwing an error and API was not working. So after trying hard for sometime he came to me and asked for help. He showed me lines of code he has added and as an experienced person I immediately caught his error. The problem was, he declared variable in lowercase and was using variable with uppercase in next line and that's what breaking on server. Something like this

$var = new Class();
$VAR->prop = value;

Case sensitivity is one of the major reason for errors while you are working on local development environment with XAMPP, WAMP in Windows. At this time case sensitive is not applied and it will treat

$var;
$VAR;
$Var;

as one and the same variables. But when you are working on server, you have unix / linux operating systems like Ubuntu, Fedora etc. At this time case sensitivity is applied and

$var;
$VAR;
$Var;

Are treated as three different variables. So by mistake if you declare it with lower case and try to use it upper case, it will give you an error. So if you are facing this issue that, code works on your local machine, but does not work on server look for the case sensitivity.

Same goes for the filenames and class names. If you have adde file with name

Myclass.php

and if you include it with

include 'MyClass.php';
require 'MyClass.php';

Then it will not be able to find file and it will throw warning or fatal error if you are using require. So make sure that you maintain case sensitivity while naming your class, variables and files in PHP because ultimately your code will be pushed to UNIX / LINUX server and it is case sensitive.

Thursday, March 16, 2017

Recently we have been discussing to add a chatbot for our new venture and that lead me to write this article on why a business will need a chatbot and what are the advantages of it.

What is a Chat bot?

In a very simple definition, a chat bot is a computer program designed to simulate conversation with human users, especially over the Internet.

So yes a chat bot is nothing but a computer program which can handle communication with users over the internet using the smart and artificial intelligence programmed in it by the developers. So in a way chat bot is your virtual customer care executive which does not exits in real life but it's in computer. Many of the businesses and website have real time talk to customer care on their website. You start a chat and in few moments you got a reply from one of the executive. But may times it's not human it's bot replying to your queries and helping you in finding a solutions to your problem. It talks like human, it behaves like human and it lead conversions like human but the fact is it's chat bot program which is replying to you. Many of the businesses are using the chat bots successfully and many of the companies are developing chat bots. Real challenge right now in chat bot development is that you have to make it really really smart to handle all types of conversation and with the increasing use of Artificial intelligence, machine learning and deep learning, natural language processing chat bots are becoming smarter and smarter. Even smarter than human as well.

One of the biggest trends in social media, specially social messaging apps, are bots and bot stores. Technology analysts predicted that bot stores will be the biggest thing since the rise of app stores. in 2017 we will see many developments on chat bots. Most of the businesses will opt for chat bot services to improve their business practices and customer care. Here are some reasons on Why Your Business Needs a Chat Bot

1) 24 X 7 Customer care

Computer do not eat, computer do not sleep, it needs only constant power to be on for 24 X 7 hours. So if you are using chat bot for the customer care, your customers will get 24 X 7 hours services. They can contact you any time and your bot will reply to them on behalf of you. This way your customer will be much satisfied and you can attend customers queries across the globe and different time zones. You don't need a call center and team of executives to handle it and it's cost effective too as you don't have to pay salary to customer care executives and do not need to invest in customer care center infrastructure, just invest in a chat bot and it will work for you all the time.

2) Better Customer Engagements with Buying Influence

Most of the companies selling online their services and products are using chat bots customer engagement. A customer browsing through your websites, products and services online on your website and chat bot can give more options to your customers based on customer preference and it will be more interactive experience to your customers and users as they feel it as a very personalized approach and they will be happy with this and you will get better customer engagements with this. Also chat bot can ask for the user preferences like what style they want and what brand they want and based on that, it will suggest the buying options thus influencing customer with more buying options.

3) Boost Social Media Engagement

In April, Facebook announced it would be opening up its increasingly influential Messenger platform in beta — and allowing brands to start using chatbots there. Not only can this help brands to achieve better sales, but it’s also a natural way with which to bolster social media engagement. By deploying a useful chatbot on Facebook, you’ll be far more likely to attract users on to your business page – where you are hopefully already bending over backwards in order to drive sales and engage with consumers on a personal level.

4) Simplify Your Business Processes

A chat bot is not just for the customer care and sales, it can even help you with your businesses. A custom chat bot designed for your business can help you simplify your business processes and let you be more productive in your business. A chat bot can also take business decisions based on certain parameters and help you in maintaining flow of your business.

In a way, chat bot is going to take industry by storm in upcoming years and chat bot will act as

Saturday, March 11, 2017

What is the Internet of Things?

Now a days we hear lot about this phrase, Internet of Things or IOT. The IoT refers to the connection of devices other than typical fare such as computers and smartphones to the Internet. So any device other which is able to communicate with Internet can be referred as IOT. So your smart car, wearable devices like heart monitors, your kitchen appliances or your smart TV can be considered as IOT as it's able to communicate with internet for different purposes. So a network of internet-connected objects able to collect and exchange data using embedded sensors and any stand-alone internet-connected device that can be monitored and/or controlled from a remote location is considered as Internet of Things. IOT is really growing in market. HP did a small survey in which they estimated the rise of connected devices over the years and the results are surprising. By 2025 1 trillion devices will be connected to internet. These devices will bridge the gap between physical and digital world to improve the quality and productivity of life, society and industries.

Here are 5 Best Examples of Internet of Things in Real Life

1) Intelligent Fridge by Samsung

The ‘Family Hub’ refrigerator is equipped with a 21.5 inch HD LCD resolution screen, which allows consumers to use a calendar, post content, pin photos or write your notes. Additionally, you can look inside their fridge at any time with the help of cameras that are embedded in the fridge itself. Lastly, healthcarethe consumer can use the fridge to purchase things online, manage recipes and compile and compare shopping lists. You can read more about it from following link.

2) Apple / Samsung Smart Watch

And the most talked company of gadgets and devices. Apple has changed the world with its inventive and ultra-modern devices. Be it phones, laptops or any other electronic device, Apple has itself strongly established. The Apple watch is the example of how advanced the technology is at Apple. Apart from time and date, the Apple watch enables you to keep a track record of your health and daily activities. Samsung also have launched the smart watch samsung gear S3 to take on Apple watch. You can read more about this at following links.

3) Philips-Hue Bulbs

Philips hue bulbs have now stepped into a new stage of innovation with these smart bulbs. Linked with your mobile phones, you can now actually control the intensity of lights on your fingertips. The combination of bulb with mobile technology is next thing for your home. Instead of going for different watt of bulbs to suit the mood and the environment, simply change the intensity from dim to medium to full using your phone. You can read more about it from following link.

4) Connected Mascara by L’Oreal

L’oreal is working on interactive cosmetics, able to give its customers a useful how-to content. Imagine your mascara suggests you what type of make-up should you choose to match your outfit. Insane? Actually, it may become part of our everyday reality pretty soon. You can read more about it from following link.

5) Mimo Monitors

They have been around for some time now. Mimo Monitors are not only affordable but also presents a new technology. Used for several business purposes, this loT has been making things easier, simpler and is said to be very productive. But now Mimo Monitors offers something unique and unexpected. The technology now enables you get updated to your baby’s body position, their breathing level, body temperature, response to activities and health. More you can read it following link.

Now we will cover some of the basic fundamentals that you should be clear with, when you start your carrier as fresher. In this post we will see about Object Oriented Programming commonly referred as OOP or OOPS.

This is most important fundament of software engineering now a days. When I interview a freshers of the post of the developers, this is my first question to them. "Tell me Three Main Principles of Object Oriented Programming". When someone fails to answer this question, I do not go further in interview and let them go. In my opinion every fresher should know about concepts of OOP. That's the crux of software development. Now a days no matter what language you use, all of them supports OOP. Be it JavaScript, PHP, C# or Java or anything all of them support OOP only implementation if different and if you are clear with fundamentals of OOP then you can implement in any of the languages. As fresher this is what is expected from you and that's why language like C++ and Java is included in almost all the courses of Computer science.

During my tenure in IT industry, I have interviewed many freshers and very few time I get satisfactory answer on concept of OOP. Some freshers knows only the name of concept but they can not explain it further. Some of them can explain it but with great confusion. When I ask them why they don't know about it, they say "We think it's not important" Now that's the biggest mis understanding. OOP is followed in most of the development in business applications. So you should be clear with fundamentals of OOP.

Why OOP was introduced?

Object oriented programming concept was created because of the need to overcome the problems that were found with using structured programming techniques. In earlier days programmers used to write many lines of code because OOP was not there. With the the OOP number of lines of codes is reduced because it makes your code reusable and easy to maintain. Any business application is going to change over the period of time and these changes should be easy to do. With OOP it is possible now. Major frameworks are built on concept of OOP and when you are using that framework, you should be knows how the OOP is used in there. Then only you will be able to work with it. Major software design patterns like MVC also works on OOP. So no matter what language you use, OOP is involved in it. So it is required that you understand OOP concepts and use it in your work.

Also there are other advantages of OOP

Code Reusability

OOP provides a clear modular structure for programs

OOP makes it easy to maintain and modify existing code

Now lets see the three main principles of OOP.

Abstraction / Data Encapsulation / Data Hiding

Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Implementation details of a class are kept hidden from the user. The user can only perform a restricted set of operations on the hidden members of the class by executing special functions commonly called methods.

So for the simple example, when you implement a class and define private members of the class, those members will be accessible only inside of the class. If you want to expose some of the functions and members to outside world, it will be declared as public. Here are some of the key things related to Abstraction / Data Encapsulation

Class

Abstract Class

Static Class

Static Methods

Modifiers like public, private

Constructor

Friend Functions

I will not give details about it as there are tons of articles available over the internet.

Inheritance

One of the most important concepts in object-oriented programming is that of inheritance. Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast implementation time. When creating a class, instead of writing completely new data members and member functions, the programmer can designate that the new class should inherit the members of an existing class. This existing class is called the base class, and the new class is referred to as the derived class.

Here are some the key things related to Inheritance.

Single Inheritance

Multiple Inheritance

Multilevel Inheritance

Hybrid Inheritance

Overriding

Modifiers

Polymorphism

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. One function with different parameters is also referred as polymorphism. Polymorphism usually comes to picture when we use inheritance and when we have parent and child class relationship.

Here are some the key things related to Inheritance.

Method Overriding

Method Overloading

So learn about OOP understand it's principles and other related stuff mentioned above if you want to establish yourself as good developer.

Thursday, March 9, 2017

The machines haven't taken over. Not yet at least. However, they are seeping their way into our lives, affecting how we live, work and entertain ourselves. From voice-powered personal assistants like Siri and Google Assistant, to more underlying and fundamental technologies such as behavioral algorithms, suggestive searches and autonomously-powered self-driving vehicles boasting powerful predictive capabilities, here are several examples and applications of artificial intelligence in use today.

1) Siri in iPhones and Google Assistnat in Android

Everyone is familiar with Apple's personal assistant, Siri. She's the friendly voice-activated computer that we interact with on a daily basis. She helps us find information, gives us directions, add events to our calendars, helps us send messages and so on. Siri is a pseudo-intelligent digital personal assistant. She uses machine-learning technology to get smarter and better able to predict and understand our natural-language questions and requests.

To take on Siri Google recently introduced Google Assistant. The same voice operated software like Siri to do things on your android phone . You can ask it anything like to search places, translate between languages, calculate something etc. You can tell it to do the things like setting up reminder, send message, call contact.

2) Tesla

Tesla is quite possibly one of the best cars ever made. Not only for the fact that it's received so many accolades, but because of its predictive capabilities, self-driving features and sheer technological "coolness." Anyone that's into technology and cars needs to own a Tesla, and these vehicles are only getting smarter and smarter thanks to their over-the-air updates.

3) Nest

Nest is the most famous name in Home Automation Technology. Most everyone is familiar with Nest, the learning thermostat that was acquired by Google in January of 2014 for $3.2 billion. The Nest learning thermostat, which, by the way, can now be voice-controlled by Alexa, uses behavioral algorithms to predictively learn from your heating and cooling needs, thus anticipating and adjusting the temperature in your home or office based on your own personal needs, and also now includes a suite of other products such as the Nest cameras.

4) Alexa

Alexa is other famous name in Home automation technology. When Amazon first introduced Alexa, it took much of the world by storm. However, it's usefulness and its uncanny ability to decipher speech from anywhere in the room has made it a revolutionary product that can help us scour the web for information, shop, schedule appointments, set alarms and a million other things, but also help power our smart homes and be a conduit for those that might have limited mobility.

5) Netflix

Netflix provides highly accurate predictive technology based on customer's reactions to films. It analyzes billions of records to suggest films that you might like based on your previous reactions and choices of films. This tech is getting smarter and smarter by the year as the dataset grows. However, the tech's only drawback is that most small-labeled movies go unnoticed while big-named movies grow and balloon on the platform.

What is Machine Learning?

Machine learning is a type of artificial intelligence (AI) that provides computers with the ability to learn without being explicitly programmed. Machine learning focuses on the development of computer programs that can change when exposed to new data. Evolved from the study of pattern recognition and computational learning theory in artificial intelligence, machine learning explores the study and construction of algorithms that can learn from and make predictions on data. The process of machine learning is similar to that of data mining. Both systems search through data to look for patterns.

Machine learning is now widely used by many software manufactures. Most of the IT companies are now investing in Machine learning. Developers are working on creating complex algorithms to enhance machine learning in systems and provide more intelligence to end users. Here in this blog we will see five real world examples of machine learning.

1) Word prediction and corrections in Office 365 by Microsoft

Just when you thought Google's AI products are the best, Microsoft strikes back with AI in Microsoft Word that blows away Google Docs. The recent version of office 365 has mind blowing machine learning added in word prediction and corrections. It just don't correct it but it will also learn from your way of writing and learns the words which you use frequently. It's really awesome. You can read more about it on following link.

2) Facebook and Machine Learning

Facebook builds its business by learning about its users and packaging their data for advertisers. It then reinvests this money into offering us new, useful functionality – currently video and shopping - which it also uses to learn even more about us. Facebook achieve its goals of providing greater convenience to users, and enabling them to learn more about us. You can read more at following link.

3) JP Moragan Software COIN

The program, called COIN, for Contract Intelligence, does the mind-numbing job of interpreting commercial-loan agreements that, until the project went online in June, consumed 360,000 hours of work each year by lawyers and loan officers. The software reviews documents in seconds. COIN is just the start for the biggest U.S. bank. The firm recently set up technology hubs for teams specializing in big data, robotics and cloud infrastructure to find new sources of revenue, while reducing expenses and risks. Read more at below link.

4) Google's Self Driving Cars

Google's self-driving cars can tour you around the streets of Mountain View, California. Google has mapped 2,000 miles of road. The US road network has 4 million miles of road. Google's team uses machine learning algorithms to create models of other people on the road. Every single mile of driving is logged, and that data fed into computers that classify how different types of objects act in all these different situations. While some driver behavior could be hardcoded in ("When the lights turn green, cars go"), they don't exclusively program that logic, but learn it from actual driver behavior. You can read more about it on following link.

5) Google Maps use Machine Learning to Predict Parking Difficulty

Google Maps now tackles parking problems as well. Google quietly launched a new parking feature for Google Maps on Android across 25 major US cities. If you are in these metro areas, you will now see a red parking sign that indicates limited parking availability to help you plan your trip. The interesting part of this update is that it does not rely on internet-connected parking meters; which often provide incomplete or wrong information due to illegal parkers or those who depart early from their spot. Instead, Google Maps combined crowdsourced data and relatively simple machine learning algorithms to classify parking difficulty. You can read more about it at following link.

Tuesday, March 7, 2017

If you are using MAC OSX for development for say android, Laravel, Sencha , Java, Composer then you must have faced this issue. There are SDKs for this development and it's installed some where in your disk and it has certain executable which you can use on command line. For example to create laravel application on your disk you can go to terminal and go to place where you want to create your application and type following command.

laravel new MyApp

But most of the time you get an error command not found. Same with the other development. So if you are using OSX and get command not found error on your terminal, that means you have to set PATH of that command to your PATH variable in OSX. In this blog I am going to mention how to do this.

$PATH variable is very similar to environment variable on windows. Once you add path of command to $PATH variable, you can execute that command from anywhere in terminal. If you want to see what is current values in your $PATH variable. You can go to terminal and type following command.

echo $PATH

and it will show you current values stored in your path. Easy and best way to set value in $PATH variable is through bash_profile file. On OSX each user will have bash_profile file that has this $PATH variables stored. Here you can append new PATH to your SDK to execute certain command. For that first of all open bash_profile file. Go to terminal and type following command.

nano ~/.bash_profile

It will open your bash_profile file. It will look something like this.

Here go to end of the file and add your new PATH here. For that first of you have to find out absolute path of command on your disk. For example in case of laravel. SDK is stored at path

/Users/hirendave/.composer/vendor/bin

Same way for your command and SDK you have to find out the exact path and add it $PATH variable. Go to end of the file and add path. For example for laravel.

export PATH=/Users/hirendave/.composer/vendor/bin:$PATH

Here we are just appending new value to existing values. To save this click

control + X

It will show below message.

Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?

Type Y here and hit enter. It will confirm from you to save changes to .bash_profile file. Hit enter again and it will close the file and take you back to terminal. Now close all the terminal and launch it again and type the command it will surely work.

So for all the command you want to use on terminal, you can use this trick to save path in $PATH variable to that can be used from anywhere in terminal.

Monday, March 6, 2017

Recently I was using Google Maps API to geocode address with PHP. There were thousands of addresses in CSV and I have to read it one by one and do geocode it and get lat long and other missing info of the address. So I was using file_get_contents function to fire HTTP request and get output like this.

That's because some of the addresses in the CSV were not properly formatted and there were some special characters in it as addresses were copied from web pages. But the problem was it's eventually breaking the execution of the script. So to fix it use PHP curl instead of file_get_contents. As it does not throw exception on bad request but it gives you response code and that you can check before you get output. So here is my code.

So as you can see on above code, we are using checking CURLINFO_HTTP_CODE, if it's 200 that means HTTP request is successfully executed or in case there is a bad request you can check it and skip accessing the output. So it won't throw an error.