Hackerrank Modified Kaprekar Numbers Solution

This is the solution to the Modified Kaprekar Numbers found in the implementation section of the algorithm domain in Hackerrank. A modified Kaprekar number is a positive whole number n with d digits, such that when we split its square into two pieces – a right hand piece r with d digits and a left hand piece l that contains the remaining d or d−1 digits, the sum of the pieces is equal to the original number (i.e. l + r = n). Screenshot The Code def sendKap(x,s): y=x*x y=str(y)…

Read More

My First webpage using Bootstrap Framework

In this post you will learn to create your first webpage using Bootstrap Framework. Bootstrap framework is a responsive framework. It automatically adjust the site’s layout according to the device in which it is viewed. Responsiveness is given highest priority now a days. This webpage using Bootstrap Framework uses basic components. Designing webpage using Bootstrap Framework is easy and need to less few lines of code. Components used Containers Jumbotron Well Panels You can view the demo of the  webpage using Bootstrap Framework by clicking here. The Code <link href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css” rel=”stylesheet”><div class=”container”> <div class=”jumbotron”>…

Read More

Accepting input from console in Node.Js

In this post, we will demonstrate how to accept input and perform operation in node.js from a console. Node.js is an open-source, cross-platform runtime environment for developing server-side web applications. Node.js applications are written in JavaScript and can be run within the Node.js runtime on OS X, Microsoft Windows, Linux, FreeBSD, NonStop, IBM AIX, IBM System z and IBM i. Screenshot: The Code var readline = require(‘readline’);var rl = readline.createInterface({ input: process.stdin, output: process.stdout});rl.question(“What is your name ? “, function(answer) { // TODO: Log the answer in a database console.log(“Hello…

Read More

Bit Stuffing Code Implementation in Java

This is an implementation of the Bit Stuffing popularly used in data communication, also known as one of the concepts of Framing data bits. To know more please click here. Sample Output: This is a sample output with data binary data entered as 11001111110. Program Code: import java.util.*;public class BitStuffing{ public static void main(String[] args) { System.out.print(“Enter the Binary message: “); Scanner sn=new Scanner(System.in); String data = sn.nextLine(); String res = new String(); String out=new String(); int counter = 0; for(int i=0;i<data.length();i++) { if (data.charAt(i)!=’1′ && data.charAt(i)!=’0′) { System.out.println(“Enter only Binary…

Read More

How to create a WIFI WLAN Hotspot in your Laptop.

Sometime we wanna create a wifi hotspot while we have connected a donggle or wired broadband connection. We use some third party software like virtual hotspot. But here we  DON’T NEED ANY THIRD PARTY SOFTWARES.Screenshots: The command window In mobile show – Wifi hotspot successfully created In mobile – Entering the password In mobile shows – Connected to your PC. The commands: We have to run the cmd as a administration.First check weather wlan drivers are available on your pc or not. C:Windowssystem32> netsh wlan show drivers Now we configure…

Read More

How to make your Pendrive Bootable.

We all have done, installed operating systems using ordinary CD and DVD, and we also have done using Bootable Pendrives somewhere. But here we’ll see how make a Pendrive to a Bootable Pendrive without using any third party software. DOS give the power to make your Pendrive Bootable using some commands. Screenshots: Copy all the required files from the folder where you’ve stored the OS Files and paste in the Pendrive. See here the removable Pendrive is Bootable now. DOS Commands: Open the command window as Administration.First we have to…

Read More

Hackerrank Cavity Map Solution

This is the solution to the Cavity Map problem found in the the implementation section of the Algorithm domain in Hackerrank. The bellow solution is in Python2. In this you are given a square map of size n×n. Each cell of the map has a value denoting its depth. We will call a cell of the map a cavity if and only if this cell is not on the border of the map and each cell adjacent to it has strictly smaller depth. Two cells are adjacent if they have…

Read More

Hackerrank Utopian Tree Solution

This is the solution to the program in Hackerrank. This program can be found in the Algorithm Domain. Basically the Utopian Tree goes through 2 cycles of growth every year. The first growth cycle occurs during the spring, when it doubles in height. The second growth cycle occurs during the summer, when its height increases by 1 meter.  Screenshot The Code: #include<stdio.h>int main() { int t, n, a; scanf(“%d”, &t); while(t–) { a=1; scanf(“%d”, &n); for(int i=1; i<=n; i++) { if(i%2) a<<=1; else a++; } printf(“%dn”, a); } return 0;}…

Read More

Insert Data in MySQL DB using PHP

This is a simple post in php. In this post you will learn how to add data to the MySQL Database. Basically in this post, a form is used which accepts input from the user. A class DBClass is used for interactions with the database. Screenshot The CodeThe Config.php File <?phpdefine(“DB_NAME”,”sample”);//Database Namedefine(“DB_USER”,”root”);//Database Userdefine(“DB_PASS”,””);//Database Passworddefine(“DB_HOST”,”localhost”);//Database Host?> The DBClass.php file <?phprequire_once ‘config.php’;class DBClass{ public function addData($table,$name,$phone,$email) { $con=mysqli_connect(DB_HOST,DB_USER,DB_PASS,DB_NAME); $res=mysqli_query($con,”insert into $table values (‘$name’,’$phone’,’$email’)”); if($res) { echo ‘<script>alert(“Data Succesfully inserted !”)</script>’; } else { echo ‘<script>alert(“Data Not Succesfully inserted !”)</script>’; } } public…

Read More