Convert Day of Year to Day of Month in Java

karthikeya Boyini
Updated on 29-Jun-2020 04:41:41

637 Views

Firstly, set the day of year using DAY_OF_YEAR constant.Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2018); cal.set(Calendar.DAY_OF_YEAR, 320);Now, get the day of month −int res = cal.get(Calendar.DAY_OF_MONTH);The following is an example −Example Live Demoimport java.util.Calendar; public class Demo {    public static void main(String[] args) {       Calendar cal = Calendar.getInstance();       cal.set(Calendar.YEAR, 2018);       cal.set(Calendar.DAY_OF_YEAR, 320);       System.out.println("Date = " + cal.getTime());       int res = cal.get(Calendar.DAY_OF_MONTH);       System.out.println("Day of month = " + res);    } }OutputDate = Fri Nov 16 07:54:55 UTC 2018 Day of month = 16Read More

Internal Python Object Serialization with Marshal

Nancy Den
Updated on 27-Jun-2020 15:01:53

1K+ Views

Even though marshal module in Python’s standard library provides object serialization features (similar to pickle module), it is not really useful for general purpose data persistence or transmission of Python objects through sockets etc. This module is mostly used by Python itself to support read/write operations on compiled versions of Python modules (.pyc files). The data format used by the marshal module is not compatible across Python versions (not even subversions). That’s why a compiled Python script (.pyc file) of one version most probably won’t execute on another. The marshal module is thus used for Python’s internal object serialization.Just as ... Read More

Python Standard Operators as Functions

Rishi Rathor
Updated on 27-Jun-2020 15:01:34

512 Views

In programming, operator is generally a symbol (key) predefined to perform a certain operation such as addition, subtraction, comparison etc. Python has a large set of built-in operations divided in different categories such as arithmetic, comparison, bit-wise, membership etc.The operator module in python library consists of functions corresponding to built-in operators. Names of the functions are analogous to type of corresponding operator. For example, add() function in operator module corresponds to + operator.Python’s Object class has dunder (double underscore before and after name) methods corresponding to operator symbols. These dunder methods can be suitably overloaded in user defined classes to ... Read More

Instructions to Perform AND Operation in 8085 Microprocessor

Chandu yadav
Updated on 27-Jun-2020 15:00:56

3K+ Views

In 8085 Instruction set, and specially in its logical group of instructions, we have AND, OR, XOR, NOT type of instructions. 8085 does not have instructions to perform NAND, NOR, XNOR operations directly. Now let us discuss the instructions to perform AND operations only.To perform ANDing of two numbers, 8085 imposes the restriction that one of the operands must be kept in the Accumulator. The other operand can be at any one of the following possible locations −ClassificationsExamplesThe other operand can be kept in 8-bit immediate data in the instruction.ANI 43HANI FFHThe other 8-bit operand can be kept in a ... Read More

Instructions to Perform OR Operation in 8085 Microprocessor

Chandu yadav
Updated on 27-Jun-2020 15:00:21

1K+ Views

In 8085 Instruction set, and specially in its logical group of instructions, we have AND, OR, XOR, NOT type of instructions. 8085 does not have instructions to perform NAND, NOR, XNOR operations directly. Now let us discuss the instructions to perform OR operations only.To perform ORing of two numbers, 8085 imposes the restriction that one of the operands must be kept in the Accumulator. The other operand can be at any one of the following possible locations −ClassificationsExamplesThe other operand can be kept in 8-bit immediate data in the instruction.ORI 43HORI FFHThe other 8-bit operand can be kept in a ... Read More

Python Object Serialization with Pickle

Krantik Chavan
Updated on 27-Jun-2020 15:00:01

1K+ Views

The term object serialization refers to process of converting state of an object into byte stream. Once created, this byte stream can further be stored in a file or transmitted via sockets etc. On the other hand reconstructing the object from the byte stream is called deserialization.Python’s terminology for serialization and deserialization is pickling and unpickling respectively. The pickle module available in Python’s standard library provides functions for serialization (dump() and dumps()) and deserialization (load() and loads()).The pickle module uses very Python specific data format. Hence, programs not written in Python may not be able to deserialize the encoded (pickled) ... Read More

Pprint Module - Data Pretty Printer

Daniol Thomas
Updated on 27-Jun-2020 14:59:38

2K+ Views

The pprint module (lib/pprint.py) is a part of Python’s standard library which is distributed along with standard Python distribution. The name pprint stands for pretty printer. The pprint module’s functionality enables aesthetically good looking appearance of Python data structures. Any data structure that can be correctly parsed by Python interpreter is elegantly formatted. The formatted expression is kept in one line as far as possible, but breaks into multiple lines if the length exceeds the width parameter of formatting. One unique feature of pprint output is that the dictionaries are automatically sorted before the display representation is formatted.The pprint module ... Read More

Perform Exclusive OR Operation in 8085 Microprocessor

Arjun Thakur
Updated on 27-Jun-2020 14:57:02

2K+ Views

In 8085 Instruction set, and specially in its logical group of instructions, we have AND, OR, XOR, NOT type of instructions. 8085 does not have instructions to perform NAND, NOR, XNOR operations directly. Now let us discuss the instructions to perform XOR operations only.To perform XORing of two numbers, 8085 imposes the restriction that one of the operands must be kept in the Accumulator. The other operand can be at any one of the following possible locations −ClassificationsExamplesThe other operand can be kept in 8-bit immediate data in the instruction.XRI 43HXRI FFHThe other 8-bit operand can be kept in a ... Read More

Complement Accumulator in 8085 Microprocessor

Ankith Reddy
Updated on 27-Jun-2020 14:56:14

8K+ Views

In 8085 Instruction set, logical type there is one complement instruction with the mnemonic CMA. It actually stands for “CoMplement the Accumulator”. It performs1's complement operation on the current contents of Accumulator, and the result is stored back in the Accumulator replacing its previous contents. It is to be noted that, there are no other instructions tocomplement any other register’s contents. Though it is a logicaltype of instruction, Flag bits are not affected by the execution of this instruction. It occupies only 1 Byte in memory. Mnemonics, OperandOpcode(in HEX)BytesCMA2F1Let us suppose that example, the initial content of Accumulator is AAH i.e. ... Read More

Complement Set CY Flag in 8085 Microprocessor

George John
Updated on 27-Jun-2020 14:55:44

1K+ Views

In 8085 Instruction set, there are two instructions to control the Cy flag bit content. Thesemnemonics are STC and CMC. Both are 1-Byteinstructions. There hex codes are given in the following table – Mnemonics, OperandOpcode(in HEX)BytesSTC371CMC3F1Using STC instruction we can set the Cy flag bit to 1 irrespective of itsprevious value. And using CMC instruction we can complement the current value of the Cy fag bit andresult will update the current Cy flag bit value. Here STC stands for “SeT the Carry flag” and CMC stands for “CoMplement the Carry flag”. Note that, there isno dedicated instruction in 8085 instruction set ... Read More

Advertisements