Posts

Showing posts with the label Utilities

Display Time using Js and Css3

Image
This is a sample post in which you can create a Java script which can display the current time. Basically it fetches the local time from the system every 1 second using setInterval method. Things we have used : Css3 shadows and Hover Properties Date Class with toLocaleTimeString() method setInterval() method. Demo: As you can see when you hover the mouse over it, the color changes. This affect is added using css3. The Code: <html> <style> body { background-color:black; } #time{ display: inline-block; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 10px; border: none; font: normal 48px/normal "Warnes", Helvetica, sans-serif; color: rgba(255,255,255,1); text-decoration: normal; text-align: center; -o-text-overflow: clip; text-overflow: clip; white-space: pre; text-shadow: 0 0 10px rgba(255,255,255,1) , 0 0 20px rgba(255,255,255,1) , 0 0 30px rgba(255,255,255,1) , 0...

Simple equation solver in JS

Image
This post will let you create a simple equation solver. This program is designed using JS and HTML. This equation solver can be used to solve addition, division, subtraction or multiplication between two numbers. Screenshot Things this code will do Create a Form Take Input from the user A button when click, calls a function Function determines which type of operation and appends the Answer. The Code <!--The CSS For the Page--> <style> #ans { position: relative; text-align: center; top: 200; } .form { position: relative; text-align: -webkit-center; padding: 110; } .form input[type="text"] { padding: 10 10 2 10; border-bottom: 2px; border-style: solid; border-left: none; border-top: none; border-right: none; } .form input:focus,button:focus{ outline: 0; } .form button { padding: 2; background-color: white; border-bottom-color: black; border-style: solid; border-left: none; border-right:...

Chat application in C using named PIPES

Image
This is a simple set of two C Programs which can act as a chat application. Basically there are two programs which need to run simultaneously. One is the client program and other the server program. This core concept used behind this is FIFO, named pipes. Screenshots [Demo] Client Side Chat Terminal running the client output file Server Side Chat Terminal running the server output file The Code --> Receiver(Server) Side code //client_chat #include<stdio.h> #include<stdlib.h> #include<sys/stat.h> #include<unistd.h> #include<string.h> #include<linux/stat.h> #define FIFO_FILE "MYFIFO" int main() { FILE *fp; char a[40]; char readbuf[80]; start: if((fp=fopen(FIFO_FILE,"r+"))==NULL) { perror("fopen"); exit(1); } printf("Me : "); gets(a); if(a[strlen(a)-1]=='.') { fputs(a,fp); fclose(fp); ...

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...

Create An Android Screaming App [SMS HotWord]

Image
In this post you will learn how to create an android app which will scream aloud no mater if the mobile is in silent or in general mode. This will work even if the app isnt in the open state. The screaming gets triggered when someone sends " scream " to your mobile as SMS. That is basically the hot word for triggering the screaming sound. Screenshots[Demo] The Code: The SMSReciever Broadcast Class: public class RecieveSMS extends BroadcastReceiver { public static final String SMS_BUNDLE = "pdus"; MediaPlayer mp; @Override public void onReceive(Context context, Intent intent) { Bundle intentExtras = intent.getExtras(); if (intentExtras != null) { Object[] sms = (Object[]) intentExtras.get(SMS_BUNDLE); for (int i = 0; i < sms.length; ++i) { SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) sms[i]); String smsBody = smsMessage.getMessa...

Countdown Timer In Java Using Threading

Image
This is a simple Countdown program in Java which is done using threading. In this program the console is periodically cleared with a Console Object. The Basic design is to make the thread sleep for 1 sec till the give time is reached. The hours and Mins along with seconds are at first converted to seconds and a loop does the rest of the work ! Screenshot [Demo] The Code: import java.io.Console; import java.util.Scanner; public class timer { public static final char ESC = 27; public static void main(String as[])throws Exception { Scanner s=new Scanner(System.in); String tim; int hh,mm=0,ss=0; int sec; Console c = System.console(); if (c == null) { System.err.println("no console"); System.exit(1); } System.out.println("Enter In this format: \"HH:MM:SS\""); tim=s.next(); hh=Integer.parseInt(tim.substring(0,2)); mm=Integer.parseInt(tim.substring(3,5)); ss=Integer.parseInt(tim.substring(6,8)); sec=hh*3600+mm*60+ss; ...