How to deploy node js code in heroku?

To use Heroku CLI it requires Git, before get starting with Heroku make sure Git was installed. Once installed, you can use the heroku command from your command shell.

In commandprompt, login with your heroku logins.

$ heroku login
Enter your Heroku credentials.
Email: **********

By using the below commands make sure you have installed all the requirements.

$ node --version
$ npm --version
$ git --version

Create an app on heroku and push the code to it.

$ heroku create

Usually we use the git push command to push our code from local repository to server. we can use the same to push our code to heroku.

$ git push heroku master

once deployed we can open the website using,

$ heroku open

How to create a cloud server (droplet) in digitalocean?

  • Create a new account in digital ocean and login with your email and password.
  • Click Create => Droplets from top right corner.

In the next page we have to choose the configuration options for the droplets.

  • In the first step choose an image from the 3 categories.

Distributions are images without any additional software.

Container distributers include CoreOS, Fedora etc;

One click apps are images that include preconfigured applications.

  • Then choose the size of RAM and storage space required.
  • Next, you’re required to choose the data center regions.
  • Add your SSH keys which provide more security than using a password.

In the final step, choose the number of droplets and hostname. Then click create droplet.

How to use cookies in PHP 7


A cookie is used to identify a user. Cookies are text files stored on the client computer and they are kept of use tracking purpose.

PHP transparently supports HTTP cookies. Browser stores this information on local machine for future use. Server script sends a set of cookies to the browser. For example name, age, or id etc.

A cookie is created with the setcookie() function. Using PHP, you can both create and retrieve cookie values.


setcookie (name, value, expire, path, domain, secure, httponly);  


Setrawcookie(name, value, expire, path, domain, secure, httponly);  

Setrawcookie() is to send a cookie without url encoding the cookie value (for PHP 5, PHP 7)

Only the name parameter is required. All other parameters are optional.

Example Scripts

Create Cookies:

$cookie_value = 'Test_cookie';

setcookie("TestCookie", $value); /* TestCookie is Cookie Name */
setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "", 1);

Retrieve Cookies:

// Print an individual cookie
echo $_COOKIE["TestCookie"];

// Another way to debug/test is to view all cookies

Edit Cookies:

if(!isset($_COOKIE[$cookie_name])) {
    echo $cookie_name . "' is not set!";
} else {
    echo $cookie_name . "' is set!<br>";

   /*Again Set Cookie value to updated (New) value */

   setcookie($cookie_name, 'changed value ', time() + (86400 * 30), "/");
    echo "Value is: " . $_COOKIE[$cookie_name];

Delete Cookies:

When deleting a cookie you should assure that the expiration date is in the past.

// set the expiration date to one hour ago
setcookie("TestCookie", "", time() - 3600);
setcookie("TestCookie", "", time() - 3600, "/~rasmus/", "", 1);

How to Install Blocksci and Trouble shooting it.

Installing Blocksci

Requirements :

If you don’t have enough memory it won’t install easily and

  • Cmake version should be 3.9
  • GCC and G++ should be 7 version

Complete instruction to install Cmake 3.9, GCC, G++ :

If the official manual didn’t work you could follow the below steps:

  • sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  • sudo apt-get update
  • sudo apt install libtool autoconf libboost-filesystem-dev libboost-iostreams-dev
    libboost-serialization-dev libboost-thread-dev libboost-test-dev libssl-dev libjsoncpp-dev
    libcurl4-openssl-dev libjsoncpp-dev libjsonrpccpp-dev libsnappy-dev zlib1g-dev libbz2-dev
    liblz4-dev libzstd-dev libjemalloc-dev libsparsehash-dev python3-dev python3-pip
  • sudo apt-get install g++-7
  • install cmake 3.9 or higher instead of 3.5 (the cmake 3.5 version installed by apt-get install) (or follow this link to remove old version of cmake and get the new version.)
  • sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-7 60 –slave /usr/bin/g++ g++ /usr/bin/g++-7
  • git clone
  • cd BlockSci
  • mkdir release
  • cd release
  • cmake -DCMAKE_BUILD_TYPE=Release ..

Install make :

  • sudo make install
  • cd ..
  • sudo -H pip3 install -e blockscipy (this takes around 2 hours)


How to write a clean code – 6 Tips

This is a tiny post which talks about writing a clean code for a fresher who is trying hard to get success in the IT Industry.

1) Use the meaningful variable names


2) Adding comments is one of the good habits. write comments for every code modifications.

3) Code scouting – When picking up the new code from the Internet, Take some time to read it and try to add methods or split the required functionalities.

4) Functions and sub-functions. Make sure functions are doing its job that its meant to do.

5) Testing – Unit testing is very important, testing the functionality and isolation intensively.

6) Final tips are Practice, Practice, Practice.

Goog Luck!

What is Elasticsearch and how it works?


Elasticsearch is an open-source, distributed, multi-tenant-capable search engine. The term multi-tenant refers to the architecture in which a single software runs on a server and serve more than one user at the same time.

