Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Programming Scripts Articles
Page 8 of 33
BEGIN and END Blocks in Perl
You may define any number of code blocks named BEGIN and END in Perl programs, which act as constructors and destructors respectively.BEGIN { ... } END { ... } BEGIN { ... } END { ... }Every BEGIN block is executed after the perl script is loaded and compiled but before any other statement is executed.Every END block is executed just before the perl interpreter exits.The BEGIN and END blocks are particularly useful when creating Perl modules.Following example shows its usage −Example#!/usr/bin/perl package Foo; print "Begin and Block Demo"; BEGIN { print "This is BEGIN Block" } END { ...
Read MoreThe fork() Function in Perl
Perl provides a fork() function that corresponds to the Unix system call of the same name. On most Unix-like platforms where the fork() system call is available, Perl's fork() simply calls it. On some platforms such as Windows where the fork() system call is not available, Perl can be built to emulate fork() at the interpreter level.The fork() function is used to clone a current process. This call create a new process running the same program at the same point. It returns the child pid to the parent process, 0 to the child process, or under if the fork is ...
Read MoreSharedArrayBuffer.byteLength Property in JavaScript
The byteLength property of the SharedArrayBuffer returns an unsigned, 32-bit integer that specifies the size/length of a SharedArrayBuffer. Syntax Its Syntax is as follows sharedArrayBuffer.byteLength Example JavaScript Example var sharedArrayBuffer = new SharedArrayBuffer(8); var result = sharedArrayBuffer.byteLength; document.write("length of the shared array buffer is: " + result); Output length of the shared array buffer is: 8
Read MoreparseFloat() function in JavaScript
The parseFloat() function accepts two parameters one is a string representing a number and another is a number representing the radix and returns an integer of the given radix.SyntaxIts Syntax is as followsnum.parseFloat('4524', 8);Example JavaScript Example var result1 = parseFloat(Math.PI); document.write("Result: "+result1); document.write(''); var result2 = parseFloat("245.12@welcome"); document.write("Result: "+result2); document.write(''); var result3 = parseFloat("11111100.010"); document.write("Result: "+result3); OutputResult: 3.141592653589793 Result: 245.12 Result: 11111100.01
Read MoreisFinite() function in JavaScript
The isFinite() function accepts a value and determines whether the given value is a finite number or not. If so, this method returns true else it returns false. You can also invoke this method using Number object.SyntaxIts Syntax is as followsisFinite(5655);Example JavaScript Example var result1 = Math.min(); document.write(isFinite(result1)); document.write(""); var result2 = Number.isFinite(100/0); document.write(result2); document.write(""); var result3 = Math.max(25, 36, 862); document.write(isFinite(result3)); Outputfalse false true
Read MoreencodeURIComponent() function in JavaScript
The encodeURIComponent() function accepts a string value representing an URI and encodes it by replacing the characters in it using numbers (1 to 4) and escape sequence.SyntaxIts Syntax is as followsencodeURIComponent('http://www.qries.com/');Example JavaScript Example var result1 = encodeURIComponent('http://www.qries.com/'); document.write(result1); document.write(""); var result2 = encodeURIComponent('http://www.tutorialspoint.com/'); document.write(encodeURIComponent(result2)); Outputhttp%3A%2F%2Fwww.qries.com%2F http%253A%252F%252Fwww.tutorialspoint.com%252F
Read MoredecodeURIComponent() function in JavaScript
The decodeURIComponent() function accepts a string value representing an encoded URI (Uniform Resource Identifier) decodes it and returns the result.SyntaxIts Syntax is as followsencodeURIComponent('http://www.qries.com/');Example JavaScript Example var encodedData = encodeURIComponent('http://www.qries.com/?x=шеллы'); document.write("Encoded Data: "+encodedData); document.write(""); var decodedData = decodeURIComponent(encodedData); document.write("Decoded Data: "+decodedData); OutputEncoded Data: http%3A%2F%2Fwww.qries.com%2F%3Fx%3D%D1%88%D0%B5%D0%BB%D0%BB%D1%8B Decoded Data: http://www.qries.com/?x=шеллы
Read MoreTypedArray.BYTES_PER_ELEMENT property in JavaScript
The BYTES_PER_ELEMENT property of the Typed Array represents the number of bytes in each element in it.SyntaxIts Syntax is as followsFloat32Array.BYTES_PER_ELEMENT;Example JavaScript Example var sizeOfFloat64Array = Float32Array.BYTES_PER_ELEMENT; document.write("Size of the float 32 array: "+sizeOfFloat64Array); document.write(""); var sizeOfInt16Array = Int16Array.BYTES_PER_ELEMENT; document.write("Size of the int 16 array: "+sizeOfInt16Array); OutputSize of the float 32 array: 4 Size of the int 16 array: 2
Read MoreTypedArray.name property in JavaScript
The name property of the TypedArray object represents the name of the typed array in string (format)i.e. one of Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array.SyntaxIts Syntax is as followsFloat32Array.name;Example JavaScript Example var nameOfarray1 = Float32Array.name; document.write("name of array1: "+nameOfarray1); document.write(""); var nameOfarray2 = Int16Array.name; document.write("name of array2: "+nameOfarray2); Outputname of array1: Float32Array name of array2: Int16Array
Read MoreTypedArray.buffer property in JavaScript
The buffer property of the TypedArray represents the ArrayBuffer of the current TypedArray.SyntaxIts Syntax is as followsobj.buffer;Example JavaScript Example var buffer = new ArrayBuffer(156); var float32 = new Float32Array(buffer); document.write(float32.buffer.byteLength); Output156
Read More