Elastic Application Performance Monitoring (APM)

Elastic APM is an application performance monitoring system built on the Elastic Stack. It allows us to monitor applications in real time, collect detailed report on performance. It also used to collect unhandled errors and exceptions. This allows the developers to monitor and analyze every part of the code.

APM has 3 components

APM agents
APM server
Kibana APM UI

APM Agents :

APM agents are open source libraries we can install it as we install anyother library. These will
inspect our code and collect performance data and errors at runtime. These data will be sent to the
APM server.

APM Server :

This application was written in GO which enables us the trace the application’s performance and send the report to the APM servers. Then these informations were documented in elastic search.

Kibana APM UI :

For viewing the data stored in APM server we can use the APM UI. Kibana APM UI is the pre-built open source dashboard.

On installing the APM agent library in our application, the application automatically appears in APM UI dashboard.

how to convert the webapp to Android app using cordova.

Cordova is Apache’s tool to convert a web application into a native application. It supports all of the major mobile operating systems.

Now we are going to see how to convert the webapp to Android app using cordova.

Install the prerquisites for cordova and create a new Cordova project.

Open index.html file from our projects root directory.

Update head of the file with the necessary elements such as title, CSS references, and the charset meta tag.

Update the body tag with our app content.

Add the required .js files as reference to the app.

Copying every files except package.json file to the respective folders under cordova project root directory.

Copy the contents of package.json carefully to package.json file under cordova project.

Call your app init logic inside the onDeviceReady method, as below.

Run ng serve for a dev server. Navigate to http://localhost:4200/.

How to create our first app with Cordova?

Once the cordova was installed and a new project folder was created it will contains the following folders.

www is the main directory that includes our application’s HTML, JavaScript, and CSS code along with the application’s starting page.

In the index.html page, there are two main JavaScript-included files, as follows:

cordova.js: This file contains Apache Cordova JavaScript APIs
index.js: This file contains the application’s simple logic

config.xml is the global configuration file for our project.

It specify for which platform, developer wants to create the app.

In config.xml, the content tag is used to specify the first page to open,
<content src=”index.html” />

Plugins folder will contain the plugins added to the app.

For adding cordova plugins use the command

$ cordova plugin add <cordova-plugin-name>

To check the requirements, opem cmd and go to the cordova project folder and type

cordova requirements

It will display the status of the requirements.

Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: installed android-21,android-22,android-23,Google Inc.:Google APIs:22
Gradle: installed

Once all the requirements were installed , we are ready to build our app.

Our apps html code will goes to index.html file.

CSS styles will be entered in the index.css file.

Once the coding and login parts were completed our app is ready to build. For building the app open the project folder in cmd and type

C:\…\…> cordova build android

How to start with Cordova?

Cordova is a free and opensource mobile application development which supports HTML, CSS, and JavaScript, to create mobile applications. It offers a bridge for connection between web app and mobile device. By using Cordova, we can make hybrid mobile apps that can use camera, geolocation, file system and other native mobile functions.

Install Cordova

To install cordova we need NodeJs and git to be installed.

Download Nodejs from http://nodejs.org

Once downloaded run the installation file.

To test the installation open command prompt and type

$ node --version

If the version number is displayed, Node.js is installed and working!

Cordova uses Git in backend so we have to install Git.

Download and install from: http://git-scm.com.

Once we have Npm and Git run the following command,

$ npm install -g cordova

To test the installation use

$ cordova --version

Creating App using cordova

For creating an App using Cordova, create a directory where the app to be installed. Open that directory in command prompt.


Once opened then enter the command with below syntax to create the app

create <app_directoryname> <domainvalue> <app_title>

app_directoryname : folder name where our app data will be stored.

domain value :  Every App has a unique domain value eg: com.myfirstapp.android

app_title : Name of the app.

Add platforms :

To be able to use the specified platform, you need to have installed the specific platform SDK. If we use Android platform we have to install Android SDK. Once the SDK was installed use,

C:\Users\username\Desktop\cordovadirectory>cordova platform add android

How to compile your app using Phonegap?

PhoneGap is a software development framework by Adobe System, which is used to develop mobile applications. Using PhoneGap, one can create apps for all major mobile operating systems like Apple iOS, Android, BlackBerry, Windows etc.

PhoneGap allows its users to upload the data contents on website and it automatically converts it to various App files.

Register here www.build.phonegap.com

Once registed you can use the userid for signin.

In phonegap you have to sign in your android/iOS keystore, for that download Javascript and install.

In commandprompt Run the following command

keytool -genkey -v -keystore [keystore_name].keystore -alias [alias_name] -keyalg RSA -keysize 2048 -validity 10000

Replace [keystore_name] and [alias_name] with any name relevant to the app.

Keystore will ask for a password, enter a new password and confirm it.

It will ask for additional details enter the appropriate details. Enter keystore alias password. Your keystore file is now ready.

  • Go to phonegap dashboard and account>signing keys
  • Now in signing keys page, add key to android.

  • Title can be anything relevant to your app.
  • Alias use the same thing that we used in keystore file.
  • Once uploaded you need to unlock it with the alias password and keystore password.

