File-based Data Management System

Kristi Castro
Updated on 19-Jun-2020 12:54:58

18K+ Views

The systems that are used to organize and maintain data files are known as file based data systems. These file systems are used to handle a single or multiple files and are not very efficient. FunctionalitiesThe functionalities of a File-based Data Management System are as follows −A file based system helps in basic data management for any user.The data stored in the file based system should remain consistent. Any transactions done in the file based system should not alter the consistency property. The file based system should not allow any illegal or potentially hazardous operations to occur on the data.The file based ... Read More

Why Do We Need a Database?

Kristi Castro
Updated on 19-Jun-2020 12:51:18

18K+ Views

A database is a collection of data, usually stored in electronic form. A database is typically designed so that it is easy to store and access information.A good database is crucial to any company or organisation. This is because the database stores all the pertinent details about  the company such as employee records, transactional records, salary details etc.The various reasons a database is important are −Manages large amounts of dataA database stores and manages a large amount of data on a daily basis. This would not be possible using any other tool such as a spreadsheet as they would simply ... Read More

Object-oriented Data Model

Kristi Castro
Updated on 19-Jun-2020 12:49:22

19K+ Views

Object oriented data model is based upon real world situations. These situations are represented as objects, with different attributes. All these object have multiple relationships between them.Elements of Object oriented data modelObjectsThe real world entities and situations are represented as objects in the Object oriented database model.Attributes and MethodEvery object has certain characteristics. These are represented using Attributes. The behaviour of the objects is represented using Methods.ClassSimilar attributes and methods are grouped together using a class. An object can be called as an instance of the class.InheritanceA new class can be derived from the original class. The derived class contains ... Read More

Check if Event Exists on Element in jQuery

Kristi Castro
Updated on 19-Jun-2020 12:47:44

4K+ Views

To check if event exists on element in jQuery, check for the existing events on the element. Here, I have set the div −   This is demo text. Click here! When you click div, then the alert generates which I have set using the div id:$("#demo").click(function() {   alert("Does event exists? - "+hasEvents); });You can try to run the following code to check if event exists −ExampleLive Demo               $(document).ready(function(){       $("#demo").click(function() {         alert("Does event exists? - "+hasEvents);      });      var events = $._data(document.getElementById('demo'), "events");      var hasEvents = (events != null);    });         This is demo text. Click here!

Date Format Validation Using Java Regex

Samual Sam
Updated on 19-Jun-2020 12:45:34

853 Views

Following example demonstrates how to check whether the date is in a proper format or not using matches method of String class.ExampleLive Demopublic class Main {    public static void main(String[] argv) {       boolean isDate = false;       String date1 = "8-05-1988";       String date2 = "08/04/1987";       String datePattern = "\d{1, 2}-\d{1, 2}-\d{4}";       isDate = date1.matches(datePattern);       System.out.println("Date :"+ date1+": matches with the this date Pattern:"+datePattern+"Ans:"+isDate);       isDate = date2.matches(datePattern);       System.out.println("Date :"+ date2+": matches with the this date ... Read More

Date Formatting Using SimpleDateFormat

karthikeya Boyini
Updated on 19-Jun-2020 12:43:03

1K+ Views

SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. SimpleDateFormat allows you to start by choosing any user-defined patterns for date-time formatting.ExampleLive Demoimport java.util.*; import java.text.*; public class DateDemo {    public static void main(String args[]) {       Date dNow = new Date( );       SimpleDateFormat ft =               new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz");       System.out.println("Current Date: " + ft.format(dNow));    } }This will produce the following result −OutputCurrent Date: Sun 2004.07.18 at 04:14:09 PM PDTSimple DateFormat ... Read More

GregorianCalendar Class in Java

Samual Sam
Updated on 19-Jun-2020 12:40:18

275 Views

GregorianCalendar is a concrete implementation of a Calendar class that implements the normal Gregorian calendar with which you are familiar. We did not discuss Calendar class in this tutorial, you can look up standard Java documentation for this.The getInstance( ) method of Calendar returns a GregorianCalendar initialized with the current date and time in the default locale and time zone. GregorianCalendar defines two fields: AD and BC. These represent the two eras defined by the Gregorian calendar.There are also several constructors for GregorianCalendar objects −Sr.No.Constructor & Description1GregorianCalendar()Constructs a default GregorianCalendar using the current time in the default time zone with the default ... Read More

Create Gradient Translucent Windows in Java Swing

karthikeya Boyini
Updated on 19-Jun-2020 12:36:39

3K+ Views

With JDK 7, we can create a gradient based translucent window using swing very easily. Following are the steps needed to make a gradient-based translucent window. Make the background of JFrame transparent first.frame.setBackground(new Color(0, 0, 0, 0)); Create a gradient paint, and fill the panel.JPanel panel = new javax.swing.JPanel() {    protected void paintComponent(Graphics g) {       Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 0),        getWidth(), getHeight(), new Color(R, G, B, 255), true);       Graphics2D g2d = (Graphics2D)g;       g2d.setPaint(p);       g2d.fillRect(0, 0, getWidth(), getHeight());    } } Assign ... Read More

Deadlock in Java Multithreading

Samual Sam
Updated on 19-Jun-2020 12:30:28

2K+ Views

Deadlock describes a situation where two or more threads are blocked forever, waiting for each other. Deadlock occurs when multiple threads need the same locks but obtain them in a different order. A Java multithreaded program may suffer from the deadlock condition because the synchronized keyword causes the executing thread to block while waiting for the lock, or monitor, associated with the specified object. Here is an example.ExampleLive Demopublic class TestThread {    public static Object Lock1 = new Object();    public static Object Lock2 = new Object();    public static void main(String args[]) {       ThreadDemo1 T1 = ... Read More

Date Parsing Using SimpleDateFormat

karthikeya Boyini
Updated on 19-Jun-2020 12:27:22

398 Views

The SimpleDateFormat class has parse() method, which tries to parse a string according to the format stored in the given SimpleDateFormat object.ExampleLive Demoimport java.util.*; import java.text.*;   public class DateDemo {    public static void main(String args[]) {       SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd");               String input = args.length == 0 ? "1818-11-11" : args[0];         System.out.print(input + " Parses as ");               Date t;       try {          t = ft.parse(input);                    System.out.println(t);               } catch (ParseException e) {                    System.out.println("Unparseable using " + ft);               }    } }A sample run of the above program would produce the following result −Output1818-11-11 Parses as Wed Nov 11 00:00:00 EST 1818

Advertisements