LockDown PC based on availability of Bluetooth Device

programming

This article describes a method of locking the PC when the user is not around.Actually it detects the user mobile phone’s bluetooth (And yes it has to be turned on all the time.) and if the application can’t find the phone it sends a command to lock down the workstation.The codes are written in  JAVA and it uses the Bluecove library ,which is a open source one. The app uses the bluetooth MAC address instead of the name so as to provide security. So first we need to find out…

Read More

Restoring Division Algorithm Implementation In C

creenshot from 2015-08-26 11_15_19.png

This is a dynamic program for the implementation of the Restoring division Algorithm in the C. Restoring Division uses Left Shift Operations, Twos’ Compliment and Binary Addition. #include<stdio.h> #include<malloc.h> int * a, * q, * m, * mc, * c, n, d; int powr(int x, int y) { int s = 1, i; for (i = 0; i < y; i++) s = s * x; return s; } void print(int arr[], int n) { int i; for (i = 0; i < n; i++) printf(“%d “, arr[i]); } void…

Read More

JFrame that pops-up from the taskbar like notifications.

programming

Here i have given the JAVA code to make a popup that happens exactly like the gmail desktop application does.It uses a JFrame to make the window. package com.oksbwn.popUp; import java.awt.*; import java.awt.event.*; import javax.swing.*; import com.oksbwn.ErrorHandling.handleExceptions; import resources.RscLoader; public class popMe extends JFrame { private static final long serialVersionUID = 1 L; public static void main(String[] args) throws Exception { new popMe(“hi”, “from Bikash”, “ok”, 15, 125); } public popMe(String message, String header, String image, final int time, int height) { Runnable r = new newThreadPop(message, header, image, time,…

Read More

Get System IP address in JAVA

programming

This is a code snippet to get the current IP address of a system.   import java.net.InetAddress; import java.net.UnknownHostException; public class IpAdress { //public static void main(String[] args){ public static InetAddress getIP() { InetAddress ip; try { ip = InetAddress.getLocalHost(); return ip; } catch (UnknownHostException e) { e.printStackTrace(); } return null; } }    

Read More

Automatic project structure/git creation in Windows

automatic project creator

While working in projects on a daily basis, as I do for YouTube videos, we tend to create the same folder structure and related repositories every time, as we move to the next project.  For me, it is like creating folders for video, code, uploaded video, schematics and so on and in my most of the video for YouTube, I always create almost same folders. Along with that, I create GitHub repository to host the codes that I use in the project or tutorial to distribute. And I hate doing the…

Read More

Making a Java Swing JFrame Transparent

programming

This is how you can create a transparent JFrame in JAVA. public class transparentJFrame { public static void main(String[] args) { new transparentJFrame(Date, Head, Detal); } public transparentJFrame(String Date, String Head, String Detal) { JFrame frame = new JFrame(); frame.setUndecorated(true); frame.setBackground(new Color(Color.black.getRed(), Color.black.getGreen(), Color.black.getBlue(), 1)); //Change value of ‘1’ above to have diff transparency ((JComponent) frame.getContentPane()).setBorder( BorderFactory.createMatteBorder(3, 2, 2, 2, Color.black)); frame.setBounds(100, 50, 500, 400); frame.getContentPane().setLayout(null); final JLabel lblX = new JLabel(“X”); lblX.setBounds(frame.getWidth() – 15, 5, 15, 15); lblX.setForeground(new Color(255, 255, 255)); lblX.setToolTipText(“Closern”); lblX.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent…

Read More

16×2 LCD With LPC1768 ARM Microcontroller | In Depth

LCD is an output display device abbreviation for Liquid Crystal Display. Many varieties and types of LCD comes into the market and out of them, 16×2 LCD is the simplest one and is easy to be interfaced. As the name suggests it is a 2 line display and each line supports up-to 16 characters. The 16×2 LCD is a  16 pin device having a PCB mounted controller and a display. The controller listens to the data ports and generates the pattern to be displayed according to the i/p data. Out of…

Read More

CRC16 using JAVA

CRC16 using JAVA

CRC codes are numerously used for error checking purposes. So many times working around Embedded Devices you will find CRC used in different communication protocols for error detection. This piece of code will help you to generate CRC16 using provided packets in JAVA. While working on devices like Raspberry Pi which supports JAVA and industrial protocols like MODBUS which uses CRC16, this code can be used.  

Read More

Get Windows PC Uptime using JAVA

programming

This code snippest is about getting the system uptime using JAVA. The way it works is we invoke net stats srv from java using, JAVA Runtime. The command returns the time that the PC has been up for, A sample command in a windows system looks like, Microsoft Windows [Version 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\user>net stats srv Server Statistics for \\DESKTOP-****** Statistics since 3/31/2020 8:49:26 PM Sessions accepted 0 Sessions timed-out 0 Sessions errored-out 0 Kilobytes sent 60 Kilobytes received 53 Mean response time (msec) 0…

Read More