Srinivas Gorla

Srinivas Gorla

45 Articles Published

Articles by Srinivas Gorla

Page 2 of 5

A scale transform the element by using y-axis with CSS3

Srinivas Gorla
Srinivas Gorla
Updated on 20-Jun-2020 383 Views

The scaleY(y) method is used to scale transform the element using y-axis.Let us see the syntax −scaleY(y)Here, y is a number representing the scaling factor to apply on the ordinate of each point of the element.Let us see an example −div {    width: 60px;    height: 60px;    background-color: yellow; } .scaled {    transform: scaleY(0.5);    background-color: black; }

Read More

In MySQL, what is the difference between SERIAL and AUTO_INCREMENT?

Srinivas Gorla
Srinivas Gorla
Updated on 20-Jun-2020 4K+ Views

In MySQL, both SERIAL and AUTO_INCREMENT are used to define a sequence as a default value for a field. But they are technically different from each other.The AUTO_INCREMENT attribute is supported by all numeric data types except for BIT and DECIMAL. There can only be one AUTO_INCREMENT field per table and the sequence generated by an AUTO_INCREMENT field in one table cannot be used in any other table. This attribute requires that a UNIQUE index exists on the field to ensure the sequence has no duplicates. The sequence would start by default from 1 and increment by 1 for every insert.Examplemysql> ...

Read More

How can we add FOREIGN KEY constraints to more than one fields of a MySQL table?

Srinivas Gorla
Srinivas Gorla
Updated on 19-Jun-2020 951 Views

MySQL allows us to add a FOREIGN KEY constraint on more than one field in a table. The condition is that each Foreign Key in the child table must refer to the different parent table.ExampleSuppose we have a table ‘customer2’ which have a Primary Key constraint on the field ‘cust_unq_id’ as follows −mysql> describe customer2; +-------------+-------------+------+-----+---------+-------+ | Field       | Type        | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | cust_id     | int(11)     | YES  |     | NULL    |       | | First_name  | ...

Read More

How to return a value from a JavaScript function?

Srinivas Gorla
Srinivas Gorla
Updated on 19-Jun-2020 3K+ Views

To return a value from a JavaScript function, use the return statement in JavaScript. You need to run the following code to learn how to return a value −Example                    function concatenate(name, age) {             var val;             val = name + age;             return val;          }          function DisplayFunction() {             var result;             result = concatenate('John ', 20) ;             document.write (result );          }                     Click the following button to call the function                          

Read More

How can we debug JavaScript in Internet Explorer?

Srinivas Gorla
Srinivas Gorla
Updated on 19-Jun-2020 255 Views

The most basic way to track down errors is by turning on error information in your browser. By default, Internet Explorer shows an error icon in the status bar when an error occurs on the page. Double-clicking this icon takes you to a dialog box showing information about the specific error that occurred. Since this icon is easy to overlook, Internet Explorer gives you the option to automatically show the Error dialog box whenever an error occurs. To enable this option, select Tools → Internet Options → Advanced tab. and then finally check the "Display a Notification About Every Script Error" box option as ...

Read More

What is the lambda expression to convert array/List of String to array/List of Integers in java?

Srinivas Gorla
Srinivas Gorla
Updated on 16-Jun-2020 883 Views

You can convert an array list of strings to an array list of integers as:ExampleLive Demoimport java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class LamdaExpressions {    public static void main(String args[]) {       ArrayList list = new ArrayList();       list.add("123");       list.add("223");       list.add("323");       list.add("334");       List listInteger =          list.stream().map(s -> Integer.parseInt(s)).collect(Collectors.toList());       System.out.println(listInteger);    } }Output[123, 223, 323, 334]

Read More

How to find numbers in an array that are greater than, less than, or equal to a value in java?

Srinivas Gorla
Srinivas Gorla
Updated on 16-Jun-2020 4K+ Views

You can find numbers in an array that are greater than, less than, or equal to a value as:ExampleLive Demopublic class GreaterOrLess {    public static void main(String args[]) {       int value = 65;       int[] myArray = {41, 52, 63, 74, 85, 96 };       System.out.println("Elements of the array that are equal to the given value are::");       for(int i = 0; i

Read More

Execute a script when the window's history changes in HTML?

Srinivas Gorla
Srinivas Gorla
Updated on 30-May-2020 212 Views

When the window’s history change, the onpopstate event triggers. You can add it like this −Example           This is demo text    

Read More

What is the role of scrollX property in JavaScript?

Srinivas Gorla
Srinivas Gorla
Updated on 20-May-2020 630 Views

The scrollX property in JavaScript works the same as pageXoffset property. If you want to get the pixels the document scrolled to from the upper left corner of the window, then use the scrollX property for horizontal pixels.ExampleYou can try to run the following code to learn how to work with scrollX property in JavaScript.                    div {             background-color: yellow;             height: 1500px;             width: 1500px;          }                              function scrollFunc() {             window.scrollBy(200, 200);             alert("Horizontal: " + window.scrollX);          }             Scroll                      

Read More

What will happen if a semicolon is misplaced in JavaScript?

Srinivas Gorla
Srinivas Gorla
Updated on 20-May-2020 249 Views

If a semicolon is misplaced in JavaScript, then it may lead to misleading results. Let’s see an example, wherein the if statement condition is false, but due to misplaced semi-colon, the value gets printed.Example                    var val1 = 10;          if (val1 == 15) {             document.write("Prints due to misplaced semi-colon: "+val1);          }          var val2 = 10;          if (val2 == 15) {             // this won't get printed             document.write(val2);          }          

Read More
Showing 11–20 of 45 articles
Advertisements