Show Full URL of a Document with JavaScript

Abhishek Kumar
Updated on 21-Sep-2022 07:46:36

2K+ Views

We use the URL property of the document object to show the full URL of a document with JavaScript. The document object, part of the DOM, corresponds to the current web page that the browser has loaded. It Contains all the information about the condition of the browser as well as the web page. It can be visualized as a hierarchy that is obtained after rendering the HTML structure of the web page. URL stands for Uniform Resource Locator. It contains the address of a resource on the internet. A Typical URL looks something like this− http://www.example.com/index.html It is ... Read More

Create Multiple JavaScript Variables in a Single Statement

Abhishek Kumar
Updated on 21-Sep-2022 07:43:33

7K+ Views

We can create many JavaScript variables in a single statement using the var, let, and const keywords that are used for declaring variables in JavaScript. Instead of declaring every variable individually, we can chain many variables together with commas (, ) in a single statement. Since JavaScript is a loosely typed language, variables of many data types can be declared in the same sentence as well. Syntax var variable1 = value1, variable2 = value2, variable3 = value3; Here, var is the keyword used for declaring the variables viz: variable1, variable2, variable3 and assigning them the respective values. Example 1 ... Read More

Show Domain Name of the Server with JavaScript

Abhishek Kumar
Updated on 21-Sep-2022 07:40:55

3K+ Views

We use the window.location.hostname property of the document object to show the domain name of the server that loaded the document using JavaScript. The document object, part of the DOM, corresponds to the current web page that the browser has loaded. It Contains all the information about the condition of the browser as well as the web page. Every resource or computer that is available on the internet has an address that is either IPV4 (192.88.99.255) or IPV6 (2001:db8:3333:4444:5555:6666:7777:8888). These addresses are good for computers but not for us. domain name system is a layer of abstraction over that organization ... Read More

Show Last Modified Date and Time with JavaScript

Abhishek Kumar
Updated on 21-Sep-2022 07:38:53

5K+ Views

We use the lastModified property of the document object to show the date and time the document was last modified with JavaScript. This command will provide the exact date and time of modification. The document object, part of the DOM, renders the whole HTML as a hierarchy of objects and their properties as well as stores different attributes of the webpage. document.lastModified It is a read-only property of the document object that returns a string containing the date and time, the document was last modified. The format looks something this: 07/29/2019 15:19:41 Note − The lastModified property is useful ... Read More

Show Name-Value Pairs of Cookies in a Document with JavaScript

Abhishek Kumar
Updated on 21-Sep-2022 07:34:32

850 Views

We use the cookie property of the document object to show the name/value pairs of cookies in a document with JavaScript. The document object, part of the DOM, corresponds to the current web page that the browser has loaded. It Contains all the information about the condition of the browser as well as the web page. A server serves requests when a connection is set up and forgets everything about the user as soon as the connection is closed. This posed a nasty problem of bad user experience to the community. A cookie, resolves this problem by storing small but ... Read More

Show Hyperlinks in JavaScript Alert

Abhishek Kumar
Updated on 21-Sep-2022 07:30:51

10K+ Views

We use the dialog API of jQuery UI to show hyperlinks in JavaScript alerts. JavaScript does not allow putting clickable hyperlinks in the alert box. The closest functionality that plain JavaScript provides is a confirm box using the window.confirm() method. We will be using the jQuery library to show hyperlinks in JavaScript alerts. It is a library for JavaScript to traverse HTML documents as well as manipulate them, create animations, and much more. One such feature is a custom dialog box that we will be using. An alert is a message for the user that requires immediate attention. An alert ... Read More

Access Serial RS232 Port in Python

AmitDiwan
Updated on 20-Sep-2022 11:56:47

23K+ Views

To access the serial port in Python, use the pyserial module, which Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython. Let us see the features - Access to the port settings through Python properties. Support for different byte sizes, stop bits, parity and flow control with RTS/CTS and/or Xon/Xoff. Working with or without receive timeout. The files in this package are 100% pure Python. The port is set up for binary transmission. No NULL byte stripping, CR-LF translation etc. To install pyserial, use pip pip install pyserial At first import the required libraries. import ... Read More

Find Current Module Name in Python

AmitDiwan
Updated on 20-Sep-2022 11:24:17

13K+ Views

A module can find out its own module name by looking at the predefined global variable __name__. If this has the value '__main__', the program is running as a script. Example def main(): print('Testing…...') ... if __name__ == '__main__': main() Output Testing…... Modules that are usually used by importing them also provide a command-line interface or a selftest, and only execute this code after checking __name__. The__name__ is an in-built variable in python language, we can write a program just to see the value of this variable. Here’s an ... Read More

Parcel Out Work Among Worker Threads in Python

AmitDiwan
Updated on 20-Sep-2022 11:18:19

181 Views

To parcel out work among a bunch of worker threads, use the concurrent.futures module, especially the ThreadPoolExecutor class. With that an alternative, if you want fine control over the dispatching algorithm, you can write your own logic manually. Use the queue module to create a queue containing a list of jobs. The Queue class maintains a list of objects and has a .put(obj) method that adds items to the queue and a .get() method to return them. The class will take care of the locking necessary to ensure that each job is handed out exactly once. Example Following is an ... Read More

What is a Doubly Excited System

Manish Kumar Saini
Updated on 20-Sep-2022 11:17:50

7K+ Views

A doubly-excited system is the type of magnetic system in which two independent coils are used to produce magnetic field. Examples of doubly-excited systems are synchronous machine, separately excited DC machines, loudspeakers, tachometers etc.Consider a doubly-excited system as shown in the figure, it consists of a stator wound with a coil having a resistance of R1 and a rotor wound with a coil of resistance R2. Both the coils are excited by independent voltage sources.Following assumptions are made to analyse a doubly excited system −For any rotor position the relationship between flux-linkage (ψ) and current is linear.Hysteresis and eddy current ... Read More

Advertisements