Drawing Lines with Continuously Varying Line Width on HTML Canvas

Arjun Thakur
Updated on 25-Jun-2020 07:45:56

577 Views

To draw lines with continuously varying line width, you can try to run the following code −Examplevar context = document.getElementById('canvas1').getContext('2d'); var pts = [null, null, null, null]; for(var i=-1; i

Listen to Keydown Events in KineticJS Managed HTML5 Canvas

Rishi Rathor
Updated on 25-Jun-2020 07:45:02

138 Views

To listen to KeyDown events, use −if(keyIsPressed && keycode == somenumber) {    doSomething(); }To capture KeyDown −var canvas1 = layer.getCanvas()._canvas; $(canvas1).attr('tabindex', 1); canvas1.focus(); $(canvas1).keydown(function (event) {    console.log(event); });

Search Case-Insensitive in a Column Using LIKE Wildcard

Ankith Reddy
Updated on 25-Jun-2020 07:44:36

244 Views

We can do this with the help of lower() with column name. Firstly, we will create a table with the help of CREATE command.Creating a table −mysql> CREATE table InCaseSensDemo -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.50 sec)Inserting records into the table with the help of INSERT command −mysql> INSERT into InCaseSensDemo values('JOhN'); Query OK, 1 row affected (0.11 sec) mysql> INSERT into InCaseSensDemo values('bob'); Query OK, 1 row affected (0.21 sec) mysql> INSERT into InCaseSensDemo values('BoB'); Query OK, 1 row affected (0.13 sec) mysql> INSERT into InCaseSensDemo values('Bob'); Query OK, ... Read More

Alternatives to HTML5 iframe srcdoc

George John
Updated on 25-Jun-2020 07:44:29

584 Views

The HTML tag is used to create an inline frame.Example           HTML iframe Tag                   The srcdoc attribute specifies the HTML content of the page to show in the iframeAn alternative of the srcdoc attribute will be −var doc = document.querySelector('#demo').contentWindow.document; var content = ''; doc.open('text/html', 'replace'); doc.write(content); doc.close();

SQL Case-Sensitive String Comparison in MySQL

Arjun Thakur
Updated on 25-Jun-2020 07:44:14

832 Views

Firstly, we will create a table with the help of CREATE command.Creating a table −mysql> CREATE table InCaseSensDemo -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.50 sec)Inserting records into the table with the help of INSERT command −mysql> INSERT into InCaseSensDemo values('JOhN'); Query OK, 1 row affected (0.11 sec) mysql> INSERT into InCaseSensDemo values('bob'); Query OK, 1 row affected (0.21 sec) mysql> INSERT into InCaseSensDemo values('BoB'); Query OK, 1 row affected (0.13 sec) mysql> INSERT into InCaseSensDemo values('Bob'); Query OK, 1 row affected (0.18 sec)Displaying all the records with the help of ... Read More

Disable HTML5 sessionStorage: Can a User Do It?

Vrundesha Joshi
Updated on 25-Jun-2020 07:43:47

2K+ Views

Yes, a user can disable HTML5 sessionStorage.It is easy to prevent browsers from accepting localStorage and sessionStorage. Let us see the settings for web browsers −Firefox Type “about config” in the address bar and press. This would show the internal browser settings. Move to dom.storage.enabled“, you need to right-click and Toggle to disable the DOM Storage.In Internet Explorer, You need to select “Extras”, “Internet Options”, “Advanced” Tab. Now go to “Security” and uncheck “Enable DOM-Storage”Google Chrome In Google Chrome, you need to open “Options”, then select “Under the Hood” Tab.Click “Content settings…”, then select “Cookies” and you need to set ... Read More

Select Column Name with Spaces in MySQL

Ankith Reddy
Updated on 25-Jun-2020 07:43:38

20K+ Views

To select a column name with spaces, use the back tick symbol with column name. The symbol is ( ` `). Back tick is displayed in the keyboard below the tilde operator ( ~).Firstly, create a table −mysql> CREATE table SpaceColumn -> ( -> `Student Name` varchar(100) -> ); Query OK, 0 rows affected (0.48 sec)Inserting recordsmysql> INSERT into SpaceColumn values('John'); Query OK, 1 row affected (0.18 sec) mysql> INSERT into SpaceColumn values('Bob'); Query OK, 1 row affected (0.17 sec)The syntax to get column name with space is as follows −SELECT `column_name` from yourTableName; Now I will apply the ... Read More

Take Snapshot of HTML5 JavaScript Video Player

Ankith Reddy
Updated on 25-Jun-2020 07:42:59

811 Views

You can try to run the following code to take a snapshot of HTML5-JavaScript-based video player −Example                                       Snapshot                var video = document.querySelector('video');          var canvas = document.querySelector('canvas');          var context = canvas.getContext('2d');          var myWidth, myHeight, ratio;                    video.addEventListener('loadedmetadata', function() {             ratio = video.videoWidth/video.videoHeight;             myWidth = video.videoWidth-100;             myHeight = parseInt(w/ratio,10);             canvas.width = myWidth;             canvas.height = myHeight;          },false);          function snap() {             context.fillRect(0,0,myWidth,myHeight);             context.drawImage(video,0,0,myWidth,myHeight);          }          

HTML5 Canvas Text Stroke for Large Font Size

Arjun Thakur
Updated on 25-Jun-2020 07:42:11

273 Views

To draw large font properly in HTML5 Canvas, you can try to run the following code −var myCanvas = document.getElementById("myCanvas"); var context = myCanvas.getContext("2d"); context.font = '180pt Georgia'; context.strokeStyle = "#FF0000"; context.fillStyle = "#FFFFFF "; context.lineWidth = 34; context.fillText("Demo!",0,200); context.strokeText("Demo!",0,200);

HTML5 Geolocation in Safari 5

George John
Updated on 25-Jun-2020 07:40:03

1K+ Views

HTML5 Geolocation API lets you share your location with your favorite web sites. A JavaScript can capture your latitude and longitude, can be sent to backend web server, and do fancy location-aware things like finding local businesses or showing your location on a map.ExampleLet us see how to get the current position −                    function showLocation(position) {             var latitude = position.coords.latitude;             var longitude = position.coords.longitude;             alert("Latitude : " + latitude + " ... Read More

Advertisements