Rishi Rathor has Published 142 Articles

Why it shows 0 instead of empty string whenever I insert an empty string into a MySQL column which is declared as NOT NULL?

Rishi Rathor

Rishi Rathor

Updated on 14-Feb-2020 06:22:42

1K+ Views

It is because inserting an empty string means that we are inserting some value and not NULL. The empty string apparently maps to zero as an integer. In other words, we can say that by inserting empty string we are providing a value to MySQL that has integer representation as ... Read More

Can a local variable's memory be accessed outside its scope in C/C++?

Rishi Rathor

Rishi Rathor

Updated on 11-Feb-2020 10:20:27

197 Views

Let us look at an example where you MIGHT be able to access a local variable's memory outside its scope.Example#include int* foo() {    int x = 3;    return &x; } int main() {    int* address = foo();    cout

What is pointer operator & in C++?

Rishi Rathor

Rishi Rathor

Updated on 10-Feb-2020 13:30:36

3K+ Views

C++ provides two pointer operators, which are Address of Operator (&) and Indirection Operator (*). A pointer is a variable that contains the address of another variable or you can say that a variable that contains the address of another variable is said to "point to" the other variable. A ... Read More

How can we get the list of tables in a particular database from MySQL Server command line?

Rishi Rathor

Rishi Rathor

Updated on 10-Feb-2020 06:46:34

280 Views

We need to use ‘mysqlshow’ client program along with the name of the database to get the list of tables in a particular database. Its syntax would be as follows −Mysqlshow – u root db_name [pat_matching]Here db_name would be the name of the database from which we want to get ... Read More

Draw part of an image inside HTML5 canvas

Rishi Rathor

Rishi Rathor

Updated on 30-Jan-2020 06:14:59

507 Views

If you want to draw part of an image inside canvas, the image onload function only fires once when the image first loads into the browser. Let us see the example:$(document).ready(function () {    var cw1 = 200;    var ch1 = 300;    var ctx1 = $("#myCanvas")[0].getContext("3d");    var myImg1 ... Read More

JS Geolocation but without prompting possible?

Rishi Rathor

Rishi Rathor

Updated on 29-Jan-2020 08:14:44

407 Views

No, you will not be able to prevent the prompt. It is a security feature because not every user would want to share its location.As stated by W3C:A conforming implementation of this specification must provide a mechanism that protects the user's privacy and this mechanism should ensure that no location ... Read More

Two way communication between the browsing contexts in HTML5

Rishi Rathor

Rishi Rathor

Updated on 29-Jan-2020 07:26:39

362 Views

Two-way communication between the browsing contexts is called channel messaging. It is useful for communication across multiple origins.While creating messageChannel, it internally creates two ports to send the data and forwarded to another browsing context.postMessage() − Post the message throw channelstart() − It sends the dataclose() − it close the ... Read More

How to use together the date and time format characters in MySQL DATE_FORMAT() function?

Rishi Rathor

Rishi Rathor

Updated on 29-Jan-2020 06:13:43

141 Views

We can use both the format characters together in DATE_FORMAT() function. The following example will clarify this −mysql> SELECT DATE_FORMAT(NOW(), 'The time is %a %h:%i:%s:%f %p'); +-----------------------------------------------------+ | DATE_FORMAT(NOW(), 'The time is %a %h:%i:%s:%f %p') | +-----------------------------------------------------+ | The time is Sun 06:35:06:000000 AM           ... Read More

HTML5 drawImage() method to draw image onto the canvas

Rishi Rathor

Rishi Rathor

Updated on 28-Jan-2020 10:23:53

335 Views

To draw image onto the canvas, use the HTML5 drawImage() method:                    function drawShape(){             // get the canvas element using the DOM             var canvas = document.getElementById('mycanvas');     ... Read More

How can we allow MySQL to store invalid dates?

Rishi Rathor

Rishi Rathor

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

326 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; +-------------+----------+--------------+ ... Read More

Previous 1 ... 6 7 8 9 10 ... 15 Next
Advertisements