SQL database managements systems aren’t really designed for full-text searches also they will take around 10 sec to list out the results were as Elastic search will perform a full-text search and return the results within few milliseconds.

Elastic search is based on Lucene,which is a open source full-text search engine library written in Java.

Indexing and Retrieving data :

Indexing :

The act of storing data in Elasticsearch is called indexing. In Elastic search each data was stored in simple JSON document. Data can be stored using HTTP PUT request.

Elasticsearch cluster can contain multiple indices which are similar to the databases in SQL. Each indices may contain multiple types. These types hold multiple documents and each document has multiple fields.

PUT /index/type/Id

Example :

Lets imagine a school record of all students.

Here the Index (Indices) may be Class-11, Class-12

Type will be as Student. Here the each student data was stored with the ID of the particular student. The files stored under this type may contains fields like : Name, Register number, Father Name etc.

eg: PUT Class-11 / Student / 1

Retrieving :

Retrieving a document is easy in elastic search where we can simple execute “HTTP Get” request and specify the address of the document.

GET /index/type/Id

eg: Class-11 / Student / 1

Every feature of Elasticsearch is exposed as a REST API:

Index API: Used to document the index.

Get API: Used to retrieve the document.

Search API: Used to submit your query and get a result.

Put Mapping API: Used to override default choices and define the mapping.

Filtering Queries and Aggregations :

Elasticsearch has a single set of components called queries, which can be mixed and matched in endless combinations.

This single set of components can be used in two contexts:

  1. Filtering Context
  2. Query Context

When used in filtering context, the query is said to be a “non-scoring” or “filtering” query.

When used in a querying context, the query becomes a “scoring” query.

Non-Scoring Query is to filter the data which matches with the given query.

A scoring query calculates how relevant each document is to the query, and assigns it a relevance _score, which is later used to sort matching documents by relevance.

Aggregations :

The query returns a certain subset of documents, and the aggregation operates on those documents.

Installing Litecoin cryptocoin data and deploying its blockchain server in CentOS7


Download the above tar file and extract it using following commands
tar xvf litecoin-0.16.0-x86_64-linux-gnu.tar.gz

Starting a litecoin server
Here, first time you need to reindex the whole chain using -reindex command
First time command: ./litecoind –txindex -daemon -reindex

litecoind -server -txindex -daemon -rpc -rpcbind= -rpcuser=theone -rpcpassword=pass123 -rpcport=9332

The above command lets you to download the blocks continously and you can access the server private data using RPC API calls.

Stopping a litecoin server
litecoind stop
if the above command doesnt work
killall -9 litecoind

Litecoin reference (params)

It should automatically download the blocks in the root

Will keep you updated with more commands.


How to Secure Your Social Media Accounts

According to a recent study it was found that we are spending approximately 2 hours in social media every day. The most popular social media platforms have billions of users, and the number keeps getting bigger every year.

Previously the social media platform was considered as a medium to get connected with other people. Now enterprises see them as a valid advertising tools. We can see most android applications are using major social media accounts to validate user identity.

Here are some tips for keeping your accounts secure:

Personal Accounts :

  1. Close your accounts that you’re not using. Hackers can leverage these forgotten account and access other accounts linked to it, like your email,mobile number etc.
  1. Before signing in to any application via your social media login, kindly check if this type of access is necessary.
  1. Please change your password often. And make sure it is somewhat complex or unique.
  1. Keep your mobile app updated. Latest versions with updated security features may protect you from the newest known threats.
  1. If any links or mails seems to be spam kindly report the account as spam. If enough people take the same action, networking service can remove the account.
  1. Use unique email (not your personal email) for all social media account. If possible, create a whole new email specifically for social media accounts so that if you are compromised, the hackers won’t have access to any valuable information.

    Corporate Accounts :

    Now-a-days social media forms the better marketing place for enterprises. They use company’s social media to promote their own brand, gain followers, or even spread a specific message.

  1. Monitor your social media regularly.
  1. Limit access to only the necessary people.
  1. Make sure you won’t share any confidential details in the social media pages.
  1. Always be aware aware of the latest security solutions.
  1. Change your password frequently.

Things to know about 5G Network

5G Network:

5G simply stands for fifth generation and refers to the next and newest mobile wireless standard based on the IEEE 802.11ac standard of broadband technology. The next (5th) generation  wireless network will address the evolution beyond mobile internet to massive IoT (Internet of Things)in 2020. Achieving the 5G vision will require new technology innovations that deliver unparalleled levels of scalability, capability and efficiency.


    • Up to 10 Gbps data rate  – > 10 to 100x improvement over 4G and 4.5G networks
    • 1 millisecond latency
    • 1000x bandwidth per unit area
    • Up to 100x number of connected devices per unit area (compared with 4G LTE)
    • 99.999% availability
    • 100% coverage
    • 90% reduction in network energy usage
    • Up to 10-year battery life for low power IoT devices

