Cross-browser Drag and Drop HTML File Upload

Nishtha Thakur
Updated on 25-Jun-2020 07:50:35

341 Views

For cross-browser HTML File Uploader, use FileDrop. It works on almost all modern web browsers.As per the official specification −FileDrop is a self-contained cross-browser for HTML5, legacy, AJAX, drag & drop, JavaScript file upload

Set Timezone of MySQL

Ankith Reddy
Updated on 25-Jun-2020 07:50:31

714 Views

To know the current time, we can use the now() function with SELECT statement. The query is as follows −mysql> SELECT now();After executing the above query, we will get the current time. The following is the output −+---------------------+ | now() | +---------------------+ | 2018-10-06 12:57:25 | +---------------------+ 1 row in set (0.02 sec)To set the time zone, we can use the command SET. The syntax is as follows −mysql> SET time_zone = "Some value"; Now I am applying the above query to set the time zone. ... Read More

Get Current Auto Increment Value for a Table in MySQL

Chandu yadav
Updated on 25-Jun-2020 07:50:02

7K+ Views

To know the current auto_increment value, we can use the last_insert_id() function. Firstly, we will create a table with the help of INSERT command.Creating a table −mysql> CREATE table AutoIncrement -> ( -> IdAuto int auto_increment, -> primary key(IdAuto) -> ); Query OK, 0 rows affected (0.59 sec)After creating a table, we will insert the records with the help of INSERT command. Inserting records −mysql> INSERT into AutoIncrement values(); Query OK, 1 row affected (0.48 sec) mysql> INSERT into AutoIncrement values(); Query OK, 1 row affected (0.17 sec) mysql> INSERT into AutoIncrement values(); Query OK, 1 row affected ... Read More

HTML5 File API: readAsBinaryString Method

Ankith Reddy
Updated on 25-Jun-2020 07:49:37

153 Views

This may happen if you are reading your file as a binary string and forming the multipart/ form-data request manually.You need to try and use xhr.send(File) and work around xhr progress event, which is fired when all list items had been already created.ExampleThe following is our upload function −function display(url, files) {    var myForm = new FormData();    for (var j = 0, file; file = files[j]; ++j) {       myForm.append(file.name, file);    }    var xhr = new XMLHttpRequest();    xhr.open('POST', url, true);    xhr.onload = function(e) { ... };    xhr.send(formData); }

What is Unsigned in MySQL

George John
Updated on 25-Jun-2020 07:49:07

2K+ Views

Unsigned allows us to enter positive value; you cannot give any negative number. Let us create a table to understand unsigned in MySQL. To create a table, we will use the CREATE command.Let us create a table −mysql> CREATE table UnsignedDemo -> ( -> id int unsigned -> ); Query OK, 0 rows affected (0.61 sec)After that I will insert only positive values. Let us insert some records −mysql> INSERT into UnsignedDemo values(124); Query OK, 1 row affected (0.09 sec) mysql> INSERT into UnsignedDemo values(78967); Query OK, 1 row affected (0.14 sec)I am displaying all the records with the ... Read More

Enable MySQL Query Log

Arjun Thakur
Updated on 25-Jun-2020 07:48:37

1K+ Views

To enable query log, use the command SET global. You cannot use set general_log in MySQL version 8.0.12 version. If you are using version 8.0.12, then you will get the below given error. Here, we are trying to set general_log to see what error will come −mysql> SET general_log = 1;The following is the output −ERROR 1229 (HY000): Variable 'general_log' is a GLOBAL variable and should be set with SET GLOBAL Now, we will use the global command with general_log. The query is as follows −mysql> SET global general_log = 1; Query OK, 0 rows affected (0.10 sec)To check it ... Read More

Play HTML Audio Blocks One by One Without Pops and Clicks

Nancy Den
Updated on 25-Jun-2020 07:48:32

93 Views

To play HTML blocks one by one, use the following HTML first −         The following is what you need to do to play audio one by one −var one = document.getElementById('one'); one.onended = function() {    document.getElementById('two').play(); } one.play();

Add a Day to the Date in MySQL

George John
Updated on 25-Jun-2020 07:47:48

437 Views

To add 1 day, use date_add() function. Adding a day to datetime in MySQL gives the next day. The following is the syntax −SELECT DATE_ADD('Any date’', INTERVAL 1 DAY) AS AliasName;Now, I am applying the above query to add a day with date in MySQL. The query is as follows −mysql> SELECT DATE_ADD('2018-10-08', INTERVAL 1 DAY) AS NextDay; After executing the above query, we will get the following output −+------------+ | NextDay | +------------+ | 2018-10-09 | +------------+ 1 row in set (0.00 sec)Therefore, in this sample output, I am adding a day with current date

Select Distinct vs Group By in MySQL

Chandu yadav
Updated on 25-Jun-2020 07:47:28

5K+ Views

SELECT DISTINCT can be used to give distinct values. Use it to remove duplicate records and it can be used with aggregate function as well. For example: MAX, AVG etc. This can be applied on a single column.Now, I am creating a table to use SELECT DISTINCT for a column. Creating a table with the help of CREATE command −mysql> CREATE TABLE DistinctDemo -> ( -> id int, -> name varchar(100) -> ); Query OK, 0 rows affected (0.64 sec)Inserting records −mysql> INSERT into DistinctDemo values(1, 'John'); Query OK, 1 row affected (0.17 sec) mysql> INSERT into DistinctDemo values(2, ... Read More

Choose Between window.URL.createObjectURL and window.webkitURL.createObjectURL

Chandu yadav
Updated on 25-Jun-2020 07:46:32

717 Views

To choose, you need to define a wrapper function −function display ( file ) {    if ( window.webkitURL ) {       return window.webkitURL.createObjectURL( file );    } else if ( window.URL && window.URL.createObjectURL ) {       return window.URL.display( file );    } else {    return null;    } }After that set it for cross-browser −var url = display( file );

Advertisements