Nitya Raut

Nitya Raut

158 Articles Published

Articles by Nitya Raut

Page 7 of 16

What are the DataTransfer object attributes?

Nitya Raut
Nitya Raut
Updated on 29-Jan-2020 576 Views

The DataTransfer object holds data about the drag and drop operation. This data can be retrieved and set in terms of various attributes associated with the DataTransfer object.The following are the attributes:Sr.No.DataTransfer attributes and their description1dataTransfer.dropEffect [ = value ]Returns the kind of operation that is currently selected.This attribute can be set, to change the selected operation.The possible values are none, copy, link, and move.2dataTransfer.effectAllowed [ = value ]Returns the kinds of operations that are to be allowed.This attribute can be set, to change the allowed operations.The possible values are none, copy, copyLink, copyMove, link, linkMove, move, all and uninitialized.3dataTransfer.typesReturns a DOMStringList ...

Read More

Test if the HTML attribute tabindex is present and get the value

Nitya Raut
Nitya Raut
Updated on 29-Jan-2020 526 Views

To get the value of the HTML attribute, try the following:$("#demo").attr("tabindex")The attr() method can be used to either fetch the value of an attribute from the first element in the matched set or set attribute values onto all matched elements.You can also use the hasAttribute() method to see if there is an attribute for an element.ExampleTry to run the following code to learn how to use hasAttribute() method:                          $(document).ready(function(){             $('button').on('click', function() {                if (this.hasAttribute("style")) {                   alert('True')                } else {                   alert('False')                }             })          });                              Button                      Button 2          

Read More

What would be output if we will try to extract time values by providing the date values only to MySQL EXTRACT() function?

Nitya Raut
Nitya Raut
Updated on 29-Jan-2020 140 Views

When we try to extract hour value from a date, then EXTRACT() function will give the output 0 with a warning as shown in the below-given example −mysql> Select EXTRACT(Hour from '2017-10-20'); +---------------------------------+ | EXTRACT(Hour from '2017-10-20') | +---------------------------------+ | 0                               | +---------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> Show Warnings; +---------+------+----------------------------------------------+ | Level   | Code | Message                                      | +---------+------+----------------------------------------------+ ...

Read More

In MYSQL, how can we store a date where the day, month or both month & day are zero?\\nday are zero?

Nitya Raut
Nitya Raut
Updated on 28-Jan-2020 349 Views

To store such kind of dates where the day, month or both month & day are zero we must have to set mode of sql to allow_invalid_dates mode.mysql> set sql_mode = 'allow_invalid_dates'; Query OK, 0 rows affected (0.00 sec) mysql> insert into check_date(OrderDate) values('2017-00-00'); Query OK, 1 row affected (0.06 sec) mysql> select * from check_date; +-------------+ | OrderDate | +-------------+ | 2017-00-00 | +-------------+ 1 row in set (0.00 sec)Above query will insert the date in which both month & day values are zero.mysql> insert into check_date(Orderdate) values ('2017-00-05'); Query OK, 1 row affected (0.07 sec) ...

Read More

Flexbox layout losing proportions when reduced in size

Nitya Raut
Nitya Raut
Updated on 28-Jan-2020 140 Views

To avoid the Flexbox layout issue, you need to add the following:* {    flex-shrink: 0;    min-width: 0;    min-height: 0; }Here, flex-shrink: 1 - Flex items are allows to shrinkmin-width: 0 - flex items to shrink past their content

Read More

Cancels ongoing watchPosition call in HTML5

Nitya Raut
Nitya Raut
Updated on 28-Jan-2020 312 Views

The clearWatch method cancels an ongoing watchPosition call. When canceled, the watchPosition call stops retrieving updates about the current geographic location of the device.                    var watchID;          var geoLoc;          function showLocation(position) {             var latitude = position.coords.latitude;             var longitude = position.coords.longitude;             alert("Latitude : " + latitude + " Longitude: " + longitude);          }          function errorHandler(err) ...

Read More

How much should be a JavaScript Line Length?

Nitya Raut
Nitya Raut
Updated on 17-Jan-2020 817 Views

Try to keep the length of lines less than 80 characters. This would make the code easier to read. Best practice is to move to next line using break if JavaScript statements aren’t fitting in a single line.In addition, move to next line only after a comma or operator. For example, you can add statement like this, with a break after operator,function display() {    var a = "";    a = a + isNaN(6234) + ": 6234";        a = a + isNaN(-52.1) + ": -52.1";    a = a + isNaN('') + ": ''";    document.getElementById("test").innerHTML = a; }

Read More

How to use Singleton with Global Context in android?

Nitya Raut
Nitya Raut
Updated on 30-Jul-2019 919 Views

Before getting into example, we should know what singleton design patter is. A singleton is a design pattern that restricts the instantiation of a class to only one instance. Notable uses include controlling concurrency, and creating a central point of access for an application to access its data store.This example demonstrates How to use Singleton with Global Context in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml."1.0" encoding>"utf-8"?> "http://schemas.android.com/apk/res/android"    xmlns:tools>"http://schemas.android.com/tools"    android:layout_width>"match_parent"   ...

Read More

How to get the number of records in a table using JDBC?

Nitya Raut
Nitya Raut
Updated on 30-Jul-2019 548 Views

The ResultSet class doesn’t provide any direct method to get the number of records in a table.The beforeFirst() method navigates the pointer/curser of the ResultSet object to its default position before first.In the same way the last() method positions the cursor at the last row of the ResultSet object.Using these methods you can find the number of records in the current ResultSet object.ExampleAssume we have a table named customers table with contents as shown below:+----+---------+-----+---------+----------------+ | ID | NAME    | AGE | SALARY  | ADDRESS        | +----+---------+-----+---------+----------------+ | 1  | Amit    | 25  | 3000.00 ...

Read More

How to get the size of a column of a table using JDBC?

Nitya Raut
Nitya Raut
Updated on 30-Jul-2019 2K+ Views

You can get the size of a column of a table using the getPrecision() method of the ResultSetMetaData class.//Retrieving the ResultSetMetaData object ResultSetMetaData rsmd = rs.getMetaData(); //getting the column type int size_name = rsmd. getPrecision(3);Assume we have a table named employee_data in the database with description as shown below:+----------+--------------+------+-----+---------+-------+ | Field    | Type         | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | id       | int(11)      | YES  |     | NULL    |       | | Name     | varchar(255) | YES  | ...

Read More
Showing 61–70 of 158 articles
« Prev 1 5 6 7 8 9 16 Next »
Advertisements