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 = new Image(); myImg1.src = "http://oi62.tinypic.com/148yf7.jpg"; var Fpst = 60; var Player1Tank = { x: cw1 / 2, w: 85, h: 85, Pos: 3, draw: function () { ... Read More
If we want to check whether circles are colliding with each other or not, one way is by getting the distance between two centers of circles and subtracting the radius of each circle from that distanceWe also check if the distance is greater than 1. If we want to check it for 20 circles, then we need to calculate exact differences in distances. x/y positions of centers vs the radii.bs(x2 - x1) > (r2 + r1) abs(y2 - y1) > (r2 + r1)The circles cannot collide if the distance in X or Y between circle centers is greater than the ... Read More
Required arguments are the arguments passed to a function in correct positional order. Here, the number of arguments in the function call should match exactly with the function definition.To call the function printme(), you definitely need to pass one argument, otherwise it gives a syntax error as follows −Example Live Demo#!/usr/bin/python # Function definition is here def printme( str ): "This prints a passed string into this function" print str return; # Now you can call printme function printme()OutputWhen the above code is executed, it produces the following result −Traceback (most recent call last): File "test.py", line 11, in printme(); TypeError: ... Read More
This cannot be done through the visited state. The best solution is to add a random query to url so that page go unvisited.
MySQL NOW() and SYSDATE() functions returns the current timestamp values. But the output of both of them depends upon the execution time. This creates the big difference between them.NOW() function returns a steady time that indicates the time at which the particular statement began to execute. In contrast, SYSDATE() function returns the accurate time at which the statement executes. Following example will show the difference between these functions −mysql> Select NOW(), SLEEP(5), NOW(); +---------------------+----------+---------------------+ | NOW() | SLEEP(5) | NOW() | +---------------------+----------+---------------------+ | 2017-10-31 09:57:36 | ... Read More
There is no way to fade markers through API.However, markers can be simulated by creating Custom Overlay.Custom overlay usually contains a div with the help of which opacity can be controlled by javascript or jquery.In order to create effects or animations over Google Maps markers, we need a custom overlay.The marker can be added to map and it surely makes optimized: false optionvar newmarkerimg= $('#map_canvas img[src*="iconmarker "][class!="imageadjust "]');
If you want to open a file browser in JavaScript and then want to set a default directory same as the file folder, then we cannot do it since windows do not allow you to do so,so it is not possible. For example:C: :\AmitThis is mainly due to security risk involved to let web code to set any value on the machine.We can never be assured that even directory exists or not.
If we pass an invalid string as an argument to STR_TO_DATE() function then MySQL will return NULL as output along with a warning. Following is an example to understand the same −mysql> Select STR_TO_DATE('20173210', '%Y%d%m'); +-----------------------------------+ | STR_TO_DATE('20173210', '%Y%d%m') | +-----------------------------------+ | NULL | +-----------------------------------+ 1 row in set, 1 warning (0.00 sec)In the query above the string value is invalid because of wrong (32) day value. Hence it returns NULL values and a warning which is given below.mysql> Show warnings\G *************************** 1. row *************************** ... Read More
With the help of UPDATE statement and WHERE clause, we can update the values in single or multiple rows of the table. MySQL updates the values on the basis of condition specified in WHERE clause. For example, suppose in the ‘employee’ table we want to change the ‘name’ and ‘doj’ of the employee whose id is 1 then it can be done with the following query −mysql> UPDATE employee SET name = 'Gaurav', doj = '2010-02-01' WHERE id = 1; Query OK, 1 row affected (0.06 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from employee ... Read More
As we know that we can convert a time of datetime value to an integer by adding 0(+0) to them. In a similar way, we can convert the datetime value returned by FROM_UNIXTIME() function in numeric format. The following example will clarify it more −mysql> Select FROM_UNIXTIME(1555033470)+0 AS 'Date in Numeric Format'; +------------------------+ | Date in Numeric Format | +------------------------+ | 20190412071430.000000 | +------------------------+ 1 row in set (0.00 sec)After adding 0 (+0) to datetime value MySQL returns the numeric value up to 6 digits microseconds.
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP