Precision Handling in Python

Samual Sam
Updated on 30-Jul-2019 22:30:23

3K+ Views

Python can handle the precision of floating point numbers using different functions. Most functions for precision handling are defined in the math module. So to use them, at first we have to import the math module, into the current namespace. import math Now we will see some of the functions for precision handling. The trunc() function The trunc() method is used to remove all fractional part from a floating point number. So it returns only the integer part from the number. The ceil() function The ceil() method is used to return the Ceiling value of a ... Read More

Define Integer Literals as Octal Values in Java

Samual Sam
Updated on 30-Jul-2019 22:30:23

4K+ Views

Literals with a leading zero are octal literals. Any number prefixed with a 0 is considered octal. Octal numbers can only use digits 0-7, just like decimal can use 0-9, and binary can use 0-1. To define integer literals as octal value in Java is effortless. Here is the declaration and initialization. int myOct = 023; Example Live Demo public class Demo { public static void main(String []args) { int myOct = 023; System.out.println(myOct); } } Output 19 Let us see another example. Example Live Demo public class Demo { public static void main(String []args) { int myOct = 010; System.out.println(myOct); } } Output 8

Use XmlSerializer in C#

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

574 Views

Serialization/ De-serialization allow communication with another application by sending and receiving data. With XmlSerializer, you can control how objects are encoded into XML. To perform XML Serialization, you need the following two classes − StreamWriter class XmlSerializer class Call the Serialize method with the parameters of the StreamWriter and object to serialize. string myPath = "new.xml"; XmlSerializer s = new XmlSerializer(settings.GetType()); StreamWriter streamWriter = new StreamWriter(myPath); s.Serialize(streamWriter, settings); An XML file is visible with the name “new.xml”. Now to deserialize. MySettings mySettings = new MySettings(); string myPath = "new.xml"; XmlSerializer ... Read More

Keywords in Python

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

5K+ Views

Like other languages, Python also has some reserved words. These words hold some special meaning. Sometimes it may be a command, or a parameter etc. We cannot use keywords as variable names. The Python Keywords are True False class def return if elif else try except raise finally for in is not from import global lambda nonlocal pass while break continue and with as yield del or assert None The True & False Keywords The True and False are the truth ... Read More

Network Switching

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

2K+ Views

Definition Network switching is the process of transmitting data packets from the source to the destination through a number of intermediate network nodes. Here, each node controls or switches data packets to the next node towards the destination. When data comes on a node it is called ingress, and when data goes out of a node it is called egress. Switching Methods The two broad level switching methods are connection oriented switching and connectionless switching. Connection – oriented Switching : In connection – oriented switching, a dedicated path is established between the source and the destination before data switching. ... Read More

Public Switched Telephone Network

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

16K+ Views

Public Switched Telephone Network (PSTN) is an agglomeration of an interconnected network of telephone lines owned by both governments as well as commercial organizations. Properties of PSTN It is also known as Plain Old Telephone Service (POTS) It has evolved from the invention of telephone by Alexander Graham Bell. The individual networks can be owned by national government, regional government or private telephone operators. Its main objective is to transmit human voice in a recognizable form. It is an aggregation of circuit-switched networks of the world. Originally, it was an entirely analog network laid with copper cables ... Read More

Packet Switching

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

28K+ Views

Packet switching is a connectionless network switching technique. Here, the message is divided and grouped into a number of units called packets that are individually routed from the source to the destination. There is no need to establish a dedicated circuit for communication. Process Each packet in a packet switching technique has two parts: a header and a payload. The header contains the addressing information of the packet and is used by the intermediate routers to direct it towards its destination. The payload carries the actual data. A packet is transmitted as soon as it is available in a node, ... Read More

Access Unique Android Device ID

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

2K+ Views

If you want to check unique device id like IMEI number through programmatically we can do this by telephonic manger as shown below example −Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javaimport android.Manifest; import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import ... Read More

Count Total Bits in a Number using Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

826 Views

The total bits in a number can be counted by using its binary representation. An example of this is given as follows − Number = 9 Binary representation = 1001 Total bits = 4 A program that demonstrates this is given as follows. Example Live Demo public class Example { public static void main(String[] arg) { int num = 10; int n = num; int count = 0; while ... Read More

Telephone Modems

Samual Sam
Updated on 30-Jul-2019 22:30:23

2K+ Views

Modem is an abbreviation of “modulator demodulator”. It is a network device that modulates digital information or bits into analog signals for transmission at the sending end, and demodulates the analog signals to bits at the receiving end. Telephone modems enables data communication between two computers over voice – grade telephone lines. Purpose and Usage The computers are digital devices that are connected via analog local loops of the telephone networks. So, there is a need to convert the bits to analog signals so that they can be transmitted via the physical channels; and conversely convert analog signals in the ... Read More

Advertisements