Introduction to Classes and Inheritance in Python

Rajendra Dharmkar
Updated on 13-Jun-2020 14:01:31

446 Views

Object-oriented programming creates reusable patterns of code to prevent code redundancy in projects. One way that recyclable code is created is through inheritance, when one subclass leverages code from another base class.Inheritance is when a class uses code written within another class.Classes called child classes or subclasses inherit methods and variables from parent classes or base classes.Because the Child subclass is inheriting from the Parent base class, the Child class can reuse the code of Parent, allowing the programmer to use fewer lines of code and decrease redundancy.Derived classes are declared much like their parent class; however, a list of ... Read More

Check If a Class is a Subclass in Python

Rajendra Dharmkar
Updated on 13-Jun-2020 13:52:45

435 Views

We have the classes A and B defined as follows −class A(object): pass class B(A): passB can be proved to be a sub class of A in two ways as followsclass A(object):pass class B(A):pass print issubclass(B, A) # Here we use the issubclass() method to check if B is subclass of A print B.__bases__ # Here we check the base classes or super classes of BThis gives the outputTrue (,)

Troubleshooting Tips

Rishi Raj
Updated on 13-Jun-2020 13:30:56

908 Views

Following steps are mostly required to Troubleshoot any problem that occurred in production.As the first step, get the time frame from the user when a particular issue occurred. Get the logs for that particular time period.If logs are very large in size, use grep command to filter out errors.$ grep -o "\w*Exception" error.log | sort -r | uniq -cIt will help to get all the exceptions in error.log sorted in reversed order and give the unique result and with counts.

How Garbage Collection Works in Python

Rajendra Dharmkar
Updated on 13-Jun-2020 13:25:47

6K+ Views

Python deletes unwanted objects (built-in types or class instances) automatically to free the memory space. The process by which Python periodically frees and reclaims blocks of memory that no longer are in use is called Garbage Collection.Python's garbage collector runs during program execution and is triggered when an object's reference count reaches zero. An object's reference count changes as the number of aliases that point to it changes.An object's reference count increases when it is assigned a new name or placed in a container (list, tuple, or dictionary). The object's reference count decreases when it's deleted with del, its reference is ... Read More

Check if a Variable is an Array in JavaScript

Rahul Sharma
Updated on 13-Jun-2020 13:24:23

220 Views

To check if a variable is an array, use “instanceof. The following is the syntax −variable instanceof ArrayExampleLet’s seen an example to check if the variable “sports” is an array or not?                       var sports = [ "tennis", "football", "cricket" ];               if (sports instanceof Array) {           alert('Array!');         } else {           alert('Not an array');         }                  

Difference Between Break and Continue Statements in JavaScript

Smita Kapse
Updated on 13-Jun-2020 13:22:14

602 Views

break statementThe break statement is used to exit a loop early, breaking out of the enclosing curly braces.  The break statement exits out of a loop.  Let’s see an example of break statement in JavaScript. The following example illustrates the use of a break statement with a while loop. Notice how the loop breaks out early once x reaches 5 and reaches to document.write (..) statement just below to the closing curly brace, Example                    var x = 1;          document.write("Entering the loop ");         ... Read More

What is Java Development Kit (JDK)

Manikanth Mani
Updated on 13-Jun-2020 13:16:30

840 Views

JDK, contains development tools and JRE.

What is void Operator in JavaScript

Nitya Raut
Updated on 13-Jun-2020 13:15:35

345 Views

The void is an important keyword in JavaScript, which can be used as a unary operator that appears before its single operand, which may be of any type. This operator specifies an expression to be evaluated without returning a value.SyntaxThe syntax of void can be either of the following two −               The most common use of this operator is in a client-side javascript: URL, where it allows you to evaluate an expression for its side-effects without the browser displaying the value of the evaluated expression.Here the expression alert ('Warning!!!') is evaluated but it ... Read More

Why jQuery Variables Start with a Dollar Sign

Johar Ali
Updated on 13-Jun-2020 13:14:27

380 Views

When you will begin working about jQuery, you will get to know about the usage of the $ sign. A $ sign is used to define jQuery.jQuery variables begin with $ to distinguish them from a standard JavaScript object. Also, it is a convention. jQuery selectors start with the dollar sign and parentheses() − $.Let's take an Example −// jQuery object var $phone = $("#myphone"); // dom object var phone_el = $("#myphone").get(1);

Configuring Java Environment on Windows

Akshaya Akki
Updated on 13-Jun-2020 13:06:46

229 Views

Set pathAssuming you have installed Java in c:\Program Files\java\jdk directory −Right-click on 'My Computer' and select 'Properties'.Click the 'Environment variables' button under the 'Advanced' tab.Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.Set ClasspathAssuming you have stored your Java programs in c:\myprograms\ directory −Right-click on 'My Computer' and select 'Properties'.Click the 'Environment variables' button under the 'Advanced' tab.Now, add the 'CLASSPATH' variable and set the path to the c:\myprograms\'.Read More

Advertisements