5G networks expand broadband wireless services beyond mobile Internet to IoT and critical communications segments.Current 4G mobile standards have the potential to provide 100s of Mbps. 5G offers to take that into multi-gigabits per second. It will have faster download speeds and the ability to run more complex mobile Internet apps.

It’s not just about speed in network connection either 5G is seen as the underlying technology allowing self-driving cars to talk to each other, or for people to wirelessly stream super high-definition virtual reality content into their headsets.

Features :

Millimeter wave:

All cellular networks use spectrum in lower frequency bands like 700 megahertz. The high speed 5G network uses a high frequency spectrum for which the millimeter wave range falls between 24 gigahertz and 100 gigahertz.


Latency is the response time between a click action and its response from the network. In current networks the lag time may be around 20 milliseconds. With 5G that latency gets reduced to 1 millisecond.

Carrier aggregation:

Wireless carriers can take different bands of radio frequencies and bind them together. They can choose the speediest and least congested Carrier.

Unlicensed spectrum:

Currently our networks using licensed spectrum but in 5G it will use unlicensed spectrum so that they can maintain enough coverage. This can increase the access network capacity and benefit users’ wireless experience.

Network slicing:

In 5G a single physical network will be sliced into multiple virtual networks that can support different devices. Same tower can offer low power connection as well as faster,low-latency connection at the same time.

5G in India:

Airtel and Huawei have successfully conducted India’s first 5G network trial. India plans to roll out 5G services for consumers by 2020.

Before the 5G network get launched in India, many smart-phones have hit the market with the feature to support a 5G Sim.

1.Apple iPhone 8
2.Samsung Galaxy Note8
3.Nokia 9
4.Google Pixel 2 / Pixel XL 2
5.Samsung Galaxy S9 / Galaxy S9+
6.LG G7
7.HTC U12
8.Xiaomi Mi 7
9.Huawei P11 / P11 Plus
10.OnePlus 6

How Will Artificial Intelligence Change The Future?

Artificial Intelligence (AI)

Artificial Intelligence (AI) is taking root in our everyday lives. We’re still a few years away from having robots at our beck and call, but AI has already had a profound impact in more subtle ways.

In 1950 Alan Turing, British WWII coder, is one of the first people to come up with the idea of machines that think. He even created the Turing test, which is still used today, as a benchmark to determine a machine’s ability to “think” like a human.

Artificial intelligence is a branch of computer science that aims to create intelligent machines. It has become an essential part of the technology industry. Instead of writing millions of lines of code to anticipate every situation, these new applications ingest vast amounts of data, recognize patterns, and “learn” from them, much as the human brain does.

The term is frequently applied to the project of developing systems endowed with the intellectual processes characteristic of humans, such as the ability to reason, discover meaning, generalize or learn from past experience.

Artificial intelligence can be understood as a set of tools and programs that makes software “smarter” in a way an outside observer thinks the output is generated by a human.

In the most simplistic terms, AI leverages self-learning systems by using multiple tools like data mining, pattern recognition and natural language processing. It operates similar to how a normal human brain functions during regular tasks like common-sense reasoning, forming an opinion or social behavior.

AI is divided into 3 stages :

First Stage : Artificial Narrow Intelligence (ANI)
Intelligence restricted to only one functional area.

Second Stage : Artificial General Intelligence (AGI)
It covers more than one field like power of reasoning, problem solving and abstract thinking.

Third Stage : Artificial Super Intelligence (ASI)
AI surpasses human intelligence across all fields.

Examples of AI technology :

Robotic Process Automation : Robots can be programmed to perform high-volume, repeatable tasks normally performed by humans.

Machine Vision : Machine vision captures and analyzes visual information using a camera. They can be programmed to see through walls.

Virtual Personal Assistants : There are some digital apps such as google map which can answer your question as per your requests. Eg: Where’s the nearest restaurant?

Video Games : The system will counteract your moves in certain games which is also an AI.

Smart Cars : Self-driving cars are moving closer and closer to reality; Google’s self-driving car project and Tesla’s “autopilot” feature are two examples that have been in the news lately.

Fraud Detection : The system will be able to spot a fraudulent transaction based on the signs and indications that it learned through the training exercise.

AI Applications :

In Health care : AI is changing health-care now and will in the future. AI is useful in Managing Medical Records, Digital Consultation, Health-care System Analysis and monitor patient’s condition and follow up with treatments.

In Business : In the business world, artificial intelligence is enabling businesses to work smarter and faster, doing more with significantly less. Companies can now use machines algorithms to identify trends and insights and make faster decisions which helps them to be competitive in real-time.

In Education : The field of artificial intelligence (AI) is having a positive impact on educational applications. AI can assess students and adapt to their needs, helping them work at their own pace. AI could change where and how students learn.

In finance : By analyzing various data points, machine learning algorithms can detect fraudulent transactions that would go unnoticed by human analysts. They are also being used as Chatbots which conducts a conversation via auditory or textual methods regarding the financial or banking queries.