Full Page Drag and Drop Files Website with HTML

Lakshmi Srinivas
Updated on 28-Jan-2020 10:18:14

449 Views

For full page drag and drop files, try the following code:var myDrop = document.getElementById('dropZone'); function displayDropZone() {    myDrop.style.visibility = "visible"; } function hideDropZone() {    myDrop.style.visibility = "hidden"; } function allowDrag(ev) {    if (true) {       ev.dataTransfer.dropEffect = 'copy';       ev.preventDefault();    } } function handleDrop(ev) {    ev.preventDefault();    hideDropZone();    alert('This is Drop!'); } window.addEventListener('dragenter', function(ev) {    displayDropZone(); }); myDrop.addEventListener('dragenter', allowDrag); myDrop.addEventListener('dragover', allowDrag); myDrop.addEventListener('dragleave', function(e) {    hideDropZone(); }); myDrop.addEventListener('drop', handleDrop);

What Happens When MySQL Encounters an Out of Range Date

varun
Updated on 28-Jan-2020 10:13:49

505 Views

The response of MySQL on encountering out-of-range or invalid date will depend upon SQL MODE. If we have enabled ALLOW_INVALID_DATES mode then MySQL will convert the out of range values into all zeros (i.e. ‘0000:00:00 00:00:00’) and also stores the same in the table without producing any error or warning.For example, we can change SQL MODE as follows and then insert the out-of-range −mysql> set sql_mode = 'ALLOW_INVALID_DATES'; Query OK, 0 rows affected (0.00 sec) mysql> Insert into order1234(productname, quantity, orderdate) values('A', 500, '999-05-100'); Query OK, 1 row affected, 1 warning (0.13 sec) mysql> Select * from order1234; ... Read More

Copy a File to Multiple Directories in Linux

Samual Sam
Updated on 28-Jan-2020 10:12:38

667 Views

Did you get to take one file on a Linux or Unix approach and replicate it to a whole bunch of alternative directories? Then, this article is for you to copy a file to multiple directories in Linux/Ubuntu.Using with cp and xargsTo copy a file to multiple directories in Linux/Ubuntu, use the following in command –$ echo dir1 dir2 dir3 | xargs -n 1 cp file1In the above command, we are copying file1 to dir1, dir2, and dir3 directories.The sample example of the above command is as shown below −$ echo Music Videos Desktop | xargs -n 1 cp httpstat.pyIn ... Read More

Allow MySQL to Store Invalid Dates

Rishi Rathor
Updated on 28-Jan-2020 10:11:12

373 Views

After enabling the SQL MODE to ALLOW_INVALID_DATES, MySQL will also be able to store invalid dates in the table. The example is given below to understand it −mysql> Insert into order1234(ProductName, Quantity, Orderdate) values('B',500,'2015-11-31'); Query OK, 1 row affected (0.06 sec) mysql> Select * from order1234; +-------------+----------+--------------+ | ProductName | Quantity | OrderDate    | +-------------+----------+--------------+ | A           | 500      | 0000-00-00   | | B           | 500      | 2015-11-31   | +-------------+----------+--------------+ 2 rows in set (0.00 sec)We can see MySQL also inserts the invalid date in a table.

Create 301 Redirection on Nginx and Apache

Samual Sam
Updated on 28-Jan-2020 10:10:43

5K+ Views

In this article, we will learn how to redirect the URLs or Domain to another address. This can be done by using the HTTP Redirection. The URL redirection is a popular technique to point one domain address to another domain address which we can achieve on Apache and Nginx both.Redirecting to an another DomainWe might face a situation in which, we have an established web-site and we need to change the domain for the site. Here, we cannot do this by deleting the older domain since this may cause breakage and disappearance of contents on the old domain is possible ... Read More

Calculate Age in Years from Birthdate in MySQL

usharani
Updated on 28-Jan-2020 10:08:56

384 Views

We can calculate age in years from birthdate as follows −mysql> SET @dob = '1984-01-17'; Query OK, 0 rows affected (0.00 sec)This above query will pass the value’1984-01-17’ in the ‘dob’ variable. Then after applying the formula in the query below, we can get the age in years.mysql> Select Date_format( From_Days( To_Days(Curdate()) - To_Days(@dob) ), '%Y' ) + 0 AS ‘Age in years; +---------------+ | ‘Age in years’| +---------------+ |   33          | +---------------+ 1 row in set (0.00 sec)

HTML5 GeoLocation Denial Callback in Chrome

Krantik Chavan
Updated on 28-Jan-2020 10:06:05

209 Views

For timeout callback in Google Chrome, try the following code:_callback = false; function successCallback(position) {    _callback = true;    console.log('success'); } function errorCallback(error) {    _callback = true;    alert('error'); } setTimeout(function(){if(!_callback)console.log('ignored')}, 20000); navigator.geolocation.getCurrentPosition(    successCallback,    errorCallback,    {timeout: 2000} );

Override HTML5 Validation

Nancy Den
Updated on 28-Jan-2020 10:05:05

1K+ Views

To ignore HTML validation, you can remove the attribute on button click using JavaScript.Uer removeAttribute() to remove an attribute from each of the matched elements.                    First Name:                                function display(id) {             document.getElementById(id).value = document.getElementById(id).removeAttribute('required');          }          

Compute Date in MySQL Using Year, Week Number, and Day of the Week

Vrundesha Joshi
Updated on 28-Jan-2020 10:04:30

155 Views

We can compute the date as follows −mysql> SET @year=2017, @week=15, @day=4; Query OK, 0 rows affected (0.00 sec)The above query will pass the value’2017’ ,’15’, ‘4’ in ‘year’, ’week’ and ‘day’ variables respectively. Then after applying the formula in the query below, we can get the date.mysql> SELECT Str_To_Date( Concat(@year,'-',@week,'-',If(@day=7,0,@day) ), '%Y-%U-%w' ) AS Date; +--------------+ | Date         | +--------------+ | 2017-04-13   | +--------------+ 1 row in set (0.00 sec)

Keep Audio Playing While Navigating Through Pages

Samual Sam
Updated on 28-Jan-2020 10:04:22

1K+ Views

To continue loading audio to play while you are navigating through pages, try the following:Use Ajax to load content History API’s pushState() can also be used to alter URL without page reload. History.js should be used for consistent behavior across multiple browsers.The pushState() has three parameters: State object For new entry created by pushState() Title: You can pass a short title URL: New history entry's URL

Advertisements