Go to the apps section and select the app that you wish to sign. Under the build section, you can choose the signing key that you uploaded. After selecting a key PhoneGap build will automatically Rebuild your app for you.

How to promote your content in reddit?

How to submit your link to reddit?

Create an account

Once you have created an account and were active on your subreddit you can submit your link. Go to subreddit’s page and click on “Submit a new Link”. The main thing is to create a catchy title for your posts.

Keep your content more relevant to the users :

Subreddits are subsidiary threads or categories within the Reddit website. They allow users to focus on a specific interest or topic. Choose the right subreddit so that your content is relevant to the specified audience.

Comment and reply to everyone :

You need to start interacting with the community about topics you genuinely care about. By sharing links and posting comments you’ll find that your Reddit karma begins to rise. when you receive more comments for your post, it might be visible to more Redditors to click on your link. Address all the comments in a humble way.

Understanding the redditors :

Then we have to know our reddit audience by studying which post receive the most upvotes. By this we can understand what kind of content the redditors are looking for and how they like it delivered. Understanding the redditors will help us to raise our upvotes.

Share your content with friends

In beginning share your post with your friends. If they like your post and upvote it on Reddit, that might gain the attention of other Reddit users and thereby increases your post engagement.The success or failure of your Reddit content can be tied to the first 10 upvotes or downvotes you receive.

Use tools like “RedditLater” and “Snoopsnoo” for analytics.

How to integrate Paypal to your website

Signup with https://developer.paypal.com/

Go to Sandbox -> accounts and create a test account for seller or buyer.

Then Go to Account -> My selling tools

There you can configure the settings for your website.

1. Paypal buttons : Copy the button code and paste in your page

2. Update the website preference and enter the website url so that paypal will return back to your website

After clicking Buy Now button, the params are sent to Paypal sandbox as mentioned in the form action.

$sql = "SELECT * FROM products";
$resultset = mysqli_query($conn, $sql) or die("database error:". mysqli_error($conn));
while( $row = mysqli_fetch_assoc($resultset) ) {
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<img src="images/<?php echo $row['p_image']; ?>"/>
<div class="caption">
<h4 class="pull-right">Price: <?php echo $row['price']; ?></h4>
<h4>Name: <?php echo $row['p_name']; ?></h4>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- Paypal business test account email id so that you can collect the payments. -->
<input type="hidden" name="business" value="<?php echo $paypal_email; ?>">
<!-- Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<?php echo $row['p_name']; ?>">
<input type="hidden" name="item_number" value="<?php echo $row['id']; ?>">
<input type="hidden" name="amount" value="<?php echo $row['price']; ?>">
<input type="hidden" name="currency_code" value="USD">
<!-- URLs -->
<input type='hidden' name='cancel_return' value='http://localhost/paypal_integration_php/cancel.php'>
<input type='hidden' name='return' value='http://localhost/paypal_integration_php/success.php'>
<!-- payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
<?php } ?>

When the PayPal payment is successful, success message was shown otherwise failed message displayed. On success page, we will receive the transaction information with $_GET variable and insert transaction data into the database.

$item_number = $_GET['item_number'];
$txn_id = $_GET['tx'];
$payment_gross = $_GET['amt'];
$currency_code = $_GET['cc'];
$payment_status = $_GET['st'];
//Get product price to store into database
$sql = "SELECT * FROM products WHERE id = ".$item_number;
$resultset = mysqli_query($conn, $sql) or die("database error:". mysqli_error($conn));
$row = mysqli_fetch_assoc($resultset);
if(!empty($txn_id) && $payment_gross == $row['price']){
//Insert tansaction data into the database
mysqli_query($conn, "INSERT INTO payments(item_number,txn_id,payment_gross,currency_code,payment_status) VALUES('".$item_number."','".$txn_id."','".$payment_gross."','".$currency_code."','".$payment_status."')");
$last_insert_id = mysqli_insert_id($conn);
<h1>Your payment has been successful.</h1>
<h1>Your Payment ID - <?php echo $last_insert_id; ?>.</h1>
<h1>Your payment has failed.</h1>

How to store data in cloud Firestore?

Cloud Firestore is an alternative to firebase realtime database with faster query feature.

Once signed with firebase you can create project in firebase. Once the project has been created you can set Firestore as its database.

On clicking the Create database button, choose “start in test mode” and click enable.

Now a new empty cloud firestore database havebeen created. For adding the content to the database we have to create an instance.

Creating collection and documents:

To write data to the firestore database, create an instance as in below example,

val ProjectDB = FirebaseFirestore.getInstance()

Then you can add collection to your database,

Val col = projectDB.collection("collection_name")

To create a document within that collection


Writing data in document :

    name: "Los Angeles",
    state: "CA",
    country: "USA"
.then(function() {
    console.log("Document successfully written!");
.catch(function(error) {
    console.error("Error writing document: ", error);


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.