Abhinaya has Published 58 Articles

How to overwrite a specific chunk in a byte array using java?

Abhinaya

Abhinaya

Updated on 16-Jun-2020 10:02:01

2K+ Views

Java provides a ByteBuffer class which allows you to wrap an array into a byte buffer using its wrap() method. Once you did that you can replace the contents of the buffer using the position(): To select the starting position and, put(): To replace the data methods:ExampleLive Demoimport java.nio.ByteBuffer; public ... Read More

How to arguments object with Rest, default, and destructured parameters in JavaScript?

Abhinaya

Abhinaya

Updated on 15-Jun-2020 13:19:37

162 Views

defaultThis came to handle function parameters with ease. Easily set Default parameters to allow initializing formal parameters with default values. This is possible only if no value or undefined is passed. Let’s see an exampleExampleLive Demo                    // default is set ... Read More

What is the role of screenY Mouse Event in JavaScript?

Abhinaya

Abhinaya

Updated on 23-May-2020 09:36:35

93 Views

When an event is triggered, the screenY mouse event returns the vertical coordinate of the mouse pointer.ExampleYou can try to run the following code to learn how to implement screenY Mouse event in JavaScript.           Click here to get the x (horizontal) and y (vertical) ... Read More

What is the usage of onfocusout event in JavaScript?

Abhinaya

Abhinaya

Updated on 22-May-2020 11:16:24

265 Views

The onfocusin event triggers when an element is to lose focus. You can try to run the following code to learn how to implement onfocusout event in JavaScript.Example           Write below:       After losing focus, the background color of input check will change.                      function newFunc(x) {             x.style.background = "blue";          }          

What is JavaScript Bitwise XOR (^) Operator?

Abhinaya

Abhinaya

Updated on 20-May-2020 10:50:12

269 Views

If both the bits are different, then 1 is returned when Bitwise OR (|) operator is used.ExampleYou can try to run the following code to learn how to work with JavaScript Bitwise XOR Operator.                    document.write("Bitwise XOR Operator");          // 7 = 00000000000000000000000000000111          // 1 = 00000000000000000000000000000001          document.write(7 ^ 1);          

How to generate a random 128 bit strings using Python?

Abhinaya

Abhinaya

Updated on 05-Mar-2020 10:21:59

3K+ Views

You can generate these just random 128-bit strings using the random module's getrandbits function that accepts a number of bits as an argument. exampleimport random hash = random.getrandbits(128) print(hex(hash))OutputThis will give the output −0xa3fa6d97f4807e145b37451fc344e58c

How to generate XML using Python?

Abhinaya

Abhinaya

Updated on 05-Mar-2020 10:14:32

2K+ Views

To generate XML from a python dictionary, you need to install the dicttoxml package. You can install it using −$ pip install dicttoxmlOnce installed, you can use the dicttoxml method to create the xml. examplea = {    'foo': 45,    'bar': {       'baz': "Hello"    } } ... Read More

How can we use Python Ternary Operator Without else?

Abhinaya

Abhinaya

Updated on 05-Mar-2020 07:37:19

1K+ Views

If you want to convert a statement like −if :    to a single line, You can use the single line if syntax to do so −if : Another way to do this is leveraging the short-circuiting and operator like − and If is false, then short-circuiting will kick ... Read More

Execute a script when the element is being clicked in HTML?

Abhinaya

Abhinaya

Updated on 03-Mar-2020 12:32:25

2K+ Views

Use the onclick attribute to execute a script when the element is clicked in HTML.ExampleYou can try to run the following code to implement onclick attribute −           Click                      function display() {             document.getElementById("test").innerHTML = "You clicked the button!";          }          

Execute a script when the user opens or closes the
element in HTML?

Abhinaya

Abhinaya

Updated on 03-Mar-2020 06:51:55

152 Views

When a user opens or closes the element, the ontoggle event fires. You can try to run the following code to implement ontoggle event attribute −Example           Details       You need to join office from Feb23                More Information          Timings: 9 to 5:30          Office location: Hyderabad                            function myFunction() {             alert("Timings, office location, etc");          }          

Advertisements