For default format, use −DateFormat.getDateInstance(DateFormat.DEFAULT)To parse the string date value, use the parse() methodDate dt = DateFormat.getDateInstance(DateFormat.DEFAULT).parse("Nov 19, 2018");The following is an example −Example Live Demoimport java.text.DateFormat; import java.util.Date; public class Demo { public static void main(String[] argv) throws Exception { // parse date Date dt = DateFormat.getDateInstance(DateFormat.DEFAULT).parse("Nov 19, 2018"); System.out.println("Date: "+dt); } }OutputDate: Mon Nov 19 00:00:00 UTC 2018
Firstly, import the following Java packagesimport java.text.SimpleDateFormat; import java.util.Date;Now, create objectsDate dt = new Date(); SimpleDateFormat dateFormat;Displaying date in the format we want −dateFormat = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz");The following is an example −Example Live Demoimport java.text.SimpleDateFormat; import java.util.Date; public class Demo { public static void main(String args[]) { Date dt = new Date(); SimpleDateFormat dateFormat; dateFormat = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz"); System.out.println("Date: "+dateFormat.format(dt)); } }OutputDate: 22 Nov 2018 07:53:58 UTC
Errors and Error Correcting CodesErrors in data occur when bits get corrupted in the data. When bits are transmitted over the computer network, they are subject to get corrupted due to interference and network problems, leading to errors.Error-correcting codes (ECC) are a sequence of numbers generated by specific algorithms for detecting and removing errors in data that has been transmitted over noisy channels. Error correcting codes ascertain the exact number of bits that has been corrupted as well as the location of the corrupted bits, within the limitations in algorithm.ECCs can be broadly categorized into two types, block codes and ... Read More
Now in this section, we will see the interrupt structure of Intel 8051 microcontroller.Interrupts are basically the events that temporarily suspend the main program, pass the control to the external sources and execute their task. It then passes the control to the main program where it had left off.8051 has five interrupts. These interrupts are INT0, INT1, TO ,T1 , TI/RI. All of the interrupts can be enabled or disabled by using the IE (interrupt enable) register.The interrupt addresses of these interrupts are like below −InterruptAddressINT00003HINT1000BHT00013HT1001BHTI/RI0023HInterrupt Enable (IE)RegisterThis register can be used to enable or disable interrupts programmatically. This register ... Read More
Firstly, import the following Java packages −import java.text.SimpleDateFormat; import java.util.Date;Now, create objects −Date dt = new Date(); SimpleDateFormat dateFormat;Displaying date in the format we wantdateFormat = new SimpleDateFormat("E MMM dd yyyy");The following is an example −Example Live Demoimport java.text.SimpleDateFormat; import java.util.Date; public class Demo { public static void main(String args[]) { Date dt = new Date(); SimpleDateFormat dateFormat; dateFormat = new SimpleDateFormat("E MMM dd yyyy"); System.out.println("Date: "+dateFormat.format(dt)); } }OutputDate: Thu Nov 22 2018
Error Correcting CodesError-correcting codes (ECC) are a sequence of numbers generated by specific algorithms for detecting and removing errors in data that has been transmitted over noisy channels. Error correcting codes ascertain the exact number of bits that has been corrupted and the location of the corrupted bits, within the limitations in algorithm.ECCs can be broadly categorized into two types, block codes and convolution codes. Low - density parity check code (LDPC) is a linear error correcting block code. They are suitable for large block sizes in very noisy channels.LDPC codes were developed by Robert G. Gallager, in his doctoral ... Read More
As we have seen there are five different interrupts in 8051. These interrupts are INT0, INT1, TO, T1, TI/RI.There are six states in each machine cycle. These states are S1 to S6. All of the interrupts are sampled at the end of state S5 of each machine cycle. When the instruction takes more than one machine cycle, then the samples are polled during the next machine cycle. When an interrupt flag is set at the S5 of the first machine cycle, then the polling cycle will find it. The interrupt system generates LCALL instruction to call appropriate ISS.There are some ... Read More
To set a duration, let us declare two objects of Calendar classCalendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance();Set a time for one of the calendar objectsc2.add(Calendar.HOUR, 9); c2.add(Calendar.MINUTE, 15); c2.add(Calendar.SECOND, 40);Now, find the difference between both the time. One would be the current time and another we declared above −long calcSeconds = (c2.getTimeInMillis() - c1.getTimeInMillis()) / 1000;The following is an example −Example Live Demoimport java.util.Calendar; public class Demo { public static void main(String args[]) { Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); // set hour, minute and second c2.add(Calendar.HOUR, 9); ... Read More
The @font-face rule is used to define the location of a font for download, although this may run into implementation-specific limits.ExampleLet us see an example
The 8251 chip is Universal Synchronous Asynchronous Receiver Transmitter (USART). It acts as a mediator between the microprocessor and peripheral devices. It converts serial data to parallel form and vice versa. This chip is 28 pin DIP.The pin description of 8251A chipPinDescriptionD0 - D7parallel dataC/DControl register or Data buffer selectRDRead ControlWRWrite controlCSChip SelectCLKclock pulseRESETResetTxCTransmitter ClockTxDtransmitted dataRxCReceiver ClockRxDReceiver DataRxRDYReceiver ReadyTxRDYTransmitter ReadyDSRData Set ReadyDTRData Terminal ReadySYNDET/Synchronous Detect/BRKDETDetectBreakRTSRequest to send DataCTSClear to send DataTxEMPTYTransmitter EmptyVccVcc (5V)GNDGround(0V)Now let us see the functional block diagram of the 8251 chip.There are five different sections in this diagram. These sections are as follows −Read/ Write control logicTransmitter ReceiverData Bus ... Read More