Posts

Showing posts with the label miscellaneous

Bit Stuffing Code Implementation in Java

Image
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 values!!!"); return; } ...

[ FUN CODE ] Couple Or Friend Finder

Image
This is a fun code which is based on love quotient. The love quotient of the names is calculated. If the difference of the love qoutients of the two names is 0, 4, 16, or 32, the pair is declared a COUPLE or else, they are declared as FRIEND. The bellow code is implemented in C++ To calculate the love qoutient of a name individually, take the product of the letters, considering A as 1, Z as 26 and so on. Then perform modulus 36 with that number. For example, DAVE can be calculated as: D * A * V * E = (4 * 1 * 22 * 5) % 36 = 440 % 36 = 8 Screenshot The Code #include<iostream> #include<string.h> #include<cmath> using namespace std; string upper(string x) { for(int i=0;i<x.size();i++) { x[i]=toupper(x[i]); } return x; } void call(string x, string y) { int yc=1,xc=1; for(int i=0;i<x.size();i++) { xc*=((int)x[i]-64); } for(int i=0;i<y.size();i++) { yc*=((int)y[i]-64); } xc=xc%36; yc=yc%36; int dif=std::abs(xc-yc); if(dif==0 || dif=...

QRCode Generator In PHP

Image
This post will guide you to create your own QR code Generator. Basically we will use Google's API to generate the QR code. QR code is a machine-readable code consisting of an array of black and white squares, typically used for storing URLs or other information for reading by the camera on a smartphone. Screenshots[Demo] Home page of the script showing which takes the Input. Generated QR code of the input Given The Code <div style="text-align:center;"> <form class="email" name="qrc" method="post" action="<?php $_PHP_SELF ?>" id='12'> <p align="center"><font color=#99742e><span style="font-size:12pt;"><b>Link</b></span></font></p> <input type="text" name="qrlink" autocomplete="off" placeholder="Enter The Link"><br/> <input class="send" type="submit...

How to add music or video to web page

Image
Adding music/video to Web Page   Music / video can be added to a web page by simply using <embed> html tag. This tag indicates the browser   to include controls for the multimedia which automatically provides browser supports as soon as   <embed> tag is encountered . Some of the attributes which can be used with <embed> tag are as follows: Attribute Name Function align Determines how to align the object. It can be set to either center, left or right. autostart This boolean attribute indicates if the media should start automatically. You can set it either true or false. loop Specifies if the sound should be played continuously (set loop to true), a certain number of times (a positive value) or not at all (false) playcount Specifies the number of times to play the sound. This is alternate option for loop if you are using IE....

Simple Password Generator Using JS

Image
This is a simple password generator using javascript. This script generates random passwords of length 6. These code snippet can be used for those registration systems where user is assigned with an generated password for the first time. This password is based on 6 String sets which shuffle their index and generate a password ! Screenshots[Demo]: The Code: <script> function gene() { var set1='abcdefghi0',set2='jklmnopqu2',set3='ABCDEFG34s'; var set4='HIJtuv569w',set5='xJKL!@#$7',set6='8&_MNOPQRS'; var set7='TUVWXYZ012'; var pas=set1.charAt(Math.floor((Math.random() * 10) + 1))+ set2.charAt(Math.floor((Math.random() * 10) + 1))+ set3.charAt(Math.floor((Math.random() * 10) + 1))+ set4.charAt(Math.floor((Math.random() * 10) + 1))+ set5.charAt(Math.floor((Math.random() * 10) + 1))+ set6.charAt(Math.floor((Math.random() * 10) + 1))+ set7.charAt(Math.floor((Math.random() * 10) + 1)); prompt(...

Image Rotation When Mouse Hovered Using CSS3

Image
This post is all about a simple code snippet using the combination of the CSS3 and HTML which rotates an image at a certain degree when mouse is hovered on it ! This add-on piece of code make your web-page look more trendy. Screenshots[Demo] :   The complete code is divided into two parts, the css and the HTML The CSS part: .hovrot { -webkit-transition: all 0.5s ease; -moz-transition: all 0.5s ease; -o-transition: all 0.5s ease; -ms-transition: all 0.5s ease; transition: all 0.5s ease; border-width: 2px; border-color: #594c2d; border-style: double; height:200px; width:200px; } .hovrot:hover { -webkit-transform: rotate(25deg); -moz-transform: rotate(25deg); -o-transform: rotate(25deg); -ms-transform: rotate(25deg); transform: rotate(25deg); color: #000000; } The HTML part: <img src="img.jpg" class='hovrot' alt='This is a simple Image'/> <b style="position: r...

A Simple Encryption and Decryption Program [Cryptography]

Image
In this post you can learn the basic concept of Cryptography. This program accepts a string as the input and performs encryption with the key provided by the programmer. This is a basic Encryption method so it just involves changing each single character of the String with some simple algebric operations with the key. It can be added with each and every single character of the string, so can be subtracted or divided. But note Your have to apply reverse method. Sample Outputs: The Code: #include<iostream> #include<cstring> using namespace std; void encrypt(string *s,int key) { int i=0; while((*s)[i]!=NULL) { (*s)[i]=(int)(*s)[i]-key; //cout<<(*s)[i]<<endl; //Remove The Comments to perform step by step analysis ! i++; } } void decrypt(string *s,int key) { int i=0; while((*s)[i]!=NULL) { (*s)[i]=(int)(*s)[i]+key; //cout<<(*s)[i]<<endl; //Remove The Comments to perform step by step analysis ! i++; } } int main() { strin...