George John has Published 1081 Articles

C++ Program to Swap Numbers in Cyclic Order Using Call by Reference

George John

George John

Updated on 25-Jun-2020 09:26:39

1K+ Views

Three numbers can be swapped in cyclic order by passing them to a function cyclicSwapping() using call by reference. This function swaps the numbers in a cyclic fashion.The program to swap numbers in cyclic order using call by reference is given as follows −Example Live Demo#include using namespace std; void cyclicSwapping(int ... Read More

Usage of radial-gradient() CSS function

George John

George John

Updated on 25-Jun-2020 09:26:23

107 Views

Set a radial gradient as the background image, with radial-gradient() CSS function. You can try to run the following code to implement linear-gradient() function in CSSExampleLive Demo                    #demo {             height: 200px;             background: radial-gradient(green, orange, maroon);          }                     Setting background as radial gradient.          

getchar_unlocked() in C

George John

George John

Updated on 25-Jun-2020 09:16:19

422 Views

The function getchar_unlocked() is deprecated in Windows because it is a thread unsafe version of getchar(). It is suggested not to use getchar_unlocked(). There is no stream lock check that’s why getchar_unlocked is unsafe. The function getchar_unlocked() is faster than getchar().Here is the syntax of getchar_unlocked() in C language, int ... Read More

Specify the size of the rows in a CSS grid layout

George John

George John

Updated on 25-Jun-2020 09:00:09

118 Views

Use the grid-template-rows property to set the number of rows in a grid layoutExampleLive Demo                    .container {             display: grid;             background-color: green;             grid-template-rows: auto auto;             padding: 20px;             grid-gap: 20px;          }          .container > div {             background-color: orange;             border: 2px solid gray;             padding: 35px;             font-size: 30px;             text-align: center;          }          .ele1 {             grid-row-start: 1;             grid-row-end: 6;          }                     Game Board                1          2          3          4          5          6          

Check if table exist without using “select from” in MySQL?

George John

George John

Updated on 25-Jun-2020 08:32:17

227 Views

We can achieve this with the help of SHOW command. Firstly, I will use my database with the help of USE command −mysql> USE business; Database changedWe are in the “business” database now. After that, we can check that how many tables are available for this database. The query is ... Read More

How to check if a column exist in a MySQL table?

George John

George John

Updated on 25-Jun-2020 08:26:10

6K+ Views

To understand whether a column exist or not, we have the following approaches −With the help of DESC commandUsing SHOW commandFirstly, we will create a table with columns −mysql> CREATE table ColumnExistDemo -> ( -> UniqueId int, -> UniqueName varchar(200), -> UniqueAddress varchar(200) -> ); Query OK, 0 rows affected ... Read More

Usage of CSS grid-row-end property

George John

George John

Updated on 25-Jun-2020 08:20:01

60 Views

Set where to end the grid-items with CSS grid-row-start property.You can try to run the following code to implement the grid-row-end propertyExampleLive Demo                    .container {             display: grid;             grid-auto-rows: 50px;             grid-gap: 10px;             background-color: red;             padding: 10px;          }          .container>div {             background-color: yellow;             text-align: center;             padding:10px 0;             font-size: 20px;          }          .ele3 {             grid-row-end: span 2;          }                              1          2          3          4          5          6          

Is HTML5 canvas and image on polygon possible?

George John

George John

Updated on 25-Jun-2020 08:15:15

424 Views

Yes, it is possible. Create a pattern using the image, and then set the pattern to fillStyle.Here, obj is our image object −var context = canvas.getContext("2d"); var pattern = context.createPattern(obj, "repeat"); context.fillStyle = pattern;You need to manipulate the image to fit an arbitrary polygon −context.save(); context.setTransform(m11, m12, m21, m22, dx, ... Read More

How to remove leading and trailing whitespace in a MySQL field?

George John

George John

Updated on 25-Jun-2020 08:06:34

979 Views

To remove leading and trailing space, we can use the trim() in MySQL. Firstly, we will create a table with the help of CREATE command.Creating a table −mysql> CREATE table TrailingANdLeadingDemo -> ( -> SpaceTrailLead varchar(100) -> ); Query OK, 0 rows affected (0.57 sec)After creating a table, we will ... Read More

HTML5 Canvas Font Size Based on Canvas Size

George John

George John

Updated on 25-Jun-2020 08:05:40

835 Views

To scale fonts, let us see an example.Canvas: 800px Font Size: 60pxYou need to use the following code for our example to scale font size based on canvas −var fontBase = 800; var fontSize = 60; function getFont() {    var ratio = fontSize / fontBase;    var cSize = canvas.width * ratio;    return (cSize |0) + 'px sans-serif'; }

Advertisements