Articles on Trending Technologies

Technical articles with clear explanations and examples

HTML DOM Anchor origin Property

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 168 Views

The HTML DOM Anchor origin property returns the protocol, hostname and port number of the href attribute value, for example, https://www.demo.com:6064  Following is the syntax−anchorObj.originLet us now see an example to implement the DOM Anchor origin property −Example Company Products Display href Part Display origin Display hreflang function display() {    var a = document.getElementById("mylink").href;       document.getElementById("myid").innerHTML = a;    }    function display2() {       var a = document.getElementById("mylink").origin;       document.getElementById("myid").innerHTML = a;    }    function display3() {       var a = document.getElementById("mylink").hreflang;       document.getElementById("myid").innerHTML = a;    } OutputClick on the “Display origin” button−

Read More

Python Program for nth Catalan Number

Pavitra
Pavitra
Updated on 11-Mar-2026 630 Views

In this article, we will learn about calculating the nth Catalan number.Catalan numbers are a sequence of natural numbers that are defined by the recursive formula −$$C_{0}= 1\:and\:C_{n+1}=\displaystyle\sum\limits_{i=0}^n C_{i}C_{n-i} for \:n\geq0;$$The first few Catalan numbers for n = 0, 1, 2, 3, … are 1, 1, 2, 5, 14, 42, 132,429,...................Catalan numbers can be obtained both by recursion and dynamic programming. So let’s see their implementation.Approach 1: Recursion MethodExample# A recursive solution def catalan(n):    #negative value    if n

Read More

How to create an image to zoom with CSS and JavaScript?

Mohd Mohtashim
Mohd Mohtashim
Updated on 11-Mar-2026 1K+ Views

Following is the code to create an image zoom:Example    * {box-sizing: border-box;}    .img{       display: inline-block;    }    .img-zoom-container {       position: relative;    }    .img-zoom-zoomLens {       position: absolute;       border: 1px solid #d4d4d4;       width: 50px;       height: 50px;    }    .myresult{       display: inline-block;    }    .img-zoom-result {       border: 1px solid #d4d4d4;    } Image Zoom Example Hover over the image on the ...

Read More

How to solve the simultaneous linear equations in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 2K+ Views

The data in simultaneous equations can be read as matrix and then we can solve those matrices to find the value of the variables. For example, if we have three equations as −x + y + z = 6 3x + 2y + 4z = 9 2x + 2y – 6z = 3then we will convert these equations into matrices and solve them using solve function in R.Example1> A AOutput   [, 1] [, 2] [, 3] [1, ] 1    1    2 [2, ] 3    2    4 [3, ] 2    3    -6> b bOutput[, 1] ...

Read More

string.sub() function in Lua

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 81K+ Views

Another important function of the Lua’s string library is the string.sub() function. The string.sub() function is used to extract a piece of the string.The string.sub() function takes three arguments in general, the first argument being the name of the string from which we want to extract a piece, the second argument is the i-th index or say, the starting index of the string piece that we want, and the third and the last argument is the j-th index of the last index of the string piece we want.It should be noted that both the starting index and the ending index, ...

Read More

How to calculate transpose of a matrix using C program?

Mandalika
Mandalika
Updated on 11-Mar-2026 54K+ Views

Transpose of a matrixThe transpose of a matrix is the one whose rows are columns of the original matrix, i.e. if A and B are two matrices such that the rows of the matrix B are the columns of the matrix A then Matrix B is said to be the transpose of Matrix A.The logic used to change m(i, j) matrix to m(j, i) is as follows −for (i = 0;i < m;i++)    for (j = 0; j < n; j++)       transpose[j][i] = matrix[i][j];Program 1In this example, we shall print the transpose of a matrix using for ...

Read More

How to remove a character in an R data frame column?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 51K+ Views

To remove a character in an R data frame column, we can use gsub() function which will replace the character with blank. For example, if we have a data frame called df that contains a character column say x which has a character ID in each value then it can be removed by using the command gsub("ID", "", as.character(df$x)).Example1Consider the below data frame −> x1 x2 df1 df1Output        x1  x2 1    Male1  8 2  Female1  4 3    Male1  9 4    Male1  2 5    Male1  7 6  Female1  5 7    Male1  3 8 ...

Read More

How to compare two lists in Python?

pawandeep
pawandeep
Updated on 11-Mar-2026 71K+ Views

The list in python is a collection of similar items. We may at times need to compare data items in the two lists to perform certain operations. We will discuss certain methods to compare two lists in python.Using list.sort() and == operatorThe list.sort() method sorts the two lists and the == operator compares the two lists item by item which means they have equal data items at equal positions. This checks if the list contains equal data item values but it does not take into account the order of elements in the list. This means that the list [1, 2, ...

Read More

How to declare a variable in Python?

pawandeep
pawandeep
Updated on 11-Mar-2026 68K+ Views

In Python, we need not declare a variable with some specific data type.Python has no command for declaring a variable. A variable is created when some value is assigned to it. The value assigned to a variable determines the data type of that variable.Thus, declaring a variable in Python is very simple.Just name the variableAssign the required value to itThe data type of the variable will be automatically determined from the value assigned, we need not define it explicitly.Declare an integer variableTo declare an integer variable −Name the variableAssign an integer value to itExamplex=2 print(x) print(type(x))This is how you declare ...

Read More

How to print in same line in Python?

pawandeep
pawandeep
Updated on 11-Mar-2026 123K+ Views

The print() method in Python automatically prints in the next line each time. The print() method by default takes the pointer to the next line.Examplefor i in range(5):    print(i)Output0 1 2 3 4Modify print() method to print on the same lineThe print method takes an extra parameter end=" " to keep the pointer on the same line.The end parameter can take certain values such as a space or some sign in the double quotes to separate the elements printed in the same line.Syntaxprint("..." , end=" ")Print on same line with space between each elementThe end=” “ is used to ...

Read More
Showing 1–10 of 61,248 articles
« Prev 1 2 3 4 5 6125 Next »
Advertisements